diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 3df00a36d..7915a1317 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -125,6 +125,7 @@ /> diff --git a/app/src/main/java/fr/gouv/etalab/mastodon/activities/MediaActivity.java b/app/src/main/java/fr/gouv/etalab/mastodon/activities/MediaActivity.java index b4af84f53..43c478eac 100644 --- a/app/src/main/java/fr/gouv/etalab/mastodon/activities/MediaActivity.java +++ b/app/src/main/java/fr/gouv/etalab/mastodon/activities/MediaActivity.java @@ -111,11 +111,6 @@ public class MediaActivity extends BaseActivity implements OnDownloadInterface { SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, android.content.Context.MODE_PRIVATE); int theme = sharedpreferences.getInt(Helper.SET_THEME, Helper.THEME_DARK); - if( theme == Helper.THEME_LIGHT){ - setTheme(R.style.AppTheme_NoActionBar); - }else { - setTheme(R.style.AppThemeDark_NoActionBar); - } setContentView(R.layout.activity_media); SwipeBackLayout mSwipeBackLayout = new SwipeBackLayout(this); diff --git a/app/src/main/java/fr/gouv/etalab/mastodon/drawers/NotificationsListAdapter.java b/app/src/main/java/fr/gouv/etalab/mastodon/drawers/NotificationsListAdapter.java index 34ffe58c0..8a9d36aed 100644 --- a/app/src/main/java/fr/gouv/etalab/mastodon/drawers/NotificationsListAdapter.java +++ b/app/src/main/java/fr/gouv/etalab/mastodon/drawers/NotificationsListAdapter.java @@ -127,6 +127,7 @@ public class NotificationsListAdapter extends RecyclerView.Adapter implements On String type = notification.getType(); String typeString = ""; int theme = sharedpreferences.getInt(Helper.SET_THEME, Helper.THEME_DARK); + boolean expand_cw = sharedpreferences.getBoolean(Helper.SET_EXPAND_CW, false); if (theme == THEME_DARK){ holder.main_container_trans.setAlpha(.3f); @@ -323,7 +324,7 @@ public class NotificationsListAdapter extends RecyclerView.Adapter implements On if( status.getReblog() == null) { if (status.getSpoiler_text() != null && status.getSpoiler_text().trim().length() > 0 ) { holder.status_spoiler_container.setVisibility(View.VISIBLE); - if( !status.isSpoilerShown()) { + if( !status.isSpoilerShown() && !expand_cw) { holder.notification_status_container.setVisibility(View.GONE); holder.status_spoiler_mention_container.setVisibility(View.VISIBLE); holder.status_spoiler_button.setText(context.getString(R.string.load_attachment_spoiler)); @@ -341,7 +342,7 @@ public class NotificationsListAdapter extends RecyclerView.Adapter implements On }else { if (status.getReblog().getSpoiler_text() != null && status.getReblog().getSpoiler_text().trim().length() > 0) { holder.status_spoiler_container.setVisibility(View.VISIBLE); - if( !status.isSpoilerShown()) { + if( !status.isSpoilerShown() && !expand_cw) { holder.notification_status_container.setVisibility(View.GONE); holder.status_spoiler_mention_container.setVisibility(View.VISIBLE); holder.status_spoiler_button.setText(context.getString(R.string.load_attachment_spoiler)); diff --git a/app/src/main/java/fr/gouv/etalab/mastodon/drawers/StatusListAdapter.java b/app/src/main/java/fr/gouv/etalab/mastodon/drawers/StatusListAdapter.java index 69bb193c9..ac65fe50c 100644 --- a/app/src/main/java/fr/gouv/etalab/mastodon/drawers/StatusListAdapter.java +++ b/app/src/main/java/fr/gouv/etalab/mastodon/drawers/StatusListAdapter.java @@ -499,6 +499,7 @@ public class StatusListAdapter extends RecyclerView.Adapter implements OnPostAct //Manages theme for icon colors int theme = sharedpreferences.getInt(Helper.SET_THEME, Helper.THEME_DARK); + boolean expand_cw = sharedpreferences.getBoolean(Helper.SET_EXPAND_CW, false); if( theme == Helper.THEME_DARK){ changeDrawableColor(context, R.drawable.ic_reply,R.color.dark_icon); changeDrawableColor(context, holder.status_more, R.color.dark_icon); @@ -699,7 +700,7 @@ public class StatusListAdapter extends RecyclerView.Adapter implements OnPostAct if( status.getReblog() == null) { if (status.getSpoiler_text() != null && status.getSpoiler_text().trim().length() > 0 ) { holder.status_spoiler_container.setVisibility(View.VISIBLE); - if( !status.isSpoilerShown()) { + if( !status.isSpoilerShown() && !expand_cw) { holder.status_content_container.setVisibility(View.GONE); holder.status_spoiler_mention_container.setVisibility(View.VISIBLE); holder.status_spoiler_button.setText(context.getString(R.string.load_attachment_spoiler)); @@ -716,7 +717,7 @@ public class StatusListAdapter extends RecyclerView.Adapter implements OnPostAct }else { if (status.getReblog().getSpoiler_text() != null && status.getReblog().getSpoiler_text().trim().length() > 0) { holder.status_spoiler_container.setVisibility(View.VISIBLE); - if( !status.isSpoilerShown()) { + if( !status.isSpoilerShown() && !expand_cw) { holder.status_content_container.setVisibility(View.GONE); holder.status_spoiler_mention_container.setVisibility(View.VISIBLE); holder.status_spoiler_button.setText(context.getString(R.string.load_attachment_spoiler)); diff --git a/app/src/main/java/fr/gouv/etalab/mastodon/fragments/SettingsFragment.java b/app/src/main/java/fr/gouv/etalab/mastodon/fragments/SettingsFragment.java index 688e3c903..b1d15bc35 100644 --- a/app/src/main/java/fr/gouv/etalab/mastodon/fragments/SettingsFragment.java +++ b/app/src/main/java/fr/gouv/etalab/mastodon/fragments/SettingsFragment.java @@ -185,6 +185,20 @@ public class SettingsFragment extends Fragment { }); + boolean expand_cw = sharedpreferences.getBoolean(Helper.SET_EXPAND_CW, false); + final CheckBox set_expand_cw = rootView.findViewById(R.id.set_expand_cw); + set_expand_cw.setChecked(expand_cw); + + set_expand_cw.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + SharedPreferences.Editor editor = sharedpreferences.edit(); + editor.putBoolean(Helper.SET_EXPAND_CW, set_expand_cw.isChecked()); + editor.apply(); + } + }); + + boolean multiaccount_actions = sharedpreferences.getBoolean(Helper.SET_ALLOW_CROSS_ACTIONS, true); final CheckBox set_multiaccount_actions = rootView.findViewById(R.id.set_multiaccount_actions); set_multiaccount_actions.setChecked(multiaccount_actions); diff --git a/app/src/main/java/fr/gouv/etalab/mastodon/helper/Helper.java b/app/src/main/java/fr/gouv/etalab/mastodon/helper/Helper.java index 66c33888a..3e243c96b 100644 --- a/app/src/main/java/fr/gouv/etalab/mastodon/helper/Helper.java +++ b/app/src/main/java/fr/gouv/etalab/mastodon/helper/Helper.java @@ -262,6 +262,7 @@ public class Helper { public static final String SET_NOTIF_HOMETIMELINE = "set_notif_hometimeline"; public static final String SET_NOTIF_SILENT = "set_notif_silent"; public static final String SET_SHOW_ERROR_MESSAGES = "set_show_error_messages"; + public static final String SET_EXPAND_CW = "set_expand_cw"; 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"; diff --git a/app/src/main/res/layout-sw600dp/fragment_settings.xml b/app/src/main/res/layout-sw600dp/fragment_settings.xml index a0a7b94d3..6abab8bbb 100644 --- a/app/src/main/res/layout-sw600dp/fragment_settings.xml +++ b/app/src/main/res/layout-sw600dp/fragment_settings.xml @@ -142,6 +142,13 @@ android:text="@string/show_boost_count" android:layout_height="wrap_content" /> + + + - - + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_settings.xml b/app/src/main/res/layout/fragment_settings.xml index 7e3df61a1..111b6c5b2 100644 --- a/app/src/main/res/layout/fragment_settings.xml +++ b/app/src/main/res/layout/fragment_settings.xml @@ -141,6 +141,13 @@ android:text="@string/show_boost_count" android:layout_height="wrap_content" /> + + + Use the built-in browser Custom tabs Enable Javascript + Automatically expand cw Allow third-party cookies Layout for timelines: diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml index 061e924cf..8fd314bf3 100644 --- a/app/src/main/res/values/styles.xml +++ b/app/src/main/res/values/styles.xml @@ -58,6 +58,17 @@ @color/mastodonC3 + + +