diff options
Diffstat (limited to 'packages/SystemUI')
18 files changed, 549 insertions, 0 deletions
diff --git a/packages/SystemUI/res/anim/ic_qs_screen_timeout_longtomed.xml b/packages/SystemUI/res/anim/ic_qs_screen_timeout_longtomed.xml new file mode 100644 index 0000000..1479734 --- /dev/null +++ b/packages/SystemUI/res/anim/ic_qs_screen_timeout_longtomed.xml @@ -0,0 +1,7 @@ +<?xml version="1.0" encoding="utf-8"?> +<objectAnimator xmlns:android="http://schemas.android.com/apk/res/android" + +android:duration="250" +android:propertyName="rotation" +android:valueFrom="-180" +android:valueTo="-90"/>
\ No newline at end of file diff --git a/packages/SystemUI/res/anim/ic_qs_screen_timeout_longtoshort.xml b/packages/SystemUI/res/anim/ic_qs_screen_timeout_longtoshort.xml new file mode 100644 index 0000000..4bc7324 --- /dev/null +++ b/packages/SystemUI/res/anim/ic_qs_screen_timeout_longtoshort.xml @@ -0,0 +1,7 @@ +<?xml version="1.0" encoding="utf-8"?> +<objectAnimator xmlns:android="http://schemas.android.com/apk/res/android" + +android:duration="400" +android:propertyName="rotation" +android:valueFrom="-180" +android:valueTo="0"/>
\ No newline at end of file diff --git a/packages/SystemUI/res/anim/ic_qs_screen_timeout_medtoshort.xml b/packages/SystemUI/res/anim/ic_qs_screen_timeout_medtoshort.xml new file mode 100644 index 0000000..ea2e135 --- /dev/null +++ b/packages/SystemUI/res/anim/ic_qs_screen_timeout_medtoshort.xml @@ -0,0 +1,7 @@ +<?xml version="1.0" encoding="utf-8"?> +<objectAnimator xmlns:android="http://schemas.android.com/apk/res/android" + +android:duration="400" +android:propertyName="rotation" +android:valueFrom="-90" +android:valueTo="0"/>
\ No newline at end of file diff --git a/packages/SystemUI/res/anim/ic_qs_screen_timeout_medtoshort_reverse.xml b/packages/SystemUI/res/anim/ic_qs_screen_timeout_medtoshort_reverse.xml new file mode 100644 index 0000000..4b252cb --- /dev/null +++ b/packages/SystemUI/res/anim/ic_qs_screen_timeout_medtoshort_reverse.xml @@ -0,0 +1,7 @@ +<?xml version="1.0" encoding="utf-8"?> +<objectAnimator xmlns:android="http://schemas.android.com/apk/res/android" + +android:duration="250" +android:propertyName="rotation" +android:valueFrom="-90" +android:valueTo="0"/>
\ No newline at end of file diff --git a/packages/SystemUI/res/anim/ic_qs_screen_timeout_shorttolong.xml b/packages/SystemUI/res/anim/ic_qs_screen_timeout_shorttolong.xml new file mode 100644 index 0000000..72103e4 --- /dev/null +++ b/packages/SystemUI/res/anim/ic_qs_screen_timeout_shorttolong.xml @@ -0,0 +1,7 @@ +<?xml version="1.0" encoding="utf-8"?> +<objectAnimator xmlns:android="http://schemas.android.com/apk/res/android" + +android:duration="400" +android:propertyName="rotation" +android:valueFrom="0" +android:valueTo="-180"/>
\ No newline at end of file diff --git a/packages/SystemUI/res/anim/ic_qs_screen_timeout_staymed.xml b/packages/SystemUI/res/anim/ic_qs_screen_timeout_staymed.xml new file mode 100644 index 0000000..186179c --- /dev/null +++ b/packages/SystemUI/res/anim/ic_qs_screen_timeout_staymed.xml @@ -0,0 +1,7 @@ +<?xml version="1.0" encoding="utf-8"?> +<objectAnimator xmlns:android="http://schemas.android.com/apk/res/android" + +android:duration="250" +android:propertyName="rotation" +android:valueFrom="-90" +android:valueTo="-90"/>
\ No newline at end of file diff --git a/packages/SystemUI/res/anim/ic_qs_screen_timeout_tolong.xml b/packages/SystemUI/res/anim/ic_qs_screen_timeout_tolong.xml new file mode 100644 index 0000000..6fa46e9 --- /dev/null +++ b/packages/SystemUI/res/anim/ic_qs_screen_timeout_tolong.xml @@ -0,0 +1,7 @@ +<?xml version="1.0" encoding="utf-8"?> +<objectAnimator xmlns:android="http://schemas.android.com/apk/res/android" + +android:duration="250" +android:propertyName="rotation" +android:valueFrom="-90" +android:valueTo="-180"/>
\ No newline at end of file diff --git a/packages/SystemUI/res/anim/ic_qs_screen_timeout_tomed.xml b/packages/SystemUI/res/anim/ic_qs_screen_timeout_tomed.xml new file mode 100644 index 0000000..7ee79ba --- /dev/null +++ b/packages/SystemUI/res/anim/ic_qs_screen_timeout_tomed.xml @@ -0,0 +1,7 @@ +<?xml version="1.0" encoding="utf-8"?> +<objectAnimator xmlns:android="http://schemas.android.com/apk/res/android" + +android:duration="250" +android:propertyName="rotation" +android:valueFrom="0" +android:valueTo="-90"/>
\ No newline at end of file diff --git a/packages/SystemUI/res/drawable/ic_qs_screen_timeout_long_avd.xml b/packages/SystemUI/res/drawable/ic_qs_screen_timeout_long_avd.xml new file mode 100644 index 0000000..5761fd3 --- /dev/null +++ b/packages/SystemUI/res/drawable/ic_qs_screen_timeout_long_avd.xml @@ -0,0 +1,12 @@ +<?xml version="1.0" encoding="utf-8"?> +<animated-vector xmlns:android="http://schemas.android.com/apk/res/android" + android:drawable="@drawable/ic_qs_screen_timeout_vector"> + + <target + android:animation="@anim/ic_qs_screen_timeout_medtoshort" + android:name="time2"/> + + <target + android:animation="@anim/ic_qs_screen_timeout_longtoshort" + android:name="time3"/> +</animated-vector>
\ No newline at end of file diff --git a/packages/SystemUI/res/drawable/ic_qs_screen_timeout_long_reverse_avd.xml b/packages/SystemUI/res/drawable/ic_qs_screen_timeout_long_reverse_avd.xml new file mode 100644 index 0000000..08871cd --- /dev/null +++ b/packages/SystemUI/res/drawable/ic_qs_screen_timeout_long_reverse_avd.xml @@ -0,0 +1,13 @@ +<?xml version="1.0" encoding="utf-8"?> +<animated-vector xmlns:android="http://schemas.android.com/apk/res/android" + android:drawable="@drawable/ic_qs_screen_timeout_vector"> + + <target + android:animation="@anim/ic_qs_screen_timeout_longtomed" + android:name="time3"/> + + <target + android:animation="@anim/ic_qs_screen_timeout_staymed" + android:name="time2" /> + +</animated-vector> diff --git a/packages/SystemUI/res/drawable/ic_qs_screen_timeout_med_avd.xml b/packages/SystemUI/res/drawable/ic_qs_screen_timeout_med_avd.xml new file mode 100644 index 0000000..88b7d14 --- /dev/null +++ b/packages/SystemUI/res/drawable/ic_qs_screen_timeout_med_avd.xml @@ -0,0 +1,13 @@ +<?xml version="1.0" encoding="utf-8"?> +<animated-vector xmlns:android="http://schemas.android.com/apk/res/android" + android:drawable="@drawable/ic_qs_screen_timeout_vector"> + + <target + android:animation="@anim/ic_qs_screen_timeout_staymed" + android:name="time2"/> + + <target + android:animation="@anim/ic_qs_screen_timeout_tolong" + android:name="time3"/> + +</animated-vector>
\ No newline at end of file diff --git a/packages/SystemUI/res/drawable/ic_qs_screen_timeout_med_reverse_avd.xml b/packages/SystemUI/res/drawable/ic_qs_screen_timeout_med_reverse_avd.xml new file mode 100644 index 0000000..4f08a14 --- /dev/null +++ b/packages/SystemUI/res/drawable/ic_qs_screen_timeout_med_reverse_avd.xml @@ -0,0 +1,13 @@ +<?xml version="1.0" encoding="utf-8"?> +<animated-vector xmlns:android="http://schemas.android.com/apk/res/android" + android:drawable="@drawable/ic_qs_screen_timeout_vector"> + + <target + android:animation="@anim/ic_qs_screen_timeout_medtoshort_reverse" + android:name="time2"/> + + <target + android:animation="@anim/ic_qs_screen_timeout_medtoshort_reverse" + android:name="time3"/> + +</animated-vector> diff --git a/packages/SystemUI/res/drawable/ic_qs_screen_timeout_short_avd.xml b/packages/SystemUI/res/drawable/ic_qs_screen_timeout_short_avd.xml new file mode 100644 index 0000000..694e662 --- /dev/null +++ b/packages/SystemUI/res/drawable/ic_qs_screen_timeout_short_avd.xml @@ -0,0 +1,13 @@ +<?xml version="1.0" encoding="utf-8"?> +<animated-vector xmlns:android="http://schemas.android.com/apk/res/android" + android:drawable="@drawable/ic_qs_screen_timeout_vector"> + + <target + android:animation="@anim/ic_qs_screen_timeout_tomed" + android:name="time2"/> + + <target + android:animation="@anim/ic_qs_screen_timeout_tomed" + android:name="time3"/> + +</animated-vector> diff --git a/packages/SystemUI/res/drawable/ic_qs_screen_timeout_short_reverse_avd.xml b/packages/SystemUI/res/drawable/ic_qs_screen_timeout_short_reverse_avd.xml new file mode 100644 index 0000000..a9a1a7d --- /dev/null +++ b/packages/SystemUI/res/drawable/ic_qs_screen_timeout_short_reverse_avd.xml @@ -0,0 +1,13 @@ +<?xml version="1.0" encoding="utf-8"?> +<animated-vector xmlns:android="http://schemas.android.com/apk/res/android" + android:drawable="@drawable/ic_qs_screen_timeout_vector"> + + <target + android:animation="@anim/ic_qs_screen_timeout_tomed" + android:name="time2"/> + + <target + android:animation="@anim/ic_qs_screen_timeout_shorttolong" + android:name="time3"/> + +</animated-vector> diff --git a/packages/SystemUI/res/drawable/ic_qs_screen_timeout_vector.xml b/packages/SystemUI/res/drawable/ic_qs_screen_timeout_vector.xml new file mode 100644 index 0000000..91f64fd --- /dev/null +++ b/packages/SystemUI/res/drawable/ic_qs_screen_timeout_vector.xml @@ -0,0 +1,53 @@ +<?xml version="1.0" encoding="utf-8"?> +<vector xmlns:android="http://schemas.android.com/apk/res/android" +android:height="64dp" +android:width="64dp" +android:viewportHeight="48" +android:viewportWidth="48"> + +<group + android:name="base_screen"> + + <path + android:fillColor="@android:color/white" + android:pathData="M38,8v32c0,2.2-1.8,4-4,4H14c-2.2,0-4-1.8-4-4V8c0-2.2,1.8-4,4-4h20C36.2,4,38,5.8,38,8Z +M34,24 c0-5.5-4.5-10-10-10s-10,4.5-10,10c0,5.5,4.5,10,10,10S34,29.5,34,24z" /> + +</group> + +<group + android:name="time1" + android:pivotX="24" + android:pivotY="24" + android:rotation="0"> + + <path + android:fillColor="@android:color/white" + android:pathData="M24,18v6h-6C18,20.7,20.7,18,24,18z"/> +</group> + +<group + android:name="time2" + android:pivotX="24" + android:pivotY="24" + android:rotation="0"> + + <path + android:fillColor="@android:color/white" + android:pathData="M24,18v6h-6C18,20.7,20.7,18,24,18z"/> +</group> + +<group + android:name="time3" + android:pivotX="24" + android:pivotY="24" + android:rotation="0"> + + <path + android:fillColor="@android:color/white" + android:pathData="M24,18v6h-6C18,20.7,20.7,18,24,18z"/> + +</group> + + +</vector> diff --git a/packages/SystemUI/res/values/cm_strings.xml b/packages/SystemUI/res/values/cm_strings.xml index b324b4f..af767a7 100644 --- a/packages/SystemUI/res/values/cm_strings.xml +++ b/packages/SystemUI/res/values/cm_strings.xml @@ -123,4 +123,10 @@ <string name="quick_settings_sync_label">Sync</string> <string name="quick_settings_volume_panel_label">Volume panel</string> <string name="quick_settings_usb_tether_label">USB tethering</string> + <string name="quick_settings_screen_timeout_detail_title">Screen timeout</string> + <!-- Content description of the screen timeout tile in quick settings (not shown on the screen). [CHAR LIMIT=NONE] --> + <string name="accessibility_quick_settings_screen_timeout">Screen timeout: <xliff:g id="timeout" example="30 seconds">%s</xliff:g>.</string> + + <!-- Announcement made when the screen timeout tile changes (not shown on the screen). [CHAR LIMIT=NONE] --> + <string name="accessibility_quick_settings_screen_timeout_changed">Screen timeout changed to <xliff:g id="timeout" example="30 seconds">%s</xliff:g>.</string> </resources> diff --git a/packages/SystemUI/src/com/android/systemui/qs/tiles/ScreenTimeoutTile.java b/packages/SystemUI/src/com/android/systemui/qs/tiles/ScreenTimeoutTile.java new file mode 100644 index 0000000..2399f5d --- /dev/null +++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/ScreenTimeoutTile.java @@ -0,0 +1,354 @@ +/* + * 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.tiles; + +import android.content.Context; +import android.content.Intent; +import android.content.pm.PackageManager; +import android.content.res.Resources; +import android.database.ContentObserver; +import android.graphics.drawable.AnimatedVectorDrawable; +import android.graphics.drawable.Drawable; +import android.net.Uri; +import android.provider.Settings; +import android.view.View; +import android.view.ViewGroup; +import android.widget.AdapterView; +import android.widget.ArrayAdapter; +import android.widget.ListView; + +import com.android.internal.logging.MetricsConstants; +import com.android.systemui.R; +import com.android.systemui.qs.QSDetailItemsList; +import com.android.systemui.qs.QSTile; +import cyanogenmod.app.StatusBarPanelCustomTile; + +import java.util.ArrayList; +import java.util.Arrays; + +public class ScreenTimeoutTile extends QSTile<ScreenTimeoutTile.TimeoutState> { + + private static final Intent SETTINGS_INTENT = new Intent(Settings.ACTION_DISPLAY_SETTINGS); + private static final String TIMEOUT_ENTRIES_NAME = "screen_timeout_entries"; + private static final String TIMEOUT_VALUES_NAME = "screen_timeout_values"; + private static final String SETTINGS_PACKAGE_NAME = "com.android.settings"; + + private final AnimationIcon mShort = + new AnimationIcon(R.drawable.ic_qs_screen_timeout_short_avd); + private final AnimationIcon mShortReverse = + new AnimationIcon(R.drawable.ic_qs_screen_timeout_short_reverse_avd); + private final AnimationIcon mMedium = + new AnimationIcon(R.drawable.ic_qs_screen_timeout_med_avd); + private final AnimationIcon mMediumReverse = + new AnimationIcon(R.drawable.ic_qs_screen_timeout_med_reverse_avd); + private final AnimationIcon mLong = + new AnimationIcon(R.drawable.ic_qs_screen_timeout_long_avd); + private final AnimationIcon mLongReverse = + new AnimationIcon(R.drawable.ic_qs_screen_timeout_long_reverse_avd); + + private String[] mEntries, mValues; + private boolean mShowingDetail; + ArrayList<Integer> mAnimationList + = new ArrayList<Integer>(); + + public ScreenTimeoutTile(Host host) { + super(host); + populateList(); + } + + private void populateList() { + try { + Context context = mContext.createPackageContext(SETTINGS_PACKAGE_NAME, 0); + Resources mSettingsResources = context.getResources(); + int id = mSettingsResources.getIdentifier(TIMEOUT_ENTRIES_NAME, + "array", SETTINGS_PACKAGE_NAME); + if (id <= 0) { + return; + } + mEntries = mSettingsResources.getStringArray(id); + id = mSettingsResources.getIdentifier(TIMEOUT_VALUES_NAME, + "array", SETTINGS_PACKAGE_NAME); + if (id <= 0) { + return; + } + mValues = mSettingsResources.getStringArray(id); + } catch (PackageManager.NameNotFoundException e) { + e.printStackTrace(); + } + } + + private int getScreenTimeout() { + return Settings.System.getInt(mContext.getContentResolver(), + Settings.System.SCREEN_OFF_TIMEOUT, 0); + } + + @Override + public DetailAdapter getDetailAdapter() { + return new ScreenTimeoutDetailAdapter(); + } + + private ContentObserver mObserver = new ContentObserver(mHandler) { + @Override + public void onChange(boolean selfChange, Uri uri) { + refreshState(); + } + }; + + @Override + public void setListening(boolean listening) { + if (listening) { + mContext.getContentResolver().registerContentObserver( + Settings.System.getUriFor(Settings.System.SCREEN_OFF_TIMEOUT), + false, mObserver); + } else { + mContext.getContentResolver().unregisterContentObserver(mObserver); + } + } + + @Override + protected TimeoutState newTileState() { + return new TimeoutState(); + } + + @Override + protected void handleClick() { + if (mEntries.length > 0) { + mShowingDetail = true; + mAnimationList.clear(); + showDetail(true); + } + } + + @Override + protected void handleLongClick() { + mHost.startActivityDismissingKeyguard(SETTINGS_INTENT); + } + + private String makeTimeoutSummaryString(int timeout) { + Resources res = mContext.getResources(); + int resId; + + /* ms -> seconds */ + timeout /= 1000; + + if (timeout >= 60 && timeout % 60 == 0) { + /* seconds -> minutes */ + timeout /= 60; + if (timeout >= 60 && timeout % 60 == 0) { + /* minutes -> hours */ + timeout /= 60; + resId = com.android.internal.R.plurals.duration_hours; + } else { + resId = com.android.internal.R.plurals.duration_minutes; + } + } else { + resId = com.android.internal.R.plurals.duration_seconds; + } + + return res.getQuantityString(resId, timeout, timeout); + } + + public static final class TimeoutState extends QSTile.State { + int previousTimeout; + } + + private enum Bucket { + SMALL(0, 30000), + MEDIUM(60000,300000), + LARGE(600000, 1800000); + private final int start; + private final int stop; + + Bucket(int start, int stop) { + this.start = start; + this.stop = stop; + } + + public static Bucket getBucket(int value) { + for (Bucket item : Bucket.values()) { + if (value >= item.start && value <= item.stop) { + return item; + } + } + return null; + } + + } + @Override + protected void handleUpdateState(final TimeoutState state, Object arg) { + if (mAnimationList.isEmpty() && mShowingDetail && arg == null) { + return; + } + + int newTimeout = getScreenTimeout(); + + AnimationIcon d = null; + Bucket nextBucket = Bucket.getBucket(newTimeout); + Bucket previousBucket = Bucket.getBucket(state.previousTimeout); + + if (state.previousTimeout < 60000) { + // Default + d = mMediumReverse; + if (nextBucket == Bucket.MEDIUM) { + // Medium + d = mShort; + } else if (nextBucket == Bucket.LARGE) { + // Large + d = mShortReverse; + } + } else if (state.previousTimeout < 600000) { + // Default + d = mShort; + if (nextBucket == Bucket.SMALL) { + // Small + d = mMediumReverse; + } else if (nextBucket == Bucket.LARGE) { + // Large + d = mMedium; + } + } else { + d = mMedium; + if (nextBucket == Bucket.MEDIUM) { + // Small + d = mLongReverse; + } else if (nextBucket == Bucket.SMALL) { + // Large + d = mLong; + } + } + + if (state.icon == null || previousBucket != nextBucket) { + if (arg instanceof Boolean && (Boolean) arg) { + d.setAllowAnimation(true); + } + state.icon = d; + } + + state.visible = true; + state.label = makeTimeoutSummaryString(newTimeout); + state.contentDescription = mContext.getString( + R.string.accessibility_quick_settings_screen_timeout, state.label); + state.previousTimeout = newTimeout; + } + + @Override + public int getMetricsCategory() { + return MetricsConstants.DONT_TRACK_ME_BRO; + } + + @Override + protected String composeChangeAnnouncement() { + return mContext.getString(R.string.accessibility_quick_settings_screen_timeout_changed, + mState.label); + } + + private class RadioAdapter extends ArrayAdapter<String> { + + public RadioAdapter(Context context, int resource, String[] objects) { + super(context, resource, objects); + } + + public RadioAdapter(Context context, int resource, + int textViewResourceId, String[] objects) { + super(context, resource, textViewResourceId, objects); + } + + @Override + public View getView(int position, View view, ViewGroup parent) { + view = super.getView(position, view, parent); + + view.setMinimumHeight(mContext.getResources() .getDimensionPixelSize( + R.dimen.qs_detail_item_height)); + + return view; + } + + } + private class ScreenTimeoutDetailAdapter implements DetailAdapter, + AdapterView.OnItemClickListener { + private QSDetailItemsList mItems; + + @Override + public int getTitle() { + return R.string.quick_settings_screen_timeout_detail_title; + } + + @Override + public Boolean getToggleState() { + return null; + } + + @Override + public Intent getSettingsIntent() { + return SETTINGS_INTENT; + } + + @Override + public StatusBarPanelCustomTile getCustomTile() { + return null; + } + + @Override + public void setToggleState(boolean state) { + // noop + } + + @Override + public int getMetricsCategory() { + return MetricsConstants.DONT_TRACK_ME_BRO; + } + + @Override + public View createDetailView(Context context, View convertView, ViewGroup parent) { + mItems = QSDetailItemsList.convertOrInflate(context, convertView, parent); + ListView listView = mItems.getListView(); + listView.setOnItemClickListener(this); + listView.setChoiceMode(ListView.CHOICE_MODE_SINGLE); + listView.setDivider(null); + RadioAdapter adapter = new RadioAdapter(context, + android.R.layout.simple_list_item_single_choice, mEntries); + int indexOfSelection = Arrays.asList(mValues).indexOf(String.valueOf(getScreenTimeout())); + mItems.setAdapter(adapter); + listView.setItemChecked(indexOfSelection, true); + mItems.addOnAttachStateChangeListener(new View.OnAttachStateChangeListener() { + @Override + public void onViewAttachedToWindow(View v) { + } + + @Override + public void onViewDetachedFromWindow(View v) { + mUiHandler.postDelayed(new Runnable() { + @Override + public void run() { + mShowingDetail = false; + refreshState(true); + } + }, 100); + + } + }); + return mItems; + } + + @Override + public void onItemClick(AdapterView<?> parent, View view, int position, long id) { + int selectedTimeout = Integer.valueOf(mValues[position]); + Settings.System.putInt(mContext.getContentResolver(), + Settings.System.SCREEN_OFF_TIMEOUT, selectedTimeout); + } + } +}
\ No newline at end of file diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/QSTileHost.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/QSTileHost.java index d1be8b7..bdf39e4 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/QSTileHost.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/QSTileHost.java @@ -53,6 +53,7 @@ import com.android.systemui.qs.tiles.LocationTile; import com.android.systemui.qs.tiles.NfcTile; import com.android.systemui.qs.tiles.ProfilesTile; import com.android.systemui.qs.tiles.RotationLockTile; +import com.android.systemui.qs.tiles.ScreenTimeoutTile; import com.android.systemui.qs.tiles.SyncTile; import com.android.systemui.qs.tiles.UsbTetherTile; import com.android.systemui.qs.tiles.VolumeTile; @@ -342,6 +343,7 @@ public class QSTileHost implements QSTile.Host, Tunable { else if (tileSpec.equals("sync")) return new SyncTile(this); else if (tileSpec.equals("volume_panel")) return new VolumeTile(this); else if (tileSpec.equals("usb_tether")) return new UsbTetherTile(this); + else if (tileSpec.equals("screen_timeout")) return new ScreenTimeoutTile(this); else if (tileSpec.startsWith(IntentTile.PREFIX)) return IntentTile.create(this,tileSpec); else throw new IllegalArgumentException("Bad tile spec: " + tileSpec); } @@ -419,6 +421,7 @@ public class QSTileHost implements QSTile.Host, Tunable { else if (spec.equals("sync")) return R.string.quick_settings_sync_label; else if (spec.equals("volume_panel")) return R.string.quick_settings_volume_panel_label; else if (spec.equals("usb_tether")) return R.string.quick_settings_usb_tether_label; + else if (spec.equals("screen_timeout")) return R.string.quick_settings_screen_timeout_detail_title; return 0; } |