First stub of the fragment to show the image in full screen

This commit is contained in:
davidoskky 2020-12-12 03:14:12 +01:00
parent 55ced4a5fb
commit 0bab675560
2 changed files with 62 additions and 0 deletions

View File

@ -0,0 +1,52 @@
package apps.amine.bou.readerforselfoss.fragments
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.fragment.app.Fragment
import apps.amine.bou.readerforselfoss.R
import apps.amine.bou.readerforselfoss.api.selfoss.Item
import kotlinx.android.synthetic.main.fragment_article.*
import kotlinx.android.synthetic.main.fragment_article.view.*
import retrofit2.http.Url
class ImageFragment : Fragment() {
private lateinit var position: Number
private lateinit var allImages: ArrayList<String>
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
position = arguments!!.getInt("position")
allImages = arguments!!.getStringArrayList("allImages")
}
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
val view : View = inflater.inflate(R.layout.fragment_image, container, false)
view.webcontent.visibility = View.VISIBLE
view.webcontent.loadUrl(allImages[0])
return view
}
companion object {
private const val ARG_POSITION = "position"
private const val ARG_IMAGES = "allImages"
fun newInstance(
position: Int,
allImages: ArrayList<String>
): ImageFragment {
val fragment = ImageFragment()
val args = Bundle()
args.putInt(ARG_POSITION, position)
args.putStringArrayList(ARG_IMAGES, allImages)
fragment.arguments = args
return fragment
}
}
}

View File

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent"
android:layout_height="match_parent">
<WebView
android:id="@+id/webcontent"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</androidx.constraintlayout.widget.ConstraintLayout>