Merge branch 'develop' into feature/home/add_document_history

# Conflicts:
#	data/src/main/java/one/nem/lacerta/data/Document.java
#	data/src/main/java/one/nem/lacerta/data/impl/DocumentImpl.java
This commit is contained in:
Fuchimoto1234 committed 2024-01-17 12:42:55 +09:00
commit d07e63f534
144 files changed
+4276 -1110

No files matched your search

+9
View File
@@ -62,4 +62,13 @@ dependencies {
// Shared
implementation project(':shared:ui')
// Scanner
implementation project(':component:scanner')
// Processor
implementation project(':processor')
// LacertaVcs
implementation project(':vcs')
}
@@ -1,10 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<application>
<activity
android:name=".DebugMenuContainerActivity"
android:exported="false" />
</application>
</manifest>
@@ -0,0 +1,44 @@
package one.nem.lacerta.feature.debug;
import android.os.Bundle;
import androidx.fragment.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
/**
* A simple {@link Fragment} subclass.
* Use the {@link DebugMenuDocProcessorTesterFragment#newInstance} factory method to
* create an instance of this fragment.
*/
public class DebugMenuDocProcessorTesterFragment extends Fragment {
public DebugMenuDocProcessorTesterFragment() {
// Required empty public constructor
}
public static DebugMenuDocProcessorTesterFragment newInstance() {
DebugMenuDocProcessorTesterFragment fragment = new DebugMenuDocProcessorTesterFragment();
Bundle args = new Bundle();
fragment.setArguments(args);
return fragment;
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
View view = inflater.inflate(R.layout.fragment_debug_menu_doc_processor_tester, container, false);
return view;
}
}
@@ -1,81 +0,0 @@
package one.nem.lacerta.feature.debug;
import android.os.Bundle;
import androidx.fragment.app.Fragment;
import androidx.recyclerview.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.List;
import javax.inject.Inject;
import dagger.hilt.android.AndroidEntryPoint;
import one.nem.lacerta.data.Document;
import one.nem.lacerta.feature.debug.common.adapter.DebugMenuDocumentListItemAdapter;
import one.nem.lacerta.feature.debug.common.model.DebugMenuDocumentListItem;
import one.nem.lacerta.model.document.DocumentMeta;
import one.nem.lacerta.utils.LacertaLogger;
/**
* A simple {@link Fragment} subclass.
* Use the {@link DebugMenuDocumentTesterListFragment#newInstance} factory method to
* create an instance of this fragment.
*/
@AndroidEntryPoint
public class DebugMenuDocumentTesterListFragment extends Fragment {
@Inject
Document document;
@Inject
LacertaLogger logger;
public DebugMenuDocumentTesterListFragment() {
// Required empty public constructor
}
public static DebugMenuDocumentTesterListFragment newInstance() {
DebugMenuDocumentTesterListFragment fragment = new DebugMenuDocumentTesterListFragment();
Bundle args = new Bundle();
fragment.setArguments(args);
return fragment;
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
View view = inflater.inflate(R.layout.fragment_debug_menu_document_tester_list, container, false);
RecyclerView recyclerView = view.findViewById(R.id.recycler_view_document_list);
recyclerView.setLayoutManager(new androidx.recyclerview.widget.LinearLayoutManager(getContext()));
ArrayList<DocumentMeta> documentMetas = document.getAllDocumentMetas(100);
logger.debug("Debug/DocList", "Document count: " + documentMetas.size());
List<DebugMenuDocumentListItem> debugMenuDocumentListItems = new ArrayList<>();
for (DocumentMeta documentMeta : documentMetas) {
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
debugMenuDocumentListItems.add(new DebugMenuDocumentListItem(documentMeta.getTitle(), "Internal Id: " + documentMeta.getId(), simpleDateFormat.format(documentMeta.getUpdatedAt())));
}
DebugMenuDocumentListItemAdapter adapter = new DebugMenuDocumentListItemAdapter(debugMenuDocumentListItems);
recyclerView.setAdapter(adapter);
return view;
}
}
@@ -1,72 +0,0 @@
package one.nem.lacerta.feature.debug;
import android.os.Bundle;
import androidx.fragment.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import com.google.android.material.textfield.TextInputEditText;
import java.util.UUID;
import javax.inject.Inject;
import dagger.hilt.android.AndroidEntryPoint;
import dagger.multibindings.IntKey;
import one.nem.lacerta.data.DocumentDebug;
import one.nem.lacerta.model.document.DocumentMeta;
import one.nem.lacerta.model.document.DocumentDetail;
import one.nem.lacerta.model.document.path.DocumentPath;
import one.nem.lacerta.model.document.tag.DocumentTag;
/**
* A simple {@link Fragment} subclass.
* Use the {@link DebugMenuDocumentTesterManageFragment#newInstance} factory method to
* create an instance of this fragment.
*/
@AndroidEntryPoint
public class DebugMenuDocumentTesterManageFragment extends Fragment {
@Inject
DocumentDebug documentDebug;
public DebugMenuDocumentTesterManageFragment() {
// Required empty public constructor
}
public static DebugMenuDocumentTesterManageFragment newInstance() {
DebugMenuDocumentTesterManageFragment fragment = new DebugMenuDocumentTesterManageFragment();
Bundle args = new Bundle();
fragment.setArguments(args);
return fragment;
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
View view = inflater.inflate(R.layout.fragment_debug_menu_document_tester_manage, container, false);
TextInputEditText editTextDocumentTitle = view.findViewById(R.id.edit_text_document_title);
view.findViewById(R.id.button_insert_test_data).setOnClickListener( v -> {
DocumentMeta meta = new DocumentMeta(editTextDocumentTitle != null ? editTextDocumentTitle.getText().toString() : "empty title"); // TODO-rca: Nullable
DocumentPath path = new DocumentPath("root", "test_path");
DocumentDetail detail = new DocumentDetail(meta, path, "test_author", "test_default_branch");
documentDebug.insertDocument(meta, detail);
});
return view;
}
}
@@ -47,8 +47,8 @@ public class DebugMenuDocumentTesterTopFragment extends Fragment {
List<DebugMenuListItem> debugMenuDocTesterListItems = new ArrayList<>();
debugMenuDocTesterListItems.add(new DebugMenuListItem("DocumentListFragment", "DocumentListFragment", R.id.action_debugMenuDocumentTesterTopFragment_to_debugMenuDocumentTesterListFragment, true));
debugMenuDocTesterListItems.add(new DebugMenuListItem("DocumentManagerFragment", "DocumentManagerFragment", R.id.action_debugMenuDocumentTesterTopFragment_to_debugMenuDocumentTesterManageFragment, true));
// debugMenuDocTesterListItems.add(new DebugMenuListItem("DocumentListFragment", "DocumentListFragment", R.id.action_debugMenuDocumentTesterTopFragment_to_debugMenuDocumentTesterListFragment, true));
// debugMenuDocTesterListItems.add(new DebugMenuListItem("DocumentManagerFragment", "DocumentManagerFragment", R.id.action_debugMenuDocumentTesterTopFragment_to_debugMenuDocumentTesterManageFragment, true));
DebugMenuListItemAdapter adapter = new DebugMenuListItemAdapter(debugMenuDocTesterListItems);
@@ -0,0 +1,115 @@
package one.nem.lacerta.feature.debug;
import android.os.Bundle;
import androidx.annotation.AnimatorRes;
import androidx.fragment.app.Fragment;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import java.util.ArrayList;
import javax.inject.Inject;
import dagger.hilt.android.AndroidEntryPoint;
import one.nem.lacerta.data.LacertaLibrary;
import one.nem.lacerta.model.LibraryItemPage;
import one.nem.lacerta.model.document.DocumentDetail;
import one.nem.lacerta.model.ListItem;
import one.nem.lacerta.model.ListItemType;
/**
* A simple {@link Fragment} subclass.
* Use the {@link DebugMenuLibraryItemListPageFragment#newInstance} factory method to
* create an instance of this fragment.
*/
@AndroidEntryPoint
public class DebugMenuLibraryItemListPageFragment extends Fragment {
@Inject
LacertaLibrary lacertaLibrary;
public DebugMenuLibraryItemListPageFragment() {
// Required empty public constructor
}
public static DebugMenuLibraryItemListPageFragment newInstance() {
DebugMenuLibraryItemListPageFragment fragment = new DebugMenuLibraryItemListPageFragment();
Bundle args = new Bundle();
fragment.setArguments(args);
return fragment;
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
View view = inflater.inflate(R.layout.fragment_debug_menu_library_item_list_page, container, false);
LibraryItemPage libraryItemPage = lacertaLibrary.getRecentDocument(10);
for (ListItem listItem : libraryItemPage.getListItems()) {
System.out.println(listItem.getTitle());
}
RecyclerView recyclerView = view.findViewById(R.id.item_recycler_view);
recyclerView.setAdapter(new ItemAdapter(libraryItemPage.getListItems()));
recyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
return view;
}
private class ItemAdapter extends RecyclerView.Adapter<ItemAdapter.ItemViewHolder> {
private ArrayList<ListItem> listItems;
public ItemAdapter(ArrayList<ListItem> listItems) {
this.listItems = listItems;
}
@Override
public ItemViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.list_item_debug_menu_document, parent, false);
return new ItemViewHolder(view);
}
@Override
public void onBindViewHolder(ItemViewHolder holder, int position) {
ListItem listItem = listItems.get(position);
holder.document_list_item_title.setText(listItem.getTitle());
holder.document_list_item_description.setText(listItem.getDescription());
holder.document_list_item_updated_at.setText(listItem.getItemType().toString());
}
@Override
public int getItemCount() {
return listItems.size();
}
public class ItemViewHolder extends RecyclerView.ViewHolder {
TextView document_list_item_title;
TextView document_list_item_description;
TextView document_list_item_updated_at;
public ItemViewHolder(View itemView) {
super(itemView);
document_list_item_title = itemView.findViewById(R.id.document_list_item_title);
document_list_item_description = itemView.findViewById(R.id.document_list_item_description);
document_list_item_updated_at = itemView.findViewById(R.id.document_list_item_updated_at);
}
}
}
}
@@ -12,6 +12,7 @@ import android.view.ViewGroup;
import java.util.ArrayList;
import java.util.List;
import dagger.hilt.android.AndroidEntryPoint;
import one.nem.lacerta.feature.debug.common.adapter.DebugMenuListItemAdapter;
import one.nem.lacerta.feature.debug.common.model.DebugMenuListItem;
@@ -20,6 +21,7 @@ import one.nem.lacerta.feature.debug.common.model.DebugMenuListItem;
* Use the {@link DebugMenuTopFragment#newInstance} factory method to
* create an instance of this fragment.
*/
@AndroidEntryPoint
public class DebugMenuTopFragment extends Fragment {
public DebugMenuTopFragment() {
// Required empty public constructor
@@ -46,8 +48,11 @@ public class DebugMenuTopFragment extends Fragment {
recyclerView.setLayoutManager(new androidx.recyclerview.widget.LinearLayoutManager(getContext()));
List<DebugMenuListItem> debugMenuListItems = new ArrayList<>();
debugMenuListItems.add(new DebugMenuListItem("Meta Data", "View meta data", R.id.action_debugMenuTopFragment_to_debugMenuMetaDataFragment, true));
debugMenuListItems.add(new DebugMenuListItem("Document Tester", "placeholder", R.id.action_debugMenuTopFragment_to_debugMenuDocumentTesterTopFragment, true));
debugMenuListItems.add(new DebugMenuListItem("ScannerStub", "placeholder", R.id.action_debugMenuTopFragment_to_scannerDataManagerStubFragment, true));
debugMenuListItems.add(new DebugMenuListItem("Scanner", "placeholder", R.id.action_debugMenuTopFragment_to_scannerManagerFragment, true));
debugMenuListItems.add(new DebugMenuListItem("Document List", "placeholder", R.id.action_debugMenuTopFragment_to_debugMenuLibraryItemListPageFragment, true));
debugMenuListItems.add(new DebugMenuListItem("VCS", "placeholder", R.id.action_debugMenuTopFragment_to_debugMenuVcsGeneralFragment, true));
DebugMenuListItemAdapter adapter = new DebugMenuListItemAdapter(debugMenuListItems);
recyclerView.setAdapter(adapter);
@@ -0,0 +1,58 @@
package one.nem.lacerta.feature.debug;
import android.os.Bundle;
import androidx.fragment.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import javax.inject.Inject;
import dagger.hilt.android.AndroidEntryPoint;
import one.nem.lacerta.vcs.LacertaVcs;
import one.nem.lacerta.vcs.factory.LacertaVcsFactory;
/**
* A simple {@link Fragment} subclass.
* Use the {@link DebugMenuVcsGeneralActionFragment#newInstance} factory method to
* create an instance of this fragment.
*/
@AndroidEntryPoint
public class DebugMenuVcsGeneralActionFragment extends Fragment {
@Inject
LacertaVcsFactory lacertaVcsFactory;
public DebugMenuVcsGeneralActionFragment() {
// Required empty public constructor
}
public static DebugMenuVcsGeneralActionFragment newInstance() {
DebugMenuVcsGeneralActionFragment fragment = new DebugMenuVcsGeneralActionFragment();
Bundle args = new Bundle();
fragment.setArguments(args);
return fragment;
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
View view = inflater.inflate(R.layout.fragment_debug_menu_vcs_general_action, container, false);
view.findViewById(R.id.add_sample_log_rev_button).setOnClickListener(v -> {
LacertaVcs lacertaVcs = lacertaVcsFactory.create("example_id");
lacertaVcs.insertPage(1, "example_id");
});
return view;
}
}
@@ -0,0 +1,59 @@
package one.nem.lacerta.feature.debug;
import android.os.Bundle;
import androidx.fragment.app.Fragment;
import androidx.recyclerview.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import java.util.ArrayList;
import java.util.List;
import one.nem.lacerta.feature.debug.common.adapter.DebugMenuListItemAdapter;
import one.nem.lacerta.feature.debug.common.model.DebugMenuListItem;
/**
* A simple {@link Fragment} subclass.
* Use the {@link DebugMenuVcsGeneralFragment#newInstance} factory method to
* create an instance of this fragment.
*/
public class DebugMenuVcsGeneralFragment extends Fragment {
public DebugMenuVcsGeneralFragment() {
// Required empty public constructor
}
public static DebugMenuVcsGeneralFragment newInstance() {
DebugMenuVcsGeneralFragment fragment = new DebugMenuVcsGeneralFragment();
Bundle args = new Bundle();
fragment.setArguments(args);
return fragment;
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
View view = inflater.inflate(R.layout.fragment_debug_menu_vcs_general, container, false);
RecyclerView recyclerView = view.findViewById(R.id.recycler_view);
recyclerView.setLayoutManager(new androidx.recyclerview.widget.LinearLayoutManager(getContext()));
List<DebugMenuListItem> debugMenuListItems = new ArrayList<>();
debugMenuListItems.add(new DebugMenuListItem("General Action", "placeholder", R.id.action_debugMenuVcsGeneralFragment_to_debugMenuVcsGeneralActionFragment, true));
debugMenuListItems.add(new DebugMenuListItem("Log Record", "placeholder", R.id.action_debugMenuVcsGeneralFragment_to_debugMenuVcsLogRecordFragment, true));
debugMenuListItems.add(new DebugMenuListItem("Rev Record", "placeholder", R.id.action_debugMenuVcsGeneralFragment_to_debugMenuVcsRevRecordFragment, true));
DebugMenuListItemAdapter adapter = new DebugMenuListItemAdapter(debugMenuListItems);
recyclerView.setAdapter(adapter);
return view;
}
}
@@ -0,0 +1,42 @@
package one.nem.lacerta.feature.debug;
import android.os.Bundle;
import androidx.fragment.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
/**
* A simple {@link Fragment} subclass.
* Use the {@link DebugMenuVcsLogRecordFragment#newInstance} factory method to
* create an instance of this fragment.
*/
public class DebugMenuVcsLogRecordFragment extends Fragment {
public DebugMenuVcsLogRecordFragment() {
// Required empty public constructor
}
public static DebugMenuVcsLogRecordFragment newInstance() {
DebugMenuVcsLogRecordFragment fragment = new DebugMenuVcsLogRecordFragment();
Bundle args = new Bundle();
fragment.setArguments(args);
return fragment;
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
View view = inflater.inflate(R.layout.fragment_debug_menu_vcs_log_record, container, false);
return view;
}
}
@@ -10,16 +10,16 @@ import android.view.ViewGroup;
/**
* A simple {@link Fragment} subclass.
* Use the {@link DebugMenuMetaDataFragment#newInstance} factory method to
* Use the {@link DebugMenuVcsRevRecordFragment#newInstance} factory method to
* create an instance of this fragment.
*/
public class DebugMenuMetaDataFragment extends Fragment {
public DebugMenuMetaDataFragment() {
public class DebugMenuVcsRevRecordFragment extends Fragment {
public DebugMenuVcsRevRecordFragment() {
// Required empty public constructor
}
public static DebugMenuMetaDataFragment newInstance() {
DebugMenuMetaDataFragment fragment = new DebugMenuMetaDataFragment();
public static DebugMenuVcsRevRecordFragment newInstance() {
DebugMenuVcsRevRecordFragment fragment = new DebugMenuVcsRevRecordFragment();
Bundle args = new Bundle();
fragment.setArguments(args);
return fragment;
@@ -34,6 +34,8 @@ public class DebugMenuMetaDataFragment extends Fragment {
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
return inflater.inflate(R.layout.fragment_debug_menu_meta_data, container, false);
View view = inflater.inflate(R.layout.fragment_debug_menu_vcs_rev_record, container, false);
return view;
}
}
@@ -0,0 +1,36 @@
<?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"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:theme="@style/Theme.Lacerta"
tools:context=".DebugMenuDocProcessorTesterFragment" >
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="1dp"
android:layout_marginTop="1dp"
android:layout_marginEnd="1dp"
android:orientation="vertical"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<com.google.android.material.button.MaterialButton
android:id="@+id/button_gen_random_img"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Generate random image" />
</LinearLayout>
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
@@ -1,60 +0,0 @@
<?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"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".DebugMenuDocumentTesterManageFragment" >
<ScrollView
android:layout_width="match_parent"
android:layout_height="0dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:layout_margin="16dp"
android:background="@drawable/rounded_secondary_container">
<TextView
android:id="@+id/textView2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="16dp"
android:textSize="16sp"
android:textColor="@color/colorOnSecondaryContainer"
android:text="Debug actions" />
<com.google.android.material.textfield.TextInputEditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Document title"
android:id="@+id/edit_text_document_title"
android:layout_margin="16dp"
android:inputType="text"
android:textSize="16sp"
style="@style/ThemeOverlay.Material3.TextInputEditText.OutlinedBox" />
<com.google.android.material.button.MaterialButton
android:id="@+id/button_insert_test_data"
style="@style/Widget.Material3.Button.OutlinedButton"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="16dp"
android:text="Insert test data"/>
</LinearLayout>
</LinearLayout>
</ScrollView>
</androidx.constraintlayout.widget.ConstraintLayout>
@@ -4,11 +4,11 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".DebugMenuDocumentTesterListFragment" >
tools:context=".DebugMenuLibraryItemListPageFragment">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recycler_view_document_list"
android:layout_width="match_parent"
android:id="@+id/item_recycler_view"
android:layout_width="0dp"
android:layout_height="0dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
@@ -1,12 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".DebugMenuMetaDataFragment">
<!-- TODO: Update blank fragment layout -->
</FrameLayout>
@@ -0,0 +1,17 @@
<?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"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".DebugMenuVcsGeneralFragment">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recycler_view"
android:layout_width="0dp"
android:layout_height="0dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
@@ -0,0 +1,24 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".DebugMenuVcsGeneralActionFragment">
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<Button
android:id="@+id/add_sample_log_rev_button"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Add Sample log/Rev" />
</LinearLayout>
</ScrollView>
</androidx.constraintlayout.widget.ConstraintLayout>
@@ -0,0 +1,17 @@
<?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"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".DebugMenuVcsGeneralFragment">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/log_recycler_view"
android:layout_width="0dp"
android:layout_height="0dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
@@ -0,0 +1,17 @@
<?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"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".DebugMenuVcsGeneralFragment">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rev_recycler_view"
android:layout_width="0dp"
android:layout_height="0dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
@@ -10,38 +10,69 @@
android:name="one.nem.lacerta.feature.debug.DebugMenuTopFragment"
android:label="fragment_debug_menu_top"
tools:layout="@layout/fragment_debug_menu_top" >
<action
android:id="@+id/action_debugMenuTopFragment_to_debugMenuMetaDataFragment"
app:destination="@id/debugMenuMetaDataFragment" />
<action
android:id="@+id/action_debugMenuTopFragment_to_debugMenuDocumentTesterTopFragment"
app:destination="@id/debugMenuDocumentTesterTopFragment" />
<action
android:id="@+id/action_debugMenuTopFragment_to_scannerDataManagerStubFragment"
app:destination="@id/scannerDataManagerStubFragment" />
<action
android:id="@+id/action_debugMenuTopFragment_to_debugMenuLibraryItemListPageFragment"
app:destination="@id/debugMenuLibraryItemListPageFragment" />
<action
android:id="@+id/action_debugMenuTopFragment_to_debugMenuVcsGeneralFragment"
app:destination="@id/debugMenuVcsGeneralFragment" />
<action
android:id="@+id/action_debugMenuTopFragment_to_scannerManagerFragment"
app:destination="@id/scannerManagerFragment" />
</fragment>
<fragment
android:id="@+id/debugMenuMetaDataFragment"
android:name="one.nem.lacerta.feature.debug.DebugMenuMetaDataFragment"
android:label="fragment_debug_menu_meta_data"
tools:layout="@layout/fragment_debug_menu_meta_data" />
<fragment
android:id="@+id/debugMenuDocumentTesterTopFragment"
android:name="one.nem.lacerta.feature.debug.DebugMenuDocumentTesterTopFragment"
android:label="fragment_debug_menu_document_tester_top"
tools:layout="@layout/fragment_debug_menu_document_tester_top" >
<action
android:id="@+id/action_debugMenuDocumentTesterTopFragment_to_debugMenuDocumentTesterListFragment"
app:destination="@id/debugMenuDocumentTesterListFragment" />
<action
android:id="@+id/action_debugMenuDocumentTesterTopFragment_to_debugMenuDocumentTesterManageFragment"
app:destination="@id/debugMenuDocumentTesterManageFragment" />
</fragment>
<fragment
android:id="@+id/debugMenuDocumentTesterListFragment"
android:name="one.nem.lacerta.feature.debug.DebugMenuDocumentTesterListFragment"
android:label="fragment_debug_menu_document_tester_list"
tools:layout="@layout/fragment_debug_menu_document_tester_list" />
android:id="@+id/scannerDataManagerStubFragment"
android:name="one.nem.lacerta.component.scanner.ScannerDataManagerStubFragment"
android:label="ScannerDataManagerStubFragment" />
<fragment
android:id="@+id/debugMenuDocumentTesterManageFragment"
android:name="one.nem.lacerta.feature.debug.DebugMenuDocumentTesterManageFragment"
android:label="fragment_debug_menu_document_tester_manage"
tools:layout="@layout/fragment_debug_menu_document_tester_manage" />
android:id="@+id/debugMenuLibraryItemListPageFragment"
android:name="one.nem.lacerta.feature.debug.DebugMenuLibraryItemListPageFragment"
android:label="fragment_debug_menu_library_item_list_page"
tools:layout="@layout/fragment_debug_menu_library_item_list_page" />
<fragment
android:id="@+id/debugMenuVcsGeneralFragment"
android:name="one.nem.lacerta.feature.debug.DebugMenuVcsGeneralFragment"
android:label="fragment_debug_menu_vcs_general"
tools:layout="@layout/fragment_debug_menu_vcs_general" >
<action
android:id="@+id/action_debugMenuVcsGeneralFragment_to_debugMenuVcsGeneralActionFragment"
app:destination="@id/debugMenuVcsGeneralActionFragment" />
<action
android:id="@+id/action_debugMenuVcsGeneralFragment_to_debugMenuVcsRevRecordFragment"
app:destination="@id/debugMenuVcsRevRecordFragment" />
<action
android:id="@+id/action_debugMenuVcsGeneralFragment_to_debugMenuVcsLogRecordFragment"
app:destination="@id/debugMenuVcsLogRecordFragment" />
</fragment>
<fragment
android:id="@+id/debugMenuVcsGeneralActionFragment"
android:name="one.nem.lacerta.feature.debug.DebugMenuVcsGeneralActionFragment"
android:label="fragment_debug_menu_vcs_general_action"
tools:layout="@layout/fragment_debug_menu_vcs_general_action" />
<fragment
android:id="@+id/debugMenuVcsLogRecordFragment"
android:name="one.nem.lacerta.feature.debug.DebugMenuVcsLogRecordFragment"
android:label="fragment_debug_menu_vcs_log_record"
tools:layout="@layout/fragment_debug_menu_vcs_log_record" />
<fragment
android:id="@+id/debugMenuVcsRevRecordFragment"
android:name="one.nem.lacerta.feature.debug.DebugMenuVcsRevRecordFragment"
android:label="fragment_debug_menu_vcs_rev_record"
tools:layout="@layout/fragment_debug_menu_vcs_rev_record" />
<fragment
android:id="@+id/scannerManagerFragment"
android:name="one.nem.lacerta.component.scanner.ScannerManagerFragment"
android:label="ScannerManagerFragment" />
</navigation>
+14
View File
@@ -1,5 +1,6 @@
plugins {
id 'com.android.library'
id 'com.google.dagger.hilt.android'
}
android {
@@ -29,6 +30,8 @@ dependencies {
implementation libs.androidx.appcompat
implementation libs.com.google.android.material
implementation 'androidx.navigation:navigation-fragment:2.7.5'
implementation 'androidx.navigation:navigation-ui:2.7.5'
testImplementation libs.junit
androidTestImplementation libs.androidx.test.ext.junit
androidTestImplementation libs.androidx.test.espresso.core
@@ -38,4 +41,15 @@ dependencies {
implementation libs.navigation.ui
implementation libs.navigation.dynamic.features.fragment
// Hilt (DI)
implementation libs.com.google.dagger.hilt.android
annotationProcessor libs.com.google.dagger.hilt.compiler
implementation project(':shared:ui')
implementation project(':model')
implementation project(':data')
}
@@ -0,0 +1,55 @@
package one.nem.lacerta.feature.library;
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.List;
import one.nem.lacerta.model.document.DocumentMeta;
public class DocumentAdapter extends RecyclerView.Adapter<DocumentAdapter.DocumentViewHolder> {
private List<DocumentMeta> documentMetas;
public DocumentAdapter(List<DocumentMeta> documentMetas) {
// nullの場合に例外を発生させる
if (documentMetas == null) {
throw new IllegalArgumentException("DocumentMetas list cannot be null or empty");
}
this.documentMetas = documentMetas;
}
@NonNull
@Override
public DocumentViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.list_item_library_menu, parent, false);
return new DocumentViewHolder(view);
}
@Override
public void onBindViewHolder(@NonNull DocumentViewHolder holder, int position) {
DocumentMeta documentMeta = documentMetas.get(position);
if (documentMeta != null) {
holder.title.setText(documentMeta.getTitle());
}
}
@Override
public int getItemCount() {
return documentMetas.size();
}
class DocumentViewHolder extends RecyclerView.ViewHolder {
TextView title;
DocumentViewHolder(View itemView) {
super(itemView);
title = itemView.findViewById(R.id.debug_menu_item_title); // 適切な id に変更する
}
}
}
@@ -0,0 +1,38 @@
package one.nem.lacerta.feature.library;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.TextView;
import androidx.appcompat.app.AppCompatActivity;
// LibraryArchiveFragment.java
//画面変移用のコード
//Fragmentへのデータの受け渡し機能
public class LibraryArchiveFragment extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.fragment_library_top);
// ここに入力された内容を表示する機能
TextView textView = findViewById(R.id.document_list);
textView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// 文字をタップしたときの処理
// 移動先のアクティビティを指定
Intent intent = new Intent(LibraryArchiveFragment.this, LibraryDocFragment.class);
// データを付加する
intent.putExtra("key_name", "value_data");
startActivity(intent);
}
});
}
}
@@ -0,0 +1,51 @@
package one.nem.lacerta.feature.library;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import androidx.fragment.app.Fragment;
//Fragmentにデータを受け渡す機能
public class LibraryDocFragment extends Fragment {
private TextView textView; // フィールドとして TextView を定義
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_library_file, container, false);
textView = view.findViewById(R.id.textView);
return view;
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// フラグメントに渡されたデータを取得
if (getArguments() != null) {
String receivedData = getArguments().getString("key_name");
// onCreateView メソッドで取得した TextView にデータをセットする
if (textView != null) {
textView.setText(receivedData);
}
}
}
// Factory method for creating a new instance of the fragment
public static LibraryDocFragment newInstance(String data) {
LibraryDocFragment fragment = new LibraryDocFragment();
// フラグメントにデータを渡す
Bundle args = new Bundle();
args.putString("key_name", data);
fragment.setArguments(args);
return fragment;
}
}
@@ -2,11 +2,28 @@ package one.nem.lacerta.feature.library;
import android.os.Bundle;
import androidx.annotation.NonNull;
import androidx.fragment.app.Fragment;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import android.widget.TextView;
import android.widget.Toast;
import java.util.ArrayList;
import java.util.List;
import javax.inject.Inject;
import dagger.hilt.android.AndroidEntryPoint;
import one.nem.lacerta.data.Document;
import one.nem.lacerta.model.document.DocumentMeta;
import one.nem.lacerta.model.document.tag.DocumentTag;
@@ -15,8 +32,12 @@ import android.view.ViewGroup;
* Use the {@link LibraryTopFragment#newInstance} factory method to
* create an instance of this fragment.
*/
@AndroidEntryPoint
public class LibraryTopFragment extends Fragment {
// @Inject
// Document document;
// TODO: Rename parameter arguments, choose names that match
// the fragment initialization parameters, e.g. ARG_ITEM_NUMBER
private static final String ARG_PARAM1 = "param1";
@@ -57,10 +78,29 @@ public class LibraryTopFragment extends Fragment {
}
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
// Inflate the layout for this fragment
return inflater.inflate(R.layout.fragment_library_top, container, false);
View view = inflater.inflate(R.layout.fragment_library_top, container, false);
// Use view.findViewById instead of findViewById
RecyclerView documentRecyclerView = view.findViewById(R.id.document_list);
LinearLayoutManager layoutManager = new LinearLayoutManager(getContext());
documentRecyclerView.setLayoutManager(layoutManager);
//データを取得
// List<DocumentMeta> metas = document.getAllDocumentMetas(100);
// Toast.makeText(getContext(), "Documents: " + Integer.toString(metas.size()), Toast.LENGTH_LONG).show();
// Create and set the adapter
// DocumentAdapter adapter = new DocumentAdapter(metas);
// documentRecyclerView.setAdapter(adapter);
// Use a LinearLayoutManager to specify the layout
return view;
}
}
}
@@ -0,0 +1,17 @@
<?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="match_parent"
android:padding="16dp">
<TextView
android:id="@+id/textView"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:textSize="16sp"
android:layout_marginEnd="8dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
@@ -1,14 +1,32 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:theme="@style/Theme.Lacerta"
tools:context=".LibraryTopFragment">
<!-- TODO: Update blank fragment layout -->
<TextView
<com.google.android.material.appbar.MaterialToolbar
android:id="@+id/tool_bar"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="@string/hello_blank_fragment" />
android:layout_height="wrap_content"
android:background="@color/colorPrimaryContainer"
android:minHeight="?attr/actionBarSize"
android:theme="?attr/actionBarTheme"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:title="Library"
app:titleTextColor="@color/colorOnPrimaryContainer" />
</FrameLayout>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/document_list"
android:layout_width="match_parent"
android:layout_height="0dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/tool_bar" />
</androidx.constraintlayout.widget.ConstraintLayout>
@@ -0,0 +1,26 @@
<?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:padding="16dp">
<TextView
android:id="@+id/debug_menu_item_title"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:textSize="16sp"
android:layout_marginEnd="8dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/debug_menu_item_description"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:textSize="14sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/debug_menu_item_title" />
</androidx.constraintlayout.widget.ConstraintLayout>
@@ -1,4 +1,3 @@
<resources>
<!-- TODO: Remove or change this placeholder text -->
<string name="hello_blank_fragment">Hello blank fragment</string>
<string name="app_name">Library</string>
</resources>