mirror of
https://github.com/owncloud/android-library.git
synced 2026-08-15 02:13:00 +00:00
Move constants and utils to proper files
This commit is contained in:
@@ -53,6 +53,7 @@ import static com.owncloud.android.lib.common.http.HttpConstants.OC_X_REQUEST_ID
|
||||
public class OwnCloudClient extends HttpClient {
|
||||
|
||||
public static final String WEBDAV_FILES_PATH_4_0 = "/remote.php/dav/files/";
|
||||
public static final String WEBDAV_PATH_4_0_AND_LATER = "/remote.php/dav";
|
||||
private static final String WEBDAV_UPLOADS_PATH_4_0 = "/remote.php/dav/uploads/";
|
||||
public static final String STATUS_PATH = "/status.php";
|
||||
|
||||
|
||||
-2
@@ -329,7 +329,5 @@ public class AccountUtils {
|
||||
* OAuth2 scope
|
||||
*/
|
||||
public static final String KEY_OAUTH2_SCOPE = "oc_oauth2_scope";
|
||||
|
||||
public static final String WEBDAV_PATH_4_0_AND_LATER = "/remote.php/dav";
|
||||
}
|
||||
}
|
||||
|
||||
+29
@@ -34,6 +34,8 @@ import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.Locale;
|
||||
|
||||
import static com.owncloud.android.lib.common.OwnCloudClient.WEBDAV_PATH_4_0_AND_LATER;
|
||||
|
||||
public class WebdavUtils {
|
||||
public static final SimpleDateFormat DISPLAY_DATE_FORMAT = new SimpleDateFormat(
|
||||
"dd.MM.yyyy hh:mm");
|
||||
@@ -120,4 +122,31 @@ public class WebdavUtils {
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public static String trimWebdavSuffix(String url) {
|
||||
if (url == null) {
|
||||
url = "";
|
||||
} else {
|
||||
if (url.endsWith("/")) {
|
||||
url = url.substring(0, url.length() - 1);
|
||||
}
|
||||
if (url.toLowerCase().endsWith(WEBDAV_PATH_4_0_AND_LATER)) {
|
||||
url = url.substring(0, url.length() - WEBDAV_PATH_4_0_AND_LATER.length());
|
||||
}
|
||||
}
|
||||
return url;
|
||||
}
|
||||
|
||||
public static String normalizeProtocolPrefix(String url, boolean isSslConn) {
|
||||
if (!url.toLowerCase().startsWith("http://") &&
|
||||
!url.toLowerCase().startsWith("https://")) {
|
||||
if (isSslConn) {
|
||||
return "https://" + url;
|
||||
} else {
|
||||
return "http://" + url;
|
||||
}
|
||||
}
|
||||
return url;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user