Alignment for more menu

This commit is contained in:
Kelvin K
2025-11-26 10:12:52 -06:00
parent 992cbcb3a0
commit 8be7ad9f68
2 changed files with 20 additions and 8 deletions
@@ -102,6 +102,8 @@ class MenuBottomBarFragment : MainActivityFragment() {
private var currentButtonDefinitions: List<ButtonDefinition>? = null; private var currentButtonDefinitions: List<ButtonDefinition>? = null;
private var moreColumns = 3;
constructor(fragment: MenuBottomBarFragment, inflater: LayoutInflater) : super(inflater.context) { constructor(fragment: MenuBottomBarFragment, inflater: LayoutInflater) : super(inflater.context) {
_fragment = fragment; _fragment = fragment;
_inflater = inflater; _inflater = inflater;
@@ -170,6 +172,7 @@ class MenuBottomBarFragment : MainActivityFragment() {
setMoreVisible(false); setMoreVisible(false);
} }
}) })
moreColumns = columns;
val layoutManager = GridLayoutManager(context, columns, GridLayoutManager.VERTICAL, true); val layoutManager = GridLayoutManager(context, columns, GridLayoutManager.VERTICAL, true);
_layoutMoreButtons.layoutManager = layoutManager; _layoutMoreButtons.layoutManager = layoutManager;
@@ -321,29 +324,37 @@ class MenuBottomBarFragment : MainActivityFragment() {
_layoutMoreButtons.removeAllViews(); _layoutMoreButtons.removeAllViews();
var insertedButtons = 0; var insertedButtons = 0;
//Force settings to be first
val settingsIndex = buttons.indexOfFirst { b -> b.id == 7 };
if (settingsIndex != -1) {
val button = buttons[settingsIndex]
buttons.removeAt(settingsIndex)
buttons.add(0, button)
//insertedButtons++;
}
//Force buy to be on top for more buttons //Force buy to be on top for more buttons
val buyIndex = buttons.indexOfFirst { b -> b.id == 98 }; val buyIndex = buttons.indexOfFirst { b -> b.id == 98 };
if (buyIndex != -1) { if (buyIndex != -1) {
val button = buttons[buyIndex] val button = buttons[buyIndex]
buttons.removeAt(buyIndex) buttons.removeAt(buyIndex)
buttons.add(0, button) buttons.add(button)
insertedButtons++; //insertedButtons++;
} }
//Force faq to be second //Force faq to be second
val faqIndex = buttons.indexOfFirst { b -> b.id == 97 }; val faqIndex = buttons.indexOfFirst { b -> b.id == 97 };
if (faqIndex != -1) { if (faqIndex != -1) {
val button = buttons[faqIndex] val button = buttons[faqIndex]
buttons.removeAt(faqIndex) buttons.removeAt(faqIndex)
buttons.add(if (insertedButtons == 1) 1 else 0, button) buttons.add(button)
insertedButtons++; //insertedButtons++;
} }
//Force privacy to be third //Force privacy to be third
val privacyIndex = buttons.indexOfFirst { b -> b.id == 96 }; val privacyIndex = buttons.indexOfFirst { b -> b.id == 96 };
if (privacyIndex != -1) { if (privacyIndex != -1) {
val button = buttons[privacyIndex] val button = buttons[privacyIndex]
buttons.removeAt(privacyIndex) buttons.removeAt(privacyIndex)
buttons.add(if (insertedButtons == 2) 2 else (if(insertedButtons == 1) 1 else 0), button) buttons.add(button)
insertedButtons++; //insertedButtons++;
} }
val newButtons = mutableListOf<MenuButtonItem>(); val newButtons = mutableListOf<MenuButtonItem>();
@@ -602,7 +613,7 @@ class MenuBottomBarFragment : MainActivityFragment() {
if (c is Activity) { if (c is Activity) {
c.overridePendingTransition(R.anim.slide_in_up, R.anim.slide_darken); c.overridePendingTransition(R.anim.slide_in_up, R.anim.slide_darken);
}*/ }*/
}), }),/*
ButtonDefinition(96, R.drawable.ic_disabled_visible, R.drawable.ic_disabled_visible, R.string.privacy_mode, canToggle = true, { false }, { ButtonDefinition(96, R.drawable.ic_disabled_visible, R.drawable.ic_disabled_visible, R.string.privacy_mode, canToggle = true, { false }, {
UIDialogs.showDialog(it.context ?: return@ButtonDefinition, R.drawable.ic_disabled_visible_purple, "Privacy Mode", UIDialogs.showDialog(it.context ?: return@ButtonDefinition, R.drawable.ic_disabled_visible_purple, "Privacy Mode",
"All requests will be processed anonymously (any logins will be disabled except for the personalized home page), local playback and history tracking will also be disabled.\n\nTap the icon to disable.", null, 0, "All requests will be processed anonymously (any logins will be disabled except for the personalized home page), local playback and history tracking will also be disabled.\n\nTap the icon to disable.", null, 0,
@@ -612,7 +623,7 @@ class MenuBottomBarFragment : MainActivityFragment() {
UIDialogs.Action("Enable", { UIDialogs.Action("Enable", {
StateApp.instance.setPrivacyMode(true); StateApp.instance.setPrivacyMode(true);
}, UIDialogs.ActionStyle.PRIMARY)); }, UIDialogs.ActionStyle.PRIMARY));
}), }),*/
ButtonDefinition(97, R.drawable.ic_quiz, R.drawable.ic_quiz_fill, R.string.faq, canToggle = true, { false }, { ButtonDefinition(97, R.drawable.ic_quiz, R.drawable.ic_quiz_fill, R.string.faq, canToggle = true, { false }, {
it.navigate<BrowserFragment>(Settings.URL_FAQ, withHistory = false); it.navigate<BrowserFragment>(Settings.URL_FAQ, withHistory = false);
}) })
@@ -109,6 +109,7 @@
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent" app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent" app:layout_constraintRight_toRightOf="parent"
android:layoutDirection="rtl"
android:gravity="end"> android:gravity="end">
</androidx.recyclerview.widget.RecyclerView> </androidx.recyclerview.widget.RecyclerView>