add hide notification delete button

This commit is contained in:
Len Chan 2019-03-19 09:04:09 +08:00
parent 29fd46fe94
commit 349cd9be31
5 changed files with 33 additions and 2 deletions

View File

@ -96,6 +96,7 @@ public class PeertubeAdapter extends RecyclerView.Adapter implements OnListActio
peertube.setInstance(Helper.getLiveInstance(context));
SharedPreferences sharedpreferences = context.getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
int theme = sharedpreferences.getInt(Helper.SET_THEME, Helper.THEME_DARK);
boolean hide_notification_delete = sharedpreferences.getBoolean(Helper.SET_HIDE_DELETE_BUTTON_ON_TAB, false);
if( theme == Helper.THEME_LIGHT){
holder.main_container.setBackgroundResource(R.color.mastodonC3__);
}else if (theme == Helper.THEME_DARK){
@ -103,7 +104,8 @@ public class PeertubeAdapter extends RecyclerView.Adapter implements OnListActio
}else if (theme == Helper.THEME_BLACK){
holder.main_container.setBackgroundResource(R.color.black);
}
if(hide_notification_delete)
holder.notification_delete.setVisibility(View.GONE);
Account account = peertube.getAccount();
holder.peertube_account_name.setText(account.getAcct());
@ -207,7 +209,7 @@ public class PeertubeAdapter extends RecyclerView.Adapter implements OnListActio
class ViewHolder extends RecyclerView.ViewHolder{
LinearLayout main_container;
ImageView peertube_profile, peertube_video_image;
ImageView peertube_profile, peertube_video_image, notification_delete;
TextView peertube_account_name, peertube_views, peertube_duration;
TextView peertube_title, peertube_date, header_title;
@ -222,6 +224,7 @@ public class PeertubeAdapter extends RecyclerView.Adapter implements OnListActio
peertube_duration = itemView.findViewById(R.id.peertube_duration);
main_container = itemView.findViewById(R.id.main_container);
header_title = itemView.findViewById(R.id.header_title);
notification_delete = itemView.findViewById(R.id.notification_delete);
}
}

View File

@ -607,6 +607,24 @@ public class SettingsFragment extends Fragment {
}
});
boolean hide_delete_notification_on_tab = sharedpreferences.getBoolean(Helper.SET_HIDE_DELETE_BUTTON_ON_TAB, false);
final CheckBox set_hide_delete_notification_on_tab = rootView.findViewById(R.id.set_hide_delete_notification_on_tab);
set_old_direct_timeline.setChecked(hide_delete_notification_on_tab);
set_old_direct_timeline.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
SharedPreferences.Editor editor = sharedpreferences.edit();
editor.putBoolean(Helper.SET_HIDE_DELETE_BUTTON_ON_TAB, set_hide_delete_notification_on_tab.isChecked());
editor.apply();
if( getActivity() != null)
getActivity().recreate();
Intent intent = new Intent(context, MainActivity.class);
if(getActivity() != null)
getActivity().finish();
startActivity(intent);
}
});
int truncate_toots_size = sharedpreferences.getInt(Helper.SET_TRUNCATE_TOOTS_SIZE, 0);
SeekBar set_truncate_size = rootView.findViewById(R.id.set_truncate_size);
set_truncate_size.setMax(20);

View File

@ -307,6 +307,7 @@ public class Helper {
public static final String SET_DISPLAY_CONTENT_AFTER_FM = "set_display_content_after_fm";
public static final String SET_FEATURED_TAGS ="set_featured_tags";
public static final String SET_FEATURED_TAG_ACTION ="set_featured_tag_action";
public static final String SET_HIDE_DELETE_BUTTON_ON_TAB = "set_hide_delete_notification_on_tab";
public static final int S_NO = 0;
static final int S_512KO = 1;
public static final int S_1MO = 2;

View File

@ -139,6 +139,14 @@
android:text="@string/set_old_direct_timeline"
android:layout_height="wrap_content" />
<CheckBox
android:id="@+id/set_hide_delete_notification_on_tab"
android:layout_width="wrap_content"
android:layout_marginTop="@dimen/settings_checkbox_margin"
android:layout_marginBottom="@dimen/settings_checkbox_margin"
android:text="@string/set_hide_delete_notification_on_tab"
android:layout_height="wrap_content" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"

View File

@ -901,6 +901,7 @@
<string name="featured_hashtags">Featured hashtags</string>
<string name="filter_timeline_with_a_tag">Filter timeline with tags</string>
<string name="no_tags">No tags</string>
<string name="set_hide_delete_notification_on_tab">Hide delete notifcation button on notification tab</string>
<!-- end languages -->