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
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ buildscript {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.1.0'
classpath 'com.android.tools.build:gradle:2.0.0-beta6'

// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
Expand Down
10 changes: 6 additions & 4 deletions demo/build.gradle
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
apply plugin: 'com.android.application'

android {
compileSdkVersion 22
buildToolsVersion "22.0.1"
compileSdkVersion 23
buildToolsVersion "23.0.2"

defaultConfig {
applicationId "com.wnafee.vector.compat.demo"
minSdkVersion 14
targetSdkVersion 22
targetSdkVersion 23
versionCode 1
versionName "1.0"

vectorDrawables.useSupportLibrary = true
}
buildTypes {
release {
Expand All @@ -21,6 +23,6 @@ android {

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:22.1.1'
compile 'com.android.support:appcompat-v7:23.2.0'
compile project(':library')
}
13 changes: 7 additions & 6 deletions demo/src/main/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,16 @@
android:paddingTop="@dimen/activity_vertical_margin"
tools:context=".MainActivity">

<com.wnafee.vector.MorphButton
<!-- <com.wnafee.vector.MorphButton
android:id="@+id/drawerBtn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="top|center_horizontal"
android:layout_margin="5dp"
app:vc_backgroundTint="#3F51B5"
app:vc_foregroundTint="#f50057"
app:vc_startDrawable="@drawable/ic_arrow_to_drawer"
app:vc_endDrawable="@drawable/ic_drawer_to_arrow"/>
app:vc_startDrawable="@drawable/ic_drawer_to_arrow"
app:vc_endDrawable="@drawable/ic_arrow_to_drawer"/> -->

<com.wnafee.vector.MorphButton
android:id="@+id/playBtn"
Expand All @@ -35,7 +35,7 @@
app:vc_startDrawable="@drawable/ic_play_to_pause"
app:vc_endDrawable="@drawable/ic_pause_to_play"/>

<com.wnafee.vector.MorphButton
<!-- <com.wnafee.vector.MorphButton
android:id="@+id/stopBtn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
Expand All @@ -54,7 +54,8 @@
android:background="?android:selectableItemBackground"
android:scaleType="center"
app:vc_backgroundTint="#6A1B9A"
app:vc_startDrawable="@drawable/abc_btn_check_to_on_mtrl_000"
app:vc_endDrawable="@drawable/abc_btn_check_to_on_mtrl_015"/>
app:vc_startDrawable="@drawable/abc_btn_checkbox_checked_mtrl"
app:vc_endDrawable="@drawable/abc_btn_checkbox_unchecked_mtrl"/> -->


</LinearLayout>
4 changes: 4 additions & 0 deletions demo/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,8 @@

<string name="hello_world">Hello world!</string>
<string name="action_settings">Settings</string>


<string name="home_black">M10,20v-6h4v6h5v-8h3L12,3 2,12h3v8z</string>
<string name="thumbs_up">M1,21h4L5,9L1,9v12zM23,10c0,-1.1 -0.9,-2 -2,-2h-6.31l0.95,-4.57 0.03,-0.32c0,-0.41 -0.17,-0.79 -0.44,-1.06L14.17,1 7.59,7.59C7.22,7.95 7,8.45 7,9v10c0,1.1 0.9,2 2,2h9c0.83,0 1.54,-0.5 1.84,-1.22l3.02,-7.05c0.09,-0.23 0.14,-0.47 0.14,-0.73v-1.91l-0.01,-0.01L23,10z</string>
</resources>
4 changes: 2 additions & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Wed Apr 10 15:27:10 PDT 2013
#Sun Mar 06 16:32:57 CET 2016
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.2.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-2.10-all.zip
10 changes: 6 additions & 4 deletions library/build.gradle
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
apply plugin: 'com.android.library'

android {
compileSdkVersion 22
buildToolsVersion "22.0.1"
compileSdkVersion 23
buildToolsVersion "23.0.2"

lintOptions {
abortOnError false
}

defaultConfig {
minSdkVersion 14
targetSdkVersion 22
targetSdkVersion 23
versionCode 1
versionName "1.0"

vectorDrawables.useSupportLibrary = true
}
buildTypes {
release {
Expand All @@ -24,6 +26,6 @@ android {

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:22.1.1'
compile 'com.android.support:appcompat-v7:23.2.0'
apply from: 'https://raw.github.com/chrisbanes/gradle-mvn-push/master/gradle-mvn-push.gradle'
}
Original file line number Diff line number Diff line change
Expand Up @@ -152,8 +152,9 @@ public boolean setVisible(boolean visible, boolean restart) {
return super.setVisible(visible, restart);
}

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

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@

public abstract class DrawableCompat extends Drawable {

int mLayoutDirection;
int mSupportLayoutDirecction;

public static abstract class ConstantStateCompat extends ConstantState {

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

public int getLayoutDirection() {
return mLayoutDirection;
public int getSupportLayoutDirecction() {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

double c?

return mSupportLayoutDirecction;
}

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

if (getSupportLayoutDirecction() != layoutDirection) {
mSupportLayoutDirecction = layoutDirection;
}
return false;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import android.content.res.Resources;
import android.graphics.drawable.Drawable;
import android.os.Build;
import android.support.v4.content.ContextCompat;

/**
* Copyright (C) 2015 Wael Nafee
Expand All @@ -28,11 +29,9 @@ public class ResourcesCompat {
public static Drawable getDrawable(Context c, int resId) {
Drawable d;
try {
if (LOLLIPOP) {
d = c.getResources().getDrawable(resId, c.getTheme());
} else {
d = c.getResources().getDrawable(resId);
}


d = ContextCompat.getDrawable(c,resId);
} catch (Resources.NotFoundException e) {

try {
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() && getSupportLayoutDirecction() == 1; // 1 is for LayoutDirection.RTL
}

@Override
Expand Down
4 changes: 2 additions & 2 deletions library/src/main/res/drawable/ic_arrow_to_drawer.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@

<target
android:name="rotationGroup"
android:animation="@anim/arrow_to_drawer_rotation" />
android:animation="@animator/arrow_to_drawer_rotation" />

<target
android:name="v"
android:animation="@anim/arrow_to_drawer_path" />
android:animation="@animator/arrow_to_drawer_path" />
</animated-vector>
4 changes: 2 additions & 2 deletions library/src/main/res/drawable/ic_drawer_to_arrow.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@

<target
android:name="rotationGroup"
android:animation="@anim/drawer_to_arrow_rotation" />
android:animation="@animator/drawer_to_arrow_rotation" />

<target
android:name="v"
android:animation="@anim/drawer_to_arrow_path" />
android:animation="@animator/drawer_to_arrow_path" />
</animated-vector>
4 changes: 2 additions & 2 deletions library/src/main/res/drawable/ic_pause_to_play.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@

<target
android:name="rotationGroup"
android:animation="@anim/pause_to_play_rotation" />
android:animation="@animator/pause_to_play_rotation" />

<target
android:name="v"
android:animation="@anim/pause_to_play_path" />
android:animation="@animator/pause_to_play_path" />
</animated-vector>
4 changes: 2 additions & 2 deletions library/src/main/res/drawable/ic_play_to_pause.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@

<target
android:name="rotationGroup"
android:animation="@anim/play_to_pause_rotation" />
android:animation="@animator/play_to_pause_rotation" />

<target
android:name="v"
android:animation="@anim/play_to_pause_path" />
android:animation="@animator/play_to_pause_path" />
</animated-vector>
4 changes: 2 additions & 2 deletions library/src/main/res/drawable/ic_play_to_stop.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@

<target
android:name="rotationGroup"
android:animation="@anim/play_to_stop_rotation" />
android:animation="@animator/play_to_stop_rotation" />

<target
android:name="v"
android:animation="@anim/play_to_stop_path" />
android:animation="@animator/play_to_stop_path" />
</animated-vector>
4 changes: 2 additions & 2 deletions library/src/main/res/drawable/ic_stop_to_play.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@

<target
android:name="rotationGroup"
android:animation="@anim/stop_to_play_rotation" />
android:animation="@animator/stop_to_play_rotation" />

<target
android:name="v"
android:animation="@anim/stop_to_play_path" />
android:animation="@animator/stop_to_play_path" />
</animated-vector>