diff options
author | Clyhtsuriva <aimeric@adjutor.xyz> | 2021-02-12 12:35:33 +0100 |
---|---|---|
committer | Clyhtsuriva <aimeric@adjutor.xyz> | 2021-02-12 12:35:33 +0100 |
commit | 97ff499413e5dae958ac3741616e2ee84a188871 (patch) | |
tree | 57c5be176a2f5b3e117d0730503d38b08607d4a9 /app/src/main | |
parent | 416450b33960588984d88659d596703e84c8c2d5 (diff) |
Adding Article and Top Manga pages.
Diffstat (limited to 'app/src/main')
-rw-r--r-- | app/src/main/java/xyz/adjutor/aniki/ArticlePage.kt | 31 | ||||
-rw-r--r-- | app/src/main/java/xyz/adjutor/aniki/HomePage.kt | 6 | ||||
-rw-r--r-- | app/src/main/java/xyz/adjutor/aniki/NewsPage.kt | 2 | ||||
-rw-r--r-- | app/src/main/java/xyz/adjutor/aniki/TopMangaPage.kt | 31 | ||||
-rw-r--r-- | app/src/main/res/layout/article_page.xml | 29 | ||||
-rw-r--r-- | app/src/main/res/layout/top_manga_page.xml | 29 | ||||
-rw-r--r-- | app/src/main/res/navigation/nav_graph.xml | 30 | ||||
-rw-r--r-- | app/src/main/res/values/strings.xml | 6 |
8 files changed, 157 insertions, 7 deletions
diff --git a/app/src/main/java/xyz/adjutor/aniki/ArticlePage.kt b/app/src/main/java/xyz/adjutor/aniki/ArticlePage.kt new file mode 100644 index 0000000..68af902 --- /dev/null +++ b/app/src/main/java/xyz/adjutor/aniki/ArticlePage.kt @@ -0,0 +1,31 @@ +package xyz.adjutor.aniki + +import android.os.Bundle +import androidx.fragment.app.Fragment +import android.view.LayoutInflater +import android.view.View +import android.view.ViewGroup +import android.widget.Button +import androidx.navigation.fragment.findNavController + +/** + * A simple [Fragment] subclass as the second destination in the navigation. + */ +class ArticlePage : Fragment() { + + override fun onCreateView( + inflater: LayoutInflater, container: ViewGroup?, + savedInstanceState: Bundle? + ): View? { + // Inflate the layout for this fragment + return inflater.inflate(R.layout.article_page, container, false) + } + + override fun onViewCreated(view: View, savedInstanceState: Bundle?) { + super.onViewCreated(view, savedInstanceState) + + view.findViewById<Button>(R.id.home).setOnClickListener { + findNavController().navigate(R.id.action_ArticlePage_to_HomePage) + } + } +}
\ No newline at end of file diff --git a/app/src/main/java/xyz/adjutor/aniki/HomePage.kt b/app/src/main/java/xyz/adjutor/aniki/HomePage.kt index 377a523..8b932ee 100644 --- a/app/src/main/java/xyz/adjutor/aniki/HomePage.kt +++ b/app/src/main/java/xyz/adjutor/aniki/HomePage.kt @@ -29,12 +29,10 @@ class HomePage : Fragment() { findNavController().navigate(R.id.action_HomePage_to_NewsPage) } view.findViewById<Button>(R.id.article).setOnClickListener { - Snackbar.make(view, "HA? YOU THOUGHT IT WAS AN ARTICLE !? BUT IT WAS I, DIO !", Snackbar.LENGTH_LONG) - .setAction("Action", null).show() + findNavController().navigate(R.id.action_HomePage_to_ArticlePage) } view.findViewById<Button>(R.id.top_manga).setOnClickListener { - Snackbar.make(view, "HA? YOU THOUGHT IT WAS A TOP !? BUT IT WAS I, DIO !", Snackbar.LENGTH_LONG) - .setAction("Action", null).show() + findNavController().navigate(R.id.action_HomePage_to_TopMangaPage) } } }
\ No newline at end of file diff --git a/app/src/main/java/xyz/adjutor/aniki/NewsPage.kt b/app/src/main/java/xyz/adjutor/aniki/NewsPage.kt index 88427fa..6d7b10d 100644 --- a/app/src/main/java/xyz/adjutor/aniki/NewsPage.kt +++ b/app/src/main/java/xyz/adjutor/aniki/NewsPage.kt @@ -27,6 +27,6 @@ class NewsPage : Fragment() { view.findViewById<Button>(R.id.home).setOnClickListener { findNavController().navigate(R.id.action_NewsPage_to_HomePage) } - val industryNews = News(0,"Horror Manga Ajin Ends Nine-Year Serialization","Gamon Sakurai's Ajin (Ajin: Demi-Human) manga ended its nine-year run in the March issue of good! Afternoon on Friday.") + //val industryNews = News(0,"Horror Manga Ajin Ends Nine-Year Serialization","Gamon Sakurai's Ajin (Ajin: Demi-Human) manga ended its nine-year run in the March issue of good! Afternoon on Friday.") } }
\ No newline at end of file diff --git a/app/src/main/java/xyz/adjutor/aniki/TopMangaPage.kt b/app/src/main/java/xyz/adjutor/aniki/TopMangaPage.kt new file mode 100644 index 0000000..c64b9fe --- /dev/null +++ b/app/src/main/java/xyz/adjutor/aniki/TopMangaPage.kt @@ -0,0 +1,31 @@ +package xyz.adjutor.aniki + +import android.os.Bundle +import androidx.fragment.app.Fragment +import android.view.LayoutInflater +import android.view.View +import android.view.ViewGroup +import android.widget.Button +import androidx.navigation.fragment.findNavController + +/** + * A simple [Fragment] subclass as the second destination in the navigation. + */ +class TopMangaPage : Fragment() { + + override fun onCreateView( + inflater: LayoutInflater, container: ViewGroup?, + savedInstanceState: Bundle? + ): View? { + // Inflate the layout for this fragment + return inflater.inflate(R.layout.top_manga_page, container, false) + } + + override fun onViewCreated(view: View, savedInstanceState: Bundle?) { + super.onViewCreated(view, savedInstanceState) + + view.findViewById<Button>(R.id.home).setOnClickListener { + findNavController().navigate(R.id.action_TopMangaPage_to_HomePage) + } + } +}
\ No newline at end of file diff --git a/app/src/main/res/layout/article_page.xml b/app/src/main/res/layout/article_page.xml new file mode 100644 index 0000000..58674de --- /dev/null +++ b/app/src/main/res/layout/article_page.xml @@ -0,0 +1,29 @@ +<?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="match_parent" + tools:context=".ArticlePage" + android:background="@color/very_dark_purple" + > + + <TextView + android:id="@+id/textview_second" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + app:layout_constraintBottom_toTopOf="@id/home" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="parent" /> + + <Button + android:id="@+id/home" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="@string/home" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@id/textview_second" /> +</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file diff --git a/app/src/main/res/layout/top_manga_page.xml b/app/src/main/res/layout/top_manga_page.xml new file mode 100644 index 0000000..6a2f86b --- /dev/null +++ b/app/src/main/res/layout/top_manga_page.xml @@ -0,0 +1,29 @@ +<?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="match_parent" + tools:context=".TopMangaPage" + android:background="@color/very_dark_purple" + > + + <TextView + android:id="@+id/textview_second" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + app:layout_constraintBottom_toTopOf="@id/home" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="parent" /> + + <Button + android:id="@+id/home" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="@string/home" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@id/textview_second" /> +</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file diff --git a/app/src/main/res/navigation/nav_graph.xml b/app/src/main/res/navigation/nav_graph.xml index 78eb7f0..d8d3b26 100644 --- a/app/src/main/res/navigation/nav_graph.xml +++ b/app/src/main/res/navigation/nav_graph.xml @@ -14,7 +14,14 @@ <action android:id="@+id/action_HomePage_to_NewsPage" app:destination="@id/NewsPage" /> + <action + android:id="@+id/action_HomePage_to_ArticlePage" + app:destination="@id/ArticlePage" /> + <action + android:id="@+id/action_HomePage_to_TopMangaPage" + app:destination="@id/TopMangaPage" /> </fragment> + <fragment android:id="@+id/NewsPage" android:name="xyz.adjutor.aniki.NewsPage" @@ -25,4 +32,27 @@ android:id="@+id/action_NewsPage_to_HomePage" app:destination="@id/HomePage" /> </fragment> + + <fragment + android:id="@+id/ArticlePage" + android:name="xyz.adjutor.aniki.ArticlePage" + android:label="@string/article_page_label" + tools:layout="@layout/article_page"> + + <action + android:id="@+id/action_ArticlePage_to_HomePage" + app:destination="@id/HomePage" /> + </fragment> + + <fragment + android:id="@+id/TopMangaPage" + android:name="xyz.adjutor.aniki.TopMangaPage" + android:label="@string/top_manga_page_label" + tools:layout="@layout/top_manga_page"> + + <action + android:id="@+id/action_TopMangaPage_to_HomePage" + app:destination="@id/HomePage" /> + </fragment> + </navigation>
\ No newline at end of file diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index b0be6b2..e076855 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -9,6 +9,8 @@ <string name="article">Article</string> <string name="top_manga">Top Manga</string> <string name="home">Home</string> - <string name="home_page_label">First Fragment</string> - <string name="news_page_label">Second Fragment</string> + <string name="home_page_label">Home Page</string> + <string name="news_page_label">News Page</string> + <string name="article_page_label">Article Page</string> + <string name="top_manga_page_label">Top Manga Page</string> </resources>
\ No newline at end of file |