diff options
author | Steve Kondik <steve@cyngn.com> | 2015-10-17 23:40:33 -0700 |
---|---|---|
committer | Steve Kondik <steve@cyngn.com> | 2015-10-17 23:40:33 -0700 |
commit | bcbf7c98a521b9ee4a7d03e00dcfc469c9b3a398 (patch) | |
tree | 85d07b2095695fe79235ab16e627f8b22c7bfd8d /src/com/android/gallery3d/util/ViewGifImage.java | |
parent | a3fcd50080c0546ebd5f0caf932eef02fabdd7ad (diff) | |
parent | 8de528917bf03cca93ac2a3dd19b7a5719d1a26e (diff) | |
download | android_packages_apps_Gallery2-bcbf7c98a521b9ee4a7d03e00dcfc469c9b3a398.tar.gz android_packages_apps_Gallery2-bcbf7c98a521b9ee4a7d03e00dcfc469c9b3a398.tar.bz2 android_packages_apps_Gallery2-bcbf7c98a521b9ee4a7d03e00dcfc469c9b3a398.zip |
Merge branch 'cm-12.1' of git://github.com/CyanogenMod/android_packages_apps_Gallery2 into cm-13.0
Change-Id: Ib8caa024d2e6feca332e3645038f226fd5a910a2
Diffstat (limited to 'src/com/android/gallery3d/util/ViewGifImage.java')
-rwxr-xr-x | src/com/android/gallery3d/util/ViewGifImage.java | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/src/com/android/gallery3d/util/ViewGifImage.java b/src/com/android/gallery3d/util/ViewGifImage.java new file mode 100755 index 000000000..cdd509280 --- /dev/null +++ b/src/com/android/gallery3d/util/ViewGifImage.java @@ -0,0 +1,67 @@ +package com.android.gallery3d.util; + +import com.android.gallery3d.R; + +import android.app.Activity; +import android.content.res.Configuration; +import android.net.Uri; +import android.os.Bundle; +import android.os.Handler; +import android.os.Message; +import android.util.DisplayMetrics; +import android.view.ViewGroup.LayoutParams; +import android.widget.ImageView; +import android.widget.LinearLayout; + +public class ViewGifImage extends Activity { + private static final String TAG = "ViewGifImage"; + public static final String VIEW_GIF_ACTION = "com.android.gallery3d.VIEW_GIF"; + + public static DisplayMetrics mDM; + + private ImageView mGifView; + + @Override + public void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.view_gif_image); + mDM = new DisplayMetrics(); + getWindowManager().getDefaultDisplay().getMetrics(mDM); + if (getIntent().getAction() != null + && getIntent().getAction().equals(VIEW_GIF_ACTION)) { + Uri gifUri = getIntent().getData(); + showGifPicture(gifUri); + } + } + + @Override + protected void onStop() { + super.onStop(); + finish(); + } + + @Override + protected void onDestroy() { + if (mGifView != null && mGifView instanceof GIFView) { + ((GIFView) mGifView).freeMemory(); + mGifView = null; + } + super.onDestroy(); + } + + private void showGifPicture(Uri uri) { + mGifView = new GIFView(this); + ((LinearLayout) findViewById(R.id.image_absoluteLayout)).addView(mGifView, + new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT)); + if (((GIFView) mGifView).setDrawable(uri)) return; + + finish(); + + } + + @Override + public void onConfigurationChanged(Configuration newConfig) { + getWindowManager().getDefaultDisplay().getMetrics(mDM); + super.onConfigurationChanged(newConfig); + } +} |