Merge "Show chevron on ScreenRecordTile" into sc-dev am: a3b91578ee
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/14981270 Change-Id: I1f9ceeb35f235ba2095f333ab23ecbc851a3774f
This commit is contained in:
@@ -103,6 +103,8 @@ public class ScreenRecordTile extends QSTileImpl<QSTile.BooleanState>
|
|||||||
state.state = (isRecording || isStarting) ? Tile.STATE_ACTIVE : Tile.STATE_INACTIVE;
|
state.state = (isRecording || isStarting) ? Tile.STATE_ACTIVE : Tile.STATE_INACTIVE;
|
||||||
state.label = mContext.getString(R.string.quick_settings_screen_record_label);
|
state.label = mContext.getString(R.string.quick_settings_screen_record_label);
|
||||||
state.icon = ResourceIcon.get(R.drawable.ic_screenrecord);
|
state.icon = ResourceIcon.get(R.drawable.ic_screenrecord);
|
||||||
|
// Show expand icon when clicking will open a dialog
|
||||||
|
state.forceExpandIcon = state.state == Tile.STATE_INACTIVE;
|
||||||
|
|
||||||
if (isRecording) {
|
if (isRecording) {
|
||||||
state.secondaryLabel = mContext.getString(R.string.quick_settings_screen_record_stop);
|
state.secondaryLabel = mContext.getString(R.string.quick_settings_screen_record_stop);
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ package com.android.systemui.qs.tiles;
|
|||||||
import static junit.framework.Assert.assertEquals;
|
import static junit.framework.Assert.assertEquals;
|
||||||
import static junit.framework.Assert.assertTrue;
|
import static junit.framework.Assert.assertTrue;
|
||||||
|
|
||||||
|
import static org.junit.Assert.assertFalse;
|
||||||
import static org.mockito.Mockito.times;
|
import static org.mockito.Mockito.times;
|
||||||
import static org.mockito.Mockito.verify;
|
import static org.mockito.Mockito.verify;
|
||||||
import static org.mockito.Mockito.when;
|
import static org.mockito.Mockito.when;
|
||||||
@@ -167,4 +168,37 @@ public class ScreenRecordTileTest extends SysuiTestCase {
|
|||||||
|
|
||||||
assertTrue(mTile.getState().contentDescription.toString().contains(mTile.getState().label));
|
assertTrue(mTile.getState().contentDescription.toString().contains(mTile.getState().label));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testForceExpandIcon_notRecordingNotStarting() {
|
||||||
|
when(mController.isStarting()).thenReturn(false);
|
||||||
|
when(mController.isRecording()).thenReturn(false);
|
||||||
|
|
||||||
|
mTile.refreshState();
|
||||||
|
mTestableLooper.processAllMessages();
|
||||||
|
|
||||||
|
assertTrue(mTile.getState().forceExpandIcon);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testForceExpandIcon_recordingNotStarting() {
|
||||||
|
when(mController.isStarting()).thenReturn(false);
|
||||||
|
when(mController.isRecording()).thenReturn(true);
|
||||||
|
|
||||||
|
mTile.refreshState();
|
||||||
|
mTestableLooper.processAllMessages();
|
||||||
|
|
||||||
|
assertFalse(mTile.getState().forceExpandIcon);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testForceExpandIcon_startingNotRecording() {
|
||||||
|
when(mController.isStarting()).thenReturn(true);
|
||||||
|
when(mController.isRecording()).thenReturn(false);
|
||||||
|
|
||||||
|
mTile.refreshState();
|
||||||
|
mTestableLooper.processAllMessages();
|
||||||
|
|
||||||
|
assertFalse(mTile.getState().forceExpandIcon);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user