diff options
author | Roman Birg <roman@cyngn.com> | 2015-12-01 19:58:58 -0800 |
---|---|---|
committer | Roman Birg <roman@cyngn.com> | 2015-12-07 14:18:12 -0800 |
commit | 6f6f1b60b699eea7c6a05fd82a61f62764565334 (patch) | |
tree | 08ee1b1eb6552f1f8bcde79ad854195975c4bc46 /packages/SystemUI/src/com/android/systemui/qs/QSSettings.java | |
parent | 8800d58e8b39e2c178d912249c8fd22bd0131848 (diff) | |
download | frameworks_base-6f6f1b60b699eea7c6a05fd82a61f62764565334.zip frameworks_base-6f6f1b60b699eea7c6a05fd82a61f62764565334.tar.gz frameworks_base-6f6f1b60b699eea7c6a05fd82a61f62764565334.tar.bz2 |
Quick settings: add statusbar setting page while editing
Adds a Settings page accessible while editing tiles at the very first
slot of the tile viewpager.
Long pressing the edit tile will put the qs panel into edit mode and
swing over to the Settings page.
Change-Id: Ie8416ac5446794a03e33ae260538ffcd9a253d57
Signed-off-by: Roman Birg <roman@cyngn.com>
Diffstat (limited to 'packages/SystemUI/src/com/android/systemui/qs/QSSettings.java')
-rw-r--r-- | packages/SystemUI/src/com/android/systemui/qs/QSSettings.java | 71 |
1 files changed, 71 insertions, 0 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/qs/QSSettings.java b/packages/SystemUI/src/com/android/systemui/qs/QSSettings.java new file mode 100644 index 0000000..959a1ee --- /dev/null +++ b/packages/SystemUI/src/com/android/systemui/qs/QSSettings.java @@ -0,0 +1,71 @@ +/* + * Copyright (C) 2015 The CyanogenMod 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.systemui.qs; + +import android.annotation.Nullable; +import android.app.AlertDialog; +import android.content.Context; +import android.content.DialogInterface; +import android.util.AttributeSet; +import android.view.View; +import android.widget.LinearLayout; +import com.android.systemui.statusbar.phone.QSTileHost; +import com.android.systemui.statusbar.phone.SystemUIDialog; + +import com.android.systemui.R; + +public class QSSettings extends LinearLayout { + private QSTileHost mHost; + + public QSSettings(Context context) { + super(context); + } + + public QSSettings(Context context, @Nullable AttributeSet attrs) { + super(context, attrs); + } + + @Override + protected void onFinishInflate() { + super.onFinishInflate(); + + findViewById(R.id.reset_tiles).setOnClickListener(new OnClickListener() { + @Override + public void onClick(View v) { + initiateTileReset(); + } + }); + } + + private void initiateTileReset() { + final AlertDialog d = new AlertDialog.Builder(mContext) + .setMessage(R.string.qs_tiles_reset_confirmation) + .setNegativeButton(R.string.cancel, null) + .setPositiveButton(com.android.internal.R.string.reset, + new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface dialog, int which) { + mHost.resetTiles(); + } + }).create(); + SystemUIDialog.makeSystemUIDialog(d); + d.show(); + } + + public void setHost(QSTileHost host) { + mHost = host; + } +} |