Skip to content

Instantly share code, notes, and snippets.

Avatar
🎯
Focusing

Kosh Sergani k0shk0sh

🎯
Focusing
View GitHub Profile
@k0shk0sh
k0shk0sh / file.kt
Created Oct 13, 2018
Nested Fragments talking to their parent fragment via scoped Activity ViewModel
View file.kt
class ProfileActivityViewModel : ViewModel() {
val tabCounterLiveData = MutableLiveData<Pair<String, Long>>()
}
class ProfileActivity : AppCompatActivity() {
@Inject lateinit var viewModelFactory: ViewModelProvider.Factory
private val viewModel by lazy { ViewModelProviders.of(this, viewModelFactory).get(ProfileActivityViewModel::class.java) }
}
class ParentFragment : Fragment() {
@k0shk0sh
k0shk0sh / code.kt
Created Mar 4, 2018 — forked from chrisbanes/code.kt
Night Mode inflater
View code.kt
/*
* Copyright 2017 Google, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
View MainActivity.java
/*
* Copyright 2016 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
View keybase.md

Keybase proof

I hereby claim:

  • I am k0shk0sh on github.
  • I am imkosh (https://keybase.io/imkosh) on keybase.
  • I have a public key whose fingerprint is B21B 490E C3C3 1E29 FC36 A7D8 2950 DD2D A315 EE38

To claim this, I am signing this object:

You can’t perform that action at this time.