From ca6025f14be518b652df271adfa7cbfc37e8451d Mon Sep 17 00:00:00 2001 From: Thomas Date: Mon, 12 Sep 2022 16:08:57 +0200 Subject: [PATCH] some changes --- .../android/activities/ReorderTimelinesActivity.java | 3 ++- .../fedilab/android/helper/PinnedTimelineHelper.java | 11 ++++++++++- app/src/main/res/layout/activity_main.xml | 2 +- 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/app/fedilab/android/activities/ReorderTimelinesActivity.java b/app/src/main/java/app/fedilab/android/activities/ReorderTimelinesActivity.java index e49a04920..7a2dedbd7 100644 --- a/app/src/main/java/app/fedilab/android/activities/ReorderTimelinesActivity.java +++ b/app/src/main/java/app/fedilab/android/activities/ReorderTimelinesActivity.java @@ -116,8 +116,9 @@ public class ReorderTimelinesActivity extends BaseActivity implements OnStartDra SharedPreferences sharedpreferences = PreferenceManager.getDefaultSharedPreferences(ReorderTimelinesActivity.this); boolean singleBar = sharedpreferences.getBoolean(getString(R.string.SET_USE_SINGLE_TOPBAR), false); if (singleBar) { - binding.titleTop.setVisibility(View.GONE); + binding.titleBottom.setVisibility(View.GONE); binding.lvReorderBottom.setVisibility(View.GONE); + binding.titleTop.setVisibility(View.GONE); } changes = false; bottomChanges = false; diff --git a/app/src/main/java/app/fedilab/android/helper/PinnedTimelineHelper.java b/app/src/main/java/app/fedilab/android/helper/PinnedTimelineHelper.java index 26108ada0..fe8110524 100644 --- a/app/src/main/java/app/fedilab/android/helper/PinnedTimelineHelper.java +++ b/app/src/main/java/app/fedilab/android/helper/PinnedTimelineHelper.java @@ -25,6 +25,7 @@ import android.content.SharedPreferences; import android.os.Bundle; import android.text.Editable; import android.text.TextWatcher; +import android.util.TypedValue; import android.view.ContextThemeWrapper; import android.view.LayoutInflater; import android.view.Menu; @@ -98,13 +99,21 @@ public class PinnedTimelineHelper { } SharedPreferences sharedpreferences = PreferenceManager.getDefaultSharedPreferences(activity); boolean singleBar = sharedpreferences.getBoolean(activity.getString(R.string.SET_USE_SINGLE_TOPBAR), false); + + ViewGroup.MarginLayoutParams params = (ViewGroup.MarginLayoutParams) activityMainBinding.viewPager.getLayoutParams(); //Hiding/Showing bottom menu depending of settings if (singleBar) { activityMainBinding.bottomNavView.setVisibility(View.GONE); + params.setMargins(0, 0, 0, 0); } else { + TypedValue tv = new TypedValue(); activityMainBinding.bottomNavView.setVisibility(View.VISIBLE); + if (activity.getTheme().resolveAttribute(R.attr.actionBarSize, tv, true)) { + int actionBarHeight = TypedValue.complexToDimensionPixelSize(tv.data, activity.getResources().getDisplayMetrics()); + params.setMargins(0, 0, 0, actionBarHeight); + } } - + activityMainBinding.viewPager.setLayoutParams(params); List pinnedTimelines = pinned.pinnedTimelines; if (!singleBar) { diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml index 8fd088542..e80725809 100644 --- a/app/src/main/res/layout/activity_main.xml +++ b/app/src/main/res/layout/activity_main.xml @@ -121,7 +121,7 @@ android:layout_height="wrap_content" android:layout_alignParentStart="true" android:layout_gravity="bottom" - android:layout_marginBottom="?actionBarSize"> + android:layout_marginBottom="?actionBarSize" />