Skip to content
This repository has been archived by the owner on Sep 8, 2019. It is now read-only.

Commit

Permalink
- fixed AnimatedVectorDrawables for Rtl-Layouts
Browse files Browse the repository at this point in the history
  • Loading branch information
kollerlukas committed Mar 27, 2017
1 parent c4f6bb8 commit 79b219d
Show file tree
Hide file tree
Showing 12 changed files with 427 additions and 21 deletions.
2 changes: 1 addition & 1 deletion .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file modified app/app-release.apk
Binary file not shown.
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ android {
applicationId "us.koller.cameraroll"
minSdkVersion 19
targetSdkVersion 25
versionCode 16
versionName "v1.3.1 Beta"
versionCode 17
versionName "v1.3.2 Beta"
renderscriptTargetApi 25
vectorDrawables.useSupportLibrary = true
renderscriptSupportModeEnabled true
Expand Down
14 changes: 7 additions & 7 deletions app/src/main/java/us/koller/cameraroll/ui/AlbumActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -740,13 +740,13 @@ public void run() {

toolbar.setTitleTextColor(ContextCompat.getColor(AlbumActivity.this, R.color.grey_900_translucent));

/*//show share button
menu.findItem(R.id.share).setVisible(true);
//show share button
//menu.findItem(R.id.share).setVisible(true);
//show copy & move button
menu.findItem(R.id.copy).setVisible(true);
/*menu.findItem(R.id.copy).setVisible(true);
menu.findItem(R.id.move).setVisible(true);*/
}
}, navIcon instanceof Animatable ? 500 : 0);
}, navIcon instanceof Animatable ? (int) (500 * Util.getAnimatorSpeed(this)) : 0);
} else {
toolbar.setBackgroundColor(ContextCompat
.getColor(this, R.color.colorAccent));
Expand Down Expand Up @@ -820,7 +820,7 @@ public void run() {
menu.findItem(R.id.copy).setVisible(false);
menu.findItem(R.id.move).setVisible(false);
}
}, navIcon instanceof Animatable ? 500 : 0);
}, navIcon instanceof Animatable ? (int) (500 * Util.getAnimatorSpeed(this)) : 0);

animateFab(false, false);
}
Expand Down Expand Up @@ -871,7 +871,7 @@ public void run() {
setPhotosResult();
}
}
}, 400);
}, (int) (400 * Util.getAnimatorSpeed(this)));
}

public void animateFab(final boolean show, boolean click) {
Expand Down Expand Up @@ -908,7 +908,7 @@ public void run() {
.setDuration(250)
.start();
}
}, click ? 400 : 0);
}, click ? (int) (400 * Util.getAnimatorSpeed(this)) : 0);
}

private void setSystemUiFlags() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ public boolean onPreDraw() {
public void run() {
recyclerViewAdapter.pickTarget();
}
}, 500);
}, (int) (500 * Util.getAnimatorSpeed(this)));
}
}
}
Expand Down Expand Up @@ -720,7 +720,7 @@ public void run() {
}
}
}
}, navIcon instanceof Animatable ? 500 : 0);
}, navIcon instanceof Animatable ? (int) (500 * Util.getAnimatorSpeed(this)) : 0);
}

@Override
Expand Down Expand Up @@ -808,7 +808,7 @@ public void run() {
}
}
}
}, 300);
}, (int) (300 * Util.getAnimatorSpeed(this)));
}

@Override
Expand Down Expand Up @@ -911,6 +911,6 @@ public void setTitle(Toolbar toolbar) {
}
}
}
}, navIcon instanceof Animatable ? 500 : 0);
}, navIcon instanceof Animatable ? (int) (500 * Util.getAnimatorSpeed(this)) : 0);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
Expand All @@ -19,7 +18,6 @@
import android.widget.TextView;

import com.bumptech.glide.Glide;
import com.bumptech.glide.load.engine.DiskCacheStrategy;

import java.util.ArrayList;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -717,7 +717,7 @@ public void bottomBarOnClick(View v) {
public void run() {
showDeleteDialog();
}
}, 400);
}, (int) (400 * Util.getAnimatorSpeed(this)));
} else {
showDeleteDialog();
}
Expand Down
7 changes: 7 additions & 0 deletions app/src/main/java/us/koller/cameraroll/util/Util.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import android.os.Build;
import android.provider.BaseColumns;
import android.provider.MediaStore;
import android.provider.Settings;
import android.support.annotation.RequiresApi;
import android.support.design.widget.Snackbar;
import android.support.v4.content.ContextCompat;
Expand All @@ -24,6 +25,7 @@
import android.util.Log;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import android.widget.TextView;
import android.widget.Toast;

Expand Down Expand Up @@ -171,4 +173,9 @@ public static int[] getScreenSize(Activity context) {
displayRect.left, displayRect.top,
displayRect.right, displayRect.bottom};
}

public static float getAnimatorSpeed(Context context) {
return Settings.Global.getFloat(context.getContentResolver(),
Settings.Global.ANIMATOR_DURATION_SCALE, 1.0f);
}
}
206 changes: 206 additions & 0 deletions app/src/main/res/drawable-ldrtl-v21/back_to_cancel_avd.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,206 @@
<animated-vector xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:aapt="http://schemas.android.com/aapt">

<aapt:attr name="android:drawable">
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:alpha="0.54"
android:viewportHeight="24"
android:viewportWidth="24">
<group
android:name="group"
android:pivotX="12"
android:pivotY="12"
android:translateX="7.3">

<path
android:name="stem"
android:pathData="M 11.41 12 L -2.59 12 Z"
android:strokeColor="@color/white"
android:strokeMiterLimit="10"
android:strokeWidth="2"
android:trimPathStart="0" />
<path
android:name="arrow_head_top"
android:pathData="M 12.71 12.71 L 4.7 4.7 Z"
android:strokeColor="@color/white"
android:strokeMiterLimit="10"
android:strokeWidth="2" />
<path
android:name="arrow_head_bottom"
android:pathData="M 12.71 11.29 L 4.7 19.3 Z"
android:strokeColor="@color/white"
android:strokeMiterLimit="10"
android:strokeWidth="2" />
<path
android:name="clear_top_right"
android:pathData="M 12 12 L 18.3 5.7 Z"
android:strokeColor="@color/white"
android:strokeMiterLimit="10"
android:strokeWidth="2"
android:trimPathStart="1" />
<path
android:name="clear_bottom_right"
android:pathData="M 12 12 L 18.3 18.3 Z"
android:strokeColor="@color/white"
android:strokeMiterLimit="10"
android:strokeWidth="2"
android:trimPathStart="1" />
</group>
</vector>
</aapt:attr>

<target android:name="stem">
<aapt:attr name="android:animation">
<set xmlns:android="http://schemas.android.com/apk/res/android">
<objectAnimator
android:name="stem"
android:duration="250"
android:fillAfter="true"
android:interpolator="@android:anim/accelerate_decelerate_interpolator"
android:propertyName="trimPathStart"
android:valueFrom="0"
android:valueTo="1"
android:valueType="floatType" />

<objectAnimator
android:name="stroke_color"
android:duration="300"
android:interpolator="@android:anim/accelerate_decelerate_interpolator"
android:propertyName="strokeColor"
android:valueFrom="@color/white"
android:valueTo="@color/grey_900"
android:valueType="colorType" />
</set>
</aapt:attr>
</target>

<target android:name="clear_bottom_right">
<aapt:attr name="android:animation">
<set xmlns:android="http://schemas.android.com/apk/res/android">
<objectAnimator
android:name="clear_bottom_right"
android:duration="250"
android:fillAfter="true"
android:interpolator="@android:anim/accelerate_decelerate_interpolator"
android:propertyName="trimPathStart"
android:startOffset="250"
android:valueFrom="1"
android:valueTo="0"
android:valueType="floatType" />

<objectAnimator
android:name="stroke_color"
android:duration="300"
android:interpolator="@android:anim/accelerate_decelerate_interpolator"
android:propertyName="strokeColor"
android:valueFrom="@color/white"
android:valueTo="@color/grey_900"
android:valueType="colorType" />
</set>
</aapt:attr>
</target>
<target android:name="clear_top_right">
<aapt:attr name="android:animation">
<set xmlns:android="http://schemas.android.com/apk/res/android">
<objectAnimator xmlns:android="http://schemas.android.com/apk/res/android"
android:name="clear_top_right"
android:duration="250"
android:fillAfter="true"
android:interpolator="@android:anim/accelerate_decelerate_interpolator"
android:propertyName="trimPathStart"
android:startOffset="250"
android:valueFrom="1"
android:valueTo="0"
android:valueType="floatType" />

<objectAnimator
android:name="stroke_color"
android:duration="300"
android:interpolator="@android:anim/accelerate_decelerate_interpolator"
android:propertyName="strokeColor"
android:valueFrom="@color/white"
android:valueTo="@color/grey_900"
android:valueType="colorType" />
</set>
</aapt:attr>
</target>

<target android:name="arrow_head_top">
<aapt:attr name="android:animation">
<set xmlns:android="http://schemas.android.com/apk/res/android">
<objectAnimator xmlns:android="http://schemas.android.com/apk/res/android"
android:name="arrow_head_top"
android:duration="500"
android:fillAfter="true"
android:interpolator="@android:anim/accelerate_decelerate_interpolator"
android:propertyName="trimPathEnd"
android:valueFrom="1"
android:valueTo="0.44"
android:valueType="floatType" />

<objectAnimator
android:name="stroke_color"
android:duration="300"
android:interpolator="@android:anim/accelerate_decelerate_interpolator"
android:propertyName="strokeColor"
android:valueFrom="@color/white"
android:valueTo="@color/grey_900"
android:valueType="colorType" />
</set>
</aapt:attr>
</target>

<target android:name="arrow_head_bottom">
<aapt:attr name="android:animation">
<set xmlns:android="http://schemas.android.com/apk/res/android">
<objectAnimator
android:name="arrow_head_bottom"
android:duration="500"
android:fillAfter="true"
android:interpolator="@android:anim/accelerate_decelerate_interpolator"
android:propertyName="trimPathEnd"
android:valueFrom="1"
android:valueTo="0.44"
android:valueType="floatType" />

<objectAnimator
android:name="stroke_color"
android:duration="300"
android:interpolator="@android:anim/accelerate_decelerate_interpolator"
android:propertyName="strokeColor"
android:valueFrom="@color/white"
android:valueTo="@color/grey_900"
android:valueType="colorType" />
</set>
</aapt:attr>
</target>

<target android:name="group">
<aapt:attr name="android:animation">
<set xmlns:android="http://schemas.android.com/apk/res/android">
<objectAnimator
android:name="group"
android:duration="500"
android:fillAfter="true"
android:interpolator="@android:anim/accelerate_decelerate_interpolator"
android:propertyName="translateX"
android:valueFrom="7.3"
android:valueTo="0"
android:valueType="floatType" />

<objectAnimator
android:name="group"
android:duration="375"
android:fillAfter="true"
android:interpolator="@android:anim/accelerate_decelerate_interpolator"
android:propertyName="rotation"
android:startOffset="125"
android:valueFrom="0"
android:valueTo="180"
android:valueType="floatType" />
</set>
</aapt:attr>
</target>
</animated-vector>
Loading

0 comments on commit 79b219d

Please sign in to comment.