mirror of
https://github.com/lacerta-doc/Lacerta.git
synced 2024-11-23 00:13:16 +00:00
表示アニメーションを500ms以上かかった場合のみに
This commit is contained in:
parent
9d750b5244
commit
58e74dbb16
|
@ -214,16 +214,22 @@ public class LibraryPageFragment extends Fragment {
|
||||||
* RecyclerViewのアイテムとUIを更新する
|
* RecyclerViewのアイテムとUIを更新する
|
||||||
*/
|
*/
|
||||||
private void updateItem(String pageId) {
|
private void updateItem(String pageId) {
|
||||||
|
long startTime = System.currentTimeMillis();
|
||||||
lacertaLibrary.getLibraryPage(pageId, 10).thenAccept(libraryItemPage -> {
|
lacertaLibrary.getLibraryPage(pageId, 10).thenAccept(libraryItemPage -> {
|
||||||
|
long endTime = System.currentTimeMillis();
|
||||||
this.libraryItemPage = libraryItemPage;
|
this.libraryItemPage = libraryItemPage;
|
||||||
logger.debug("LibraryTopFragment", "Item selected! libraryItemPage.getListItems().size(): " + libraryItemPage.getListItems().size());
|
logger.debug("LibraryTopFragment", "Item selected! libraryItemPage.getListItems().size(): " + libraryItemPage.getListItems().size());
|
||||||
getActivity().runOnUiThread(() -> {
|
if (endTime - startTime > 500) { // 500ms以上かかった場合は表示アニメーションをする
|
||||||
listItemAdapter.notifyItemRangeRemoved(0, libraryItemPage.getListItems().size() - 1);
|
getActivity().runOnUiThread(() -> {
|
||||||
});
|
listItemAdapter.setLibraryItemPage(libraryItemPage);
|
||||||
listItemAdapter.setLibraryItemPage(libraryItemPage);
|
listItemAdapter.notifyItemRangeInserted(0, this.libraryItemPage.getListItems().size());
|
||||||
getActivity().runOnUiThread(() -> {
|
});
|
||||||
listItemAdapter.notifyItemRangeInserted(0, libraryItemPage.getListItems().size() - 1);
|
} else {
|
||||||
});
|
listItemAdapter.setLibraryItemPage(libraryItemPage);
|
||||||
|
getActivity().runOnUiThread(() -> {
|
||||||
|
listItemAdapter.notifyDataSetChanged();
|
||||||
|
});
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user