From f17aa9b4ebbbe96774b9350e941de10c9cc188dc Mon Sep 17 00:00:00 2001 From: ByteHamster Date: Tue, 24 Dec 2019 00:06:32 +0100 Subject: [PATCH] Switched to less demanding animation --- .../antennapod/activity/MainActivity.java | 10 ++++---- .../antennapod/fragment/FeedInfoFragment.java | 19 +++++++------- .../fragment/FeedItemlistFragment.java | 4 +-- .../fragment/FeedSettingsFragment.java | 4 +-- .../antennapod/fragment/TransitionEffect.java | 2 +- app/src/main/res/anim/card_flip_left_in.xml | 25 ------------------- app/src/main/res/anim/card_flip_left_out.xml | 18 ------------- app/src/main/res/anim/card_flip_right_in.xml | 25 ------------------- app/src/main/res/anim/card_flip_right_out.xml | 18 ------------- app/src/main/res/anim/fade_in.xml | 2 +- app/src/main/res/anim/fade_out.xml | 2 +- app/src/main/res/anim/slide_left_in.xml | 8 ++++++ app/src/main/res/anim/slide_left_out.xml | 8 ++++++ app/src/main/res/anim/slide_right_in.xml | 8 ++++++ app/src/main/res/anim/slide_right_out.xml | 8 ++++++ app/src/main/res/values/integers.xml | 5 ---- 16 files changed, 52 insertions(+), 114 deletions(-) delete mode 100644 app/src/main/res/anim/card_flip_left_in.xml delete mode 100644 app/src/main/res/anim/card_flip_left_out.xml delete mode 100644 app/src/main/res/anim/card_flip_right_in.xml delete mode 100644 app/src/main/res/anim/card_flip_right_out.xml create mode 100644 app/src/main/res/anim/slide_left_in.xml create mode 100644 app/src/main/res/anim/slide_left_out.xml create mode 100644 app/src/main/res/anim/slide_right_in.xml create mode 100644 app/src/main/res/anim/slide_right_out.xml delete mode 100644 app/src/main/res/values/integers.xml diff --git a/app/src/main/java/de/danoeh/antennapod/activity/MainActivity.java b/app/src/main/java/de/danoeh/antennapod/activity/MainActivity.java index 0023e6d7f..fab84078e 100644 --- a/app/src/main/java/de/danoeh/antennapod/activity/MainActivity.java +++ b/app/src/main/java/de/danoeh/antennapod/activity/MainActivity.java @@ -383,12 +383,12 @@ public class MainActivity extends CastEnabledActivity implements NavDrawerActivi case FADE: transaction.setCustomAnimations(R.anim.fade_in, R.anim.fade_out); break; - case FLIP: + case SLIDE: transaction.setCustomAnimations( - R.anim.card_flip_left_in, - R.anim.card_flip_left_out, - R.anim.card_flip_right_in, - R.anim.card_flip_right_out); + R.anim.slide_right_in, + R.anim.slide_left_out, + R.anim.slide_left_in, + R.anim.slide_right_out); break; } diff --git a/app/src/main/java/de/danoeh/antennapod/fragment/FeedInfoFragment.java b/app/src/main/java/de/danoeh/antennapod/fragment/FeedInfoFragment.java index 79637d79a..3949172bb 100644 --- a/app/src/main/java/de/danoeh/antennapod/fragment/FeedInfoFragment.java +++ b/app/src/main/java/de/danoeh/antennapod/fragment/FeedInfoFragment.java @@ -76,7 +76,7 @@ public class FeedInfoFragment extends Fragment { private final View.OnClickListener copyUrlToClipboard = new View.OnClickListener() { @Override public void onClick(View v) { - if(feed != null && feed.getDownload_url() != null) { + if (feed != null && feed.getDownload_url() != null) { String url = feed.getDownload_url(); ClipData clipData = ClipData.newPlainText(url, url); android.content.ClipboardManager cm = (android.content.ClipboardManager) getContext() @@ -91,12 +91,13 @@ public class FeedInfoFragment extends Fragment { @Override public void onResume() { super.onResume(); - ((MainActivity)getActivity()).getSupportActionBar().setTitle(R.string.feed_info_label); + ((MainActivity) getActivity()).getSupportActionBar().setTitle(R.string.feed_info_label); } @Nullable @Override - public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { + public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, + @Nullable Bundle savedInstanceState) { View root = inflater.inflate(R.layout.feedinfo, null); setHasOptionsMenu(true); @@ -118,7 +119,6 @@ public class FeedInfoFragment extends Fragment { txtvUrl = root.findViewById(R.id.txtvUrl); txtvUrl.setOnClickListener(copyUrlToClipboard); - postponeEnterTransition(); return root; } @@ -136,10 +136,9 @@ public class FeedInfoFragment extends Fragment { .subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread()) .subscribe(result -> { - feed = result; - showFeed(); - }, error -> Log.d(TAG, Log.getStackTraceString(error)), - this::startPostponedEnterTransition); + feed = result; + showFeed(); + }, error -> Log.d(TAG, Log.getStackTraceString(error)), () -> { }); } private void showFeed() { @@ -208,8 +207,8 @@ public class FeedInfoFragment extends Fragment { public void onPrepareOptionsMenu(Menu menu) { super.onPrepareOptionsMenu(menu); menu.findItem(R.id.share_link_item).setVisible(feed != null && feed.getLink() != null); - menu.findItem(R.id.visit_website_item).setVisible(feed != null && feed.getLink() != null && - IntentUtils.isCallable(getContext(), new Intent(Intent.ACTION_VIEW, Uri.parse(feed.getLink())))); + menu.findItem(R.id.visit_website_item).setVisible(feed != null && feed.getLink() != null + && IntentUtils.isCallable(getContext(), new Intent(Intent.ACTION_VIEW, Uri.parse(feed.getLink())))); } @Override diff --git a/app/src/main/java/de/danoeh/antennapod/fragment/FeedItemlistFragment.java b/app/src/main/java/de/danoeh/antennapod/fragment/FeedItemlistFragment.java index 33343948f..94aa7291e 100644 --- a/app/src/main/java/de/danoeh/antennapod/fragment/FeedItemlistFragment.java +++ b/app/src/main/java/de/danoeh/antennapod/fragment/FeedItemlistFragment.java @@ -515,7 +515,7 @@ public class FeedItemlistFragment extends ListFragment { butShowSettings.setOnClickListener(v -> { if (feed != null) { FeedSettingsFragment fragment = FeedSettingsFragment.newInstance(feed); - ((MainActivity) getActivity()).loadChildFragment(fragment, TransitionEffect.FLIP); + ((MainActivity) getActivity()).loadChildFragment(fragment, TransitionEffect.SLIDE); } }); headerCreated = true; @@ -524,7 +524,7 @@ public class FeedItemlistFragment extends ListFragment { private void showFeedInfo() { if (feed != null) { FeedInfoFragment fragment = FeedInfoFragment.newInstance(feed); - ((MainActivity) getActivity()).loadChildFragment(fragment, TransitionEffect.FLIP); + ((MainActivity) getActivity()).loadChildFragment(fragment, TransitionEffect.SLIDE); } } diff --git a/app/src/main/java/de/danoeh/antennapod/fragment/FeedSettingsFragment.java b/app/src/main/java/de/danoeh/antennapod/fragment/FeedSettingsFragment.java index 7c1555e66..bb1f8f8e9 100644 --- a/app/src/main/java/de/danoeh/antennapod/fragment/FeedSettingsFragment.java +++ b/app/src/main/java/de/danoeh/antennapod/fragment/FeedSettingsFragment.java @@ -54,7 +54,6 @@ public class FeedSettingsFragment extends PreferenceFragmentCompat { setupAutoDownloadGlobalPreference(); // To prevent transition animation because of summary update - postponeEnterTransition(); long feedId = getArguments().getLong(EXTRA_FEED_ID); disposable = Maybe.create((MaybeOnSubscribe) emitter -> { Feed feed = DBReader.getFeed(feedId); @@ -81,8 +80,7 @@ public class FeedSettingsFragment extends PreferenceFragmentCompat { updateAutoDeleteSummary(); updateAutoDownloadEnabled(); updatePlaybackSpeedPreference(); - }, error -> Log.d(TAG, Log.getStackTraceString(error)), - this::startPostponedEnterTransition); + }, error -> Log.d(TAG, Log.getStackTraceString(error)), () -> { }); } @Override diff --git a/app/src/main/java/de/danoeh/antennapod/fragment/TransitionEffect.java b/app/src/main/java/de/danoeh/antennapod/fragment/TransitionEffect.java index 461fa9da3..e3ec14890 100644 --- a/app/src/main/java/de/danoeh/antennapod/fragment/TransitionEffect.java +++ b/app/src/main/java/de/danoeh/antennapod/fragment/TransitionEffect.java @@ -1,5 +1,5 @@ package de.danoeh.antennapod.fragment; public enum TransitionEffect { - NONE, FLIP, FADE + NONE, FADE, SLIDE } diff --git a/app/src/main/res/anim/card_flip_left_in.xml b/app/src/main/res/anim/card_flip_left_in.xml deleted file mode 100644 index 0ffc85aec..000000000 --- a/app/src/main/res/anim/card_flip_left_in.xml +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - - - - - - \ No newline at end of file diff --git a/app/src/main/res/anim/card_flip_left_out.xml b/app/src/main/res/anim/card_flip_left_out.xml deleted file mode 100644 index 817f0d3fc..000000000 --- a/app/src/main/res/anim/card_flip_left_out.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/app/src/main/res/anim/card_flip_right_in.xml b/app/src/main/res/anim/card_flip_right_in.xml deleted file mode 100644 index 31ff1dde5..000000000 --- a/app/src/main/res/anim/card_flip_right_in.xml +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - - - - - - \ No newline at end of file diff --git a/app/src/main/res/anim/card_flip_right_out.xml b/app/src/main/res/anim/card_flip_right_out.xml deleted file mode 100644 index b57113fea..000000000 --- a/app/src/main/res/anim/card_flip_right_out.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/app/src/main/res/anim/fade_in.xml b/app/src/main/res/anim/fade_in.xml index d3567dc31..fa1ba9ade 100644 --- a/app/src/main/res/anim/fade_in.xml +++ b/app/src/main/res/anim/fade_in.xml @@ -2,7 +2,7 @@ diff --git a/app/src/main/res/anim/fade_out.xml b/app/src/main/res/anim/fade_out.xml index ddf12d13f..392ec4277 100644 --- a/app/src/main/res/anim/fade_out.xml +++ b/app/src/main/res/anim/fade_out.xml @@ -2,7 +2,7 @@ diff --git a/app/src/main/res/anim/slide_left_in.xml b/app/src/main/res/anim/slide_left_in.xml new file mode 100644 index 000000000..6effe70f4 --- /dev/null +++ b/app/src/main/res/anim/slide_left_in.xml @@ -0,0 +1,8 @@ + + + + diff --git a/app/src/main/res/anim/slide_left_out.xml b/app/src/main/res/anim/slide_left_out.xml new file mode 100644 index 000000000..ee28900e9 --- /dev/null +++ b/app/src/main/res/anim/slide_left_out.xml @@ -0,0 +1,8 @@ + + + + diff --git a/app/src/main/res/anim/slide_right_in.xml b/app/src/main/res/anim/slide_right_in.xml new file mode 100644 index 000000000..368927438 --- /dev/null +++ b/app/src/main/res/anim/slide_right_in.xml @@ -0,0 +1,8 @@ + + + + diff --git a/app/src/main/res/anim/slide_right_out.xml b/app/src/main/res/anim/slide_right_out.xml new file mode 100644 index 000000000..13567b256 --- /dev/null +++ b/app/src/main/res/anim/slide_right_out.xml @@ -0,0 +1,8 @@ + + + + diff --git a/app/src/main/res/values/integers.xml b/app/src/main/res/values/integers.xml deleted file mode 100644 index 8c444ee8b..000000000 --- a/app/src/main/res/values/integers.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - 400 - 200 - \ No newline at end of file