mirror of
https://github.com/lacerta-doc/Lacerta.git
synced 2026-11-02 11:37:37 +00:00
途中
This commit is contained in:
1 parent
59a35cbb4a
commit
f186064f6e
12 files changed
+124
-6
No files matched your search
@@ -1,4 +1,5 @@
|
||||
plugins {
|
||||
id 'com.google.dagger.hilt.android'
|
||||
id 'com.android.library'
|
||||
}
|
||||
|
||||
@@ -50,4 +51,6 @@ dependencies {
|
||||
|
||||
//model
|
||||
implementation project(':model')
|
||||
|
||||
implementation "androidx.recyclerview:recyclerview:1.3.2"
|
||||
}
|
||||
+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());
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -3,18 +3,36 @@ 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 java.util.ArrayList;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
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.
|
||||
* Use the {@link HomeTopFragment#newInstance} factory method to
|
||||
* create an instance of this fragment.
|
||||
*/
|
||||
@AndroidEntryPoint
|
||||
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";
|
||||
@@ -59,6 +77,14 @@ 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);
|
||||
|
||||
ArrayList<DocumentMeta> metas = document.getAllDocumentMetas(100);
|
||||
|
||||
Log.d("docs", Integer.toString(metas.size()));
|
||||
|
||||
return view;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
package one.nem.lacerta.feature.home;
|
||||
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import one.nem.lacerta.model.document.DocumentMeta;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class MyAdapter extends RecyclerView.Adapter<MyAdapter.MyAdapterViewHolder> {
|
||||
public MyAdapter(List<DocumentMeta> documentMeta) {
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public MyAdapterViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull MyAdapterViewHolder holder, int position) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return 100;
|
||||
}
|
||||
|
||||
public class MyAdapterViewHolder extends RecyclerView.ViewHolder {
|
||||
public MyAdapterViewHolder(@NonNull View itemView) {
|
||||
super(itemView);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
@@ -3,12 +3,17 @@
|
||||
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/recycler_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:text="@string/hello_blank_fragment" />
|
||||
android:layout_height="match_parent"/>
|
||||
|
||||
|
||||
</FrameLayout>
|
||||
@@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<item name="my_recycler_view" type="id" />
|
||||
</resources>
|
||||
@@ -0,0 +1,2 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources></resources>
|
||||
Reference in new issue
Block a user