summaryrefslogtreecommitdiffstats
path: root/app/src
diff options
context:
space:
mode:
authortom79 <tschneider.ac@gmail.com>2019-05-08 09:37:17 +0200
committertom79 <tschneider.ac@gmail.com>2019-05-08 09:37:17 +0200
commit8a88975d6ab4990be00bf1e4c5d061ba781d12fa (patch)
tree21ac964994ce4fe59659f2236a705cba6a3527eb /app/src
parent09bb853bf356d9809b0489790d4b7b4364a2073a (diff)
Fix for all
Diffstat (limited to 'app/src')
-rw-r--r--app/src/main/java/fr/gouv/etalab/mastodon/client/Entities/Status.java12
-rw-r--r--app/src/main/java/fr/gouv/etalab/mastodon/drawers/StatusListAdapter.java75
-rw-r--r--app/src/main/res/drawable/rounded_label_sensitive.xml16
-rw-r--r--app/src/main/res/layout/drawer_status.xml7
-rw-r--r--app/src/main/res/layout/drawer_status_compact.xml5
-rw-r--r--app/src/main/res/layout/drawer_status_console.xml5
-rw-r--r--app/src/main/res/layout/drawer_status_focused.xml5
7 files changed, 79 insertions, 46 deletions
diff --git a/app/src/main/java/fr/gouv/etalab/mastodon/client/Entities/Status.java b/app/src/main/java/fr/gouv/etalab/mastodon/client/Entities/Status.java
index 0ba3a6a4b..667183a57 100644
--- a/app/src/main/java/fr/gouv/etalab/mastodon/client/Entities/Status.java
+++ b/app/src/main/java/fr/gouv/etalab/mastodon/client/Entities/Status.java
@@ -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;
+ }
}
diff --git a/app/src/main/java/fr/gouv/etalab/mastodon/drawers/StatusListAdapter.java b/app/src/main/java/fr/gouv/etalab/mastodon/drawers/StatusListAdapter.java
index a1bc07ee1..87288a991 100644
--- a/app/src/main/java/fr/gouv/etalab/mastodon/drawers/StatusListAdapter.java
+++ b/app/src/main/java/fr/gouv/etalab/mastodon/drawers/StatusListAdapter.java
@@ -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();
+ }
}
}
});
diff --git a/app/src/main/res/drawable/rounded_label_sensitive.xml b/app/src/main/res/drawable/rounded_label_sensitive.xml
new file mode 100644
index 000000000..94100870a
--- /dev/null
+++ b/app/src/main/res/drawable/rounded_label_sensitive.xml
@@ -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> \ No newline at end of file
diff --git a/app/src/main/res/layout/drawer_status.xml b/app/src/main/res/layout/drawer_status.xml
index 9c69e4ad7..efe3fb26e 100644
--- a/app/src/main/res/layout/drawer_status.xml
+++ b/app/src/main/res/layout/drawer_status.xml
@@ -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" />
diff --git a/app/src/main/res/layout/drawer_status_compact.xml b/app/src/main/res/layout/drawer_status_compact.xml
index b06df6022..c37d302b1 100644
--- a/app/src/main/res/layout/drawer_status_compact.xml
+++ b/app/src/main/res/layout/drawer_status_compact.xml
@@ -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" />
diff --git a/app/src/main/res/layout/drawer_status_console.xml b/app/src/main/res/layout/drawer_status_console.xml
index bdfe79f2a..466447bd2 100644
--- a/app/src/main/res/layout/drawer_status_console.xml
+++ b/app/src/main/res/layout/drawer_status_console.xml
@@ -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" />
diff --git a/app/src/main/res/layout/drawer_status_focused.xml b/app/src/main/res/layout/drawer_status_focused.xml
index 73f0947b1..6dd9660fd 100644
--- a/app/src/main/res/layout/drawer_status_focused.xml
+++ b/app/src/main/res/layout/drawer_status_focused.xml
@@ -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" />