実際にRevisionを表示するように

This commit is contained in:
r-ca 2024-01-27 16:09:26 +09:00
parent 87c913811b
commit f812e6c38e
No known key found for this signature in database
GPG Key ID: 6A72911AC73464A9

View File

@ -12,9 +12,26 @@ import androidx.recyclerview.widget.RecyclerView;
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
import javax.inject.Inject;
import dagger.hilt.android.AndroidEntryPoint;
import one.nem.lacerta.data.LacertaLibrary;
import one.nem.lacerta.utils.LacertaLogger;
import one.nem.lacerta.vcs.LacertaVcs;
import one.nem.lacerta.vcs.factory.LacertaVcsFactory;
@AndroidEntryPoint
public class LacertaSelectRevDialog extends DialogFragment {
@Inject
LacertaVcsFactory lacertaVcsFactory;
@Inject
LacertaLogger logger;
String title;
String documentId;
String message;
String negativeButtonText;
@ -25,6 +42,11 @@ public class LacertaSelectRevDialog extends DialogFragment {
return this;
}
public LacertaSelectRevDialog setDocumentId(String documentId) {
this.documentId = documentId;
return this;
}
public LacertaSelectRevDialog setMessage(String message) {
this.message = message;
return this;
@ -62,8 +84,21 @@ public class LacertaSelectRevDialog extends DialogFragment {
recyclerView.setAdapter(adapter);
recyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
builder.setView(view);
if (this.documentId == null) {
logger.error("SelectRevDialog", "documentId is null");
logger.e_code("0296fb0c-07a3-4971-a280-bd1a61461bb7");
Toast.makeText(getContext(), "Sorry, something went wrong", Toast.LENGTH_SHORT).show();
dismiss();
}
LacertaVcs lacertaVcs = lacertaVcsFactory.create(this.documentId);
lacertaVcs.getRevisionHistory().thenAccept(revList -> {
adapter.setRevList(revList);
adapter.notifyDataSetChanged(); // TODO-rca:時間に応じてアニメーションをつける
});
builder.setTitle(title == null ? "Select Rev" : title);
builder.setMessage(message == null ? "Select Rev" : message);
builder.setNegativeButton(negativeButtonText, (dialog, which) -> {