Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions library/build.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
apply plugin: 'com.android.library'

android {
compileSdkVersion 22
compileSdkVersion 23
buildToolsVersion "22.0.1"

lintOptions {
Expand All @@ -10,7 +10,7 @@ android {

defaultConfig {
minSdkVersion 14
targetSdkVersion 22
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
Expand Down
2 changes: 1 addition & 1 deletion library/src/main/java/com/wnafee/vector/MorphButton.java
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ private void updateDrawable(Drawable d, MorphState state) {
if (d != null) {
d.setCallback(this);
//TODO: Adjust layout direction
// d.setLayoutDirection(getLayoutDirection());
// d.setSupportLayoutDirection(getSupportLayoutDirection());
if (d.isStateful()) {
d.setState(getDrawableState());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,8 +152,8 @@ public boolean setVisible(boolean visible, boolean restart) {
return super.setVisible(visible, restart);
}

public void setLayoutDirection(int layoutDirection) {
mAnimatedVectorState.mVectorDrawable.setLayoutDirection(layoutDirection);
public boolean setSupportLayoutDirection(int layoutDirection) {
return mAnimatedVectorState.mVectorDrawable.setSupportLayoutDirection(layoutDirection);
}

@Override
Expand Down
21 changes: 15 additions & 6 deletions library/src/main/java/com/wnafee/vector/compat/DrawableCompat.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,15 @@
import android.graphics.PorterDuffColorFilter;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
import android.os.Build;
import android.support.annotation.NonNull;
import android.util.AttributeSet;
import android.util.LayoutDirection;
import android.view.View;

public abstract class DrawableCompat extends Drawable {

int mLayoutDirection;
int mSupportLayoutDirection;

public static abstract class ConstantStateCompat extends ConstantState {

Expand Down Expand Up @@ -77,14 +80,20 @@ public void getHotspotBounds(Rect outRect) {
outRect.set(getBounds());
}

public int getLayoutDirection() {
return mLayoutDirection;
public int getSupportLayoutDirection() {
return mSupportLayoutDirection;
}

public void setLayoutDirection(int layoutDirection) {
if (getLayoutDirection() != layoutDirection) {
mLayoutDirection = layoutDirection;
public boolean setSupportLayoutDirection(int layoutDirection) {
if (getSupportLayoutDirection() != layoutDirection) {
mSupportLayoutDirection = layoutDirection;

// if (Build.VERSION.SDK_INT > Build.VERSION_CODES.LOLLIPOP_MR1) {
// return onLayoutDirectionChanged(mSupportLayoutDirection);
// }
}

return false;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -503,7 +503,7 @@ void setAllowCaching(boolean allowCaching) {
}

private boolean needMirroring() {
return isAutoMirrored() && getLayoutDirection() == 1; // 1 is for LayoutDirection.RTL
return isAutoMirrored() && getSupportLayoutDirection() == 1; // 1 is for LayoutDirection.RTL
}

@Override
Expand Down