add option to hide fedilab features button

This commit is contained in:
Kasun 2019-06-24 22:20:46 +05:30
parent 4f745231a8
commit aba39b3004
7 changed files with 57 additions and 3 deletions

View File

@ -584,6 +584,8 @@ public class StatusListAdapter extends RecyclerView.Adapter implements OnPostAct
boolean isModerator = sharedpreferences.getBoolean(Helper.PREF_IS_MODERATOR, false);
boolean isAdmin = sharedpreferences.getBoolean(Helper.PREF_IS_ADMINISTRATOR, false);
boolean fedilab_features_button = sharedpreferences.getBoolean(Helper.SET_DISPLAY_FEDILAB_FEATURES_BUTTON, true);
boolean new_badge = sharedpreferences.getBoolean(Helper.SET_DISPLAY_NEW_BADGE, true);
boolean bot_icon = sharedpreferences.getBoolean(Helper.SET_DISPLAY_BOT_ICON, true);
@ -988,7 +990,7 @@ public class StatusListAdapter extends RecyclerView.Adapter implements OnPostAct
});
}
if( holder.cached_status != null) {
if( holder.cached_status != null && (holder.getItemViewType() == DISPLAYED_STATUS && !fedilab_features_button)) {
if (status.iscached()) {
holder.cached_status.setVisibility(View.VISIBLE);
} else {
@ -1002,7 +1004,10 @@ public class StatusListAdapter extends RecyclerView.Adapter implements OnPostAct
});
}
if( holder.fedilab_features != null) {
if (holder.fedilab_features != null && !fedilab_features_button)
holder.fedilab_features.setVisibility(View.GONE);
if (holder.fedilab_features != null && fedilab_features_button) {
TooltipCompat.setTooltipText(holder.fedilab_features, context.getString(R.string.app_features));
holder.fedilab_features.setOnClickListener(new View.OnClickListener() {
@Override
@ -2355,7 +2360,7 @@ public class StatusListAdapter extends RecyclerView.Adapter implements OnPostAct
popup.getMenu().findItem(R.id.action_block_domain).setVisible(false);
popup.getMenu().findItem(R.id.action_mute_conversation).setVisible(false);
}
if( holder.getItemViewType() == DISPLAYED_STATUS){
if (holder.getItemViewType() == DISPLAYED_STATUS && fedilab_features_button) {
popup.getMenu().findItem(R.id.action_translate).setVisible(false);
popup.getMenu().findItem(R.id.action_bookmark).setVisible(false);
popup.getMenu().findItem(R.id.action_timed_mute).setVisible(false);

View File

@ -673,6 +673,19 @@ public class SettingsFragment extends Fragment {
}
});
boolean fedilab_features_button = sharedpreferences.getBoolean(Helper.SET_DISPLAY_FEDILAB_FEATURES_BUTTON, true);
final CheckBox set_fedilab_features_button = rootView.findViewById(R.id.set_display_fedilab_features_button);
set_fedilab_features_button.setChecked(fedilab_features_button);
set_fedilab_features_button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
SharedPreferences.Editor editor = sharedpreferences.edit();
editor.putBoolean(Helper.SET_DISPLAY_FEDILAB_FEATURES_BUTTON, set_fedilab_features_button.isChecked());
editor.apply();
}
});
boolean bot_icon = sharedpreferences.getBoolean(Helper.SET_DISPLAY_BOT_ICON, true);
final CheckBox set_bot_icon = rootView.findViewById(R.id.set_display_bot_icon);
set_bot_icon.setChecked(bot_icon);

View File

@ -351,6 +351,7 @@ public class Helper {
public static final String SET_REMEMBER_POSITION_HOME = "set_remember_position";
public static final String SET_DISPLAY_ADMIN_MENU = "set_display_admin_menu";
public static final String SET_DISPLAY_ADMIN_STATUSES = "set_display_admin_statuses";
public static final String SET_DISPLAY_FEDILAB_FEATURES_BUTTON = "set_display_fedilab_features_button";
public static final int S_NO = 0;
static final int S_512KO = 1;

View File

@ -306,6 +306,15 @@
android:text="@string/set_display_new_badge"
android:layout_height="wrap_content" />
<!-- DISPLAY FEDILAB FEATURES BUTTON -->
<CheckBox
android:id="@+id/set_display_fedilab_features_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/settings_checkbox_margin"
android:layout_marginBottom="@dimen/settings_checkbox_margin"
android:text="@string/set_display_fedilab_features_button" />
<!-- DISPLAY BOOKMARK BUTTON -->
<CheckBox
android:id="@+id/set_display_bookmarks"

View File

@ -207,6 +207,22 @@
app:layout_constraintTop_toBottomOf="@id/status_pp_section"
app:layout_constraintVertical_bias="0" />
<ImageView
android:id="@+id/cached_status"
android:layout_width="35dp"
android:layout_height="35dp"
android:layout_marginTop="5dp"
android:layout_marginBottom="5dp"
android:contentDescription="@string/cached_status"
android:padding="5dp"
android:src="@drawable/ic_cached_black"
android:visibility="gone"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="@id/status_pp_section"
app:layout_constraintStart_toStartOf="@id/status_pp_section"
app:layout_constraintTop_toBottomOf="@id/status_pp_section"
app:layout_constraintVertical_bias="0" />
<!-- Remove status button (Pleroma admin only) -->
<ImageView
android:id="@+id/status_remove"

View File

@ -317,6 +317,15 @@
android:text="@string/set_display_new_badge"
android:layout_height="wrap_content" />
<!-- DISPLAY FEDILAB FEATURES BUTTON -->
<CheckBox
android:id="@+id/set_display_fedilab_features_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/settings_checkbox_margin"
android:layout_marginBottom="@dimen/settings_checkbox_margin"
android:text="@string/set_display_fedilab_features_button" />
<!-- DISPLAY BOOKMARK BUTTON -->
<CheckBox
android:id="@+id/set_display_bookmarks"

View File

@ -1080,6 +1080,7 @@
<string name="mark_resolved">Mark as resolved</string>
<string name="mark_unresolved">Mark as unresolved</string>
<string name="toast_empty_content">Empty content!</string>
<string name="set_display_fedilab_features_button">Display Fedilab features button</string>
<plurals name="number_of_vote">
<item quantity="one">%d vote</item>
<item quantity="other">%d votes</item>