For example, you want to set 40% alpha transparence to #000000 (black color), you need to add 66 like this #66000000.
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
| import androidx.lifecycle.Lifecycle | |
| import androidx.lifecycle.LifecycleObserver | |
| import androidx.lifecycle.OnLifecycleEvent | |
| class MVPLifecycleObserver<VIEW : BaseView<PRESENTER>, PRESENTER : BasePresenter<VIEW>>( | |
| private val view: VIEW, | |
| private val presenter: PRESENTER, | |
| private val retainedState: RetainedState | |
| ) : LifecycleObserver { |
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
| import androidx.lifecycle.SavedStateHandle | |
| import androidx.lifecycle.ViewModel | |
| class RetainedState(private val state: SavedStateHandle) : ViewModel() { | |
| fun <T> get(key: String): T? { | |
| return state.get(key) | |
| } | |
| fun <T> remove(key: String): T? { |
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 BaseView<PRESENTER> { | |
| fun getPresenter(): PRESENTER | |
| } |
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
| import androidx.annotation.CallSuper | |
| interface PresenterContract<VIEW> { | |
| fun attach(view: VIEW, retainedState: RetainedState) | |
| fun detach() | |
| fun onViewAttached() | |
| fun onViewDetached() | |
| } | |
| abstract class BasePresenter<VIEW>: PresenterContract<VIEW> { |
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 AppRepository { | |
| suspend fun getAppById(id: Long): AppDetail | |
| suspend fun getAppsByPublisher(publisherId: Long): List<AppDetail> | |
| } | |
| class AppApiRepository(private val api: AppApi) : AppRepository { | |
| override suspend fun getAppById(id: Long): AppDetail { /*...*/ } | |
| override suspend fun getAppsByPublisher(publisherId: Long): List<AppDetail> { /*...*/ } | |
| } |
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 AppDetail( | |
| val id: Long, | |
| val name: String, | |
| val description: String, | |
| val publisher: Publisher | |
| ) | |
| interface ResultCallback<T> { | |
| fun onSuccess(result: T) | |
| fun onError(exception: Exception) |
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 KataTest { | |
| @Test | |
| fun testStringInvokeOverride() { | |
| val arg = "somearg" | |
| val result = "SomeThing"(arg) | |
| assert.true(result, arg) | |
| } | |
| operator fun <T> String.invoke(arg : T) : T{ |
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"?> | |
| <android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" | |
| xmlns:app="http://schemas.android.com/apk/res-auto" | |
| android:layout_width="match_parent" | |
| android:layout_height="match_parent"> | |
| <View | |
| android:id="@+id/video_view" | |
| android:layout_width="0dp" | |
| android:layout_height="0dp" |
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
| Androind N | |
| - Notification badges | |
| - Wi-Fi Aware | |
| - Instant App | |
| Android | |
| - Wearables | |
| - Android TV | |
| - Android Studio tools & plugins | |
| Debugging Tips | |
| Optimization Tips |
NewerOlder