Allow to hide the follow instance button

This commit is contained in:
stom79 2018-09-15 09:53:13 +02:00
parent 8c3bdaf043
commit 939d8c880c
6 changed files with 43 additions and 0 deletions

View File

@ -256,6 +256,10 @@ public abstract class BaseMainActivity extends BaseActivity
FloatingActionButton federatedTimelines = findViewById(R.id.federated_timeline);
boolean displayFollowInstance = sharedpreferences.getBoolean(Helper.SET_DISPLAY_FOLLOW_INSTANCE, true);
if( !displayFollowInstance)
federatedTimelines.setVisibility(View.GONE);
federatedTimelines.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
@ -1881,6 +1885,15 @@ public abstract class BaseMainActivity extends BaseActivity
}
public void refreshButton(){
SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, android.content.Context.MODE_PRIVATE);
FloatingActionButton federatedTimelines = findViewById(R.id.federated_timeline);
boolean displayFollowInstance = sharedpreferences.getBoolean(Helper.SET_DISPLAY_FOLLOW_INSTANCE, true);
if( !displayFollowInstance)
federatedTimelines.setVisibility(View.GONE);
else
federatedTimelines.setVisibility(View.VISIBLE);
}
public DisplayStatusFragment getHomeFragment(){
return homeFragment;
}

View File

@ -213,6 +213,21 @@ public class SettingsFragment extends Fragment {
}
});
boolean follow_instance = sharedpreferences.getBoolean(Helper.SET_DISPLAY_FOLLOW_INSTANCE, true);
final CheckBox set_follow_instance = rootView.findViewById(R.id.set_display_follow_instance);
set_follow_instance.setChecked(follow_instance);
set_follow_instance.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
SharedPreferences.Editor editor = sharedpreferences.edit();
editor.putBoolean(Helper.SET_DISPLAY_FOLLOW_INSTANCE, set_follow_instance.isChecked());
editor.apply();
((MainActivity) context).refreshButton();
}
});
boolean display_bookmark = sharedpreferences.getBoolean(Helper.SET_SHOW_BOOKMARK, true);
final CheckBox set_display_bookmark = rootView.findViewById(R.id.set_display_bookmarks);
set_display_bookmark.setChecked(display_bookmark);

View File

@ -299,6 +299,7 @@ public class Helper {
public static final String SET_NOTIF_SILENT = "set_notif_silent";
public static final String SET_EXPAND_CW = "set_expand_cw";
public static final String SET_EXPAND_MEDIA = "set_expand_media";
public static final String SET_DISPLAY_FOLLOW_INSTANCE = "set_display_follow_instance";
public static final String SET_EMBEDDED_BROWSER = "set_embedded_browser";
public static final String SET_CUSTOM_TABS = "set_custom_tabs";
public static final String SET_JAVASCRIPT = "set_javascript";

View File

@ -130,6 +130,13 @@
android:text="@string/set_compact_mode"
android:layout_height="wrap_content" />
<!-- HIDE FOLLOW INSTANCE BUTTON -->
<CheckBox
android:id="@+id/set_display_follow_instance"
android:layout_width="wrap_content"
android:text="@string/set_display_follow_instance"
android:layout_height="wrap_content" />
<!-- PUT THE WHOLE CONTENT WHEN SHARING -->
<CheckBox
android:id="@+id/set_share_details"

View File

@ -129,6 +129,12 @@
android:text="@string/set_compact_mode"
android:layout_height="wrap_content" />
<!-- HIDE FOLLOW INSTANCE BUTTON -->
<CheckBox
android:id="@+id/set_display_follow_instance"
android:layout_width="wrap_content"
android:text="@string/set_display_follow_instance"
android:layout_height="wrap_content" />
<!-- PUT THE WHOLE CONTENT WHEN SHARING -->
<CheckBox

View File

@ -602,6 +602,7 @@
<string name="toast_impossible_to_follow">Account(s) can\'t be followed</string>
<string name="retrieve_remote_account">Fetching remote account</string>
<string name="expand_image">Automatically expand hidden media</string>
<string name="set_display_follow_instance">Display follow instances button</string>
<string-array translatable="false" name="proxy_type_choice">