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 visibility;
|
||||
private boolean attachmentShown = false;
|
||||
private boolean spoilerShown = false;
|
||||
private List<Attachment> media_attachments;
|
||||
private List<Mention> mentions;
|
||||
private List<Tag> tags;
|
||||
|
@ -69,6 +70,7 @@ public class Status implements Parcelable {
|
|||
spoiler_text = in.readString();
|
||||
visibility = in.readString();
|
||||
attachmentShown = in.readByte() != 0;
|
||||
spoilerShown = in.readByte() != 0;
|
||||
}
|
||||
|
||||
public Status(){}
|
||||
|
@ -279,5 +281,14 @@ public class Status implements Parcelable {
|
|||
dest.writeString(spoiler_text);
|
||||
dest.writeString(visibility);
|
||||
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_privacy = (ImageView) convertView.findViewById(R.id.status_privacy);
|
||||
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);
|
||||
} else {
|
||||
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
|
||||
if( type == RetrieveFeedsAsyncTask.Type.USER){
|
||||
|
@ -563,6 +587,11 @@ public class StatusListAdapter extends BaseAdapter implements OnPostActionInterf
|
|||
|
||||
|
||||
private class ViewHolder {
|
||||
LinearLayout status_content_container;
|
||||
LinearLayout status_spoiler_container;
|
||||
TextView status_spoiler;
|
||||
Button status_spoiler_button;
|
||||
|
||||
TextView status_content;
|
||||
TextView status_account_username;
|
||||
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:gravity="end"
|
||||
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
|
||||
android:id="@+id/status_document_container"
|
||||
android:orientation="horizontal"
|
||||
android:id="@+id/status_spoiler_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="200dp">
|
||||
<ImageView
|
||||
android:id="@+id/status_prev1"
|
||||
android:layout_width="0dp"
|
||||
android:layout_weight="1"
|
||||
android:scaleType="centerCrop"
|
||||
android:layout_height="match_parent"
|
||||
tools:ignore="ContentDescription" />
|
||||
android:orientation="vertical"
|
||||
android:visibility="gone"
|
||||
android:layout_height="wrap_content">
|
||||
<TextView
|
||||
android:id="@+id/status_spoiler"
|
||||
android:layout_marginTop="10dp"
|
||||
android:autoLink="web"
|
||||
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
|
||||
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_height="match_parent">
|
||||
android:id="@+id/status_document_container"
|
||||
android:orientation="horizontal"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="200dp">
|
||||
<ImageView
|
||||
android:id="@+id/status_prev2"
|
||||
android:layout_width="match_parent"
|
||||
android:id="@+id/status_prev1"
|
||||
android:layout_width="0dp"
|
||||
android:layout_weight="1"
|
||||
android:scaleType="centerCrop"
|
||||
android:layout_height="0dp"
|
||||
android:layout_height="match_parent"
|
||||
tools:ignore="ContentDescription" />
|
||||
<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_width="match_parent"
|
||||
android:orientation="horizontal"
|
||||
android:layout_marginTop="2dp"
|
||||
android:id="@+id/status_container3"
|
||||
android:layout_height="0dp">
|
||||
android:layout_height="match_parent">
|
||||
<ImageView
|
||||
android:id="@+id/status_prev3"
|
||||
android:id="@+id/status_prev2"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:layout_width="0dp"
|
||||
android:scaleType="centerCrop"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_height="0dp"
|
||||
tools:ignore="ContentDescription" />
|
||||
<ImageView
|
||||
android:layout_marginLeft="2dp"
|
||||
android:layout_marginStart="2dp"
|
||||
android:id="@+id/status_prev4"
|
||||
<LinearLayout
|
||||
android:layout_weight="1"
|
||||
android:layout_width="0dp"
|
||||
android:scaleType="centerCrop"
|
||||
android:layout_height="wrap_content"
|
||||
tools:ignore="ContentDescription" />
|
||||
android:layout_width="match_parent"
|
||||
android:orientation="horizontal"
|
||||
android:layout_marginTop="2dp"
|
||||
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>
|
||||
<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>
|
||||
<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
|
||||
|
|
|
@ -216,6 +216,7 @@
|
|||
<string name="set_attachment_ask">Demander</string>
|
||||
<string name="set_attachment_action">Charger les médias</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="set_display_reply">Afficher le message précédent lors d\'une réponse</string>
|
||||
|
||||
|
|
Loading…
Reference in New Issue