aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClyhtsuriva <aimeric@adjutor.xyz>2021-02-12 11:00:47 +0100
committerClyhtsuriva <aimeric@adjutor.xyz>2021-02-12 11:00:47 +0100
commit3decfd9d0d043c710f48cc145027a7b6bd45df8f (patch)
tree1c9a83333062654fc2477fca074a6e84b664a9fd
parentb96bca561c321fb259895d470b2d01d9c0f34ea9 (diff)
Renaming and adding some functions for the home buttons.
-rw-r--r--app/src/main/java/xyz/adjutor/aniki/FirstFragment.kt11
-rw-r--r--app/src/main/java/xyz/adjutor/aniki/MainActivity.kt6
-rw-r--r--app/src/main/java/xyz/adjutor/aniki/SecondFragment.kt3
-rw-r--r--app/src/main/res/layout/activity_main.xml2
-rw-r--r--app/src/main/res/layout/fragment_first.xml46
-rw-r--r--app/src/main/res/layout/fragment_second.xml10
-rw-r--r--app/src/main/res/values/strings.xml7
7 files changed, 55 insertions, 30 deletions
diff --git a/app/src/main/java/xyz/adjutor/aniki/FirstFragment.kt b/app/src/main/java/xyz/adjutor/aniki/FirstFragment.kt
index 05e5673..e2fa6eb 100644
--- a/app/src/main/java/xyz/adjutor/aniki/FirstFragment.kt
+++ b/app/src/main/java/xyz/adjutor/aniki/FirstFragment.kt
@@ -7,6 +7,7 @@ import android.view.View
import android.view.ViewGroup
import android.widget.Button
import androidx.navigation.fragment.findNavController
+import com.google.android.material.snackbar.Snackbar
/**
* A simple [Fragment] subclass as the default destination in the navigation.
@@ -24,8 +25,16 @@ class FirstFragment : Fragment() {
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
- view.findViewById<Button>(R.id.button_first).setOnClickListener {
+ view.findViewById<Button>(R.id.news).setOnClickListener {
findNavController().navigate(R.id.action_FirstFragment_to_SecondFragment)
}
+ 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()
+ }
+ 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()
+ }
}
} \ No newline at end of file
diff --git a/app/src/main/java/xyz/adjutor/aniki/MainActivity.kt b/app/src/main/java/xyz/adjutor/aniki/MainActivity.kt
index 162ed95..4ccae64 100644
--- a/app/src/main/java/xyz/adjutor/aniki/MainActivity.kt
+++ b/app/src/main/java/xyz/adjutor/aniki/MainActivity.kt
@@ -14,12 +14,10 @@ class MainActivity : AppCompatActivity() {
setContentView(R.layout.activity_main)
setSupportActionBar(findViewById(R.id.toolbar))
- findViewById<FloatingActionButton>(R.id.fab).setOnClickListener { view ->
- Snackbar.make(view, "HA? YOU THOUGHT IT WAS A FEATURE !? BUT IT WAS I, DIO !", Snackbar.LENGTH_LONG)
+ findViewById<FloatingActionButton>(R.id.info).setOnClickListener { view ->
+ Snackbar.make(view, "HA? YOU THOUGHT IT WAS AN INFO !? BUT IT WAS I, DIO !", Snackbar.LENGTH_LONG)
.setAction("Action", null).show()
}
- 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.")
-
}
override fun onCreateOptionsMenu(menu: Menu): Boolean {
diff --git a/app/src/main/java/xyz/adjutor/aniki/SecondFragment.kt b/app/src/main/java/xyz/adjutor/aniki/SecondFragment.kt
index a994c61..2e215c4 100644
--- a/app/src/main/java/xyz/adjutor/aniki/SecondFragment.kt
+++ b/app/src/main/java/xyz/adjutor/aniki/SecondFragment.kt
@@ -24,8 +24,9 @@ class SecondFragment : Fragment() {
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
- view.findViewById<Button>(R.id.button_second).setOnClickListener {
+ view.findViewById<Button>(R.id.home).setOnClickListener {
findNavController().navigate(R.id.action_SecondFragment_to_FirstFragment)
}
+ 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/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml
index bd973bc..b0826f8 100644
--- a/app/src/main/res/layout/activity_main.xml
+++ b/app/src/main/res/layout/activity_main.xml
@@ -23,7 +23,7 @@
<include layout="@layout/content_main" />
<com.google.android.material.floatingactionbutton.FloatingActionButton
- android:id="@+id/fab"
+ android:id="@+id/info"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|end"
diff --git a/app/src/main/res/layout/fragment_first.xml b/app/src/main/res/layout/fragment_first.xml
index c2b4de3..46033be 100644
--- a/app/src/main/res/layout/fragment_first.xml
+++ b/app/src/main/res/layout/fragment_first.xml
@@ -4,41 +4,55 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
+ tools:context=".FirstFragment"
android:background="@color/very_dark_purple"
- tools:context=".FirstFragment">
+ >
<TextView
- android:id="@+id/textview_first"
+ android:id="@+id/title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/black"
android:fontFamily="@font/bangers"
- android:text="@string/hello_first_fragment"
+ android:text="@string/app_name"
android:textAlignment="center"
android:textColor="@color/strong_pink"
- android:textSize="36sp"
- app:layout_constraintBottom_toTopOf="@id/button_first"
- app:layout_constraintEnd_toEndOf="parent"
- app:layout_constraintStart_toStartOf="parent"
- app:layout_constraintTop_toTopOf="parent" />
+ android:textSize="40sp"
+ app:layout_constraintBottom_toTopOf="@id/news"
+ app:layout_constraintTop_toTopOf="parent"
+ />
<Button
- android:id="@+id/button_first"
+ android:id="@+id/news"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:text="@string/press_on_me"
+ android:text="@string/news"
+ app:layout_constraintTop_toBottomOf="@id/title"
app:layout_constraintBottom_toBottomOf="parent"
- app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
- app:layout_constraintTop_toBottomOf="@id/textview_first" />
+ app:layout_constraintEnd_toStartOf="@id/article"
+ />
+
+ <Button
+ android:id="@+id/article"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="@string/article"
+ app:layout_constraintTop_toBottomOf="@id/title"
+ app:layout_constraintBottom_toBottomOf="parent"
+ app:layout_constraintStart_toEndOf="@id/news"
+ app:layout_constraintEnd_toStartOf="@id/top_manga"
+ />
<Button
- android:id="@+id/button_second"
+ android:id="@+id/top_manga"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:text="@string/no_press_on_me"
+ android:text="@string/top_manga"
+ app:layout_constraintTop_toBottomOf="@id/title"
+ app:layout_constraintBottom_toBottomOf="parent"
+ app:layout_constraintStart_toEndOf="@id/article"
app:layout_constraintEnd_toEndOf="parent"
- app:layout_constraintStart_toStartOf="parent"
- app:layout_constraintTop_toBottomOf="@id/button_first" />
+ />
</androidx.constraintlayout.widget.ConstraintLayout> \ No newline at end of file
diff --git a/app/src/main/res/layout/fragment_second.xml b/app/src/main/res/layout/fragment_second.xml
index bd90524..daabf01 100644
--- a/app/src/main/res/layout/fragment_second.xml
+++ b/app/src/main/res/layout/fragment_second.xml
@@ -4,22 +4,24 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
- tools:context=".SecondFragment">
+ tools:context=".SecondFragment"
+ 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/button_second"
+ 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/button_second"
+ android:id="@+id/home"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:text="@string/previous"
+ android:text="@string/home"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index cbf81ad..3eed9c6 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -4,11 +4,12 @@
<!-- Strings used for fragments for navigation -->
<string name="first_fragment_label">First Fragment</string>
<string name="second_fragment_label">Second Fragment</string>
- <string name="press_on_me">PRESS ON ME</string>
- <string name="no_press_on_me">NO, PRESS ON ME !</string>
- <string name="previous">Previous</string>
<string name="hello_first_fragment">Oi Otouto !</string>
<string name="hello_second_fragment">Hello second fragment. Arg: %1$s</string>
<string name="info">Infos about the developper of the app.</string>
+ <string name="news">News</string>
+ <string name="article">Article</string>
+ <string name="top_manga">Top Manga</string>
+ <string name="home">Home</string>
</resources> \ No newline at end of file