diff options
author | Tony Tam <engineer.tonytam@pm.me> | 2020-07-16 07:43:18 -0700 |
---|---|---|
committer | Tony Tam <engineer.tonytam@pm.me> | 2020-07-16 07:43:18 -0700 |
commit | b3112701de533456166355ee73428e7412604367 (patch) | |
tree | b3178bb0439673aac3cc8c7e5c3a8de26947b868 /app | |
parent | 7f8ac6c681085c2c517e7dd352806a99e682d93b (diff) | |
download | AntennaPod-b3112701de533456166355ee73428e7412604367.zip |
remove global var for orientation
Diffstat (limited to 'app')
-rw-r--r-- | app/src/main/java/de/danoeh/antennapod/fragment/CoverFragment.java | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/app/src/main/java/de/danoeh/antennapod/fragment/CoverFragment.java b/app/src/main/java/de/danoeh/antennapod/fragment/CoverFragment.java index a3f46542d..c9fd417cd 100644 --- a/app/src/main/java/de/danoeh/antennapod/fragment/CoverFragment.java +++ b/app/src/main/java/de/danoeh/antennapod/fragment/CoverFragment.java @@ -54,7 +54,6 @@ public class CoverFragment extends Fragment { private Disposable disposable; private int displayedChapterIndex = -2; private Playable media; - private int orientation = Configuration.ORIENTATION_UNDEFINED; @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, @@ -70,7 +69,7 @@ public class CoverFragment extends Fragment { @Override public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) { - configureForOrientation(getResources().getConfiguration().orientation, getResources().getConfiguration()); + configureForOrientation(getResources().getConfiguration()); } private void loadMediaInfo() { @@ -175,10 +174,7 @@ public class CoverFragment extends Fragment { public void onConfigurationChanged(Configuration newConfig) { super.onConfigurationChanged(newConfig); - if (orientation != newConfig.orientation) { - orientation = newConfig.orientation; - } - configureForOrientation(orientation, newConfig); + configureForOrientation(newConfig); } public float convertDpToPixel(float dp) { @@ -186,9 +182,9 @@ public class CoverFragment extends Fragment { return dp * ((float) context.getResources().getDisplayMetrics().densityDpi / DisplayMetrics.DENSITY_DEFAULT); } - private void configureForOrientation(int orientation, Configuration newConfig) { + private void configureForOrientation(Configuration newConfig) { LinearLayout mainContainer = getView().findViewById(R.id.cover_fragment); - if (orientation == Configuration.ORIENTATION_PORTRAIT) { + if (newConfig.orientation == Configuration.ORIENTATION_PORTRAIT) { mainContainer.setOrientation(LinearLayout.VERTICAL); if (newConfig.screenWidthDp > 0) { imgvCover.getLayoutParams().width = (int) (convertDpToPixel(newConfig.screenWidthDp) * .80); |