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

Commit f72df377 authored by Svetoslav Ganov's avatar Svetoslav Ganov Committed by android-build-merger
Browse files

Merge "Make request permissions dialog layout robost" am: 816baf35

am: b0a98d2e

* commit 'b0a98d2e':
  Make request permissions dialog layout robost
parents a4ff41f1 b0a98d2e
Loading
Loading
Loading
Loading
+15 −0
Original line number Diff line number Diff line
@@ -25,6 +25,7 @@ import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.content.pm.PackageManager.NameNotFoundException;
import android.content.pm.PermissionInfo;
import android.content.res.Configuration;
import android.content.res.Resources;
import android.graphics.Typeface;
import android.graphics.drawable.Icon;
@@ -186,6 +187,20 @@ public class GrantPermissionsActivity extends OverlayTouchActivity
        }
    }

    @Override
    public void onConfigurationChanged(Configuration newConfig) {
        super.onConfigurationChanged(newConfig);
        // This is just gross - we need to relayout the window as
        // dialog width may be different in landscape vs portrait
        // which affect the min window height needed to show all
        // content. We have to re-add the window to force it to be
        // resized if needed. The way the permission grant dialog
        // is implemented is not correct and has to be rewritten.
        View decor = getWindow().getDecorView();
        getWindowManager().removeViewImmediate(decor);
        getWindowManager().addView(decor, decor.getLayoutParams());
    }

    @Override
    public boolean dispatchTouchEvent(MotionEvent ev) {
        View rootView = getWindow().getDecorView();
+20 −5
Original line number Diff line number Diff line
@@ -17,7 +17,6 @@ package com.android.packageinstaller.permission.ui;

import android.content.Context;
import android.util.AttributeSet;
import android.view.View;
import android.widget.FrameLayout;

/**
@@ -27,13 +26,10 @@ import android.widget.FrameLayout;
 * but allows the view to grow downwards for animation.
 */
public class ManualLayoutFrame extends FrameLayout {

    private int mDesiredHeight;
    private int mHeight;
    private int mWidth;

    private View mOffsetView;

    public ManualLayoutFrame(Context context, AttributeSet attrs) {
        super(context, attrs);
        setClipChildren(false);
@@ -47,10 +43,29 @@ public class ManualLayoutFrame extends FrameLayout {
    @Override
    protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
        if (mWidth != 0) {
            // Keep the width constant to avoid weirdness.
            int newWidth = mWidth;
            final int widthMode = MeasureSpec.getMode(widthMeasureSpec);
            switch (widthMode) {
                case MeasureSpec.AT_MOST: {
                    newWidth = Math.min(mWidth, MeasureSpec.getSize(widthMeasureSpec));
                } break;
                case MeasureSpec.EXACTLY: {
                    newWidth = MeasureSpec.getSize(widthMeasureSpec);
                } break;
            }
            // If the width changes we have to re-evaluate the height
            if (newWidth != mWidth) {
                mWidth = newWidth;
                mHeight = 0;
            }
            widthMeasureSpec = MeasureSpec.makeMeasureSpec(mWidth, MeasureSpec.EXACTLY);
        }

        // Let the content measure how much it needs to be fully shown
        heightMeasureSpec = MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED);

        super.onMeasure(widthMeasureSpec, heightMeasureSpec);

        mDesiredHeight = getMeasuredHeight();
        if (mHeight == 0 && mDesiredHeight != 0) {
            // Record the first non-zero width and height, this will be the height henceforth.
+0 −1
Original line number Diff line number Diff line
@@ -20,7 +20,6 @@ import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.animation.ObjectAnimator;
import android.content.Context;
import android.content.res.Resources;
import android.graphics.drawable.Icon;
import android.os.Bundle;
import android.util.SparseArray;