Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 7d11a098 authored by Stephen Bird's avatar Stephen Bird
Browse files

Manage Storage Sources: intent to settings properly

Change-Id: Icc6a5680be3174db5de5e0abb9123691ec620911
parent 418a152a
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -743,6 +743,8 @@
    <string name="pref_secure_storage_reset_password_title">Change password</string>
    <!-- Preferences - Storage - Secure Storage - Delete storage title -->
    <string name="pref_secure_storage_delete_storage_title">Delete storage</string>
    <!-- Preferences - Storage - Manage storage title -->
    <string name="pref_manage_storage_sources_title">Manage storage sources</string>
    <!-- Preferences - Editor - Behaviour category -->
    <string name="pref_editor_behaviour_category">Behaviour</string>
    <!-- Preferences - Editor - No suggestions -->
+5 −0
Original line number Diff line number Diff line
@@ -17,6 +17,11 @@
<PreferenceScreen
  xmlns:android="http://schemas.android.com/apk/res/android">

    <!-- Reset password -->
    <Preference
            android:key="manage_storage_sources"
            android:title="@string/pref_manage_storage_sources_title"/>

    <!-- Secure Storage -->
    <PreferenceCategory
      android:key="secure_storage"
+1 −1
Original line number Diff line number Diff line
@@ -519,7 +519,7 @@ public class MainActivity extends ActionBarActivity
                break;
            case R.id.navigation_item_manage:
                if (DEBUG) Log.d(TAG, "onNavigationItemSelected::navigation_item_manage");
                StorageProviderUtils.loadProviderLogin(this);
                StorageProviderUtils.manageStorageSources(this);
                break;
            case R.id.navigation_item_settings:
                if (DEBUG) Log.d(TAG, "onNavigationItemSelected::navigation_item_settings");
+8 −0
Original line number Diff line number Diff line
@@ -31,6 +31,7 @@ import com.cyanogenmod.filemanager.R;
import com.cyanogenmod.filemanager.console.secure.SecureConsole;
import com.cyanogenmod.filemanager.preferences.FileManagerSettings;
import com.cyanogenmod.filemanager.preferences.Preferences;
import com.cyanogenmod.filemanager.util.StorageProviderUtils;

/**
 * A class that manages the storage options
@@ -43,8 +44,10 @@ public class StoragePreferenceFragment extends TitlePreferenceFragment {

    private static final String KEY_RESET_PASSWORD = "secure_storage_reset_password";
    private static final String KEY_DELETE_STORAGE = "secure_storage_delete_storage";
    private static final String KEY_MANAGE_STORAGE = "manage_storage_sources";

    private Preference mResetPassword;
    private Preference mManageStorageSources;
    private Preference mDeleteStorage;
    private SwitchPreference mDelayedSync;

@@ -81,6 +84,8 @@ public class StoragePreferenceFragment extends TitlePreferenceFragment {
                getSecureConsole().requestReset(getActivity());
            } else if (preference.equals(mDeleteStorage)) {
                getSecureConsole().requestDelete(getActivity());
            } else if (preference.equals(mManageStorageSources)) {
                StorageProviderUtils.manageStorageSources(getActivity());
            }
            return false;
        }
@@ -136,6 +141,9 @@ public class StoragePreferenceFragment extends TitlePreferenceFragment {
        mDeleteStorage = findPreference(KEY_DELETE_STORAGE);
        mDeleteStorage.setOnPreferenceClickListener(mOnClickListener);

        mManageStorageSources = findPreference(KEY_MANAGE_STORAGE);
        mManageStorageSources.setOnPreferenceClickListener(mOnClickListener);

        // Delayed sync
        this.mDelayedSync =
                (SwitchPreference)findPreference(
+11 −0
Original line number Diff line number Diff line
@@ -68,6 +68,8 @@ public final class StorageProviderUtils {
    public static final String CACHE_DIR = ".storage-provider-files";
    private static final String DEFAULT_MIMETYPE = "text/plain";
    private static final String CLOUD_STORAGE_LOGIN = "android.settings.CLOUD_STORAGE_LOGIN";
    private static final String INTERNAL_STORAGE_SETTINGS
            = "android.settings.INTERNAL_STORAGE_SETTINGS";

    private static final String TAG = StorageProviderUtils.class.getSimpleName();

@@ -589,4 +591,13 @@ public final class StorageProviderUtils {
        settingsIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
        ctx.startActivity(settingsIntent);
    }

    /*
     * Start Intent for manage storage sources
     */
    public static void manageStorageSources(Context context) {
        Intent intent = new Intent();
        intent.setAction(INTERNAL_STORAGE_SETTINGS);
        context.startActivity(intent);
    }
}