-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Muhammad Saifullah Khan
committed
Oct 24, 2017
1 parent
7c30186
commit 592dab6
Showing
14 changed files
with
287 additions
and
228 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
78 changes: 78 additions & 0 deletions
78
app/src/main/java/pk/aspirasoft/tasbih/views/CounterView.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
package pk.aspirasoft.tasbih.views; | ||
|
||
import android.content.Context; | ||
import android.util.AttributeSet; | ||
import android.view.View; | ||
import android.widget.RelativeLayout; | ||
import android.widget.TextView; | ||
|
||
import com.github.lzyzsd.circleprogress.CircleProgress; | ||
import com.github.lzyzsd.circleprogress.DonutProgress; | ||
|
||
import pk.aspirasoft.tasbih.R; | ||
|
||
|
||
public class CounterView extends RelativeLayout { | ||
|
||
private int progress = 0; | ||
private int max = 100; | ||
|
||
private DonutProgress donutProgress; | ||
private CircleProgress circleProgress; | ||
|
||
public CounterView(Context context) { | ||
super(context); | ||
init(); | ||
} | ||
|
||
public CounterView(Context context, AttributeSet attrs) { | ||
super(context, attrs); | ||
init(); | ||
} | ||
|
||
public CounterView(Context context, AttributeSet attrs, int defStyleAttr) { | ||
super(context, attrs, defStyleAttr); | ||
init(); | ||
} | ||
|
||
private void init() { | ||
View.inflate(getContext(), R.layout.counter, this); | ||
|
||
donutProgress = findViewById(R.id.donut_progress); | ||
donutProgress.setProgress(progress); | ||
donutProgress.setMax(max); | ||
|
||
circleProgress = findViewById(R.id.circle_progress); | ||
circleProgress.setProgress(progress); | ||
circleProgress.setMax(max); | ||
} | ||
|
||
public int getProgress() { | ||
return progress; | ||
} | ||
|
||
public void setProgress(int progress) { | ||
this.progress = progress; | ||
|
||
donutProgress.setProgress(progress); | ||
circleProgress.setProgress(progress); | ||
} | ||
|
||
public int getMax() { | ||
return max; | ||
} | ||
|
||
public void setMax(int max) { | ||
this.max = max; | ||
|
||
donutProgress.setMax(max); | ||
circleProgress.setMax(max); | ||
} | ||
|
||
public void setCompleted(int completed) { | ||
String text = getResources().getString(R.string.label_finished, completed); | ||
|
||
TextView finished = findViewById(R.id.finished); | ||
finished.setText(text); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<shape xmlns:android="http://schemas.android.com/apk/res/android"> | ||
<corners android:radius="100dp" /> | ||
<solid android:color="@color/colorAccent" /> | ||
</shape> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||
xmlns:custom="http://schemas.android.com/apk/res-auto" | ||
android:layout_width="match_parent" | ||
android:layout_height="match_parent"> | ||
|
||
<com.github.lzyzsd.circleprogress.DonutProgress | ||
android:id="@+id/donut_progress" | ||
android:layout_width="match_parent" | ||
android:layout_height="match_parent" | ||
android:elevation="4dp" | ||
custom:donut_finished_color="#000" | ||
custom:donut_finished_stroke_width="10dp" | ||
custom:donut_max="33" | ||
custom:donut_progress="15" | ||
custom:donut_text="" | ||
custom:donut_unfinished_color="@android:color/darker_gray" | ||
custom:donut_unfinished_stroke_width="10dp" /> | ||
|
||
<com.github.lzyzsd.circleprogress.CircleProgress | ||
android:id="@+id/circle_progress" | ||
android:layout_width="match_parent" | ||
android:layout_height="match_parent" | ||
android:layout_margin="15dp" | ||
custom:circle_finished_color="@color/colorAccent" | ||
custom:circle_max="33" | ||
custom:circle_progress="15" | ||
custom:circle_suffix_text="" | ||
custom:circle_unfinished_color="#000" /> | ||
|
||
<TextView | ||
android:id="@+id/finished" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:layout_centerHorizontal="true" | ||
android:layout_marginTop="50dp" | ||
android:text="@string/label_finished" | ||
android:textStyle="bold" /> | ||
|
||
</RelativeLayout> | ||
|
Oops, something went wrong.