add reply BottomSheet
This commit is contained in:
parent
dc139d4dae
commit
afc7169b67
|
@ -48,7 +48,8 @@
|
|||
<activity android:name=".components.about.licenses.LicenseActivity"/>
|
||||
<activity android:name="at.connyduck.pixelcat.components.compose.ComposeActivity" />
|
||||
<activity android:name=".components.profile.ProfileActivity" />
|
||||
<activity android:name=".components.timeline.detail.DetailActivity" />
|
||||
<activity android:name=".components.timeline.detail.DetailActivity"
|
||||
android:windowSoftInputMode="adjustResize|stateVisible"/>
|
||||
|
||||
<service android:name=".components.compose.SendStatusService" />
|
||||
|
||||
|
|
|
@ -4,6 +4,8 @@ import android.content.Context
|
|||
import android.content.Intent
|
||||
import android.os.Bundle
|
||||
import androidx.activity.viewModels
|
||||
import androidx.core.graphics.Insets
|
||||
import androidx.core.view.WindowInsetsCompat
|
||||
import androidx.lifecycle.Observer
|
||||
import androidx.recyclerview.widget.ConcatAdapter
|
||||
import at.connyduck.pixelcat.R
|
||||
|
@ -20,6 +22,7 @@ import at.connyduck.pixelcat.dagger.ViewModelFactory
|
|||
import at.connyduck.pixelcat.databinding.ActivityDetailBinding
|
||||
import at.connyduck.pixelcat.db.entitity.StatusEntity
|
||||
import at.connyduck.pixelcat.util.viewBinding
|
||||
import com.google.android.material.bottomsheet.BottomSheetBehavior
|
||||
import javax.inject.Inject
|
||||
|
||||
class DetailActivity : BaseActivity(), TimeLineActionListener {
|
||||
|
@ -40,11 +43,12 @@ class DetailActivity : BaseActivity(), TimeLineActionListener {
|
|||
setContentView(binding.root)
|
||||
|
||||
binding.root.setOnApplyWindowInsetsListener { _, insets ->
|
||||
val top = insets.systemWindowInsetTop
|
||||
binding.root.setPadding(0, insets.systemWindowInsetTop, 0, 0)
|
||||
|
||||
binding.root.setPadding(0, top, 0, 0)
|
||||
|
||||
insets.consumeSystemWindowInsets()
|
||||
WindowInsetsCompat.Builder(WindowInsetsCompat.toWindowInsetsCompat(insets))
|
||||
.setSystemWindowInsets(Insets.of(insets.systemWindowInsetLeft, 0, insets.systemWindowInsetRight, insets.systemWindowInsetBottom))
|
||||
.build()
|
||||
.toWindowInsets()
|
||||
}
|
||||
|
||||
binding.detailSwipeRefresh.setColorSchemeColors(
|
||||
|
@ -115,7 +119,9 @@ class DetailActivity : BaseActivity(), TimeLineActionListener {
|
|||
}
|
||||
|
||||
override fun onReply(status: StatusEntity) {
|
||||
TODO("Not yet implemented")
|
||||
val replyBottomsheet = BottomSheetBehavior.from(binding.detailReplyBottomSheet)
|
||||
replyBottomsheet.state = BottomSheetBehavior.STATE_EXPANDED
|
||||
binding.detailReply.requestFocus()
|
||||
}
|
||||
|
||||
override fun onMediaVisibilityChanged(status: StatusEntity) {
|
||||
|
|
|
@ -0,0 +1,20 @@
|
|||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24">
|
||||
<path
|
||||
android:pathData="M22,2L11,13"
|
||||
android:strokeLineJoin="round"
|
||||
android:strokeWidth="2"
|
||||
android:fillColor="#00000000"
|
||||
android:strokeColor="?android:attr/textColorTertiary"
|
||||
android:strokeLineCap="round"/>
|
||||
<path
|
||||
android:pathData="M22,2l-7,20l-4,-9l-9,-4l20,-7z"
|
||||
android:strokeLineJoin="round"
|
||||
android:strokeWidth="2"
|
||||
android:fillColor="#00000000"
|
||||
android:strokeColor="?android:attr/textColorTertiary"
|
||||
android:strokeLineCap="round"/>
|
||||
</vector>
|
|
@ -1,9 +1,11 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@drawable/pixelcat_gradient">
|
||||
android:background="@drawable/pixelcat_gradient"
|
||||
android:fitsSystemWindows="true">
|
||||
|
||||
<com.google.android.material.appbar.AppBarLayout
|
||||
android:id="@+id/detailAppbar"
|
||||
|
@ -54,4 +56,48 @@
|
|||
|
||||
</FrameLayout>
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/detailReplyBottomSheet"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/background_bottom_sheet"
|
||||
android:elevation="4dp"
|
||||
app:behavior_hideable="true"
|
||||
app:behavior_peekHeight="0dp"
|
||||
app:layout_behavior="com.google.android.material.bottomsheet.BottomSheetBehavior">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/detailReplyingTo"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginTop="16dp"
|
||||
android:text="replying to @ConnyDuck"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<com.google.android.material.textfield.TextInputLayout
|
||||
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginTop="8dp"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:layout_marginBottom="16dp"
|
||||
app:endIconDrawable="@drawable/ic_send"
|
||||
app:endIconMode="custom"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/detailReplyingTo">
|
||||
|
||||
<com.google.android.material.textfield.TextInputEditText
|
||||
android:id="@+id/detailReply"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
</com.google.android.material.textfield.TextInputLayout>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
Loading…
Reference in New Issue