瀏覽代碼

initially show instant upload feature revamp message if instant upload has been used/active with the legacy preferences

AndyScherzinger 8 年之前
父節點
當前提交
a3cf129281

+ 1 - 0
res/values/strings.xml

@@ -503,6 +503,7 @@
     <string name="folder_sync_no_results">No media folders found.</string>
     <string name="folder_sync_preferences">Folder Sync Preferences</string>
     <string name="folder_sync_settings">Settings</string>
+    <string name="folder_sync_new_info">Instant upload has been revamped completely. Please see the main menu and re-configure your instant upload. Sorry for the inconvenience.\n\nEnjoy the new and extended instant upload capabilities!</string>
     <plurals name="items_selected_count">
         <!--
              As a developer, you should always supply "one" and "other"

+ 1 - 2
src/com/owncloud/android/db/PreferenceManager.java

@@ -22,7 +22,6 @@ package com.owncloud.android.db;
 import android.content.Context;
 import android.content.SharedPreferences;
 
-import com.owncloud.android.files.services.FileUploader;
 import com.owncloud.android.utils.FileStorageUtils;
 
 /**
@@ -160,7 +159,7 @@ public abstract class PreferenceManager {
         saveIntPreference(context, AUTO_PREF__UPLOADER_BEHAVIOR, uploaderBehaviour);
     }
 
-    private static void saveBooleanPreference(Context context, String key, boolean value) {
+    public static void saveBooleanPreference(Context context, String key, boolean value) {
         SharedPreferences.Editor appPreferences = getDefaultSharedPreferences(context.getApplicationContext()).edit();
         appPreferences.putBoolean(key, value);
         appPreferences.apply();

+ 38 - 0
src/com/owncloud/android/ui/activity/FileDisplayActivity.java

@@ -56,6 +56,7 @@ import com.owncloud.android.MainApp;
 import com.owncloud.android.R;
 import com.owncloud.android.datamodel.FileDataStorageManager;
 import com.owncloud.android.datamodel.OCFile;
+import com.owncloud.android.db.PreferenceManager;
 import com.owncloud.android.files.services.FileDownloader;
 import com.owncloud.android.files.services.FileDownloader.FileDownloaderBinder;
 import com.owncloud.android.files.services.FileUploader;
@@ -236,6 +237,43 @@ public class FileDisplayActivity extends HookActivity
         // always AFTER setContentView(...) in onCreate(); to work around bug in its implementation
 
         setBackgroundText();
+
+        upgradeNotificationForInstantUpload();
+    }
+
+    /**
+     * For Android 5+.
+     * Opens a pop up info for the new instant upload and disabled the old instant upload.
+     */
+    private void upgradeNotificationForInstantUpload() {
+        // check for Android 5+ if legacy instant upload is activated --> disable + show info
+        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
+            if (PreferenceManager.instantPictureUploadEnabled(this) || PreferenceManager.instantPictureUploadEnabled
+                    (this)) {
+                PreferenceManager.saveBooleanPreference(this, "instant_uploading", false);
+                PreferenceManager.saveBooleanPreference(this, "instant_video_uploading", false);
+
+                // show info pop-up
+                new AlertDialog.Builder(this, R.style.Theme_ownCloud_Dialog)
+                        .setTitle(R.string.drawer_folder_sync)
+                        .setMessage(R.string.folder_sync_new_info)
+                        .setPositiveButton(R.string.drawer_open, new DialogInterface.OnClickListener() {
+                            public void onClick(DialogInterface dialog, int which) {
+                                // show instant upload
+                                Intent folderSyncIntent = new Intent(getApplicationContext(), FolderSyncActivity.class);
+                                dialog.dismiss();
+                                startActivity(folderSyncIntent);
+                            }
+                        })
+                        .setNegativeButton(R.string.drawer_close, new DialogInterface.OnClickListener() {
+                            public void onClick(DialogInterface dialog, int which) {
+                                dialog.dismiss();
+                            }
+                        })
+                        .setIcon(R.drawable.ic_cloud_upload)
+                        .show();
+            }
+        }
     }
 
     @Override