Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c4988ae7 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Automerger Merge Worker
Browse files

Merge "Move conversation app name into header" into rvc-dev am: 821b7f21 am:...

Merge "Move conversation app name into header" into rvc-dev am: 821b7f21 am: 83b97589 am: c233896a

Change-Id: I005cffcc1ccc161938023db10aa4b659f6417b60
parents 8f6435e8 c233896a
Loading
Loading
Loading
Loading
+20 −28
Original line number Original line Diff line number Diff line
@@ -115,10 +115,9 @@ public class ConversationLayout extends FrameLayout
    private ImageResolver mImageResolver;
    private ImageResolver mImageResolver;
    private CachingIconView mConversationIconView;
    private CachingIconView mConversationIconView;
    private View mConversationIconContainer;
    private View mConversationIconContainer;
    private int mConversationIconTopPadding;
    private int mConversationIconTopPaddingExpandedGroup;
    private int mConversationIconTopPaddingExpandedGroup;
    private int mConversationIconTopPaddingNoAppName;
    private int mConversationIconTopPadding;
    private int mExpandedGroupMessagePaddingNoAppName;
    private int mExpandedGroupMessagePadding;
    private TextView mConversationText;
    private TextView mConversationText;
    private View mConversationIconBadge;
    private View mConversationIconBadge;
    private CachingIconView mConversationIconBadgeBg;
    private CachingIconView mConversationIconBadgeBg;
@@ -162,6 +161,7 @@ public class ConversationLayout extends FrameLayout
    private Rect mAppOpsTouchRect = new Rect();
    private Rect mAppOpsTouchRect = new Rect();
    private float mMinTouchSize;
    private float mMinTouchSize;
    private Icon mConversationIcon;
    private Icon mConversationIcon;
    private View mAppNameDivider;


    public ConversationLayout(@NonNull Context context) {
    public ConversationLayout(@NonNull Context context) {
        super(context);
        super(context);
@@ -261,14 +261,12 @@ public class ConversationLayout extends FrameLayout
                R.dimen.conversation_avatar_size);
                R.dimen.conversation_avatar_size);
        mConversationAvatarSizeExpanded = getResources().getDimensionPixelSize(
        mConversationAvatarSizeExpanded = getResources().getDimensionPixelSize(
                R.dimen.conversation_avatar_size_group_expanded);
                R.dimen.conversation_avatar_size_group_expanded);
        mConversationIconTopPadding = getResources().getDimensionPixelSize(
                R.dimen.conversation_icon_container_top_padding);
        mConversationIconTopPaddingExpandedGroup = getResources().getDimensionPixelSize(
        mConversationIconTopPaddingExpandedGroup = getResources().getDimensionPixelSize(
                R.dimen.conversation_icon_container_top_padding_small_avatar);
                R.dimen.conversation_icon_container_top_padding_small_avatar);
        mConversationIconTopPaddingNoAppName = getResources().getDimensionPixelSize(
        mConversationIconTopPadding = getResources().getDimensionPixelSize(
                R.dimen.conversation_icon_container_top_padding_no_app_name);
                R.dimen.conversation_icon_container_top_padding);
        mExpandedGroupMessagePaddingNoAppName = getResources().getDimensionPixelSize(
        mExpandedGroupMessagePadding = getResources().getDimensionPixelSize(
                R.dimen.expanded_group_conversation_message_padding_without_app_name);
                R.dimen.expanded_group_conversation_message_padding);
        mExpandedGroupSideMargin = getResources().getDimensionPixelSize(
        mExpandedGroupSideMargin = getResources().getDimensionPixelSize(
                R.dimen.conversation_badge_side_margin_group_expanded);
                R.dimen.conversation_badge_side_margin_group_expanded);
        mExpandedGroupSideMarginFacePile = getResources().getDimensionPixelSize(
        mExpandedGroupSideMarginFacePile = getResources().getDimensionPixelSize(
@@ -287,6 +285,7 @@ public class ConversationLayout extends FrameLayout
        mFallbackGroupChatName = getResources().getString(
        mFallbackGroupChatName = getResources().getString(
                R.string.conversation_title_fallback_group_chat);
                R.string.conversation_title_fallback_group_chat);
        mAppName = findViewById(R.id.app_name_text);
        mAppName = findViewById(R.id.app_name_text);
        mAppNameDivider = findViewById(R.id.app_name_divider);
        mAppNameGone = mAppName.getVisibility() == GONE;
        mAppNameGone = mAppName.getVisibility() == GONE;
        mAppName.setOnVisibilityChangedListener((visibility) -> {
        mAppName.setOnVisibilityChangedListener((visibility) -> {
            onAppNameVisibilityChanged();
            onAppNameVisibilityChanged();
@@ -524,6 +523,7 @@ public class ConversationLayout extends FrameLayout
        updateImageMessages();
        updateImageMessages();
        updatePaddingsBasedOnContentAvailability();
        updatePaddingsBasedOnContentAvailability();
        updateActionListPadding();
        updateActionListPadding();
        updateAppNameDividerVisibility();
    }
    }


    private void updateActionListPadding() {
    private void updateActionListPadding() {
@@ -685,27 +685,15 @@ public class ConversationLayout extends FrameLayout
    }
    }


    private void updatePaddingsBasedOnContentAvailability() {
    private void updatePaddingsBasedOnContentAvailability() {
        int containerTopPadding;
        int messagingPadding = mIsOneToOne || mIsCollapsed
        int messagingPadding = 0;
                ? 0
        if (mIsOneToOne || mIsCollapsed) {
                // Add some extra padding to the messages, since otherwise it will overlap with the
            containerTopPadding = mConversationIconTopPadding;
                // group
        } else {
                : mExpandedGroupMessagePadding;
            if (mAppName.getVisibility() != GONE) {
                // The app name is visible, let's center outselves in the two lines
                containerTopPadding = mConversationIconTopPaddingExpandedGroup;
            } else {
                // App name is gone, let's center ourselves int he one remaining line
                containerTopPadding = mConversationIconTopPaddingNoAppName;

                // The app name is gone and we're a group, we'll need to add some extra padding
                // to the messages, since otherwise it will overlap with the group
                messagingPadding = mExpandedGroupMessagePaddingNoAppName;
            }
        }


        mConversationIconContainer.setPaddingRelative(
        mConversationIconContainer.setPaddingRelative(
                mConversationIconContainer.getPaddingStart(),
                mConversationIconContainer.getPaddingStart(),
                containerTopPadding,
                mConversationIconTopPadding,
                mConversationIconContainer.getPaddingEnd(),
                mConversationIconContainer.getPaddingEnd(),
                mConversationIconContainer.getPaddingBottom());
                mConversationIconContainer.getPaddingBottom());


@@ -1214,8 +1202,12 @@ public class ConversationLayout extends FrameLayout
        boolean appNameGone = mAppName.getVisibility() == GONE;
        boolean appNameGone = mAppName.getVisibility() == GONE;
        if (appNameGone != mAppNameGone) {
        if (appNameGone != mAppNameGone) {
            mAppNameGone = appNameGone;
            mAppNameGone = appNameGone;
            updatePaddingsBasedOnContentAvailability();
            updateAppNameDividerVisibility();
        }
    }
    }

    private void updateAppNameDividerVisibility() {
        mAppNameDivider.setVisibility(mAppNameGone ? GONE : VISIBLE);
    }
    }


    public void updateExpandability(boolean expandable, @Nullable OnClickListener onClickListener) {
    public void updateExpandability(boolean expandable, @Nullable OnClickListener onClickListener) {
+26 −11
Original line number Original line Diff line number Diff line
@@ -139,6 +139,32 @@
                        android:layout_weight="1"
                        android:layout_weight="1"
                        />
                        />



                    <TextView
                        android:id="@+id/app_name_divider"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:textAppearance="?attr/notificationHeaderTextAppearance"
                        android:layout_marginStart="@dimen/notification_header_separating_margin"
                        android:layout_marginEnd="@dimen/notification_header_separating_margin"
                        android:text="@string/notification_header_divider_symbol"
                        android:layout_gravity="center"
                        android:paddingTop="1sp"
                        android:singleLine="true"
                        android:visibility="gone"
                    />

                    <!-- App Name -->
                    <com.android.internal.widget.ObservableTextView
                        android:id="@+id/app_name_text"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_marginStart="@dimen/conversation_content_start"
                        android:textSize="12sp"
                        android:layout_marginBottom="16dp"
                        android:textAppearance="@style/TextAppearance.DeviceDefault.Notification.Info"
                    />

                    <TextView
                    <TextView
                        android:id="@+id/time_divider"
                        android:id="@+id/time_divider"
                        android:layout_width="wrap_content"
                        android:layout_width="wrap_content"
@@ -230,17 +256,6 @@
                    </LinearLayout>
                    </LinearLayout>
                </LinearLayout>
                </LinearLayout>


                <!-- App Name -->
                <com.android.internal.widget.ObservableTextView
                    android:id="@+id/app_name_text"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginStart="@dimen/conversation_content_start"
                    android:textSize="12sp"
                    android:layout_marginBottom="16dp"
                    android:textAppearance="@style/TextAppearance.DeviceDefault.Notification"
                />

                <!-- Messages -->
                <!-- Messages -->
                <com.android.internal.widget.MessagingLinearLayout
                <com.android.internal.widget.MessagingLinearLayout
                    android:id="@+id/notification_messaging"
                    android:id="@+id/notification_messaging"
+3 −6
Original line number Original line Diff line number Diff line
@@ -710,14 +710,11 @@
    <dimen name="conversation_face_pile_protection_width">2dp</dimen>
    <dimen name="conversation_face_pile_protection_width">2dp</dimen>
    <!-- The width of the protection of the face pile layout when expanded-->
    <!-- The width of the protection of the face pile layout when expanded-->
    <dimen name="conversation_face_pile_protection_width_expanded">1dp</dimen>
    <dimen name="conversation_face_pile_protection_width_expanded">1dp</dimen>
    <!-- The padding of the expanded message container when the app name is gone-->
    <!-- The padding of the expanded message container-->
    <dimen name="expanded_group_conversation_message_padding_without_app_name">14dp</dimen>
    <dimen name="expanded_group_conversation_message_padding">14dp</dimen>


    <!-- The top padding of the conversation icon container in the regular state-->
    <!-- The top padding of the conversation icon container in the regular state-->
    <dimen name="conversation_icon_container_top_padding">12dp</dimen>
    <dimen name="conversation_icon_container_top_padding">9dp</dimen>

    <!-- The top padding of the conversation icon container when there's no app name present in a group-->
    <dimen name="conversation_icon_container_top_padding_no_app_name">9dp</dimen>


    <!-- The top padding of the conversation icon container when the avatar is small-->
    <!-- The top padding of the conversation icon container when the avatar is small-->
    <dimen name="conversation_icon_container_top_padding_small_avatar">17.5dp</dimen>
    <dimen name="conversation_icon_container_top_padding_small_avatar">17.5dp</dimen>
+2 −2
Original line number Original line Diff line number Diff line
@@ -2824,6 +2824,7 @@


  <java-symbol type="string" name="notification_hidden_text" />
  <java-symbol type="string" name="notification_hidden_text" />
  <java-symbol type="id" name="app_name_text" />
  <java-symbol type="id" name="app_name_text" />
  <java-symbol type="id" name="app_name_divider" />
  <java-symbol type="id" name="header_text" />
  <java-symbol type="id" name="header_text" />
  <java-symbol type="id" name="header_text_secondary" />
  <java-symbol type="id" name="header_text_secondary" />
  <java-symbol type="id" name="expand_button" />
  <java-symbol type="id" name="expand_button" />
@@ -3912,12 +3913,11 @@
  <java-symbol type="dimen" name="conversation_badge_side_margin_group_expanded" />
  <java-symbol type="dimen" name="conversation_badge_side_margin_group_expanded" />
  <java-symbol type="dimen" name="conversation_badge_side_margin_group_expanded_face_pile" />
  <java-symbol type="dimen" name="conversation_badge_side_margin_group_expanded_face_pile" />
  <java-symbol type="dimen" name="conversation_content_start" />
  <java-symbol type="dimen" name="conversation_content_start" />
  <java-symbol type="dimen" name="expanded_group_conversation_message_padding_without_app_name" />
  <java-symbol type="dimen" name="expanded_group_conversation_message_padding" />
  <java-symbol type="dimen" name="messaging_layout_margin_end" />
  <java-symbol type="dimen" name="messaging_layout_margin_end" />
  <java-symbol type="dimen" name="conversation_header_expanded_padding_end" />
  <java-symbol type="dimen" name="conversation_header_expanded_padding_end" />
  <java-symbol type="dimen" name="conversation_icon_container_top_padding" />
  <java-symbol type="dimen" name="conversation_icon_container_top_padding" />
  <java-symbol type="dimen" name="conversation_icon_container_top_padding_small_avatar" />
  <java-symbol type="dimen" name="conversation_icon_container_top_padding_small_avatar" />
  <java-symbol type="dimen" name="conversation_icon_container_top_padding_no_app_name" />
  <java-symbol type="layout" name="notification_template_material_conversation" />
  <java-symbol type="layout" name="notification_template_material_conversation" />
  <java-symbol type="dimen" name="button_padding_horizontal_material" />
  <java-symbol type="dimen" name="button_padding_horizontal_material" />
  <java-symbol type="dimen" name="button_inset_horizontal_material" />
  <java-symbol type="dimen" name="button_inset_horizontal_material" />