mirror of
https://github.com/anyproto/anytype-kotlin.git
synced 2025-06-08 05:47:05 +09:00
DROID-3132 Space-level chat | Enhancement | Added loading state for fullscreen media preview + fix window insets
This commit is contained in:
parent
5089a5cc03
commit
14b1de8a8c
3 changed files with 35 additions and 7 deletions
|
@ -6,6 +6,7 @@ import android.view.View
|
|||
import android.view.ViewGroup
|
||||
import androidx.core.os.bundleOf
|
||||
import com.anytypeio.anytype.R
|
||||
import com.anytypeio.anytype.core_utils.ext.argOrNull
|
||||
import com.anytypeio.anytype.core_utils.ui.BaseFragment
|
||||
import com.anytypeio.anytype.databinding.FragmentFullScreenPictureBinding
|
||||
import com.bumptech.glide.Glide
|
||||
|
@ -15,6 +16,10 @@ class FullScreenPictureFragment : BaseFragment<FragmentFullScreenPictureBinding>
|
|||
private val url: String
|
||||
get() = requireArguments().getString(ARG_URL_KEY) ?: throw IllegalStateException()
|
||||
|
||||
private val ignoreRootWindowInsets
|
||||
get() = argOrNull<Boolean>(ARG_IGNORE_INSETS_KEY)
|
||||
|
||||
|
||||
companion object {
|
||||
|
||||
fun new(target: String, url: String) = FullScreenPictureFragment().apply {
|
||||
|
@ -24,10 +29,14 @@ class FullScreenPictureFragment : BaseFragment<FragmentFullScreenPictureBinding>
|
|||
)
|
||||
}
|
||||
|
||||
fun args(url: String) : Bundle = bundleOf(ARG_URL_KEY to url)
|
||||
fun args(
|
||||
url: String,
|
||||
ignoreRootWindowInsets: Boolean = false
|
||||
) : Bundle = bundleOf(ARG_URL_KEY to url, ARG_IGNORE_INSETS_KEY to ignoreRootWindowInsets)
|
||||
|
||||
const val ARG_URL_KEY = "arg.full_screen_picture.url"
|
||||
const val ARG_TARGET_KEY = "arg.full_screen_picture.target"
|
||||
private const val ARG_IGNORE_INSETS_KEY = "arg.full_screen_picture.ignore-insets"
|
||||
}
|
||||
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
|
@ -39,6 +48,14 @@ class FullScreenPictureFragment : BaseFragment<FragmentFullScreenPictureBinding>
|
|||
override fun injectDependencies() {}
|
||||
override fun releaseDependencies() {}
|
||||
|
||||
override fun onApplyWindowRootInsets() {
|
||||
if (ignoreRootWindowInsets != true) {
|
||||
super.onApplyWindowRootInsets()
|
||||
} else {
|
||||
// DO nothing.
|
||||
}
|
||||
}
|
||||
|
||||
override fun inflateBinding(
|
||||
inflater: LayoutInflater,
|
||||
container: ViewGroup?
|
||||
|
|
|
@ -193,12 +193,15 @@ class HomeScreenFragment : BaseComposeFragment(),
|
|||
proceedWithAction(SystemAction.OpenUrl(it))
|
||||
},
|
||||
onRequestOpenFullScreenImage = { url ->
|
||||
findNavController().navigate(
|
||||
R.id.fullScreenImageFragment,
|
||||
FullScreenPictureFragment.args(
|
||||
url = url
|
||||
runCatching {
|
||||
findNavController().navigate(
|
||||
R.id.fullScreenImageFragment,
|
||||
FullScreenPictureFragment.args(
|
||||
url = url,
|
||||
ignoreRootWindowInsets = true
|
||||
)
|
||||
)
|
||||
)
|
||||
}
|
||||
},
|
||||
onSelectChatReaction = {
|
||||
runCatching {
|
||||
|
|
|
@ -2,13 +2,21 @@
|
|||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:background="@color/background_primary"
|
||||
android:id="@+id/root"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<androidx.core.widget.ContentLoadingProgressBar
|
||||
android:layout_gravity="center"
|
||||
android:id="@+id/progress"
|
||||
style="?android:attr/progressBarStyleSmall"
|
||||
android:theme="@style/GreyProgressBar"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"/>
|
||||
|
||||
<com.github.chrisbanes.photoview.PhotoView
|
||||
android:id="@+id/picture"
|
||||
android:layout_width="match_parent"
|
||||
android:background="@color/background_primary"
|
||||
android:layout_height="match_parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue