add toggle for hiding translate button
This commit is contained in:
parent
ae385c139b
commit
e41386082c
|
@ -27,6 +27,7 @@ public class GlobalUserPreferences{
|
|||
public static boolean disableSwipe;
|
||||
public static boolean voteButtonForSingleChoice;
|
||||
public static boolean enableDeleteNotifications;
|
||||
public static boolean translateButtonOpenedOnly;
|
||||
public static String publishButtonText;
|
||||
public static ThemePreference theme;
|
||||
public static ColorPreference color;
|
||||
|
@ -58,6 +59,7 @@ public class GlobalUserPreferences{
|
|||
disableSwipe=prefs.getBoolean("disableSwipe", false);
|
||||
voteButtonForSingleChoice=prefs.getBoolean("voteButtonForSingleChoice", true);
|
||||
enableDeleteNotifications=prefs.getBoolean("enableDeleteNotifications", false);
|
||||
translateButtonOpenedOnly=prefs.getBoolean("translateButtonOpenedOnly", false);
|
||||
publishButtonText=prefs.getString("publishButtonText", "");
|
||||
theme=ThemePreference.values()[prefs.getInt("theme", 0)];
|
||||
recentLanguages=fromJson(prefs.getString("recentLanguages", "{}"), recentLanguagesType, new HashMap<>());
|
||||
|
@ -84,6 +86,7 @@ public class GlobalUserPreferences{
|
|||
.putBoolean("disableMarquee", disableMarquee)
|
||||
.putBoolean("disableSwipe", disableSwipe)
|
||||
.putBoolean("enableDeleteNotifications", enableDeleteNotifications)
|
||||
.putBoolean("translateButtonOpenedOnly", translateButtonOpenedOnly)
|
||||
.putString("publishButtonText", publishButtonText)
|
||||
.putInt("theme", theme.ordinal())
|
||||
.putString("color", color.name())
|
||||
|
|
|
@ -182,6 +182,11 @@ public class SettingsFragment extends MastodonToolbarFragment{
|
|||
GlobalUserPreferences.save();
|
||||
needAppRestart=true;
|
||||
}));
|
||||
items.add(new SwitchItem(R.string.sk_settings_hide_translate_in_timeline, R.drawable.ic_fluent_translate_24_regular, GlobalUserPreferences.translateButtonOpenedOnly, i->{
|
||||
GlobalUserPreferences.translateButtonOpenedOnly=i.checked;
|
||||
GlobalUserPreferences.save();
|
||||
needAppRestart=true;
|
||||
}));
|
||||
|
||||
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->{
|
||||
|
|
|
@ -12,6 +12,7 @@ import android.widget.LinearLayout;
|
|||
import android.widget.Button;
|
||||
import android.widget.TextView;
|
||||
|
||||
import org.joinmastodon.android.GlobalUserPreferences;
|
||||
import org.joinmastodon.android.R;
|
||||
import org.joinmastodon.android.api.requests.statuses.TranslateStatus;
|
||||
import org.joinmastodon.android.api.session.AccountSession;
|
||||
|
@ -145,7 +146,9 @@ public class TextStatusDisplayItem extends StatusDisplayItem{
|
|||
Instance instanceInfo = AccountSessionManager.getInstance().getInstanceInfo(item.session.domain);
|
||||
boolean translateEnabled = instanceInfo.v2 != null && instanceInfo.v2.configuration.translation != null && instanceInfo.v2.configuration.translation.enabled;
|
||||
|
||||
translateWrap.setVisibility(item.textSelectable && translateEnabled &&
|
||||
translateWrap.setVisibility(
|
||||
(!GlobalUserPreferences.translateButtonOpenedOnly || item.textSelectable) &&
|
||||
translateEnabled &&
|
||||
!item.status.visibility.isLessVisibleThan(StatusPrivacy.UNLISTED) &&
|
||||
item.status.language != null &&
|
||||
(item.session.preferences == null || !item.status.language.equalsIgnoreCase(item.session.preferences.postingDefaultLanguage))
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
<vector xmlns:android="http://schemas.android.com/apk/res/android" android:width="24dp" android:height="24dp" android:viewportWidth="24" android:viewportHeight="24">
|
||||
<path android:pathData="M16.961 5.987c0.13-0.394-0.082-0.818-0.475-0.949-0.393-0.13-0.818 0.083-0.948 0.476-0.148 0.445-0.304 1.04-0.42 1.512-0.736 0.026-1.446 0.018-2.067-0.024-0.413-0.028-0.771 0.284-0.8 0.697-0.027 0.413 0.285 0.771 0.698 0.8 0.563 0.038 1.19 0.05 1.844 0.037-0.144 0.765-0.241 1.449-0.3 2.064-1.215 0.642-2.061 1.504-2.539 2.412-0.613 1.166-0.66 2.556 0.206 3.443 0.571 0.584 1.408 0.64 2.129 0.485 0.405-0.087 0.825-0.248 1.24-0.474l0.018 0.046c0.145 0.389 0.577 0.586 0.965 0.44 0.388-0.144 0.585-0.576 0.44-0.964-0.056-0.152-0.114-0.291-0.17-0.424 1.023-0.936 1.915-2.308 2.285-4.047 0.638 0.312 1.07 0.836 1.278 1.4 0.227 0.613 0.213 1.312-0.097 1.952-0.308 0.636-0.933 1.265-2.015 1.681-0.387 0.149-0.58 0.583-0.431 0.97 0.149 0.386 0.582 0.579 0.969 0.43 1.387-0.533 2.33-1.402 2.827-2.427 0.494-1.02 0.518-2.143 0.154-3.127-0.414-1.116-1.3-2.01-2.505-2.424 0.002-0.073 0.003-0.147 0.003-0.222C19.25 9.336 18.914 9 18.5 9c-0.405 0-0.735 0.322-0.75 0.724-0.524-0.005-1.084 0.07-1.672 0.237 0.064-0.455 0.148-0.953 0.257-1.5 1.185-0.089 2.364-0.252 3.337-0.48 0.403-0.095 0.653-0.5 0.558-0.902-0.095-0.404-0.498-0.654-0.902-0.559-0.767 0.18-1.69 0.318-2.637 0.406 0.085-0.33 0.18-0.67 0.27-0.94zm-3.68 7.723c0.227-0.43 0.6-0.886 1.147-1.3 0.017 0.492 0.065 0.926 0.137 1.317 0.094 0.52 0.236 0.974 0.386 1.373-0.306 0.171-0.632 0.3-0.977 0.374-0.485 0.104-0.687-0.012-0.742-0.068-0.24-0.245-0.394-0.853 0.05-1.696zm4.315-2.487c-0.21 0.966-0.7 2.022-1.414 2.848-0.052-0.184-0.1-0.385-0.142-0.612-0.089-0.49-0.14-1.092-0.111-1.866 0.11-0.042 0.222-0.082 0.339-0.12 0.481-0.16 0.924-0.238 1.328-0.25zM7.96 6.53C5.72 5.878 3.958 6.681 3.385 6.997c-0.363 0.2-0.494 0.657-0.294 1.02C3.29 8.378 3.747 8.51 4.11 8.31c0.405-0.223 1.736-0.833 3.43-0.34 0.773 0.227 1.098 0.64 1.264 1.056 0.133 0.332 0.175 0.691 0.188 1.042-0.27-0.075-0.581-0.15-0.923-0.21-1.132-0.202-2.682-0.263-4.122 0.427-1.586 0.76-2.13 2.316-1.902 3.697 0.224 1.356 1.216 2.666 2.8 2.951 1.43 0.258 2.806-0.256 3.757-0.761 0.14-0.074 0.271-0.148 0.396-0.222v0.3c0 0.414 0.335 0.75 0.75 0.75 0.414 0 0.75-0.336 0.75-0.75v-5.79c0-0.454 0-1.236-0.3-1.99-0.331-0.829-1.005-1.578-2.236-1.94H7.96zm-0.153 4.804c0.483 0.086 0.898 0.206 1.19 0.305v2.506l-0.105 0.078C8.653 14.4 8.31 14.63 7.9 14.847c-0.84 0.447-1.85 0.779-2.788 0.61-0.845-0.152-1.445-0.866-1.586-1.72-0.138-0.83 0.179-1.673 1.07-2.1 1.037-0.496 2.226-0.478 3.212-0.303z" android:fillColor="@color/fluent_default_icon_tint"/>
|
||||
</vector>
|
|
@ -79,4 +79,5 @@
|
|||
<string name="sk_enable_delete_notifications">Enable deleting notifications</string>
|
||||
<string name="sk_settings_publish_button_text">Publish button text</string>
|
||||
<string name="sk_settings_publish_button_text_title">Customize Publish button text</string>
|
||||
<string name="sk_settings_hide_translate_in_timeline">Hide translate button in timeline</string>
|
||||
</resources>
|
||||
|
|
Loading…
Reference in New Issue