diff options
author | ByteHamster <info@bytehamster.com> | 2020-07-19 09:10:35 +0200 |
---|---|---|
committer | ByteHamster <info@bytehamster.com> | 2020-07-19 09:10:35 +0200 |
commit | 02b4c9542c2ef2a32e7fce2fc4f754058ffe4e9b (patch) | |
tree | e3e0d2276f1095dd45547d06f9b925a284ac04a4 /app/src/main | |
parent | bb753f46c1b22149b173d431b589c054a879a51b (diff) | |
download | AntennaPod-02b4c9542c2ef2a32e7fce2fc4f754058ffe4e9b.zip |
Change horizontal spacing automatically
Diffstat (limited to 'app/src/main')
-rw-r--r-- | app/src/main/java/de/danoeh/antennapod/fragment/FeedInfoFragment.java | 13 | ||||
-rw-r--r-- | app/src/main/java/de/danoeh/antennapod/fragment/FeedItemlistFragment.java | 10 | ||||
-rw-r--r-- | app/src/main/java/de/danoeh/antennapod/view/EpisodeItemListRecyclerView.java | 9 | ||||
-rw-r--r-- | app/src/main/res/layout-w800dp/main.xml (renamed from app/src/main/res/layout-w720dp/main.xml) | 0 | ||||
-rw-r--r-- | app/src/main/res/layout/all_episodes_fragment.xml | 1 | ||||
-rw-r--r-- | app/src/main/res/layout/feed_item_list_fragment.xml | 1 | ||||
-rw-r--r-- | app/src/main/res/layout/feeditemlist_header.xml | 2 | ||||
-rw-r--r-- | app/src/main/res/layout/queue_fragment.xml | 1 | ||||
-rw-r--r-- | app/src/main/res/layout/search_fragment.xml | 1 | ||||
-rw-r--r-- | app/src/main/res/layout/simple_list_fragment.xml | 3 |
10 files changed, 31 insertions, 10 deletions
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 c58e6c15f..a268b8b58 100644 --- a/app/src/main/java/de/danoeh/antennapod/fragment/FeedInfoFragment.java +++ b/app/src/main/java/de/danoeh/antennapod/fragment/FeedInfoFragment.java @@ -3,6 +3,7 @@ package de.danoeh.antennapod.fragment; import android.content.ClipData; import android.content.Context; import android.content.Intent; +import android.content.res.Configuration; import android.graphics.LightingColorFilter; import android.net.Uri; import android.os.Bundle; @@ -47,9 +48,6 @@ import io.reactivex.MaybeOnSubscribe; import io.reactivex.android.schedulers.AndroidSchedulers; import io.reactivex.disposables.Disposable; import io.reactivex.schedulers.Schedulers; -import org.apache.commons.lang3.StringUtils; -import org.jsoup.Jsoup; -import org.jsoup.nodes.Document; /** * Displays information about a feed. @@ -71,6 +69,7 @@ public class FeedInfoFragment extends Fragment { private TextView txtvUrl; private TextView txtvAuthorHeader; private ImageView imgvBackground; + private View header; private Menu optionsMenu; private ToolbarIconTintManager iconTintManager; @@ -124,6 +123,7 @@ public class FeedInfoFragment extends Fragment { txtvTitle = root.findViewById(R.id.txtvTitle); txtvAuthorHeader = root.findViewById(R.id.txtvAuthor); imgvBackground = root.findViewById(R.id.imgvBackground); + header = root.findViewById(R.id.headerContainer); root.findViewById(R.id.butShowInfo).setVisibility(View.INVISIBLE); root.findViewById(R.id.butShowSettings).setVisibility(View.INVISIBLE); // https://github.com/bumptech/glide/issues/529 @@ -159,6 +159,13 @@ public class FeedInfoFragment extends Fragment { }, error -> Log.d(TAG, Log.getStackTraceString(error)), () -> { }); } + @Override + public void onConfigurationChanged(Configuration newConfig) { + super.onConfigurationChanged(newConfig); + int horizontalSpacing = (int) getResources().getDimension(R.dimen.additional_horizontal_spacing); + header.setPadding(horizontalSpacing, header.getPaddingTop(), horizontalSpacing, header.getPaddingBottom()); + } + private void showFeed() { Log.d(TAG, "Language is " + feed.getLanguage()); Log.d(TAG, "Author is " + feed.getAuthor()); 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 9be32dfdd..5ae2b9ce5 100644 --- a/app/src/main/java/de/danoeh/antennapod/fragment/FeedItemlistFragment.java +++ b/app/src/main/java/de/danoeh/antennapod/fragment/FeedItemlistFragment.java @@ -2,6 +2,7 @@ package de.danoeh.antennapod.fragment; import android.content.Context; import android.content.DialogInterface; +import android.content.res.Configuration; import android.graphics.LightingColorFilter; import android.os.Bundle; import android.util.Log; @@ -98,6 +99,7 @@ public class FeedItemlistFragment extends Fragment implements AdapterView.OnItem private TextView txtvAuthor; private ImageButton butShowInfo; private ImageButton butShowSettings; + private View header; private Menu optionsMenu; private ToolbarIconTintManager iconTintManager; @@ -155,6 +157,7 @@ public class FeedItemlistFragment extends Fragment implements AdapterView.OnItem butShowSettings = root.findViewById(R.id.butShowSettings); txtvInformation = root.findViewById(R.id.txtvInformation); txtvFailure = root.findViewById(R.id.txtvFailure); + header = root.findViewById(R.id.headerContainer); AppBarLayout appBar = root.findViewById(R.id.appBar); CollapsingToolbarLayout collapsingToolbar = root.findViewById(R.id.collapsing_toolbar); @@ -246,6 +249,13 @@ public class FeedItemlistFragment extends Fragment implements AdapterView.OnItem } @Override + public void onConfigurationChanged(Configuration newConfig) { + super.onConfigurationChanged(newConfig); + int horizontalSpacing = (int) getResources().getDimension(R.dimen.additional_horizontal_spacing); + header.setPadding(horizontalSpacing, header.getPaddingTop(), horizontalSpacing, header.getPaddingBottom()); + } + + @Override public boolean onOptionsItemSelected(MenuItem item) { if (!super.onOptionsItemSelected(item)) { if (feed == null) { diff --git a/app/src/main/java/de/danoeh/antennapod/view/EpisodeItemListRecyclerView.java b/app/src/main/java/de/danoeh/antennapod/view/EpisodeItemListRecyclerView.java index 58d562616..83d90f98b 100644 --- a/app/src/main/java/de/danoeh/antennapod/view/EpisodeItemListRecyclerView.java +++ b/app/src/main/java/de/danoeh/antennapod/view/EpisodeItemListRecyclerView.java @@ -2,6 +2,7 @@ package de.danoeh.antennapod.view; import android.content.Context; import android.content.SharedPreferences; +import android.content.res.Configuration; import android.util.AttributeSet; import android.view.View; import androidx.appcompat.view.ContextThemeWrapper; @@ -39,6 +40,14 @@ public class EpisodeItemListRecyclerView extends RecyclerView { setLayoutManager(layoutManager); setHasFixedSize(true); addItemDecoration(new HorizontalDividerItemDecoration.Builder(getContext()).build()); + setClipToPadding(false); + } + + @Override + protected void onConfigurationChanged(Configuration newConfig) { + super.onConfigurationChanged(newConfig); + int horizontalSpacing = (int) getResources().getDimension(R.dimen.additional_horizontal_spacing); + setPadding(horizontalSpacing, getPaddingTop(), horizontalSpacing, getPaddingBottom()); } public void saveScrollPosition(String tag) { diff --git a/app/src/main/res/layout-w720dp/main.xml b/app/src/main/res/layout-w800dp/main.xml index 79b7213e0..79b7213e0 100644 --- a/app/src/main/res/layout-w720dp/main.xml +++ b/app/src/main/res/layout-w800dp/main.xml diff --git a/app/src/main/res/layout/all_episodes_fragment.xml b/app/src/main/res/layout/all_episodes_fragment.xml index 28f0b0575..353e4f1d0 100644 --- a/app/src/main/res/layout/all_episodes_fragment.xml +++ b/app/src/main/res/layout/all_episodes_fragment.xml @@ -23,7 +23,6 @@ android:layout_below="@+id/txtvInformation" android:layout_marginTop="0dp" android:layout_marginBottom="0dp" - android:clipToPadding="false" android:paddingTop="@dimen/list_vertical_padding" android:paddingBottom="@dimen/list_vertical_padding" android:paddingHorizontal="@dimen/additional_horizontal_spacing" diff --git a/app/src/main/res/layout/feed_item_list_fragment.xml b/app/src/main/res/layout/feed_item_list_fragment.xml index bfd36acf7..b995ff28f 100644 --- a/app/src/main/res/layout/feed_item_list_fragment.xml +++ b/app/src/main/res/layout/feed_item_list_fragment.xml @@ -53,7 +53,6 @@ android:layout_width="match_parent" android:layout_height="match_parent" android:paddingHorizontal="@dimen/additional_horizontal_spacing" - android:clipToPadding="false" app:layout_behavior="@string/appbar_scrolling_view_behavior" /> <ProgressBar diff --git a/app/src/main/res/layout/feeditemlist_header.xml b/app/src/main/res/layout/feeditemlist_header.xml index 60b0c9d03..9eb0104c9 100644 --- a/app/src/main/res/layout/feeditemlist_header.xml +++ b/app/src/main/res/layout/feeditemlist_header.xml @@ -5,7 +5,7 @@ xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent" android:layout_height="wrap_content" - android:paddingHorizontal="@dimen/additional_horizontal_spacing" + android:id="@+id/headerContainer" android:orientation="vertical"> <LinearLayout diff --git a/app/src/main/res/layout/queue_fragment.xml b/app/src/main/res/layout/queue_fragment.xml index 157086a8d..6a1851648 100644 --- a/app/src/main/res/layout/queue_fragment.xml +++ b/app/src/main/res/layout/queue_fragment.xml @@ -37,7 +37,6 @@ android:layout_width="match_parent" android:layout_height="match_parent" android:paddingHorizontal="@dimen/additional_horizontal_spacing" - android:clipToPadding="false" android:layout_below="@id/divider" /> <ProgressBar diff --git a/app/src/main/res/layout/search_fragment.xml b/app/src/main/res/layout/search_fragment.xml index 9df4fb6c9..0bc663db1 100644 --- a/app/src/main/res/layout/search_fragment.xml +++ b/app/src/main/res/layout/search_fragment.xml @@ -37,7 +37,6 @@ android:layout_marginTop="-4dp" android:paddingTop="12dp" android:paddingHorizontal="@dimen/additional_horizontal_spacing" - android:clipToPadding="false" android:layout_width="match_parent" android:layout_height="match_parent"/> </RelativeLayout> diff --git a/app/src/main/res/layout/simple_list_fragment.xml b/app/src/main/res/layout/simple_list_fragment.xml index 48ff3bd6d..989566499 100644 --- a/app/src/main/res/layout/simple_list_fragment.xml +++ b/app/src/main/res/layout/simple_list_fragment.xml @@ -16,8 +16,7 @@ android:layout_height="match_parent" android:paddingHorizontal="@dimen/additional_horizontal_spacing" android:layout_below="@id/toolbar" - android:id="@+id/recyclerView" - android:clipToPadding="false"/> + android:id="@+id/recyclerView"/> <ProgressBar android:id="@+id/progLoading" |