Add back button to the Image view

This commit is contained in:
davidoskky 2020-12-12 18:37:30 +01:00
parent 59c307323f
commit 41386adf4e
2 changed files with 21 additions and 7 deletions

View File

@ -7,10 +7,8 @@ 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 apps.amine.bou.readerforselfoss.api.selfoss.Item import kotlinx.android.synthetic.main.fragment_article.view.webcontent
import kotlinx.android.synthetic.main.fragment_article.* import kotlinx.android.synthetic.main.fragment_image.view.*
import kotlinx.android.synthetic.main.fragment_article.view.*
import retrofit2.http.Url
class ImageFragment : Fragment() { class ImageFragment : Fragment() {
@ -29,6 +27,10 @@ class ImageFragment : Fragment() {
(activity as AppCompatActivity).supportActionBar?.hide() (activity as AppCompatActivity).supportActionBar?.hide()
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)

View File

@ -1,11 +1,23 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<LinearLayout <androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:android="http://schemas.android.com/apk/res/android" 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" />
</LinearLayout> </androidx.coordinatorlayout.widget.CoordinatorLayout>