Merge "Improve dream overlay status bar icon spacing." into tm-qpr-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
69481d95aa
@@ -40,7 +40,6 @@
|
|||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:orientation="horizontal"
|
android:orientation="horizontal"
|
||||||
android:gravity="center_vertical"
|
android:gravity="center_vertical"
|
||||||
android:layout_marginEnd="@dimen/dream_overlay_status_bar_extra_margin"
|
|
||||||
app:layout_constraintEnd_toStartOf="@+id/dream_overlay_system_status" />
|
app:layout_constraintEnd_toStartOf="@+id/dream_overlay_system_status" />
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
@@ -48,14 +47,15 @@
|
|||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:orientation="horizontal"
|
android:orientation="horizontal"
|
||||||
android:layout_marginStart="@dimen/dream_overlay_status_bar_extra_margin"
|
android:paddingStart="@dimen/dream_overlay_status_bar_extra_margin"
|
||||||
|
android:visibility="gone"
|
||||||
app:layout_constraintEnd_toEndOf="parent">
|
app:layout_constraintEnd_toEndOf="parent">
|
||||||
|
|
||||||
<com.android.systemui.statusbar.AlphaOptimizedImageView
|
<com.android.systemui.statusbar.AlphaOptimizedImageView
|
||||||
android:id="@+id/dream_overlay_alarm_set"
|
android:id="@+id/dream_overlay_alarm_set"
|
||||||
android:layout_width="@dimen/dream_overlay_status_bar_icon_size"
|
android:layout_width="@dimen/dream_overlay_status_bar_icon_size"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:layout_marginEnd="@dimen/dream_overlay_status_icon_margin"
|
android:layout_marginStart="@dimen/dream_overlay_status_icon_margin"
|
||||||
android:src="@drawable/ic_alarm"
|
android:src="@drawable/ic_alarm"
|
||||||
android:tint="@android:color/white"
|
android:tint="@android:color/white"
|
||||||
android:visibility="gone"
|
android:visibility="gone"
|
||||||
@@ -65,7 +65,7 @@
|
|||||||
android:id="@+id/dream_overlay_priority_mode"
|
android:id="@+id/dream_overlay_priority_mode"
|
||||||
android:layout_width="@dimen/dream_overlay_status_bar_icon_size"
|
android:layout_width="@dimen/dream_overlay_status_bar_icon_size"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:layout_marginEnd="@dimen/dream_overlay_status_icon_margin"
|
android:layout_marginStart="@dimen/dream_overlay_status_icon_margin"
|
||||||
android:src="@drawable/ic_qs_dnd_on"
|
android:src="@drawable/ic_qs_dnd_on"
|
||||||
android:tint="@android:color/white"
|
android:tint="@android:color/white"
|
||||||
android:visibility="gone"
|
android:visibility="gone"
|
||||||
@@ -75,7 +75,7 @@
|
|||||||
android:id="@+id/dream_overlay_wifi_status"
|
android:id="@+id/dream_overlay_wifi_status"
|
||||||
android:layout_width="@dimen/dream_overlay_status_bar_icon_size"
|
android:layout_width="@dimen/dream_overlay_status_bar_icon_size"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:layout_marginEnd="@dimen/dream_overlay_status_icon_margin"
|
android:layout_marginStart="@dimen/dream_overlay_status_icon_margin"
|
||||||
android:src="@drawable/ic_signal_wifi_off"
|
android:src="@drawable/ic_signal_wifi_off"
|
||||||
android:visibility="gone"
|
android:visibility="gone"
|
||||||
android:contentDescription="@string/dream_overlay_status_bar_wifi_off" />
|
android:contentDescription="@string/dream_overlay_status_bar_wifi_off" />
|
||||||
@@ -84,7 +84,7 @@
|
|||||||
android:id="@+id/dream_overlay_mic_off"
|
android:id="@+id/dream_overlay_mic_off"
|
||||||
android:layout_width="@dimen/dream_overlay_grey_chip_width"
|
android:layout_width="@dimen/dream_overlay_grey_chip_width"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:layout_marginEnd="@dimen/dream_overlay_status_icon_margin"
|
android:layout_marginStart="@dimen/dream_overlay_status_icon_margin"
|
||||||
android:src="@drawable/dream_overlay_mic_off"
|
android:src="@drawable/dream_overlay_mic_off"
|
||||||
android:visibility="gone"
|
android:visibility="gone"
|
||||||
android:contentDescription="@string/dream_overlay_status_bar_mic_off" />
|
android:contentDescription="@string/dream_overlay_status_bar_mic_off" />
|
||||||
@@ -93,7 +93,7 @@
|
|||||||
android:id="@+id/dream_overlay_camera_off"
|
android:id="@+id/dream_overlay_camera_off"
|
||||||
android:layout_width="@dimen/dream_overlay_grey_chip_width"
|
android:layout_width="@dimen/dream_overlay_grey_chip_width"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:layout_marginEnd="@dimen/dream_overlay_status_icon_margin"
|
android:layout_marginStart="@dimen/dream_overlay_status_icon_margin"
|
||||||
android:src="@drawable/dream_overlay_camera_off"
|
android:src="@drawable/dream_overlay_camera_off"
|
||||||
android:visibility="gone"
|
android:visibility="gone"
|
||||||
android:contentDescription="@string/dream_overlay_status_bar_camera_off" />
|
android:contentDescription="@string/dream_overlay_status_bar_camera_off" />
|
||||||
@@ -102,7 +102,7 @@
|
|||||||
android:id="@+id/dream_overlay_camera_mic_off"
|
android:id="@+id/dream_overlay_camera_mic_off"
|
||||||
android:layout_width="@dimen/dream_overlay_grey_chip_width"
|
android:layout_width="@dimen/dream_overlay_grey_chip_width"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:layout_marginEnd="@dimen/dream_overlay_status_icon_margin"
|
android:layout_marginStart="@dimen/dream_overlay_status_icon_margin"
|
||||||
android:src="@drawable/dream_overlay_mic_and_camera_off"
|
android:src="@drawable/dream_overlay_mic_and_camera_off"
|
||||||
android:visibility="gone"
|
android:visibility="gone"
|
||||||
android:contentDescription="@string/dream_overlay_status_bar_camera_mic_off" />
|
android:contentDescription="@string/dream_overlay_status_bar_camera_mic_off" />
|
||||||
|
|||||||
@@ -1464,7 +1464,7 @@
|
|||||||
<dimen name="dream_overlay_camera_mic_off_indicator_size">8dp</dimen>
|
<dimen name="dream_overlay_camera_mic_off_indicator_size">8dp</dimen>
|
||||||
<dimen name="dream_overlay_notification_indicator_size">6dp</dimen>
|
<dimen name="dream_overlay_notification_indicator_size">6dp</dimen>
|
||||||
<dimen name="dream_overlay_grey_chip_width">56dp</dimen>
|
<dimen name="dream_overlay_grey_chip_width">56dp</dimen>
|
||||||
<dimen name="dream_overlay_status_bar_extra_margin">16dp</dimen>
|
<dimen name="dream_overlay_status_bar_extra_margin">8dp</dimen>
|
||||||
|
|
||||||
<!-- Dream overlay complications related dimensions -->
|
<!-- Dream overlay complications related dimensions -->
|
||||||
<dimen name="dream_overlay_complication_clock_time_text_size">86sp</dimen>
|
<dimen name="dream_overlay_complication_clock_time_text_size">86sp</dimen>
|
||||||
|
|||||||
@@ -61,6 +61,7 @@ public class DreamOverlayStatusBarView extends ConstraintLayout {
|
|||||||
|
|
||||||
private final Map<Integer, View> mStatusIcons = new HashMap<>();
|
private final Map<Integer, View> mStatusIcons = new HashMap<>();
|
||||||
private ViewGroup mSystemStatusViewGroup;
|
private ViewGroup mSystemStatusViewGroup;
|
||||||
|
private ViewGroup mExtraSystemStatusViewGroup;
|
||||||
|
|
||||||
public DreamOverlayStatusBarView(Context context) {
|
public DreamOverlayStatusBarView(Context context) {
|
||||||
this(context, null);
|
this(context, null);
|
||||||
@@ -98,7 +99,8 @@ public class DreamOverlayStatusBarView extends ConstraintLayout {
|
|||||||
mStatusIcons.put(STATUS_ICON_PRIORITY_MODE_ON,
|
mStatusIcons.put(STATUS_ICON_PRIORITY_MODE_ON,
|
||||||
fetchStatusIconForResId(R.id.dream_overlay_priority_mode));
|
fetchStatusIconForResId(R.id.dream_overlay_priority_mode));
|
||||||
|
|
||||||
mSystemStatusViewGroup = findViewById(R.id.dream_overlay_extra_items);
|
mSystemStatusViewGroup = findViewById(R.id.dream_overlay_system_status);
|
||||||
|
mExtraSystemStatusViewGroup = findViewById(R.id.dream_overlay_extra_items);
|
||||||
}
|
}
|
||||||
|
|
||||||
void showIcon(@StatusIconType int iconType, boolean show, @Nullable String contentDescription) {
|
void showIcon(@StatusIconType int iconType, boolean show, @Nullable String contentDescription) {
|
||||||
@@ -110,11 +112,12 @@ public class DreamOverlayStatusBarView extends ConstraintLayout {
|
|||||||
icon.setContentDescription(contentDescription);
|
icon.setContentDescription(contentDescription);
|
||||||
}
|
}
|
||||||
icon.setVisibility(show ? View.VISIBLE : View.GONE);
|
icon.setVisibility(show ? View.VISIBLE : View.GONE);
|
||||||
|
mSystemStatusViewGroup.setVisibility(areAnyStatusIconsVisible() ? View.VISIBLE : View.GONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
void setExtraStatusBarItemViews(List<View> views) {
|
void setExtraStatusBarItemViews(List<View> views) {
|
||||||
removeAllStatusBarItemViews();
|
removeAllExtraStatusBarItemViews();
|
||||||
views.forEach(view -> mSystemStatusViewGroup.addView(view));
|
views.forEach(view -> mExtraSystemStatusViewGroup.addView(view));
|
||||||
}
|
}
|
||||||
|
|
||||||
private View fetchStatusIconForResId(int resId) {
|
private View fetchStatusIconForResId(int resId) {
|
||||||
@@ -122,7 +125,16 @@ public class DreamOverlayStatusBarView extends ConstraintLayout {
|
|||||||
return Objects.requireNonNull(statusIcon);
|
return Objects.requireNonNull(statusIcon);
|
||||||
}
|
}
|
||||||
|
|
||||||
void removeAllStatusBarItemViews() {
|
void removeAllExtraStatusBarItemViews() {
|
||||||
mSystemStatusViewGroup.removeAllViews();
|
mExtraSystemStatusViewGroup.removeAllViews();
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean areAnyStatusIconsVisible() {
|
||||||
|
for (int i = 0; i < mSystemStatusViewGroup.getChildCount(); i++) {
|
||||||
|
if (mSystemStatusViewGroup.getChildAt(i).getVisibility() == View.VISIBLE) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -192,7 +192,7 @@ public class DreamOverlayStatusBarViewController extends ViewController<DreamOve
|
|||||||
mDreamOverlayNotificationCountProvider.ifPresent(
|
mDreamOverlayNotificationCountProvider.ifPresent(
|
||||||
provider -> provider.removeCallback(mNotificationCountCallback));
|
provider -> provider.removeCallback(mNotificationCountCallback));
|
||||||
mStatusBarItemsProvider.removeCallback(mStatusBarItemsProviderCallback);
|
mStatusBarItemsProvider.removeCallback(mStatusBarItemsProviderCallback);
|
||||||
mView.removeAllStatusBarItemViews();
|
mView.removeAllExtraStatusBarItemViews();
|
||||||
mTouchInsetSession.clear();
|
mTouchInsetSession.clear();
|
||||||
|
|
||||||
mIsAttached = false;
|
mIsAttached = false;
|
||||||
|
|||||||
@@ -310,7 +310,7 @@ public class DreamOverlayStatusBarViewControllerTest extends SysuiTestCase {
|
|||||||
@Test
|
@Test
|
||||||
public void testOnViewDetachedRemovesViews() {
|
public void testOnViewDetachedRemovesViews() {
|
||||||
mController.onViewDetached();
|
mController.onViewDetached();
|
||||||
verify(mView).removeAllStatusBarItemViews();
|
verify(mView).removeAllExtraStatusBarItemViews();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|||||||
Reference in New Issue
Block a user