Loading res/drawable/ic_keyboard_arrow_down_black_32.xml 0 → 100644 +25 −0 Original line number Diff line number Diff line <?xml version="1.0" encoding="utf-8"?> <!-- Copyright (C) 2016 The Android Open Source Project Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. --> <vector xmlns:android="http://schemas.android.com/apk/res/android" android:width="32dp" android:height="32dp" android:viewportWidth="24.0" android:viewportHeight="24.0"> <path android:fillColor="#FF000000" android:pathData="M7.41,7.84L12,12.42l4.59,-4.58L18,9.25l-6,6 -6,-6z"/> </vector> No newline at end of file res/drawable/ic_keyboard_arrow_up_black_32.xml 0 → 100644 +25 −0 Original line number Diff line number Diff line <?xml version="1.0" encoding="utf-8"?> <!-- Copyright (C) 2016 The Android Open Source Project Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. --> <vector xmlns:android="http://schemas.android.com/apk/res/android" android:width="32dp" android:height="32dp" android:viewportWidth="24.0" android:viewportHeight="24.0"> <path android:fillColor="#FF000000" android:pathData="M7.41,15.41L12,10.83l4.59,4.58L18,14l-6,-6 -6,6z"/> </vector> No newline at end of file res/values/strings.xml +6 −0 Original line number Diff line number Diff line Loading @@ -7627,4 +7627,10 @@ <!-- Button to activate the storage manager on the storage manager upsell. [CHAR LIMIT=20]--> <string name="deletion_helper_upsell_activate">Turn on</string> <!-- Title for the apps category in the deletion helper, showing how many apps to delete. [CHAR LIMIT=40]--> <string name="deletion_helper_apps_group_title">Apps (<xliff:g id="num_items">%1$d</xliff:g>)</string> <!-- 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> </resources> res/xml/deletion_helper_list.xml +3 −3 Original line number Diff line number Diff line Loading @@ -23,8 +23,8 @@ <com.android.settings.deletionhelper.DownloadsDeletionPreference android:key="delete_downloads" /> <PreferenceCategory <com.android.settings.CollapsibleCheckboxPreferenceGroup android:key="apps_group" android:title="@string/deletion_helper_apps_title" /> android:icon="@drawable/ic_keyboard_arrow_down_black_32"/> </PreferenceScreen> src/com/android/settings/CollapsibleCheckboxPreferenceGroup.java 0 → 100644 +147 −0 Original line number Diff line number Diff line /* * Copyright (C) 2016 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.android.settings; import android.content.Context; import android.support.v7.preference.Preference; import android.support.v7.preference.PreferenceGroup; import android.support.v7.preference.PreferenceViewHolder; import android.util.AttributeSet; import android.util.Log; import android.util.TypedValue; import android.view.View; import android.widget.Checkable; import android.widget.TextView; import java.util.LinkedHashMap; /** * CollapsibleCheckboxPreferenceGroup is a preference group that can be expanded or collapsed and * also has a checkbox. */ public class CollapsibleCheckboxPreferenceGroup extends PreferenceGroup implements View.OnClickListener { private boolean mCollapsed; private boolean mChecked; public CollapsibleCheckboxPreferenceGroup(Context context) { this(context, null); } public CollapsibleCheckboxPreferenceGroup(Context context, AttributeSet attrs) { super(context, attrs); setWidgetLayoutResource(com.android.settings.R.layout.preference_widget_checkbox); } @Override public void onBindViewHolder(PreferenceViewHolder holder) { super.onBindViewHolder(holder); View checkbox = holder.findViewById(com.android.internal.R.id.checkbox); if (checkbox != null && checkbox instanceof Checkable) { ((Checkable) checkbox).setChecked(mChecked); checkbox.setClickable(true); checkbox.setFocusable(true); checkbox.setOnClickListener(this); } final TextView titleView = (TextView) holder.findViewById(android.R.id.title); if (titleView != null) { Context context = getContext(); TypedValue value = new TypedValue(); context.getTheme().resolveAttribute(android.R.attr.colorAccent, value, true); titleView.setTextColor(context.getColor(value.resourceId)); } } @Override public boolean addPreference(Preference p) { super.addPreference(p); p.setVisible(!isCollapsed()); return true; } // The preference click handler. @Override protected void onClick() { super.onClick(); setCollapse(!isCollapsed()); } // The checkbox view click handler. @Override public void onClick(View v) { setChecked(!isChecked()); } /** * Return if the view is collapsed. */ public boolean isCollapsed() { return mCollapsed; } /** * Returns the checked state of the preference. */ public boolean isChecked() { return mChecked; } /** * Sets the checked state and notifies listeners of the state change. */ public void setChecked(boolean checked) { if (mChecked != checked) { mChecked = checked; callChangeListener(checked); notifyDependencyChange(shouldDisableDependents()); notifyChanged(); } } private void setCollapse(boolean isCollapsed) { if (mCollapsed == isCollapsed) { return; } mCollapsed = isCollapsed; if (isCollapsed) { hideDropdownPreferences(); } else { showDropdownPreferences(); } } private void showDropdownPreferences() { setAllPreferencesVisibility(true); setIcon(R.drawable.ic_keyboard_arrow_down_black_32); } private void hideDropdownPreferences() { setAllPreferencesVisibility(false); setIcon(R.drawable.ic_keyboard_arrow_up_black_32); } private void setAllPreferencesVisibility(boolean visible) { for (int i = 0; i < getPreferenceCount(); i++) { Preference p = getPreference(i); p.setVisible(visible); } } } Loading
res/drawable/ic_keyboard_arrow_down_black_32.xml 0 → 100644 +25 −0 Original line number Diff line number Diff line <?xml version="1.0" encoding="utf-8"?> <!-- Copyright (C) 2016 The Android Open Source Project Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. --> <vector xmlns:android="http://schemas.android.com/apk/res/android" android:width="32dp" android:height="32dp" android:viewportWidth="24.0" android:viewportHeight="24.0"> <path android:fillColor="#FF000000" android:pathData="M7.41,7.84L12,12.42l4.59,-4.58L18,9.25l-6,6 -6,-6z"/> </vector> No newline at end of file
res/drawable/ic_keyboard_arrow_up_black_32.xml 0 → 100644 +25 −0 Original line number Diff line number Diff line <?xml version="1.0" encoding="utf-8"?> <!-- Copyright (C) 2016 The Android Open Source Project Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. --> <vector xmlns:android="http://schemas.android.com/apk/res/android" android:width="32dp" android:height="32dp" android:viewportWidth="24.0" android:viewportHeight="24.0"> <path android:fillColor="#FF000000" android:pathData="M7.41,15.41L12,10.83l4.59,4.58L18,14l-6,-6 -6,6z"/> </vector> No newline at end of file
res/values/strings.xml +6 −0 Original line number Diff line number Diff line Loading @@ -7627,4 +7627,10 @@ <!-- Button to activate the storage manager on the storage manager upsell. [CHAR LIMIT=20]--> <string name="deletion_helper_upsell_activate">Turn on</string> <!-- Title for the apps category in the deletion helper, showing how many apps to delete. [CHAR LIMIT=40]--> <string name="deletion_helper_apps_group_title">Apps (<xliff:g id="num_items">%1$d</xliff:g>)</string> <!-- 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> </resources>
res/xml/deletion_helper_list.xml +3 −3 Original line number Diff line number Diff line Loading @@ -23,8 +23,8 @@ <com.android.settings.deletionhelper.DownloadsDeletionPreference android:key="delete_downloads" /> <PreferenceCategory <com.android.settings.CollapsibleCheckboxPreferenceGroup android:key="apps_group" android:title="@string/deletion_helper_apps_title" /> android:icon="@drawable/ic_keyboard_arrow_down_black_32"/> </PreferenceScreen>
src/com/android/settings/CollapsibleCheckboxPreferenceGroup.java 0 → 100644 +147 −0 Original line number Diff line number Diff line /* * Copyright (C) 2016 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.android.settings; import android.content.Context; import android.support.v7.preference.Preference; import android.support.v7.preference.PreferenceGroup; import android.support.v7.preference.PreferenceViewHolder; import android.util.AttributeSet; import android.util.Log; import android.util.TypedValue; import android.view.View; import android.widget.Checkable; import android.widget.TextView; import java.util.LinkedHashMap; /** * CollapsibleCheckboxPreferenceGroup is a preference group that can be expanded or collapsed and * also has a checkbox. */ public class CollapsibleCheckboxPreferenceGroup extends PreferenceGroup implements View.OnClickListener { private boolean mCollapsed; private boolean mChecked; public CollapsibleCheckboxPreferenceGroup(Context context) { this(context, null); } public CollapsibleCheckboxPreferenceGroup(Context context, AttributeSet attrs) { super(context, attrs); setWidgetLayoutResource(com.android.settings.R.layout.preference_widget_checkbox); } @Override public void onBindViewHolder(PreferenceViewHolder holder) { super.onBindViewHolder(holder); View checkbox = holder.findViewById(com.android.internal.R.id.checkbox); if (checkbox != null && checkbox instanceof Checkable) { ((Checkable) checkbox).setChecked(mChecked); checkbox.setClickable(true); checkbox.setFocusable(true); checkbox.setOnClickListener(this); } final TextView titleView = (TextView) holder.findViewById(android.R.id.title); if (titleView != null) { Context context = getContext(); TypedValue value = new TypedValue(); context.getTheme().resolveAttribute(android.R.attr.colorAccent, value, true); titleView.setTextColor(context.getColor(value.resourceId)); } } @Override public boolean addPreference(Preference p) { super.addPreference(p); p.setVisible(!isCollapsed()); return true; } // The preference click handler. @Override protected void onClick() { super.onClick(); setCollapse(!isCollapsed()); } // The checkbox view click handler. @Override public void onClick(View v) { setChecked(!isChecked()); } /** * Return if the view is collapsed. */ public boolean isCollapsed() { return mCollapsed; } /** * Returns the checked state of the preference. */ public boolean isChecked() { return mChecked; } /** * Sets the checked state and notifies listeners of the state change. */ public void setChecked(boolean checked) { if (mChecked != checked) { mChecked = checked; callChangeListener(checked); notifyDependencyChange(shouldDisableDependents()); notifyChanged(); } } private void setCollapse(boolean isCollapsed) { if (mCollapsed == isCollapsed) { return; } mCollapsed = isCollapsed; if (isCollapsed) { hideDropdownPreferences(); } else { showDropdownPreferences(); } } private void showDropdownPreferences() { setAllPreferencesVisibility(true); setIcon(R.drawable.ic_keyboard_arrow_down_black_32); } private void hideDropdownPreferences() { setAllPreferencesVisibility(false); setIcon(R.drawable.ic_keyboard_arrow_up_black_32); } private void setAllPreferencesVisibility(boolean visible) { for (int i = 0; i < getPreferenceCount(); i++) { Preference p = getPreference(i); p.setVisible(visible); } } }