mirror of
https://github.com/lacerta-doc/Lacerta.git
synced 2024-11-23 00:13:16 +00:00
移植元削除
This commit is contained in:
parent
afa3460b24
commit
705b89a500
|
@ -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();
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,5 +0,0 @@
|
||||||
package one.nem.lacerta.shared.ui;
|
|
||||||
|
|
||||||
public interface LacertaSelectDirDialogEventListener {
|
|
||||||
void onDirSelected(String name, String itemId);
|
|
||||||
}
|
|
|
@ -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<SelectDirDialogItemAdapter.ViewHolder> {
|
|
||||||
|
|
||||||
ArrayList<ListItem> listItems;
|
|
||||||
LacertaSelectDirDialogEventListener listener;
|
|
||||||
|
|
||||||
public SelectDirDialogItemAdapter(LacertaSelectDirDialogEventListener listener) {
|
|
||||||
this.listener = listener;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setListItems(ArrayList<ListItem> 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);
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,28 +0,0 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:orientation="vertical">
|
|
||||||
|
|
||||||
<!-- Currentのタイトルと戻るボタン -->
|
|
||||||
<androidx.appcompat.widget.Toolbar
|
|
||||||
android:id="@+id/select_dir_toolbar"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="?attr/actionBarSize"
|
|
||||||
android:background="@color/colorSecondaryContainer"
|
|
||||||
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
|
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
|
||||||
app:popupTheme="@style/ThemeOverlay.AppCompat.Light" />
|
|
||||||
|
|
||||||
<androidx.recyclerview.widget.RecyclerView
|
|
||||||
android:id="@+id/select_dir_recycler_view"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:layout_margin="8dp"
|
|
||||||
android:background="@color/colorSurface"
|
|
||||||
android:padding="8dp"
|
|
||||||
android:scrollbars="vertical"
|
|
||||||
android:scrollbarStyle="outsideOverlay" />
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
Loading…
Reference in New Issue
Block a user