mirror of
				https://github.com/lacerta-doc/Lacerta.git
				synced 2025-09-09 12:09:25 +00:00 
			
		
		
		
	表示アニメーションを500ms以上かかった場合のみに
This commit is contained in:
		
							parent
							
								
									58e74dbb16
								
							
						
					
					
						commit
						8a2b4ed12d
					
				| 
						 | 
				
			
			@ -106,20 +106,22 @@ public class HomeTopFragment extends Fragment {
 | 
			
		|||
    }
 | 
			
		||||
 | 
			
		||||
    private void updateList() {
 | 
			
		||||
        long startTime = System.currentTimeMillis();
 | 
			
		||||
        lacertaLibrary.getRecentDocument(10).thenAccept(listItems -> {
 | 
			
		||||
            long endTime = System.currentTimeMillis();
 | 
			
		||||
            if (listItems == null) {
 | 
			
		||||
                return;
 | 
			
		||||
            }
 | 
			
		||||
            this.listItemAdapter.setListItems(listItems);
 | 
			
		||||
            if (endTime - startTime > 500) { // 500ms以上かかった場合は表示アニメーションをする
 | 
			
		||||
                getActivity().runOnUiThread(() -> {
 | 
			
		||||
                Log.d("HomeTopFragment", "onViewCreated: " + listItems.size());
 | 
			
		||||
                if (FeatureSwitch.RecyclerView.useSimpleNotifyMethod) {
 | 
			
		||||
                    this.listItemAdapter.notifyDataSetChanged();
 | 
			
		||||
                } else {
 | 
			
		||||
                    // IndexOutOfBoundsExceptionを吐くことがあったので いったん
 | 
			
		||||
                    this.listItemAdapter.notifyItemRangeInserted(0, listItems.size() - 1);
 | 
			
		||||
                }
 | 
			
		||||
                    this.listItemAdapter.notifyItemRangeInserted(0, listItems.size());
 | 
			
		||||
                });
 | 
			
		||||
            } else {
 | 
			
		||||
                getActivity().runOnUiThread(() -> {
 | 
			
		||||
                    this.listItemAdapter.notifyDataSetChanged();
 | 
			
		||||
                });
 | 
			
		||||
            }
 | 
			
		||||
        });
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue
	
	Block a user