aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/de
diff options
context:
space:
mode:
authorChristian Schneppe <christian@pix-art.de>2019-02-09 22:51:29 +0100
committerChristian Schneppe <christian@pix-art.de>2019-02-09 22:51:29 +0100
commitb92f7be0cd37c603f865a024b47a08e3d644e2d9 (patch)
tree1c735beda616fac26bafa8f2c446dec11358452a /src/main/java/de
parent9648ce71a6b2a1b940fec148c350ef944eaeeeee (diff)
respect Android datasaver and if enabled don't load images
Diffstat (limited to 'src/main/java/de')
-rw-r--r--src/main/java/de/pixart/messenger/ui/widget/RichLinkView.java15
1 files changed, 10 insertions, 5 deletions
diff --git a/src/main/java/de/pixart/messenger/ui/widget/RichLinkView.java b/src/main/java/de/pixart/messenger/ui/widget/RichLinkView.java
index 29f04970d..7a7baa5c7 100644
--- a/src/main/java/de/pixart/messenger/ui/widget/RichLinkView.java
+++ b/src/main/java/de/pixart/messenger/ui/widget/RichLinkView.java
@@ -6,7 +6,6 @@ import android.net.Uri;
import android.os.Build;
import android.support.annotation.RequiresApi;
import android.util.AttributeSet;
-import android.util.Log;
import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;
@@ -16,6 +15,7 @@ import android.widget.TextView;
import com.squareup.picasso.Picasso;
import de.pixart.messenger.R;
+import de.pixart.messenger.services.XmppConnectionService;
import io.github.ponnamkarthik.richlinkpreview.MetaData;
import io.github.ponnamkarthik.richlinkpreview.ResponseListener;
import io.github.ponnamkarthik.richlinkpreview.RichLinkListener;
@@ -44,6 +44,7 @@ public class RichLinkView extends RelativeLayout {
private RichLinkListener richLinkListener;
+ private XmppConnectionService mXmppConnectionService;
public RichLinkView(Context context) {
super(context);
@@ -96,10 +97,14 @@ public class RichLinkView extends RelativeLayout {
if (meta.getImageurl().equals("") || meta.getImageurl().isEmpty()) {
imageView.setVisibility(GONE);
} else {
- imageView.setVisibility(VISIBLE);
- Picasso.get()
- .load(meta.getImageurl())
- .into(imageView);
+ if (mXmppConnectionService != null && mXmppConnectionService.isDataSaverDisabled()) {
+ imageView.setVisibility(VISIBLE);
+ Picasso.get()
+ .load(meta.getImageurl())
+ .into(imageView);
+ } else {
+ imageView.setVisibility(GONE);
+ }
}
if (meta.getTitle().isEmpty() || meta.getTitle().equals("")) {
textViewTitle.setVisibility(GONE);