Manages spoiler in toots
This commit is contained in:
parent
ebe994d508
commit
e248db9d34
|
@ -45,6 +45,7 @@ public class Status implements Parcelable {
|
||||||
private String spoiler_text;
|
private String spoiler_text;
|
||||||
private String visibility;
|
private String visibility;
|
||||||
private boolean attachmentShown = false;
|
private boolean attachmentShown = false;
|
||||||
|
private boolean spoilerShown = false;
|
||||||
private List<Attachment> media_attachments;
|
private List<Attachment> media_attachments;
|
||||||
private List<Mention> mentions;
|
private List<Mention> mentions;
|
||||||
private List<Tag> tags;
|
private List<Tag> tags;
|
||||||
|
@ -69,6 +70,7 @@ public class Status implements Parcelable {
|
||||||
spoiler_text = in.readString();
|
spoiler_text = in.readString();
|
||||||
visibility = in.readString();
|
visibility = in.readString();
|
||||||
attachmentShown = in.readByte() != 0;
|
attachmentShown = in.readByte() != 0;
|
||||||
|
spoilerShown = in.readByte() != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Status(){}
|
public Status(){}
|
||||||
|
@ -279,5 +281,14 @@ public class Status implements Parcelable {
|
||||||
dest.writeString(spoiler_text);
|
dest.writeString(spoiler_text);
|
||||||
dest.writeString(visibility);
|
dest.writeString(visibility);
|
||||||
dest.writeByte((byte) (attachmentShown ? 1 : 0));
|
dest.writeByte((byte) (attachmentShown ? 1 : 0));
|
||||||
|
dest.writeByte((byte) (spoilerShown ? 1 : 0));
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isSpoilerShown() {
|
||||||
|
return spoilerShown;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSpoilerShown(boolean spoilerShown) {
|
||||||
|
this.spoilerShown = spoilerShown;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -155,10 +155,34 @@ public class StatusListAdapter extends BaseAdapter implements OnPostActionInterf
|
||||||
holder.status_reply = (ImageView) convertView.findViewById(R.id.status_reply);
|
holder.status_reply = (ImageView) convertView.findViewById(R.id.status_reply);
|
||||||
holder.status_privacy = (ImageView) convertView.findViewById(R.id.status_privacy);
|
holder.status_privacy = (ImageView) convertView.findViewById(R.id.status_privacy);
|
||||||
holder.main_container = (LinearLayout) convertView.findViewById(R.id.main_container);
|
holder.main_container = (LinearLayout) convertView.findViewById(R.id.main_container);
|
||||||
|
holder.status_spoiler_container = (LinearLayout) convertView.findViewById(R.id.status_spoiler_container);
|
||||||
|
holder.status_content_container = (LinearLayout) convertView.findViewById(R.id.status_content_container);
|
||||||
|
holder.status_spoiler = (TextView) convertView.findViewById(R.id.status_spoiler);
|
||||||
|
holder.status_spoiler_button = (Button) convertView.findViewById(R.id.status_spoiler_button);
|
||||||
|
|
||||||
convertView.setTag(holder);
|
convertView.setTag(holder);
|
||||||
} else {
|
} else {
|
||||||
holder = (ViewHolder) convertView.getTag();
|
holder = (ViewHolder) convertView.getTag();
|
||||||
}
|
}
|
||||||
|
if( status.getSpoiler_text() != null && status.getSpoiler_text().trim().length() > 0 && !status.isSpoilerShown()){
|
||||||
|
holder.status_spoiler_container.setVisibility(View.VISIBLE);
|
||||||
|
holder.status_content_container.setVisibility(View.GONE);
|
||||||
|
}else {
|
||||||
|
holder.status_spoiler_button.setVisibility(View.GONE);
|
||||||
|
holder.status_content_container.setVisibility(View.VISIBLE);
|
||||||
|
}
|
||||||
|
if( status.getSpoiler_text() != null)
|
||||||
|
holder.status_spoiler.setText(status.getSpoiler_text());
|
||||||
|
|
||||||
|
//Spoiler opens
|
||||||
|
holder.status_spoiler_button.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
status.setSpoilerShown(true);
|
||||||
|
holder.status_spoiler_button.setVisibility(View.GONE);
|
||||||
|
statusListAdapter.notifyDataSetChanged();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
//Hides action bottom bar action when looking to status trough accounts
|
//Hides action bottom bar action when looking to status trough accounts
|
||||||
if( type == RetrieveFeedsAsyncTask.Type.USER){
|
if( type == RetrieveFeedsAsyncTask.Type.USER){
|
||||||
|
@ -563,6 +587,11 @@ public class StatusListAdapter extends BaseAdapter implements OnPostActionInterf
|
||||||
|
|
||||||
|
|
||||||
private class ViewHolder {
|
private class ViewHolder {
|
||||||
|
LinearLayout status_content_container;
|
||||||
|
LinearLayout status_spoiler_container;
|
||||||
|
TextView status_spoiler;
|
||||||
|
Button status_spoiler_button;
|
||||||
|
|
||||||
TextView status_content;
|
TextView status_content;
|
||||||
TextView status_account_username;
|
TextView status_account_username;
|
||||||
TextView status_account_displayname;
|
TextView status_account_displayname;
|
||||||
|
|
Binary file not shown.
After Width: | Height: | Size: 508 B |
Binary file not shown.
After Width: | Height: | Size: 342 B |
Binary file not shown.
After Width: | Height: | Size: 338 B |
Binary file not shown.
After Width: | Height: | Size: 652 B |
Binary file not shown.
After Width: | Height: | Size: 940 B |
Binary file not shown.
After Width: | Height: | Size: 1.2 KiB |
|
@ -83,83 +83,120 @@
|
||||||
android:layout_gravity="end"
|
android:layout_gravity="end"
|
||||||
android:gravity="end"
|
android:gravity="end"
|
||||||
android:layout_height="wrap_content" />
|
android:layout_height="wrap_content" />
|
||||||
<TextView
|
|
||||||
android:id="@+id/status_content"
|
|
||||||
android:layout_marginTop="10dp"
|
|
||||||
android:autoLink="web"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content" />
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:id="@+id/status_document_container"
|
android:id="@+id/status_spoiler_container"
|
||||||
android:orientation="horizontal"
|
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="200dp">
|
android:orientation="vertical"
|
||||||
<ImageView
|
android:visibility="gone"
|
||||||
android:id="@+id/status_prev1"
|
android:layout_height="wrap_content">
|
||||||
android:layout_width="0dp"
|
<TextView
|
||||||
android:layout_weight="1"
|
android:id="@+id/status_spoiler"
|
||||||
android:scaleType="centerCrop"
|
android:layout_marginTop="10dp"
|
||||||
android:layout_height="match_parent"
|
android:autoLink="web"
|
||||||
tools:ignore="ContentDescription" />
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content" />
|
||||||
|
<Button
|
||||||
|
android:id="@+id/status_spoiler_button"
|
||||||
|
android:textAllCaps="false"
|
||||||
|
android:drawableLeft="@drawable/ic_remove_red_eye"
|
||||||
|
android:drawableStart="@drawable/ic_remove_red_eye"
|
||||||
|
android:gravity="center"
|
||||||
|
android:drawablePadding="5dp"
|
||||||
|
android:paddingLeft="10dp"
|
||||||
|
android:paddingStart="10dp"
|
||||||
|
android:paddingRight="10dp"
|
||||||
|
android:paddingEnd="10dp"
|
||||||
|
android:paddingTop="5dp"
|
||||||
|
android:paddingBottom="5dp"
|
||||||
|
android:maxLines="1"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/load_attachment_spoiler" />
|
||||||
|
</LinearLayout>
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/status_content_container"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:layout_height="wrap_content">
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/status_content"
|
||||||
|
android:layout_marginTop="10dp"
|
||||||
|
android:autoLink="web"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content" />
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:orientation="vertical"
|
android:id="@+id/status_document_container"
|
||||||
android:layout_width="0dp"
|
android:orientation="horizontal"
|
||||||
android:layout_marginLeft="2dp"
|
android:layout_width="match_parent"
|
||||||
android:layout_marginStart="2dp"
|
android:layout_height="200dp">
|
||||||
android:id="@+id/status_container2"
|
|
||||||
android:layout_weight="1"
|
|
||||||
android:layout_height="match_parent">
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/status_prev2"
|
android:id="@+id/status_prev1"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="0dp"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:scaleType="centerCrop"
|
android:scaleType="centerCrop"
|
||||||
android:layout_height="0dp"
|
android:layout_height="match_parent"
|
||||||
tools:ignore="ContentDescription" />
|
tools:ignore="ContentDescription" />
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_marginLeft="2dp"
|
||||||
|
android:layout_marginStart="2dp"
|
||||||
|
android:id="@+id/status_container2"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:layout_width="match_parent"
|
android:layout_height="match_parent">
|
||||||
android:orientation="horizontal"
|
|
||||||
android:layout_marginTop="2dp"
|
|
||||||
android:id="@+id/status_container3"
|
|
||||||
android:layout_height="0dp">
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/status_prev3"
|
android:id="@+id/status_prev2"
|
||||||
|
android:layout_width="match_parent"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:layout_width="0dp"
|
|
||||||
android:scaleType="centerCrop"
|
android:scaleType="centerCrop"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="0dp"
|
||||||
tools:ignore="ContentDescription" />
|
tools:ignore="ContentDescription" />
|
||||||
<ImageView
|
<LinearLayout
|
||||||
android:layout_marginLeft="2dp"
|
|
||||||
android:layout_marginStart="2dp"
|
|
||||||
android:id="@+id/status_prev4"
|
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:layout_width="0dp"
|
android:layout_width="match_parent"
|
||||||
android:scaleType="centerCrop"
|
android:orientation="horizontal"
|
||||||
android:layout_height="wrap_content"
|
android:layout_marginTop="2dp"
|
||||||
tools:ignore="ContentDescription" />
|
android:id="@+id/status_container3"
|
||||||
|
android:layout_height="0dp">
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/status_prev3"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:scaleType="centerCrop"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
tools:ignore="ContentDescription" />
|
||||||
|
<ImageView
|
||||||
|
android:layout_marginLeft="2dp"
|
||||||
|
android:layout_marginStart="2dp"
|
||||||
|
android:id="@+id/status_prev4"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:scaleType="centerCrop"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
tools:ignore="ContentDescription" />
|
||||||
|
</LinearLayout>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
<Button
|
||||||
|
android:id="@+id/status_show_more"
|
||||||
|
android:visibility="gone"
|
||||||
|
android:textAllCaps="false"
|
||||||
|
android:drawableLeft="@drawable/ic_photo"
|
||||||
|
android:drawableStart="@drawable/ic_photo"
|
||||||
|
android:gravity="center"
|
||||||
|
android:drawablePadding="5dp"
|
||||||
|
android:paddingLeft="10dp"
|
||||||
|
android:paddingStart="10dp"
|
||||||
|
android:paddingRight="10dp"
|
||||||
|
android:paddingEnd="10dp"
|
||||||
|
android:paddingTop="5dp"
|
||||||
|
android:paddingBottom="5dp"
|
||||||
|
android:maxLines="1"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/load_attachment" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
<Button
|
|
||||||
android:id="@+id/status_show_more"
|
|
||||||
android:visibility="gone"
|
|
||||||
android:textAllCaps="false"
|
|
||||||
android:drawableLeft="@drawable/ic_photo"
|
|
||||||
android:drawableStart="@drawable/ic_photo"
|
|
||||||
android:gravity="center"
|
|
||||||
android:drawablePadding="5dp"
|
|
||||||
android:paddingLeft="10dp"
|
|
||||||
android:paddingStart="10dp"
|
|
||||||
android:paddingRight="10dp"
|
|
||||||
android:paddingEnd="10dp"
|
|
||||||
android:paddingTop="5dp"
|
|
||||||
android:paddingBottom="5dp"
|
|
||||||
android:maxLines="1"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:text="@string/load_attachment" />
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
|
|
|
@ -216,6 +216,7 @@
|
||||||
<string name="set_attachment_ask">Demander</string>
|
<string name="set_attachment_ask">Demander</string>
|
||||||
<string name="set_attachment_action">Charger les médias</string>
|
<string name="set_attachment_action">Charger les médias</string>
|
||||||
<string name="load_attachment">Charger les images</string>
|
<string name="load_attachment">Charger les images</string>
|
||||||
|
<string name="load_attachment_spoiler">Afficher le contenu ?</string>
|
||||||
<string name="load_sensitive_attachment">Charger les images sensibles</string>
|
<string name="load_sensitive_attachment">Charger les images sensibles</string>
|
||||||
<string name="set_display_reply">Afficher le message précédent lors d\'une réponse</string>
|
<string name="set_display_reply">Afficher le message précédent lors d\'une réponse</string>
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue