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

Commit 3372c90c authored by Annie Chin's avatar Annie Chin Committed by Android (Google) Code Review
Browse files

Merge "Add setLandscape() method to ButtonInterface" into nyc-mr1-dev

parents 30c40507 6fc4600d
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -49,6 +49,13 @@ public class ButtonDispatcher {
        mViews.clear();
    }

    void addView(View view, boolean landscape) {
        addView(view);
        if (view instanceof ButtonInterface) {
            ((ButtonInterface) view).setLandscape(landscape);
        }
    }

    void addView(View view) {
        mViews.add(view);
        view.setOnClickListener(mClickListener);
@@ -178,5 +185,7 @@ public class ButtonDispatcher {
        void setImageDrawable(@Nullable Drawable drawable);

        void abortCurrentGesture();

        void setLandscape(boolean landscape);
    }
}
+4 −4
Original line number Diff line number Diff line
@@ -280,7 +280,7 @@ public class NavigationBarInflaterView extends FrameLayout implements TunerServi
            params.width = (int) (params.width * size);
        }
        parent.addView(v);
        addToDispatchers(v);
        addToDispatchers(v, landscape);
        View lastView = landscape ? mLastRot90 : mLastRot0;
        if (lastView != null) {
            v.setAccessibilityTraversalAfter(lastView.getId());
@@ -327,16 +327,16 @@ public class NavigationBarInflaterView extends FrameLayout implements TunerServi
        return buttonSpec.substring(0, buttonSpec.indexOf(SIZE_MOD_START));
    }

    private void addToDispatchers(View v) {
    private void addToDispatchers(View v, boolean landscape) {
        if (mButtonDispatchers != null) {
            final int indexOfKey = mButtonDispatchers.indexOfKey(v.getId());
            if (indexOfKey >= 0) {
                mButtonDispatchers.valueAt(indexOfKey).addView(v);
                mButtonDispatchers.valueAt(indexOfKey).addView(v, landscape);
            } else if (v instanceof ViewGroup) {
                final ViewGroup viewGroup = (ViewGroup)v;
                final int N = viewGroup.getChildCount();
                for (int i = 0; i < N; i++) {
                    addToDispatchers(viewGroup.getChildAt(i));
                    addToDispatchers(viewGroup.getChildAt(i), landscape);
                }
            }
        }
+5 −0
Original line number Diff line number Diff line
@@ -265,6 +265,11 @@ public class KeyButtonView extends ImageView implements ButtonDispatcher.ButtonI
    public void setImageDrawable(@Nullable Drawable drawable) {
        super.setImageDrawable(drawable);
    }

    @Override
    public void setLandscape(boolean landscape) {
        //no op
    }
}