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 EventMediator<T> { | |
interface Input<T> { | |
fun bind(input: LiveData<T>) | |
} | |
interface Output<T> { | |
val onAction: LiveData<T> | |
} | |
val input: Input<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
data class UserMessage(val id: Long, val title: String, val message: String) | |
data class $name$UiState( | |
val userMessages: List<UserMessage> = kotlin.collections.emptyList(), | |
) | |
class $name$ViewModel : androidx.lifecycle.ViewModel() { | |
private val _uiState = kotlinx.coroutines.flow.MutableStateFlow($name$UiState()) | |
val uiState: kotlinx.coroutines.flow.StateFlow<$name$UiState> = _uiState | |
private fun showMessage(title: String, message: String) { |
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 Context.currentProcess(): ActivityManager.RunningAppProcessInfo? { | |
val manager = getSystemService<ActivityManager>()!! | |
val pid = android.os.Process.myPid() | |
return manager.runningAppProcesses.firstOrNull { it.pid == pid } | |
} | |
fun Context.isMainProcess(): Boolean { | |
val currentProcess = currentProcess() | |
return currentProcess?.processName == BuildConfig.APPLICATION_ID | |
} |
OlderNewer