Loading packages/SystemUI/res/layout/qs_customize_panel.xml +5 −39 Original line number Original line Diff line number Diff line Loading @@ -22,47 +22,13 @@ android:background="@drawable/qs_customizer_background" android:background="@drawable/qs_customizer_background" android:gravity="center_horizontal"> android:gravity="center_horizontal"> <LinearLayout <Toolbar android:id="@*android:id/action_bar" android:layout_width="match_parent" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_height="wrap_content" android:paddingTop="28dp" android:layout_marginTop="28dp" android:paddingEnd="8dp"> android:navigationContentDescription="@*android:string/action_bar_up_description" style="?android:attr/toolbarStyle" /> <ImageView android:id="@+id/close" android:layout_width="56dp" android:layout_height="56dp" android:padding="16dp" android:src="@drawable/ic_close_white" /> <Space android:layout_width="0dp" android:layout_height="0dp" android:layout_weight="1" /> <Button android:id="@+id/save" android:layout_width="wrap_content" android:layout_height="wrap_content" android:paddingStart="12dp" android:paddingEnd="12dp" android:background="?android:attr/selectableItemBackground" android:textAppearance="@android:style/TextAppearance.Material.Widget.Button.Inverse" android:textColor="?android:attr/colorAccent" android:text="@string/save" /> <Button android:id="@+id/reset" android:layout_width="wrap_content" android:layout_height="wrap_content" android:paddingStart="12dp" android:paddingEnd="12dp" android:background="?android:attr/selectableItemBackground" android:textAppearance="@android:style/TextAppearance.Material.Widget.Button.Inverse" android:textColor="?android:attr/colorAccent" android:text="@*android:string/reset" /> </LinearLayout> <android.support.v7.widget.RecyclerView <android.support.v7.widget.RecyclerView android:id="@android:id/list" android:id="@android:id/list" Loading packages/SystemUI/res/values/dimens.xml +1 −0 Original line number Original line Diff line number Diff line Loading @@ -203,6 +203,7 @@ <dimen name="qs_data_usage_text_size">14sp</dimen> <dimen name="qs_data_usage_text_size">14sp</dimen> <dimen name="qs_data_usage_usage_text_size">36sp</dimen> <dimen name="qs_data_usage_usage_text_size">36sp</dimen> <dimen name="qs_expand_margin">0dp</dimen> <dimen name="qs_expand_margin">0dp</dimen> <dimen name="qs_battery_padding">2dp</dimen> <dimen name="segmented_button_spacing">0dp</dimen> <dimen name="segmented_button_spacing">0dp</dimen> <dimen name="borderless_button_radius">2dp</dimen> <dimen name="borderless_button_radius">2dp</dimen> Loading packages/SystemUI/src/com/android/systemui/qs/QSIconView.java +2 −0 Original line number Original line Diff line number Diff line Loading @@ -70,11 +70,13 @@ public class QSIconView extends ViewGroup { protected void setIcon(ImageView iv, QSTile.State state) { protected void setIcon(ImageView iv, QSTile.State state) { if (!Objects.equals(state.icon, iv.getTag(R.id.qs_icon_tag))) { if (!Objects.equals(state.icon, iv.getTag(R.id.qs_icon_tag))) { Drawable d = state.icon != null ? state.icon.getDrawable(mContext) : null; Drawable d = state.icon != null ? state.icon.getDrawable(mContext) : null; int padding = state.icon != null ? state.icon.getPadding() : null; if (d != null && state.autoMirrorDrawable) { if (d != null && state.autoMirrorDrawable) { d.setAutoMirrored(true); d.setAutoMirrored(true); } } iv.setImageDrawable(d); iv.setImageDrawable(d); iv.setTag(R.id.qs_icon_tag, state.icon); iv.setTag(R.id.qs_icon_tag, state.icon); iv.setPadding(0, padding, 0, padding); if (d instanceof Animatable) { if (d instanceof Animatable) { Animatable a = (Animatable) d; Animatable a = (Animatable) d; a.start(); a.start(); Loading packages/SystemUI/src/com/android/systemui/qs/QSTile.java +4 −0 Original line number Original line Diff line number Diff line Loading @@ -420,6 +420,10 @@ public abstract class QSTile<TState extends State> implements Listenable { public int hashCode() { public int hashCode() { return Icon.class.hashCode(); return Icon.class.hashCode(); } } public int getPadding() { return 0; } } } public static class DrawableIcon extends Icon { public static class DrawableIcon extends Icon { Loading packages/SystemUI/src/com/android/systemui/qs/customize/QSCustomizer.java +35 −26 Original line number Original line Diff line number Diff line Loading @@ -22,12 +22,15 @@ import android.content.Context; import android.support.v7.widget.DefaultItemAnimator; import android.support.v7.widget.DefaultItemAnimator; import android.support.v7.widget.GridLayoutManager; import android.support.v7.widget.GridLayoutManager; import android.support.v7.widget.RecyclerView; import android.support.v7.widget.RecyclerView; import android.support.v7.widget.helper.ItemTouchHelper; import android.util.AttributeSet; import android.util.AttributeSet; import android.util.TypedValue; import android.view.ContextThemeWrapper; import android.view.ContextThemeWrapper; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.view.View; import android.view.View.OnClickListener; import android.widget.LinearLayout; import android.widget.LinearLayout; import android.widget.Toolbar; import android.widget.Toolbar.OnMenuItemClickListener; import com.android.systemui.R; import com.android.systemui.R; import com.android.systemui.qs.QSDetailClipper; import com.android.systemui.qs.QSDetailClipper; import com.android.systemui.qs.QSTile; import com.android.systemui.qs.QSTile; Loading @@ -43,7 +46,9 @@ import java.util.List; * This adds itself to the status bar window, so it can appear on top of quick settings and * This adds itself to the status bar window, so it can appear on top of quick settings and * *someday* do fancy animations to get into/out of it. * *someday* do fancy animations to get into/out of it. */ */ public class QSCustomizer extends LinearLayout implements OnClickListener { public class QSCustomizer extends LinearLayout implements OnMenuItemClickListener { private static final int MENU_RESET = Menu.FIRST; private final QSDetailClipper mClipper; private final QSDetailClipper mClipper; Loading @@ -53,9 +58,7 @@ public class QSCustomizer extends LinearLayout implements OnClickListener { private QSTileHost mHost; private QSTileHost mHost; private RecyclerView mRecyclerView; private RecyclerView mRecyclerView; private TileAdapter mTileAdapter; private TileAdapter mTileAdapter; private View mClose; private Toolbar mToolbar; private View mSave; private View mReset; public QSCustomizer(Context context, AttributeSet attrs) { public QSCustomizer(Context context, AttributeSet attrs) { super(new ContextThemeWrapper(context, android.R.style.Theme_Material), attrs); super(new ContextThemeWrapper(context, android.R.style.Theme_Material), attrs); Loading @@ -70,17 +73,26 @@ public class QSCustomizer extends LinearLayout implements OnClickListener { @Override @Override protected void onFinishInflate() { protected void onFinishInflate() { super.onFinishInflate(); super.onFinishInflate(); mClose = findViewById(R.id.close); mToolbar = (Toolbar) findViewById(com.android.internal.R.id.action_bar); mSave = findViewById(R.id.save); TypedValue value = new TypedValue(); mReset = findViewById(R.id.reset); mContext.getTheme().resolveAttribute(android.R.attr.homeAsUpIndicator, value, true); mClose.setOnClickListener(this); mToolbar.setNavigationIcon( mSave.setOnClickListener(this); getResources().getDrawable(R.drawable.ic_close_white, mContext.getTheme())); mReset.setOnClickListener(this); mToolbar.setNavigationOnClickListener(new OnClickListener() { @Override public void onClick(View v) { save(); hide((int) v.getX() + v.getWidth() / 2, (int) v.getY() + v.getHeight() / 2); } }); mToolbar.setOnMenuItemClickListener(this); mToolbar.getMenu().add(Menu.NONE, MENU_RESET, 0, mContext.getString(com.android.internal.R.string.reset)); mRecyclerView = (RecyclerView) findViewById(android.R.id.list); mRecyclerView = (RecyclerView) findViewById(android.R.id.list); mTileAdapter = new TileAdapter(getContext()); mTileAdapter = new TileAdapter(getContext()); mRecyclerView.setAdapter(mTileAdapter); mRecyclerView.setAdapter(mTileAdapter); new ItemTouchHelper(mTileAdapter.getCallback()).attachToRecyclerView(mRecyclerView); mTileAdapter.getItemTouchHelper().attachToRecyclerView(mRecyclerView); GridLayoutManager layout = new GridLayoutManager(getContext(), 3); GridLayoutManager layout = new GridLayoutManager(getContext(), 3); layout.setSpanSizeLookup(mTileAdapter.getSizeLookup()); layout.setSpanSizeLookup(mTileAdapter.getSizeLookup()); mRecyclerView.setLayoutManager(layout); mRecyclerView.setLayoutManager(layout); Loading Loading @@ -111,6 +123,16 @@ public class QSCustomizer extends LinearLayout implements OnClickListener { return isShown; return isShown; } } @Override public boolean onMenuItemClick(MenuItem item) { switch (item.getItemId()) { case MENU_RESET: reset(); break; } return false; } private void reset() { private void reset() { ArrayList<String> tiles = new ArrayList<>(); ArrayList<String> tiles = new ArrayList<>(); String defTiles = mContext.getString(R.string.quick_settings_tiles_default); String defTiles = mContext.getString(R.string.quick_settings_tiles_default); Loading @@ -130,19 +152,6 @@ public class QSCustomizer extends LinearLayout implements OnClickListener { private void save() { private void save() { mTileAdapter.saveSpecs(mHost); mTileAdapter.saveSpecs(mHost); hide((int) mSave.getX() + mSave.getWidth() / 2, (int) mSave.getY() + mSave.getHeight() / 2); } @Override public void onClick(View v) { if (v == mClose) { hide((int) mClose.getX() + mClose.getWidth() / 2, (int) mClose.getY() + mClose.getHeight() / 2); } else if (v == mSave) { save(); } else if (v == mReset) { reset(); } } } private final AnimatorListener mCollapseAnimationListener = new AnimatorListenerAdapter() { private final AnimatorListener mCollapseAnimationListener = new AnimatorListenerAdapter() { Loading Loading
packages/SystemUI/res/layout/qs_customize_panel.xml +5 −39 Original line number Original line Diff line number Diff line Loading @@ -22,47 +22,13 @@ android:background="@drawable/qs_customizer_background" android:background="@drawable/qs_customizer_background" android:gravity="center_horizontal"> android:gravity="center_horizontal"> <LinearLayout <Toolbar android:id="@*android:id/action_bar" android:layout_width="match_parent" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_height="wrap_content" android:paddingTop="28dp" android:layout_marginTop="28dp" android:paddingEnd="8dp"> android:navigationContentDescription="@*android:string/action_bar_up_description" style="?android:attr/toolbarStyle" /> <ImageView android:id="@+id/close" android:layout_width="56dp" android:layout_height="56dp" android:padding="16dp" android:src="@drawable/ic_close_white" /> <Space android:layout_width="0dp" android:layout_height="0dp" android:layout_weight="1" /> <Button android:id="@+id/save" android:layout_width="wrap_content" android:layout_height="wrap_content" android:paddingStart="12dp" android:paddingEnd="12dp" android:background="?android:attr/selectableItemBackground" android:textAppearance="@android:style/TextAppearance.Material.Widget.Button.Inverse" android:textColor="?android:attr/colorAccent" android:text="@string/save" /> <Button android:id="@+id/reset" android:layout_width="wrap_content" android:layout_height="wrap_content" android:paddingStart="12dp" android:paddingEnd="12dp" android:background="?android:attr/selectableItemBackground" android:textAppearance="@android:style/TextAppearance.Material.Widget.Button.Inverse" android:textColor="?android:attr/colorAccent" android:text="@*android:string/reset" /> </LinearLayout> <android.support.v7.widget.RecyclerView <android.support.v7.widget.RecyclerView android:id="@android:id/list" android:id="@android:id/list" Loading
packages/SystemUI/res/values/dimens.xml +1 −0 Original line number Original line Diff line number Diff line Loading @@ -203,6 +203,7 @@ <dimen name="qs_data_usage_text_size">14sp</dimen> <dimen name="qs_data_usage_text_size">14sp</dimen> <dimen name="qs_data_usage_usage_text_size">36sp</dimen> <dimen name="qs_data_usage_usage_text_size">36sp</dimen> <dimen name="qs_expand_margin">0dp</dimen> <dimen name="qs_expand_margin">0dp</dimen> <dimen name="qs_battery_padding">2dp</dimen> <dimen name="segmented_button_spacing">0dp</dimen> <dimen name="segmented_button_spacing">0dp</dimen> <dimen name="borderless_button_radius">2dp</dimen> <dimen name="borderless_button_radius">2dp</dimen> Loading
packages/SystemUI/src/com/android/systemui/qs/QSIconView.java +2 −0 Original line number Original line Diff line number Diff line Loading @@ -70,11 +70,13 @@ public class QSIconView extends ViewGroup { protected void setIcon(ImageView iv, QSTile.State state) { protected void setIcon(ImageView iv, QSTile.State state) { if (!Objects.equals(state.icon, iv.getTag(R.id.qs_icon_tag))) { if (!Objects.equals(state.icon, iv.getTag(R.id.qs_icon_tag))) { Drawable d = state.icon != null ? state.icon.getDrawable(mContext) : null; Drawable d = state.icon != null ? state.icon.getDrawable(mContext) : null; int padding = state.icon != null ? state.icon.getPadding() : null; if (d != null && state.autoMirrorDrawable) { if (d != null && state.autoMirrorDrawable) { d.setAutoMirrored(true); d.setAutoMirrored(true); } } iv.setImageDrawable(d); iv.setImageDrawable(d); iv.setTag(R.id.qs_icon_tag, state.icon); iv.setTag(R.id.qs_icon_tag, state.icon); iv.setPadding(0, padding, 0, padding); if (d instanceof Animatable) { if (d instanceof Animatable) { Animatable a = (Animatable) d; Animatable a = (Animatable) d; a.start(); a.start(); Loading
packages/SystemUI/src/com/android/systemui/qs/QSTile.java +4 −0 Original line number Original line Diff line number Diff line Loading @@ -420,6 +420,10 @@ public abstract class QSTile<TState extends State> implements Listenable { public int hashCode() { public int hashCode() { return Icon.class.hashCode(); return Icon.class.hashCode(); } } public int getPadding() { return 0; } } } public static class DrawableIcon extends Icon { public static class DrawableIcon extends Icon { Loading
packages/SystemUI/src/com/android/systemui/qs/customize/QSCustomizer.java +35 −26 Original line number Original line Diff line number Diff line Loading @@ -22,12 +22,15 @@ import android.content.Context; import android.support.v7.widget.DefaultItemAnimator; import android.support.v7.widget.DefaultItemAnimator; import android.support.v7.widget.GridLayoutManager; import android.support.v7.widget.GridLayoutManager; import android.support.v7.widget.RecyclerView; import android.support.v7.widget.RecyclerView; import android.support.v7.widget.helper.ItemTouchHelper; import android.util.AttributeSet; import android.util.AttributeSet; import android.util.TypedValue; import android.view.ContextThemeWrapper; import android.view.ContextThemeWrapper; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.view.View; import android.view.View.OnClickListener; import android.widget.LinearLayout; import android.widget.LinearLayout; import android.widget.Toolbar; import android.widget.Toolbar.OnMenuItemClickListener; import com.android.systemui.R; import com.android.systemui.R; import com.android.systemui.qs.QSDetailClipper; import com.android.systemui.qs.QSDetailClipper; import com.android.systemui.qs.QSTile; import com.android.systemui.qs.QSTile; Loading @@ -43,7 +46,9 @@ import java.util.List; * This adds itself to the status bar window, so it can appear on top of quick settings and * This adds itself to the status bar window, so it can appear on top of quick settings and * *someday* do fancy animations to get into/out of it. * *someday* do fancy animations to get into/out of it. */ */ public class QSCustomizer extends LinearLayout implements OnClickListener { public class QSCustomizer extends LinearLayout implements OnMenuItemClickListener { private static final int MENU_RESET = Menu.FIRST; private final QSDetailClipper mClipper; private final QSDetailClipper mClipper; Loading @@ -53,9 +58,7 @@ public class QSCustomizer extends LinearLayout implements OnClickListener { private QSTileHost mHost; private QSTileHost mHost; private RecyclerView mRecyclerView; private RecyclerView mRecyclerView; private TileAdapter mTileAdapter; private TileAdapter mTileAdapter; private View mClose; private Toolbar mToolbar; private View mSave; private View mReset; public QSCustomizer(Context context, AttributeSet attrs) { public QSCustomizer(Context context, AttributeSet attrs) { super(new ContextThemeWrapper(context, android.R.style.Theme_Material), attrs); super(new ContextThemeWrapper(context, android.R.style.Theme_Material), attrs); Loading @@ -70,17 +73,26 @@ public class QSCustomizer extends LinearLayout implements OnClickListener { @Override @Override protected void onFinishInflate() { protected void onFinishInflate() { super.onFinishInflate(); super.onFinishInflate(); mClose = findViewById(R.id.close); mToolbar = (Toolbar) findViewById(com.android.internal.R.id.action_bar); mSave = findViewById(R.id.save); TypedValue value = new TypedValue(); mReset = findViewById(R.id.reset); mContext.getTheme().resolveAttribute(android.R.attr.homeAsUpIndicator, value, true); mClose.setOnClickListener(this); mToolbar.setNavigationIcon( mSave.setOnClickListener(this); getResources().getDrawable(R.drawable.ic_close_white, mContext.getTheme())); mReset.setOnClickListener(this); mToolbar.setNavigationOnClickListener(new OnClickListener() { @Override public void onClick(View v) { save(); hide((int) v.getX() + v.getWidth() / 2, (int) v.getY() + v.getHeight() / 2); } }); mToolbar.setOnMenuItemClickListener(this); mToolbar.getMenu().add(Menu.NONE, MENU_RESET, 0, mContext.getString(com.android.internal.R.string.reset)); mRecyclerView = (RecyclerView) findViewById(android.R.id.list); mRecyclerView = (RecyclerView) findViewById(android.R.id.list); mTileAdapter = new TileAdapter(getContext()); mTileAdapter = new TileAdapter(getContext()); mRecyclerView.setAdapter(mTileAdapter); mRecyclerView.setAdapter(mTileAdapter); new ItemTouchHelper(mTileAdapter.getCallback()).attachToRecyclerView(mRecyclerView); mTileAdapter.getItemTouchHelper().attachToRecyclerView(mRecyclerView); GridLayoutManager layout = new GridLayoutManager(getContext(), 3); GridLayoutManager layout = new GridLayoutManager(getContext(), 3); layout.setSpanSizeLookup(mTileAdapter.getSizeLookup()); layout.setSpanSizeLookup(mTileAdapter.getSizeLookup()); mRecyclerView.setLayoutManager(layout); mRecyclerView.setLayoutManager(layout); Loading Loading @@ -111,6 +123,16 @@ public class QSCustomizer extends LinearLayout implements OnClickListener { return isShown; return isShown; } } @Override public boolean onMenuItemClick(MenuItem item) { switch (item.getItemId()) { case MENU_RESET: reset(); break; } return false; } private void reset() { private void reset() { ArrayList<String> tiles = new ArrayList<>(); ArrayList<String> tiles = new ArrayList<>(); String defTiles = mContext.getString(R.string.quick_settings_tiles_default); String defTiles = mContext.getString(R.string.quick_settings_tiles_default); Loading @@ -130,19 +152,6 @@ public class QSCustomizer extends LinearLayout implements OnClickListener { private void save() { private void save() { mTileAdapter.saveSpecs(mHost); mTileAdapter.saveSpecs(mHost); hide((int) mSave.getX() + mSave.getWidth() / 2, (int) mSave.getY() + mSave.getHeight() / 2); } @Override public void onClick(View v) { if (v == mClose) { hide((int) mClose.getX() + mClose.getWidth() / 2, (int) mClose.getY() + mClose.getHeight() / 2); } else if (v == mSave) { save(); } else if (v == mReset) { reset(); } } } private final AnimatorListener mCollapseAnimationListener = new AnimatorListenerAdapter() { private final AnimatorListener mCollapseAnimationListener = new AnimatorListenerAdapter() { Loading