android-jetpack

Disabling the current tab in a bottom navigation controller

生来就可爱ヽ(ⅴ<●) 提交于 2020-01-30 03:16:38
问题 I'm using Jetpack Navigation to handle the bottom navigation controller. It works great; however, I am looking for a way to improve the UX. Is it possible to disable the tab that the user is currently navigated to? I'm able to "spam" the current tab in the bottom navigation, which reloads data & the UI unnecessarily. If this behavior (of re-tapping the current tab) is intended, is there a way to retain the state of the fragment, so that when navigated away & to, it doesn't recreate? How I

Disabling the current tab in a bottom navigation controller

守給你的承諾、 提交于 2020-01-30 03:15:11
问题 I'm using Jetpack Navigation to handle the bottom navigation controller. It works great; however, I am looking for a way to improve the UX. Is it possible to disable the tab that the user is currently navigated to? I'm able to "spam" the current tab in the bottom navigation, which reloads data & the UI unnecessarily. If this behavior (of re-tapping the current tab) is intended, is there a way to retain the state of the fragment, so that when navigated away & to, it doesn't recreate? How I

What's the minimum Android API level for using new Google's Jetpack components

爱⌒轻易说出口 提交于 2020-01-24 15:12:15
问题 I had started to learn RxJava that I knew there's some new Google's components like LiveData, Databinding, etc. I want to know what is the minimum Android's API level to use them. Can I leverage them for example in an older APIs like 21 or 23? 回答1: Right from the Docs https://developer.android.com/topic/libraries/support-library/. Starting with Support Library release 26.0.0 (July 2017), the minimum supported API level across most support libraries has increased to Android 4.0 (API level 14)

Biometric prompt not displayed on Android 6

限于喜欢 提交于 2020-01-23 10:32:28
问题 I am trying to use BiometricPrompt to use fingerprint sensor for authentication. My minimum supported sdk is 23 (Android M). It works on all android version I tested except for marshmallow. In marshmallow when I try to use authenticate method on button click it calls onAuthenticationError method from BiometricPrompt.AuthenticationCallback and it gives error code ERROR_HW_NOT_PRESENT and error messsage: This device does not have a fingerprint sensor even when device have fingerprint sensor and

Biometric prompt not displayed on Android 6

醉酒当歌 提交于 2020-01-23 10:32:28
问题 I am trying to use BiometricPrompt to use fingerprint sensor for authentication. My minimum supported sdk is 23 (Android M). It works on all android version I tested except for marshmallow. In marshmallow when I try to use authenticate method on button click it calls onAuthenticationError method from BiometricPrompt.AuthenticationCallback and it gives error code ERROR_HW_NOT_PRESENT and error messsage: This device does not have a fingerprint sensor even when device have fingerprint sensor and

New navigation component from arch with nested navigation graph

感情迁移 提交于 2020-01-22 04:14:27
问题 I have one case and wish to implement it by arch navigation component. For example I have 2 Nav Graphs (main and nested). Can I call main graph from nested and how? example 回答1: The point is to get the right NavController to navigate in the right graph. Let's take this scenario as an example: MainActivity |- MainNavHost |- NavBarFragment | |- NestedNavHost | | |-NestedContentFragment1 | | |-NestedContentFragment2 | | | |- BottomNavigationView | |- LoginFragment The main graph and the nested

Paging library returns empty list initially

﹥>﹥吖頭↗ 提交于 2020-01-21 04:05:29
问题 I'm using Paging library to paginate a list of items I'm retrieving from my server. Initially, when my fragment is loaded, it returns an empty list. But after changing fragments and going back to that fragment, I can see the list loaded. After debugging I saw that data was actually being fetched, but an empty list was passed to my fragment. ItemDataSource: @Override public void loadInitial(@NonNull LoadInitialParams<Integer> params, @NonNull LoadInitialCallback<Integer, Item> callback) {

How to change start destination of a navigation graph programmatically [Jetpack]

生来就可爱ヽ(ⅴ<●) 提交于 2020-01-20 02:09:47
问题 Basically, I have the following navigation graph: I want to change my starting point in navigation graph to fragment 2 right after reaching it (in order to prevent going back to fragment 1 when pressing back button - like with the splash screen). This is my code: navGraph = navController.getGraph(); navGraph.setStartDestination(R.id.fragment2); navController.setGraph(navGraph); But, obviously it's not working and it gets back to fragment 1 after pressing back button. Am I doing it wrong? Is

Bottom Navigation View With Navigation Control transaction failing some times

耗尽温柔 提交于 2020-01-16 09:03:12
问题 while moving from one tab to another tab on bottom navigation view some times i am getting the app theme color is applying to enter fragment like this is my code ``code from activity``` override fun onSupportNavigateUp() = NavigationUI.navigateUp(navController!!, null) private fun setUpNavigation() { navController = Navigation.findNavController(this, R.id.frameRoot) bottomNavigationView.setupWithNavController(navController) bottomNavigationView.setOnNavigationItemSelectedListener { item ->

how to remove default animation transition when using navigation component in Android?

安稳与你 提交于 2020-01-15 09:14:36
问题 I am using Navigation component, and I have a bottom navigation view in the main activity. when I tap the tab in that bottom navigation view, it seems that there is a fade in animation when the fragment appear. I don't think I manually set the animation, it seems that the animation will be there by default. I want to remove that animation. here is the code I use in my Main Activity. class MainActivity : AppCompatActivity(), NavController.OnDestinationChangedListener { private lateinit var