diff options
author | Tony Tam <engineer.tonytam@pm.me> | 2020-07-16 22:45:59 -0700 |
---|---|---|
committer | Tony Tam <engineer.tonytam@pm.me> | 2020-07-16 22:45:59 -0700 |
commit | ac8f6f9a3e3ffd27ff82cea82256007c6676c764 (patch) | |
tree | d8e453a10d8ad6d22876a1e6001ca891740c20a5 /app | |
parent | b3112701de533456166355ee73428e7412604367 (diff) | |
download | AntennaPod-ac8f6f9a3e3ffd27ff82cea82256007c6676c764.zip |
layout params
Diffstat (limited to 'app')
-rw-r--r-- | app/src/main/java/de/danoeh/antennapod/fragment/CoverFragment.java | 12 |
1 files changed, 8 insertions, 4 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 c9fd417cd..0bb657e51 100644 --- a/app/src/main/java/de/danoeh/antennapod/fragment/CoverFragment.java +++ b/app/src/main/java/de/danoeh/antennapod/fragment/CoverFragment.java @@ -184,17 +184,21 @@ public class CoverFragment extends Fragment { private void configureForOrientation(Configuration newConfig) { LinearLayout mainContainer = getView().findViewById(R.id.cover_fragment); + ViewGroup.LayoutParams params = imgvCover.getLayoutParams(); + if (newConfig.orientation == Configuration.ORIENTATION_PORTRAIT) { mainContainer.setOrientation(LinearLayout.VERTICAL); if (newConfig.screenWidthDp > 0) { - imgvCover.getLayoutParams().width = (int) (convertDpToPixel(newConfig.screenWidthDp) * .80); - imgvCover.getLayoutParams().height = imgvCover.getLayoutParams().width; + params.width = (int) (convertDpToPixel(newConfig.screenWidthDp) * .80); + params.height= params.width; + imgvCover.setLayoutParams(params); } } else { mainContainer.setOrientation(LinearLayout.HORIZONTAL); if (newConfig.screenHeightDp > 0) { - imgvCover.getLayoutParams().height = (int) (convertDpToPixel(newConfig.screenHeightDp) * .40); - imgvCover.getLayoutParams().width = imgvCover.getLayoutParams().height; + params.height = (int) (convertDpToPixel(newConfig.screenHeightDp) * .40); + params.width = params.height; + imgvCover.setLayoutParams(params); } } } |