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

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,203 +1,209 @@
<?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"
android:background="@drawable/bg_top_round_corner_10_222222"
android:gravity="center"
android:orientation="vertical"
android:paddingTop="33.3dp"
android:paddingBottom="13.3dp">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingStart="23.33dp"
android:paddingEnd="26.67dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:drawablePadding="6.7dp"
android:fontFamily="@font/gmarket_sans_bold"
android:gravity="center_vertical"
android:text="후원하기"
android:textColor="@color/color_eeeeee"
android:textSize="18.3sp"
app:drawableStartCompat="@drawable/ic_donation_white" />
<TextView
android:id="@+id/tv_can"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:drawablePadding="6.7dp"
android:fontFamily="@font/gmarket_sans_bold"
android:gravity="center"
android:textColor="@color/color_eeeeee"
android:textSize="16sp"
app:drawableEndCompat="@drawable/ic_forward"
app:drawableStartCompat="@drawable/ic_can"
tools:ignore="RelativeOverlap"
tools:text="0" />
</RelativeLayout>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginVertical="16dp"
android:background="@color/color_909090" />
<EditText
android:id="@+id/et_donation_can"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginHorizontal="20dp"
android:background="@drawable/bg_round_corner_6_7_88333333"
android:fontFamily="@font/gmarket_sans_medium"
android:hint="몇 캔을 후원할까요?"
android:importantForAutofill="no"
android:inputType="numberSigned"
android:padding="13.3dp"
android:textColor="@color/color_eeeeee"
android:textColorHint="@color/color_777777"
android:textCursorDrawable="@drawable/edit_text_cursor"
android:textSize="14.7sp"
tools:ignore="LabelFor" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginHorizontal="20dp"
android:layout_marginTop="26dp">
<TextView
android:id="@+id/tv_plus_10"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="@drawable/bg_round_corner_6_7_9970ff"
android:fontFamily="@font/gmarket_sans_bold"
android:gravity="center"
android:paddingVertical="12.7dp"
android:text="+10"
android:textColor="@color/white"
android:textSize="14.7sp" />
<TextView
android:id="@+id/tv_plus_100"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_weight="1"
android:background="@drawable/bg_round_corner_6_7_9970ff"
android:fontFamily="@font/gmarket_sans_bold"
android:gravity="center"
android:paddingVertical="12.7dp"
android:text="+100"
android:textColor="@color/white"
android:textSize="14.7sp" />
<TextView
android:id="@+id/tv_plus_1000"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_weight="1"
android:background="@drawable/bg_round_corner_6_7_9970ff"
android:fontFamily="@font/gmarket_sans_bold"
android:gravity="center"
android:paddingVertical="12.7dp"
android:text="+1000"
android:textColor="@color/white"
android:textSize="14.7sp" />
<TextView
android:id="@+id/tv_plus_10000"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_weight="1"
android:background="@drawable/bg_round_corner_6_7_9970ff"
android:fontFamily="@font/gmarket_sans_bold"
android:gravity="center"
android:paddingVertical="12.7dp"
android:text="+10000"
android:textColor="@color/white"
android:textSize="14.7sp" />
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginHorizontal="20dp"
android:layout_marginVertical="18.7dp"
android:background="@color/color_909090" />
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"
android:gravity="center"
android:paddingHorizontal="20dp">
android:orientation="vertical"
android:paddingTop="33.3dp"
android:paddingBottom="13.3dp">
<ImageView
android:id="@+id/iv_profile"
android:layout_width="40dp"
android:layout_height="40dp"
android:contentDescription="@null" />
<EditText
android:id="@+id/et_donation_message"
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="10.3dp"
android:paddingStart="23.33dp"
android:paddingEnd="26.67dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:drawablePadding="6.7dp"
android:fontFamily="@font/gmarket_sans_bold"
android:gravity="center_vertical"
android:text="후원하기"
android:textColor="@color/color_eeeeee"
android:textSize="18.3sp"
app:drawableStartCompat="@drawable/ic_donation_white" />
<TextView
android:id="@+id/tv_can"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:drawablePadding="6.7dp"
android:fontFamily="@font/gmarket_sans_bold"
android:gravity="center"
android:textColor="@color/color_eeeeee"
android:textSize="16sp"
app:drawableEndCompat="@drawable/ic_forward"
app:drawableStartCompat="@drawable/ic_can"
tools:ignore="RelativeOverlap"
tools:text="0" />
</RelativeLayout>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginVertical="16dp"
android:background="@color/color_909090" />
<EditText
android:id="@+id/et_donation_can"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginHorizontal="20dp"
android:background="@drawable/bg_round_corner_6_7_88333333"
android:fontFamily="@font/gmarket_sans_medium"
android:hint="함께 보낼 메시지 입력(최대 50자)"
android:hint="몇 캔을 후원할까요?"
android:importantForAutofill="no"
android:inputType="text"
android:maxLines="1"
android:maxLength="50"
android:inputType="numberSigned"
android:padding="13.3dp"
android:textColor="@color/color_eeeeee"
android:textColorHint="@color/color_777777"
android:textCursorDrawable="@drawable/edit_text_cursor"
android:textSize="14.7sp"
tools:ignore="LabelFor" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="13.3dp"
android:orientation="horizontal">
<TextView
android:id="@+id/tv_cancel"
android:layout_width="0dp"
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginEnd="13.3dp"
android:layout_weight="1"
android:background="@drawable/bg_round_corner_10_339970ff_9970ff"
android:fontFamily="@font/gmarket_sans_bold"
android:gravity="center"
android:paddingVertical="16dp"
android:text="취소"
android:textColor="@color/color_9970ff"
android:textSize="18.3sp" />
android:layout_marginHorizontal="20dp"
android:layout_marginTop="26dp">
<TextView
android:id="@+id/tv_donation"
android:layout_width="0dp"
<TextView
android:id="@+id/tv_plus_10"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="@drawable/bg_round_corner_6_7_9970ff"
android:fontFamily="@font/gmarket_sans_bold"
android:gravity="center"
android:paddingVertical="12.7dp"
android:text="+10"
android:textColor="@color/white"
android:textSize="14.7sp" />
<TextView
android:id="@+id/tv_plus_100"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_weight="1"
android:background="@drawable/bg_round_corner_6_7_9970ff"
android:fontFamily="@font/gmarket_sans_bold"
android:gravity="center"
android:paddingVertical="12.7dp"
android:text="+100"
android:textColor="@color/white"
android:textSize="14.7sp" />
<TextView
android:id="@+id/tv_plus_1000"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_weight="1"
android:background="@drawable/bg_round_corner_6_7_9970ff"
android:fontFamily="@font/gmarket_sans_bold"
android:gravity="center"
android:paddingVertical="12.7dp"
android:text="+1000"
android:textColor="@color/white"
android:textSize="14.7sp" />
<TextView
android:id="@+id/tv_plus_10000"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_weight="1"
android:background="@drawable/bg_round_corner_6_7_9970ff"
android:fontFamily="@font/gmarket_sans_bold"
android:gravity="center"
android:paddingVertical="12.7dp"
android:text="+10000"
android:textColor="@color/white"
android:textSize="14.7sp" />
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginHorizontal="20dp"
android:layout_marginVertical="18.7dp"
android:background="@color/color_909090" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1.5"
android:background="@drawable/bg_round_corner_10_9970ff"
android:fontFamily="@font/gmarket_sans_bold"
android:gravity="center"
android:paddingVertical="16dp"
android:text="후원하기"
android:textColor="@color/white"
android:textSize="18.3sp" />
android:paddingHorizontal="20dp">
<ImageView
android:id="@+id/iv_profile"
android:layout_width="40dp"
android:layout_height="40dp"
android:contentDescription="@null" />
<EditText
android:id="@+id/et_donation_message"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="10.3dp"
android:background="@drawable/bg_round_corner_6_7_88333333"
android:fontFamily="@font/gmarket_sans_medium"
android:hint="함께 보낼 메시지 입력(최대 50자)"
android:importantForAutofill="no"
android:inputType="text"
android:maxLength="50"
android:maxLines="1"
android:padding="13.3dp"
android:textColor="@color/color_eeeeee"
android:textColorHint="@color/color_777777"
android:textCursorDrawable="@drawable/edit_text_cursor"
android:textSize="14.7sp"
tools:ignore="LabelFor" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="13.3dp"
android:orientation="horizontal">
<TextView
android:id="@+id/tv_cancel"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginEnd="13.3dp"
android:layout_weight="1"
android:background="@drawable/bg_round_corner_10_339970ff_9970ff"
android:fontFamily="@font/gmarket_sans_bold"
android:gravity="center"
android:paddingVertical="16dp"
android:text="취소"
android:textColor="@color/color_9970ff"
android:textSize="18.3sp" />
<TextView
android:id="@+id/tv_donation"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1.5"
android:background="@drawable/bg_round_corner_10_9970ff"
android:fontFamily="@font/gmarket_sans_bold"
android:gravity="center"
android:paddingVertical="16dp"
android:text="후원하기"
android:textColor="@color/white"
android:textSize="18.3sp" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
</ScrollView>