From 20d30e338e76e57f1d6c6c5bbb38c3aa7d5e9375 Mon Sep 17 00:00:00 2001 From: Fuchimoto1234 Date: Wed, 17 Jan 2024 12:35:30 +0900 Subject: [PATCH] wip --- .../java/one/nem/lacerta/MainActivity.java | 2 +- .../java/one/nem/lacerta/data/Document.java | 4 ++ .../nem/lacerta/data/impl/DocumentImpl.java | 10 ++++ .../main/res/layout/list_item_debug_menu.xml | 2 + feature/home/build.gradle | 2 + .../lacerta/feature/home/HomeTopFragment.java | 53 +++++++++++++++---- .../nem/lacerta/feature/home/MyAdapter.java | 34 +++++++++++- .../nem/lacerta/feature/home/myfragment.java | 33 ------------ .../src/main/res/layout/fragment_home_top.xml | 4 +- .../res/layout/list_item_home_document.xml | 10 ++++ feature/home/src/main/res/values/ids.xml | 2 + feature/home/src/main/res/values/strings.xml | 1 + .../feature/library/LibraryTopFragment.java | 2 + .../model/document/DocumentDetail.java | 4 +- 14 files changed, 115 insertions(+), 48 deletions(-) delete mode 100644 feature/home/src/main/java/one/nem/lacerta/feature/home/myfragment.java diff --git a/app/src/main/java/one/nem/lacerta/MainActivity.java b/app/src/main/java/one/nem/lacerta/MainActivity.java index b8c7bed8..283e0e12 100644 --- a/app/src/main/java/one/nem/lacerta/MainActivity.java +++ b/app/src/main/java/one/nem/lacerta/MainActivity.java @@ -39,4 +39,4 @@ public class MainActivity extends AppCompatActivity { } -} \ No newline at end of file +} diff --git a/data/src/main/java/one/nem/lacerta/data/Document.java b/data/src/main/java/one/nem/lacerta/data/Document.java index 78293c85..eaa7b4bf 100644 --- a/data/src/main/java/one/nem/lacerta/data/Document.java +++ b/data/src/main/java/one/nem/lacerta/data/Document.java @@ -43,4 +43,8 @@ public interface Document { DocumentDetail getDocumentDetailByMeta(DocumentMeta meta); // 簡単に使えるように DocumentDetail createDocumentByMeta(DocumentMeta meta); + + Object getDocumentDetail(); + + ArrayList getAllDocumentDetail(int i); } diff --git a/data/src/main/java/one/nem/lacerta/data/impl/DocumentImpl.java b/data/src/main/java/one/nem/lacerta/data/impl/DocumentImpl.java index 0be30724..1740ef3c 100644 --- a/data/src/main/java/one/nem/lacerta/data/impl/DocumentImpl.java +++ b/data/src/main/java/one/nem/lacerta/data/impl/DocumentImpl.java @@ -138,4 +138,14 @@ public class DocumentImpl implements Document{ return documentDetail; } + + @Override + public Object getDocumentDetail() { + return null; + } + + @Override + public ArrayList getAllDocumentDetail(int i) { + return null; + } } diff --git a/feature/debug/src/main/res/layout/list_item_debug_menu.xml b/feature/debug/src/main/res/layout/list_item_debug_menu.xml index 277da422..607fd4e6 100644 --- a/feature/debug/src/main/res/layout/list_item_debug_menu.xml +++ b/feature/debug/src/main/res/layout/list_item_debug_menu.xml @@ -23,4 +23,6 @@ app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toBottomOf="@+id/debug_menu_item_title" /> + + \ No newline at end of file diff --git a/feature/home/build.gradle b/feature/home/build.gradle index 35c3fbbe..e3aa10e0 100644 --- a/feature/home/build.gradle +++ b/feature/home/build.gradle @@ -30,6 +30,8 @@ dependencies { implementation libs.androidx.appcompat implementation libs.com.google.android.material + implementation project(path: ':feature:debug') + implementation project(path: ':utils') testImplementation libs.junit androidTestImplementation libs.androidx.test.ext.junit androidTestImplementation libs.androidx.test.espresso.core diff --git a/feature/home/src/main/java/one/nem/lacerta/feature/home/HomeTopFragment.java b/feature/home/src/main/java/one/nem/lacerta/feature/home/HomeTopFragment.java index dfea5c28..6d65d29b 100644 --- a/feature/home/src/main/java/one/nem/lacerta/feature/home/HomeTopFragment.java +++ b/feature/home/src/main/java/one/nem/lacerta/feature/home/HomeTopFragment.java @@ -1,26 +1,25 @@ package one.nem.lacerta.feature.home; import android.os.Bundle; - -import androidx.fragment.app.Fragment; -import androidx.recyclerview.widget.LinearLayoutManager; -import androidx.recyclerview.widget.RecyclerView; - import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; +import androidx.fragment.app.Fragment; +import androidx.recyclerview.widget.LinearLayoutManager; +import androidx.recyclerview.widget.RecyclerView; + 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; -import dagger.hilt.android.AndroidEntryPoint; /** * A simple {@link Fragment} subclass. @@ -33,6 +32,11 @@ public class HomeTopFragment 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"; @@ -64,12 +68,15 @@ public class HomeTopFragment extends Fragment { return fragment; } + @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); if (getArguments() != null) { mParam1 = getArguments().getString(ARG_PARAM1); mParam2 = getArguments().getString(ARG_PARAM2); + + } } @@ -79,12 +86,38 @@ public class HomeTopFragment extends Fragment { // Inflate the layout for this fragment View view = inflater.inflate(R.layout.fragment_home_top, container, false); - ArrayList metas = document.getAllDocumentMetas(100); + List metas = document.getAllDocumentMetas(100); Log.d("docs", Integer.toString(metas.size())); + RecyclerView recyclerView = view.findViewById(R.id.recycler_view); + + recyclerView.setLayoutManager(new LinearLayoutManager(getContext())); + + MyAdapter myAdapter = new MyAdapter(metas); + + recyclerView.setAdapter(myAdapter); + return view; - } -} \ No newline at end of file + } +String pageTitle; + String pageId; + ArrayList listItems; + + String title; + String description; + + String itemId; + + + +} + + + + + + + diff --git a/feature/home/src/main/java/one/nem/lacerta/feature/home/MyAdapter.java b/feature/home/src/main/java/one/nem/lacerta/feature/home/MyAdapter.java index d9b8ace8..e6e251dd 100644 --- a/feature/home/src/main/java/one/nem/lacerta/feature/home/MyAdapter.java +++ b/feature/home/src/main/java/one/nem/lacerta/feature/home/MyAdapter.java @@ -1,7 +1,9 @@ package one.nem.lacerta.feature.home; +import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; +import android.widget.TextView; import one.nem.lacerta.model.document.DocumentMeta; @@ -11,28 +13,56 @@ import androidx.recyclerview.widget.RecyclerView; import java.util.List; public class MyAdapter extends RecyclerView.Adapter { + + List documentMetas; + public MyAdapter(List documentMeta) { + this.documentMetas = documentMeta; } @NonNull @Override public MyAdapterViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { - return null; + View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.list_item_home_document, parent, false); + return new MyAdapterViewHolder(view); } @Override public void onBindViewHolder(@NonNull MyAdapterViewHolder holder, int position) { + + holder.title.setText(documentMetas.get(position).getTitle()); + holder.description.setText(documentMetas.get(position).getId()); + + + + + + + + } + @Override public int getItemCount() { - return 100; + return documentMetas.size(); } public class MyAdapterViewHolder extends RecyclerView.ViewHolder { + + TextView title; + + TextView description; + public MyAdapterViewHolder(@NonNull View itemView) { super(itemView); + + title = itemView.findViewById(R.id.debug_menu_item_title); + description = itemView.findViewById(R.id.debug_menu_item_description); + + } } } + diff --git a/feature/home/src/main/java/one/nem/lacerta/feature/home/myfragment.java b/feature/home/src/main/java/one/nem/lacerta/feature/home/myfragment.java deleted file mode 100644 index d780eb79..00000000 --- a/feature/home/src/main/java/one/nem/lacerta/feature/home/myfragment.java +++ /dev/null @@ -1,33 +0,0 @@ -package one.nem.lacerta.feature.home; - -import android.os.Bundle; -import android.view.LayoutInflater; -import android.view.View; -import android.view.ViewGroup; - -import androidx.fragment.app.Fragment; -import androidx.recyclerview.widget.LinearLayoutManager; -import androidx.recyclerview.widget.RecyclerView; - -public class myfragment extends Fragment { - private RecyclerView recyclerView; - private RecyclerView.Adapter mAdapter; - private RecyclerView.LayoutManager layoutManager; - - @Override - public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { - View view = inflater.inflate(R.layout.fragment_home_top, container, false); - - recyclerView = view.findViewById(R.id.recycler_view); - recyclerView.setHasFixedSize(true); - - layoutManager = new LinearLayoutManager(getActivity()); - recyclerView.setLayoutManager(layoutManager); - - Object myDataset = 100; - mAdapter = new MyAdapter(myDataset); - recyclerView.setAdapter(mAdapter); - - return view; - } -} diff --git a/feature/home/src/main/res/layout/fragment_home_top.xml b/feature/home/src/main/res/layout/fragment_home_top.xml index b9695d7d..3895dcbe 100644 --- a/feature/home/src/main/res/layout/fragment_home_top.xml +++ b/feature/home/src/main/res/layout/fragment_home_top.xml @@ -13,7 +13,9 @@ + android:layout_height="match_parent"> + + \ No newline at end of file diff --git a/feature/home/src/main/res/layout/list_item_home_document.xml b/feature/home/src/main/res/layout/list_item_home_document.xml index 277da422..b165608b 100644 --- a/feature/home/src/main/res/layout/list_item_home_document.xml +++ b/feature/home/src/main/res/layout/list_item_home_document.xml @@ -23,4 +23,14 @@ app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toBottomOf="@+id/debug_menu_item_title" /> + + + \ No newline at end of file diff --git a/feature/home/src/main/res/values/ids.xml b/feature/home/src/main/res/values/ids.xml index 6f5c6a16..a72561ba 100644 --- a/feature/home/src/main/res/values/ids.xml +++ b/feature/home/src/main/res/values/ids.xml @@ -1,4 +1,6 @@ + + \ No newline at end of file diff --git a/feature/home/src/main/res/values/strings.xml b/feature/home/src/main/res/values/strings.xml index 6048840e..f00d1b44 100644 --- a/feature/home/src/main/res/values/strings.xml +++ b/feature/home/src/main/res/values/strings.xml @@ -1,4 +1,5 @@ Hello blank fragment + TextView \ 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 495b235d..b08bfccc 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 @@ -8,6 +8,8 @@ import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; + + /** * A simple {@link Fragment} subclass. * Use the {@link LibraryTopFragment#newInstance} factory method to diff --git a/model/src/main/java/one/nem/lacerta/model/document/DocumentDetail.java b/model/src/main/java/one/nem/lacerta/model/document/DocumentDetail.java index 13559491..a9c696ee 100644 --- a/model/src/main/java/one/nem/lacerta/model/document/DocumentDetail.java +++ b/model/src/main/java/one/nem/lacerta/model/document/DocumentDetail.java @@ -125,4 +125,6 @@ public class DocumentDetail { this.repository = repository; } -} + + } +