From 120a50ef73d0a4a2a71c8539eb7ad72dafd0f234 Mon Sep 17 00:00:00 2001 From: RoiSoleil Date: Sun, 23 Jun 2013 14:43:45 +0200 Subject: [PATCH] HG : Add GifViewLayout to be able to pause and see a Pause icon --- AndroidManifest.xml | 2 +- bin/AndroidManifest.xml | 2 +- bin/R.txt | 6 +- bin/gifview.jar | Bin 3335 -> 4678 bytes res/drawable-mdpi/pause.png | Bin 0 -> 1624 bytes res/layout/pause.xml | 14 +++++ res/values/strings.xml | 6 ++ src/org/roisoleil/gifview/GifViewLayout.java | 59 +++++++++++++++++++ 8 files changed, 86 insertions(+), 3 deletions(-) create mode 100644 res/drawable-mdpi/pause.png create mode 100644 res/layout/pause.xml create mode 100644 res/values/strings.xml create mode 100644 src/org/roisoleil/gifview/GifViewLayout.java diff --git a/AndroidManifest.xml b/AndroidManifest.xml index 781c8de..bf74a46 100644 --- a/AndroidManifest.xml +++ b/AndroidManifest.xml @@ -4,7 +4,7 @@ android:versionName="1.0" > \ No newline at end of file diff --git a/bin/AndroidManifest.xml b/bin/AndroidManifest.xml index 781c8de..bf74a46 100644 --- a/bin/AndroidManifest.xml +++ b/bin/AndroidManifest.xml @@ -4,7 +4,7 @@ android:versionName="1.0" > \ No newline at end of file diff --git a/bin/R.txt b/bin/R.txt index 75f85f2..155aa50 100644 --- a/bin/R.txt +++ b/bin/R.txt @@ -1,7 +1,11 @@ int attr gif 0x7f010000 int attr gifViewStyle 0x7f010002 int attr paused 0x7f010001 -int style Widget_GifView 0x7f020000 +int drawable pause 0x7f020000 +int layout pause 0x7f030000 +int string pause 0x7f040001 +int string play 0x7f040000 +int style Widget_GifView 0x7f050000 int[] styleable CustomTheme { 0x7f010002 } int styleable CustomTheme_gifViewStyle 0 int[] styleable GifView { 0x7f010000, 0x7f010001 } diff --git a/bin/gifview.jar b/bin/gifview.jar index e673cf914ec8a127bb1e528097012c0675f8190d..b1bdac0bb6474d2593801bb2d352aa2fbe5b926b 100644 GIT binary patch delta 1358 zcmY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x&?~cMy)FwzL>YuTUh_gz#I`m(VgG&3ryUtzcbrFRio#;!zHDoGg zo${-0A0h%A0Pm|Fr1KJ;AiZcQ^rfC_5qZQlkrIXJ<1RtUO(l9AA?NVhmmUL;mj40J W1E?Ca1SB;80000 + + + + + \ No newline at end of file diff --git a/res/values/strings.xml b/res/values/strings.xml new file mode 100644 index 0000000..425a107 --- /dev/null +++ b/res/values/strings.xml @@ -0,0 +1,6 @@ + + + Play + Pause + + diff --git a/src/org/roisoleil/gifview/GifViewLayout.java b/src/org/roisoleil/gifview/GifViewLayout.java new file mode 100644 index 0000000..6ce8036 --- /dev/null +++ b/src/org/roisoleil/gifview/GifViewLayout.java @@ -0,0 +1,59 @@ +package org.roisoleil.gifview; + +import android.content.Context; +import android.util.AttributeSet; +import android.view.LayoutInflater; +import android.view.View; +import android.view.View.OnClickListener; +import android.widget.FrameLayout; + +public class GifViewLayout extends FrameLayout implements OnClickListener { + + protected GifView mGifView; + + protected View mPauseView; + + public GifViewLayout(Context context) { + this(context, null); + } + + public GifViewLayout(Context context, AttributeSet attrs) { + this(context, attrs, 0); + } + + public GifViewLayout(Context context, AttributeSet attrs, int defStyle) { + super(context, attrs, defStyle); + mGifView = createGifView(context, attrs); + mPauseView = createPauseView(); + FrameLayout.LayoutParams params = new FrameLayout.LayoutParams( + LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT); + addView(mGifView, params); + addView(mPauseView, params); + } + + protected GifView createGifView(Context context, AttributeSet attrs) { + GifView gifView = new GifView(context, attrs, + R.styleable.CustomTheme_gifViewStyle); + gifView.setOnClickListener(this); + return gifView; + } + + protected View createPauseView() { + LayoutInflater layoutInflater = LayoutInflater.from(getContext()); + View view = layoutInflater.inflate(R.layout.pause, this, false); + view.setVisibility(View.GONE); + view.setOnClickListener(this); + return view; + } + + @Override + public void onClick(View v) { + if (mGifView.isPaused()) { + mPauseView.setVisibility(View.GONE); + mGifView.setPaused(false); + } else { + mPauseView.setVisibility(View.VISIBLE); + mGifView.setPaused(true); + } + } +}