Fix for all

This commit is contained in:
tom79 2019-05-08 09:37:17 +02:00
parent 09bb853bf3
commit 8a88975d6a
7 changed files with 79 additions and 46 deletions

View File

@ -134,6 +134,8 @@ public class Status implements Parcelable{
private boolean isNotice = false;
private Poll poll = null;
private int media_height;
@Override
public void writeToParcel(Parcel dest, int flags) {
dest.writeString(this.id);
@ -190,6 +192,7 @@ public class Status implements Parcelable{
dest.writeByte(this.showSpoiler ? (byte) 1 : (byte) 0);
dest.writeByte(this.isNotice ? (byte) 1 : (byte) 0);
dest.writeParcelable(this.poll, flags);
dest.writeInt(this.media_height);
}
protected Status(Parcel in) {
@ -249,6 +252,7 @@ public class Status implements Parcelable{
this.showSpoiler = in.readByte() != 0;
this.isNotice = in.readByte() != 0;
this.poll = in.readParcelable(Poll.class.getClassLoader());
this.media_height = in.readInt();
}
public static final Creator<Status> CREATOR = new Creator<Status>() {
@ -1340,4 +1344,12 @@ public class Status implements Parcelable{
public void setPoll(Poll poll) {
this.poll = poll;
}
public int getMedia_height() {
return media_height;
}
public void setMedia_height(int media_height) {
this.media_height = media_height;
}
}

View File

@ -538,7 +538,7 @@ public class StatusListAdapter extends RecyclerView.Adapter implements OnPostAct
boolean display_card = sharedpreferences.getBoolean(Helper.SET_DISPLAY_CARD, false);
boolean display_video_preview = sharedpreferences.getBoolean(Helper.SET_DISPLAY_VIDEO_PREVIEWS, true);
int truncate_toots_size = sharedpreferences.getInt(Helper.SET_TRUNCATE_TOOTS_SIZE, 0);
final int timeout = sharedpreferences.getInt(Helper.SET_NSFW_TIMEOUT, 5);
boolean share_details = sharedpreferences.getBoolean(Helper.SET_SHARE_DETAILS, true);
boolean confirmFav = sharedpreferences.getBoolean(Helper.SET_NOTIF_VALIDATION_FAV, false);
boolean confirmBoost = sharedpreferences.getBoolean(Helper.SET_NOTIF_VALIDATION, true);
@ -2075,32 +2075,6 @@ public class StatusListAdapter extends RecyclerView.Adapter implements OnPostAct
}
});
holder.status_show_more.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
status.setAttachmentShown(true);
notifyStatusChanged(status);
/*
Added a Countdown Timer, so that Sensitive (NSFW)
images only get displayed for user set time,
giving the user time to click on them to expand them,
if they want. Images are then hidden again.
-> Default value is set to 5 seconds
*/
if (timeout > 0) {
new CountDownTimer((timeout * 1000), 1000) {
public void onTick(long millisUntilFinished) {
}
public void onFinish() {
status.setAttachmentShown(false);
notifyStatusChanged(status);
}
}.start();
}
}
});
if (type == RetrieveFeedsAsyncTask.Type.REMOTE_INSTANCE)
holder.status_more.setVisibility(View.GONE);
@ -2723,8 +2697,8 @@ public class StatusListAdapter extends RecyclerView.Adapter implements OnPostAct
}else{
holder.status_toot_app.setVisibility(View.GONE);
}
}
}
@ -2808,6 +2782,7 @@ public class StatusListAdapter extends RecyclerView.Adapter implements OnPostAct
int position = 1;
for(final Attachment attachment: attachments){
ImageView imageView;
RelativeLayout container = holder.status_horizontal_document_container;
if( i == 0) {
imageView = fullAttachement?holder.status_prev1_h:holder.status_prev1;
if( attachment.getType().toLowerCase().equals("image") || attachment.getType().toLowerCase().equals("unknown"))
@ -2927,6 +2902,7 @@ public class StatusListAdapter extends RecyclerView.Adapter implements OnPostAct
resource = Bitmap.createScaledBitmap(resource, width, height, false);
}
imageView.setImageBitmap(resource);
status.setMedia_height(container.getHeight());
}
});
}else{
@ -2978,15 +2954,40 @@ public class StatusListAdapter extends RecyclerView.Adapter implements OnPostAct
imageView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if( attachment.getType().equals("web")){
Helper.openBrowser(context, attachment.getUrl());
}else {
Intent intent = new Intent(context, MediaActivity.class);
Bundle b = new Bundle();
intent.putParcelableArrayListExtra("mediaArray", status.getMedia_attachments());
b.putInt("position", finalPosition);
intent.putExtras(b);
context.startActivity(intent);
if( status.isAttachmentShown()) {
if (attachment.getType().equals("web")) {
Helper.openBrowser(context, attachment.getUrl());
} else {
Intent intent = new Intent(context, MediaActivity.class);
Bundle b = new Bundle();
intent.putParcelableArrayListExtra("mediaArray", status.getMedia_attachments());
b.putInt("position", finalPosition);
intent.putExtras(b);
context.startActivity(intent);
}
}else{
status.setAttachmentShown(true);
notifyStatusChanged(status);
/*
Added a Countdown Timer, so that Sensitive (NSFW)
images only get displayed for user set time,
giving the user time to click on them to expand them,
if they want. Images are then hidden again.
-> Default value is set to 5 seconds
*/
final int timeout = sharedpreferences.getInt(Helper.SET_NSFW_TIMEOUT, 5);
if (timeout > 0) {
new CountDownTimer((timeout * 1000), 1000) {
public void onTick(long millisUntilFinished) {
}
public void onFinish() {
status.setAttachmentShown(false);
notifyStatusChanged(status);
}
}.start();
}
}
}
});

View File

@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" >
<stroke
android:width="1dp"
android:color="#77000000" />
<solid android:color="#77000000" />
<padding
android:left="1dp"
android:right="1dp"
android:bottom="1dp"
android:top="1dp" />
<corners android:radius="5dp" />
</shape>

View File

@ -672,8 +672,9 @@
android:visibility="gone"
android:id="@+id/status_show_more"
android:layout_width="match_parent"
android:layout_height="200dp"
>
android:layout_height="match_parent"
android:layout_centerInParent="true"
>
<TextView
android:textSize="20sp"
android:gravity="center"
@ -681,7 +682,7 @@
android:layout_gravity="center"
android:layout_centerInParent="true"
android:padding="12dp"
android:background="#AA000000"
android:background="@drawable/rounded_label_sensitive"
android:textColor="#ffffffff"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />

View File

@ -633,7 +633,8 @@
android:visibility="gone"
android:id="@+id/status_show_more"
android:layout_width="match_parent"
android:layout_height="200dp"
android:layout_height="match_parent"
android:layout_centerInParent="true"
>
<TextView
android:textSize="20sp"
@ -642,7 +643,7 @@
android:layout_gravity="center"
android:layout_centerInParent="true"
android:padding="12dp"
android:background="#AA000000"
android:background="@drawable/rounded_label_sensitive"
android:textColor="#ffffffff"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />

View File

@ -633,7 +633,8 @@
android:visibility="gone"
android:id="@+id/status_show_more"
android:layout_width="match_parent"
android:layout_height="200dp"
android:layout_height="match_parent"
android:layout_centerInParent="true"
>
<TextView
android:textSize="20sp"
@ -642,7 +643,7 @@
android:layout_gravity="center"
android:layout_centerInParent="true"
android:padding="12dp"
android:background="#AA000000"
android:background="@drawable/rounded_label_sensitive"
android:textColor="#ffffffff"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />

View File

@ -557,7 +557,8 @@
android:visibility="gone"
android:id="@+id/status_show_more"
android:layout_width="match_parent"
android:layout_height="200dp"
android:layout_height="match_parent"
android:layout_centerInParent="true"
>
<TextView
android:textSize="20sp"
@ -566,7 +567,7 @@
android:layout_gravity="center"
android:layout_centerInParent="true"
android:padding="12dp"
android:background="#AA000000"
android:background="@drawable/rounded_label_sensitive"
android:textColor="#ffffffff"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />