Its now optional!

This commit is contained in:
LucasGGamerM
2022-12-28 19:49:38 -03:00
parent fb54948f86
commit c1d98cad00
7 changed files with 30 additions and 7 deletions

View File

@@ -29,6 +29,7 @@ public class GlobalUserPreferences{
public static boolean disableDividers;
public static boolean voteButtonForSingleChoice;
public static boolean showDifferentiatedPushNoticationIcons;
public static boolean relocatePublishButton;
public static ThemePreference theme;
public static ColorPreference color;
@@ -59,6 +60,7 @@ public class GlobalUserPreferences{
disableMarquee=prefs.getBoolean("disableMarquee", false);
disableSwipe=prefs.getBoolean("disableSwipe", false);
disableDividers=prefs.getBoolean("disableDividers", true);
relocatePublishButton=prefs.getBoolean("relocatePublishButton", false);
voteButtonForSingleChoice=prefs.getBoolean("voteButtonForSingleChoice", true);
theme=ThemePreference.values()[prefs.getInt("theme", 0)];
recentLanguages=fromJson(prefs.getString("recentLanguages", "{}"), recentLanguagesType, new HashMap<>());
@@ -89,6 +91,7 @@ public class GlobalUserPreferences{
.putBoolean("disableMarquee", disableMarquee)
.putBoolean("disableSwipe", disableSwipe)
.putBoolean("disableDividers", disableDividers)
.putBoolean("relocatePublishButton", relocatePublishButton)
.putBoolean("showDifferentiatedPushNoticationIcons", showDifferentiatedPushNoticationIcons)
.putInt("theme", theme.ordinal())
.putString("color", color.name())

View File

@@ -299,9 +299,12 @@ public class ComposeFragment extends MastodonToolbarFragment implements OnBackPr
sensitiveItem=view.findViewById(R.id.sensitive_item);
replyText=view.findViewById(R.id.reply_text);
publishButton=view.findViewById(R.id.publish);
publishButton.setText(editingStatus==null || redraftStatus ? R.string.publish : R.string.save);
publishButton.setOnClickListener(this::onPublishClick);
if(GlobalUserPreferences.relocatePublishButton){
publishButton=view.findViewById(R.id.publish);
publishButton.setText(editingStatus==null || redraftStatus ? R.string.publish : R.string.save);
publishButton.setOnClickListener(this::onPublishClick);
publishButton.setVisibility(View.VISIBLE);
}
mediaBtn.setOnClickListener(v->openFilePicker());
pollBtn.setOnClickListener(v->togglePoll());
@@ -636,9 +639,11 @@ public class ComposeFragment extends MastodonToolbarFragment implements OnBackPr
@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater){
// publishButton=new Button(getActivity());
// publishButton.setText(editingStatus==null || redraftStatus ? R.string.publish : R.string.save);
// publishButton.setOnClickListener(this::onPublishClick);
if(!GlobalUserPreferences.relocatePublishButton){
publishButton=new Button(getActivity());
publishButton.setText(editingStatus==null || redraftStatus ? R.string.publish : R.string.save);
publishButton.setOnClickListener(this::onPublishClick);
}
LinearLayout wrap=new LinearLayout(getActivity());
wrap.setOrientation(LinearLayout.HORIZONTAL);
@@ -661,7 +666,10 @@ public class ComposeFragment extends MastodonToolbarFragment implements OnBackPr
langParams.setMarginEnd(V.dp(8));
wrap.addView(buildLanguageSelector(), langParams);
// wrap.addView(publishButton, new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT));
if(!GlobalUserPreferences.relocatePublishButton){
wrap.addView(publishButton, new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT));
}
wrap.setPadding(V.dp(16), V.dp(4), V.dp(16), V.dp(8));
wrap.setClipToPadding(false);
MenuItem item=menu.add(editingStatus==null ? R.string.publish : R.string.save);

View File

@@ -150,6 +150,10 @@ public class SettingsFragment extends MastodonToolbarFragment{
GlobalUserPreferences.save();
needAppRestart=true;
}));
items.add(new SwitchItem(R.string.sk_relocate_publish_button, R.drawable.ic_fluent_arrow_autofit_down_24_regular, GlobalUserPreferences.relocatePublishButton, i->{
GlobalUserPreferences.relocatePublishButton=i.checked;
GlobalUserPreferences.save();
}));
items.add(new HeaderItem(R.string.home_timeline));
items.add(new SwitchItem(R.string.sk_settings_show_replies, R.drawable.ic_fluent_chat_multiple_24_regular, GlobalUserPreferences.showReplies, i->{