From: jabarros Date: Wed, 12 Nov 2014 11:46:33 +0000 (+0100) Subject: Create static var for defining 'content://' String into FileDisplayActivity and delet... X-Git-Tag: oc-android-1.7.0_signed~101^2~8 X-Git-Url: http://git.linex4red.de/pub/Android/ownCloud.git/commitdiff_plain/e4d6f267f7373aeac535747cb05e48e6dfc7e166?ds=inline Create static var for defining 'content://' String into FileDisplayActivity and delete some unnecessary comments --- diff --git a/src/com/owncloud/android/ui/activity/FileDisplayActivity.java b/src/com/owncloud/android/ui/activity/FileDisplayActivity.java index 2469dcf7..c258498e 100644 --- a/src/com/owncloud/android/ui/activity/FileDisplayActivity.java +++ b/src/com/owncloud/android/ui/activity/FileDisplayActivity.java @@ -157,7 +157,9 @@ OnSslUntrustedCertListener, OnEnforceableRefreshListener { private String DIALOG_UNTRUSTED_CERT; private OCFile mWaitingToSend; - + + private static final String URI_TYPE_OF_CONTENT_PROVIDER = "content://"; + @Override protected void onCreate(Bundle savedInstanceState) { Log_OC.d(TAG, "onCreate() start"); @@ -694,20 +696,14 @@ OnSslUntrustedCertListener, OnEnforceableRefreshListener { if (!remotepath.endsWith(OCFile.PATH_SEPARATOR)) remotepath += OCFile.PATH_SEPARATOR; - if (filepath.startsWith("content://")) { + if (filepath.startsWith(URI_TYPE_OF_CONTENT_PROVIDER)) { // The query, since it only applies to a single document, will only return - // one row. There's no need to filter, sort, or select fields, since we want - // all fields for one document. + // one row. Cursor cursor = MainApp.getAppContext().getContentResolver() .query(Uri.parse(filepath), null, null, null, null, null); try { - // moveToFirst() returns false if the cursor has 0 rows. Very handy for - // "if there's anything to look at, look at it" conditionals. if (cursor != null && cursor.moveToFirst()) { - - // Note it's called "Display Name". This is - // provider-specific, and might not necessarily be the file name. String displayName = cursor.getString( cursor.getColumnIndex(OpenableColumns.DISPLAY_NAME)); Log.i(TAG, "Display Name: " + displayName); @@ -950,7 +946,7 @@ OnSslUntrustedCertListener, OnEnforceableRefreshListener { return getDataColumn(getApplicationContext(), contentUri, selection, selectionArgs); } // Documents providers returned as content://... - else if (isAContentDocument(uri)) { + else if (isContentDocument(uri)) { return uri.toString(); } } @@ -1031,23 +1027,14 @@ OnSslUntrustedCertListener, OnEnforceableRefreshListener { public static boolean isGooglePhotosUri(Uri uri) { return "com.google.android.apps.photos.content".equals(uri.getAuthority()); } - - /** - * - * @param uri The Uri to check. - * @return Whether the Uri authority is Google Drive. - */ - public static boolean isGoogleDriveDocument(Uri uri) { - return "com.google.android.apps.docs.storage".equals(uri.getAuthority()); - } /** * * @param uri The Uri to check. * @return Whether the Uri is from a content provider as kind "content://..." */ - public static boolean isAContentDocument(Uri uri) { - return uri.toString().startsWith("content://"); + public static boolean isContentDocument(Uri uri) { + return uri.toString().startsWith(URI_TYPE_OF_CONTENT_PROVIDER); } /**