Create a mosaic with different colors by adding ID attributes and selecting individual elements. Use the background-color attribute.
Now you have all the tools to make a game!
But let's just practice using them for now.
- What variable do you change to make the ball fall faster? Try it!
- What variable can you change to make the ball fall further?
- Let's give our ball horizontal motion!
- Create a global var horizontalSpeed, assign it the value 1.
- Within the move function body, make another variable called previousLeft, assign it ball.offset().left.
- Then use offset() to change the ball's left offset.
This file contains 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
import android.annotation.TargetApi | |
import android.support.v4.view.animation.FastOutSlowInInterpolator | |
import android.support.v7.widget.RecyclerView | |
import android.transition.ChangeBounds | |
import android.transition.Fade | |
import android.transition.Transition | |
import android.transition.TransitionManager | |
import android.transition.TransitionSet | |
import android.view.View | |
import android.view.ViewGroup |
This file contains 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
import android.arch.lifecycle.ViewModelProvider | |
import android.arch.lifecycle.ViewModelStores | |
import android.support.v4.app.Fragment | |
/** | |
* Created by Shen on 2/4/2018. | |
*/ | |
object ViewModelProviderHelper { | |
fun forFragmentInActivity(fragment: Fragment): ViewModelProvider { |
This file contains 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
sealed class ViewState<T> { | |
class Init<T>: ViewState<T>() | |
class Error<T>: ViewState<T>() | |
class Empty<T>: ViewState<T>() | |
class Loading<T>: ViewState<T>() | |
class DataReady<T>(val data : T): ViewState<T>() | |
} |