diff options
Diffstat (limited to 'app/src/main/java')
-rw-r--r-- | app/src/main/java/xyz/adjutor/aniki/presentation/view/activity/MainActivity.kt | 30 | ||||
-rw-r--r-- | app/src/main/java/xyz/adjutor/aniki/presentation/view/fragment/TopMangaFragment.kt | 5 |
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() } |