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

Commit 322594c4 authored by Jeff Sharkey's avatar Jeff Sharkey Committed by Android Git Automerger
Browse files

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

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

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

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

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

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

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

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

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