ぐるぐるさせました #111
|
@ -32,6 +32,7 @@ dependencies {
|
|||
implementation libs.material
|
||||
implementation libs.navigation.fragment
|
||||
implementation libs.navigation.ui
|
||||
implementation libs.androidx.swiperefreshlayout
|
||||
testImplementation libs.junit
|
||||
androidTestImplementation libs.ext.junit
|
||||
androidTestImplementation libs.espresso.core
|
||||
|
|
|
@ -6,7 +6,9 @@ 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.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
@ -38,6 +40,40 @@ public class ParentMainFragment extends Fragment {
|
|||
public ParentMainFragment() {
|
||||
// Required empty public constructor
|
||||
}
|
||||
|
||||
private void dataRefresh(){
|
||||
SwipeRefreshLayout swipeRefreshLayout = requireView().findViewById(R.id.swipe_refresh_layout);
|
||||
swipeRefreshLayout.setRefreshing(true);
|
||||
|
||||
RecyclerView recyclerView =requireView().findViewById(R.id.main_recycle_view);
|
||||
|
||||
recyclerView.setHasFixedSize(true);
|
||||
|
||||
RecyclerView.LayoutManager layoutManager = new LinearLayoutManager(getContext());
|
||||
recyclerView.setLayoutManager(layoutManager);
|
||||
|
||||
List<TaskItemModel> task = taskData.getTasks(new TaskItemModelCallback() {
|
||||
@Override
|
||||
public void onUnchanged() {
|
||||
// TODO
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpdated(List<TaskItemModel> taskItem) {
|
||||
// TODO
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailed(String message) {
|
||||
// TODO
|
||||
}
|
||||
}).join();
|
||||
|
||||
RecyclerView.Adapter mainAdapter = new ParentAdapter(task);
|
||||
recyclerView.setAdapter(mainAdapter);
|
||||
|
||||
swipeRefreshLayout.setRefreshing(false);
|
||||
}
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||
Bundle savedInstanceState) {
|
||||
|
@ -46,37 +82,6 @@ public class ParentMainFragment extends Fragment {
|
|||
//タスク一覧表示
|
||||
View view = inflater.inflate(R.layout.fragment_parent_main, container, false);
|
||||
|
||||
RecyclerView recyclerView = view.findViewById(R.id.main_recycle_view);
|
||||
|
||||
recyclerView.setHasFixedSize(true);
|
||||
|
||||
RecyclerView.LayoutManager layoutManager = new LinearLayoutManager(getContext());
|
||||
recyclerView.setLayoutManager(layoutManager);
|
||||
|
||||
ksLogger.debug("タスク一覧取得開始");
|
||||
List<TaskItemModel> task = taskData.getTasks(new TaskItemModelCallback() {
|
||||
@Override
|
||||
public void onUnchanged() {
|
||||
// TODO: Do something
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpdated(List<TaskItemModel> taskItem) {
|
||||
// TODO: Do something
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailed(String message) {
|
||||
// TODO: Do something
|
||||
}
|
||||
}).join();
|
||||
ksLogger.debug("タスク一覧取得完了");
|
||||
|
||||
RecyclerView.Adapter mainAdapter = new ParentAdapter(task);
|
||||
recyclerView.setAdapter(mainAdapter);
|
||||
|
||||
|
||||
|
||||
//お手伝い追加ダイアログ
|
||||
LayoutInflater inflater1 = requireActivity().getLayoutInflater();
|
||||
View view1 = inflater1.inflate(R.layout.add_task_list_dialog,null);
|
||||
|
@ -114,5 +119,10 @@ public class ParentMainFragment extends Fragment {
|
|||
public void onViewCreated(@NonNull View view, Bundle savedInstanceState) {
|
||||
super.onViewCreated(view, savedInstanceState);
|
||||
// Do something...
|
||||
SwipeRefreshLayout swipeRefreshLayout = view.findViewById(R.id.swipe_refresh_layout);
|
||||
swipeRefreshLayout.setOnRefreshListener(()->{
|
||||
dataRefresh();
|
||||
});
|
||||
|
||||
}
|
||||
}
|
|
@ -1,13 +1,17 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout 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:id="@+id/main"
|
||||
android:id="@+id/swipe_refresh_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
tools:context=".ParentMainFragment">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_height="match_parent"
|
||||
android:layout_width="match_parent"
|
||||
android:orientation="vertical">
|
||||
|
||||
|
||||
<Button
|
||||
android:id="@+id/addtask"
|
||||
|
@ -18,6 +22,7 @@
|
|||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/main_recycle_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
android:layout_height="match_parent" />
|
||||
|
||||
</LinearLayout>
|
||||
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
|
|
@ -32,7 +32,7 @@ dependencies {
|
|||
implementation libs.material
|
||||
implementation libs.navigation.fragment
|
||||
implementation libs.navigation.ui
|
||||
implementation libs.swiperefreshlayout
|
||||
implementation libs.androidx.swiperefreshlayout
|
||||
testImplementation libs.junit
|
||||
androidTestImplementation libs.ext.junit
|
||||
androidTestImplementation libs.espresso.core
|
||||
|
|
|
@ -80,7 +80,6 @@ public class SettingMainFragment extends Fragment {
|
|||
}
|
||||
});
|
||||
|
||||
|
||||
/*
|
||||
TODO:
|
||||
- コールバックの処理を実装
|
||||
|
@ -91,7 +90,6 @@ public class SettingMainFragment extends Fragment {
|
|||
- onFailed時にそれを通知
|
||||
*/
|
||||
|
||||
|
||||
ParentModel parent = completableFuture.join();
|
||||
|
||||
if (parent == null) {
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
[versions]
|
||||
agp = "8.3.2"
|
||||
gson = "2.11.0"
|
||||
javafaker = "1.0.2"
|
||||
junit = "4.13.2"
|
||||
junitVersion = "1.1.5"
|
||||
espressoCore = "3.5.1"
|
||||
|
@ -12,7 +13,6 @@ nav = "2.7.7"
|
|||
swiperefreshlayout = "1.1.0"
|
||||
retrofit = "2.11.0"
|
||||
room = "2.6.1"
|
||||
javafaker = "1.0.2"
|
||||
|
||||
[libraries]
|
||||
converter-gson = { module = "com.squareup.retrofit2:converter-gson", version.ref = "retrofit" }
|
||||
|
@ -32,11 +32,11 @@ 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" }
|
||||
retrofit = { module = "com.squareup.retrofit2:retrofit", version.ref = "retrofit" }
|
||||
|
||||
androidx-room-runtime = { group = "androidx.room", name = "room-runtime", version.ref = "room" }
|
||||
androidx-room-compiler = { group = "androidx.room", name = "room-compiler", version.ref = "room" }
|
||||
androidx-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