diff options
author | Clyhtsuriva <aimeric@adjutor.xyz> | 2021-02-22 20:55:37 +0100 |
---|---|---|
committer | Clyhtsuriva <aimeric@adjutor.xyz> | 2021-02-22 20:55:37 +0100 |
commit | ac950ab43854d06ac8ceee3c2402bdee5e13870e (patch) | |
tree | 83aaac57cb504664f56e2ff78954859f31a8933b /app/src/main/java/xyz | |
parent | 4012256bf91ccf02eb1871229f755beb26dad3de (diff) |
SwipeRefresh implemented and added to mangas.
Diffstat (limited to 'app/src/main/java/xyz')
-rw-r--r-- | app/src/main/java/xyz/adjutor/aniki/topmanga/TopMangaPage.kt | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/app/src/main/java/xyz/adjutor/aniki/topmanga/TopMangaPage.kt b/app/src/main/java/xyz/adjutor/aniki/topmanga/TopMangaPage.kt index f99cd9a..c8075b2 100644 --- a/app/src/main/java/xyz/adjutor/aniki/topmanga/TopMangaPage.kt +++ b/app/src/main/java/xyz/adjutor/aniki/topmanga/TopMangaPage.kt @@ -11,6 +11,7 @@ import androidx.fragment.app.Fragment import androidx.navigation.fragment.findNavController import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.RecyclerView +import androidx.swiperefreshlayout.widget.SwipeRefreshLayout import com.google.android.material.snackbar.Snackbar import com.google.gson.GsonBuilder import com.google.gson.reflect.TypeToken @@ -70,6 +71,17 @@ class TopMangaPage : Fragment() { findNavController().navigate(R.id.action_TopMangaPage_to_HomePage) } + fun updateList() { + makeApiCall(view,base_url) + Snackbar.make(requireView(), "Data refreshed", Snackbar.LENGTH_LONG) + .setAction("Action", null).show() + } + val swipeRefresh: SwipeRefreshLayout = view.findViewById(R.id.swiperefresh) + swipeRefresh.setOnRefreshListener{ + updateList() + swipeRefresh.isRefreshing = false + } + } //display the recyclerview |