aboutsummaryrefslogtreecommitdiff
path: root/app/src/main/java/xyz/adjutor
diff options
context:
space:
mode:
authorClyhtsuriva <aimeric@adjutor.xyz>2021-05-31 15:15:39 +0200
committerClyhtsuriva <aimeric@adjutor.xyz>2021-05-31 15:15:39 +0200
commitfc2156374611421c242ff7d65315f52fe57ceecf (patch)
treebbc122054ed71e1032dfbc2e022f202cae28e0c2 /app/src/main/java/xyz/adjutor
parenteea218eda48b3a35a4940d2525b8b7a9fa316ee7 (diff)
Adding the base of bottom navigation.
Also changing the the prev and next button for top manga
Diffstat (limited to 'app/src/main/java/xyz/adjutor')
-rw-r--r--app/src/main/java/xyz/adjutor/aniki/presentation/view/activity/MainActivity.kt30
-rw-r--r--app/src/main/java/xyz/adjutor/aniki/presentation/view/fragment/TopMangaFragment.kt5
2 files changed, 29 insertions, 6 deletions
diff --git a/app/src/main/java/xyz/adjutor/aniki/presentation/view/activity/MainActivity.kt b/app/src/main/java/xyz/adjutor/aniki/presentation/view/activity/MainActivity.kt
index 3a50028..4a3b08b 100644
--- a/app/src/main/java/xyz/adjutor/aniki/presentation/view/activity/MainActivity.kt
+++ b/app/src/main/java/xyz/adjutor/aniki/presentation/view/activity/MainActivity.kt
@@ -2,14 +2,42 @@ package xyz.adjutor.aniki.presentation.view.activity
import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
+import androidx.navigation.NavController
+import androidx.navigation.fragment.NavHostFragment
+import androidx.navigation.ui.AppBarConfiguration
+import androidx.navigation.ui.setupActionBarWithNavController
+import androidx.navigation.ui.setupWithNavController
+import com.google.android.material.bottomnavigation.BottomNavigationView
import xyz.adjutor.aniki.R
+import xyz.adjutor.aniki.databinding.ActivityMainBinding
+
class MainActivity : AppCompatActivity() {
+ private lateinit var binding: ActivityMainBinding
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
- setContentView(R.layout.activity_main)
+
+ binding = ActivityMainBinding.inflate(layoutInflater)
+ setContentView(binding.root)
+
+ val navView: BottomNavigationView = binding.navView
+
+ val navHostFragment =
+ supportFragmentManager.findFragmentById(R.id.nav_host_fragment_activity_main) as NavHostFragment
+ val navController: NavController = navHostFragment.navController
+ // Passing each menu ID as a set of Ids because each
+ // menu should be considered as top level destinations.
+ val appBarConfiguration = AppBarConfiguration(
+ setOf(
+ R.id.navigation_home, R.id.navigation_manga, R.id.navigation_anime
+ )
+ )
setSupportActionBar(findViewById(R.id.toolbar))
+ setupActionBarWithNavController(navController, appBarConfiguration)
+ navView.setupWithNavController(navController)
+
+
}
} \ No newline at end of file
diff --git a/app/src/main/java/xyz/adjutor/aniki/presentation/view/fragment/TopMangaFragment.kt b/app/src/main/java/xyz/adjutor/aniki/presentation/view/fragment/TopMangaFragment.kt
index 7821e50..eb76e86 100644
--- a/app/src/main/java/xyz/adjutor/aniki/presentation/view/fragment/TopMangaFragment.kt
+++ b/app/src/main/java/xyz/adjutor/aniki/presentation/view/fragment/TopMangaFragment.kt
@@ -6,7 +6,6 @@ import android.view.View
import android.view.ViewGroup
import android.widget.Button
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
@@ -38,10 +37,6 @@ class TopMangaFragment : Fragment() {
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
- //button to return to the home page
- view.findViewById<Button>(R.id.button_home).setOnClickListener {
- findNavController().navigate(R.id.action_TopMangaPage_to_HomePage)
- }
view.findViewById<Button>(R.id.button_prev).setOnClickListener {
controller.onButtonPrevClick()
}