fbpx

WorkManager – PeriodicWorkRequest

WorkManager basics - Periodic request

Reading Time: 9 minutes In this WorkManager basics tutorial we are going to learn about how we can create PeriodicWorkRequest. It means, that the work going to run in the background periodically even if we have closed the application. Follow and like us:

WorkManager basics – One time request and chain

WorkManager basics - One time request

Reading Time: 13 minutes In this WorkManager basics tutorial we are going to learn about how we can create one time request and chain. It means, that the work will be fired only once until it finishes successfully, then the next work will be started in thet case. First, we gonna talk about how we can fire only one … Read more WorkManager basics – One time request and chain

Guessing Game – Play the game

Reading Time: 5 minutes

In this chapter of the Guessing Game tutorial we are going to implement the core part, which is how we can play the game. For this, we are going to create one more ViewModel. This ViewModel will contain the business logic about the game.

In the very last chapter (Guessing Game – ViewModel), we have implement a ViewModel class already, which is responsible to change the username, and store it indside of a LiveData.

First, we are going to create an enum. This enum will hold the 4 states of the game. Then, we gonna start the implementation of the GameViewModel, which will contain the business logic. It means, here we gonna generate the random numbe to guess, then compare this number to the number of the guess, show the result and start a new game. Inside of this ViewModel we gonna implement two more methods, which will help us to show and hide the soft keyboard after every guess.

So, let’s start coding! ๐Ÿ˜Ž

Read moreGuessing Game – Play the game

Follow and like us:

Guessing Game – ViewModel

Reading Time: 4 minutes

In this chapter of the Guessing Game tutorial we are going to implement the first ViewModel, which will be a helper to change in real time the username.

In the very last chapter we have implemented the Navigation Component. This Jetpack library is responsible for the navigation inside of the app.

In our case, we have implemented 2 destinations. The first is the GameFragment, the second is the bottom sheet dialog. We can open it by tapping on the TextView of the username, or by clicking on the pen icon. After that, we can write our username inside of the EditText, but still it won’t be changed in the app.

We are going to implement this functionality by using a ViewModel and a LiveData. This LiveData will hold the username, what we will bind to the TextView inside of the GameFragment using Data Binding with layout variables and layout expressions.

So, let’s start coding. ๐Ÿ˜Ž

Read moreGuessing Game – ViewModel

Follow and like us:

Guessing Game – Navigation Component

Reading Time: 5 minutes

In this chapter of the Guessing Game tutorial we are going to implement the Jetpack Navigation Component library to navigate between the fragments.

In our case we have only 2 fragments. First, it will help us to show the GameFragment at startup. Then, when we want to set our username, it will open up the ChangePlayerDialogFragment also, which is inherited from the BottomSheetDialogFragment class.

Read moreGuessing Game – Navigation Component

Follow and like us:

Guessing Game – Preparation

Reading Time: 6 minutes
In this chapter of the Guessing Game tutorial we are going to talk about the preparation of the game. It means, we are going to build up the user interfaces, then we are going to add the needed dependencies and we gonna enable the Data Binding as well.

After that, we are going ot create the navigation graph. Finally, we gonna show you how you can transform the original layout to use Data Binding. So, let’s start coding. ๐Ÿ˜Ž

Read moreGuessing Game – Preparation

Follow and like us:

stay informed!

Subscribe to receive exclusive content and notifications