android-jetpack

How to send search suggestions dynamically to data source and get updated pagelist in Android jetpack paging library?

狂风中的少年 提交于 2020-01-06 07:56:08
问题 How to send search suggestions dynamically to data source's retrofit params and get updated pagedlist in Android jetpack paging library? Here's my web function in retrofit web service that brings data. @GET(version + "/get-bills") Call<ApiResponse<BillsModel>> getPartnerBillsSorted(@Query("page")int page, @Query("type")int type,@Query("search")String search ); This api is being called in data source and it gives me listing of all data, which i am listing in reyclerview using pagedlist. But i

Hide Toolbar back arrow with NavigationComponent and BottomNavigationView

北城余情 提交于 2020-01-06 06:46:45
问题 I'm in the process of implementing NavigationComponent coupled with a BottomNavigationView and I am noticing that the back arrow is shown in the toolbar for all fragment destinations except the one specified as the startDestination in my navigation graph. All examples of this implementation that I've been able to find show similar behavior. Hiding the back arrow for each associated fragment of a BottomNavigationView seems like a more natural design in my opinion, (hitting a back arrow in the

Android Navcontroller hardware back button crash

ぃ、小莉子 提交于 2020-01-06 02:35:22
问题 I am using new android storyboard to create an application. The flow need to be like following: SplashFragment -> Fragment1 -> Fragment2 Following is the storyboard( navigation_main.xml ): <?xml version="1.0" encoding="utf-8"?> <navigation xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/launch_navigation_graph" app:startDestination="@id/splashFragment"> <fragment

Shared element transition in Jetpack Navigation from RecyclerView to Detail Fragment

对着背影说爱祢 提交于 2020-01-04 05:09:31
问题 I'm trying to make a transition with simple animation of shared element between Fragments. In the first fragment I have elements in RecyclerView, in second - exactly the same element (defined in separate xml layout, in the list elements are also of this type) on top and details in the rest of the view. I'm giving various transitionNames for all elements in bindViewHolder and in onCreateView of target fragment I'm reading them and set them to element I want make transition. Anyway animation is

Livedata returned by Room won't be triggered after GC

試著忘記壹切 提交于 2020-01-02 19:20:10
问题 Our team are building a project with benefits from Android Jetpack. There are demo code showing the question we are facing. These code can be found at https://github.com/viseator/TestRoomLivedata I create a UserDao : @Dao interface UserDao { @Query("SELECT * FROM user WHERE uid = :uid LIMIT 1") fun findUserById(uid: String?): Single<User> @Query("SELECT * FROM user WHERE state = 1 LIMIT 1") fun findLoginUserWithObserve(): LiveData<User> @Query("SELECT * FROM user WHERE state =1 LIMIT 1") fun

PagedListAdapter jumps to beginning of the list on receiving new PagedList

﹥>﹥吖頭↗ 提交于 2020-01-01 03:02:27
问题 I'm using Paging Library to load data from network using ItemKeyedDataSource . After fetching items user can edit them, this updates are done inside in Memory cache (no database like Room is used). Now since the PagedList itself cannot be updated (discussed here) I have to recreate PagedList and pass it to the PagedListAdapter . The update itself is no problem but after updating the recyclerView with the new PagedList , the list jumps to the beginning of the list destroying previous scroll

BoundService + LiveData + ViewModel best practice in new Android recommended architecture

亡梦爱人 提交于 2019-12-31 08:43:17
问题 I been struggling a lot thinking about where to place Android Services in the new Android recommended Architecture. I came up with many possible solutions, but I cannot make up my mind about which one is the best approach. I did a lot of research, and I couldn't find any useful guideline nor tutorial. The only hint I found about where to place the Service in my app architecture is this one, from @JoseAlcerreca Medium post Ideally, ViewModels shouldn’t know anything about Android. This

How to prevent previous fragment to show up after pressing back button using navigation controller?

馋奶兔 提交于 2019-12-31 01:49:13
问题 I am trying to use the navigation controller right now. I want to move from LoginFragment to HomeFragment . In LoginFragment I use this code below to move to HomeFragment . Navigation.findNavController(view).navigate(homeDestination) However, when I tap the back button in the HomeFragment , it will go back to LoginFragment , I expect that when I tap the button it will close the app. In old way, if I use activity instead of using Fragment , I usually do something like this to get that expected

How to create LiveData which emits a single event and notifies only last subscribed observer?

北慕城南 提交于 2019-12-29 07:13:08
问题 I created live data which emits a single event as in this example. My question is next: How to notify only last subscribed observer when the value in the LiveData changes? What comes to my mind is to store observers in the linked list in SingleLiveData class and then to call super.observe only if a passed observer is the same as the last element of the list. I'm not sure if this is the best approach. I want to use this mechanism to propagate FAB click events from activity to the fragments

Dagger2: ViewModel cannot be provided without an @Provides-annotated method

偶尔善良 提交于 2019-12-25 03:02:38
问题 I am following the architecture used by GithubBrowserSample by Google. But facing troubles while building the project. I have migrated the project to AndroidX. I have tried many answers available on StackOverflow without success. Here is the build exception I am facing while building: e:/windows/Apps/Verifi/VerifiApp/app/build/tmp/kapt3/stubs/debug/com/verifi/di/component/AppComponent.java:11: error: [Dagger/MissingBinding] [dagger.android.AndroidInjector.inject(T)] java.util.Map<java.lang