Slackbot
10/26/2019, 4:07 AMDanil Novoselov
10/26/2019, 10:14 AMfragmentManager.popBackStack()
. I did not put the B fragment to back stack, so I used fragmentTransaction.replace(...).commit()
. BUT! when use fragmentManager.popBackStack()
on fragment C I go to the fragment A, but fragment C is overdrawn over (or behind I do not understand) fragment A. Do we have a nice solution to manage this situation? I know, that we can use popBackStack()
for specific transaction, but I do need to put fragment B to backstackKhan
10/26/2019, 11:08 AMAveepsit Chowdhury
10/26/2019, 12:09 PMNikola Milovic
10/26/2019, 3:00 PMSrSouza
10/26/2019, 5:11 PMSergio C.
10/26/2019, 9:22 PMJ6ey
10/26/2019, 11:07 PMMirza Adil
10/27/2019, 9:08 AMAyden
10/27/2019, 9:18 AMshowProgressBar(visibility: Boolean)
function, this will toggle the ProgressBar visibility based on the value.
Then, I have a RecipeListActivity which extends BaseActivity that will send the boolean data type in the showProgressBar
when the button is clicked.
BaseActivity .kt
fun showProgressBar(visibility: Boolean) {
progressBar.visibility = if (visibility) View.INVISIBLE else View.VISIBLE
}
RecipeListActivity.kt
activity_content.test.setOnClickListener(View.OnClickListener { view ->
val visibility = view.visibility != View.VISIBLE
showProgressBar(visibility)
})
But right now the value of the visibility in the showProgressBar
is showing 8
or 0
instead of true or false.
Did I miss out anything?Aslam Hossin
10/28/2019, 2:19 AMDagger2
documentation is published officially
https://developer.android.com/training/dependency-injection/dagger-basicsvoddan
10/28/2019, 8:36 AMBacho Kurtanidze
10/28/2019, 9:46 AMBacho Kurtanidze
10/28/2019, 9:56 AMBigDisgrace
10/28/2019, 11:50 AMJohn
10/29/2019, 1:35 PMvapoyan
10/29/2019, 2:15 PMMockk
Hey Guys, In my current application I am using mockito for mocking, currently I want to switch to mockk, so right now I have a lot of code which look like
verify(loggingService, times(1)).log(any(), any())
is there a way to write wrapper method which will use mockk verify, so I I will not change all 8900 calls in my project ?Khan
10/29/2019, 4:02 PMLuca Nicoletti
10/30/2019, 8:47 AMLint
android provides by default?Saulnguyen
10/30/2019, 9:02 AMKulwinder Singh
10/30/2019, 11:58 AMviewModels
ktx extension function ?aidanvii
10/30/2019, 2:42 PM{}
) with null, and empty lists ([]
) with null. The pattern is as follows:
Regex("""\{}|\[]""")
This compiles and works just fine in a unit test, but on android it crashes with:
Caused by: java.util.regex.PatternSyntaxException: Syntax error in regexp pattern near index 3
\{}|\[]
^
at java.util.regex.Pattern.compileImpl(Native Method)
at java.util.regex.Pattern.compile(Pattern.java:1344)
at java.util.regex.Pattern.<init>(Pattern.java:1328)
at java.util.regex.Pattern.compile(Pattern.java:950)
at kotlin.text.Regex.<init>(Regex.kt:89)
All I can surmise from this is that the underlying native implementation on Android is different.theopaintsil
10/30/2019, 4:19 PMam414
10/30/2019, 8:01 PMAnastasia Finogenova
10/30/2019, 10:04 PMAnastasia Finogenova
10/30/2019, 10:05 PMAnastasia Finogenova
10/30/2019, 10:23 PMSomesh
10/31/2019, 6:15 AMRepository
and `ViewModel`'s livedata in-case of @GET
request and observe them in fragment.
I don't have this problem when the request type is @POST
because I can use Transformation.switchMap
on body and whenever the body changes repository's function gets invoked and emit value to the response live data something like this
val matchSetsDetail: LiveData<Resource<MatchDetailBean>> = Transformations.switchMap(matchIdLiveData) { matchId ->
val body = MatchSetRequest(matchId)
repository.getMatchSet(body)
}
but in case of @GET
request I have several query parameter the my View supplies
I have this retrofit API call in repository class and the code looks like this
fun checkInCheckOutUser(apiKey: String, userId: Int, status: String, latitude: Double, longitude: Double, checkedOn: Long): LiveData<Resource<BaseResponse>> = liveData {
emit(Resource.Loading())
try {
val response: Response<BaseResponse> = ApiClient.coachApi.checkInCheckOutUser(apiKey, userId, status, latitude, longitude, checkedOn)
if (response.isSuccessful && response.body() != null) {
if (response.body()!!.isValidKey && response.body()!!.success) {
emit(Resource.Success(response.body()!!))
} else {
emit(Resource.Failure(response.body()!!.message))
}
} else {
emit(Resource.Failure())
}
} catch (e: Exception) {
emit(Resource.Failure())
}
}
and ViewModel
class CheckInMapViewModel : ViewModel() {
val checkInResponse: LiveData<Resource<BaseResponse>> = MutableLiveData()
fun checkInCheckOut(apiKey: String, userId: Int, status: String, latitude: Double, longitude: Double, checkedOn: Long): LiveData<Resource<BaseResponse>> {
return repository.checkInCheckOutUser(apiKey,userId,status,latitude,longitude,checkedOn)
}
}
Main problem is I want to observe checkInResponse
but don't know how to pass repository's livedata same as I did with my post request above using Transformations.switchMap
. Can anyone help me with this case?James
10/31/2019, 9:14 AMharoldadmin
10/31/2019, 7:32 PM@Parcelize
data class State(
val userId: String = 1234,
val userResource: Resource<User> = Resource.Uninitialized
): Parcelable
I want to exclude the userResource
property from being Parcelized, as the Resource
class is not Parcelable.
Here is the warning I get from the IDE: Type is not directly supported by @Parcelize. Annotate the field with @RawValue if you want to be serialized using 'writeValue()'
@Transient
does not work, and neither does @IgnoreOnParcel
(I get the warning that it is not applicable on properties in primary constructor). Any way to solve this?haroldadmin
10/31/2019, 7:32 PM@Parcelize
data class State(
val userId: String = 1234,
val userResource: Resource<User> = Resource.Uninitialized
): Parcelable
I want to exclude the userResource
property from being Parcelized, as the Resource
class is not Parcelable.
Here is the warning I get from the IDE: Type is not directly supported by @Parcelize. Annotate the field with @RawValue if you want to be serialized using 'writeValue()'
@Transient
does not work, and neither does @IgnoreOnParcel
(I get the warning that it is not applicable on properties in primary constructor). Any way to solve this?nglauber
10/31/2019, 7:47 PMharoldadmin
10/31/2019, 8:02 PM@Parcelize
data class State(
val userId: Int = 1234
): Parcelable {
private lateinit var resource: Resource<User>
constructor(missionId: Int, userRes: Resource<User>) {
this.resource = userRes
}
}
This, of course is not great because I lose immutability (resource is now a var). Also, the auto-generated copy function does not accept secondary constructor params.nglauber
10/31/2019, 8:23 PMrkeazor
11/01/2019, 12:13 PM