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

Commit 7b83639c authored by Selim Cinek's avatar Selim Cinek
Browse files

Changed the appearance of the notification children

Some further tuning to the layout

Change-Id: Ifb3797e9982d718a30954adb9e1901eb2a1fa75d
parent bde0d4fe
Loading
Loading
Loading
Loading
+2 −5
Original line number Diff line number Diff line
@@ -3001,6 +3001,7 @@ public class Notification implements Parcelable
         */
        private void resetNotificationHeader(RemoteViews contentView) {
            contentView.setImageViewResource(R.id.icon, 0);
            contentView.setBoolean(R.id.notification_header, "setExpanded", false);
            contentView.setTextViewText(R.id.app_name_text, null);
            contentView.setViewVisibility(R.id.chronometer, View.GONE);
            contentView.setViewVisibility(R.id.header_sub_text, View.GONE);
@@ -3277,11 +3278,7 @@ public class Notification implements Parcelable
        }

        private void adaptNotificationHeaderForBigContentView(RemoteViews result) {
            // We have to set the collapse button instead
            result.setImageViewResource(R.id.expand_button, R.drawable.ic_arrow_up_14dp);
            // Apply the color again
            result.setDrawableParameters(R.id.expand_button, false, -1, resolveColor(),
                    PorterDuff.Mode.SRC_ATOP, -1);
            result.setBoolean(R.id.notification_header, "setExpanded", true);
        }

        /**
+40 −2
Original line number Diff line number Diff line
@@ -20,6 +20,7 @@ import android.annotation.Nullable;
import android.content.Context;
import android.graphics.Rect;
import android.util.AttributeSet;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RemoteViews;
import android.widget.TextView;
@@ -35,15 +36,18 @@ import java.util.ArrayList;
public class NotificationHeaderView extends LinearLayout {
    public static final int NO_COLOR = -1;
    private final int mHeaderMinWidth;
    private final int mExpandTopPadding;
    private View mAppName;
    private View mSubTextView;
    private OnClickListener mExpandClickListener;
    private HeaderTouchListener mTouchListener = new HeaderTouchListener();
    private View mExpandButton;
    private ImageView mExpandButton;
    private View mIcon;
    private TextView mChildCount;
    private int mIconColor;
    private int mOriginalNotificationColor;
    private boolean mGroupHeader;
    private boolean mExpanded;

    public NotificationHeaderView(Context context) {
        this(context, null);
@@ -61,6 +65,7 @@ public class NotificationHeaderView extends LinearLayout {
        super(context, attrs, defStyleAttr, defStyleRes);
        mHeaderMinWidth = getResources().getDimensionPixelSize(
                com.android.internal.R.dimen.notification_header_shrink_min_width);
        mExpandTopPadding = (int) (1 * getResources().getDisplayMetrics().density);
    }

    @Override
@@ -68,7 +73,7 @@ public class NotificationHeaderView extends LinearLayout {
        super.onFinishInflate();
        mAppName = findViewById(com.android.internal.R.id.app_name_text);
        mSubTextView = findViewById(com.android.internal.R.id.header_sub_text);
        mExpandButton = findViewById(com.android.internal.R.id.expand_button);
        mExpandButton = (ImageView) findViewById(com.android.internal.R.id.expand_button);
        mIcon = findViewById(com.android.internal.R.id.icon);
        mChildCount = (TextView) findViewById(com.android.internal.R.id.number_of_children);
    }
@@ -166,6 +171,39 @@ public class NotificationHeaderView extends LinearLayout {
        return mOriginalNotificationColor;
    }

    public void setIsGroupHeader(boolean isGroupHeader) {
        mGroupHeader = isGroupHeader;
        updateExpandButton();
    }

    @RemotableViewMethod
    public void setExpanded(boolean expanded) {
        mExpanded = expanded;
        updateExpandButton();
    }

    private void updateExpandButton() {
        int drawableId;
        int paddingTop = 0;
        if (mGroupHeader) {
            if (mExpanded) {
                drawableId = com.android.internal.R.drawable.ic_collapse_bundle;
            } else {
                drawableId =com.android.internal.R.drawable.ic_expand_bundle;
            }
        } else {
            if (mExpanded) {
                drawableId = com.android.internal.R.drawable.ic_collapse_notification;
            } else {
                drawableId = com.android.internal.R.drawable.ic_expand_notification;
            }
            paddingTop = mExpandTopPadding;
        }
        mExpandButton.setImageDrawable(getContext().getDrawable(drawableId));
        mExpandButton.setColorFilter(mOriginalNotificationColor);
        mExpandButton.setPadding(0, paddingTop, 0, 0);
    }

    public class HeaderTouchListener implements View.OnTouchListener {

        private final ArrayList<Rect> mTouchRects = new ArrayList<>();
+0 −24
Original line number Diff line number Diff line
<!--
  ~ Copyright (C) 2015 The Android Open Source Project
  ~
  ~ Licensed under the Apache License, Version 2.0 (the "License");
  ~ you may not use this file except in compliance with the License.
  ~ You may obtain a copy of the License at
  ~
  ~      http://www.apache.org/licenses/LICENSE-2.0
  ~
  ~ Unless required by applicable law or agreed to in writing, software
  ~ distributed under the License is distributed on an "AS IS" BASIS,
  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  ~ See the License for the specific language governing permissions and
  ~ limitations under the License
  -->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
        android:width="14.0dp"
        android:height="14.0dp"
        android:viewportWidth="24.0"
        android:viewportHeight="24.0">
    <path
        android:pathData="M12.000000,8.000000l-6.000000,6.000000 1.400000,1.400000 4.600000,-4.599999 4.600000,4.599999 1.400000,-1.400000z"
        android:fillColor="#FF000000"/>
</vector>
+6 −6
Original line number Diff line number Diff line
@@ -20,6 +20,6 @@ Copyright (C) 2015 The Android Open Source Project
        android:viewportWidth="24.0"
        android:viewportHeight="24.0">
    <path
        android:pathData="M16.600000,8.600000l-4.600000,4.599999 -4.600000,-4.599999 -1.400000,1.400000 6.000000,6.000000 6.000000,-6.000000z"
        android:fillColor="#FF000000"/>
        android:fillColor="#FF000000"
        android:pathData="M12.0,10.0l5.3,-5.2l-1.4,-1.4L12.0,7.2L8.2,3.4L6.8,4.8L12.0,10.0zM6.8,19.2l1.4,1.4l3.8,-3.8l3.9,3.8l1.4,-1.4L12.0,14.0L6.8,19.2z"/>
</vector>
+28 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2015 The Android Open Source Project

   Licensed under the Apache License, Version 2.0 (the "License");
    you may not use this file except in compliance with the License.
    You may obtain a copy of the License at

         http://www.apache.org/licenses/LICENSE-2.0

    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS,
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specific language governing permissions and
    limitations under the License.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
        android:width="14.0dp"
        android:height="14.0dp"
        android:viewportWidth="24.0"
        android:viewportHeight="24.0">
    <path
        android:fillColor="#FF000000"
        android:pathData="M12.0,8.0l-6.0,6.0l1.4,1.4l4.6,-4.6l4.6,4.6L18.0,14.0L12.0,8.0z"/>
    <path
        android:pathData="M0,0h24v24H0V0z"
        android:fillColor="#00000000"/>
</vector>
Loading