Merge "Fix QS labels on language change" into mnc-dev
This commit is contained in:
@@ -158,6 +158,9 @@ public class QSPanel extends ViewGroup {
|
||||
mColumns = columns;
|
||||
postInvalidate();
|
||||
}
|
||||
for (TileRecord r : mRecords) {
|
||||
r.tile.clearState();
|
||||
}
|
||||
if (mListening) {
|
||||
refreshAllTiles();
|
||||
}
|
||||
|
||||
@@ -61,8 +61,8 @@ public abstract class QSTile<TState extends State> implements Listenable {
|
||||
protected final Handler mUiHandler = new Handler(Looper.getMainLooper());
|
||||
|
||||
private Callback mCallback;
|
||||
protected final TState mState = newTileState();
|
||||
private final TState mTmpState = newTileState();
|
||||
protected TState mState = newTileState();
|
||||
private TState mTmpState = newTileState();
|
||||
private boolean mAnnounceNextStateChange;
|
||||
|
||||
abstract protected TState newTileState();
|
||||
@@ -139,6 +139,10 @@ public abstract class QSTile<TState extends State> implements Listenable {
|
||||
mHandler.obtainMessage(H.REFRESH_STATE, arg).sendToTarget();
|
||||
}
|
||||
|
||||
public final void clearState() {
|
||||
mHandler.sendEmptyMessage(H.CLEAR_STATE);
|
||||
}
|
||||
|
||||
public void userSwitch(int newUserId) {
|
||||
mHandler.obtainMessage(H.USER_SWITCH, newUserId, 0).sendToTarget();
|
||||
}
|
||||
@@ -178,6 +182,11 @@ public abstract class QSTile<TState extends State> implements Listenable {
|
||||
// optional
|
||||
}
|
||||
|
||||
protected void handleClearState() {
|
||||
mTmpState = newTileState();
|
||||
mState = newTileState();
|
||||
}
|
||||
|
||||
protected void handleRefreshState(Object arg) {
|
||||
handleUpdateState(mTmpState, arg);
|
||||
final boolean changed = mTmpState.copyTo(mState);
|
||||
@@ -246,6 +255,7 @@ public abstract class QSTile<TState extends State> implements Listenable {
|
||||
private static final int TOGGLE_STATE_CHANGED = 8;
|
||||
private static final int SCAN_STATE_CHANGED = 9;
|
||||
private static final int DESTROY = 10;
|
||||
private static final int CLEAR_STATE = 11;
|
||||
|
||||
private H(Looper looper) {
|
||||
super(looper);
|
||||
@@ -286,6 +296,9 @@ public abstract class QSTile<TState extends State> implements Listenable {
|
||||
} else if (msg.what == DESTROY) {
|
||||
name = "handleDestroy";
|
||||
handleDestroy();
|
||||
} else if (msg.what == CLEAR_STATE) {
|
||||
name = "handleClearState";
|
||||
handleClearState();
|
||||
} else {
|
||||
throw new IllegalArgumentException("Unknown msg: " + msg.what);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user