add option to toggle bot icon

This commit is contained in:
Kasun 2019-05-24 22:47:44 +05:30
parent d80fc504e0
commit 0d4989ecbf
6 changed files with 52 additions and 14 deletions

View File

@ -538,19 +538,6 @@ public class StatusListAdapter extends RecyclerView.Adapter implements OnPostAct
}
status.setItemViewType(viewHolder.getItemViewType());
if( status.getReblog() == null){
if( status.getAccount().isBot()){
holder.status_account_bot.setVisibility(View.VISIBLE);
}else {
holder.status_account_bot.setVisibility(View.GONE);
}
}else{
if( status.getReblog().getAccount().isBot()){
holder.status_account_bot.setVisibility(View.VISIBLE);
}else {
holder.status_account_bot.setVisibility(View.GONE);
}
}
boolean displayBookmarkButton = sharedpreferences.getBoolean(Helper.SET_SHOW_BOOKMARK, false);
boolean fullAttachement = sharedpreferences.getBoolean(Helper.SET_FULL_PREVIEW, false);
@ -573,8 +560,26 @@ 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 new_badge = sharedpreferences.getBoolean(Helper.SET_DISPLAY_NEW_BADGE, true);
boolean bot_icon = sharedpreferences.getBoolean(Helper.SET_DISPLAY_BOT_ICON, true);
int translator = sharedpreferences.getInt(Helper.SET_TRANSLATOR, Helper.TRANS_YANDEX);
int behaviorWithAttachments = sharedpreferences.getInt(Helper.SET_ATTACHMENT_ACTION, Helper.ATTACHMENT_ALWAYS);
if (status.getReblog() == null) {
if (bot_icon && status.getAccount().isBot()) {
holder.status_account_bot.setVisibility(View.VISIBLE);
} else {
holder.status_account_bot.setVisibility(View.GONE);
}
} else {
if (bot_icon && status.getReblog().getAccount().isBot()) {
holder.status_account_bot.setVisibility(View.VISIBLE);
} else {
holder.status_account_bot.setVisibility(View.GONE);
}
}
if (type != RetrieveFeedsAsyncTask.Type.REMOTE_INSTANCE && !isCompactMode && !isConsoleMode && displayBookmarkButton)
holder.status_bookmark.setVisibility(View.VISIBLE);
else
@ -781,7 +786,7 @@ public class StatusListAdapter extends RecyclerView.Adapter implements OnPostAct
});
}
boolean new_badge = sharedpreferences.getBoolean(Helper.SET_DISPLAY_NEW_BADGE, true);
if (status.isNew() && new_badge)
holder.new_element.setVisibility(View.VISIBLE);
else

View File

@ -591,6 +591,19 @@ public class SettingsFragment extends Fragment {
}
});
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);
set_bot_icon.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
SharedPreferences.Editor editor = sharedpreferences.edit();
editor.putBoolean(Helper.SET_DISPLAY_BOT_ICON, set_bot_icon.isChecked());
editor.apply();
}
});
boolean fit_preview = sharedpreferences.getBoolean(Helper.SET_FULL_PREVIEW, false);
final CheckBox set_fit_preview = rootView.findViewById(R.id.set_fit_preview);
set_fit_preview.setChecked(fit_preview);

View File

@ -385,6 +385,7 @@ public class Helper {
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_DISPLAY_NEW_BADGE = "set_display_new_badge";
public static final String SET_DISPLAY_BOT_ICON = "set_display_bot_icon";
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

@ -251,6 +251,15 @@
android:text="@string/set_display_bookmark_button"
android:layout_height="wrap_content" />
<!-- DISPLAY BOT ICON -->
<CheckBox
android:id="@+id/set_display_bot_icon"
android:layout_width="wrap_content"
android:layout_marginTop="@dimen/settings_checkbox_margin"
android:layout_marginBottom="@dimen/settings_checkbox_margin"
android:text="@string/set_display_bot_icon"
android:layout_height="wrap_content" />
<!-- FIT PREVIEWS -->
<CheckBox
android:id="@+id/set_fit_preview"

View File

@ -257,6 +257,15 @@
android:text="@string/set_display_bookmark_button"
android:layout_height="wrap_content" />
<!-- DISPLAY BOT ICON -->
<CheckBox
android:id="@+id/set_display_bot_icon"
android:layout_width="wrap_content"
android:layout_marginTop="@dimen/settings_checkbox_margin"
android:layout_marginBottom="@dimen/settings_checkbox_margin"
android:text="@string/set_display_bot_icon"
android:layout_height="wrap_content" />
<!-- FIT PREVIEWS -->
<CheckBox
android:id="@+id/set_fit_preview"

View File

@ -946,6 +946,7 @@
<string name="set_blur_sensitive">Blur sensitive media</string>
<string name="set_display_timeline_in_list">Display timelines in a list</string>
<string name="display_timeline">Display timelines</string>
<string name="set_display_bot_icon">Mark bot accounts in toots</string>
<plurals name="number_of_vote">
<item quantity="one">%d vote</item>