This commit is contained in:
Fuchimoto1234 2023-12-19 12:56:31 +09:00
parent 59a35cbb4a
commit f186064f6e
12 changed files with 124 additions and 6 deletions

View File

@ -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">

View File

@ -1,6 +1,6 @@
<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">

View File

@ -14,5 +14,7 @@ public class LacertaApplication extends Application {
// DynamicColorを有効化
DynamicColors.applyToActivitiesIfAvailable(this);
}
}

View File

@ -35,6 +35,8 @@ public class MainActivity extends AppCompatActivity {
NavigationUI.setupWithNavController(bottomNavigationView, navController);
Toast.makeText(this, "testMessage", Toast.LENGTH_SHORT).show();
}
}

View File

@ -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"
}

View File

@ -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());
}
}

View File

@ -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;
}
}

View File

@ -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);
}
}
}

View File

@ -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;
}
}

View File

@ -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>

View File

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<item name="my_recycler_view" type="id" />
</resources>

View File

@ -0,0 +1,2 @@
<?xml version="1.0" encoding="utf-8"?>
<resources></resources>