diff options
author | John Spurlock <jspurlock@google.com> | 2014-10-17 12:06:38 -0400 |
---|---|---|
committer | John Spurlock <jspurlock@google.com> | 2014-10-17 12:06:38 -0400 |
commit | 289d797a6a748cfc7dcca8c815fab6c37061bf05 (patch) | |
tree | 289097f52f68ee0941dbaa2e72c9f13a26795f9a /packages/SystemUI/src | |
parent | df385fffe822a7854fb7ce9c5e46ee007646c89e (diff) | |
download | frameworks_base-289d797a6a748cfc7dcca8c815fab6c37061bf05.zip frameworks_base-289d797a6a748cfc7dcca8c815fab6c37061bf05.tar.gz frameworks_base-289d797a6a748cfc7dcca8c815fab6c37061bf05.tar.bz2 |
QS: 7 day timeout for color-inversion tile.
Bug: 17631628
Change-Id: I4f8a6ce3ea1f79d696686760732c3e8216bfb6c4
Diffstat (limited to 'packages/SystemUI/src')
3 files changed, 10 insertions, 7 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/qs/UsageTracker.java b/packages/SystemUI/src/com/android/systemui/qs/UsageTracker.java index ad79aba..a1092a3 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/UsageTracker.java +++ b/packages/SystemUI/src/com/android/systemui/qs/UsageTracker.java @@ -22,7 +22,6 @@ import android.content.Intent; import android.content.IntentFilter; import android.content.SharedPreferences; -import com.android.systemui.R; import com.android.systemui.statusbar.policy.Listenable; public class UsageTracker implements Listenable { @@ -35,11 +34,10 @@ public class UsageTracker implements Listenable { private boolean mRegistered; - public UsageTracker(Context context, Class<?> tile) { + public UsageTracker(Context context, Class<?> tile, int timeoutResource) { mContext = context; mPrefKey = tile.getSimpleName() + "LastUsed"; - mTimeToShowTile = MILLIS_PER_DAY * mContext.getResources() - .getInteger(R.integer.days_to_show_timeout_tiles); + mTimeToShowTile = MILLIS_PER_DAY * mContext.getResources().getInteger(timeoutResource); mResetAction = "com.android.systemui.qs." + tile.getSimpleName() + ".usage_reset"; } diff --git a/packages/SystemUI/src/com/android/systemui/qs/tiles/ColorInversionTile.java b/packages/SystemUI/src/com/android/systemui/qs/tiles/ColorInversionTile.java index 01849c1..7ba1dc0 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/tiles/ColorInversionTile.java +++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/ColorInversionTile.java @@ -44,7 +44,8 @@ public class ColorInversionTile extends QSTile<QSTile.BooleanState> { } } }; - mUsageTracker = new UsageTracker(host.getContext(), ColorInversionTile.class); + mUsageTracker = new UsageTracker(host.getContext(), ColorInversionTile.class, + R.integer.days_to_show_color_inversion_tile); if (mSetting.getValue() != 0 && !mUsageTracker.isRecentlyUsed()) { mUsageTracker.trackUsage(); } diff --git a/packages/SystemUI/src/com/android/systemui/qs/tiles/HotspotTile.java b/packages/SystemUI/src/com/android/systemui/qs/tiles/HotspotTile.java index ce99cc3..b30a1d3 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/tiles/HotspotTile.java +++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/HotspotTile.java @@ -34,7 +34,7 @@ public class HotspotTile extends QSTile<QSTile.BooleanState> { public HotspotTile(Host host) { super(host); mController = host.getHotspotController(); - mUsageTracker = new UsageTracker(host.getContext(), HotspotTile.class); + mUsageTracker = newUsageTracker(host.getContext()); mUsageTracker.setListening(true); } @@ -84,6 +84,10 @@ public class HotspotTile extends QSTile<QSTile.BooleanState> { } } + private static UsageTracker newUsageTracker(Context context) { + return new UsageTracker(context, HotspotTile.class, R.integer.days_to_show_hotspot_tile); + } + private final class Callback implements HotspotController.Callback { @Override public void onHotspotChanged(boolean enabled) { @@ -101,7 +105,7 @@ public class HotspotTile extends QSTile<QSTile.BooleanState> { @Override public void onReceive(Context context, Intent intent) { if (mUsageTracker == null) { - mUsageTracker = new UsageTracker(context, HotspotTile.class); + mUsageTracker = newUsageTracker(context); } mUsageTracker.trackUsage(); } |