mirror of
https://github.com/lacerta-doc/Lacerta.git
synced 2024-11-26 09:43:15 +00:00
RecyclerViewDialog WIP
This commit is contained in:
parent
38a277c15e
commit
420197e5c3
|
@ -22,6 +22,7 @@ import javax.inject.Inject;
|
||||||
import dagger.hilt.android.AndroidEntryPoint;
|
import dagger.hilt.android.AndroidEntryPoint;
|
||||||
import one.nem.lacerta.data.Document;
|
import one.nem.lacerta.data.Document;
|
||||||
import one.nem.lacerta.model.document.page.Page;
|
import one.nem.lacerta.model.document.page.Page;
|
||||||
|
import one.nem.lacerta.shared.ui.LacertaSelectDirDialog;
|
||||||
import one.nem.lacerta.utils.FeatureSwitch;
|
import one.nem.lacerta.utils.FeatureSwitch;
|
||||||
import one.nem.lacerta.utils.LacertaLogger;
|
import one.nem.lacerta.utils.LacertaLogger;
|
||||||
import one.nem.lacerta.vcs.LacertaVcs;
|
import one.nem.lacerta.vcs.LacertaVcs;
|
||||||
|
@ -204,7 +205,10 @@ public class ViewerListFragment extends Fragment {
|
||||||
builder.show();
|
builder.show();
|
||||||
return true;
|
return true;
|
||||||
} else if (item.getItemId() == R.id.action_move) {
|
} else if (item.getItemId() == R.id.action_move) {
|
||||||
Toast.makeText(getContext(), "Work in progress", Toast.LENGTH_SHORT).show();
|
// Toast.makeText(getContext(), "Work in progress", Toast.LENGTH_SHORT).show();
|
||||||
|
|
||||||
|
LacertaSelectDirDialog lacertaSelectDirDialog = new LacertaSelectDirDialog();
|
||||||
|
lacertaSelectDirDialog.show(getParentFragmentManager(), "selectDirDialog");
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -2,8 +2,13 @@ package one.nem.lacerta.shared.ui;
|
||||||
|
|
||||||
import android.app.Dialog;
|
import android.app.Dialog;
|
||||||
import android.os.Bundle;
|
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.fragment.app.DialogFragment;
|
||||||
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
|
||||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
|
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
|
||||||
|
|
||||||
|
@ -12,6 +17,24 @@ public class LacertaSelectDirDialog extends DialogFragment {
|
||||||
@Override
|
@Override
|
||||||
public Dialog onCreateDialog(Bundle savedInstanceState) {
|
public Dialog onCreateDialog(Bundle savedInstanceState) {
|
||||||
MaterialAlertDialogBuilder builder = new MaterialAlertDialogBuilder(getActivity());
|
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();
|
||||||
|
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.setTitle("Select Directory");
|
||||||
builder.setMessage("Please select a directory.");
|
builder.setMessage("Please select a directory.");
|
||||||
builder.setPositiveButton("OK", null);
|
builder.setPositiveButton("OK", null);
|
||||||
|
|
|
@ -24,7 +24,7 @@ public class SelectDirDialogItemAdapter extends RecyclerView.Adapter<SelectDirDi
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getItemCount() {
|
public int getItemCount() {
|
||||||
return 3;
|
return 100;
|
||||||
}
|
}
|
||||||
|
|
||||||
public class ViewHolder extends RecyclerView.ViewHolder {
|
public class ViewHolder extends RecyclerView.ViewHolder {
|
||||||
|
|
|
@ -1,6 +1,28 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<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_width="match_parent"
|
||||||
android:layout_height="match_parent">
|
android:layout_height="match_parent"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
<!-- 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