Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Added basis of fade timer

  • Loading branch information...
commit ff2f634ddc1da9bde0446015d08b737a22123613 1 parent 4cdc84b
@matto1990 matto1990 authored
View
2  viewflow-example/.classpath
@@ -4,7 +4,7 @@
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="gen"/>
<classpathentry kind="src" path="org_taptwo_android_widget_viewflow_src"/>
- <classpathentry combineaccessrules="false" kind="src" path="/viewflow"/>
<classpathentry kind="src" path="viewflow_src"/>
+ <classpathentry combineaccessrules="false" kind="src" path="/viewflow"/>
<classpathentry kind="output" path="bin"/>
</classpath>
View
36 viewflow/src/org/taptwo/android/widget/CircleFlowIndicator.java
@@ -23,6 +23,7 @@
import android.graphics.Paint;
import android.graphics.Paint.Style;
import android.util.AttributeSet;
+import android.util.Log;
import android.view.View;
/**
@@ -43,12 +44,14 @@
public class CircleFlowIndicator extends View implements FlowIndicator {
private static final int STYLE_STROKE = 0;
private static final int STYLE_FILL = 1;
+
private float radius = 4;
private final Paint mPaintStroke = new Paint(Paint.ANTI_ALIAS_FLAG);
private final Paint mPaintActive = new Paint(Paint.ANTI_ALIAS_FLAG);
private ViewFlow viewFlow;
private int currentScroll = 0;
private int flowWidth = 0;
+ private FadeTimer timer;
/**
* Default constructor
@@ -109,6 +112,8 @@ public CircleFlowIndicator(Context context, AttributeSet attrs) {
// Retrieve the radius
radius = a.getDimension(R.styleable.CircleFlowIndicator_radius, 4.0f);
initColors(activeColor, inactiveColor, activeType, inactiveType);
+
+
}
private void initColors(int activeColor, int inactiveColor, int activeType,
@@ -182,6 +187,9 @@ public void onSwitched(View view, int position) {
*/
@Override
public void setViewFlow(ViewFlow view) {
+ timer = new FadeTimer();
+ timer.start();
+
viewFlow = view;
flowWidth = viewFlow.getWidth();
invalidate();
@@ -195,6 +203,7 @@ public void setViewFlow(ViewFlow view) {
*/
@Override
public void onScrolled(int h, int v, int oldh, int oldv) {
+ timer.resetTimer();
currentScroll = h;
flowWidth = viewFlow.getWidth();
invalidate();
@@ -293,4 +302,31 @@ public void setStrokeColor(int color) {
mPaintStroke.setColor(color);
invalidate();
}
+
+ // TODO: Stop this counting when view not in view
+ // TODO: Stop counting when limit hit
+ // TODO: Start animation when limit hit
+ private class FadeTimer extends Thread {
+ private int timer = 0;
+ private boolean _run = true;
+
+ public void resetTimer() {
+ Log.d("Circle", "Timer reset");
+ timer = 0;
+ }
+
+ @Override
+ public void run() {
+ while (_run) {
+ try {
+ Thread.sleep(1000);
+ timer++;
+ Log.d("Circle", "Timer\t" + timer);
+ } catch (InterruptedException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+ }
+ }
}
Please sign in to comment.
Something went wrong with that request. Please try again.