mirror of
https://github.com/lacerta-doc/Lacerta.git
synced 2026-11-08 03:47:36 +00:00
Compare commits
77
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1fb37a0317 | ||
|
|
57d1c7809c | ||
|
|
4158faf453 | ||
|
|
beef661e3b | ||
|
|
8329769028 | ||
|
|
49ac5c2ddc | ||
|
|
5645cf64b6 | ||
|
|
d76d0a02e2 | ||
|
|
719769c045 | ||
|
|
b0a0682561 | ||
|
|
3c75a04a5f | ||
|
|
0a0a4b56b9 | ||
|
|
d393087ff6 | ||
|
|
d691ee0126 | ||
|
|
e85c8a7ed0 | ||
|
|
c44fd3ae8b | ||
|
|
1a2cf77f62 | ||
|
|
19f6eb1683 | ||
|
|
f673954bef | ||
|
|
6fdef14eec | ||
|
|
dcfb22f6a0 | ||
|
|
f2bbfca36c | ||
|
|
972487fec1 | ||
|
|
1fd992fb4a | ||
|
|
8b1af8e2d7 | ||
|
|
53ae1dadb8 | ||
|
|
7bcb2f07ab | ||
|
|
da78f5eef1 | ||
|
|
fcdb7c838b | ||
|
|
7086582fad | ||
|
|
9084613e38 | ||
|
|
c849fdae2e | ||
|
|
6d73bede6b | ||
|
|
74784a76d3 | ||
|
|
4e17c5636c | ||
|
|
331a520be0 | ||
|
|
0735c90d5e | ||
|
|
ea345c45e4 | ||
|
|
50f00411ca | ||
|
|
1e0ba33519 | ||
|
|
b32ce60ad8 | ||
|
|
55ceb2838e | ||
|
|
bbc8674c0b | ||
|
|
4ed8d96caa | ||
|
|
141c91e1d7 | ||
|
|
68dddbabee | ||
|
|
efdf9c1fea | ||
|
|
a13f6e28ec | ||
|
|
fa4f074871 | ||
|
|
3715627c07 | ||
|
|
8542869a63 | ||
|
|
d66546a567 | ||
|
|
f2f4c77016 | ||
|
|
9a4d3a1310 | ||
|
|
bf58f25cd5 | ||
|
|
04e0c9c05a | ||
|
|
4770977e66 | ||
|
|
d794bb97b6 | ||
|
|
0d5c3c4337 | ||
|
|
67a8f42ef1 | ||
|
|
79a64c3108 | ||
|
|
6847af9b9a | ||
|
|
d562447777 | ||
|
|
425616c335 | ||
|
|
dcd10b7d2b | ||
|
|
1515e53484 | ||
|
|
8ca05fe454 | ||
|
|
33766fbe18 | ||
|
|
5e0310beb2 | ||
|
|
d8c525fe37 | ||
|
|
8af2afe996 | ||
|
|
9045cec67d | ||
|
|
ab92c6ce93 | ||
|
|
10621d2935 | ||
|
|
45c2b5f0fb | ||
|
|
6ed09e6103 | ||
|
|
23489e20c6 |
No files matched your search
+83
@@ -0,0 +1,83 @@
|
|||||||
|
package one.nem.lacerta.component.common;
|
||||||
|
|
||||||
|
import android.util.Log;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
import android.widget.CheckBox;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
import one.nem.lacerta.component.common.model.DocumentTagApplyTagDialogExtendedModel;
|
||||||
|
import one.nem.lacerta.model.document.tag.DocumentTag;
|
||||||
|
|
||||||
|
public class LacertaApplyTagAdapter extends RecyclerView.Adapter<LacertaApplyTagAdapter.LacertaApplyTagViewHolder>{
|
||||||
|
|
||||||
|
// Listener
|
||||||
|
public interface LacertaApplyTagDialogListener {
|
||||||
|
void itemChecked(View view, String tagId);
|
||||||
|
void itemUnchecked(View view, String tagId);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Variables
|
||||||
|
private ArrayList<DocumentTagApplyTagDialogExtendedModel> documentTagArrayList;
|
||||||
|
private LacertaApplyTagDialogListener listener;
|
||||||
|
|
||||||
|
// Setter
|
||||||
|
public LacertaApplyTagAdapter setListener(LacertaApplyTagDialogListener listener) {
|
||||||
|
this.listener = listener;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public LacertaApplyTagAdapter setDocumentTagArrayList(ArrayList<DocumentTagApplyTagDialogExtendedModel> documentTagArrayList) {
|
||||||
|
this.documentTagArrayList = documentTagArrayList;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Empty constructor
|
||||||
|
public LacertaApplyTagAdapter() {
|
||||||
|
}
|
||||||
|
|
||||||
|
@NonNull
|
||||||
|
@Override
|
||||||
|
public LacertaApplyTagAdapter.LacertaApplyTagViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||||
|
View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.apply_tag_list_item, parent, false);
|
||||||
|
return new LacertaApplyTagAdapter.LacertaApplyTagViewHolder(view);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onBindViewHolder(@NonNull LacertaApplyTagAdapter.LacertaApplyTagViewHolder holder, int position) {
|
||||||
|
DocumentTagApplyTagDialogExtendedModel documentTag = documentTagArrayList.get(position);
|
||||||
|
if (holder.checkBox == null) {
|
||||||
|
Log.d("LacertaApplyTagAdapter", "onBindViewHolder: holder.checkBox is null");
|
||||||
|
}
|
||||||
|
holder.checkBox.setText(documentTag.getName());
|
||||||
|
holder.checkBox.setChecked(documentTag.getIsChecked());
|
||||||
|
holder.checkBox.setOnCheckedChangeListener((buttonView, isChecked) -> {
|
||||||
|
if (isChecked) {
|
||||||
|
listener.itemChecked(buttonView, documentTag.getId());
|
||||||
|
} else {
|
||||||
|
listener.itemUnchecked(buttonView, documentTag.getId());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getItemCount() {
|
||||||
|
return documentTagArrayList == null ? 0 : documentTagArrayList.size();
|
||||||
|
}
|
||||||
|
|
||||||
|
public class LacertaApplyTagViewHolder extends RecyclerView.ViewHolder {
|
||||||
|
|
||||||
|
CheckBox checkBox;
|
||||||
|
|
||||||
|
public LacertaApplyTagViewHolder(@NonNull View itemView) {
|
||||||
|
super(itemView);
|
||||||
|
|
||||||
|
checkBox = itemView.findViewById(R.id.tag_check_box);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
+184
@@ -0,0 +1,184 @@
|
|||||||
|
package one.nem.lacerta.component.common;
|
||||||
|
|
||||||
|
import android.app.Dialog;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.View;
|
||||||
|
import android.widget.CheckBox;
|
||||||
|
import android.widget.Checkable;
|
||||||
|
import android.widget.EditText;
|
||||||
|
import android.widget.Toast;
|
||||||
|
|
||||||
|
import androidx.fragment.app.DialogFragment;
|
||||||
|
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||||
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
|
||||||
|
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.concurrent.CompletableFuture;
|
||||||
|
import java.util.concurrent.CompletionException;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
import javax.inject.Inject;
|
||||||
|
|
||||||
|
import dagger.hilt.android.AndroidEntryPoint;
|
||||||
|
import one.nem.lacerta.component.common.model.DocumentTagApplyTagDialogExtendedModel;
|
||||||
|
import one.nem.lacerta.data.Document;
|
||||||
|
import one.nem.lacerta.data.LacertaLibrary;
|
||||||
|
import one.nem.lacerta.model.document.tag.DocumentTag;
|
||||||
|
import one.nem.lacerta.utils.LacertaLogger;
|
||||||
|
|
||||||
|
@AndroidEntryPoint
|
||||||
|
public class LacertaApplyTagDialog extends DialogFragment {
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
LacertaLogger logger;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
LacertaLibrary lacertaLibrary;
|
||||||
|
|
||||||
|
// Listener
|
||||||
|
public interface LacertaApplyTagDialogListener {
|
||||||
|
void onDialogPositiveClick(ArrayList<DocumentTag> appliedTags);
|
||||||
|
void onDialogNegativeClick();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Variables
|
||||||
|
private String title;
|
||||||
|
private String message;
|
||||||
|
private String positiveButtonText;
|
||||||
|
private String negativeButtonText;
|
||||||
|
private String documentId;
|
||||||
|
private LacertaApplyTagDialogListener listener;
|
||||||
|
private ArrayList<DocumentTag> registeredTags;
|
||||||
|
private ArrayList<DocumentTag> appliedTags;
|
||||||
|
|
||||||
|
// Setter
|
||||||
|
|
||||||
|
public LacertaApplyTagDialog setListener(LacertaApplyTagDialogListener listener) {
|
||||||
|
this.listener = listener;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public LacertaApplyTagDialog setTitle(String title) {
|
||||||
|
this.title = title;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public LacertaApplyTagDialog setMessage(String message) {
|
||||||
|
this.message = message;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public LacertaApplyTagDialog setPositiveButtonText(String positiveButtonText) {
|
||||||
|
this.positiveButtonText = positiveButtonText;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public LacertaApplyTagDialog setNegativeButtonText(String negativeButtonText) {
|
||||||
|
this.negativeButtonText = negativeButtonText;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public LacertaApplyTagDialog setDocumentId(String documentId) {
|
||||||
|
this.documentId = documentId;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Dialog onCreateDialog(Bundle savedInstanceState) {
|
||||||
|
MaterialAlertDialogBuilder builder = new MaterialAlertDialogBuilder(getActivity());
|
||||||
|
LayoutInflater inflater = requireActivity().getLayoutInflater();
|
||||||
|
View view = inflater.inflate(R.layout.lacerta_dialog_apply_tag, null);
|
||||||
|
|
||||||
|
// RecyclerView
|
||||||
|
RecyclerView recyclerView = view.findViewById(R.id.apply_tag_list);
|
||||||
|
|
||||||
|
LacertaApplyTagAdapter lacertaApplyTagAdapter = new LacertaApplyTagAdapter();
|
||||||
|
lacertaApplyTagAdapter.setListener(new LacertaApplyTagAdapter.LacertaApplyTagDialogListener() {
|
||||||
|
@Override
|
||||||
|
public void itemChecked(View view, String tagId) {
|
||||||
|
applyChangeToVariable(true, tagId);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void itemUnchecked(View view, String tagId) {
|
||||||
|
applyChangeToVariable(false, tagId);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
recyclerView.setAdapter(lacertaApplyTagAdapter);
|
||||||
|
recyclerView.setLayoutManager(new LinearLayoutManager(view.getContext()));
|
||||||
|
|
||||||
|
getDocumentTagArrayList(documentId).thenAccept(documentTagArrayList -> {
|
||||||
|
lacertaApplyTagAdapter.setDocumentTagArrayList(documentTagArrayList);
|
||||||
|
lacertaApplyTagAdapter.notifyDataSetChanged(); // TODO-rca: アニメーション
|
||||||
|
});
|
||||||
|
|
||||||
|
// Set the dialog title
|
||||||
|
builder.setTitle(title)
|
||||||
|
.setMessage(message)
|
||||||
|
.setView(view)
|
||||||
|
.setPositiveButton(positiveButtonText == null ? "OK" : positiveButtonText, (dialog, id) -> {
|
||||||
|
// Send the positive button event back to the host activity
|
||||||
|
listener.onDialogPositiveClick(this.appliedTags);
|
||||||
|
})
|
||||||
|
.setNegativeButton(negativeButtonText == null ? "Cancel" : negativeButtonText, (dialog, id) -> {
|
||||||
|
// Send the negative button event back to the host activity
|
||||||
|
listener.onDialogNegativeClick();
|
||||||
|
});
|
||||||
|
return builder.create();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void applyChangeToVariable(boolean isChecked, String tagId) {
|
||||||
|
if (isChecked) {
|
||||||
|
this.registeredTags.stream().filter(tag -> tag.getId().equals(tagId)).findFirst().ifPresent(tag -> this.appliedTags.add(tag));
|
||||||
|
} else {
|
||||||
|
this.appliedTags.stream().filter(tag -> tag.getId().equals(tagId)).findFirst().ifPresent(tag -> this.appliedTags.remove(tag));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private CompletableFuture<ArrayList<DocumentTagApplyTagDialogExtendedModel>> getDocumentTagArrayList(String documentId) {
|
||||||
|
return CompletableFuture.supplyAsync(() -> {
|
||||||
|
ArrayList<DocumentTagApplyTagDialogExtendedModel> documentTagArrayList = new ArrayList<>();
|
||||||
|
setRegisteredTagList().thenRun(() -> setAppliedTagList(documentId).join()).thenAccept(Void -> {
|
||||||
|
logger.debug("getDocumentTagArrayList", "this.registeredTags.size(): " + this.registeredTags.size());
|
||||||
|
logger.debug("getDocumentTagArrayList", "this.appliedTags.size(): " + this.appliedTags.size());
|
||||||
|
|
||||||
|
documentTagArrayList.addAll(this.registeredTags.stream().map(tag -> {
|
||||||
|
DocumentTagApplyTagDialogExtendedModel documentTag = new DocumentTagApplyTagDialogExtendedModel(
|
||||||
|
new DocumentTag(tag.getId(), tag.getName(), tag.getColor()),
|
||||||
|
this.appliedTags.stream().anyMatch(appliedTag -> appliedTag.getId().equals(tag.getId()))
|
||||||
|
);
|
||||||
|
return documentTag;
|
||||||
|
}).collect(Collectors.toCollection(ArrayList::new)));
|
||||||
|
|
||||||
|
}).join();
|
||||||
|
return documentTagArrayList;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private CompletableFuture<Void> setRegisteredTagList() {
|
||||||
|
return CompletableFuture.runAsync(() -> {
|
||||||
|
this.registeredTags = new ArrayList<>();
|
||||||
|
this.lacertaLibrary.getTagList().thenAccept(documentTagList -> {
|
||||||
|
for (int i = 0; i < documentTagList.size(); i++) {
|
||||||
|
this.registeredTags.add(new DocumentTag(documentTagList.get(i).getId(), documentTagList.get(i).getName(), documentTagList.get(i).getColor()));
|
||||||
|
}
|
||||||
|
}).join();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private CompletableFuture<Void> setAppliedTagList(String documentId) {
|
||||||
|
return CompletableFuture.runAsync(() -> {
|
||||||
|
this.appliedTags = new ArrayList<>();
|
||||||
|
this.lacertaLibrary.getAppliedTagList(documentId).thenAccept(documentTagList -> {
|
||||||
|
for (int i = 0; i < documentTagList.size(); i++) {
|
||||||
|
this.appliedTags.add(new DocumentTag(documentTagList.get(i).getId(), documentTagList.get(i).getName(), documentTagList.get(i).getColor()));
|
||||||
|
}
|
||||||
|
}).join();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
+4
@@ -0,0 +1,4 @@
|
|||||||
|
package one.nem.lacerta.component.common;
|
||||||
|
|
||||||
|
public class LacertaEditMetaDialog {
|
||||||
|
}
|
||||||
+31
@@ -0,0 +1,31 @@
|
|||||||
|
package one.nem.lacerta.component.common.model;
|
||||||
|
|
||||||
|
import one.nem.lacerta.model.document.tag.DocumentTag;
|
||||||
|
|
||||||
|
// TODO-rca: クラス名が長すぎ
|
||||||
|
|
||||||
|
/**
|
||||||
|
* DocumentTagを設定するダイアログで使うための拡張モデル
|
||||||
|
* チェックボックスの状態を保持するように
|
||||||
|
*/
|
||||||
|
public class DocumentTagApplyTagDialogExtendedModel extends DocumentTag {
|
||||||
|
|
||||||
|
private boolean isChecked;
|
||||||
|
|
||||||
|
public DocumentTagApplyTagDialogExtendedModel(DocumentTag documentTag) {
|
||||||
|
super(documentTag.getId(), documentTag.getName(), documentTag.getColor());
|
||||||
|
}
|
||||||
|
|
||||||
|
public DocumentTagApplyTagDialogExtendedModel(DocumentTag documentTag, boolean isChecked) {
|
||||||
|
super(documentTag.getId(), documentTag.getName(), documentTag.getColor());
|
||||||
|
this.isChecked = isChecked;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean getIsChecked() {
|
||||||
|
return isChecked;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setIsChecked(boolean checked) {
|
||||||
|
isChecked = checked;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content">
|
||||||
|
|
||||||
|
<CheckBox
|
||||||
|
android:id="@+id/tag_check_box"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:textSize="16sp"
|
||||||
|
android:layout_marginHorizontal="16dp"
|
||||||
|
android:layout_marginVertical="4dp"
|
||||||
|
android:text="CheckBox" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
|
<androidx.recyclerview.widget.RecyclerView
|
||||||
|
android:id="@+id/apply_tag_list"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent" />
|
||||||
|
</FrameLayout>
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
<com.google.android.material.textfield.TextInputLayout
|
||||||
|
android:id="@+id/title_text_input_layout"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:paddingTop="8dp"
|
||||||
|
android:paddingHorizontal="16dp"
|
||||||
|
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox">
|
||||||
|
|
||||||
|
<com.google.android.material.textfield.TextInputEditText
|
||||||
|
android:id="@+id/tag_name_edit_text"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content" />
|
||||||
|
</com.google.android.material.textfield.TextInputLayout>
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
@@ -52,4 +52,6 @@ dependencies {
|
|||||||
implementation project(':vcs')
|
implementation project(':vcs')
|
||||||
|
|
||||||
implementation project(':data')
|
implementation project(':data')
|
||||||
|
|
||||||
|
implementation project(':component:common')
|
||||||
}
|
}
|
||||||
+80
-11
@@ -2,6 +2,7 @@ package one.nem.lacerta.component.scanner;
|
|||||||
|
|
||||||
import android.Manifest;
|
import android.Manifest;
|
||||||
import android.app.ProgressDialog;
|
import android.app.ProgressDialog;
|
||||||
|
import android.content.Intent;
|
||||||
import android.content.pm.PackageManager;
|
import android.content.pm.PackageManager;
|
||||||
import android.graphics.Bitmap;
|
import android.graphics.Bitmap;
|
||||||
import android.graphics.BitmapFactory;
|
import android.graphics.BitmapFactory;
|
||||||
@@ -29,7 +30,9 @@ import java.util.concurrent.CompletableFuture;
|
|||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
|
|
||||||
import dagger.hilt.android.AndroidEntryPoint;
|
import dagger.hilt.android.AndroidEntryPoint;
|
||||||
|
import one.nem.lacerta.component.common.picker.LacertaFilePickerDialog;
|
||||||
import one.nem.lacerta.data.Document;
|
import one.nem.lacerta.data.Document;
|
||||||
|
import one.nem.lacerta.data.LacertaLibrary;
|
||||||
import one.nem.lacerta.model.document.DocumentDetail;
|
import one.nem.lacerta.model.document.DocumentDetail;
|
||||||
import one.nem.lacerta.model.document.DocumentMeta;
|
import one.nem.lacerta.model.document.DocumentMeta;
|
||||||
import one.nem.lacerta.processor.factory.DocumentProcessorFactory;
|
import one.nem.lacerta.processor.factory.DocumentProcessorFactory;
|
||||||
@@ -53,9 +56,25 @@ public class ScannerManagerActivity extends AppCompatActivity {
|
|||||||
@Inject
|
@Inject
|
||||||
LacertaVcsFactory lacertaVcsFactory;
|
LacertaVcsFactory lacertaVcsFactory;
|
||||||
|
|
||||||
|
// @Inject
|
||||||
|
// public ScannerManagerActivity(LacertaLogger logger, Document document, LacertaLibrary lacertaLibrary, DocumentProcessorFactory documentProcessorFactory, LacertaVcsFactory lacertaVcsFactory) {
|
||||||
|
// this.logger = logger;
|
||||||
|
// this.document = document;
|
||||||
|
// this.lacertaLibrary = lacertaLibrary;
|
||||||
|
// this.documentProcessorFactory = documentProcessorFactory;
|
||||||
|
// this.lacertaVcsFactory = lacertaVcsFactory;
|
||||||
|
// }
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
public ScannerManagerActivity() {
|
||||||
|
// Required empty public constructor
|
||||||
|
}
|
||||||
|
|
||||||
// Variables
|
// Variables
|
||||||
private ArrayList<Bitmap> croppedImages = new ArrayList<>();
|
private ArrayList<Bitmap> croppedImages = new ArrayList<>();
|
||||||
|
|
||||||
|
private boolean single = false;
|
||||||
|
|
||||||
View view;
|
View view;
|
||||||
|
|
||||||
DocumentScanner documentScanner = new DocumentScanner(
|
DocumentScanner documentScanner = new DocumentScanner(
|
||||||
@@ -85,6 +104,36 @@ public class ScannerManagerActivity extends AppCompatActivity {
|
|||||||
null
|
null
|
||||||
);
|
);
|
||||||
|
|
||||||
|
DocumentScanner documentScannerSingle = new DocumentScanner( // TODO-rca: ひどすぎるのでなんとかする
|
||||||
|
this,
|
||||||
|
(croppedImageResults) -> {
|
||||||
|
logger.debug(TAG, "croppedImage size: " + croppedImageResults.size());
|
||||||
|
ArrayList<Bitmap> croppedImages = new ArrayList<>();
|
||||||
|
for (String result : croppedImageResults) {
|
||||||
|
croppedImages.add(BitmapFactory.decodeFile(result));
|
||||||
|
}
|
||||||
|
processResult(croppedImages);
|
||||||
|
return null;
|
||||||
|
},
|
||||||
|
(errorMessage) -> {
|
||||||
|
// an error happened
|
||||||
|
logger.error(TAG, "Error: " + errorMessage);
|
||||||
|
logger.e_code("543a230e-cb9a-47a2-8131-3beecfe1c458");
|
||||||
|
finish();
|
||||||
|
return null;
|
||||||
|
},
|
||||||
|
() -> {
|
||||||
|
// user canceled document scan
|
||||||
|
logger.debug(TAG, "User canceled document scan");
|
||||||
|
finish();
|
||||||
|
return null;
|
||||||
|
},
|
||||||
|
null,
|
||||||
|
null,
|
||||||
|
1
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
@@ -108,11 +157,21 @@ public class ScannerManagerActivity extends AppCompatActivity {
|
|||||||
setSupportActionBar(toolbar);
|
setSupportActionBar(toolbar);
|
||||||
Objects.requireNonNull(getSupportActionBar()).setDisplayHomeAsUpEnabled(true);
|
Objects.requireNonNull(getSupportActionBar()).setDisplayHomeAsUpEnabled(true);
|
||||||
|
|
||||||
|
Intent intent = getIntent();
|
||||||
|
Bundle bundle = intent.getExtras();
|
||||||
|
if (bundle != null) {
|
||||||
|
this.single = bundle.getBoolean("single", false);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.single) {
|
||||||
|
documentScanner = documentScannerSingle;
|
||||||
|
}
|
||||||
documentScanner.startScan();
|
documentScanner.startScan();
|
||||||
// Init
|
// Init
|
||||||
|
|
||||||
this.view = findViewById(R.id.main); // TODO-rca:なんとかする
|
this.view = findViewById(R.id.main); // TODO-rca:なんとかする
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -125,15 +184,13 @@ public class ScannerManagerActivity extends AppCompatActivity {
|
|||||||
public boolean onOptionsItemSelected(android.view.MenuItem item) {
|
public boolean onOptionsItemSelected(android.view.MenuItem item) {
|
||||||
if (item.getItemId() == R.id.action_save_new) {
|
if (item.getItemId() == R.id.action_save_new) {
|
||||||
// 新ドキュメントとして保存
|
// 新ドキュメントとして保存
|
||||||
Toast.makeText(this, "保存処理", Toast.LENGTH_SHORT).show();
|
|
||||||
saveNewDocument();
|
saveNewDocument();
|
||||||
return true;
|
return true;
|
||||||
// }
|
}
|
||||||
// else if (item.getItemId() == R.id.action_insert_exist) {
|
else if (item.getItemId() == R.id.action_insert_exist) {
|
||||||
// // 既存ドキュメントに挿入
|
// 既存ドキュメントに挿入
|
||||||
// Toast.makeText(this, "Work in progress", Toast.LENGTH_SHORT).show();
|
insertToExistDocument();
|
||||||
// insertToExistDocument();
|
return true;
|
||||||
// return true;
|
|
||||||
} else if (item.getItemId() == android.R.id.home) {
|
} else if (item.getItemId() == android.R.id.home) {
|
||||||
finish();
|
finish();
|
||||||
return true;
|
return true;
|
||||||
@@ -174,7 +231,7 @@ public class ScannerManagerActivity extends AppCompatActivity {
|
|||||||
Bitmap[] bitmaps = new Bitmap[croppedImages.size()];
|
Bitmap[] bitmaps = new Bitmap[croppedImages.size()];
|
||||||
croppedImages.toArray(bitmaps);
|
croppedImages.toArray(bitmaps);
|
||||||
logger.debug(TAG, "bitmaps.length: " + bitmaps.length);
|
logger.debug(TAG, "bitmaps.length: " + bitmaps.length);
|
||||||
addPagesToDocumentDetail(documentDetail, bitmaps).join();
|
addPagesToDocumentDetail(documentDetail, bitmaps, null).join();
|
||||||
document.updateDocument(documentDetail).join();
|
document.updateDocument(documentDetail).join();
|
||||||
dialog.dismiss();
|
dialog.dismiss();
|
||||||
finish();
|
finish();
|
||||||
@@ -182,11 +239,11 @@ public class ScannerManagerActivity extends AppCompatActivity {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private CompletableFuture<Void> addPagesToDocumentDetail(DocumentDetail documentDetail, Bitmap[] bitmaps) {
|
private CompletableFuture<Void> addPagesToDocumentDetail(DocumentDetail documentDetail, Bitmap[] bitmaps, String commitMessage) {
|
||||||
return CompletableFuture.runAsync(() -> {
|
return CompletableFuture.runAsync(() -> {
|
||||||
try {
|
try {
|
||||||
document.updateDocument(documentProcessorFactory.create(documentDetail).addNewPagesToLast(bitmaps).getDocumentDetail()).join();
|
document.updateDocument(documentProcessorFactory.create(documentDetail).addNewPagesToLast(bitmaps).getDocumentDetail()).join();
|
||||||
lacertaVcsFactory.create(documentDetail.getMeta().getId()).generateRevisionAtCurrent("Initial commit");
|
lacertaVcsFactory.create(documentDetail.getMeta().getId()).generateRevisionAtCurrent(commitMessage == null ? "Update" : commitMessage);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
logger.error(TAG, "Error: " + e.getMessage());
|
logger.error(TAG, "Error: " + e.getMessage());
|
||||||
logger.e_code("9dff2a28-20e8-4ccd-9d04-f0c7646faa6a");
|
logger.e_code("9dff2a28-20e8-4ccd-9d04-f0c7646faa6a");
|
||||||
@@ -196,7 +253,19 @@ public class ScannerManagerActivity extends AppCompatActivity {
|
|||||||
|
|
||||||
private void insertToExistDocument() {
|
private void insertToExistDocument() {
|
||||||
logger.debug(TAG, "insertToExistDocument");
|
logger.debug(TAG, "insertToExistDocument");
|
||||||
// TODO-rca: 実装
|
LacertaFilePickerDialog dialog = new LacertaFilePickerDialog();
|
||||||
|
dialog.setListener(((name, fileId) -> {
|
||||||
|
document.getDocument(fileId).thenAccept((documentDetail) -> {
|
||||||
|
Bitmap[] bitmaps = new Bitmap[croppedImages.size()];
|
||||||
|
croppedImages.toArray(bitmaps);
|
||||||
|
logger.debug(TAG, "bitmaps.length: " + bitmaps.length);
|
||||||
|
addPagesToDocumentDetail(documentDetail, bitmaps, "ページを追加").join();
|
||||||
|
document.updateDocument(documentDetail).join();
|
||||||
|
finish();
|
||||||
|
});
|
||||||
|
}));
|
||||||
|
dialog.setTitle("追加するドキュメントを選択");
|
||||||
|
dialog.show(getSupportFragmentManager(), "LacertaFilePickerDialog");
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateResultView(ArrayList<Bitmap> resultImages) {
|
private void updateResultView(ArrayList<Bitmap> resultImages) {
|
||||||
|
|||||||
@@ -6,9 +6,9 @@
|
|||||||
android:icon="@drawable/save_24px"
|
android:icon="@drawable/save_24px"
|
||||||
android:title="Save"
|
android:title="Save"
|
||||||
app:showAsAction="ifRoom"/>
|
app:showAsAction="ifRoom"/>
|
||||||
<!-- <item-->
|
<item
|
||||||
<!-- android:id="@+id/action_insert_exist"-->
|
android:id="@+id/action_insert_exist"
|
||||||
<!-- android:icon="@drawable/description_24px"-->
|
android:icon="@drawable/description_24px"
|
||||||
<!-- android:title="Insert"-->
|
android:title="Insert"
|
||||||
<!-- app:showAsAction="ifRoom"/>-->
|
app:showAsAction="ifRoom"/>
|
||||||
</menu>
|
</menu>
|
||||||
+90
-11
@@ -19,13 +19,18 @@ import com.google.android.material.tabs.TabLayoutMediator;
|
|||||||
import com.google.android.material.textfield.TextInputEditText;
|
import com.google.android.material.textfield.TextInputEditText;
|
||||||
import com.google.android.material.textfield.TextInputLayout;
|
import com.google.android.material.textfield.TextInputLayout;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
|
|
||||||
import dagger.hilt.android.AndroidEntryPoint;
|
import dagger.hilt.android.AndroidEntryPoint;
|
||||||
|
import one.nem.lacerta.component.common.LacertaApplyTagDialog;
|
||||||
import one.nem.lacerta.component.common.picker.LacertaFilePickerDialog;
|
import one.nem.lacerta.component.common.picker.LacertaFilePickerDialog;
|
||||||
import one.nem.lacerta.data.Document;
|
import one.nem.lacerta.data.Document;
|
||||||
import one.nem.lacerta.data.LacertaLibrary;
|
import one.nem.lacerta.data.LacertaLibrary;
|
||||||
import one.nem.lacerta.model.document.page.Page;
|
import one.nem.lacerta.model.document.page.Page;
|
||||||
|
import one.nem.lacerta.model.document.tag.DocumentTag;
|
||||||
import one.nem.lacerta.model.pref.ToxiDocumentModel;
|
import one.nem.lacerta.model.pref.ToxiDocumentModel;
|
||||||
import one.nem.lacerta.utils.LacertaLogger;
|
import one.nem.lacerta.utils.LacertaLogger;
|
||||||
|
|
||||||
@@ -52,6 +57,7 @@ public class ViewerContainerFragment extends Fragment {
|
|||||||
private String documentId;
|
private String documentId;
|
||||||
private String documentName;
|
private String documentName;
|
||||||
private boolean hasCombined = false;
|
private boolean hasCombined = false;
|
||||||
|
private ViewerViewPagerAdapter viewerViewPagerAdapter;
|
||||||
|
|
||||||
public ViewerContainerFragment() {
|
public ViewerContainerFragment() {
|
||||||
// Required empty public constructor
|
// Required empty public constructor
|
||||||
@@ -102,7 +108,7 @@ public class ViewerContainerFragment extends Fragment {
|
|||||||
ViewPager2 viewPager = view.findViewById(R.id.view_pager);
|
ViewPager2 viewPager = view.findViewById(R.id.view_pager);
|
||||||
|
|
||||||
// Init view pager adapter
|
// Init view pager adapter
|
||||||
ViewerViewPagerAdapter viewerViewPagerAdapter = new ViewerViewPagerAdapter(requireActivity());
|
this.viewerViewPagerAdapter = new ViewerViewPagerAdapter(requireActivity());
|
||||||
viewPager.setAdapter(viewerViewPagerAdapter);
|
viewPager.setAdapter(viewerViewPagerAdapter);
|
||||||
|
|
||||||
// Init tab layout
|
// Init tab layout
|
||||||
@@ -112,22 +118,24 @@ public class ViewerContainerFragment extends Fragment {
|
|||||||
Toolbar toolbar = view.findViewById(R.id.toolbar);
|
Toolbar toolbar = view.findViewById(R.id.toolbar);
|
||||||
initToolbar(toolbar, true, documentName);
|
initToolbar(toolbar, true, documentName);
|
||||||
|
|
||||||
if (this.hasCombined) {
|
// Get document page
|
||||||
|
if (this.hasCombined) { // 結合親の場合
|
||||||
logger.debug("ViewerContainerFragment", "hasCombined: " + hasCombined);
|
logger.debug("ViewerContainerFragment", "hasCombined: " + hasCombined);
|
||||||
lacertaLibrary.getCombinedDocumentToxiList(documentId).thenAccept(combinedDocumentToxiList -> {
|
lacertaLibrary.getCombinedDocumentToxiList(documentId).thenAccept(combinedDocumentToxiList -> {
|
||||||
logger.debug("ViewerContainerFragment", "combinedDocumentToxiList: " + combinedDocumentToxiList.size());
|
logger.debug("ViewerContainerFragment", "combinedDocumentToxiList: " + combinedDocumentToxiList.size());
|
||||||
for (ToxiDocumentModel toxiDocumentModel : combinedDocumentToxiList) {
|
|
||||||
logger.debug("ViewerContainerFragment", "titleCache: " + toxiDocumentModel.getTitleCache());
|
viewerViewPagerAdapter.setFragmentTargetIdList(
|
||||||
viewerViewPagerAdapter
|
combinedDocumentToxiList.stream().map(ToxiDocumentModel::getChildDocumentId).collect(Collectors.toCollection(ArrayList::new)));
|
||||||
.addFragment(ViewerBodyFragment.newInstance(toxiDocumentModel.getChildDocumentId(), toxiDocumentModel.getTitleCache()),
|
viewerViewPagerAdapter.setFragmentTitleList(
|
||||||
toxiDocumentModel.getTitleCache());
|
combinedDocumentToxiList.stream().map(ToxiDocumentModel::getTitleCache).collect(Collectors.toCollection(ArrayList::new)));
|
||||||
}
|
|
||||||
viewerViewPagerAdapter.notifyItemRangeChanged(0, combinedDocumentToxiList.size());
|
viewerViewPagerAdapter.notifyItemRangeChanged(0, combinedDocumentToxiList.size());
|
||||||
});
|
});
|
||||||
} else {
|
} else { // それ以外の場合
|
||||||
logger.debug("ViewerContainerFragment", "hasCombined: " + hasCombined);
|
logger.debug("ViewerContainerFragment", "hasCombined: " + hasCombined);
|
||||||
tabLayout.setVisibility(View.GONE);
|
tabLayout.setVisibility(View.GONE);
|
||||||
viewerViewPagerAdapter.addFragment(ViewerBodyFragment.newInstance(documentId, documentName), documentName);
|
viewerViewPagerAdapter.setFragmentTargetIdList(new ArrayList<String>(){{add(documentId);}}); // TODO-rca: 読みにくいので直接追加できるようにする
|
||||||
|
viewerViewPagerAdapter.setFragmentTitleList(new ArrayList<String>(){{add(documentName);}});
|
||||||
viewerViewPagerAdapter.notifyItemRangeChanged(0, 1);
|
viewerViewPagerAdapter.notifyItemRangeChanged(0, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -140,13 +148,54 @@ public class ViewerContainerFragment extends Fragment {
|
|||||||
|
|
||||||
ImageButton imageButton = customView.findViewById(R.id.tab_modify);
|
ImageButton imageButton = customView.findViewById(R.id.tab_modify);
|
||||||
imageButton.setOnClickListener(v -> {
|
imageButton.setOnClickListener(v -> {
|
||||||
Toast.makeText(getContext(), "Working!, Index:" + position, Toast.LENGTH_SHORT).show();
|
renameCombinedDocument(
|
||||||
|
this.documentId,
|
||||||
|
viewerViewPagerAdapter.getFragmentTargetId(position),
|
||||||
|
viewerViewPagerAdapter.getFragmentTitle(position),
|
||||||
|
position);
|
||||||
});
|
});
|
||||||
|
|
||||||
tab.setCustomView(customView);
|
tab.setCustomView(customView);
|
||||||
}).attach();
|
}).attach();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void renameCombinedDocument(String parentId, String childId, String current, int position) { // TODO-rca: 無理やりpositionを渡してるのでなんとかする
|
||||||
|
MaterialAlertDialogBuilder builder = new MaterialAlertDialogBuilder(getContext());
|
||||||
|
builder.setTitle("アイテム名の変更");
|
||||||
|
builder.setMessage("アイテム名を入力してください");
|
||||||
|
|
||||||
|
View view = LayoutInflater.from(getContext()).inflate(one.nem.lacerta.shared.ui.R.layout.lacerta_dialog_edit_text_layout, null);
|
||||||
|
TextInputEditText textInputEditText = view.findViewById(one.nem.lacerta.shared.ui.R.id.custom_edit_text);
|
||||||
|
TextInputLayout textInputLayout = view.findViewById(one.nem.lacerta.shared.ui.R.id.custom_text_input_layout);
|
||||||
|
textInputEditText.setText(current);
|
||||||
|
textInputLayout.setHint("アイテム名");
|
||||||
|
builder.setView(view);
|
||||||
|
|
||||||
|
builder.setPositiveButton("変更", (dialog, which) -> {
|
||||||
|
document.renameDocument(childId, textInputEditText.getText().toString()).thenCombine(
|
||||||
|
lacertaLibrary.updateTitleCache(parentId, childId, textInputEditText.getText().toString()), (aVoid, aVoid2) -> {
|
||||||
|
getActivity().runOnUiThread(() -> {
|
||||||
|
Toast.makeText(getContext(), "変更しました", Toast.LENGTH_SHORT).show();
|
||||||
|
updateTabTitle(position, textInputEditText.getText().toString());
|
||||||
|
dialog.dismiss();
|
||||||
|
});
|
||||||
|
return null;
|
||||||
|
});
|
||||||
|
});
|
||||||
|
builder.setNegativeButton("キャンセル", (dialog, which) -> {
|
||||||
|
dialog.cancel();
|
||||||
|
});
|
||||||
|
|
||||||
|
builder.show();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void updateTabTitle(int position, String title) {
|
||||||
|
ArrayList<String> fragmentTitleList = viewerViewPagerAdapter.getFragmentTitleList();
|
||||||
|
fragmentTitleList.set(position, title);
|
||||||
|
viewerViewPagerAdapter.setFragmentTitleList(fragmentTitleList);
|
||||||
|
viewerViewPagerAdapter.notifyItemChanged(position);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Toolbarをinitする
|
* Toolbarをinitする
|
||||||
*
|
*
|
||||||
@@ -187,6 +236,9 @@ public class ViewerContainerFragment extends Fragment {
|
|||||||
} else if (item.getItemId() == R.id.action_combine) {
|
} else if (item.getItemId() == R.id.action_combine) {
|
||||||
combineDocument();
|
combineDocument();
|
||||||
return true;
|
return true;
|
||||||
|
} else if (item.getItemId() == R.id.action_apply_tag) {
|
||||||
|
applyTag();
|
||||||
|
return true;
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -194,6 +246,33 @@ public class ViewerContainerFragment extends Fragment {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void applyTag() {
|
||||||
|
LacertaApplyTagDialog lacertaApplyTagDialog = new LacertaApplyTagDialog();
|
||||||
|
lacertaApplyTagDialog
|
||||||
|
.setTitle("タグの適用")
|
||||||
|
.setMessage("タグを適用するファイルを選択してください")
|
||||||
|
.setNegativeButtonText("キャンセル")
|
||||||
|
.setDocumentId(documentId)
|
||||||
|
.setListener(new LacertaApplyTagDialog.LacertaApplyTagDialogListener() {
|
||||||
|
@Override
|
||||||
|
public void onDialogPositiveClick(ArrayList<DocumentTag> appliedTags) {
|
||||||
|
logger.debug("ViewerContainerFragment", "Dialog Result: appliedTags: " + appliedTags.size());
|
||||||
|
lacertaLibrary.applyTagListToDocument(documentId, appliedTags).thenAccept(aVoid -> {
|
||||||
|
getActivity().runOnUiThread(() -> {
|
||||||
|
Toast.makeText(getContext(), "タグを適用しました", Toast.LENGTH_SHORT).show();
|
||||||
|
lacertaApplyTagDialog.dismiss();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onDialogNegativeClick() {
|
||||||
|
lacertaApplyTagDialog.dismiss();
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.show(getChildFragmentManager(), "LacertaApplyTagDialog");
|
||||||
|
}
|
||||||
|
|
||||||
private void combineDocument() {
|
private void combineDocument() {
|
||||||
LacertaFilePickerDialog lacertaFilePickerDialog = new LacertaFilePickerDialog();
|
LacertaFilePickerDialog lacertaFilePickerDialog = new LacertaFilePickerDialog();
|
||||||
lacertaFilePickerDialog.setListener((fileName, selectedId) -> {
|
lacertaFilePickerDialog.setListener((fileName, selectedId) -> {
|
||||||
|
|||||||
+34
-6
@@ -13,13 +13,17 @@ import java.util.ArrayList;
|
|||||||
public class ViewerViewPagerAdapter extends FragmentStateAdapter {
|
public class ViewerViewPagerAdapter extends FragmentStateAdapter {
|
||||||
|
|
||||||
// Variables
|
// Variables
|
||||||
private ArrayList<Fragment> fragmentArrayList = new ArrayList<>();
|
private ArrayList<String> fragmentTargetIdList = new ArrayList<>();
|
||||||
private ArrayList<String> fragmentTitleList = new ArrayList<>();
|
private ArrayList<String> fragmentTitleList = new ArrayList<>();
|
||||||
|
|
||||||
// Setter
|
// Setter
|
||||||
public void addFragment(Fragment fragment, String title){
|
|
||||||
fragmentArrayList.add(fragment);
|
public void setFragmentTargetIdList(ArrayList<String> fragmentTargetIdList) {
|
||||||
fragmentTitleList.add(title);
|
this.fragmentTargetIdList = fragmentTargetIdList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFragmentTitleList(ArrayList<String> fragmentTitleList) {
|
||||||
|
this.fragmentTitleList = fragmentTitleList;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ViewerViewPagerAdapter(@NonNull FragmentActivity fragmentActivity) {
|
public ViewerViewPagerAdapter(@NonNull FragmentActivity fragmentActivity) {
|
||||||
@@ -29,16 +33,40 @@ public class ViewerViewPagerAdapter extends FragmentStateAdapter {
|
|||||||
@NonNull
|
@NonNull
|
||||||
@Override
|
@Override
|
||||||
public Fragment createFragment(int position) {
|
public Fragment createFragment(int position) {
|
||||||
return fragmentArrayList.get(position);
|
return ViewerBodyFragment.newInstance(fragmentTargetIdList.get(position), fragmentTitleList.get(position));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getItemCount() {
|
public int getItemCount() {
|
||||||
return fragmentArrayList == null ? 0 : fragmentArrayList.size();
|
if (fragmentTargetIdList == null || fragmentTitleList == null) {
|
||||||
|
return 0;
|
||||||
|
} else if (fragmentTargetIdList.size() != fragmentTitleList.size()) {
|
||||||
|
throw new IllegalStateException("fragmentTargetIdList.size() != fragmentTitleList.size()");
|
||||||
|
} else {
|
||||||
|
return fragmentTargetIdList.size();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
public CharSequence getTabTitle(int position) {
|
public CharSequence getTabTitle(int position) {
|
||||||
return fragmentTitleList.get(position);
|
return fragmentTitleList.get(position);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Getter
|
||||||
|
|
||||||
|
public String getFragmentTargetId(int position) {
|
||||||
|
return fragmentTargetIdList.get(position);
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getFragmentTitle(int position) {
|
||||||
|
return fragmentTitleList.get(position);
|
||||||
|
}
|
||||||
|
|
||||||
|
public ArrayList<String> getFragmentTargetIdList() {
|
||||||
|
return fragmentTargetIdList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ArrayList<String> getFragmentTitleList() {
|
||||||
|
return fragmentTitleList;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -20,4 +20,12 @@
|
|||||||
android:id="@+id/action_combine"
|
android:id="@+id/action_combine"
|
||||||
android:title="結合" />
|
android:title="結合" />
|
||||||
|
|
||||||
|
<item
|
||||||
|
android:id="@+id/action_edit_meta"
|
||||||
|
android:title="メタデータ編集" />
|
||||||
|
|
||||||
|
<item
|
||||||
|
android:id="@+id/action_apply_tag"
|
||||||
|
android:title="タグの管理" />
|
||||||
|
|
||||||
</menu>
|
</menu>
|
||||||
@@ -35,6 +35,8 @@ public interface LacertaLibrary {
|
|||||||
// Tag
|
// Tag
|
||||||
CompletableFuture<ArrayList<DocumentTag>> getTagList();
|
CompletableFuture<ArrayList<DocumentTag>> getTagList();
|
||||||
|
|
||||||
|
CompletableFuture<ArrayList<DocumentTag>> getAppliedTagList(String documentId);
|
||||||
|
|
||||||
CompletableFuture<Void> createTag(DocumentTag tag);
|
CompletableFuture<Void> createTag(DocumentTag tag);
|
||||||
|
|
||||||
CompletableFuture<Void> updateTag(DocumentTag tag);
|
CompletableFuture<Void> updateTag(DocumentTag tag);
|
||||||
@@ -43,12 +45,16 @@ public interface LacertaLibrary {
|
|||||||
|
|
||||||
CompletableFuture<Void> addTagToDocument(String documentId, String tagId);
|
CompletableFuture<Void> addTagToDocument(String documentId, String tagId);
|
||||||
|
|
||||||
|
CompletableFuture<Void> applyTagListToDocument(String documentId, ArrayList<DocumentTag> tagList);
|
||||||
|
|
||||||
CompletableFuture<Void> removeTagFromDocument(String documentId, String tagId);
|
CompletableFuture<Void> removeTagFromDocument(String documentId, String tagId);
|
||||||
|
|
||||||
// Combined Document
|
// Combined Document
|
||||||
|
|
||||||
CompletableFuture<Void> combineDocument(String parentId, String childId);
|
CompletableFuture<Void> combineDocument(String parentId, String childId);
|
||||||
|
|
||||||
|
CompletableFuture<Void> updateTitleCache(String parentId, String childId, String titleCache);
|
||||||
|
|
||||||
CompletableFuture<Void> uncombineDocument(String parentId, String childId);
|
CompletableFuture<Void> uncombineDocument(String parentId, String childId);
|
||||||
|
|
||||||
// CompletableFuture<Void> combineDocument(String parentId, ArrayList<String> childIdList);
|
// CompletableFuture<Void> combineDocument(String parentId, ArrayList<String> childIdList);
|
||||||
|
|||||||
@@ -121,6 +121,19 @@ public class LacertaLibraryImpl implements LacertaLibrary {
|
|||||||
listItem.setDescription(simpleDateFormat.format(documentEntity.updatedAt));
|
listItem.setDescription(simpleDateFormat.format(documentEntity.updatedAt));
|
||||||
listItem.setItemId(documentEntity.id);
|
listItem.setItemId(documentEntity.id);
|
||||||
listItem.setHasCombined(documentEntity.isCombineParent);
|
listItem.setHasCombined(documentEntity.isCombineParent);
|
||||||
|
// タグを取得して関連付ける処理 TODO-rca: わかりにくい + 責任がめちゃくちゃ + めちゃくちゃ重いのでなんとかする
|
||||||
|
List<ToxiDocumentTagEntity> documentTagEntities = database.toxiDocumentTagDao().findByDocumentId(documentEntity.id);
|
||||||
|
ArrayList<DocumentTag> documentTags = new ArrayList<>();
|
||||||
|
for (ToxiDocumentTagEntity toxiDocumentTagEntity : documentTagEntities) {
|
||||||
|
logger.debug("LacertaLibraryImpl", "toxiDocumentTagEntity.tagId: " + toxiDocumentTagEntity.tagId);
|
||||||
|
TagEntity tagEntity = database.tagDao().findById(toxiDocumentTagEntity.tagId);
|
||||||
|
if (tagEntity != null) {
|
||||||
|
logger.debug("LacertaLibraryImpl", "tagEntity.tagName: " + tagEntity.tagName);
|
||||||
|
documentTags.add(convertTagEntityToDocumentTag(tagEntity));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
listItem.setTagList(documentTags);
|
||||||
|
logger.debug("LacertaLibraryImpl", "documentTags.size(): " + documentTags.size());
|
||||||
listItems.add(listItem);
|
listItems.add(listItem);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -248,6 +261,22 @@ public class LacertaLibraryImpl implements LacertaLibrary {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public CompletableFuture<ArrayList<DocumentTag>> getAppliedTagList(String documentId) {
|
||||||
|
return CompletableFuture.supplyAsync(() -> {
|
||||||
|
List<ToxiDocumentTagEntity> toxiDocumentTagEntities = database.toxiDocumentTagDao().findByDocumentId(documentId);
|
||||||
|
logger.debug("LacertaLibraryImpl", "Database Query: Get ToxiDocumentTagEntity List (Size: " + toxiDocumentTagEntities.size() + ")");
|
||||||
|
ArrayList<DocumentTag> documentTags = new ArrayList<>();
|
||||||
|
for (ToxiDocumentTagEntity toxiDocumentTagEntity : toxiDocumentTagEntities) {
|
||||||
|
TagEntity tagEntity = database.tagDao().findById(toxiDocumentTagEntity.tagId);
|
||||||
|
if (tagEntity != null) {
|
||||||
|
documentTags.add(convertTagEntityToDocumentTag(tagEntity));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return documentTags;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CompletableFuture<Void> createTag(DocumentTag tag) {
|
public CompletableFuture<Void> createTag(DocumentTag tag) {
|
||||||
return CompletableFuture.supplyAsync(() -> {
|
return CompletableFuture.supplyAsync(() -> {
|
||||||
@@ -292,6 +321,20 @@ public class LacertaLibraryImpl implements LacertaLibrary {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public CompletableFuture<Void> applyTagListToDocument(String documentId, ArrayList<DocumentTag> tagArrayList) {
|
||||||
|
return CompletableFuture.supplyAsync(() -> { // TODO-rca: 必要なものだけInsertするべき, 時間があれば...
|
||||||
|
// 一旦全てのタグを削除
|
||||||
|
database.toxiDocumentTagDao().deleteByDocumentId(documentId);
|
||||||
|
logger.debug("LacertaLibraryImpl", "Database Query: Deleted ToxiDocumentTagEntity");
|
||||||
|
// タグを追加
|
||||||
|
for (DocumentTag documentTag : tagArrayList) {
|
||||||
|
addTagToDocument(documentId, documentTag.getId());
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CompletableFuture<Void> removeTagFromDocument(String documentId, String tagId) {
|
public CompletableFuture<Void> removeTagFromDocument(String documentId, String tagId) {
|
||||||
return CompletableFuture.supplyAsync(() -> {
|
return CompletableFuture.supplyAsync(() -> {
|
||||||
@@ -346,6 +389,21 @@ public class LacertaLibraryImpl implements LacertaLibrary {
|
|||||||
logger.debug("LacertaLibraryImpl", "Database Query: Inserted ToxiDocumentEntity");
|
logger.debug("LacertaLibraryImpl", "Database Query: Inserted ToxiDocumentEntity");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public CompletableFuture<Void> updateTitleCache(String parentId, String documentId, String titleCache) {
|
||||||
|
return CompletableFuture.supplyAsync(() -> {
|
||||||
|
ToxiDocumentEntity toxiDocumentEntity = database.toxiDocumentDao().findByParentIdAndChildId(parentId, documentId);
|
||||||
|
if (toxiDocumentEntity == null) {
|
||||||
|
logger.warn("LacertaLibraryImpl", "ToxiDocumentEntity is not found.");
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
toxiDocumentEntity.titleCache = titleCache;
|
||||||
|
database.toxiDocumentDao().update(toxiDocumentEntity);
|
||||||
|
logger.debug("LacertaLibraryImpl", "Database Query: Updated ToxiDocumentEntity");
|
||||||
|
return null;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CompletableFuture<Void> uncombineDocument(String parentId, String childId) {
|
public CompletableFuture<Void> uncombineDocument(String parentId, String childId) {
|
||||||
return CompletableFuture.supplyAsync(() -> {
|
return CompletableFuture.supplyAsync(() -> {
|
||||||
|
|||||||
@@ -21,9 +21,11 @@ import javax.inject.Inject;
|
|||||||
|
|
||||||
import dagger.hilt.android.AndroidEntryPoint;
|
import dagger.hilt.android.AndroidEntryPoint;
|
||||||
import one.nem.lacerta.component.viewer.ViewerMainActivity;
|
import one.nem.lacerta.component.viewer.ViewerMainActivity;
|
||||||
|
import one.nem.lacerta.data.Document;
|
||||||
import one.nem.lacerta.data.LacertaLibrary;
|
import one.nem.lacerta.data.LacertaLibrary;
|
||||||
import one.nem.lacerta.model.LibraryItemPage;
|
import one.nem.lacerta.model.LibraryItemPage;
|
||||||
import one.nem.lacerta.model.ListItemType;
|
import one.nem.lacerta.model.ListItemType;
|
||||||
|
import one.nem.lacerta.model.document.tag.DocumentTag;
|
||||||
import one.nem.lacerta.utils.FeatureSwitch;
|
import one.nem.lacerta.utils.FeatureSwitch;
|
||||||
import one.nem.lacerta.utils.LacertaLogger;
|
import one.nem.lacerta.utils.LacertaLogger;
|
||||||
|
|
||||||
@@ -53,6 +55,9 @@ public class LibraryPageFragment extends Fragment {
|
|||||||
@Inject
|
@Inject
|
||||||
LacertaLogger logger;
|
LacertaLogger logger;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
Document document;
|
||||||
|
|
||||||
ListItemAdapter listItemAdapter;
|
ListItemAdapter listItemAdapter;
|
||||||
|
|
||||||
public LibraryPageFragment() {
|
public LibraryPageFragment() {
|
||||||
@@ -233,6 +238,9 @@ public class LibraryPageFragment extends Fragment {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void getTag(String documentId) { //debug
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Toolbarのサブタイトルを更新
|
* Toolbarのサブタイトルを更新
|
||||||
* @param subtitle サブタイトル
|
* @param subtitle サブタイトル
|
||||||
|
|||||||
@@ -1,14 +1,19 @@
|
|||||||
package one.nem.lacerta.feature.library;
|
package one.nem.lacerta.feature.library;
|
||||||
|
|
||||||
|
import android.util.Log;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
import android.widget.Toast;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.recyclerview.widget.RecyclerView;
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
|
||||||
|
import com.google.android.material.chip.Chip;
|
||||||
|
import com.google.android.material.chip.ChipGroup;
|
||||||
|
|
||||||
import one.nem.lacerta.model.LibraryItemPage;
|
import one.nem.lacerta.model.LibraryItemPage;
|
||||||
import one.nem.lacerta.model.ListItem;
|
import one.nem.lacerta.model.ListItem;
|
||||||
import one.nem.lacerta.model.ListItemType;
|
import one.nem.lacerta.model.ListItemType;
|
||||||
@@ -31,7 +36,7 @@ public class ListItemAdapter extends RecyclerView.Adapter<ListItemAdapter.ListIt
|
|||||||
@NonNull
|
@NonNull
|
||||||
@Override
|
@Override
|
||||||
public ListItemViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
public ListItemViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||||
View view = LayoutInflater.from(parent.getContext()).inflate(one.nem.lacerta.shared.ui.R.layout.common_list_item, parent, false);
|
View view = LayoutInflater.from(parent.getContext()).inflate(one.nem.lacerta.shared.ui.R.layout.common_list_item_with_tag, parent, false);
|
||||||
return new ListItemViewHolder(view);
|
return new ListItemViewHolder(view);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -43,6 +48,19 @@ public class ListItemAdapter extends RecyclerView.Adapter<ListItemAdapter.ListIt
|
|||||||
holder.title.setText(listItem.getTitle());
|
holder.title.setText(listItem.getTitle());
|
||||||
holder.description.setText(listItem.getDescription());
|
holder.description.setText(listItem.getDescription());
|
||||||
|
|
||||||
|
if (listItem.getTagList() != null && !listItem.getTagList().isEmpty()) {
|
||||||
|
for (int i = 0; i < listItem.getTagList().size(); i++) {
|
||||||
|
Toast.makeText(holder.tagGroup.getContext(), listItem.getTagList().get(i).getName(), Toast.LENGTH_SHORT).show();
|
||||||
|
ChipGroup chipGroup = holder.tagGroup;
|
||||||
|
Chip chip = new Chip(chipGroup.getContext());
|
||||||
|
chip.setText(listItem.getTagList().get(i).getName());
|
||||||
|
chipGroup.addView(chip);
|
||||||
|
}
|
||||||
|
holder.tagGroup.setVisibility(View.VISIBLE);
|
||||||
|
} else {
|
||||||
|
holder.tagGroup.setVisibility(View.GONE);
|
||||||
|
}
|
||||||
|
|
||||||
holder.itemView.setOnClickListener( v -> {
|
holder.itemView.setOnClickListener( v -> {
|
||||||
if (listItem.getItemType() == ListItemType.ITEM_TYPE_DOCUMENT) {
|
if (listItem.getItemType() == ListItemType.ITEM_TYPE_DOCUMENT) {
|
||||||
listener.onDocumentSelected(listItem.getItemId(), listItem.getTitle(), listItem.getHasCombined());
|
listener.onDocumentSelected(listItem.getItemId(), listItem.getTitle(), listItem.getHasCombined());
|
||||||
@@ -64,12 +82,14 @@ public class ListItemAdapter extends RecyclerView.Adapter<ListItemAdapter.ListIt
|
|||||||
ImageView icon;
|
ImageView icon;
|
||||||
TextView title;
|
TextView title;
|
||||||
TextView description;
|
TextView description;
|
||||||
|
ChipGroup tagGroup;
|
||||||
public ListItemViewHolder(@NonNull View itemView) {
|
public ListItemViewHolder(@NonNull View itemView) {
|
||||||
super(itemView);
|
super(itemView);
|
||||||
|
|
||||||
icon = itemView.findViewById(one.nem.lacerta.shared.ui.R.id.item_icon);
|
icon = itemView.findViewById(one.nem.lacerta.shared.ui.R.id.item_icon);
|
||||||
title = itemView.findViewById(one.nem.lacerta.shared.ui.R.id.item_title);
|
title = itemView.findViewById(one.nem.lacerta.shared.ui.R.id.item_title);
|
||||||
description = itemView.findViewById(one.nem.lacerta.shared.ui.R.id.item_description);
|
description = itemView.findViewById(one.nem.lacerta.shared.ui.R.id.item_description);
|
||||||
|
tagGroup = itemView.findViewById(one.nem.lacerta.shared.ui.R.id.item_tags);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,44 @@
|
|||||||
|
package one.nem.lacerta.feature.library;
|
||||||
|
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
import android.widget.BaseAdapter;
|
||||||
|
|
||||||
|
import com.google.android.material.chip.Chip;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
import one.nem.lacerta.model.document.tag.DocumentTag;
|
||||||
|
|
||||||
|
public class TagAdapter extends BaseAdapter {
|
||||||
|
|
||||||
|
private ArrayList<DocumentTag> tagList;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getCount() {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Object getItem(int position) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public long getItemId(int position) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public View getView(int position, View convertView, ViewGroup parent) {
|
||||||
|
Chip chip;
|
||||||
|
if (convertView == null) {
|
||||||
|
chip = new Chip(parent.getContext());
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
chip = (Chip) convertView;
|
||||||
|
}
|
||||||
|
chip.setText(tagList.get(position).getName());
|
||||||
|
return chip;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -2,6 +2,10 @@ package one.nem.lacerta.model;
|
|||||||
|
|
||||||
import android.graphics.drawable.Drawable;
|
import android.graphics.drawable.Drawable;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
import one.nem.lacerta.model.document.tag.DocumentTag;
|
||||||
|
|
||||||
public class ListItem {
|
public class ListItem {
|
||||||
|
|
||||||
// Properties
|
// Properties
|
||||||
@@ -11,6 +15,7 @@ public class ListItem {
|
|||||||
ListItemType itemType;
|
ListItemType itemType;
|
||||||
String itemId;
|
String itemId;
|
||||||
boolean hasCombined;
|
boolean hasCombined;
|
||||||
|
ArrayList<DocumentTag> tagList;
|
||||||
|
|
||||||
// Constructor
|
// Constructor
|
||||||
|
|
||||||
@@ -29,6 +34,15 @@ public class ListItem {
|
|||||||
this.hasCombined = hasCombined;
|
this.hasCombined = hasCombined;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ListItem(String title, String description, ListItemType itemType, String itemId,boolean hasCombined, ArrayList<DocumentTag> tagList) {
|
||||||
|
this.title = title;
|
||||||
|
this.description = description;
|
||||||
|
this.itemType = itemType;
|
||||||
|
this.itemId = itemId;
|
||||||
|
this.hasCombined = hasCombined;
|
||||||
|
this.tagList = tagList;
|
||||||
|
}
|
||||||
|
|
||||||
public ListItem() {
|
public ListItem() {
|
||||||
// Empty constructor
|
// Empty constructor
|
||||||
}
|
}
|
||||||
@@ -55,6 +69,10 @@ public class ListItem {
|
|||||||
return hasCombined;
|
return hasCombined;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ArrayList<DocumentTag> getTagList() {
|
||||||
|
return tagList;
|
||||||
|
}
|
||||||
|
|
||||||
// Setter
|
// Setter
|
||||||
|
|
||||||
public void setTitle(String title) {
|
public void setTitle(String title) {
|
||||||
@@ -77,4 +95,7 @@ public class ListItem {
|
|||||||
this.hasCombined = hasCombined;
|
this.hasCombined = hasCombined;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setTagList(ArrayList<DocumentTag> tagList) {
|
||||||
|
this.tagList = tagList;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,63 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<androidx.constraintlayout.widget.ConstraintLayout 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="wrap_content"
|
||||||
|
android:paddingHorizontal="24dp"
|
||||||
|
android:paddingVertical="16dp"
|
||||||
|
android:theme="@style/Theme.Lacerta">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/item_icon"
|
||||||
|
android:layout_width="32dp"
|
||||||
|
android:layout_height="0dp"
|
||||||
|
android:layout_marginEnd="16dp"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintEnd_toStartOf="@id/item_text_container"
|
||||||
|
app:srcCompat="@drawable/description_24px"
|
||||||
|
android:contentDescription="icon" />
|
||||||
|
|
||||||
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
|
android:id="@+id/item_text_container"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toEndOf="@id/item_icon"
|
||||||
|
app:layout_constraintTop_toTopOf="parent">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/item_title"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:textSize="16sp"
|
||||||
|
android:layout_marginEnd="8dp"
|
||||||
|
android:text="Placeholder Title"
|
||||||
|
android:textColor="@color/colorOnSurface"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/item_description"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:textSize="14sp"
|
||||||
|
android:text="Placeholder Description"
|
||||||
|
android:textColor="@color/colorOnSurfaceSecondary"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@+id/item_title" />
|
||||||
|
|
||||||
|
<com.google.android.material.chip.ChipGroup
|
||||||
|
android:id="@+id/item_tags"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:visibility="gone"
|
||||||
|
app:layout_constraintTop_toBottomOf="@id/item_description">
|
||||||
|
|
||||||
|
</com.google.android.material.chip.ChipGroup>
|
||||||
|
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
@@ -15,6 +15,9 @@ public interface ToxiDocumentDao {
|
|||||||
@Query("SELECT * FROM toxi_document WHERE parent_document_id = :parentId AND is_active = 1 ORDER BY `order` ASC")
|
@Query("SELECT * FROM toxi_document WHERE parent_document_id = :parentId AND is_active = 1 ORDER BY `order` ASC")
|
||||||
List<ToxiDocumentEntity> findByParentId(String parentId);
|
List<ToxiDocumentEntity> findByParentId(String parentId);
|
||||||
|
|
||||||
|
@Query("SELECT * FROM toxi_document WHERE parent_document_id = :parentId AND child_document_id = :childId AND is_active = 1")
|
||||||
|
ToxiDocumentEntity findByParentIdAndChildId(String parentId, String childId);
|
||||||
|
|
||||||
@Insert
|
@Insert
|
||||||
void insert(ToxiDocumentEntity toxiDocument);
|
void insert(ToxiDocumentEntity toxiDocument);
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user