処理修正

This commit is contained in:
ろむねこ 2024-01-25 14:12:10 +09:00
parent 20ecbeea5c
commit 232967c905
No known key found for this signature in database
GPG Key ID: FA1F39A1BA37D168

View File

@ -4,6 +4,7 @@ import android.app.Dialog;
import android.os.Bundle; import android.os.Bundle;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.widget.TextView;
import android.widget.Toast; import android.widget.Toast;
import androidx.appcompat.widget.Toolbar; import androidx.appcompat.widget.Toolbar;
@ -13,10 +14,13 @@ import androidx.recyclerview.widget.RecyclerView;
import com.google.android.material.dialog.MaterialAlertDialogBuilder; import com.google.android.material.dialog.MaterialAlertDialogBuilder;
import org.w3c.dom.Text;
import javax.inject.Inject; import javax.inject.Inject;
import dagger.hilt.android.AndroidEntryPoint; import dagger.hilt.android.AndroidEntryPoint;
import one.nem.lacerta.data.LacertaLibrary; import one.nem.lacerta.data.LacertaLibrary;
import one.nem.lacerta.model.ListItemType;
@AndroidEntryPoint @AndroidEntryPoint
public class LacertaSelectDirDialog extends DialogFragment { public class LacertaSelectDirDialog extends DialogFragment {
@ -28,6 +32,8 @@ public class LacertaSelectDirDialog extends DialogFragment {
private RecyclerView recyclerView; private RecyclerView recyclerView;
private TextView current_dir_text_view;
@Override @Override
public Dialog onCreateDialog(Bundle savedInstanceState) { public Dialog onCreateDialog(Bundle savedInstanceState) {
@ -38,6 +44,7 @@ public class LacertaSelectDirDialog extends DialogFragment {
View view = inflater.inflate(R.layout.lacerta_dialog_select_dir, null); View view = inflater.inflate(R.layout.lacerta_dialog_select_dir, null);
this.recyclerView = view.findViewById(R.id.select_dir_recycler_view); this.recyclerView = view.findViewById(R.id.select_dir_recycler_view);
this.current_dir_text_view = view.findViewById(R.id.current_dir_text_view);
this.adapter = new SelectDirDialogItemAdapter((name, itemId) -> { this.adapter = new SelectDirDialogItemAdapter((name, itemId) -> {
Toast.makeText(getContext(), "Called:" + name, Toast.LENGTH_SHORT).show(); Toast.makeText(getContext(), "Called:" + name, Toast.LENGTH_SHORT).show();
@ -57,6 +64,15 @@ public class LacertaSelectDirDialog extends DialogFragment {
} }
private void showRecyclerViewItem(String parent) { private void showRecyclerViewItem(String parent) {
lacertaLibrary.getPublicPath(parent, ListItemType.ITEM_TYPE_FOLDER).thenAccept(publicPath -> {
getActivity().runOnUiThread(() -> {
if (publicPath != null) {
current_dir_text_view.setText("/" + publicPath.getStringPath()); // TODO-rca: PublicPathの実装を修正する
} else {
current_dir_text_view.setText("/");
}
});
});
lacertaLibrary.getFolderList(parent).thenAccept(listItems -> { lacertaLibrary.getFolderList(parent).thenAccept(listItems -> {
getActivity().runOnUiThread(() -> { getActivity().runOnUiThread(() -> {
int currentCount = adapter.getItemCount(); int currentCount = adapter.getItemCount();