diff options
author | Christian Schneppe <christian@pix-art.de> | 2018-05-03 22:14:23 +0200 |
---|---|---|
committer | Christian Schneppe <christian@pix-art.de> | 2018-05-03 22:14:23 +0200 |
commit | 7d5c374fd09bdeaf3acd2dca653e618ecd3e2c71 (patch) | |
tree | 8219358cd0ce1736ea0032fd5ad851f275abcc30 /src | |
parent | 75f7ec90466e6cbfc4220bd59b78a6230dc8fef7 (diff) |
add animations
Diffstat (limited to 'src')
-rw-r--r-- | src/main/java/de/pixart/messenger/ui/ConversationFragment.java | 8 | ||||
-rw-r--r-- | src/main/java/de/pixart/messenger/ui/ConversationsOverviewFragment.java | 8 | ||||
-rw-r--r-- | src/main/res/animator/fade_left_in.xml | 15 | ||||
-rw-r--r-- | src/main/res/animator/fade_left_out.xml | 15 | ||||
-rw-r--r-- | src/main/res/animator/fade_right_in.xml | 15 | ||||
-rw-r--r-- | src/main/res/animator/fade_right_out.xml | 15 | ||||
-rw-r--r-- | src/main/res/layout/fragment_conversation.xml | 4 |
7 files changed, 78 insertions, 2 deletions
diff --git a/src/main/java/de/pixart/messenger/ui/ConversationFragment.java b/src/main/java/de/pixart/messenger/ui/ConversationFragment.java index 253d27433..fdcbf29b3 100644 --- a/src/main/java/de/pixart/messenger/ui/ConversationFragment.java +++ b/src/main/java/de/pixart/messenger/ui/ConversationFragment.java @@ -1,6 +1,8 @@ package de.pixart.messenger.ui; import android.Manifest; +import android.animation.Animator; +import android.animation.AnimatorInflater; import android.annotation.SuppressLint; import android.app.Activity; import android.app.Fragment; @@ -1212,6 +1214,12 @@ public class ConversationFragment extends XmppFragment implements EditMessage.Ke return binding.getRoot(); } + @Override + public Animator onCreateAnimator(int transit, boolean enter, int nextAnim) { + int animator = enter ? R.animator.fade_right_in : R.animator.fade_right_out; + return AnimatorInflater.loadAnimator(getActivity(), animator); + } + private void quoteText(String text) { if (binding.textinput.isEnabled()) { text = text.replaceAll("(\n *){2,}", "\n").replaceAll("(^|\n)", "$1> ").replaceAll("\n$", ""); diff --git a/src/main/java/de/pixart/messenger/ui/ConversationsOverviewFragment.java b/src/main/java/de/pixart/messenger/ui/ConversationsOverviewFragment.java index 63dc9b699..d2f7110f9 100644 --- a/src/main/java/de/pixart/messenger/ui/ConversationsOverviewFragment.java +++ b/src/main/java/de/pixart/messenger/ui/ConversationsOverviewFragment.java @@ -29,6 +29,8 @@ package de.pixart.messenger.ui; +import android.animation.Animator; +import android.animation.AnimatorInflater; import android.app.Activity; import android.app.Fragment; import android.content.Intent; @@ -217,6 +219,12 @@ public class ConversationsOverviewFragment extends XmppFragment { } @Override + public Animator onCreateAnimator(int transit, boolean enter, int nextAnim) { + int animator = enter ? R.animator.fade_left_in : R.animator.fade_left_out; + return AnimatorInflater.loadAnimator(getActivity(), animator); + } + + @Override void refresh() { if (this.binding == null || this.activity == null) { Log.d(Config.LOGTAG, "ConversationsOverviewFragment.refresh() skipped updated because view binding or activity was null"); diff --git a/src/main/res/animator/fade_left_in.xml b/src/main/res/animator/fade_left_in.xml new file mode 100644 index 000000000..fa53b49c7 --- /dev/null +++ b/src/main/res/animator/fade_left_in.xml @@ -0,0 +1,15 @@ +<?xml version="1.0" encoding="utf-8"?> +<set xmlns:android="http://schemas.android.com/apk/res/android" + android:duration="200" + android:shareInterpolator="@android:anim/accelerate_decelerate_interpolator"> + <objectAnimator + android:propertyName="translationX" + android:valueFrom="-200" + android:valueTo="0" + android:valueType="floatType" /> + <objectAnimator + android:propertyName="alpha" + android:valueFrom="0" + android:valueTo="1" + android:valueType="floatType" /> +</set>
\ No newline at end of file diff --git a/src/main/res/animator/fade_left_out.xml b/src/main/res/animator/fade_left_out.xml new file mode 100644 index 000000000..af002f57d --- /dev/null +++ b/src/main/res/animator/fade_left_out.xml @@ -0,0 +1,15 @@ +<?xml version="1.0" encoding="utf-8"?> +<set xmlns:android="http://schemas.android.com/apk/res/android" + android:duration="200" + android:shareInterpolator="@android:anim/accelerate_decelerate_interpolator"> + <objectAnimator + android:propertyName="translationX" + android:valueFrom="0" + android:valueTo="-200" + android:valueType="floatType" /> + <objectAnimator + android:propertyName="alpha" + android:valueFrom="1" + android:valueTo="0" + android:valueType="floatType" /> +</set>
\ No newline at end of file diff --git a/src/main/res/animator/fade_right_in.xml b/src/main/res/animator/fade_right_in.xml new file mode 100644 index 000000000..497ebb465 --- /dev/null +++ b/src/main/res/animator/fade_right_in.xml @@ -0,0 +1,15 @@ +<?xml version="1.0" encoding="utf-8"?> +<set xmlns:android="http://schemas.android.com/apk/res/android" + android:duration="200" + android:shareInterpolator="@android:anim/accelerate_decelerate_interpolator"> + <objectAnimator + android:propertyName="translationX" + android:valueFrom="200" + android:valueTo="0" + android:valueType="floatType" /> + <objectAnimator + android:propertyName="alpha" + android:valueFrom="0" + android:valueTo="1" + android:valueType="floatType" /> +</set>
\ No newline at end of file diff --git a/src/main/res/animator/fade_right_out.xml b/src/main/res/animator/fade_right_out.xml new file mode 100644 index 000000000..3d83be942 --- /dev/null +++ b/src/main/res/animator/fade_right_out.xml @@ -0,0 +1,15 @@ +<?xml version="1.0" encoding="utf-8"?> +<set xmlns:android="http://schemas.android.com/apk/res/android" + android:duration="200" + android:shareInterpolator="@android:anim/accelerate_decelerate_interpolator"> + <objectAnimator + android:propertyName="translationX" + android:valueFrom="0" + android:valueTo="200" + android:valueType="floatType" /> + <objectAnimator + android:propertyName="alpha" + android:valueFrom="1" + android:valueTo="0" + android:valueType="floatType" /> +</set>
\ No newline at end of file diff --git a/src/main/res/layout/fragment_conversation.xml b/src/main/res/layout/fragment_conversation.xml index 1b03b375d..cc35d21cc 100644 --- a/src/main/res/layout/fragment_conversation.xml +++ b/src/main/res/layout/fragment_conversation.xml @@ -10,8 +10,8 @@ <ListView android:id="@+id/messages_view" - android:layout_width="fill_parent" - android:layout_height="wrap_content" + android:layout_width="match_parent" + android:layout_height="match_parent" android:layout_above="@+id/snackbar" android:layout_alignParentLeft="true" android:layout_alignParentTop="true" |