From dd98602309bf17662c9b1337f9a31331ff260d0f Mon Sep 17 00:00:00 2001 From: nero Date: Thu, 21 Dec 2023 14:54:06 +0900 Subject: [PATCH 1/8] =?UTF-8?q?=E3=82=B3=E3=83=A1=E3=83=B3=E3=83=88?= =?UTF-8?q?=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../nem/lacerta/feature/library/LibraryArchiveFragment.java | 3 +++ .../one/nem/lacerta/feature/library/LibraryDocFragment.java | 1 + 2 files changed, 4 insertions(+) diff --git a/feature/library/src/main/java/one/nem/lacerta/feature/library/LibraryArchiveFragment.java b/feature/library/src/main/java/one/nem/lacerta/feature/library/LibraryArchiveFragment.java index 18acbb3d..0867fa0e 100644 --- a/feature/library/src/main/java/one/nem/lacerta/feature/library/LibraryArchiveFragment.java +++ b/feature/library/src/main/java/one/nem/lacerta/feature/library/LibraryArchiveFragment.java @@ -8,6 +8,9 @@ import android.widget.TextView; import androidx.appcompat.app.AppCompatActivity; // LibraryArchiveFragment.java + +//画面変移用のコード +//Fragmentへのデータの受け渡し機能 public class LibraryArchiveFragment extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { diff --git a/feature/library/src/main/java/one/nem/lacerta/feature/library/LibraryDocFragment.java b/feature/library/src/main/java/one/nem/lacerta/feature/library/LibraryDocFragment.java index b489d496..1fc09f28 100644 --- a/feature/library/src/main/java/one/nem/lacerta/feature/library/LibraryDocFragment.java +++ b/feature/library/src/main/java/one/nem/lacerta/feature/library/LibraryDocFragment.java @@ -8,6 +8,7 @@ import android.widget.TextView; import androidx.fragment.app.Fragment; +//Fragmentにデータを受け渡す機能 public class LibraryDocFragment extends Fragment { private TextView textView; // フィールドとして TextView を定義 From c2ee49d274e781da32da1ff45f67c0d7d1515ca6 Mon Sep 17 00:00:00 2001 From: nero Date: Thu, 21 Dec 2023 14:54:58 +0900 Subject: [PATCH 2/8] =?UTF-8?q?=E4=BF=9D=E5=AD=98=E3=81=95=E3=82=8C?= =?UTF-8?q?=E3=81=A6=E3=81=84=E3=82=8B=E3=83=87=E3=83=BC=E3=82=BF=E4=BB=B6?= =?UTF-8?q?=E6=95=B0=E3=82=92=E8=A1=A8=E7=A4=BA=E3=81=99=E3=82=8B=E6=A9=9F?= =?UTF-8?q?=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .idea/deploymentTargetDropDown.xml | 17 ----------------- feature/library/build.gradle | 5 +++++ .../feature/library/LibraryTopFragment.java | 19 +++++++++++++++++++ 3 files changed, 24 insertions(+), 17 deletions(-) delete mode 100644 .idea/deploymentTargetDropDown.xml diff --git a/.idea/deploymentTargetDropDown.xml b/.idea/deploymentTargetDropDown.xml deleted file mode 100644 index 76049e85..00000000 --- a/.idea/deploymentTargetDropDown.xml +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/feature/library/build.gradle b/feature/library/build.gradle index 97d6dc86..89087a45 100644 --- a/feature/library/build.gradle +++ b/feature/library/build.gradle @@ -1,5 +1,6 @@ plugins { id 'com.android.library' + id 'com.google.dagger.hilt.android' } android { @@ -46,5 +47,9 @@ dependencies { implementation project(':shared:ui') + implementation project(':model') + + implementation project(':data') + } \ No newline at end of file diff --git a/feature/library/src/main/java/one/nem/lacerta/feature/library/LibraryTopFragment.java b/feature/library/src/main/java/one/nem/lacerta/feature/library/LibraryTopFragment.java index 867f928b..152b73b9 100644 --- a/feature/library/src/main/java/one/nem/lacerta/feature/library/LibraryTopFragment.java +++ b/feature/library/src/main/java/one/nem/lacerta/feature/library/LibraryTopFragment.java @@ -13,17 +13,29 @@ 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; + /** * A simple {@link Fragment} subclass. * 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"; @@ -76,6 +88,13 @@ public class LibraryTopFragment extends Fragment { LinearLayoutManager layoutManager = new LinearLayoutManager(getContext()); documentRecyclerView.setLayoutManager(layoutManager); + List metas = new ArrayList<>(); + + metas = document.getAllDocumentMetas(100); + + Toast.makeText(getContext(), "Documents: " + Integer.toString(metas.size()), Toast.LENGTH_LONG).show(); + + List documentList = new ArrayList<>(); documentList.add("Document A"); documentList.add("Document B"); From 017748b4a631745cc534d10b7b9a8d64a158966d Mon Sep 17 00:00:00 2001 From: nero Date: Thu, 21 Dec 2023 16:03:49 +0900 Subject: [PATCH 3/8] =?UTF-8?q?=E4=BF=9D=E5=AD=98=E3=81=95=E3=82=8C?= =?UTF-8?q?=E3=81=9F=E3=83=87=E3=83=BC=E3=82=BF=E3=82=92=E4=B8=80=E8=A6=A7?= =?UTF-8?q?=E8=A1=A8=E7=A4=BA=E3=81=A7=E3=81=8D=E3=82=8B=E3=82=88=E3=81=86?= =?UTF-8?q?=E3=81=AB=E3=81=97=E3=81=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../lacerta/feature/library/DocumentAdapter.java | 15 +++++++++------ .../feature/library/LibraryTopFragment.java | 13 +++++++------ 2 files changed, 16 insertions(+), 12 deletions(-) diff --git a/feature/library/src/main/java/one/nem/lacerta/feature/library/DocumentAdapter.java b/feature/library/src/main/java/one/nem/lacerta/feature/library/DocumentAdapter.java index 12b4fdef..ae187769 100644 --- a/feature/library/src/main/java/one/nem/lacerta/feature/library/DocumentAdapter.java +++ b/feature/library/src/main/java/one/nem/lacerta/feature/library/DocumentAdapter.java @@ -10,12 +10,14 @@ import androidx.recyclerview.widget.RecyclerView; import java.util.List; +import one.nem.lacerta.model.document.DocumentMeta; + public class DocumentAdapter extends RecyclerView.Adapter { - private List documentList; + private List documentMetas; - public DocumentAdapter(List documentList) { - this.documentList = documentList; + public DocumentAdapter(List documentMetas) { + this.documentMetas = documentMetas; } @NonNull @@ -27,12 +29,13 @@ public class DocumentAdapter extends RecyclerView.Adapter metas = new ArrayList<>(); metas = document.getAllDocumentMetas(100); Toast.makeText(getContext(), "Documents: " + Integer.toString(metas.size()), Toast.LENGTH_LONG).show(); - - List documentList = new ArrayList<>(); - documentList.add("Document A"); - documentList.add("Document B"); - documentList.add("Document C"); + //仮データを取得 +// List documentList = new ArrayList<>(); +// documentList.add("Document A"); +// documentList.add("Document B"); +// documentList.add("Document C"); // Create and set the adapter - DocumentAdapter adapter = new DocumentAdapter(documentList); + DocumentAdapter adapter = new DocumentAdapter(metas); documentRecyclerView.setAdapter(adapter); // Use a LinearLayoutManager to specify the layout From c35c4e829e59e94fd111440baeb684763d839f48 Mon Sep 17 00:00:00 2001 From: nero Date: Thu, 21 Dec 2023 16:16:07 +0900 Subject: [PATCH 4/8] =?UTF-8?q?=E3=82=B3=E3=83=A1=E3=83=B3=E3=83=88?= =?UTF-8?q?=E3=81=A8=E4=BE=8B=E5=A4=96=E3=81=8C=E8=B5=B7=E3=81=93=E3=81=A3?= =?UTF-8?q?=E3=81=9F=E9=9A=9B=E3=81=AE=E5=87=A6=E7=90=86=E3=82=92=E5=85=A5?= =?UTF-8?q?=E3=82=8C=E3=81=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../nem/lacerta/feature/library/DocumentAdapter.java | 10 ++++++++++ .../lacerta/feature/library/LibraryTopFragment.java | 6 ------ 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/feature/library/src/main/java/one/nem/lacerta/feature/library/DocumentAdapter.java b/feature/library/src/main/java/one/nem/lacerta/feature/library/DocumentAdapter.java index ae187769..c9164fe2 100644 --- a/feature/library/src/main/java/one/nem/lacerta/feature/library/DocumentAdapter.java +++ b/feature/library/src/main/java/one/nem/lacerta/feature/library/DocumentAdapter.java @@ -16,7 +16,12 @@ public class DocumentAdapter extends RecyclerView.Adapter documentMetas; + public DocumentAdapter(List documentMetas) { + // nullの場合に例外を発生させる + if (documentMetas == null) { + throw new IllegalArgumentException("DocumentMetas list cannot be null"); + } this.documentMetas = documentMetas; } @@ -31,6 +36,11 @@ public class DocumentAdapter extends RecyclerView.Adapter documentList = new ArrayList<>(); -// documentList.add("Document A"); -// documentList.add("Document B"); -// documentList.add("Document C"); - // Create and set the adapter DocumentAdapter adapter = new DocumentAdapter(metas); documentRecyclerView.setAdapter(adapter); From ba87fb283e5069f5a0aca86810e8fc635204c82a Mon Sep 17 00:00:00 2001 From: nero Date: Thu, 21 Dec 2023 16:19:34 +0900 Subject: [PATCH 5/8] =?UTF-8?q?=E3=82=B3=E3=83=A1=E3=83=B3=E3=83=88?= =?UTF-8?q?=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../one/nem/lacerta/feature/library/LibraryTopFragment.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/feature/library/src/main/java/one/nem/lacerta/feature/library/LibraryTopFragment.java b/feature/library/src/main/java/one/nem/lacerta/feature/library/LibraryTopFragment.java index 7eed2b35..89de2ee9 100644 --- a/feature/library/src/main/java/one/nem/lacerta/feature/library/LibraryTopFragment.java +++ b/feature/library/src/main/java/one/nem/lacerta/feature/library/LibraryTopFragment.java @@ -88,7 +88,7 @@ public class LibraryTopFragment extends Fragment { LinearLayoutManager layoutManager = new LinearLayoutManager(getContext()); documentRecyclerView.setLayoutManager(layoutManager); - //ダミーデータを取得 + //データを取得 List metas = new ArrayList<>(); metas = document.getAllDocumentMetas(100); From 2402936a19cec86edf367c3c814d0eaf85142c94 Mon Sep 17 00:00:00 2001 From: nero Date: Thu, 21 Dec 2023 16:25:10 +0900 Subject: [PATCH 6/8] =?UTF-8?q?=E9=87=8D=E8=A4=87=E4=BA=8B=E9=A0=85?= =?UTF-8?q?=E3=82=92=E5=89=8A=E9=99=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../one/nem/lacerta/feature/library/DocumentAdapter.java | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/feature/library/src/main/java/one/nem/lacerta/feature/library/DocumentAdapter.java b/feature/library/src/main/java/one/nem/lacerta/feature/library/DocumentAdapter.java index c9164fe2..1d6bcceb 100644 --- a/feature/library/src/main/java/one/nem/lacerta/feature/library/DocumentAdapter.java +++ b/feature/library/src/main/java/one/nem/lacerta/feature/library/DocumentAdapter.java @@ -16,7 +16,6 @@ public class DocumentAdapter extends RecyclerView.Adapter documentMetas; - public DocumentAdapter(List documentMetas) { // nullの場合に例外を発生させる if (documentMetas == null) { @@ -34,9 +33,6 @@ public class DocumentAdapter extends RecyclerView.Adapter Date: Fri, 22 Dec 2023 10:29:57 +0900 Subject: [PATCH 7/8] =?UTF-8?q?=E4=BE=8B=E5=A4=96=E6=99=82=E3=81=AB?= =?UTF-8?q?=E5=87=BA=E5=8A=9B=E3=81=99=E3=82=8B=E3=83=A1=E3=83=83=E3=82=BB?= =?UTF-8?q?=E3=83=BC=E3=82=B8=E3=82=92=E5=A4=89=E6=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/one/nem/lacerta/feature/library/DocumentAdapter.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/feature/library/src/main/java/one/nem/lacerta/feature/library/DocumentAdapter.java b/feature/library/src/main/java/one/nem/lacerta/feature/library/DocumentAdapter.java index 1d6bcceb..987dc903 100644 --- a/feature/library/src/main/java/one/nem/lacerta/feature/library/DocumentAdapter.java +++ b/feature/library/src/main/java/one/nem/lacerta/feature/library/DocumentAdapter.java @@ -19,7 +19,7 @@ public class DocumentAdapter extends RecyclerView.Adapter documentMetas) { // nullの場合に例外を発生させる if (documentMetas == null) { - throw new IllegalArgumentException("DocumentMetas list cannot be null"); + throw new IllegalArgumentException("DocumentMetas list cannot be null or empty"); } this.documentMetas = documentMetas; } From 54f2076eda325c80d1771aaf640ab01c29fb14b9 Mon Sep 17 00:00:00 2001 From: nero Date: Fri, 22 Dec 2023 10:50:23 +0900 Subject: [PATCH 8/8] =?UTF-8?q?ArrayList=E3=82=92=E5=89=8A=E9=99=A4?= =?UTF-8?q?=EF=BC=88=E4=BD=BF=E3=81=A3=E3=81=A6=E3=81=AA=E3=81=8B=E3=81=A3?= =?UTF-8?q?=E3=81=9F=E3=81=AE=E3=81=A7=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../one/nem/lacerta/feature/library/LibraryTopFragment.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/feature/library/src/main/java/one/nem/lacerta/feature/library/LibraryTopFragment.java b/feature/library/src/main/java/one/nem/lacerta/feature/library/LibraryTopFragment.java index 89de2ee9..eb672856 100644 --- a/feature/library/src/main/java/one/nem/lacerta/feature/library/LibraryTopFragment.java +++ b/feature/library/src/main/java/one/nem/lacerta/feature/library/LibraryTopFragment.java @@ -89,9 +89,8 @@ public class LibraryTopFragment extends Fragment { documentRecyclerView.setLayoutManager(layoutManager); //データを取得 - List metas = new ArrayList<>(); - metas = document.getAllDocumentMetas(100); + List metas = document.getAllDocumentMetas(100); Toast.makeText(getContext(), "Documents: " + Integer.toString(metas.size()), Toast.LENGTH_LONG).show();