Revert to using Toolbar for navigation.

This commit is contained in:
davidoskky 2020-12-13 16:30:10 +01:00
parent b0c4b010a2
commit 584c6869b5
2 changed files with 10 additions and 23 deletions

View File

@ -1,14 +1,11 @@
package apps.amine.bou.readerforselfoss.fragments package apps.amine.bou.readerforselfoss.fragments
import android.os.Bundle import android.os.Bundle
import android.view.LayoutInflater import android.view.*
import android.view.View
import android.view.ViewGroup
import androidx.appcompat.app.AppCompatActivity import androidx.appcompat.app.AppCompatActivity
import androidx.fragment.app.Fragment import androidx.fragment.app.Fragment
import apps.amine.bou.readerforselfoss.R import apps.amine.bou.readerforselfoss.R
import kotlinx.android.synthetic.main.fragment_article.view.webcontent import kotlinx.android.synthetic.main.fragment_article.view.webcontent
import kotlinx.android.synthetic.main.fragment_image.view.*
class ImageFragment : Fragment() { class ImageFragment : Fragment() {
@ -17,6 +14,7 @@ class ImageFragment : Fragment() {
override fun onCreate(savedInstanceState: Bundle?) { override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState) super.onCreate(savedInstanceState)
setHasOptionsMenu(true)
position = arguments!!.getInt("position") position = arguments!!.getInt("position")
allImages = arguments!!.getStringArrayList("allImages") allImages = arguments!!.getStringArrayList("allImages")
@ -24,13 +22,9 @@ class ImageFragment : Fragment() {
} }
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? { override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
(activity as AppCompatActivity).supportActionBar?.hide() (activity as AppCompatActivity).supportActionBar?.setDisplayShowTitleEnabled(false)
val view : View = inflater.inflate(R.layout.fragment_image, container, false) val view : View = inflater.inflate(R.layout.fragment_image, container, false)
view.backButton.setOnClickListener() {
fragmentManager!!.popBackStackImmediate()
}
view.webcontent.visibility = View.VISIBLE view.webcontent.visibility = View.VISIBLE
view.webcontent.settings.setLoadWithOverviewMode(true) view.webcontent.settings.setLoadWithOverviewMode(true)
view.webcontent.settings.setUseWideViewPort(true) view.webcontent.settings.setUseWideViewPort(true)
@ -42,8 +36,12 @@ class ImageFragment : Fragment() {
return view return view
} }
override fun onCreateOptionsMenu(menu: Menu, inflater: MenuInflater) {
menu.clear()
}
override fun onDestroy() { override fun onDestroy() {
(activity as AppCompatActivity).supportActionBar?.show() (activity as AppCompatActivity).supportActionBar?.setDisplayShowTitleEnabled(true)
super.onDestroy() super.onDestroy()
} }

View File

@ -1,23 +1,12 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android" <androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
android:background="@android:color/black"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent"> android:layout_height="match_parent">
<com.google.android.material.floatingactionbutton.FloatingActionButton
android:id="@+id/backButton"
style="?android:borderlessButtonStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:clickable="true"
app:background="@android:color/transparent"
app:backgroundTint="@null"
app:rippleColor="@null"
app:srcCompat="?attr/homeAsUpIndicator" />
<WebView <WebView
android:id="@+id/webcontent" android:id="@+id/webcontent"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" /> android:layout_height="match_parent" >
</WebView>
</androidx.coordinatorlayout.widget.CoordinatorLayout> </androidx.coordinatorlayout.widget.CoordinatorLayout>