mirror of
https://github.com/lacerta-doc/Lacerta.git
synced 2026-11-02 11:37:37 +00:00
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:
commit
d07e63f534
144 files changed
+4276
-1110
No files matched your search
@@ -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 に変更する
|
||||
}
|
||||
}
|
||||
}
|
||||
+38
@@ -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;
|
||||
}
|
||||
}
|
||||
+44
-4
@@ -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>
|
||||
Reference in new issue
Block a user