Browse Source

extract authority to image_cache_provider_authority

tobiasKaminsky 7 năm trước cách đây
mục cha
commit
6574af5435

+ 1 - 1
src/main/AndroidManifest.xml

@@ -187,7 +187,7 @@
 
         <provider
             android:name=".providers.DiskLruImageCacheFileProvider"
-            android:authorities="org.nextcloud.imageCache.provider"
+            android:authorities="@string/image_cache_provider_authority"
             android:exported="true">
         </provider>
 

+ 0 - 1
src/main/java/com/owncloud/android/providers/DiskLruImageCacheFileProvider.java

@@ -42,7 +42,6 @@ import java.io.FileNotFoundException;
 import java.io.FileOutputStream;
 
 public class DiskLruImageCacheFileProvider extends ContentProvider {
-    public static final String AUTHORITY = "org.nextcloud.imageCache.provider";
     public static final String TAG = DiskLruImageCacheFileProvider.class.getSimpleName();
 
     @Override

+ 3 - 2
src/main/java/com/owncloud/android/ui/helpers/FileOperationsHelper.java

@@ -44,7 +44,6 @@ import com.owncloud.android.lib.common.utils.Log_OC;
 import com.owncloud.android.lib.resources.shares.OCShare;
 import com.owncloud.android.lib.resources.shares.ShareType;
 import com.owncloud.android.lib.resources.status.OwnCloudVersion;
-import com.owncloud.android.providers.DiskLruImageCacheFileProvider;
 import com.owncloud.android.services.OperationsService;
 import com.owncloud.android.services.observer.FileObserverService;
 import com.owncloud.android.ui.activity.FileActivity;
@@ -498,10 +497,12 @@ public class FileOperationsHelper {
 
     public void sendCachedImage(OCFile file) {
         if (file != null) {
+            Context context = MainApp.getAppContext();
             Intent sendIntent = new Intent(Intent.ACTION_SEND);
             // set MimeType
             sendIntent.setType(file.getMimetype());
-            sendIntent.putExtra(Intent.EXTRA_STREAM, Uri.parse("content://" + DiskLruImageCacheFileProvider.AUTHORITY +
+            sendIntent.putExtra(Intent.EXTRA_STREAM, Uri.parse("content://" +
+                    context.getResources().getString(R.string.image_cache_provider_authority) +
                     file.getRemotePath()));
             sendIntent.putExtra(Intent.ACTION_SEND, true);      // Send Action
 

+ 1 - 0
src/main/res/values/setup.xml

@@ -11,6 +11,7 @@
     <string name="users_and_groups_share_with">com.nextcloud.android.providers.UsersAndGroupsSearchProvider.action.SHARE_WITH</string>
     <string name="document_provider_authority">org.nextcloud.documents</string>
     <string name="file_provider_authority">org.nextcloud.files</string>
+    <string name="image_cache_provider_authority">org.nextcloud.imageCache.provider</string>
     <string name ="db_file">nextcloud.db</string>
     <string name ="db_name">nextcloud</string>
     <string name ="data_folder">nextcloud</string>