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

Commit 6d7de848 authored by Jeff Sharkey's avatar Jeff Sharkey Committed by Android Git Automerger
Browse files

am 1fc9eb78: am 16326f70: Merge "Fix animations, padding in RTL mode." into klp-dev

* commit '1fc9eb78':
  Fix animations, padding in RTL mode.
parents 5e0582e5 1fc9eb78
Loading
Loading
Loading
Loading
+7 −1
Original line number Original line Diff line number Diff line
@@ -203,6 +203,12 @@ public class InsetDrawable extends Drawable implements Drawable.Callback
        mInsetState.mDrawable.setColorFilter(cf);
        mInsetState.mDrawable.setColorFilter(cf);
    }
    }


    /** {@hide} */
    @Override
    public void setLayoutDirection(int layoutDirection) {
        mInsetState.mDrawable.setLayoutDirection(layoutDirection);
    }

    @Override
    @Override
    public int getOpacity() {
    public int getOpacity() {
        return mInsetState.mDrawable.getOpacity();
        return mInsetState.mDrawable.getOpacity();
+18 −6
Original line number Original line Diff line number Diff line
@@ -219,16 +219,15 @@ public class NinePatchDrawable extends Drawable {
    @Override
    @Override
    public void draw(Canvas canvas) {
    public void draw(Canvas canvas) {
        final Rect bounds = getBounds();
        final Rect bounds = getBounds();
        final boolean needMirroring = isAutoMirrored() &&
        final boolean needsMirroring = needsMirroring();
                getLayoutDirection() == LayoutDirection.RTL;
        if (needsMirroring) {
        if (needMirroring) {
            canvas.save();
            canvas.save();
            // Mirror the 9patch
            // Mirror the 9patch
            canvas.translate(bounds.right - bounds.left, 0);
            canvas.translate(bounds.right - bounds.left, 0);
            canvas.scale(-1.0f, 1.0f);
            canvas.scale(-1.0f, 1.0f);
        }
        }
        mNinePatch.draw(canvas, bounds, mPaint);
        mNinePatch.draw(canvas, bounds, mPaint);
        if (needMirroring) {
        if (needsMirroring) {
            canvas.restore();
            canvas.restore();
        }
        }
    }
    }
@@ -240,7 +239,11 @@ public class NinePatchDrawable extends Drawable {


    @Override
    @Override
    public boolean getPadding(Rect padding) {
    public boolean getPadding(Rect padding) {
        if (needsMirroring()) {
            padding.set(mPadding.right, mPadding.top, mPadding.left, mPadding.bottom);
        } else {
            padding.set(mPadding);
            padding.set(mPadding);
        }
        return true;
        return true;
    }
    }


@@ -249,8 +252,13 @@ public class NinePatchDrawable extends Drawable {
     */
     */
    @Override
    @Override
    public Insets getOpticalInsets() {
    public Insets getOpticalInsets() {
        if (needsMirroring()) {
            return Insets.of(mOpticalInsets.right, mOpticalInsets.top, mOpticalInsets.right,
                    mOpticalInsets.bottom);
        } else {
            return mOpticalInsets;
            return mOpticalInsets;
        }
        }
    }


    @Override
    @Override
    public void setAlpha(int alpha) {
    public void setAlpha(int alpha) {
@@ -297,6 +305,10 @@ public class NinePatchDrawable extends Drawable {
        mNinePatchState.mAutoMirrored = mirrored;
        mNinePatchState.mAutoMirrored = mirrored;
    }
    }


    private boolean needsMirroring() {
        return isAutoMirrored() && getLayoutDirection() == LayoutDirection.RTL;
    }

    @Override
    @Override
    public boolean isAutoMirrored() {
    public boolean isAutoMirrored() {
        return mNinePatchState.mAutoMirrored;
        return mNinePatchState.mAutoMirrored;
+22 −0
Original line number Original line Diff line number Diff line
<!-- Copyright (C) 2013 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.
-->

<objectAnimator xmlns:android="http://schemas.android.com/apk/res/android"
    android:valueFrom="-1"
    android:valueTo="0"
    android:propertyName="position"
    android:valueType="floatType"
    android:duration="@android:integer/config_mediumAnimTime"
    android:interpolator="@android:interpolator/decelerate_quad" />
+22 −0
Original line number Original line Diff line number Diff line
<!-- Copyright (C) 2013 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.
-->

<objectAnimator xmlns:android="http://schemas.android.com/apk/res/android"
    android:valueFrom="0"
    android:valueTo="-1"
    android:propertyName="position"
    android:valueType="floatType"
    android:duration="@android:integer/config_mediumAnimTime"
    android:interpolator="@android:interpolator/accelerate_quad" />
Loading