Skip to content

Commit

Permalink
Add tinting to sample.
Browse files Browse the repository at this point in the history
  • Loading branch information
zhanghai committed Oct 20, 2016
1 parent 95541b1 commit 1909145
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 12 deletions.
43 changes: 31 additions & 12 deletions sample/src/main/res/layout/main_activity.xml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
android:textAppearance="@style/TextAppearance.AppCompat.Caption" />

<ProgressBar
android:id="@+id/horizontal_progress_native"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:progress="30"
Expand All @@ -51,14 +50,30 @@
android:textAppearance="@style/TextAppearance.AppCompat.Caption" />

<me.zhanghai.android.materialprogressbar.MaterialProgressBar
android:id="@+id/horizontal_progress_library"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:progress="30"
android:secondaryProgress="60"
app:mpb_progressStyle="horizontal"
style="@style/Widget.MaterialProgressBar.ProgressBar.Horizontal" />

<TextView
android:text="@string/library_implementation_tinted"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textAppearance="@style/TextAppearance.AppCompat.Caption" />

<me.zhanghai.android.materialprogressbar.MaterialProgressBar
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:progress="30"
android:secondaryProgress="60"
app:mpb_progressStyle="horizontal"
app:mpb_progressTint="@color/tint"
app:mpb_secondaryProgressTint="@color/tint"
app:mpb_progressBackgroundTint="@color/tint"
style="@style/Widget.MaterialProgressBar.ProgressBar.Horizontal" />

<!-- Indeterminate horizontal progress -->

<TextView
Expand All @@ -74,7 +89,6 @@
android:textAppearance="@style/TextAppearance.AppCompat.Caption" />

<ProgressBar
android:id="@+id/indeterminate_horizontal_progress_native"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:indeterminate="true"
Expand All @@ -87,13 +101,26 @@
android:textAppearance="@style/TextAppearance.AppCompat.Caption" />

<me.zhanghai.android.materialprogressbar.MaterialProgressBar
android:id="@+id/indeterminate_horizontal_progress_library"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:indeterminate="true"
app:mpb_progressStyle="horizontal"
style="@style/Widget.MaterialProgressBar.ProgressBar.Horizontal" />

<TextView
android:text="@string/library_implementation_tinted"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textAppearance="@style/TextAppearance.AppCompat.Caption" />

<me.zhanghai.android.materialprogressbar.MaterialProgressBar
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:indeterminate="true"
app:mpb_progressStyle="horizontal"
app:mpb_indeterminateTint="@color/tint"
style="@style/Widget.MaterialProgressBar.ProgressBar.Horizontal" />

<!-- Indeterminate progress -->

<TextView
Expand All @@ -113,23 +140,20 @@
android:layout_height="wrap_content">

<ProgressBar
android:id="@+id/indeterminate_progress_large_native"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="left|bottom"
android:indeterminate="true"
style="?android:progressBarStyleLarge" />

<ProgressBar
android:id="@+id/indeterminate_progress_native"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal|bottom"
android:indeterminate="true"
style="?android:progressBarStyle" />

<ProgressBar
android:id="@+id/indeterminate_progress_small_native"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="right|bottom"
Expand All @@ -148,23 +172,20 @@
android:layout_height="wrap_content">

<me.zhanghai.android.materialprogressbar.MaterialProgressBar
android:id="@+id/indeterminate_progress_large_library"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="left|bottom"
android:indeterminate="true"
style="@style/Widget.MaterialProgressBar.ProgressBar.Large" />

<me.zhanghai.android.materialprogressbar.MaterialProgressBar
android:id="@+id/indeterminate_progress_library"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal|bottom"
android:indeterminate="true"
style="@style/Widget.MaterialProgressBar.ProgressBar" />

<me.zhanghai.android.materialprogressbar.MaterialProgressBar
android:id="@+id/indeterminate_progress_small_library"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="right|bottom"
Expand Down Expand Up @@ -204,7 +225,6 @@
</FrameLayout>

<me.zhanghai.android.materialprogressbar.MaterialProgressBar
android:id="@+id/horizontal_progress_toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
Expand Down Expand Up @@ -240,7 +260,6 @@
</FrameLayout>

<me.zhanghai.android.materialprogressbar.MaterialProgressBar
android:id="@+id/indeterminate_horizontal_progress_toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
Expand Down
10 changes: 10 additions & 0 deletions sample/src/main/res/values/colors.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>

<!--
~ Copyright (c) 2016 Zhang Hai <[email protected]>
~ All Rights Reserved.
-->

<resources>
<color name="tint">#f44336</color>
</resources>
1 change: 1 addition & 0 deletions sample/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

<string name="native_implementation">Native Implementation</string>
<string name="library_implementation">Library Implementation</string>
<string name="library_implementation_tinted">Library Implementation (Tinted)</string>
<string name="horizontal_progress">Horizontal ProgressBar</string>
<string name="indeterminate_horizontal_progress">Indeterminate Horizontal ProgressBar</string>
<string name="indeterminate_progress">Indeterminate ProgressBar</string>
Expand Down

0 comments on commit 1909145

Please sign in to comment.