$ keytool -genkey -v -keystore debug.keystore -storepass android -alias androiddebugkey -keypass android -keyalg RSA -keysize 2048 -validity 10000 -dname "C=US, O=Android, CN=Android Debug"
This file contains hidden or 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
| class TextMultiStateView : LinearLayout { | |
| lateinit var text: TextView | |
| lateinit var progress: ProgressBar | |
| lateinit var image: ImageView | |
| constructor(context: Context) : super(context) { | |
| init(context) | |
| } | |
| constructor(context: Context, attrs: AttributeSet) : super(context, attrs) { |
This file contains hidden or 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
| fun setText(text: String) { | |
| this.text.text = text | |
| } | |
| fun setState(state: State) { | |
| when (state) { | |
| State.DISABLED -> { | |
| image.setImageDrawable(resources.getDrawable(R.drawable.ic_more)) | |
| image.visibility = View.VISIBLE | |
| progress.visibility = View.GONE |
This file contains hidden or 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
| <com.rygelouv.fragmentstepperproject.testcustomviews.TextMultiStateView | |
| android:id="@+id/text1" | |
| android:layout_width="wrap_content" | |
| android:layout_height="wrap_content" | |
| android:gravity="center" | |
| android:layout_marginTop="16dp" | |
| /> |
This file contains hidden or 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
| text1.text.text = "Upload profile picture" | |
| text2.text.text = "Upload document" | |
| text3.text.text = "Validate process" | |
| text1.setState(State.LOADING) | |
| // We simulate a running task | |
| Handler().postDelayed({ | |
| text1.setState(State.DONE) | |
| }, 1000) |
This file contains hidden or 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
| <?xml version="1.0" encoding="utf-8"?> | |
| <merge xmlns:android="http://schemas.android.com/apk/res/android" | |
| xmlns:tools="http://schemas.android.com/tools" | |
| xmlns:app="http://schemas.android.com/apk/res-auto" | |
| android:layout_width="match_parent" | |
| android:layout_height="wrap_content" | |
| android:orientation="horizontal" | |
| android:layout_gravity="center_vertical" | |
| android:gravity="center" | |
| > |
This file contains hidden or 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
| interface PostService { | |
| @GET("posts/list") | |
| fun getPostList(): Deferred<Response<PostResponse>> | |
| } |
This file contains hidden or 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
| data class PostResponse(val data: List<Post>): BaseApiResponse() | |
| abstract class BaseApiResponse { | |
| var status: Int = 0 | |
| var message: String? = null | |
| } |
This file contains hidden or 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
| val postListResponse = PostsAPI.postService.getPostList().awaitResult().getOrThrow() |
This file contains hidden or 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
| try { | |
| val postListResponse = PostsAPI.postService.getPostList().awaitResult().getOrThrow() | |
| // Do something with the data you got | |
| } | |
| catch (e: Exception) { | |
| // Handle the error case | |
| } |