Skip to content

Instantly share code, notes, and snippets.

View sergei-mikhailovskii-idf's full-sized avatar
🦁
lion on the jeep

sergei-mikhailovskii-idf

🦁
lion on the jeep
View GitHub Profile
2020-08-04 12:36:32.970 9530-9661/es.moneyman D/OkHttp: --> GET https://qa-delivery-es-release.moneyman.ru/secure/loan/pay?payment=PLN
2020-08-04 12:36:32.970 9530-9661/es.moneyman D/OkHttp: User-Agent: ANDROID-APPLICATION
2020-08-04 12:36:32.970 9530-9661/es.moneyman D/OkHttp: --> END GET
2020-08-04 12:36:33.011 9530-9643/es.moneyman D/EGL_emulation: eglMakeCurrent: 0xe23ddb60: ver 2 0 (tinfo 0xe23df120)
2020-08-04 12:36:33.080 9530-9643/es.moneyman I/chatty: uid=10102(es.moneyman) RenderThread identical 1 line
2020-08-04 12:36:33.116 9530-9643/es.moneyman D/EGL_emulation: eglMakeCurrent: 0xe23ddb60: ver 2 0 (tinfo 0xe23df120)
2020-08-04 12:36:33.280 9530-9661/es.moneyman D/OkHttp: <-- 200 https://qa-delivery-es-release.moneyman.ru/secure/loan/pay?payment=PLN (309ms)
2020-08-04 12:36:33.280 9530-9661/es.moneyman D/OkHttp: server: nginx
2020-08-04 12:36:33.280 9530-9661/es.moneyman D/OkHttp: date: Tue, 04 Aug 2020 09:36:14 GMT
2020-08-04 12:36:33.281 9530-9661/es.moneyman D/OkHttp: content-type: text/html;cha
1) WebView is not loaded (after rasing targetSdk to 29): https://stackoverflow.com/questions/58061708/webview-targeting-29-not-showing-content
2) Orange button lines overlapping - change line height (it is 12 in styles by default)
3) WebView scrolls badly - override method in class, which extends WebView:
override fun onTouchEvent(event: MotionEvent?): Boolean {
requestDisallowInterceptTouchEvent(true)
return super.onTouchEvent(event)
}
class MainActivity : AppCompatActivity(){
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContent {
FitnestApp()
}
}
}
fun FitnestApp() {
val navController = rememberAnimatedNavController(AnimatedComposeNavigator())
FitnestTheme {
Scaffold(
bottomBar = { BottomBar(navController) },
topBar = { TopBar(navController) },
) {
AnimatedNavHost(
navController = navController,
startDestination = Route.Splash.screenName
@Composable
fun SplashScreen(navController: NavController) {
...
LaunchedEffect(key1 = null) {
launch {
viewModel.failureSharedFlow.collect {
// TODO - show snackbar with error message
}
}
}
@Composable
fun SnackbarDemo() {
val scaffoldState: ScaffoldState = rememberScaffoldState()
Scaffold(scaffoldState = scaffoldState) {
Button(onClick = {
scaffoldState.snackbarHostState.showSnackbar(
message = "This is your message",
actionLabel = "Do something"
)
}) {
internal class SnackbarDelegate(
var snackbarHostState: SnackbarHostState? = null,
var coroutineScope: CoroutineScope? = null
) {
fun showSnackbar(
message: String,
actionLabel: String? = null,
duration: SnackbarDuration = SnackbarDuration.Short
) {
fun FitnestApp() {
val snackbarDelegate: SnackbarDelegate by rememberInstance()
val scaffoldState = rememberScaffoldState()
snackbarDelegate.apply {
snackbarHostState = scaffoldState.snackbarHostState
coroutineScope = rememberCoroutineScope()
}
enum class SnackbarState {
DEFAULT,
ERROR
}
internal class SnackbarDelegate(
var snackbarHostState: SnackbarHostState? = null,
var coroutineScope: CoroutineScope? = null
) {
fun FitnestApp() {
val snackbarDelegate: SnackbarDelegate by rememberInstance()
val scaffoldState = rememberScaffoldState()
snackbarDelegate.apply {
snackbarHostState = scaffoldState.snackbarHostState
coroutineScope = rememberCoroutineScope()
}