From 7e6e9d3dcdf98ab8b5a35342f3dce08a9a51b0eb Mon Sep 17 00:00:00 2001 From: sk Date: Thu, 29 Dec 2022 18:14:26 +0100 Subject: [PATCH] move translation availability closes sk22#213 --- .../android/fragments/SettingsFragment.java | 11 +++++------ 1 file changed, 5 insertions(+), 6 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 4ea669240..12f1d9c68 100644 --- a/mastodon/src/main/java/org/joinmastodon/android/fragments/SettingsFragment.java +++ b/mastodon/src/main/java/org/joinmastodon/android/fragments/SettingsFragment.java @@ -91,6 +91,7 @@ public class SettingsFragment extends MastodonToolbarFragment{ accountID=getArguments().getString("account"); AccountSession session=AccountSessionManager.getInstance().getAccount(accountID); Instance instance = AccountSessionManager.getInstance().getInstanceInfo(session.domain); + String instanceName = UiUtils.getInstanceName(accountID); if(GithubSelfUpdater.needSelfUpdating()){ GithubSelfUpdater updater=GithubSelfUpdater.getInstance(); @@ -194,6 +195,10 @@ public class SettingsFragment extends MastodonToolbarFragment{ GlobalUserPreferences.save(); needAppRestart=true; })); + boolean translationAvailable = instance.v2 != null && instance.v2.configuration.translation != null && instance.v2.configuration.translation.enabled; + items.add(new SmallTextItem(getString(translationAvailable ? + R.string.sk_settings_translation_availability_note_available : + R.string.sk_settings_translation_availability_note_unavailable, instanceName))); 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->{ @@ -224,17 +229,11 @@ public class SettingsFragment extends MastodonToolbarFragment{ items.add(new TextItem(R.string.sk_settings_filters, ()->UiUtils.launchWebBrowser(getActivity(), "https://"+session.domain+"/filters"), R.drawable.ic_fluent_open_24_regular)); items.add(new TextItem(R.string.sk_settings_auth, ()->UiUtils.launchWebBrowser(getActivity(), "https://"+session.domain+"/auth/edit"), R.drawable.ic_fluent_open_24_regular)); - String instanceName = UiUtils.getInstanceName(accountID); items.add(new HeaderItem(instanceName)); items.add(new TextItem(R.string.sk_settings_rules, ()->UiUtils.launchWebBrowser(getActivity(), "https://"+session.domain+"/about"), R.drawable.ic_fluent_open_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)); - boolean translationAvailable = instance.v2 != null && instance.v2.configuration.translation != null && instance.v2.configuration.translation.enabled; - items.add(new SmallTextItem(getString(translationAvailable ? - R.string.sk_settings_translation_availability_note_available : - R.string.sk_settings_translation_availability_note_unavailable, instanceName))); - 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));