mirror of
https://github.com/lacerta-doc/Lacerta.git
synced 2024-11-22 16:03:15 +00:00
Merge pull request #78 from lacerta-doc/feature/home/add_document_history
ドキュメント履歴をホームに追加
This commit is contained in:
commit
3d2cc5ac05
|
@ -4,6 +4,7 @@
|
|||
<component name="GradleSettings">
|
||||
<option name="linkedExternalProjectsSettings">
|
||||
<GradleProjectSettings>
|
||||
<option name="testRunner" value="GRADLE" />
|
||||
<option name="externalProjectPath" value="$PROJECT_DIR$" />
|
||||
<option name="gradleJvm" value="jbr-17" />
|
||||
<option name="modules">
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ExternalStorageConfigurationManager" enabled="true" />
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_17" default="true" project-jdk-name="jbr-17" project-jdk-type="JavaSDK">
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_17" project-jdk-name="jbr-17" project-jdk-type="JavaSDK">
|
||||
<output url="file://$PROJECT_DIR$/build/classes" />
|
||||
</component>
|
||||
<component name="ProjectType">
|
||||
|
|
|
@ -14,5 +14,7 @@ public class LacertaApplication extends Application {
|
|||
|
||||
// DynamicColorを有効化
|
||||
DynamicColors.applyToActivitiesIfAvailable(this);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -35,6 +35,8 @@ public class MainActivity extends AppCompatActivity {
|
|||
NavigationUI.setupWithNavController(bottomNavigationView, navController);
|
||||
|
||||
Toast.makeText(this, "testMessage", Toast.LENGTH_SHORT).show();
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -23,4 +23,6 @@
|
|||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/debug_menu_item_title" />
|
||||
|
||||
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
|
@ -1,4 +1,5 @@
|
|||
plugins {
|
||||
id 'com.google.dagger.hilt.android'
|
||||
id 'com.android.library'
|
||||
}
|
||||
|
||||
|
@ -29,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
|
||||
|
@ -38,6 +41,18 @@ dependencies {
|
|||
implementation libs.navigation.ui
|
||||
implementation libs.navigation.dynamic.features.fragment
|
||||
|
||||
// DI
|
||||
implementation libs.com.google.dagger.hilt.android
|
||||
annotationProcessor libs.com.google.dagger.hilt.compiler
|
||||
|
||||
// shared
|
||||
implementation project(':shared:ui')
|
||||
|
||||
// DI
|
||||
implementation project(':data')
|
||||
|
||||
//model
|
||||
implementation project(':model')
|
||||
|
||||
implementation "androidx.recyclerview:recyclerview:1.3.2"
|
||||
}
|
|
@ -22,5 +22,7 @@ public class ExampleInstrumentedTest {
|
|||
// Context of the app under test.
|
||||
Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
|
||||
assertEquals("one.nem.lacerta.feature.home.test", appContext.getPackageName());
|
||||
|
||||
|
||||
}
|
||||
}
|
|
@ -1,20 +1,40 @@
|
|||
package one.nem.lacerta.feature.home;
|
||||
|
||||
import android.os.Bundle;
|
||||
|
||||
import androidx.fragment.app.Fragment;
|
||||
|
||||
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.data.LacertaLibrary;
|
||||
import one.nem.lacerta.model.ListItem;
|
||||
import one.nem.lacerta.model.document.DocumentMeta;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* A simple {@link Fragment} subclass.
|
||||
* Use the {@link HomeTopFragment#newInstance} factory method to
|
||||
* create an instance of this fragment.
|
||||
*/
|
||||
@AndroidEntryPoint
|
||||
public class HomeTopFragment extends Fragment {
|
||||
|
||||
@Inject
|
||||
LacertaLibrary lacertaLibrary;
|
||||
|
||||
|
||||
// TODO: Rename parameter arguments, choose names that match
|
||||
// the fragment initialization parameters, e.g. ARG_ITEM_NUMBER
|
||||
private static final String ARG_PARAM1 = "param1";
|
||||
|
@ -46,12 +66,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);
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -59,6 +82,42 @@ public class HomeTopFragment extends Fragment {
|
|||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||
Bundle savedInstanceState) {
|
||||
// Inflate the layout for this fragment
|
||||
return inflater.inflate(R.layout.fragment_home_top, container, false);
|
||||
}
|
||||
View view = inflater.inflate(R.layout.fragment_home_top, container, false);
|
||||
|
||||
// List<DocumentMeta> metas = document.getAllDocumentMetas(100);
|
||||
|
||||
List<ListItem> listItem = lacertaLibrary.getRecentDocument(100).getListItems();
|
||||
|
||||
Log.d("docs", Integer.toString(listItem.size()));
|
||||
|
||||
RecyclerView recyclerView = view.findViewById(R.id.item_recycler_view);
|
||||
|
||||
recyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
|
||||
|
||||
MyAdapter myAdapter = new MyAdapter(listItems);
|
||||
|
||||
recyclerView.setAdapter(myAdapter);
|
||||
|
||||
return view;
|
||||
|
||||
|
||||
}
|
||||
String pageTitle;
|
||||
String pageId;
|
||||
ArrayList listItems;
|
||||
|
||||
String title;
|
||||
String description;
|
||||
|
||||
String itemId;
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -0,0 +1,70 @@
|
|||
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.ListItem;
|
||||
import one.nem.lacerta.model.document.DocumentMeta;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class MyAdapter extends RecyclerView.Adapter<MyAdapter.MyAdapterViewHolder> {
|
||||
|
||||
ArrayList<ListItem> listItems;
|
||||
|
||||
public MyAdapter(ArrayList<ListItem> ListItem) {
|
||||
// this.listItem = listItem;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public MyAdapterViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
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(listItems.get(position).getTitle());
|
||||
holder.description.setText(listItems.get(position).getDescription());
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return listItems.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);
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -3,12 +3,19 @@
|
|||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:context=".HomeTopFragment">
|
||||
tools:context=".HomeTopFragment"
|
||||
tools:ignore="ExtraText">
|
||||
|
||||
|
||||
<!-- TODO: Update blank fragment layout -->
|
||||
<TextView
|
||||
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/item_recycler_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:text="@string/hello_blank_fragment" />
|
||||
android:layout_height="match_parent">
|
||||
|
||||
|
||||
</androidx.recyclerview.widget.RecyclerView>
|
||||
|
||||
</FrameLayout>
|
36
feature/home/src/main/res/layout/list_item_home_document.xml
Normal file
36
feature/home/src/main/res/layout/list_item_home_document.xml
Normal file
|
@ -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"
|
||||
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" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/debug_menu_item_updated_at_home"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="14sp"
|
||||
android:text="Updated at: aaaaaaaaaa"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
6
feature/home/src/main/res/values/ids.xml
Normal file
6
feature/home/src/main/res/values/ids.xml
Normal file
|
@ -0,0 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<item name="my_recycler_view" type="id" />
|
||||
<item name="TITLE" type="id" />
|
||||
<item name="textView" type="id" />
|
||||
</resources>
|
2
feature/home/src/main/res/values/refs.xml
Normal file
2
feature/home/src/main/res/values/refs.xml
Normal file
|
@ -0,0 +1,2 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources></resources>
|
|
@ -1,4 +1,5 @@
|
|||
<resources>
|
||||
<!-- TODO: Remove or change this placeholder text -->
|
||||
<string name="hello_blank_fragment">Hello blank fragment</string>
|
||||
<string name="textview">TextView</string>
|
||||
</resources>
|
|
@ -25,6 +25,8 @@ 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
|
||||
|
|
|
@ -73,4 +73,6 @@ public class DocumentDetail {
|
|||
this.pages = pages;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user