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() {
 | 
					    private void updateList() {
 | 
				
			||||||
 | 
					        long startTime = System.currentTimeMillis();
 | 
				
			||||||
        lacertaLibrary.getRecentDocument(10).thenAccept(listItems -> {
 | 
					        lacertaLibrary.getRecentDocument(10).thenAccept(listItems -> {
 | 
				
			||||||
 | 
					            long endTime = System.currentTimeMillis();
 | 
				
			||||||
            if (listItems == null) {
 | 
					            if (listItems == null) {
 | 
				
			||||||
                return;
 | 
					                return;
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
            this.listItemAdapter.setListItems(listItems);
 | 
					            this.listItemAdapter.setListItems(listItems);
 | 
				
			||||||
            getActivity().runOnUiThread(() -> {
 | 
					            if (endTime - startTime > 500) { // 500ms以上かかった場合は表示アニメーションをする
 | 
				
			||||||
                Log.d("HomeTopFragment", "onViewCreated: " + listItems.size());
 | 
					                getActivity().runOnUiThread(() -> {
 | 
				
			||||||
                if (FeatureSwitch.RecyclerView.useSimpleNotifyMethod) {
 | 
					                    this.listItemAdapter.notifyItemRangeInserted(0, listItems.size());
 | 
				
			||||||
 | 
					                });
 | 
				
			||||||
 | 
					            } else {
 | 
				
			||||||
 | 
					                getActivity().runOnUiThread(() -> {
 | 
				
			||||||
                    this.listItemAdapter.notifyDataSetChanged();
 | 
					                    this.listItemAdapter.notifyDataSetChanged();
 | 
				
			||||||
                } else {
 | 
					                });
 | 
				
			||||||
                    // IndexOutOfBoundsExceptionを吐くことがあったので いったん
 | 
					            }
 | 
				
			||||||
                    this.listItemAdapter.notifyItemRangeInserted(0, listItems.size() - 1);
 | 
					 | 
				
			||||||
                }
 | 
					 | 
				
			||||||
            });
 | 
					 | 
				
			||||||
        });
 | 
					        });
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue
	
	Block a user