From 1a6ad6c029792e22c2cd2773b0291ae00864e12c Mon Sep 17 00:00:00 2001 From: sk Date: Wed, 25 Jan 2023 11:52:41 -0300 Subject: [PATCH] re-arrange settings --- .../android/fragments/SettingsFragment.java | 16 ++++++++-------- mastodon/src/main/res/values/strings_sk.xml | 6 ++++-- 2 files changed, 12 insertions(+), 10 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 996672126..44dc1031f 100644 --- a/mastodon/src/main/java/org/joinmastodon/android/fragments/SettingsFragment.java +++ b/mastodon/src/main/java/org/joinmastodon/android/fragments/SettingsFragment.java @@ -278,7 +278,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)); @@ -289,6 +288,7 @@ public class SettingsFragment extends MastodonToolbarFragment{ 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) { @@ -298,9 +298,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); @@ -310,7 +312,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))); boolean translationAvailable = instance.v2 != null && instance.v2.configuration.translation != null && instance.v2.configuration.translation.enabled; @@ -1028,21 +1030,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); - TypedValue val = new TypedValue(); - getContext().getTheme().resolveAttribute(android.R.attr.textColorSecondary, val, true); - text.setTextColor(getResources().getColor(val.resourceId, getContext().getTheme())); - 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