Allow to hide long toots
This commit is contained in:
parent
9a1b72b76f
commit
df3f870c7d
|
@ -119,6 +119,8 @@ public class Status implements Parcelable{
|
||||||
private RetrieveFeedsAsyncTask.Type type;
|
private RetrieveFeedsAsyncTask.Type type;
|
||||||
private int itemViewType;
|
private int itemViewType;
|
||||||
private String conversationId;
|
private String conversationId;
|
||||||
|
private boolean isExpanded = false;
|
||||||
|
private int numberLines = -1;
|
||||||
|
|
||||||
public Status(){}
|
public Status(){}
|
||||||
private List<String> conversationProfilePicture;
|
private List<String> conversationProfilePicture;
|
||||||
|
@ -1149,4 +1151,20 @@ public class Status implements Parcelable{
|
||||||
public void setConversationId(String conversationId) {
|
public void setConversationId(String conversationId) {
|
||||||
this.conversationId = conversationId;
|
this.conversationId = conversationId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isExpanded() {
|
||||||
|
return isExpanded;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setExpanded(boolean expanded) {
|
||||||
|
isExpanded = expanded;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getNumberLines() {
|
||||||
|
return numberLines;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNumberLines(int numberLines) {
|
||||||
|
this.numberLines = numberLines;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -299,6 +299,7 @@ public class StatusListAdapter extends RecyclerView.Adapter implements OnPostAct
|
||||||
RelativeLayout webview_preview;
|
RelativeLayout webview_preview;
|
||||||
ImageView webview_preview_card;
|
ImageView webview_preview_card;
|
||||||
LinearLayout left_buttons;
|
LinearLayout left_buttons;
|
||||||
|
Button status_show_more_content;
|
||||||
|
|
||||||
public View getView(){
|
public View getView(){
|
||||||
return itemView;
|
return itemView;
|
||||||
|
@ -379,6 +380,7 @@ public class StatusListAdapter extends RecyclerView.Adapter implements OnPostAct
|
||||||
conversation_pp_3_container = itemView.findViewById(R.id.conversation_pp_3_container);
|
conversation_pp_3_container = itemView.findViewById(R.id.conversation_pp_3_container);
|
||||||
vertical_content = itemView.findViewById(R.id.vertical_content);
|
vertical_content = itemView.findViewById(R.id.vertical_content);
|
||||||
left_buttons = itemView.findViewById(R.id.left_buttons);
|
left_buttons = itemView.findViewById(R.id.left_buttons);
|
||||||
|
status_show_more_content = itemView.findViewById(R.id.status_show_more_content);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -715,7 +717,31 @@ public class StatusListAdapter extends RecyclerView.Adapter implements OnPostAct
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
holder.status_content.setText(status.getContentSpan(), TextView.BufferType.SPANNABLE);
|
holder.status_content.setText(status.getContentSpan(), TextView.BufferType.SPANNABLE);
|
||||||
|
boolean truncate_toots = sharedpreferences.getBoolean(Helper.SET_TRUNCATE_TOOTS, false);
|
||||||
|
if( truncate_toots) {
|
||||||
|
if (status.getNumberLines() == -1) {
|
||||||
|
status.setNumberLines(holder.status_content.getLineCount());
|
||||||
|
}
|
||||||
|
if (status.getNumberLines() > 10) {
|
||||||
|
holder.status_show_more_content.setVisibility(View.VISIBLE);
|
||||||
|
if (status.isExpanded()) {
|
||||||
|
holder.status_content.setMaxLines(Integer.MAX_VALUE);
|
||||||
|
holder.status_show_more_content.setText(R.string.load_attachment_spoiler_less);
|
||||||
|
} else {
|
||||||
|
holder.status_content.setMaxLines(10);
|
||||||
|
holder.status_show_more_content.setText(R.string.load_attachment_spoiler);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
holder.status_show_more_content.setVisibility(View.GONE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
holder.status_show_more_content.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
status.setExpanded(!status.isExpanded());
|
||||||
|
notifyStatusChanged(status);
|
||||||
|
}
|
||||||
|
});
|
||||||
holder.status_spoiler.setText(status.getContentSpanCW(), TextView.BufferType.SPANNABLE);
|
holder.status_spoiler.setText(status.getContentSpanCW(), TextView.BufferType.SPANNABLE);
|
||||||
|
|
||||||
holder.status_content.setMovementMethod(LinkMovementMethod.getInstance());
|
holder.status_content.setMovementMethod(LinkMovementMethod.getInstance());
|
||||||
|
@ -1055,7 +1081,13 @@ public class StatusListAdapter extends RecyclerView.Adapter implements OnPostAct
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if( theme == Helper.THEME_BLACK) {
|
||||||
|
changeDrawableColor(context, R.drawable.ic_photo, R.color.dark_text);
|
||||||
|
changeDrawableColor(context, R.drawable.ic_more_toot_content, R.color.dark_text);
|
||||||
|
}else {
|
||||||
|
changeDrawableColor(context, R.drawable.ic_photo, R.color.mastodonC4);
|
||||||
|
changeDrawableColor(context, R.drawable.ic_more_toot_content, R.color.mastodonC4);
|
||||||
|
}
|
||||||
if(!fullAttachement)
|
if(!fullAttachement)
|
||||||
holder.hide_preview.setOnClickListener(new View.OnClickListener() {
|
holder.hide_preview.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
|
@ -1065,11 +1097,6 @@ public class StatusListAdapter extends RecyclerView.Adapter implements OnPostAct
|
||||||
status.getReblog().setSensitive(true);
|
status.getReblog().setSensitive(true);
|
||||||
else
|
else
|
||||||
status.setSensitive(true);
|
status.setSensitive(true);
|
||||||
|
|
||||||
if( theme == Helper.THEME_BLACK)
|
|
||||||
changeDrawableColor(context, R.drawable.ic_photo,R.color.dark_text);
|
|
||||||
else
|
|
||||||
changeDrawableColor(context, R.drawable.ic_photo,R.color.mastodonC4);
|
|
||||||
notifyStatusChanged(status);
|
notifyStatusChanged(status);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -1082,11 +1109,6 @@ public class StatusListAdapter extends RecyclerView.Adapter implements OnPostAct
|
||||||
status.getReblog().setSensitive(true);
|
status.getReblog().setSensitive(true);
|
||||||
else
|
else
|
||||||
status.setSensitive(true);
|
status.setSensitive(true);
|
||||||
|
|
||||||
if( theme == Helper.THEME_BLACK)
|
|
||||||
changeDrawableColor(context, R.drawable.ic_photo,R.color.dark_text);
|
|
||||||
else
|
|
||||||
changeDrawableColor(context, R.drawable.ic_photo,R.color.mastodonC4);
|
|
||||||
notifyStatusChanged(status);
|
notifyStatusChanged(status);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -262,6 +262,20 @@ public class SettingsFragment extends Fragment {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
boolean truncate_toots = sharedpreferences.getBoolean(Helper.SET_TRUNCATE_TOOTS, false);
|
||||||
|
final CheckBox set_truncate_toots = rootView.findViewById(R.id.set_truncate_toots);
|
||||||
|
set_truncate_toots.setChecked(truncate_toots);
|
||||||
|
|
||||||
|
set_truncate_toots.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
SharedPreferences.Editor editor = sharedpreferences.edit();
|
||||||
|
editor.putBoolean(Helper.SET_TRUNCATE_TOOTS, set_truncate_toots.isChecked());
|
||||||
|
editor.apply();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
boolean follow_instance = sharedpreferences.getBoolean(Helper.SET_DISPLAY_FOLLOW_INSTANCE, true);
|
boolean follow_instance = sharedpreferences.getBoolean(Helper.SET_DISPLAY_FOLLOW_INSTANCE, true);
|
||||||
final CheckBox set_follow_instance = rootView.findViewById(R.id.set_display_follow_instance);
|
final CheckBox set_follow_instance = rootView.findViewById(R.id.set_display_follow_instance);
|
||||||
set_follow_instance.setChecked(follow_instance);
|
set_follow_instance.setChecked(follow_instance);
|
||||||
|
|
|
@ -338,6 +338,7 @@ public class Helper {
|
||||||
public static final String SET_DISPLAY_GLOBAL = "set_display_global";
|
public static final String SET_DISPLAY_GLOBAL = "set_display_global";
|
||||||
public static final String SET_AUTOMATICALLY_SPLIT_TOOTS = "set_automatically_split_toots";
|
public static final String SET_AUTOMATICALLY_SPLIT_TOOTS = "set_automatically_split_toots";
|
||||||
public static final String SET_AUTOMATICALLY_SPLIT_TOOTS_SIZE = "set_automatically_split_toots_size";
|
public static final String SET_AUTOMATICALLY_SPLIT_TOOTS_SIZE = "set_automatically_split_toots_size";
|
||||||
|
public static final String SET_TRUNCATE_TOOTS = "set_truncate_toots";
|
||||||
//End points
|
//End points
|
||||||
public static final String EP_AUTHORIZE = "/oauth/authorize";
|
public static final String EP_AUTHORIZE = "/oauth/authorize";
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,9 @@
|
||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="24dp"
|
||||||
|
android:height="24dp"
|
||||||
|
android:viewportWidth="24.0"
|
||||||
|
android:viewportHeight="24.0">
|
||||||
|
<path
|
||||||
|
android:fillColor="#FF000000"
|
||||||
|
android:pathData="M6,10c-1.1,0 -2,0.9 -2,2s0.9,2 2,2 2,-0.9 2,-2 -0.9,-2 -2,-2zM18,10c-1.1,0 -2,0.9 -2,2s0.9,2 2,2 2,-0.9 2,-2 -0.9,-2 -2,-2zM12,10c-1.1,0 -2,0.9 -2,2s0.9,2 2,2 2,-0.9 2,-2 -0.9,-2 -2,-2z"/>
|
||||||
|
</vector>
|
|
@ -186,6 +186,12 @@
|
||||||
android:text="@string/set_old_direct_timeline"
|
android:text="@string/set_old_direct_timeline"
|
||||||
android:layout_height="wrap_content" />
|
android:layout_height="wrap_content" />
|
||||||
|
|
||||||
|
<!-- TRUNCATE LONG TOOTS -->
|
||||||
|
<CheckBox
|
||||||
|
android:id="@+id/set_truncate_toots"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:text="@string/truncate_long_toots"
|
||||||
|
android:layout_height="wrap_content" />
|
||||||
|
|
||||||
<!-- Resize pictures -->
|
<!-- Resize pictures -->
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
|
|
|
@ -265,6 +265,21 @@
|
||||||
android:layout_marginBottom="10dp"
|
android:layout_marginBottom="10dp"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content" />
|
android:layout_height="wrap_content" />
|
||||||
|
<Button
|
||||||
|
android:id="@+id/status_show_more_content"
|
||||||
|
android:visibility="gone"
|
||||||
|
android:textAllCaps="false"
|
||||||
|
android:drawableLeft="@drawable/ic_more_toot_content"
|
||||||
|
android:drawableStart="@drawable/ic_more_toot_content"
|
||||||
|
android:gravity="center_vertical"
|
||||||
|
android:drawablePadding="5dp"
|
||||||
|
android:paddingTop="5dp"
|
||||||
|
android:paddingBottom="5dp"
|
||||||
|
android:maxLines="1"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
style="?attr/borderless"
|
||||||
|
android:text="@string/load_attachment_spoiler" />
|
||||||
<TextView
|
<TextView
|
||||||
android:visibility="gone"
|
android:visibility="gone"
|
||||||
android:layout_marginEnd="10dp"
|
android:layout_marginEnd="10dp"
|
||||||
|
|
|
@ -234,6 +234,21 @@
|
||||||
android:textIsSelectable="true"
|
android:textIsSelectable="true"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content" />
|
android:layout_height="wrap_content" />
|
||||||
|
<Button
|
||||||
|
android:id="@+id/status_show_more_content"
|
||||||
|
android:visibility="gone"
|
||||||
|
android:textAllCaps="false"
|
||||||
|
android:drawableLeft="@drawable/ic_more_toot_content"
|
||||||
|
android:drawableStart="@drawable/ic_more_toot_content"
|
||||||
|
android:gravity="center_vertical"
|
||||||
|
android:drawablePadding="5dp"
|
||||||
|
android:paddingTop="5dp"
|
||||||
|
android:paddingBottom="5dp"
|
||||||
|
android:maxLines="1"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
style="?attr/borderless"
|
||||||
|
android:text="@string/load_attachment_spoiler" />
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
|
|
@ -161,6 +161,21 @@
|
||||||
android:layout_marginBottom="10dp"
|
android:layout_marginBottom="10dp"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content" />
|
android:layout_height="wrap_content" />
|
||||||
|
<Button
|
||||||
|
android:id="@+id/status_show_more_content"
|
||||||
|
android:visibility="gone"
|
||||||
|
android:textAllCaps="false"
|
||||||
|
android:drawableLeft="@drawable/ic_more_toot_content"
|
||||||
|
android:drawableStart="@drawable/ic_more_toot_content"
|
||||||
|
android:gravity="center_vertical"
|
||||||
|
android:drawablePadding="5dp"
|
||||||
|
android:paddingTop="5dp"
|
||||||
|
android:paddingBottom="5dp"
|
||||||
|
android:maxLines="1"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
style="?attr/borderless"
|
||||||
|
android:text="@string/load_attachment_spoiler" />
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
|
|
@ -185,6 +185,13 @@
|
||||||
android:text="@string/set_old_direct_timeline"
|
android:text="@string/set_old_direct_timeline"
|
||||||
android:layout_height="wrap_content" />
|
android:layout_height="wrap_content" />
|
||||||
|
|
||||||
|
<!-- TRUNCATE LONG TOOTS -->
|
||||||
|
<CheckBox
|
||||||
|
android:id="@+id/set_truncate_toots"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:text="@string/truncate_long_toots"
|
||||||
|
android:layout_height="wrap_content" />
|
||||||
|
|
||||||
<!-- Resize pictures -->
|
<!-- Resize pictures -->
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_marginTop="10dp"
|
android:layout_marginTop="10dp"
|
||||||
|
|
|
@ -676,6 +676,7 @@
|
||||||
<string name="settings_title_battery">Optimization of the battery</string>
|
<string name="settings_title_battery">Optimization of the battery</string>
|
||||||
<string name="set_change_locale">Change the language</string>
|
<string name="set_change_locale">Change the language</string>
|
||||||
<string name="default_language">Default language</string>
|
<string name="default_language">Default language</string>
|
||||||
|
<string name="truncate_long_toots">Truncate long toots</string>
|
||||||
|
|
||||||
<string-array name="filter_expire">
|
<string-array name="filter_expire">
|
||||||
<item>Never</item>
|
<item>Never</item>
|
||||||
|
|
Loading…
Reference in New Issue