親の名前出したよ
This commit is contained in:
parent
fc28d43cce
commit
b004d9b3d1
|
@ -1,4 +1,3 @@
|
|||
<?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">
|
||||
|
|
|
@ -0,0 +1,49 @@
|
|||
package one.nem.kidshift.feature.parent;
|
||||
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.CheckBox;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.google.android.material.chip.Chip;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import one.nem.kidshift.model.ChildModel;
|
||||
import one.nem.kidshift.model.tasks.TaskItemModel;
|
||||
|
||||
public class ChildListAdapter extends RecyclerView.Adapter<ChildListAdapter.MainViewHolder> {
|
||||
|
||||
private final List<ChildModel> childDataList;
|
||||
|
||||
ChildListAdapter(List<ChildModel> childDataList) {
|
||||
this.childDataList = childDataList;
|
||||
}
|
||||
|
||||
static class MainViewHolder extends RecyclerView.ViewHolder {
|
||||
CheckBox childname;
|
||||
|
||||
MainViewHolder(@NonNull View itemView) {
|
||||
super(itemView);
|
||||
childname = itemView.findViewById(R.id.childname);
|
||||
}
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public MainViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType){
|
||||
View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.select_child_list,parent,false);
|
||||
return new MainViewHolder(view);
|
||||
}
|
||||
|
||||
public void onBindViewHolder(@NonNull MainViewHolder holder,int position){
|
||||
ChildModel childData = this.childDataList.get(position);
|
||||
holder.childname.setText(childData.getDisplayName());
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount(){ return childDataList.size();}
|
||||
}
|
|
@ -10,6 +10,7 @@ import androidx.recyclerview.widget.RecyclerView;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
import one.nem.kidshift.model.ChildModel;
|
||||
import one.nem.kidshift.model.tasks.TaskItemModel;
|
||||
|
||||
public class ParentAdapter extends RecyclerView.Adapter<ParentAdapter.MainViewHolder> {
|
||||
|
@ -18,6 +19,8 @@ public class ParentAdapter extends RecyclerView.Adapter<ParentAdapter.MainViewHo
|
|||
|
||||
ParentAdapter(List<TaskItemModel> taskDataList) { this.taskDataList = taskDataList; }
|
||||
|
||||
|
||||
|
||||
static class MainViewHolder extends RecyclerView.ViewHolder{
|
||||
TextView taskTitle;
|
||||
TextView taskContents;
|
||||
|
|
|
@ -18,7 +18,9 @@ import java.util.List;
|
|||
import javax.inject.Inject;
|
||||
|
||||
import dagger.hilt.android.AndroidEntryPoint;
|
||||
import one.nem.kidshift.data.ChildData;
|
||||
import one.nem.kidshift.data.TaskData;
|
||||
import one.nem.kidshift.model.ChildModel;
|
||||
import one.nem.kidshift.model.tasks.TaskItemModel;
|
||||
import one.nem.kidshift.utils.KSLogger;
|
||||
|
||||
|
@ -29,6 +31,8 @@ public class ParentMainFragment extends Fragment {
|
|||
KSLogger ksLogger;
|
||||
@Inject
|
||||
TaskData taskData;
|
||||
@Inject
|
||||
ChildData childData;
|
||||
|
||||
public ParentMainFragment() {
|
||||
// Required empty public constructor
|
||||
|
@ -53,10 +57,25 @@ public class ParentMainFragment extends Fragment {
|
|||
RecyclerView.Adapter mainAdapter = new ParentAdapter(task);
|
||||
recyclerView.setAdapter(mainAdapter);
|
||||
|
||||
|
||||
|
||||
//お手伝い追加ダイアログ
|
||||
LayoutInflater inflater1 = requireActivity().getLayoutInflater();
|
||||
View view1 = inflater1.inflate(R.layout.add_task_list_dialog,null);
|
||||
|
||||
//子供選択表示
|
||||
RecyclerView recyclerView1 = view1.findViewById(R.id.taskchild);
|
||||
|
||||
recyclerView1.setHasFixedSize(true);
|
||||
|
||||
RecyclerView.LayoutManager layoutManager1 = new LinearLayoutManager(getContext());
|
||||
recyclerView1.setLayoutManager(layoutManager1);
|
||||
|
||||
List<ChildModel> child = childData.getChildList();
|
||||
|
||||
RecyclerView.Adapter mainAdapter1 = new ChildListAdapter(child);
|
||||
recyclerView1.setAdapter(mainAdapter1);
|
||||
|
||||
MaterialAlertDialogBuilder builder = new MaterialAlertDialogBuilder(getContext());
|
||||
builder.setTitle("お手伝い名追加")
|
||||
.setView(view1)
|
||||
|
|
|
@ -24,11 +24,20 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="15dp"
|
||||
android:ems="10"
|
||||
android:inputType="number"
|
||||
android:hint="金額を入力"
|
||||
android:inputType="number"
|
||||
android:textSize="20dp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/taskname" />
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/taskchild"
|
||||
android:layout_width="232dp"
|
||||
android:layout_height="158dp"
|
||||
android:layout_marginTop="25dp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/taskmoney" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
17
feature/parent/src/main/res/layout/select_child_list.xml
Normal file
17
feature/parent/src/main/res/layout/select_child_list.xml
Normal file
|
@ -0,0 +1,17 @@
|
|||
<?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"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/childname"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="CheckBox"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
|
@ -32,6 +32,7 @@ dependencies {
|
|||
implementation libs.material
|
||||
implementation libs.navigation.fragment
|
||||
implementation libs.navigation.ui
|
||||
implementation libs.swiperefreshlayout
|
||||
testImplementation libs.junit
|
||||
androidTestImplementation libs.ext.junit
|
||||
androidTestImplementation libs.espresso.core
|
||||
|
|
|
@ -6,6 +6,7 @@ import androidx.annotation.NonNull;
|
|||
import androidx.fragment.app.Fragment;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
|
||||
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
|
@ -88,9 +89,38 @@ public class SettingMainFragment extends Fragment {
|
|||
//親の名前、アドレス表示
|
||||
ParentModel parent = parentData.getParent("poiuytrew");
|
||||
|
||||
//RecyclerViewの処理
|
||||
|
||||
|
||||
|
||||
View view = inflater.inflate(R.layout.fragment_setting_main, container, false);
|
||||
|
||||
// Pull-to-refresh(スワイプで更新)
|
||||
SwipeRefreshLayout swipeRefreshLayout = view.findViewById(R.id.swipe_refresh_layout);
|
||||
swipeRefreshLayout.setOnRefreshListener(() ->{
|
||||
|
||||
TextView username = view.findViewById(R.id.username);
|
||||
TextView useradress = view.findViewById(R.id.useradress);
|
||||
|
||||
username.setText(parent.getDisplayName());
|
||||
useradress.setText(parent.getEmail());
|
||||
|
||||
RecyclerView recyclerView = view.findViewById(R.id.childrecyclerview);
|
||||
|
||||
recyclerView.setHasFixedSize(true);
|
||||
|
||||
RecyclerView.LayoutManager layoutManager = new LinearLayoutManager(getContext());
|
||||
recyclerView.setLayoutManager(layoutManager);
|
||||
|
||||
List<ChildModel> child = childData.getChildList();
|
||||
|
||||
RecyclerView.Adapter mainAdapter = new SettingAdapter(child);
|
||||
recyclerView.setAdapter(mainAdapter);
|
||||
|
||||
swipeRefreshLayout.setRefreshing(false);
|
||||
|
||||
});
|
||||
|
||||
//RecyclerViewの処理
|
||||
TextView username = view.findViewById(R.id.username);
|
||||
TextView useradress = view.findViewById(R.id.useradress);
|
||||
|
||||
|
|
|
@ -1,10 +1,23 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:context=".SettingMainFragment">
|
||||
tools:context=".SettingMainFragment"
|
||||
android:id="@+id/swipe_refresh_layout">
|
||||
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<!-- <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"-->
|
||||
<!-- xmlns:app="http://schemas.android.com/apk/res-auto"-->
|
||||
<!-- xmlns:tools="http://schemas.android.com/tools"-->
|
||||
<!-- android:layout_width="match_parent"-->
|
||||
<!-- android:layout_height="match_parent"-->
|
||||
<!-- tools:context=".SettingMainFragment">-->
|
||||
|
||||
<!-- TODO: Update blank fragment layout -->
|
||||
|
||||
|
@ -87,4 +100,5 @@
|
|||
app:layout_constraintStart_toStartOf="parent" />
|
||||
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
|
|
@ -9,6 +9,7 @@ material = "1.12.0"
|
|||
activity = "1.9.0"
|
||||
constraintlayout = "2.1.4"
|
||||
nav = "2.7.7"
|
||||
swiperefreshlayout = "1.1.0"
|
||||
|
||||
[libraries]
|
||||
gson = { module = "com.google.code.gson:gson", version.ref = "gson" }
|
||||
|
@ -26,6 +27,7 @@ com-google-dagger-hilt-compiler = { group="com.google.dagger", name="hilt-compil
|
|||
navigation-fragment = { group="androidx.navigation", name="navigation-fragment", version.ref="nav"}
|
||||
navigation-ui = { group="androidx.navigation", name="navigation-ui", version.ref="nav"}
|
||||
navigation-dynamic-features-fragment = { group="androidx.navigation", name="navigation-dynamic-features-fragment", version.ref="nav"}
|
||||
swiperefreshlayout = { group = "androidx.swiperefreshlayout", name = "swiperefreshlayout", version.ref = "swiperefreshlayout" }
|
||||
|
||||
[plugins]
|
||||
androidApplication = { id = "com.android.application", version.ref = "agp" }
|
||||
|
|
Loading…
Reference in New Issue
Block a user