Skip to content

Commit 03625ff

Browse files
committed
Process Line text aligment bug fixed
1 parent fae1d6a commit 03625ff

File tree

6 files changed

+46
-7
lines changed

6 files changed

+46
-7
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ A progress bar for my ongoing project.
88
via Gradle:
99

1010
dependencies {
11-
compile 'com.zekapp.library:progreswheelview:1.0.8'
11+
compile 'com.zekapp.library:progreswheelview:1.0.9'
1212
}
1313

1414
## Usage

app/src/main/java/com/app/progresswheel/MainActivity.java

+18-1
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,11 @@
55
import android.support.design.widget.Snackbar;
66
import android.support.v7.app.AppCompatActivity;
77
import android.support.v7.widget.Toolbar;
8-
import android.view.View;
98
import android.view.Menu;
109
import android.view.MenuItem;
10+
import android.view.View;
1111

12+
import com.app.progresviews.ProgressLine;
1213
import com.app.progresviews.ProgressWheel;
1314

1415
import java.text.DecimalFormat;
@@ -20,6 +21,9 @@ public class MainActivity extends AppCompatActivity {
2021
private int step = 20000;
2122
private DecimalFormat mformatter;
2223

24+
private ProgressLine mProgressLine;
25+
private int mValue = 90000;
26+
2327
@Override
2428
protected void onCreate(Bundle savedInstanceState) {
2529
super.onCreate(savedInstanceState);
@@ -38,6 +42,7 @@ public void onClick(View view) {
3842
});
3943

4044
mProgressWheel = (ProgressWheel) findViewById(R.id.progress);
45+
mProgressLine = (ProgressLine) findViewById(R.id.progress_line);
4146

4247
mformatter = new DecimalFormat("#,###,###");
4348

@@ -81,4 +86,16 @@ public void change(View view) {
8186
mProgressWheel.setPercentage(per = per + 72);
8287
mProgressWheel.setStepCountText(mformatter.format(step = step + 20000));
8388
}
89+
90+
public void changeLine(View view) {
91+
mValue += 10000;
92+
mProgressLine.setmValueText(String.valueOf(mValue));
93+
}
94+
95+
public void clearAllData(View view) {
96+
mValue = 0;
97+
per = 0;
98+
step = 0;
99+
mProgressLine.setmValueText(String.valueOf(mValue));
100+
}
84101
}

app/src/main/res/layout/content_main.xml

+19-3
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,25 @@
3434
android:orientation="horizontal"
3535
android:layout_centerInParent="true">
3636
<Button
37-
android:layout_width="wrap_content"
37+
android:layout_width="100dp"
3838
android:layout_height="wrap_content"
39-
android:text="Change"
40-
android:onClick="change"/>
39+
android:text="Change Wheel"
40+
android:onClick="change"
41+
android:layout_gravity="center_horizontal"/>
42+
43+
<Button
44+
android:layout_width="100dp"
45+
android:layout_height="wrap_content"
46+
android:text="Change Line"
47+
android:onClick="changeLine"
48+
android:layout_gravity="center_horizontal"/>
49+
50+
<Button
51+
android:layout_width="100dp"
52+
android:layout_height="wrap_content"
53+
android:text="Clear Data"
54+
android:onClick="clearAllData"
55+
android:layout_gravity="center_horizontal"/>
4156
</LinearLayout>
4257

4358

@@ -55,6 +70,7 @@
5570
android:layout_gravity="center_vertical"/>
5671

5772
<com.app.progresviews.ProgressLine
73+
android:id="@+id/progress_line"
5874
android:layout_width="0dp"
5975
android:layout_height="match_parent"
6076
android:layout_weight="0.9"

gradle.properties

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,4 @@
1515
# When configured, Gradle will run in incubating parallel mode.
1616
# This option should only be used with decoupled projects. More details, visit
1717
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
18-
# org.gradle.parallel=true
18+
# org.gradle.parallel=true

progreswheelview/build.gradle

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
apply plugin: 'com.android.library'
22

3-
def libVer = '1.0.8'
3+
def libVer = '1.0.9'
44

55
ext {
66
bintrayRepo = 'Maven'

progreswheelview/src/main/java/com/app/progresviews/ProgressLine.java

+6
Original file line numberDiff line numberDiff line change
@@ -200,16 +200,22 @@ public void setmDefText(String mDefText) {
200200

201201
public void setmValueText(int value) {
202202
this.mValueText = mformatter.format(value);
203+
setupBounds();
204+
setupPaints();
203205
invalidate();
204206
}
205207

206208
public void setmValueText(String value) {
207209
this.mValueText = value;
210+
setupBounds();
211+
setupPaints();
208212
invalidate();
209213
}
210214

211215
public void setmPercentage(int mPercentage) {
212216
this.mPercentage = mPercentage;
217+
setupBounds();
218+
setupPaints();
213219
calculateBarScale();
214220
invalidate();
215221
}

0 commit comments

Comments
 (0)