Update the storage manager settings to match the mocks.
Bug: 28560570 Change-Id: I0f218da1d23b687e38c52b5a927f7b84645958c7
This commit is contained in:
@@ -2458,6 +2458,8 @@
|
||||
<string name="storage_menu_explore">Explore</string>
|
||||
<!-- Storage setting. Menu option for using the deletion helper. [CHAR LIMIT=30] -->
|
||||
<string name="storage_menu_free">Free up space</string>
|
||||
<!-- Storage setting. Menu option for accessing the storage manager settings. [CHAR LIMIT=30] -->
|
||||
<string name="storage_menu_manage">Manage storage</string>
|
||||
|
||||
<!-- Storage setting. Title for USB transfer settings [CHAR LIMIT=30]-->
|
||||
<string name="storage_title_usb">USB computer connection</string>
|
||||
@@ -7637,4 +7639,16 @@
|
||||
<!-- Summary for the apps category in the deletion helper, showing how many space to clear. [CHAR LIMIT=NONE]-->
|
||||
<string name="deletion_helper_apps_group_summary"><xliff:g id="used" example="1.2GB">%1$s</xliff:g></string>
|
||||
|
||||
<!-- Category title for the automatic settings in the storage manager settings. [CHAR LIMIT=40] -->
|
||||
<string name="deletion_helper_automatic_title">Automatic</string>
|
||||
|
||||
<!-- Category title for the manual settings in the storage manager settings. [CHAR LIMIT=40] -->
|
||||
<string name="deletion_helper_manual_title">Manual</string>
|
||||
|
||||
<!-- Preference menu title for accessing the deletion helper from the storage manager settings. [CHAR LIMIT=30]-->
|
||||
<string name="deletion_helper_preference_title">Free space now</string>
|
||||
|
||||
<!-- Preference title for the automatic storage manager toggle. [CHAR LIMIT=60]-->
|
||||
<string name="automatic_storage_manager_preference_title">Storage manager</string>
|
||||
|
||||
</resources>
|
||||
|
@@ -18,6 +18,15 @@
|
||||
xmlns:settings="http://schemas.android.com/apk/res-auto"
|
||||
android:title="@string/automatic_storage_manager_settings" >
|
||||
|
||||
<PreferenceCategory
|
||||
android:key="automatic"
|
||||
android:title="@string/deletion_helper_automatic_title">
|
||||
|
||||
<SwitchPreference
|
||||
android:key="storage_manager_active"
|
||||
android:title="@string/automatic_storage_manager_preference_title"
|
||||
android:summary="@string/automatic_storage_manager_text"/>
|
||||
|
||||
<DropDownPreference
|
||||
android:key="days"
|
||||
android:summary="%s"
|
||||
@@ -25,11 +34,16 @@
|
||||
android:entries="@array/automatic_storage_management_days"
|
||||
android:entryValues="@array/automatic_storage_management_days_values"/>
|
||||
|
||||
<com.android.settings.fuelgauge.WallOfTextPreference
|
||||
android:key="disclaimer"
|
||||
android:summary="@string/automatic_storage_manager_text"
|
||||
android:persistent="false"
|
||||
android:selectable="false"
|
||||
settings:allowDividerAbove="true" />
|
||||
</PreferenceCategory>
|
||||
|
||||
<PreferenceCategory
|
||||
android:key="manual"
|
||||
android:title="@string/deletion_helper_manual_title">
|
||||
|
||||
<Preference
|
||||
android:key="deletion_helper"
|
||||
android:title="@string/deletion_helper_preference_title"/>
|
||||
|
||||
</PreferenceCategory>
|
||||
|
||||
</PreferenceScreen>
|
@@ -21,6 +21,7 @@ import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.widget.Switch;
|
||||
import android.support.v14.preference.SwitchPreference;
|
||||
import android.support.v7.preference.DropDownPreference;
|
||||
import android.support.v7.preference.Preference;
|
||||
import android.support.v7.preference.Preference.OnPreferenceChangeListener;
|
||||
@@ -38,11 +39,14 @@ import com.android.settings.widget.SwitchBar.OnSwitchChangeListener;
|
||||
* automatic storage manager.
|
||||
*/
|
||||
public class AutomaticStorageManagerSettings extends SettingsPreferenceFragment implements
|
||||
OnSwitchChangeListener, OnPreferenceChangeListener {
|
||||
OnPreferenceChangeListener, Preference.OnPreferenceClickListener {
|
||||
private static final String KEY_DAYS = "days";
|
||||
private static final String KEY_DELETION_HELPER = "deletion_helper";
|
||||
private static final String KEY_STORAGE_MANAGER_SWITCH = "storage_manager_active";
|
||||
|
||||
private SwitchBar mSwitchBar;
|
||||
private DropDownPreference mDaysToRetain;
|
||||
private Preference mDeletionHelper;
|
||||
private SwitchPreference mStorageManagerSwitch;
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
@@ -53,33 +57,34 @@ public class AutomaticStorageManagerSettings extends SettingsPreferenceFragment
|
||||
@Override
|
||||
public void onActivityCreated(Bundle savedInstanceState) {
|
||||
super.onActivityCreated(savedInstanceState);
|
||||
Activity activity = getActivity();
|
||||
mSwitchBar = ((SettingsActivity) activity).getSwitchBar();
|
||||
mSwitchBar.show();
|
||||
mSwitchBar.addOnSwitchChangeListener(this);
|
||||
// TODO: Initialize the switch bar position based on if the storage manager is active.
|
||||
|
||||
mDaysToRetain = (DropDownPreference) findPreference(KEY_DAYS);
|
||||
mDaysToRetain.setOnPreferenceChangeListener(this);
|
||||
|
||||
mDeletionHelper = findPreference(KEY_DELETION_HELPER);
|
||||
mDeletionHelper.setOnPreferenceClickListener(this);
|
||||
|
||||
mStorageManagerSwitch = (SwitchPreference) findPreference(KEY_STORAGE_MANAGER_SWITCH);
|
||||
mStorageManagerSwitch.setOnPreferenceChangeListener(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
// TODO: Initialize the switch bar position based on if the storage manager is active.
|
||||
maybeShowDayDropdown(mSwitchBar.isChecked());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSwitchChanged(Switch switchView, boolean isChecked) {
|
||||
// TODO: Flip a setting which controls if the storage manager should run.
|
||||
maybeShowDayDropdown(isChecked);
|
||||
mDaysToRetain.setEnabled(mStorageManagerSwitch.isChecked());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onPreferenceChange(Preference preference, Object newValue) {
|
||||
switch (preference.getKey()) {
|
||||
case KEY_STORAGE_MANAGER_SWITCH:
|
||||
boolean checked = (boolean) newValue;
|
||||
mDaysToRetain.setEnabled(checked);
|
||||
break;
|
||||
case KEY_DAYS:
|
||||
// TODO: Configure a setting which controls how many days of data the storage manager
|
||||
// should retain.
|
||||
break;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -88,12 +93,12 @@ public class AutomaticStorageManagerSettings extends SettingsPreferenceFragment
|
||||
return MetricsEvent.STORAGE_MANAGER_SETTINGS;
|
||||
}
|
||||
|
||||
private void maybeShowDayDropdown(boolean shouldShow) {
|
||||
PreferenceScreen screen = getPreferenceScreen();
|
||||
if (shouldShow) {
|
||||
screen.addPreference(mDaysToRetain);
|
||||
} else {
|
||||
screen.removePreference(mDaysToRetain);
|
||||
}
|
||||
@Override
|
||||
public boolean onPreferenceClick(Preference preference) {
|
||||
if (KEY_DELETION_HELPER.equals(preference.getKey())) {
|
||||
startFragment(this, DeletionHelperFragment.class.getCanonicalName(),
|
||||
R.string.deletion_helper_title, 0, null);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@@ -170,7 +170,7 @@ public class PrivateVolumeSettings extends SettingsPreferenceFragment {
|
||||
mCurrentUser = mUserManager.getUserInfo(UserHandle.myUserId());
|
||||
|
||||
mExplore = buildAction(R.string.storage_menu_explore);
|
||||
mAutomaticStorageManagement = buildAction(R.string.storage_settings);
|
||||
mAutomaticStorageManagement = buildAction(R.string.storage_menu_manage);
|
||||
|
||||
mNeedsUpdate = true;
|
||||
|
||||
@@ -485,7 +485,7 @@ public class PrivateVolumeSettings extends SettingsPreferenceFragment {
|
||||
case R.string.storage_menu_explore: {
|
||||
intent = mSharedVolume.buildBrowseIntent();
|
||||
} break;
|
||||
case R.string.storage_settings: {
|
||||
case R.string.storage_menu_manage: {
|
||||
startFragment(this, AutomaticStorageManagerSettings.class.getCanonicalName(),
|
||||
R.string.automatic_storage_manager_settings, 0, null);
|
||||
return true;
|
||||
|
Reference in New Issue
Block a user