Add some contexts

This commit is contained in:
tom79 2019-07-03 11:39:10 +02:00
parent dba52b699c
commit a16929b116
10 changed files with 660 additions and 656 deletions

View File

@ -177,8 +177,6 @@ public class SettingsActivity extends BaseActivity implements ViewAnimator.ViewA
SlideMenuItem menuItemAdmin = new SlideMenuItem(ContentSettingsFragment.type.ADMIN, R.drawable.ic_security_admin_menu);
SlideMenuItem menuItemInterface = new SlideMenuItem(ContentSettingsFragment.type.INTERFACE, R.drawable.ic_tablet_menu);
SlideMenuItem menuItemEdit = new SlideMenuItem(ContentSettingsFragment.type.COMPOSE, R.drawable.ic_edit_black_menu);
SlideMenuItem menuItemHidden = new SlideMenuItem(ContentSettingsFragment.type.HIDDEN, R.drawable.ic_visibility_off_menu);
SlideMenuItem menuItem7 = new SlideMenuItem(ContentSettingsFragment.type.ALL, R.drawable.ic_all_inclusive_menu);
SlideMenuItem menuItemBattery = new SlideMenuItem(ContentSettingsFragment.type.BATTERY, R.drawable.ic_battery_alert_menu);
list.add(menuItemClose);
@ -190,8 +188,6 @@ public class SettingsActivity extends BaseActivity implements ViewAnimator.ViewA
if( MainActivity.social == UpdateAccountInfoAsyncTask.SOCIAL.MASTODON || MainActivity.social == UpdateAccountInfoAsyncTask.SOCIAL.PLEROMA){
list.add(menuItemAdmin);
}
list.add(menuItemHidden);
list.add(menuItem7);
}
@Override

View File

@ -446,18 +446,15 @@ public class ShowAccountActivity extends BaseActivity implements OnPostActionInt
}
});
mPager = findViewById(R.id.account_viewpager);
boolean optimize_loading = sharedpreferences.getBoolean(Helper.SET_OPTIMIZE_LOADING, false);
if( !peertubeAccount) {
tabLayout.addTab(tabLayout.newTab().setText(getString(R.string.toots)));
tabLayout.addTab(tabLayout.newTab().setText(getString(R.string.following)));
tabLayout.addTab(tabLayout.newTab().setText(getString(R.string.followers)));
if( !optimize_loading)
mPager.setOffscreenPageLimit(3);
mPager.setOffscreenPageLimit(3);
}else if( ! ischannel){
tabLayout.addTab(tabLayout.newTab().setText(getString(R.string.videos)));
tabLayout.addTab(tabLayout.newTab().setText(getString(R.string.channels)));
if( !optimize_loading)
mPager.setOffscreenPageLimit(2);
mPager.setOffscreenPageLimit(2);
}else{
tabLayout.addTab(tabLayout.newTab().setText(getString(R.string.videos)));
mPager.setOffscreenPageLimit(1);

View File

@ -580,8 +580,6 @@ public class StatusListAdapter extends RecyclerView.Adapter implements OnPostAct
ImageView status_pin;
ImageView status_remove;
ImageView status_privacy;
ImageView status_translate;
ImageView status_bookmark;
LinearLayout status_container2;
LinearLayout status_container3;
LinearLayout main_container;
@ -680,8 +678,7 @@ public class StatusListAdapter extends RecyclerView.Adapter implements OnPostAct
status_prev4_container = itemView.findViewById(R.id.status_prev4_container);
status_reply = itemView.findViewById(R.id.status_reply);
status_privacy = itemView.findViewById(R.id.status_privacy);
status_translate = itemView.findViewById(R.id.status_translate);
status_bookmark = itemView.findViewById(R.id.status_bookmark);
status_content_translated_container = itemView.findViewById(R.id.status_content_translated_container);
main_container = itemView.findViewById(R.id.main_container);
status_spoiler_container = itemView.findViewById(R.id.status_spoiler_container);
@ -821,7 +818,7 @@ public class StatusListAdapter extends RecyclerView.Adapter implements OnPostAct
status.setItemViewType(viewHolder.getItemViewType());
boolean displayBookmarkButton = sharedpreferences.getBoolean(Helper.SET_SHOW_BOOKMARK, false);
boolean fullAttachement = sharedpreferences.getBoolean(Helper.SET_FULL_PREVIEW, false);
boolean isCompactMode = sharedpreferences.getBoolean(Helper.SET_COMPACT_MODE, false);
boolean isConsoleMode = sharedpreferences.getBoolean(Helper.SET_CONSOLE_MODE, false);
@ -1274,30 +1271,6 @@ public class StatusListAdapter extends RecyclerView.Adapter implements OnPostAct
if( holder.status_bookmark != null) {
if (status.isBookmarked())
holder.status_bookmark.setImageDrawable(ContextCompat.getDrawable(context, R.drawable.ic_bookmark));
else
holder.status_bookmark.setImageDrawable(ContextCompat.getDrawable(context, R.drawable.ic_bookmark_border));
if (type != RetrieveFeedsAsyncTask.Type.REMOTE_INSTANCE && !isCompactMode && !isConsoleMode && displayBookmarkButton)
holder.status_bookmark.setVisibility(View.VISIBLE);
else
holder.status_bookmark.setVisibility(View.GONE);
holder.status_bookmark.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
bookmark(status);
}
});
holder.status_bookmark.setOnLongClickListener(new View.OnLongClickListener() {
@Override
public boolean onLongClick(View v) {
CrossActions.doCrossBookmark(context, status, statusListAdapter);
return false;
}
});
}
if( holder.cached_status != null && (holder.getItemViewType() == DISPLAYED_STATUS && !fedilab_features_button)) {
if (status.iscached()) {
@ -1561,38 +1534,6 @@ public class StatusListAdapter extends RecyclerView.Adapter implements OnPostAct
});
}
if( holder.status_translate != null) {
holder.status_translate.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
translateToot(status);
}
});
boolean differentLanguage;
if (status.getReblog() == null)
differentLanguage = status.getLanguage() != null && !status.getLanguage().trim().equals(currentLocale);
else
differentLanguage = status.getReblog().getLanguage() != null && !status.getReblog().getLanguage().trim().equals(currentLocale);
if ((getItemViewType(viewHolder.getAdapterPosition()) != COMPACT_STATUS) && getItemViewType(viewHolder.getAdapterPosition()) != CONSOLE_STATUS && (trans_forced || (translator != Helper.TRANS_NONE && currentLocale != null && differentLanguage))) {
if (status.getSpoiler_text() != null && status.getSpoiler_text().length() > 0) {
if (status.isSpoilerShown() || expand_cw || getItemViewType(viewHolder.getAdapterPosition()) == FOCUSED_STATUS) {
holder.status_translate.setVisibility(View.VISIBLE);
} else {
holder.status_translate.setVisibility(View.GONE);
}
} else if (status.getReblog() != null && status.getReblog().getSpoiler_text() != null && status.getReblog().getSpoiler_text().length() > 0) {
if (status.isSpoilerShown() || expand_cw || getItemViewType(viewHolder.getAdapterPosition()) == FOCUSED_STATUS) {
holder.status_translate.setVisibility(View.VISIBLE);
} else {
holder.status_translate.setVisibility(View.GONE);
}
} else {
holder.status_translate.setVisibility(View.VISIBLE);
}
} else {
holder.status_translate.setVisibility(View.GONE);
}
}
if( isConsoleMode){
String starting = "";

View File

@ -88,10 +88,8 @@ import mabbas007.tagsedittext.TagsEditText;
import static android.app.Activity.RESULT_OK;
import static android.content.Context.MODE_PRIVATE;
import static app.fedilab.android.fragments.ContentSettingsFragment.type.ADMIN;
import static app.fedilab.android.fragments.ContentSettingsFragment.type.ALL;
import static app.fedilab.android.fragments.ContentSettingsFragment.type.BATTERY;
import static app.fedilab.android.fragments.ContentSettingsFragment.type.COMPOSE;
import static app.fedilab.android.fragments.ContentSettingsFragment.type.HIDDEN;
import static app.fedilab.android.fragments.ContentSettingsFragment.type.INTERFACE;
import static app.fedilab.android.fragments.ContentSettingsFragment.type.NOTIFICATIONS;
import static app.fedilab.android.fragments.ContentSettingsFragment.type.TIMELINES;
@ -112,9 +110,7 @@ public class ContentSettingsFragment extends Fragment implements ScreenShotable
NOTIFICATIONS,
INTERFACE,
COMPOSE,
HIDDEN,
BATTERY,
ALL
}
private static final int ACTIVITY_CHOOSE_FILE = 411;
@ -232,8 +228,6 @@ public class ContentSettingsFragment extends Fragment implements ScreenShotable
LinearLayout settings_admin = rootView.findViewById(R.id.settings_admin);
LinearLayout settings_interface = rootView.findViewById(R.id.settings_interface);
LinearLayout settings_compose = rootView.findViewById(R.id.settings_compose);
LinearLayout settings_hidden = rootView.findViewById(R.id.settings_hidden);
LinearLayout settings_to_do = rootView.findViewById(R.id.settings_to_do);
LinearLayout settings_battery = rootView.findViewById(R.id.settings_battery);
if(type == null || type.equals(TIMELINES)){
@ -248,10 +242,6 @@ public class ContentSettingsFragment extends Fragment implements ScreenShotable
settings_battery.setVisibility(View.VISIBLE);
}else if(type == COMPOSE){
settings_compose.setVisibility(View.VISIBLE);
}else if( type == HIDDEN){
settings_hidden.setVisibility(View.VISIBLE);
}else if( type == ALL){
settings_to_do.setVisibility(View.VISIBLE);
}
@ -364,28 +354,6 @@ public class ContentSettingsFragment extends Fragment implements ScreenShotable
});
boolean optimize_loading = sharedpreferences.getBoolean(Helper.SET_OPTIMIZE_LOADING, false);
final CheckBox set_optimize_loading = rootView.findViewById(R.id.set_optimize_loading);
set_optimize_loading.setChecked(optimize_loading);
set_optimize_loading.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
SharedPreferences.Editor editor = sharedpreferences.edit();
editor.putBoolean(Helper.SET_OPTIMIZE_LOADING, set_optimize_loading.isChecked());
if( set_optimize_loading.isChecked()){
editor.putInt(Helper.SET_ACCOUNTS_PER_PAGE, 10);
editor.putInt(Helper.SET_TOOTS_PER_PAGE, 10);
editor.putInt(Helper.SET_NOTIFICATIONS_PER_PAGE, 10);
}else {
editor.putInt(Helper.SET_ACCOUNTS_PER_PAGE, 40);
editor.putInt(Helper.SET_TOOTS_PER_PAGE, 40);
editor.putInt(Helper.SET_NOTIFICATIONS_PER_PAGE, 15);
}
editor.apply();
}
});
int videoMode = sharedpreferences.getInt(Helper.SET_VIDEO_MODE, Helper.VIDEO_MODE_DIRECT);
@ -737,18 +705,6 @@ public class ContentSettingsFragment extends Fragment implements ScreenShotable
});
boolean display_bookmark = sharedpreferences.getBoolean(Helper.SET_SHOW_BOOKMARK, false);
final CheckBox set_display_bookmark = rootView.findViewById(R.id.set_display_bookmarks);
set_display_bookmark.setChecked(display_bookmark);
set_display_bookmark.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
SharedPreferences.Editor editor = sharedpreferences.edit();
editor.putBoolean(Helper.SET_SHOW_BOOKMARK, set_display_bookmark.isChecked());
editor.apply();
}
});
boolean new_badge = sharedpreferences.getBoolean(Helper.SET_DISPLAY_NEW_BADGE, true);
final CheckBox set_new_badge = rootView.findViewById(R.id.set_display_new_badge);

View File

@ -320,7 +320,6 @@ public class Helper {
public static final String SET_DISABLE_GIF = "set_disable_gif";
public static final String SET_CAPITALIZE = "set_capitalize";
public static final String SET_PICTURE_RESIZE = "set_picture_resize";
public static final String SET_SHOW_BOOKMARK = "set_show_bookmark";
public static final String SET_FORWARD_TAGS_IN_REPLY = "set_forward_tags_in_reply";
public static final String SET_FULL_PREVIEW = "set_full_preview";
public static final String SET_COMPACT_MODE = "set_compact_mode";
@ -422,7 +421,6 @@ public class Helper {
public static final String SET_AUTOMATICALLY_SPLIT_TOOTS_SIZE = "set_automatically_split_toots_size";
public static final String SET_TRUNCATE_TOOTS_SIZE = "set_truncate_toots_size";
public static final String SET_ART_WITH_NSFW = "set_art_with_nsfw";
public static final String SET_OPTIMIZE_LOADING = "set_optimize_loading";
public static final String SET_SECURITY_PROVIDER = "set_security_provider";
//End points
public static final String EP_AUTHORIZE = "/oauth/authorize";

View File

@ -264,34 +264,6 @@
android:layout_height="wrap_content"
style="?attr/borderless"
android:text="@string/display_toot_truncate" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
>
<ImageButton
android:id="@+id/status_translate"
android:gravity="center"
android:tint="@android:color/white"
style="?attr/borderless"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ic_translate"
android:layout_marginTop="10dp"
android:layout_gravity="center_horizontal"
/>
<ImageButton
android:id="@+id/status_bookmark"
android:gravity="center"
android:tint="@android:color/white"
style="?attr/borderless"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ic_bookmark_border"
android:layout_marginTop="10dp"
android:layout_gravity="center_horizontal"
/>
</LinearLayout>
<LinearLayout
android:id="@+id/status_content_translated_container"
android:visibility="gone"

View File

@ -261,34 +261,6 @@
android:layout_height="wrap_content"
style="?attr/borderless"
android:text="@string/display_toot_truncate" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
>
<ImageButton
android:id="@+id/status_translate"
android:gravity="center"
android:tint="@android:color/white"
style="?attr/borderless"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ic_translate"
android:layout_marginTop="10dp"
android:layout_gravity="center_horizontal"
/>
<ImageButton
android:id="@+id/status_bookmark"
android:gravity="center"
android:tint="@android:color/white"
style="?attr/borderless"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ic_bookmark_border"
android:layout_marginTop="10dp"
android:layout_gravity="center_horizontal"
/>
</LinearLayout>
<LinearLayout
android:id="@+id/status_content_translated_container"
android:visibility="gone"

View File

@ -194,35 +194,6 @@
android:layout_height="wrap_content"
style="?attr/borderless"
android:text="@string/display_toot_truncate" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
>
<ImageButton
android:layout_marginLeft="5dp"
android:layout_marginStart="5dp"
android:id="@+id/status_translate"
android:layout_gravity="center_horizontal"
android:layout_width="40dp"
android:layout_height="40dp"
android:src="@drawable/ic_translate"
style="@style/Base.Widget.AppCompat.Button.Colored"
/>
<ImageButton
android:layout_marginLeft="5dp"
android:layout_marginStart="5dp"
android:id="@+id/status_bookmark"
android:gravity="center"
android:layout_gravity="center_horizontal"
android:tint="@android:color/white"
style="@style/Base.Widget.AppCompat.Button.Colored"
android:layout_width="40dp"
android:layout_height="40dp"
android:src="@drawable/ic_bookmark_border"
android:layout_marginTop="5dp"
/>
</LinearLayout>
<LinearLayout
android:id="@+id/status_content_translated_container"
android:visibility="gone"

File diff suppressed because it is too large Load Diff

View File

@ -148,7 +148,6 @@
<item quantity="one">%d reply</item>
<item quantity="other">%d replies</item>
</plurals>
<string name="set_display_bookmark_button">Display the bookmark button</string>
<string name="bookmarks">Bookmarks</string>
<string name="bookmark_add">Add to bookmarks</string>
<string name="bookmark_remove">Remove bookmark</string>
@ -871,7 +870,6 @@
<string name="action_html">HTML</string>
<string name="action_markdown">Markdown</string>
<string name="action_logout_account">Logout account</string>
<string name="set_optimize_loading">Optimize loading time</string>
<string name="all">All</string>
<string name="about_opencollective">Support the app</string>
<string name="more_about_opencollective">Open Collective enables groups to quickly set up a collective, raise funds and manage them transparently.</string>
@ -1087,6 +1085,16 @@
<string name="live_notif_indication">Keep an open connection to the streaming API for live notifications.</string>
<string name="set_keep_background_process_indication">When the app is in background, it will keep a connection to the streaming API. Disable it if you care about your battery.</string>
<string name="set_enable_time_slot_indication">During the time slot, the app will send notifications. You can reverse (ie: silent) this time slot with the right spinner.</string>
<string name="set_display_fedilab_features_button_indication">Display a Fedilab button bellow profile picture. It is a shortcut for accessing in-app features.</string>
<string name="set_quick_reply_indication">Allow to reply directly in timelines bellow statuses</string>
<string name="set_fit_preview_indication">Previews will not be cropped in timelines</string>
<string name="set_display_video_preview_indication">Allow to play embedded videos directly in timelines</string>
<string name="set_display_content_after_fetch_more_indication">Allow to reverse the way to read statuses that are displayed once clicking the fetch more button</string>
<string name="set_security_provider_indication">This option allows to support recent cipher suites. It is useful for older Android devices or if you cannot connect to your instance.</string>
<string name="set_video_mode_indication">Exclusively for Peertube videos. Switch this mode if you cannot read them.</string>
<string name="featured_hashtags_indication">These tags will allow to filter statuses from profiles. You will have to use the context menu for seeing them.</string>
<string name="set_capitalize_indication">Automatically insert a line break after the mention to capitalize the first letter</string>
<string name="settings_title_custom_sharing_indication">Allow content creators to share statuses to their RSS feeds</string>
<plurals name="number_of_vote">
<item quantity="one">%d vote</item>