Issue #290 - Automatically expand CW

This commit is contained in:
stom79 2018-02-09 17:39:09 +01:00
parent 12abe7502e
commit 1219609dd7
11 changed files with 77 additions and 36 deletions

View File

@ -125,6 +125,7 @@
/>
<activity android:name=".activities.MediaActivity"
android:label="@string/app_name"
android:theme="@style/Theme.Transparent"
android:configChanges="keyboardHidden|orientation|screenSize"
android:noHistory="true"
/>

View File

@ -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);

View File

@ -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));

View File

@ -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));

View File

@ -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);

View File

@ -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";

View File

@ -142,6 +142,13 @@
android:text="@string/show_boost_count"
android:layout_height="wrap_content" />
<!-- EXPAND CW -->
<CheckBox
android:id="@+id/set_expand_cw"
android:layout_width="wrap_content"
android:text="@string/expand_cw"
android:layout_height="wrap_content" />
<!-- Resize pictures -->
<LinearLayout
android:layout_marginTop="10dp"

View File

@ -32,34 +32,7 @@
android:id="@+id/main_container_media">
<android.support.design.widget.FloatingActionButton
android:id="@+id/media_close"
app:fabSize="mini"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
app:layout_anchorGravity="top|left"
android:layout_marginStart="10dp"
android:layout_marginLeft="10dp"
android:layout_marginTop="5dp"
android:layout_width="30dp"
android:layout_height="30dp"
android:src="@drawable/ic_close"
/>
<android.support.design.widget.FloatingActionButton
android:id="@+id/media_save"
app:fabSize="mini"
android:layout_alignParentTop="true"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"
android:layout_marginEnd="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="5dp"
android:layout_width="30dp"
android:layout_height="30dp"
android:src="@drawable/ic_save_white"
/>
<!-- Main Loader -->
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/loader"
@ -135,5 +108,34 @@
android:layout_alignParentBottom="true"
android:layout_width="match_parent"
android:layout_height="40dp"/>
<android.support.design.widget.FloatingActionButton
android:id="@+id/media_close"
app:fabSize="mini"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
app:layout_anchorGravity="top|left"
android:layout_marginStart="10dp"
android:layout_marginLeft="10dp"
android:layout_marginTop="5dp"
android:layout_width="30dp"
android:layout_height="30dp"
android:src="@drawable/ic_close"
/>
<android.support.design.widget.FloatingActionButton
android:id="@+id/media_save"
app:fabSize="mini"
android:layout_alignParentTop="true"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"
android:layout_marginEnd="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="5dp"
android:layout_width="30dp"
android:layout_height="30dp"
android:src="@drawable/ic_save_white"
/>
</RelativeLayout>
</com.gw.swipeback.SwipeBackLayout>

View File

@ -141,6 +141,13 @@
android:text="@string/show_boost_count"
android:layout_height="wrap_content" />
<!-- EXPAND CW -->
<CheckBox
android:id="@+id/set_expand_cw"
android:layout_width="wrap_content"
android:text="@string/expand_cw"
android:layout_height="wrap_content" />
<!-- Resize pictures -->
<LinearLayout

View File

@ -327,6 +327,7 @@
<string name="embedded_browser">Use the built-in browser</string>
<string name="custom_tabs">Custom tabs</string>
<string name="use_javascript">Enable Javascript</string>
<string name="expand_cw">Automatically expand cw</string>
<string name="use_cookies">Allow third-party cookies</string>
<string name="settings_ui_layout">Layout for timelines: </string>
<string-array name="settings_menu_tabs">

View File

@ -58,6 +58,17 @@
<item name="color_in_account_header">@color/mastodonC3</item>
</style>
<style name="Theme.Transparent" parent="Theme.AppCompat.Light.NoActionBar">
<item name="android:windowIsTranslucent">true</item>
<item name="android:windowBackground">@android:color/transparent</item>
<item name="android:windowContentOverlay">@null</item>
<item name="android:windowNoTitle">true</item>
<item name="android:windowIsFloating">true</item>
<item name="android:backgroundDimEnabled">false</item>
<item name="colorAccent">@color/mastodonC4</item>
</style>
<style name="DropDownListViewStyle" parent="Base.Widget.AppCompat.ListView.DropDown">
<item name="android:background">@color/mastodonC3__</item>
</style>