diff options
author | Christian Schneppe <christian@pix-art.de> | 2019-01-04 17:18:34 +0100 |
---|---|---|
committer | Christian Schneppe <christian@pix-art.de> | 2019-01-04 17:18:34 +0100 |
commit | 7685c46c5af7154c6fb59ab020a174923643bd48 (patch) | |
tree | d14edb2d89e3139ca58080c6013cc1ae3ccf24a7 /src/main/java/de/pixart/messenger/ui/XmppActivity.java | |
parent | 032630143a286f886c58f802d3c61c9a4ba3e99f (diff) |
add preference to play gif files automatically in chat view
fixes #170 and #236
Diffstat (limited to '')
-rw-r--r-- | src/main/java/de/pixart/messenger/ui/XmppActivity.java | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/src/main/java/de/pixart/messenger/ui/XmppActivity.java b/src/main/java/de/pixart/messenger/ui/XmppActivity.java index 19319df18..65383c2aa 100644 --- a/src/main/java/de/pixart/messenger/ui/XmppActivity.java +++ b/src/main/java/de/pixart/messenger/ui/XmppActivity.java @@ -55,6 +55,7 @@ import android.widget.Toast; import net.java.otr4j.session.SessionID; +import java.io.File; import java.io.IOException; import java.lang.ref.WeakReference; import java.util.ArrayList; @@ -87,6 +88,7 @@ import de.pixart.messenger.utils.MenuDoubleTabUtil; import de.pixart.messenger.utils.ThemeHelper; import de.pixart.messenger.xmpp.OnKeyStatusUpdated; import de.pixart.messenger.xmpp.OnUpdateBlocklist; +import pl.droidsonroids.gif.GifDrawable; import rocks.xmpp.addr.Jid; public abstract class XmppActivity extends ActionBarActivity { @@ -441,7 +443,7 @@ public abstract class XmppActivity extends ActionBarActivity { return getBooleanPreference("display_enter_key", R.bool.display_enter_key); } - protected SharedPreferences getPreferences() { + public SharedPreferences getPreferences() { return PreferenceManager.getDefaultSharedPreferences(getApplicationContext()); } @@ -1083,6 +1085,16 @@ public abstract class XmppActivity extends ActionBarActivity { return xmppConnectionService.getAvatarService(); } + public void loadGif(File file, ImageView imageView) { + GifDrawable gifDrawable = null; + try { + gifDrawable = new GifDrawable(file); + } catch (IOException e) { + e.printStackTrace(); + } + imageView.setImageDrawable(gifDrawable); + } + public void loadBitmap(Message message, ImageView imageView) { Bitmap bm; try { |