Loading packages/SystemUI/src/com/android/systemui/Prefs.java +2 −0 Original line number Diff line number Diff line Loading @@ -48,6 +48,7 @@ public final class Prefs { Key.QS_DATA_SAVER_ADDED, Key.QS_INVERT_COLORS_ADDED, Key.QS_WORK_ADDED, Key.QS_NIGHT_ADDED, }) public @interface Key { String OVERVIEW_SEARCH_APP_WIDGET_ID = "searchAppWidgetId"; Loading @@ -68,6 +69,7 @@ public final class Prefs { String QS_DATA_SAVER_ADDED = "QsDataSaverAdded"; String QS_INVERT_COLORS_ADDED = "QsInvertColorsAdded"; String QS_WORK_ADDED = "QsWorkAdded"; String QS_NIGHT_ADDED = "QsNightAdded"; } public static boolean getBoolean(Context context, @Key String key, boolean defaultValue) { Loading packages/SystemUI/src/com/android/systemui/qs/customize/TileAdapter.java +4 −1 Original line number Diff line number Diff line Loading @@ -107,7 +107,10 @@ public class TileAdapter extends RecyclerView.Adapter<Holder> implements TileSta mOtherTiles = new ArrayList<TileInfo>(mAllTiles); mTiles.clear(); for (int i = 0; i < mCurrentSpecs.size(); i++) { mTiles.add(getAndRemoveOther(mCurrentSpecs.get(i))); final TileInfo tile = getAndRemoveOther(mCurrentSpecs.get(i)); if (tile != null) { mTiles.add(tile); } } mTiles.add(null); mTiles.addAll(mOtherTiles); Loading packages/SystemUI/src/com/android/systemui/qs/customize/TileQueryHelper.java +11 −2 Original line number Diff line number Diff line Loading @@ -28,11 +28,14 @@ import android.os.AsyncTask; import android.os.Handler; import android.os.Looper; import android.service.quicksettings.TileService; import com.android.systemui.Prefs; import com.android.systemui.Prefs.Key; import com.android.systemui.R; import com.android.systemui.qs.QSTile; import com.android.systemui.qs.QSTile.DrawableIcon; import com.android.systemui.qs.external.CustomTile; import com.android.systemui.statusbar.phone.QSTileHost; import com.android.systemui.tuner.TunerService; import java.util.ArrayList; import java.util.Collection; Loading @@ -54,7 +57,8 @@ public class TileQueryHelper { } private void addSystemTiles(QSTileHost host) { boolean hasColorMod = host.getNightModeController().isEnabled(); boolean hasColorMod = Prefs.getBoolean(host.getContext(), Key.QS_NIGHT_ADDED, false) && TunerService.isTunerEnabled(host.getContext()); String possible = mContext.getString(R.string.quick_settings_tiles_default) + ",hotspot,inversion,saver,work,cast" + (hasColorMod ? ",night" : ""); String[] possibleTiles = possible.split(","); Loading Loading @@ -86,12 +90,17 @@ public class TileQueryHelper { }); } qsHandler.post(new Runnable() { @Override public void run() { mainHandler.post(new Runnable() { @Override public void run() { new QueryTilesTask().execute(); } }); } }); } public void setListener(TileStateListener listener) { mListener = listener; Loading packages/SystemUI/src/com/android/systemui/statusbar/phone/AutoTileManager.java +22 −0 Original line number Diff line number Diff line Loading @@ -24,6 +24,7 @@ import com.android.systemui.statusbar.policy.DataSaverController; import com.android.systemui.statusbar.policy.DataSaverController.Listener; import com.android.systemui.statusbar.policy.HotspotController; import com.android.systemui.statusbar.policy.HotspotController.Callback; import com.android.systemui.statusbar.policy.NightModeController; /** * Manages which tiles should be automatically added to QS. Loading Loading @@ -66,12 +67,33 @@ public class AutoTileManager { if (!Prefs.getBoolean(context, Key.QS_WORK_ADDED, false)) { host.getManagedProfileController().addCallback(mProfileCallback); } if (!Prefs.getBoolean(context, Key.QS_NIGHT_ADDED, false)) { host.getNightModeController().addListener(mNightModeListener); } } public void destroy() { // TODO: Remove any registered listeners. } private final NightModeController.Listener mNightModeListener = new NightModeController.Listener() { @Override public void onNightModeChanged() { mHost.addTile("night"); Prefs.putBoolean(mContext, Key.QS_NIGHT_ADDED, true); mHandler.post(new Runnable() { @Override public void run() { mHost.getNightModeController().removeListener(mNightModeListener); } }); } @Override public void onTwilightAutoChanged() { } }; private final ManagedProfileController.Callback mProfileCallback = new ManagedProfileController.Callback() { @Override Loading Loading
packages/SystemUI/src/com/android/systemui/Prefs.java +2 −0 Original line number Diff line number Diff line Loading @@ -48,6 +48,7 @@ public final class Prefs { Key.QS_DATA_SAVER_ADDED, Key.QS_INVERT_COLORS_ADDED, Key.QS_WORK_ADDED, Key.QS_NIGHT_ADDED, }) public @interface Key { String OVERVIEW_SEARCH_APP_WIDGET_ID = "searchAppWidgetId"; Loading @@ -68,6 +69,7 @@ public final class Prefs { String QS_DATA_SAVER_ADDED = "QsDataSaverAdded"; String QS_INVERT_COLORS_ADDED = "QsInvertColorsAdded"; String QS_WORK_ADDED = "QsWorkAdded"; String QS_NIGHT_ADDED = "QsNightAdded"; } public static boolean getBoolean(Context context, @Key String key, boolean defaultValue) { Loading
packages/SystemUI/src/com/android/systemui/qs/customize/TileAdapter.java +4 −1 Original line number Diff line number Diff line Loading @@ -107,7 +107,10 @@ public class TileAdapter extends RecyclerView.Adapter<Holder> implements TileSta mOtherTiles = new ArrayList<TileInfo>(mAllTiles); mTiles.clear(); for (int i = 0; i < mCurrentSpecs.size(); i++) { mTiles.add(getAndRemoveOther(mCurrentSpecs.get(i))); final TileInfo tile = getAndRemoveOther(mCurrentSpecs.get(i)); if (tile != null) { mTiles.add(tile); } } mTiles.add(null); mTiles.addAll(mOtherTiles); Loading
packages/SystemUI/src/com/android/systemui/qs/customize/TileQueryHelper.java +11 −2 Original line number Diff line number Diff line Loading @@ -28,11 +28,14 @@ import android.os.AsyncTask; import android.os.Handler; import android.os.Looper; import android.service.quicksettings.TileService; import com.android.systemui.Prefs; import com.android.systemui.Prefs.Key; import com.android.systemui.R; import com.android.systemui.qs.QSTile; import com.android.systemui.qs.QSTile.DrawableIcon; import com.android.systemui.qs.external.CustomTile; import com.android.systemui.statusbar.phone.QSTileHost; import com.android.systemui.tuner.TunerService; import java.util.ArrayList; import java.util.Collection; Loading @@ -54,7 +57,8 @@ public class TileQueryHelper { } private void addSystemTiles(QSTileHost host) { boolean hasColorMod = host.getNightModeController().isEnabled(); boolean hasColorMod = Prefs.getBoolean(host.getContext(), Key.QS_NIGHT_ADDED, false) && TunerService.isTunerEnabled(host.getContext()); String possible = mContext.getString(R.string.quick_settings_tiles_default) + ",hotspot,inversion,saver,work,cast" + (hasColorMod ? ",night" : ""); String[] possibleTiles = possible.split(","); Loading Loading @@ -86,12 +90,17 @@ public class TileQueryHelper { }); } qsHandler.post(new Runnable() { @Override public void run() { mainHandler.post(new Runnable() { @Override public void run() { new QueryTilesTask().execute(); } }); } }); } public void setListener(TileStateListener listener) { mListener = listener; Loading
packages/SystemUI/src/com/android/systemui/statusbar/phone/AutoTileManager.java +22 −0 Original line number Diff line number Diff line Loading @@ -24,6 +24,7 @@ import com.android.systemui.statusbar.policy.DataSaverController; import com.android.systemui.statusbar.policy.DataSaverController.Listener; import com.android.systemui.statusbar.policy.HotspotController; import com.android.systemui.statusbar.policy.HotspotController.Callback; import com.android.systemui.statusbar.policy.NightModeController; /** * Manages which tiles should be automatically added to QS. Loading Loading @@ -66,12 +67,33 @@ public class AutoTileManager { if (!Prefs.getBoolean(context, Key.QS_WORK_ADDED, false)) { host.getManagedProfileController().addCallback(mProfileCallback); } if (!Prefs.getBoolean(context, Key.QS_NIGHT_ADDED, false)) { host.getNightModeController().addListener(mNightModeListener); } } public void destroy() { // TODO: Remove any registered listeners. } private final NightModeController.Listener mNightModeListener = new NightModeController.Listener() { @Override public void onNightModeChanged() { mHost.addTile("night"); Prefs.putBoolean(mContext, Key.QS_NIGHT_ADDED, true); mHandler.post(new Runnable() { @Override public void run() { mHost.getNightModeController().removeListener(mNightModeListener); } }); } @Override public void onTwilightAutoChanged() { } }; private final ManagedProfileController.Callback mProfileCallback = new ManagedProfileController.Callback() { @Override Loading