라이브 후원 다이얼로그 - 키보드가 올라왔을 때 화면이 전체적으로 위로 이동하여 보이지 않는 부분이 없어지도록 수정

This commit is contained in:
klaus 2023-08-25 21:56:03 +09:00
parent 0a56ef1227
commit 96c72c4fa0
2 changed files with 199 additions and 176 deletions

View File

@ -5,11 +5,14 @@ import android.content.Intent
import android.graphics.Color
import android.graphics.drawable.ColorDrawable
import android.view.LayoutInflater
import android.view.View
import android.view.WindowManager
import android.widget.FrameLayout
import android.widget.Toast
import androidx.appcompat.app.AppCompatActivity
import coil.load
import coil.transform.CircleCropTransformation
import com.google.android.material.bottomsheet.BottomSheetBehavior
import com.google.android.material.bottomsheet.BottomSheetDialog
import kr.co.vividnext.sodalive.R
import kr.co.vividnext.sodalive.common.Constants
@ -32,6 +35,16 @@ class LiveRoomDonationDialog(
bottomSheetDialog.window?.setBackgroundDrawable(ColorDrawable(Color.TRANSPARENT))
bottomSheetDialog.setCancelable(false)
val bottomSheetInternal = bottomSheetDialog.findViewById<FrameLayout>(
com.google.android.material.R.id.design_bottom_sheet
)
if (bottomSheetInternal != null) {
val bottomSheetBehavior = BottomSheetBehavior.from(bottomSheetInternal)
bottomSheetBehavior.state = BottomSheetBehavior.STATE_EXPANDED
bottomSheetBehavior.skipCollapsed = true
}
dialogView.tvCancel.setOnClickListener { bottomSheetDialog.dismiss() }
dialogView.tvDonation.setOnClickListener {
try {
@ -70,6 +83,10 @@ class LiveRoomDonationDialog(
lp.height = WindowManager.LayoutParams.WRAP_CONTENT
bottomSheetDialog.window?.attributes = lp
dialogView.scrollView.post {
dialogView.scrollView.fullScroll(View.FOCUS_DOWN)
}
}
}

View File

@ -1,7 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
<ScrollView 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:id="@+id/scroll_view"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/bg_top_round_corner_10_222222"
@ -157,8 +162,8 @@
android:hint="함께 보낼 메시지 입력(최대 50자)"
android:importantForAutofill="no"
android:inputType="text"
android:maxLines="1"
android:maxLength="50"
android:maxLines="1"
android:padding="13.3dp"
android:textColor="@color/color_eeeeee"
android:textColorHint="@color/color_777777"
@ -201,3 +206,4 @@
android:textSize="18.3sp" />
</LinearLayout>
</LinearLayout>
</ScrollView>