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

Commit 54d69625 authored by Fabrice Di Meglio's avatar Fabrice Di Meglio
Browse files

Fix bug #4972141 Overlapping content in single-choice dialogs

- need to take care about padding resolution

Change-Id: Ida9738ffada6c6455b7949f933fa61924c4f7961
parent c1df573a
Loading
Loading
Loading
Loading
+9 −3
Original line number Diff line number Diff line
@@ -2167,21 +2167,27 @@ public class View implements Drawable.Callback2, KeyEvent.Callback, Accessibilit

    /**
     * Cache the paddingRight set by the user to append to the scrollbar's size.
     *
     * @hide
     */
    @ViewDebug.ExportedProperty(category = "padding")
    int mUserPaddingRight;
    protected int mUserPaddingRight;

    /**
     * Cache the paddingBottom set by the user to append to the scrollbar's size.
     *
     * @hide
     */
    @ViewDebug.ExportedProperty(category = "padding")
    int mUserPaddingBottom;
    protected int mUserPaddingBottom;

    /**
     * Cache the paddingLeft set by the user to append to the scrollbar's size.
     *
     * @hide
     */
    @ViewDebug.ExportedProperty(category = "padding")
    int mUserPaddingLeft;
    protected int mUserPaddingLeft;

    /**
     * Cache if the user padding is relative.
+5 −5
Original line number Diff line number Diff line
@@ -130,10 +130,10 @@ public class CheckedTextView extends TextView implements Checkable {
            setMinHeight(d.getIntrinsicHeight());
            
            mCheckMarkWidth = d.getIntrinsicWidth();
            mPaddingRight = mCheckMarkWidth + mBasePaddingRight;
            mUserPaddingRight = mCheckMarkWidth + mBasePaddingRight;
            d.setState(getDrawableState());
        } else {
            mPaddingRight = mBasePaddingRight;
            mUserPaddingRight = mBasePaddingRight;
        }
        mCheckMarkDrawable = d;
        requestLayout();
@@ -142,7 +142,7 @@ public class CheckedTextView extends TextView implements Checkable {
    @Override
    public void setPadding(int left, int top, int right, int bottom) {
        super.setPadding(left, top, right, bottom);
        mBasePaddingRight = mPaddingRight;
        mBasePaddingRight = mUserPaddingRight;
    }

    @Override
@@ -167,9 +167,9 @@ public class CheckedTextView extends TextView implements Checkable {
            
            int right = getWidth();
            checkMarkDrawable.setBounds(
                    right - mCheckMarkWidth - mBasePaddingRight, 
                    right - mUserPaddingRight,
                    y, 
                    right - mBasePaddingRight, 
                    right - mUserPaddingRight + mCheckMarkWidth,
                    y + height);
            checkMarkDrawable.draw(canvas);
        }
+6 −0
Original line number Diff line number Diff line
@@ -49,6 +49,12 @@

        </LinearLayout>

        <Button android:id="@+id/button_alert_dialog"
                android:layout_height="wrap_content"
                android:layout_width="wrap_content"
                android:text="@string/button_alert_dialog_text"
                android:textSize="32dip"
                />
    </LinearLayout>

</FrameLayout>
 No newline at end of file
+1 −0
Original line number Diff line number Diff line
@@ -23,6 +23,7 @@
    <string name="button_left_text">Left</string>
    <string name="button_before_text">Start</string>
    <string name="button_requestlayout_text">Request Layout</string>
    <string name="button_alert_dialog_text">AlertDialog</string>
    <string name="textview_text">This is a text for a TextView</string>
    <string name="edittext_text">mmmmmmmmmmmmmmmmmmmmmmmm</string>
    <string name="normal_text">Normal String</string>
+27 −2
Original line number Diff line number Diff line
@@ -16,17 +16,42 @@

package com.android.bidi;

import android.app.AlertDialog;
import android.app.Fragment;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;

public class BiDiTestBasic extends Fragment {

    private View currentView;
    private Button alertDialogButton;
    private String[] items = {"This is a very very very very very very very very very very very long Item1", "Item2"};

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
            Bundle savedInstanceState) {
        return inflater.inflate(R.layout.basic, container, false);
        currentView = inflater.inflate(R.layout.basic, container, false);
        return currentView;
    }

    @Override
    public void onViewCreated(View view, Bundle savedInstanceState) {
        super.onViewCreated(view, savedInstanceState);

        alertDialogButton = (Button) currentView.findViewById(R.id.button_alert_dialog);
        alertDialogButton.setOnClickListener(new View.OnClickListener() {
            public void onClick(View v) {
                showDialog();
            }
        });
    }

    private void showDialog() {
        AlertDialog.Builder builder = new AlertDialog.Builder(currentView.getContext());
        builder.setSingleChoiceItems(items, 0, null);
        builder.show();
    }
}