android - How the progress bar of Git Hub app is implemented -
when trying implement progress bar. came across git hub application implements fabulous progress bar spinner. curious how it. how calling spinner in app such way other part of activiy ui loads part of activity ie 1 probabalyfetched server shows spinner. since git hubis open source software able browse code. couldnt undrstand much.
gihub app source code know how implementing progress bar.
it regular progressbar
custom style. e.g.
https://github.com/github/android/blob/master/app/res/layout/progress_dialog.xml
<progressbar android:id="@+id/pb_loading" style="@style/spinner" android:layout_width="48dp" android:layout_height="48dp" />
defines should use spinner
style defined as
https://github.com/github/android/blob/master/app/res/values/styles.xml
<style name="spinner"> <item name="android:indeterminate">true</item> <item name="android:indeterminatedrawable">@drawable/spinner</item> <item name="android:indeterminateduration">2000</item> <item name="android:indeterminateonly">true</item> </style>
that style defines custom drawable used defined 2 part layerlist.
https://github.com/github/android/blob/master/app/res/drawable/spinner.xml
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" > <item android:drawable="@drawable/spinner_inner"/> <item> <rotate android:fromdegrees="0" android:interpolator="@android:anim/linear_interpolator" android:pivotx="50%" android:pivoty="50%" android:todegrees="360" > <bitmap android:antialias="true" android:filter="true" android:src="@drawable/spinner_outer" /> </rotate> </item> </layer-list>
the inner image cat logo, outer images set rotate 360° dashed circle.
Comments
Post a Comment