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

Commit fc0a05e3 authored by Jeff DeCew's avatar Jeff DeCew Committed by Android (Google) Code Review
Browse files

Merge "Remove padding logic designed for old position of the expand button" into sc-dev

parents 0cdfb5fd 970a13ae
Loading
Loading
Loading
Loading
+0 −25
Original line number Diff line number Diff line
@@ -44,7 +44,6 @@ import java.util.ArrayList;
 */
@RemoteViews.RemoteView
public class NotificationHeaderView extends RelativeLayout {
    private final int mHeadingEndMargin;
    private final int mTouchableHeight;
    private OnClickListener mExpandClickListener;
    private HeaderTouchListener mTouchListener = new HeaderTouchListener();
@@ -84,7 +83,6 @@ public class NotificationHeaderView extends RelativeLayout {
            int defStyleRes) {
        super(context, attrs, defStyleAttr, defStyleRes);
        Resources res = getResources();
        mHeadingEndMargin = res.getDimensionPixelSize(R.dimen.notification_heading_margin_end);
        mTouchableHeight = res.getDimensionPixelSize(R.dimen.notification_header_touchable_height);
        mEntireHeaderClickable = res.getBoolean(R.bool.config_notificationHeaderClickableForExpand);
    }
@@ -197,29 +195,6 @@ public class NotificationHeaderView extends RelativeLayout {
        }
    }

    /**
     * Get the current margin end value for the header text.
     * Add this to {@link #getTopLineBaseMarginEnd()} to get the total margin of the top line.
     *
     * @return extra margin
     */
    public int getTopLineExtraMarginEnd() {
        return mTopLineView.getHeaderTextMarginEnd();
    }

    /**
     * Get the base margin at the end of the top line view.
     * Add this to {@link #getTopLineExtraMarginEnd()} to get the total margin of the top line.
     * <p>
     * NOTE: This method's result is only valid if the expander does not have a number. Currently
     * only groups headers and conversations have numbers, so this is safe to use by MediaStyle.
     *
     * @return base margin
     */
    public int getTopLineBaseMarginEnd() {
        return mHeadingEndMargin;
    }

    /**
     * Handles clicks on the header based on the region tapped.
     */
+0 −20
Original line number Diff line number Diff line
@@ -31,7 +31,6 @@ import android.util.Log;
import android.util.Pair;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.NotificationHeaderView;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewTreeObserver;
@@ -248,9 +247,6 @@ public class NotificationContentView extends FrameLayout {
                measureChildWithMargins(mContractedChild, widthMeasureSpec, 0, heightSpec, 0);
            }
            maxChildHeight = Math.max(maxChildHeight, measuredHeight);
            if (updateContractedHeaderWidth()) {
                measureChildWithMargins(mContractedChild, widthMeasureSpec, 0, heightSpec, 0);
            }
            if (mExpandedChild != null
                    && mContractedChild.getMeasuredHeight() > mExpandedChild.getMeasuredHeight()) {
                // the Expanded child is smaller then the collapsed. Let's remeasure it.
@@ -311,22 +307,6 @@ public class NotificationContentView extends FrameLayout {
        return 0;
    }

    private boolean updateContractedHeaderWidth() {
        // We need to update the expanded and the collapsed header to have exactly the same with to
        // have the expand buttons laid out at the same location.
        NotificationHeaderView contractedHeader = mContractedWrapper.getNotificationHeader();
        if (contractedHeader != null && mExpandedWrapper != null
                && mExpandedWrapper.getNotificationHeader() != null) {
            NotificationHeaderView expandedHeader = mExpandedWrapper.getNotificationHeader();
            int headerTextMargin = expandedHeader.getTopLineExtraMarginEnd();
            if (headerTextMargin != contractedHeader.getTopLineExtraMarginEnd()) {
                contractedHeader.setTopLineExtraMarginEnd(headerTextMargin);
                return true;
            }
        }
        return false;
    }

    private boolean shouldContractedBeFixedSize() {
        return mBeforeN && mContractedWrapper instanceof NotificationCustomViewWrapper;
    }