mirror of
				https://codeberg.org/tom79/Fedilab.git
				synced 2025-10-20 11:20:16 +03:00 
			
		
		
		
	some changes
This commit is contained in:
		
							parent
							
								
									c89cabdcb4
								
							
						
					
					
						commit
						dc9b31b4eb
					
				
					 2 changed files with 6 additions and 11 deletions
				
			
		|  | @ -243,9 +243,6 @@ public abstract class BaseMainActivity extends BaseActivity implements NetworkSt | ||||||
|             if (b != null) { |             if (b != null) { | ||||||
|                 if (b.getBoolean(Helper.RECEIVE_REDRAW_TOPBAR, false)) { |                 if (b.getBoolean(Helper.RECEIVE_REDRAW_TOPBAR, false)) { | ||||||
|                     List<MastodonList> mastodonLists = (List<MastodonList>) b.getSerializable(Helper.RECEIVE_MASTODON_LIST); |                     List<MastodonList> mastodonLists = (List<MastodonList>) b.getSerializable(Helper.RECEIVE_MASTODON_LIST); | ||||||
|                     if (mastodonLists != null && mastodonLists.size() == 0) { |  | ||||||
|                         mastodonLists = null; |  | ||||||
|                     } |  | ||||||
|                     redrawPinned(mastodonLists); |                     redrawPinned(mastodonLists); | ||||||
|                 } |                 } | ||||||
|                 if (b.getBoolean(Helper.RECEIVE_REDRAW_BOTTOM, false)) { |                 if (b.getBoolean(Helper.RECEIVE_REDRAW_BOTTOM, false)) { | ||||||
|  | @ -1227,12 +1224,8 @@ public abstract class BaseMainActivity extends BaseActivity implements NetworkSt | ||||||
|                             PinnedTimelineHelper.redrawTopBarPinned(BaseMainActivity.this, binding, pinned, bottomMenu, null); |                             PinnedTimelineHelper.redrawTopBarPinned(BaseMainActivity.this, binding, pinned, bottomMenu, null); | ||||||
|                             //Fetch remote lists for the authenticated account and update them |                             //Fetch remote lists for the authenticated account and update them | ||||||
|                             new ViewModelProvider(BaseMainActivity.this).get(TimelinesVM.class).getLists(currentInstance, currentToken) |                             new ViewModelProvider(BaseMainActivity.this).get(TimelinesVM.class).getLists(currentInstance, currentToken) | ||||||
|                                     .observe(this, mastodonLists -> { |                                     .observe(this, mastodonLists -> | ||||||
|                                         if (mastodonLists != null && mastodonLists.size() == 0) { |                                             PinnedTimelineHelper.redrawTopBarPinned(BaseMainActivity.this, binding, pinned, bottomMenu, mastodonLists) | ||||||
|                                             mastodonLists = null; |  | ||||||
|                                         } |  | ||||||
|                                                 PinnedTimelineHelper.redrawTopBarPinned(BaseMainActivity.this, binding, pinned, bottomMenu, mastodonLists); |  | ||||||
|                                             } |  | ||||||
|                                     ); |                                     ); | ||||||
|                         }); |                         }); | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -679,13 +679,14 @@ public class TimelinesVM extends AndroidViewModel { | ||||||
|     public LiveData<List<MastodonList>> getLists(@NonNull String instance, String token) { |     public LiveData<List<MastodonList>> getLists(@NonNull String instance, String token) { | ||||||
|         mastodonListListMutableLiveData = new MutableLiveData<>(); |         mastodonListListMutableLiveData = new MutableLiveData<>(); | ||||||
|         MastodonTimelinesService mastodonTimelinesService = init(instance); |         MastodonTimelinesService mastodonTimelinesService = init(instance); | ||||||
|         List<MastodonList> mastodonListList = new ArrayList<>(); |  | ||||||
|         new Thread(() -> { |         new Thread(() -> { | ||||||
|  |             List<MastodonList> mastodonListList = null; | ||||||
|             Call<List<MastodonList>> getListsCall = mastodonTimelinesService.getLists(token); |             Call<List<MastodonList>> getListsCall = mastodonTimelinesService.getLists(token); | ||||||
|             if (getListsCall != null) { |             if (getListsCall != null) { | ||||||
|                 try { |                 try { | ||||||
|                     Response<List<MastodonList>> getListsResponse = getListsCall.execute(); |                     Response<List<MastodonList>> getListsResponse = getListsCall.execute(); | ||||||
|                     if (getListsResponse.isSuccessful()) { |                     if (getListsResponse.isSuccessful()) { | ||||||
|  |                         mastodonListList = new ArrayList<>(); | ||||||
|                         List<MastodonList> mastodonLists = getListsResponse.body(); |                         List<MastodonList> mastodonLists = getListsResponse.body(); | ||||||
|                         if (mastodonLists != null) { |                         if (mastodonLists != null) { | ||||||
|                             mastodonListList.addAll(mastodonLists); |                             mastodonListList.addAll(mastodonLists); | ||||||
|  | @ -696,7 +697,8 @@ public class TimelinesVM extends AndroidViewModel { | ||||||
|                 } |                 } | ||||||
|             } |             } | ||||||
|             Handler mainHandler = new Handler(Looper.getMainLooper()); |             Handler mainHandler = new Handler(Looper.getMainLooper()); | ||||||
|             Runnable myRunnable = () -> mastodonListListMutableLiveData.setValue(mastodonListList); |             List<MastodonList> finalMastodonListList = mastodonListList; | ||||||
|  |             Runnable myRunnable = () -> mastodonListListMutableLiveData.setValue(finalMastodonListList); | ||||||
|             mainHandler.post(myRunnable); |             mainHandler.post(myRunnable); | ||||||
|         }).start(); |         }).start(); | ||||||
|         return mastodonListListMutableLiveData; |         return mastodonListListMutableLiveData; | ||||||
|  |  | ||||||
		Loading…
	
		Reference in a new issue