Merge "Use view layouts rather than compositing an image" into sc-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
2bd8c0f2fb
@@ -36,13 +36,62 @@
|
|||||||
android:clipChildren="false"
|
android:clipChildren="false"
|
||||||
android:paddingTop="@dimen/notification_guts_header_top_padding"
|
android:paddingTop="@dimen/notification_guts_header_top_padding"
|
||||||
android:clipToPadding="true">
|
android:clipToPadding="true">
|
||||||
<ImageView
|
<FrameLayout
|
||||||
android:id="@+id/conversation_icon"
|
android:layout_width="wrap_content"
|
||||||
android:layout_width="@dimen/notification_guts_conversation_icon_size"
|
android:layout_height="wrap_content"
|
||||||
android:layout_height="@dimen/notification_guts_conversation_icon_size"
|
android:clipChildren="false"
|
||||||
|
android:clipToPadding="false"
|
||||||
android:layout_centerVertical="false"
|
android:layout_centerVertical="false"
|
||||||
android:layout_alignParentStart="true"
|
android:layout_alignParentStart="true"
|
||||||
android:layout_marginEnd="12dp" />
|
android:layout_marginEnd="12dp"
|
||||||
|
>
|
||||||
|
|
||||||
|
<!-- Big icon: 52x52, 12dp padding left + top, 16dp padding right -->
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/conversation_icon"
|
||||||
|
android:layout_width="@*android:dimen/conversation_avatar_size"
|
||||||
|
android:layout_height="@*android:dimen/conversation_avatar_size"
|
||||||
|
android:scaleType="centerCrop"
|
||||||
|
android:importantForAccessibility="no"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<FrameLayout
|
||||||
|
android:id="@+id/conversation_icon_badge"
|
||||||
|
android:layout_width="@*android:dimen/conversation_icon_size_badged"
|
||||||
|
android:layout_height="@*android:dimen/conversation_icon_size_badged"
|
||||||
|
android:layout_marginLeft="@*android:dimen/conversation_badge_side_margin"
|
||||||
|
android:layout_marginTop="@*android:dimen/conversation_badge_side_margin"
|
||||||
|
android:clipChildren="false"
|
||||||
|
android:clipToPadding="false"
|
||||||
|
>
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/conversation_icon_badge_bg"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:layout_gravity="center"
|
||||||
|
android:src="@*android:drawable/conversation_badge_background"
|
||||||
|
android:forceHasOverlappingRendering="false"
|
||||||
|
/>
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/conversation_icon_badge_icon"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:layout_margin="4dp"
|
||||||
|
android:layout_gravity="center"
|
||||||
|
android:forceHasOverlappingRendering="false"
|
||||||
|
/>
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/conversation_icon_badge_ring"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="center"
|
||||||
|
android:src="@*android:drawable/conversation_badge_ring"
|
||||||
|
android:forceHasOverlappingRendering="false"
|
||||||
|
android:clipToPadding="false"
|
||||||
|
android:scaleType="center"
|
||||||
|
/>
|
||||||
|
</FrameLayout>
|
||||||
|
</FrameLayout>
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:id="@+id/names"
|
android:id="@+id/names"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
|
|||||||
@@ -243,7 +243,7 @@
|
|||||||
<dimen name="notification_guts_conversation_action_text_padding_start">32dp</dimen>
|
<dimen name="notification_guts_conversation_action_text_padding_start">32dp</dimen>
|
||||||
<dimen name="conversation_onboarding_bullet_gap_width">6dp</dimen>
|
<dimen name="conversation_onboarding_bullet_gap_width">6dp</dimen>
|
||||||
|
|
||||||
<dimen name="notification_guts_header_top_padding">11dp</dimen>
|
<dimen name="notification_guts_header_top_padding">12dp</dimen>
|
||||||
|
|
||||||
<!-- The height of the header in inline settings -->
|
<!-- The height of the header in inline settings -->
|
||||||
<dimen name="notification_guts_header_height">24dp</dimen>
|
<dimen name="notification_guts_header_height">24dp</dimen>
|
||||||
|
|||||||
@@ -346,9 +346,22 @@ public class NotificationConversationInfo extends LinearLayout implements
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void bindIcon(boolean important) {
|
private void bindIcon(boolean important) {
|
||||||
|
Drawable person = mIconFactory.getBaseIconDrawable(mShortcutInfo);
|
||||||
|
if (person == null) {
|
||||||
|
person = mContext.getDrawable(R.drawable.ic_person).mutate();
|
||||||
|
TypedArray ta = mContext.obtainStyledAttributes(new int[]{android.R.attr.colorAccent});
|
||||||
|
int colorAccent = ta.getColor(0, 0);
|
||||||
|
ta.recycle();
|
||||||
|
person.setTint(colorAccent);
|
||||||
|
}
|
||||||
ImageView image = findViewById(R.id.conversation_icon);
|
ImageView image = findViewById(R.id.conversation_icon);
|
||||||
image.setImageDrawable(mIconFactory.getConversationDrawable(
|
image.setImageDrawable(person);
|
||||||
mShortcutInfo, mPackageName, mAppUid, important));
|
|
||||||
|
ImageView app = findViewById(R.id.conversation_icon_badge_icon);
|
||||||
|
app.setImageDrawable(mIconFactory.getAppBadge(
|
||||||
|
mPackageName, UserHandle.getUserId(mSbn.getUid())));
|
||||||
|
|
||||||
|
findViewById(R.id.conversation_icon_badge_ring).setVisibility(important ? VISIBLE : GONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void bindPackage() {
|
private void bindPackage() {
|
||||||
|
|||||||
@@ -199,8 +199,7 @@ public class NotificationConversationInfoTest extends SysuiTestCase {
|
|||||||
when(mShortcutInfo.getLabel()).thenReturn("Convo name");
|
when(mShortcutInfo.getLabel()).thenReturn("Convo name");
|
||||||
List<ShortcutInfo> shortcuts = Arrays.asList(mShortcutInfo);
|
List<ShortcutInfo> shortcuts = Arrays.asList(mShortcutInfo);
|
||||||
when(mLauncherApps.getShortcuts(any(), any())).thenReturn(shortcuts);
|
when(mLauncherApps.getShortcuts(any(), any())).thenReturn(shortcuts);
|
||||||
when(mIconFactory.getConversationDrawable(
|
when(mIconFactory.getBaseIconDrawable(any(ShortcutInfo.class)))
|
||||||
any(ShortcutInfo.class), anyString(), anyInt(), anyBoolean()))
|
|
||||||
.thenReturn(mIconDrawable);
|
.thenReturn(mIconDrawable);
|
||||||
|
|
||||||
mNotificationChannel = new NotificationChannel(
|
mNotificationChannel = new NotificationChannel(
|
||||||
|
|||||||
Reference in New Issue
Block a user