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 e673cf9..b1bdac0 100644 Binary files a/bin/gifview.jar and b/bin/gifview.jar differ diff --git a/res/drawable-mdpi/pause.png b/res/drawable-mdpi/pause.png new file mode 100644 index 0000000..c4f894c Binary files /dev/null and b/res/drawable-mdpi/pause.png differ diff --git a/res/layout/pause.xml b/res/layout/pause.xml new file mode 100644 index 0000000..53c8bda --- /dev/null +++ b/res/layout/pause.xml @@ -0,0 +1,14 @@ + + + + + + \ 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); + } + } +}