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

Commit c5d20509 authored by Daniel Sandler's avatar Daniel Sandler Committed by Android (Google) Code Review
Browse files

Merge "Visual tweaks to notifications." into jb-dev

parents 75856e96 6387d2f6
Loading
Loading
Loading
Loading
+17 −14
Original line number Diff line number Diff line
@@ -1379,7 +1379,7 @@ public class Notification implements Parcelable
            }
        }

        private RemoteViews applyStandardTemplate(int resId) {
        private RemoteViews applyStandardTemplate(int resId, boolean fitIn1U) {
            RemoteViews contentView = new RemoteViews(mContext.getPackageName(), resId);
            boolean showLine3 = false;
            boolean showLine2 = false;
@@ -1432,7 +1432,6 @@ public class Notification implements Parcelable
                contentView.setTextViewText(R.id.text, mSubText);
                if (mContentText != null) {
                    contentView.setTextViewText(R.id.text2, mContentText);
                    // need to shrink all the type to make sure everything fits
                    contentView.setViewVisibility(R.id.text2, View.VISIBLE);
                    showLine2 = true;
                } else {
@@ -1450,10 +1449,13 @@ public class Notification implements Parcelable
                }
            }
            if (showLine2) {
                if (fitIn1U) {
                    // need to shrink all the type to make sure everything fits
                    final Resources res = mContext.getResources();
                    final float subTextSize = res.getDimensionPixelSize(
                            R.dimen.notification_subtext_size);
                    contentView.setTextViewTextSize(R.id.text, TypedValue.COMPLEX_UNIT_PX, subTextSize);
                }
                // vertical centering
                contentView.setViewPadding(R.id.line1, 0, 0, 0, 0);
            }
@@ -1470,16 +1472,18 @@ public class Notification implements Parcelable
                }
            }
            contentView.setViewVisibility(R.id.line3, showLine3 ? View.VISIBLE : View.GONE);
            contentView.setViewVisibility(R.id.overflow_divider, showLine3 ? View.VISIBLE : View.GONE);
            return contentView;
        }

        private RemoteViews applyStandardTemplateWithActions(int layoutId) {
            RemoteViews big = applyStandardTemplate(layoutId);
            RemoteViews big = applyStandardTemplate(layoutId, false);

            int N = mActions.size();
            if (N > 0) {
                // Log.d("Notification", "has actions: " + mContentText);
                big.setViewVisibility(R.id.actions, View.VISIBLE);
                big.setViewVisibility(R.id.action_divider, View.VISIBLE);
                if (N>MAX_ACTION_BUTTONS) N=MAX_ACTION_BUTTONS;
                big.removeAllViews(R.id.actions);
                for (int i=0; i<N; i++) {
@@ -1495,7 +1499,7 @@ public class Notification implements Parcelable
            if (mContentView != null) {
                return mContentView;
            } else {
                return applyStandardTemplate(R.layout.notification_template_base); // no more special large_icon flavor
                return applyStandardTemplate(R.layout.notification_template_base, true); // no more special large_icon flavor
            }
        }

@@ -1506,7 +1510,7 @@ public class Notification implements Parcelable
                if (mContentView == null) {
                    return applyStandardTemplate(mLargeIcon == null
                            ? R.layout.status_bar_latest_event_ticker
                            : R.layout.status_bar_latest_event_ticker_large_icon);
                            : R.layout.status_bar_latest_event_ticker_large_icon, true);
                } else {
                    return null;
                }
@@ -1655,12 +1659,9 @@ public class Notification implements Parcelable
                contentView.setViewVisibility(R.id.line1, View.VISIBLE);
            }

            // The last line defaults to the content text or subtext, but can be replaced by mSummaryText
            if (mSummaryText != null && !mSummaryText.equals("")) {
                contentView.setViewVisibility(R.id.overflow_title, View.VISIBLE);
                contentView.setTextViewText(R.id.overflow_title, mSummaryText);
                contentView.setViewVisibility(R.id.line3, View.GONE);
            } else {
                contentView.setViewVisibility(R.id.overflow_title, View.GONE);
                contentView.setTextViewText(R.id.text, mSummaryText);
                contentView.setViewVisibility(R.id.line3, View.VISIBLE);
            }

@@ -1801,6 +1802,8 @@ public class Notification implements Parcelable
        }

        private RemoteViews makeBigContentView() {
            // Remove the content text so line3 disappears entirely
            mBuilder.mContentText = null;
            RemoteViews contentView = getStandardView(R.layout.notification_template_big_text);
            contentView.setTextViewText(R.id.big_text, mBigText);
            contentView.setViewVisibility(R.id.big_text, View.VISIBLE);
+1 −0
Original line number Diff line number Diff line
@@ -23,6 +23,7 @@
    android:visibility="gone"
    android:showDividers="middle"
    android:divider="?android:attr/listDivider"
    android:dividerPadding="12dp"
    >
    <!-- actions will be added here -->
</LinearLayout>
+10 −16
Original line number Diff line number Diff line
@@ -36,8 +36,7 @@
        android:layout_marginLeft="@dimen/notification_large_icon_width"
        android:minHeight="@dimen/notification_large_icon_height"
        android:orientation="vertical"
        android:paddingLeft="12dp"
        android:paddingRight="12dp"
        android:paddingRight="8dp"
        android:paddingTop="2dp"
        android:paddingBottom="2dp"
        android:gravity="top"
@@ -47,6 +46,7 @@
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:paddingTop="6dp"
            android:layout_marginLeft="8dp"
            android:orientation="horizontal"
            >
            <TextView android:id="@+id/title"
@@ -81,6 +81,7 @@
            android:layout_height="wrap_content"
            android:layout_marginTop="-2dp"
            android:layout_marginBottom="-2dp"
            android:layout_marginLeft="8dp"
            android:singleLine="true"
            android:fadingEdge="horizontal"
            android:ellipsize="marquee"
@@ -90,24 +91,17 @@
            android:id="@android:id/progress"
            android:layout_width="match_parent"
            android:layout_height="12dp"
            android:layout_marginLeft="8dp"
            android:visibility="gone"
            style="?android:attr/progressBarStyleHorizontal"
            />
        <TextView android:id="@+id/overflow_title"
            android:textAppearance="@style/TextAppearance.StatusBar.EventContent"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:singleLine="true"
            android:ellipsize="marquee"
            android:fadingEdge="horizontal"
            android:visibility="gone"
            android:layout_weight="1"
            />
        <LinearLayout
            android:id="@+id/line3"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="horizontal"
            android:gravity="center_vertical"
            android:layout_marginLeft="8dp"
            >
            <TextView android:id="@+id/text"
                android:textAppearance="@style/TextAppearance.StatusBar.EventContent"
@@ -130,14 +124,14 @@
                android:paddingLeft="8dp"
                />
            <ImageView android:id="@+id/right_icon"
                android:layout_width="wrap_content"
                android:layout_height="match_parent"
                android:layout_width="16dp"
                android:layout_height="16dp"
                android:layout_gravity="center"
                android:layout_weight="0"
                android:layout_marginLeft="8dp"
                android:scaleType="centerInside"
                android:paddingLeft="8dp"
                android:visibility="gone"
                android:drawableAlpha="180"
                android:drawableAlpha="153"
                />
        </LinearLayout>
    </LinearLayout>
+25 −10
Original line number Diff line number Diff line
@@ -33,19 +33,16 @@
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_gravity="fill_vertical"
        android:layout_marginLeft="@dimen/notification_large_icon_width"
        android:minHeight="@dimen/notification_large_icon_height"
        android:orientation="vertical"
        android:paddingLeft="12dp"
        android:paddingRight="12dp"
        android:paddingTop="2dp"
        android:paddingBottom="2dp"
        android:gravity="top"
        >
        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginLeft="@dimen/notification_large_icon_width"
            android:minHeight="@dimen/notification_large_icon_height"
            android:paddingTop="2dp"
            android:orientation="vertical"
            >
            <LinearLayout
@@ -53,6 +50,8 @@
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:paddingTop="6dp"
                android:layout_marginRight="8dp"
                android:layout_marginLeft="8dp"
                android:orientation="horizontal"
                >
                <TextView android:id="@+id/title"
@@ -87,6 +86,8 @@
                android:layout_height="wrap_content"
                android:layout_marginTop="-2dp"
                android:layout_marginBottom="-2dp"
                android:layout_marginLeft="8dp"
                android:layout_marginRight="8dp"
                android:singleLine="true"
                android:fadingEdge="horizontal"
                android:ellipsize="marquee"
@@ -96,6 +97,8 @@
                android:textAppearance="@style/TextAppearance.StatusBar.EventContent"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginLeft="8dp"
                android:layout_marginRight="8dp"
                android:singleLine="false"
                android:visibility="gone"
                />
@@ -103,7 +106,10 @@
                android:id="@+id/line3"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginLeft="8dp"
                android:layout_marginRight="8dp"
                android:orientation="horizontal"
                android:gravity="center_vertical"
                >
                <TextView android:id="@+id/text"
                    android:textAppearance="@style/TextAppearance.StatusBar.EventContent"
@@ -126,29 +132,38 @@
                    android:paddingLeft="8dp"
                    />
                <ImageView android:id="@+id/right_icon"
                    android:layout_width="wrap_content"
                    android:layout_height="match_parent"
                    android:layout_width="16dp"
                    android:layout_height="16dp"
                    android:layout_gravity="center"
                    android:layout_weight="0"
                    android:layout_marginLeft="8dp"
                    android:scaleType="centerInside"
                    android:paddingLeft="8dp"
                    android:visibility="gone"
                    android:drawableAlpha="180"
                    android:drawableAlpha="153"
                    />
            </LinearLayout>
            <ProgressBar
                android:id="@android:id/progress"
                android:layout_width="match_parent"
                android:layout_height="12dp"
                android:layout_marginBottom="8dp"
                android:layout_marginLeft="8dp"
                android:layout_marginRight="8dp"
                android:visibility="gone"
                style="?android:attr/progressBarStyleHorizontal"
                />
        </LinearLayout>
        <ImageView
            android:layout_width="match_parent"
            android:layout_height="1px"
            android:id="@+id/action_divider"
            android:visibility="gone"
            android:background="?android:attr/dividerHorizontal" />
        <include
            layout="@layout/notification_action_list"
            android:id="@+id/actions"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginLeft="@dimen/notification_large_icon_width"
            />
    </LinearLayout>
</FrameLayout>
+0 −1
Original line number Diff line number Diff line
@@ -53,7 +53,6 @@
        <include
            layout="@layout/notification_action_list"
            android:id="@+id/actions"
            android:layout_marginLeft="8dp"
            android:layout_gravity="bottom"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
Loading