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>
|
<string name="storage_menu_explore">Explore</string>
|
||||||
<!-- Storage setting. Menu option for using the deletion helper. [CHAR LIMIT=30] -->
|
<!-- Storage setting. Menu option for using the deletion helper. [CHAR LIMIT=30] -->
|
||||||
<string name="storage_menu_free">Free up space</string>
|
<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]-->
|
<!-- Storage setting. Title for USB transfer settings [CHAR LIMIT=30]-->
|
||||||
<string name="storage_title_usb">USB computer connection</string>
|
<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]-->
|
<!-- 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>
|
<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>
|
</resources>
|
||||||
|
@@ -18,18 +18,32 @@
|
|||||||
xmlns:settings="http://schemas.android.com/apk/res-auto"
|
xmlns:settings="http://schemas.android.com/apk/res-auto"
|
||||||
android:title="@string/automatic_storage_manager_settings" >
|
android:title="@string/automatic_storage_manager_settings" >
|
||||||
|
|
||||||
<DropDownPreference
|
<PreferenceCategory
|
||||||
android:key="days"
|
android:key="automatic"
|
||||||
android:summary="%s"
|
android:title="@string/deletion_helper_automatic_title">
|
||||||
android:title="@string/automatic_storage_manager_days_title"
|
|
||||||
android:entries="@array/automatic_storage_management_days"
|
|
||||||
android:entryValues="@array/automatic_storage_management_days_values"/>
|
|
||||||
|
|
||||||
<com.android.settings.fuelgauge.WallOfTextPreference
|
<SwitchPreference
|
||||||
android:key="disclaimer"
|
android:key="storage_manager_active"
|
||||||
android:summary="@string/automatic_storage_manager_text"
|
android:title="@string/automatic_storage_manager_preference_title"
|
||||||
android:persistent="false"
|
android:summary="@string/automatic_storage_manager_text"/>
|
||||||
android:selectable="false"
|
|
||||||
settings:allowDividerAbove="true" />
|
<DropDownPreference
|
||||||
|
android:key="days"
|
||||||
|
android:summary="%s"
|
||||||
|
android:title="@string/automatic_storage_manager_days_title"
|
||||||
|
android:entries="@array/automatic_storage_management_days"
|
||||||
|
android:entryValues="@array/automatic_storage_management_days_values"/>
|
||||||
|
|
||||||
|
</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>
|
</PreferenceScreen>
|
@@ -21,6 +21,7 @@ import android.os.Bundle;
|
|||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.widget.Switch;
|
import android.widget.Switch;
|
||||||
|
import android.support.v14.preference.SwitchPreference;
|
||||||
import android.support.v7.preference.DropDownPreference;
|
import android.support.v7.preference.DropDownPreference;
|
||||||
import android.support.v7.preference.Preference;
|
import android.support.v7.preference.Preference;
|
||||||
import android.support.v7.preference.Preference.OnPreferenceChangeListener;
|
import android.support.v7.preference.Preference.OnPreferenceChangeListener;
|
||||||
@@ -38,11 +39,14 @@ import com.android.settings.widget.SwitchBar.OnSwitchChangeListener;
|
|||||||
* automatic storage manager.
|
* automatic storage manager.
|
||||||
*/
|
*/
|
||||||
public class AutomaticStorageManagerSettings extends SettingsPreferenceFragment implements
|
public class AutomaticStorageManagerSettings extends SettingsPreferenceFragment implements
|
||||||
OnSwitchChangeListener, OnPreferenceChangeListener {
|
OnPreferenceChangeListener, Preference.OnPreferenceClickListener {
|
||||||
private static final String KEY_DAYS = "days";
|
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 DropDownPreference mDaysToRetain;
|
||||||
|
private Preference mDeletionHelper;
|
||||||
|
private SwitchPreference mStorageManagerSwitch;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCreate(Bundle savedInstanceState) {
|
public void onCreate(Bundle savedInstanceState) {
|
||||||
@@ -53,33 +57,34 @@ public class AutomaticStorageManagerSettings extends SettingsPreferenceFragment
|
|||||||
@Override
|
@Override
|
||||||
public void onActivityCreated(Bundle savedInstanceState) {
|
public void onActivityCreated(Bundle savedInstanceState) {
|
||||||
super.onActivityCreated(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 = (DropDownPreference) findPreference(KEY_DAYS);
|
||||||
mDaysToRetain.setOnPreferenceChangeListener(this);
|
mDaysToRetain.setOnPreferenceChangeListener(this);
|
||||||
|
|
||||||
|
mDeletionHelper = findPreference(KEY_DELETION_HELPER);
|
||||||
|
mDeletionHelper.setOnPreferenceClickListener(this);
|
||||||
|
|
||||||
|
mStorageManagerSwitch = (SwitchPreference) findPreference(KEY_STORAGE_MANAGER_SWITCH);
|
||||||
|
mStorageManagerSwitch.setOnPreferenceChangeListener(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onResume() {
|
public void onResume() {
|
||||||
super.onResume();
|
super.onResume();
|
||||||
// TODO: Initialize the switch bar position based on if the storage manager is active.
|
mDaysToRetain.setEnabled(mStorageManagerSwitch.isChecked());
|
||||||
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);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onPreferenceChange(Preference preference, Object newValue) {
|
public boolean onPreferenceChange(Preference preference, Object newValue) {
|
||||||
// TODO: Configure a setting which controls how many days of data the storage manager
|
switch (preference.getKey()) {
|
||||||
// should retain.
|
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;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -88,12 +93,12 @@ public class AutomaticStorageManagerSettings extends SettingsPreferenceFragment
|
|||||||
return MetricsEvent.STORAGE_MANAGER_SETTINGS;
|
return MetricsEvent.STORAGE_MANAGER_SETTINGS;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void maybeShowDayDropdown(boolean shouldShow) {
|
@Override
|
||||||
PreferenceScreen screen = getPreferenceScreen();
|
public boolean onPreferenceClick(Preference preference) {
|
||||||
if (shouldShow) {
|
if (KEY_DELETION_HELPER.equals(preference.getKey())) {
|
||||||
screen.addPreference(mDaysToRetain);
|
startFragment(this, DeletionHelperFragment.class.getCanonicalName(),
|
||||||
} else {
|
R.string.deletion_helper_title, 0, null);
|
||||||
screen.removePreference(mDaysToRetain);
|
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -170,7 +170,7 @@ public class PrivateVolumeSettings extends SettingsPreferenceFragment {
|
|||||||
mCurrentUser = mUserManager.getUserInfo(UserHandle.myUserId());
|
mCurrentUser = mUserManager.getUserInfo(UserHandle.myUserId());
|
||||||
|
|
||||||
mExplore = buildAction(R.string.storage_menu_explore);
|
mExplore = buildAction(R.string.storage_menu_explore);
|
||||||
mAutomaticStorageManagement = buildAction(R.string.storage_settings);
|
mAutomaticStorageManagement = buildAction(R.string.storage_menu_manage);
|
||||||
|
|
||||||
mNeedsUpdate = true;
|
mNeedsUpdate = true;
|
||||||
|
|
||||||
@@ -485,7 +485,7 @@ public class PrivateVolumeSettings extends SettingsPreferenceFragment {
|
|||||||
case R.string.storage_menu_explore: {
|
case R.string.storage_menu_explore: {
|
||||||
intent = mSharedVolume.buildBrowseIntent();
|
intent = mSharedVolume.buildBrowseIntent();
|
||||||
} break;
|
} break;
|
||||||
case R.string.storage_settings: {
|
case R.string.storage_menu_manage: {
|
||||||
startFragment(this, AutomaticStorageManagerSettings.class.getCanonicalName(),
|
startFragment(this, AutomaticStorageManagerSettings.class.getCanonicalName(),
|
||||||
R.string.automatic_storage_manager_settings, 0, null);
|
R.string.automatic_storage_manager_settings, 0, null);
|
||||||
return true;
|
return true;
|
||||||
|
Reference in New Issue
Block a user