amar_1995
08/23/2020, 8:23 AMJohn Leeroy
08/24/2020, 2:25 AMursus
08/25/2020, 12:25 AMursus
08/29/2020, 12:03 AMMohamed Ibrahim
08/31/2020, 10:30 AMbuildSrc
or convert all .gradle
files to Kotlin dsl, preparing to refactor app to Modules?ursus
09/02/2020, 8:37 AMDaniele Segato
09/03/2020, 2:25 PMRodri Represa
09/08/2020, 1:55 PMstantronic
09/09/2020, 10:43 AMclass Activity(val delegate = ScreenDelegate()): AppCompatActivity(), Screen by delegate {
...methods
}
KayCee
09/10/2020, 8:54 AMursus
09/23/2020, 2:23 PMNick
10/01/2020, 2:22 PMChristopher Elías
10/02/2020, 1:42 PMNick
10/02/2020, 9:37 PMprotected val titleLiveData = MutableLiveData<String>()
fun getTitleLiveData(): LiveData<String> {
return titleLivaData
}
ursus
10/02/2020, 10:56 PMFlorina
10/07/2020, 8:52 AMJoan Colmenero
10/09/2020, 7:46 AMPablo
10/14/2020, 9:15 AMFlorian
10/15/2020, 2:49 PMursus
10/18/2020, 5:09 AMJoost Klitsie
10/21/2020, 12:56 PMFlorian
10/21/2020, 1:33 PMLiveData<Resource<T>>
, doesn't the fragment have to make too many decisions? I.e. what to do for each resultFlorian
10/23/2020, 8:11 AMmainViewModel.sessionManager.firebaseUser.observe(viewLifecycleOwner) {
if (it != null) {
previousSavedStateHandle.set(LOGIN_SUCCESSFUL, true)
binding.editTextEmail.clearFocus()
binding.editTextPassword.clearFocus()
findNavController().popBackStack()
}
}
The login method in the ViewModel looks like this:
fun login(email: String, password: String) {
if (email.isEmpty() || password.isEmpty()) {
viewModelScope.launch {
snackBarMessage.send("Please fill out all fields")
}
return
}
viewModelScope.launch {
_loginLoading.value = true
when (val result = authRepository.login(email, password)) {
is AsyncResult.Success -> {
val firebaseUser = sessionManager.firebaseUser.value!!
snackBarMessage.send("Logged in as ${firebaseUser.displayName}")
}
is AsyncResult.Error -> snackBarMessage.send(
result.throwable.localizedMessage ?: "Something went wrong"
)
}
_loginLoading.value = false
}
}
My question is about that confirmation snackbar ("Logged in as ${firebaseUser.displayName}"
). Does the code that triggers the snackbar belong into the when statement inside the ViewModel (where it is right now), or can/should I put it into the if (it != null)
block inside the fragment? I'm asking this because the latter option would get rid of the problem that the snackbar doesn't arrive early enough before the fragment is popped from the backstack. But I am not sure if showing a snackbar is considered "business logic" here and should be in the ViewModel.
(The snackbar event is send via a Kotlin channel here that the fragment reacts to)Simon Lin
10/23/2020, 9:25 AMGlobalScope.launch
?
// Fragment
override fun onPause() {
viewModel.leave()
}
// ViewModel
fun leave() {
GlobalScope.launch {
repository.leave()
}
}
Florian
10/24/2020, 4:56 PMFlorian
10/27/2020, 9:15 AMItemTouchHelper
in a Fragment. Is it okay to show the snackbar here directly or should the ViewModel trigger it via an event?
ItemTouchHelper(object :
ItemTouchHelper.SimpleCallback(0, ItemTouchHelper.LEFT or ItemTouchHelper.RIGHT) {
override fun onMove(
recyclerView: RecyclerView,
viewHolder: RecyclerView.ViewHolder,
target: RecyclerView.ViewHolder
): Boolean {
return false
}
override fun onSwiped(viewHolder: RecyclerView.ViewHolder, direction: Int) {
val task = taskAdapter.currentList[viewHolder.adapterPosition]
viewModel.deleteTask(task)
Snackbar.make(requireView(), "Task deleted", Snackbar.LENGTH_LONG)
.setAction("UNDO") {
viewModel.insertTask(task)
}
.show()
}
}).attachToRecyclerView(recyclerViewTasks)
TheDukerChip
10/28/2020, 5:44 AMprivate lateinit var binding: FragmentGardenBinding
Sometimes when activity is resumed, I'm getting the following crash and it's unable to reproduce
lateinit property binding has not been initialized
Rim Gazzah
11/02/2020, 2:37 PMBrady Aiello
11/18/2020, 3:14 AMursus
11/22/2020, 2:22 AMfun <T> get(klass: Class<T>): T = store.getOrNull(klass) ?: error("No such component '$klass' found")
issue is my release builds are obviously proguarded, so the exception logs obviously read "No such component 'ndsjadnjka.dqw.DWQ' found"
Is there a sane way around it other than whitelisting component classes to not have them renamed (which might or not be a security issue)?
Maybe somehow leverage firebase crashlytics already knowing the proguard mappings?ursus
11/22/2020, 2:22 AMfun <T> get(klass: Class<T>): T = store.getOrNull(klass) ?: error("No such component '$klass' found")
issue is my release builds are obviously proguarded, so the exception logs obviously read "No such component 'ndsjadnjka.dqw.DWQ' found"
Is there a sane way around it other than whitelisting component classes to not have them renamed (which might or not be a security issue)?
Maybe somehow leverage firebase crashlytics already knowing the proguard mappings?Tom Hermann
11/23/2020, 5:58 PMkeepnames
if it is important that value be human readable.
You could switch your store to work in terms of strings, and just pass the literal name of the store you want access to. e.g. store.get("users")
You may be able to deobfuscate using the mapping file, see: https://www.guardsquare.com/en/products/proguard/manual/retrace
I would opt for passing a literal string if you don’t want to fight classname obfuscation. I generally avoid using classnames for tags, logging, caching, etc unless I’m only doing it transiently within the scope of my process.ursus
11/25/2020, 8:05 PMTom Hermann
11/30/2020, 3:48 PM