android-jetpack

How to update a single item in a PagedListAdapter

与世无争的帅哥 提交于 2020-05-15 10:11:03
问题 I've implemented the new PagedListAdapter with an ItemKeyedDataSource. My list contains feed items with a like button. A click on the like button should refresh the item. To refresh my list item on a like button click, i update the state in my Firestore back-end, and call invalidate on my ItemKeyedDataSource. But this will refresh my whole list while jumping back to the top of my list. I wasn't sure if this is normal behaviour, so i went debugging and checking maiby my DiffUtil.ItemCallback

How to update a single item in a PagedListAdapter

亡梦爱人 提交于 2020-05-15 10:10:08
问题 I've implemented the new PagedListAdapter with an ItemKeyedDataSource. My list contains feed items with a like button. A click on the like button should refresh the item. To refresh my list item on a like button click, i update the state in my Firestore back-end, and call invalidate on my ItemKeyedDataSource. But this will refresh my whole list while jumping back to the top of my list. I wasn't sure if this is normal behaviour, so i went debugging and checking maiby my DiffUtil.ItemCallback

Is it possible to change up button icon in Navigation Component?

给你一囗甜甜゛ 提交于 2020-05-15 06:53:05
问题 I would like to change up button icon in ActionBar that is working with Navigation Component. I've tried several options like: supportActionBar?.setHomeAsUpIndicator(R.drawable.ic_arrow_left_blue_24dp) in MainAcitivty or app:navigationIcon="@drawable/ic_arrow_left_blue_24dp" in Toolbar .xml file and nothing seems to work. I have a pretty standard setup with setSupportActionBar(appToolbar.toolbar) setupActionBarWithNavController(this, navController) called in MainActivity:onCreate method. I

How do I define default animations for Navigation Actions?

巧了我就是萌 提交于 2020-05-09 19:26:13
问题 I'm using Android Studio 3.2 Canary 14 and The Navigation Architecture Component. With this you can define transition animations pretty much as you would when using Intents. But the animations are set as properties of the actions in the navigation graph, like so: <fragment android:id="@+id/startScreenFragment" android:name="com.example.startScreen.StartScreenFragment" android:label="fragment_start_screen" tools:layout="@layout/fragment_start_screen" > <action android:id="@+id/action

setupWithNavController method for toolbar no longer available?

二次信任 提交于 2020-04-18 05:44:29
问题 so previously I had crash with error: You must call setGraph() before calling getGraph() then after reading the solution frem here. it is said that I have to use these lines on my gradle implementation "androidx.navigation:navigation-fragment:2.3.0-alpha02" implementation "androidx.navigation:navigation-ui:2.3.0-alpha02" and the error is dissapear. but now I no longer can find setupWithNavController method. usually I use this line toolbar.setupWithNavController(navController

setupWithNavController method for toolbar no longer available?

北城以北 提交于 2020-04-18 05:44:13
问题 so previously I had crash with error: You must call setGraph() before calling getGraph() then after reading the solution frem here. it is said that I have to use these lines on my gradle implementation "androidx.navigation:navigation-fragment:2.3.0-alpha02" implementation "androidx.navigation:navigation-ui:2.3.0-alpha02" and the error is dissapear. but now I no longer can find setupWithNavController method. usually I use this line toolbar.setupWithNavController(navController

why my map livedata is not called even though I have change the value?

此生再无相见时 提交于 2020-04-18 05:27:44
问题 I am new in MVVM and Android Architecture component. so I have repository like this object RestaurantRepository { val restaurants : LiveData<ArrayList<Restaurant>> = RestaurantClient.restaurants private var count : LiveData<Int> = Transformations.map(restaurants) { Log.d("debugLog","map") it.size } fun searchRestaurants(query: String, latitude:Double, longitude: Double) { mQuery = query RestaurantClient.searchRestaurants( query = query, latitude = latitude, longitude = longitude, start = 0 )

how to remove back button in the toolbar of top level fragment if I set toolbar in each fragment using navigation component?

旧城冷巷雨未停 提交于 2020-04-17 21:59:36
问题 I have tried to read this but my problem is little bit different. I need some different toolbars, so according the documentation from here , I need to set the toolbar in each of my fragment not in my MainActivity. so I set the toolbar in each xml of my fragment. and then in each fragment I use this code to set the toolbar override fun onViewCreated(view: View, savedInstanceState: Bundle?) { super.onViewCreated(view, savedInstanceState) val toolbar = view.findViewById<androidx.appcompat.widget

how to remove back button in the toolbar of top level fragment if I set toolbar in each fragment using navigation component?

混江龙づ霸主 提交于 2020-04-17 21:58:48
问题 I have tried to read this but my problem is little bit different. I need some different toolbars, so according the documentation from here , I need to set the toolbar in each of my fragment not in my MainActivity. so I set the toolbar in each xml of my fragment. and then in each fragment I use this code to set the toolbar override fun onViewCreated(view: View, savedInstanceState: Bundle?) { super.onViewCreated(view, savedInstanceState) val toolbar = view.findViewById<androidx.appcompat.widget

how to remove back button in the toolbar of top level fragment if I set toolbar in each fragment using navigation component?

℡╲_俬逩灬. 提交于 2020-04-17 21:56:19
问题 I have tried to read this but my problem is little bit different. I need some different toolbars, so according the documentation from here , I need to set the toolbar in each of my fragment not in my MainActivity. so I set the toolbar in each xml of my fragment. and then in each fragment I use this code to set the toolbar override fun onViewCreated(view: View, savedInstanceState: Bundle?) { super.onViewCreated(view, savedInstanceState) val toolbar = view.findViewById<androidx.appcompat.widget