Souhail Marghabi
05/29/2020, 5:45 AMiex
05/29/2020, 8:04 AMIfvwm
05/29/2020, 8:34 AMT
05/29/2020, 12:01 PMdata class NewsData (
val author: String, val title: String,
val url: String, val publishedAt: String
)
class NewsViewModel : ViewModel() {
// The internal MutableLiveData String that stores the most recent response
private val _response = MutableLiveData<String>()
// The external immutable LiveData for the response String
val response: LiveData<String>
get() = _response
/**
* Call getNewsData() on init so we can display status immediately.
*/
init {
getNewsData()
}
/**
* Sets the value of the status LiveData to the News API status.
*/
private fun getNewsData() {
_response.value = NewsApi.retrofitService.getProperties().enqueue(
object : Callback<ResponseBody> {
override fun onFailure(call: Call<ResponseBody>, t: Throwable) {
_response.value = "Failure: " + t.message
//Log.i("response", t.message)
}
override fun onResponse(call: Call<ResponseBody>, response: Response<ResponseBody>) {
val root = JSONObject(response.body().toString())
val jsonArr = root.getJSONArray("articles")
val ob = jsonArr.getJSONObject(0)
val name = ob.getString("author")
_response.value = name
}
}).toString()
}
}
This is the format of the json response.Adam
05/29/2020, 1:38 PMT
05/29/2020, 10:17 PMAzhar
05/30/2020, 5:18 AMNikola Milovic
05/31/2020, 8:23 AMRemon Shehata
05/31/2020, 10:12 AMfor (item in statusList) {
Log.d(TAG, item)
filteredReport.filter { it.status == item }
}
Mohamed Ibrahim
05/31/2020, 7:33 PMtransaction.addSharedElement(buttonSignIn, buttonSignIn.transitionName)
.addSharedElement(socialSigninButtonContainer, socialSigninButtonContainer.transitionName)
.addSharedElement(signInInputsContainer, signInInputsContainer.transitionName)
.addSharedElement(textViewCopyright, textViewCopyright.transitionName)
val autoTransition = AutoTransition().also {
it.interpolator = AccelerateInterpolator()
}
fragment.allowEnterTransitionOverlap = true
fragment.allowReturnTransitionOverlap = true
fragment.sharedElementEnterTransition = autoTransition
the problem is I want to add a fading out/in animation with sync with the sliding oneVivekpanchal64
06/01/2020, 8:41 PMJavier
06/01/2020, 9:32 PMNikolay Puliaev
06/02/2020, 1:59 PMJoao Birk
06/02/2020, 7:13 PMoverride fun onNewIntent(intent: Intent) {
super.onNewIntent(intent)
if (currentNavController?.value?.handleDeepLink(intent) == false) {
...
}
}
I understand the problem, basically the currentNavController.value
which has the navigation_graph_2.xml
doesnt have such deep link set...how can I check if other graphs (tabs) support such deep link and then navigate to the desired tab?Diego Marulanda
06/03/2020, 1:45 AMKevin
06/03/2020, 5:53 AMElias
06/03/2020, 7:53 AMprivate val _foo: MutableLiveData<List<Foo>> = MutableLiveData()
private val _bar: MutableLiveData<List<Bar>> = MutableLiveData()
val fooBar: LiveData<List<FooBar>> = MediatorLiveData<List<FooBar>>.apply {
addSouce(_foo) { this.value = makeFooBarList() }
addSouce(_bar) { this.value = makeFooBarList() }
}
init {
loadFoo()
loadBar()
}
We have been struggling with the viewModel being updated twice or more, which sometimes messes with tests, and can make the views take longer than necessary to load.
Any tips and tricks are appreciated!sanket
06/03/2020, 2:05 PMTim
06/03/2020, 7:13 PMGalou Minisini
06/04/2020, 4:33 PMMichael Pohl
06/04/2020, 5:00 PMIvann Ruiz
06/05/2020, 3:48 AMandroidexpertmanish
06/05/2020, 9:27 AMGaurav K Tyagi 1
06/05/2020, 11:29 AMAnaniya
06/05/2020, 5:23 PMDeepti M
06/05/2020, 5:36 PMRemon Shehata
06/05/2020, 11:50 PMAzhar
06/06/2020, 8:26 AMApex
06/06/2020, 12:46 PMRemon Shehata
06/06/2020, 10:52 PMonSuccess
I can call the same function again and pass in the next user.
I think this would work but I am not sure it's the optimal way to do this..any ideas?Remon Shehata
06/06/2020, 10:52 PMonSuccess
I can call the same function again and pass in the next user.
I think this would work but I am not sure it's the optimal way to do this..any ideas?Adam Powell
06/06/2020, 11:11 PMRemon Shehata
06/06/2020, 11:30 PM