mirror of
https://github.com/kiwix/kiwix-android.git
synced 2025-09-22 12:03:09 -04:00
#2159 navigation works but no navigation fragments are implemented
This commit is contained in:
parent
bc532d7abf
commit
560614a292
@ -63,11 +63,12 @@ class KiwixMainActivity : CoreMainActivity() {
|
|||||||
|
|
||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
super.onCreate(savedInstanceState)
|
super.onCreate(savedInstanceState)
|
||||||
|
setContentView(R.layout.activity_kiwix_new_navigation)
|
||||||
|
|
||||||
if (savedInstanceState != null) {
|
if (savedInstanceState != null) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
supportFragmentManager.beginTransaction()
|
supportFragmentManager.beginTransaction()
|
||||||
.add(R.id.fragment_custom_app_container, KiwixMainFragment()).commit()
|
.add(R.id.kiwix_fragment_containter, KiwixMainFragment()).commit()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -87,7 +87,7 @@ class KiwixMainFragment : CoreReaderFragment() {
|
|||||||
) = KiwixWebViewClient(webViewCallback, zimReaderContainer)
|
) = KiwixWebViewClient(webViewCallback, zimReaderContainer)
|
||||||
|
|
||||||
override fun onNewNavigationMenuClicked() {
|
override fun onNewNavigationMenuClicked() {
|
||||||
// do nothing
|
startActivity(Intent(activity, KiwixNewNavigationActivity::class.java))
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun manageExternalLaunchAndRestoringViewState() {
|
private fun manageExternalLaunchAndRestoringViewState() {
|
||||||
|
@ -42,7 +42,6 @@ class KiwixNewNavigationActivity : CoreNewNavigationActivity() {
|
|||||||
|
|
||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
super.onCreate(savedInstanceState)
|
super.onCreate(savedInstanceState)
|
||||||
setContentView(R.layout.activity_new_navigation)
|
|
||||||
val navView: BottomNavigationView = findViewById(R.id.nav_view)
|
val navView: BottomNavigationView = findViewById(R.id.nav_view)
|
||||||
|
|
||||||
navController = findNavController(R.id.nav_host_fragment)
|
navController = findNavController(R.id.nav_host_fragment)
|
||||||
|
@ -18,8 +18,12 @@
|
|||||||
|
|
||||||
package org.kiwix.kiwixmobile.main
|
package org.kiwix.kiwixmobile.main
|
||||||
|
|
||||||
import androidx.fragment.app.Fragment
|
import android.content.Intent
|
||||||
|
import androidx.navigation.fragment.NavHostFragment
|
||||||
class NavigationHostFragment : Fragment() {
|
|
||||||
|
|
||||||
|
class NavigationHostFragment : NavHostFragment() {
|
||||||
|
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
|
||||||
|
super.onActivityResult(requestCode, resultCode, data)
|
||||||
|
childFragmentManager.fragments.forEach { it.onActivityResult(requestCode, resultCode, data) }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
33
app/src/main/res/layout/activity_kiwix_new_navigation.xml
Normal file
33
app/src/main/res/layout/activity_kiwix_new_navigation.xml
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?><!--
|
||||||
|
~ Kiwix Android
|
||||||
|
~ Copyright (c) 2020 Kiwix <android.kiwix.org>
|
||||||
|
~ This program is free software: you can redistribute it and/or modify
|
||||||
|
~ it under the terms of the GNU General Public License as published by
|
||||||
|
~ the Free Software Foundation, either version 3 of the License, or
|
||||||
|
~ (at your option) any later version.
|
||||||
|
~
|
||||||
|
~ This program is distributed in the hope that it will be useful,
|
||||||
|
~ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
~ GNU General Public License for more details.
|
||||||
|
~
|
||||||
|
~ You should have received a copy of the GNU General Public License
|
||||||
|
~ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
~
|
||||||
|
-->
|
||||||
|
|
||||||
|
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
|
<androidx.fragment.app.FragmentContainerView
|
||||||
|
android:id="@+id/kiwix_fragment_containter"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
@ -23,7 +23,7 @@
|
|||||||
android:layout_height="match_parent">
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
<androidx.fragment.app.FragmentContainerView
|
<androidx.fragment.app.FragmentContainerView
|
||||||
android:id="@+id/fragment_custom_app_container"
|
android:id="@+id/fragment_containter"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
@ -71,6 +71,6 @@ class CustomMainActivity : CoreMainActivity() {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
supportFragmentManager.beginTransaction()
|
supportFragmentManager.beginTransaction()
|
||||||
.add(R.id.fragment_custom_app_container, CustomReaderFragment()).commit()
|
.add(R.id.fragment_containter, CustomReaderFragment()).commit()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user