From 705b89a5002edb7fee3d9b353d783144ff9f09ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=82=8D=E3=82=80=E3=81=AD=E3=81=93?= Date: Thu, 25 Jan 2024 12:17:38 +0900 Subject: [PATCH] =?UTF-8?q?=E7=A7=BB=E6=A4=8D=E5=85=83=E5=89=8A=E9=99=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../shared/ui/LacertaSelectDirDialog.java | 47 -------------- .../LacertaSelectDirDialogEventListener.java | 5 -- .../shared/ui/SelectDirDialogItemAdapter.java | 63 ------------------- .../res/layout/lacerta_dialog_select_dir.xml | 28 --------- 4 files changed, 143 deletions(-) delete mode 100644 shared/ui/src/main/java/one/nem/lacerta/shared/ui/LacertaSelectDirDialog.java delete mode 100644 shared/ui/src/main/java/one/nem/lacerta/shared/ui/LacertaSelectDirDialogEventListener.java delete mode 100644 shared/ui/src/main/java/one/nem/lacerta/shared/ui/SelectDirDialogItemAdapter.java delete mode 100644 shared/ui/src/main/res/layout/lacerta_dialog_select_dir.xml diff --git a/shared/ui/src/main/java/one/nem/lacerta/shared/ui/LacertaSelectDirDialog.java b/shared/ui/src/main/java/one/nem/lacerta/shared/ui/LacertaSelectDirDialog.java deleted file mode 100644 index 4faebf45..00000000 --- a/shared/ui/src/main/java/one/nem/lacerta/shared/ui/LacertaSelectDirDialog.java +++ /dev/null @@ -1,47 +0,0 @@ -package one.nem.lacerta.shared.ui; - -import android.app.Dialog; -import android.os.Bundle; -import android.view.LayoutInflater; -import android.view.View; -import android.widget.Toast; - -import androidx.appcompat.widget.Toolbar; -import androidx.fragment.app.DialogFragment; -import androidx.recyclerview.widget.RecyclerView; - -import com.google.android.material.dialog.MaterialAlertDialogBuilder; - -public class LacertaSelectDirDialog extends DialogFragment { - - @Override - public Dialog onCreateDialog(Bundle savedInstanceState) { - MaterialAlertDialogBuilder builder = new MaterialAlertDialogBuilder(getActivity()); - LayoutInflater inflater = requireActivity().getLayoutInflater(); - View view = inflater.inflate(R.layout.lacerta_dialog_select_dir, null); - - RecyclerView recyclerView = view.findViewById(R.id.select_dir_recycler_view); - recyclerView.setHasFixedSize(true); - - SelectDirDialogItemAdapter adapter = new SelectDirDialogItemAdapter((name, itemId) -> { - Toast.makeText(getContext(), "Called", Toast.LENGTH_SHORT).show(); - dismiss(); - }); - recyclerView.setAdapter(adapter); - recyclerView.setLayoutManager(new androidx.recyclerview.widget.LinearLayoutManager(getContext())); - - Toolbar toolbar = view.findViewById(R.id.select_dir_toolbar); - toolbar.setNavigationOnClickListener(v -> { - Toast.makeText(getContext(), "Called", Toast.LENGTH_SHORT).show(); - dismiss(); - }); - - builder.setView(view); - - builder.setTitle("Select Directory"); - builder.setMessage("Please select a directory."); - builder.setPositiveButton("OK", null); - builder.setNegativeButton("Cancel", null); - return builder.create(); - } -} diff --git a/shared/ui/src/main/java/one/nem/lacerta/shared/ui/LacertaSelectDirDialogEventListener.java b/shared/ui/src/main/java/one/nem/lacerta/shared/ui/LacertaSelectDirDialogEventListener.java deleted file mode 100644 index a2fb8fdb..00000000 --- a/shared/ui/src/main/java/one/nem/lacerta/shared/ui/LacertaSelectDirDialogEventListener.java +++ /dev/null @@ -1,5 +0,0 @@ -package one.nem.lacerta.shared.ui; - -public interface LacertaSelectDirDialogEventListener { - void onDirSelected(String name, String itemId); -} diff --git a/shared/ui/src/main/java/one/nem/lacerta/shared/ui/SelectDirDialogItemAdapter.java b/shared/ui/src/main/java/one/nem/lacerta/shared/ui/SelectDirDialogItemAdapter.java deleted file mode 100644 index 81ffc6ec..00000000 --- a/shared/ui/src/main/java/one/nem/lacerta/shared/ui/SelectDirDialogItemAdapter.java +++ /dev/null @@ -1,63 +0,0 @@ -package one.nem.lacerta.shared.ui; - -import android.view.LayoutInflater; -import android.view.View; -import android.view.ViewGroup; -import android.widget.TextView; - -import androidx.annotation.NonNull; -import androidx.recyclerview.widget.RecyclerView; - -import java.util.ArrayList; - -import one.nem.lacerta.model.ListItem; - -public class SelectDirDialogItemAdapter extends RecyclerView.Adapter { - - ArrayList listItems; - LacertaSelectDirDialogEventListener listener; - - public SelectDirDialogItemAdapter(LacertaSelectDirDialogEventListener listener) { - this.listener = listener; - } - - public void setListItems(ArrayList listItems) { - this.listItems = listItems; - } - - @Override - public SelectDirDialogItemAdapter.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { - View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.common_list_item, parent, false); - return new SelectDirDialogItemAdapter.ViewHolder(view); - } - - @Override - public void onBindViewHolder(SelectDirDialogItemAdapter.ViewHolder holder, int position) { - ListItem listItem = listItems.get(position); - holder.title.setText(listItem.getTitle()); - holder.description.setText(listItem.getDescription()); - holder.itemView.setOnClickListener(v -> { - listener.onDirSelected(listItem.getTitle(), listItem.getItemId()); - }); - } - - @Override - public int getItemCount() { - return listItems.size(); - } - - public class ViewHolder extends RecyclerView.ViewHolder { - - TextView title; - TextView description; - - - public ViewHolder(@NonNull View itemView) { - super(itemView); - - title = itemView.findViewById(R.id.item_title); - description = itemView.findViewById(R.id.item_description); - - } - } -} diff --git a/shared/ui/src/main/res/layout/lacerta_dialog_select_dir.xml b/shared/ui/src/main/res/layout/lacerta_dialog_select_dir.xml deleted file mode 100644 index b62a4868..00000000 --- a/shared/ui/src/main/res/layout/lacerta_dialog_select_dir.xml +++ /dev/null @@ -1,28 +0,0 @@ - - - - - - - - - \ No newline at end of file