直接サーバーから更新する方法を追加

This commit is contained in:
rca 2024-07-08 21:52:09 +09:00
parent 3650ca9b4d
commit 1c534adca4

View File

@ -132,7 +132,7 @@ public class ChildManageMainActivity extends AppCompatActivity {
Toast.makeText(this, "名前を入力してください", Toast.LENGTH_SHORT).show();
}
childData.addChild(new ChildModel(childName))
.thenRun(this::updateList);
.thenRun(this::updateListDirectly);
})
.setNegativeButton("キャンセル", (dialog, which) -> dialog.dismiss())
.show();
@ -159,4 +159,11 @@ public class ChildManageMainActivity extends AppCompatActivity {
runOnUiThread(() -> childListAdapter.notifyDataSetChanged());
});
}
@SuppressLint("NotifyDataSetChanged")
private void updateListDirectly() {
childData.getChildListDirect().thenAccept(childListAdapter::setChildList).thenRun(() -> {
runOnUiThread(() -> childListAdapter.notifyDataSetChanged());
});
}
}