From 5f48870a90ed03997c4cf37bf03bd65093448252 Mon Sep 17 00:00:00 2001 From: sk Date: Wed, 25 Jan 2023 15:52:41 +0100 Subject: [PATCH] re-arrange settings --- .../android/fragments/SettingsFragment.java | 16 ++++++++++------ mastodon/src/main/res/values/strings_sk.xml | 6 ++++-- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/mastodon/src/main/java/org/joinmastodon/android/fragments/SettingsFragment.java b/mastodon/src/main/java/org/joinmastodon/android/fragments/SettingsFragment.java index 0f1163fee..bcef22297 100644 --- a/mastodon/src/main/java/org/joinmastodon/android/fragments/SettingsFragment.java +++ b/mastodon/src/main/java/org/joinmastodon/android/fragments/SettingsFragment.java @@ -259,7 +259,6 @@ public class SettingsFragment extends MastodonToolbarFragment{ items.add(new TextItem(R.string.sk_settings_auth, ()->UiUtils.launchWebBrowser(getActivity(), "https://"+session.domain+"/auth/edit"), R.drawable.ic_fluent_open_24_regular)); items.add(new HeaderItem(instanceName)); - items.add(new TextItem(R.string.log_out, this::confirmLogOut, R.drawable.ic_fluent_sign_out_24_regular)); items.add(new TextItem(R.string.sk_settings_rules, ()->{ Bundle args=new Bundle(); args.putParcelable("instance", Parcels.wrap(instance)); @@ -268,6 +267,9 @@ public class SettingsFragment extends MastodonToolbarFragment{ items.add(new TextItem(R.string.sk_settings_about_instance , ()->UiUtils.launchWebBrowser(getActivity(), "https://"+session.domain+"/about"), R.drawable.ic_fluent_info_24_regular)); items.add(new TextItem(R.string.settings_tos, ()->UiUtils.launchWebBrowser(getActivity(), "https://"+session.domain+"/terms"), R.drawable.ic_fluent_open_24_regular)); items.add(new TextItem(R.string.settings_privacy_policy, ()->UiUtils.launchWebBrowser(getActivity(), "https://"+session.domain+"/terms"), R.drawable.ic_fluent_open_24_regular)); + items.add(new TextItem(R.string.log_out, this::confirmLogOut, R.drawable.ic_fluent_sign_out_24_regular)); + + items.add(new HeaderItem(R.string.sk_instance_features)); items.add(new SwitchItem(R.string.sk_settings_support_local_only, 0, GlobalUserPreferences.accountsWithLocalOnlySupport.contains(accountID), i->{ glitchModeItem.enabled = i.checked; if (i.checked) { @@ -277,9 +279,11 @@ public class SettingsFragment extends MastodonToolbarFragment{ GlobalUserPreferences.accountsWithLocalOnlySupport.remove(accountID); GlobalUserPreferences.accountsInGlitchMode.remove(accountID); } + glitchModeItem.checked = GlobalUserPreferences.accountsInGlitchMode.contains(accountID); if (list.findViewHolderForAdapterPosition(items.indexOf(glitchModeItem)) instanceof SwitchViewHolder svh) svh.rebind(); GlobalUserPreferences.save(); })); + items.add(new SmallTextItem(getString(R.string.sk_settings_local_only_explanation))); items.add(glitchModeItem = new SwitchItem(R.string.sk_settings_glitch_instance, 0, GlobalUserPreferences.accountsInGlitchMode.contains(accountID), i->{ if (i.checked) { GlobalUserPreferences.accountsInGlitchMode.add(accountID); @@ -289,7 +293,7 @@ public class SettingsFragment extends MastodonToolbarFragment{ GlobalUserPreferences.save(); })); glitchModeItem.enabled = GlobalUserPreferences.accountsWithLocalOnlySupport.contains(accountID); - items.add(new SmallTextItem(getString(R.string.sk_settings_local_only_explanation))); + items.add(new SmallTextItem(getString(R.string.sk_settings_glitch_mode_explanation))); items.add(new HeaderItem(R.string.sk_settings_about)); items.add(new TextItem(R.string.sk_settings_contribute, ()->UiUtils.launchWebBrowser(getActivity(), "https://github.com/sk22/megalodon"), R.drawable.ic_fluent_open_24_regular)); @@ -975,19 +979,19 @@ public class SettingsFragment extends MastodonToolbarFragment{ private class SmallTextViewHolder extends BindableViewHolder { private final TextView text; -; public SmallTextViewHolder(){ super(getActivity(), R.layout.item_settings_text, list); text = itemView.findViewById(R.id.text); + text.setTextColor(UiUtils.getThemeColor(getActivity(), android.R.attr.textColorSecondary)); + text.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT)); + text.setTextSize(TypedValue.COMPLEX_UNIT_SP, 14); + text.setPaddingRelative(text.getPaddingStart(), 0, text.getPaddingEnd(), text.getPaddingBottom()); } @Override public void onBind(SmallTextItem item){ text.setText(item.text); - text.setTextColor(UiUtils.getThemeColor(getActivity(), android.R.attr.textColorSecondary)); - text.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT)); - text.setTextSize(TypedValue.COMPLEX_UNIT_SP, 14); } } diff --git a/mastodon/src/main/res/values/strings_sk.xml b/mastodon/src/main/res/values/strings_sk.xml index a82bb1bf1..4c976158a 100644 --- a/mastodon/src/main/res/values/strings_sk.xml +++ b/mastodon/src/main/res/values/strings_sk.xml @@ -240,7 +240,9 @@ mentioned-only · Local-only + Instance features Server supports local-only posting - Use Glitch implementation 👁 - Your instance must support local-only posting for these options to work. + Your home instance must support local-only posting for this to work. Most modified versions of Mastodon do, but Mastodon doesn’t. + Glitch local-only mode + Enable this if your home instance runs on Glitch. Not needed for Hometown or Akkoma. \ No newline at end of file