From baba9281fb4bc00416fa644db21ba4487fdd7f8e Mon Sep 17 00:00:00 2001 From: KIM MINJEONG Date: Wed, 17 Jan 2024 21:53:03 +0900 Subject: [PATCH 1/3] =?UTF-8?q?#79=20[mod]=20toast=20=EB=A9=94=EC=8B=9C?= =?UTF-8?q?=EC=A7=80=20=EC=A7=80=EC=86=8D=20=EC=8B=9C=EA=B0=84=20=EB=B3=80?= =?UTF-8?q?=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/src/main/java/com/sopetit/softie/util/Context.kt | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/com/sopetit/softie/util/Context.kt b/app/src/main/java/com/sopetit/softie/util/Context.kt index f873a238..42f5e772 100644 --- a/app/src/main/java/com/sopetit/softie/util/Context.kt +++ b/app/src/main/java/com/sopetit/softie/util/Context.kt @@ -4,6 +4,8 @@ import android.app.Activity import android.content.Context import android.content.Intent import android.os.Build +import android.os.Handler +import android.os.Looper import android.view.View import android.view.inputmethod.InputMethodManager import android.widget.Toast @@ -24,7 +26,11 @@ fun snackBar( } fun Context.toast(message: String) { - Toast.makeText(this, message, Toast.LENGTH_SHORT).show() + val toast = Toast.makeText(this, message, Toast.LENGTH_SHORT) + toast.show() + Handler(Looper.getMainLooper()).postDelayed({ + run() { toast.cancel() } + }, 1000) } fun Fragment.setStatusBarColor(colorResId: Int) { From 9e6b808f25c8523aca766aa068d8b66bc149f5de Mon Sep 17 00:00:00 2001 From: KIM MINJEONG Date: Wed, 17 Jan 2024 22:14:01 +0900 Subject: [PATCH 2/3] =?UTF-8?q?#79=20[add]=20=ED=99=94=EB=A9=B4=20?= =?UTF-8?q?=ED=81=B4=EB=A6=AD=EC=8B=9C=20hidekeyboard=20&=20edt=20?= =?UTF-8?q?=ED=8F=AC=EC=BB=A4=EC=8A=A4=20=ED=95=B4=EC=A0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../softie/ui/onboarding/OnboardingActivity.kt | 7 +++++++ app/src/main/java/com/sopetit/softie/util/Context.kt | 11 ++++++++--- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/com/sopetit/softie/ui/onboarding/OnboardingActivity.kt b/app/src/main/java/com/sopetit/softie/ui/onboarding/OnboardingActivity.kt index b42cc9e1..abcd70f6 100644 --- a/app/src/main/java/com/sopetit/softie/ui/onboarding/OnboardingActivity.kt +++ b/app/src/main/java/com/sopetit/softie/ui/onboarding/OnboardingActivity.kt @@ -4,6 +4,7 @@ import android.os.Bundle import android.text.SpannableStringBuilder import android.text.Spanned import android.text.style.ForegroundColorSpan +import android.view.MotionEvent import androidx.activity.viewModels import androidx.core.content.ContextCompat import androidx.fragment.app.Fragment @@ -16,6 +17,7 @@ import com.sopetit.softie.ui.onboarding.routinechoice.RoutineChoiceFragment import com.sopetit.softie.ui.onboarding.themechoice.ChoiceThemeFragment import com.sopetit.softie.util.binding.BindingActivity import com.sopetit.softie.util.binding.BindingAdapter.setImage +import com.sopetit.softie.util.hideKeyboard import com.sopetit.softie.util.setStatusBarColorFromResource import dagger.hilt.android.AndroidEntryPoint import kotlinx.coroutines.CoroutineScope @@ -38,6 +40,11 @@ class OnboardingActivity : initChangeFragment() } + override fun dispatchTouchEvent(ev: MotionEvent?): Boolean { + hideKeyboard(currentFocus) + return super.dispatchTouchEvent(ev) + } + private fun initMakeFragment() { val currentFragment = supportFragmentManager.findFragmentById(R.id.fcv_onboarding_fragment) if (currentFragment == null) { diff --git a/app/src/main/java/com/sopetit/softie/util/Context.kt b/app/src/main/java/com/sopetit/softie/util/Context.kt index 42f5e772..0d531f9b 100644 --- a/app/src/main/java/com/sopetit/softie/util/Context.kt +++ b/app/src/main/java/com/sopetit/softie/util/Context.kt @@ -8,14 +8,19 @@ import android.os.Handler import android.os.Looper import android.view.View import android.view.inputmethod.InputMethodManager +import android.widget.EditText import android.widget.Toast import androidx.core.content.ContextCompat import androidx.fragment.app.Fragment import java.io.Serializable -fun Context.hideKeyboard(view: View) { - val inputMethodManager = getSystemService(Activity.INPUT_METHOD_SERVICE) as InputMethodManager - inputMethodManager.hideSoftInputFromWindow(view.windowToken, 0) +fun Context.hideKeyboard(view: View?) { + if (view is EditText) { + view.clearFocus() + val inputMethodManager = + getSystemService(Activity.INPUT_METHOD_SERVICE) as InputMethodManager + inputMethodManager.hideSoftInputFromWindow(view.windowToken, 0) + } } fun snackBar( From 54eb242032f597125bf65f2e81df1f760f2ddbbe Mon Sep 17 00:00:00 2001 From: KIM MINJEONG Date: Wed, 17 Jan 2024 22:37:32 +0900 Subject: [PATCH 3/3] =?UTF-8?q?#79=20[ui]=20=ED=85=8C=EB=A7=88=20&=20?= =?UTF-8?q?=EB=A3=A8=ED=8B=B4=20=EC=84=A0=ED=83=9D=20=EB=A6=AC=EC=82=AC?= =?UTF-8?q?=EC=9D=B4=ED=81=B4=EB=9F=AC=EB=B7=B0=20=EC=9C=84=EC=B9=98=20?= =?UTF-8?q?=EC=A1=B0=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/res/layout/fragment_onboarding_choice_routine.xml | 4 ++-- app/src/main/res/layout/fragment_onboarding_choice_theme.xml | 4 ++-- app/src/main/res/layout/item_onboarding_choice_theme.xml | 3 ++- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/app/src/main/res/layout/fragment_onboarding_choice_routine.xml b/app/src/main/res/layout/fragment_onboarding_choice_routine.xml index cdb65905..a10655d3 100644 --- a/app/src/main/res/layout/fragment_onboarding_choice_routine.xml +++ b/app/src/main/res/layout/fragment_onboarding_choice_routine.xml @@ -63,9 +63,9 @@ android:layout_marginTop="37dp" android:layout_marginBottom="90dp" android:layout_marginStart="30dp" - android:layout_marginEnd="10dp" + android:layout_marginEnd="20dp" android:scrollbars="vertical" - android:scrollbarStyle="outsideInset" + android:scrollbarStyle="outsideOverlay" android:scrollbarThumbVertical="@drawable/ic_scrollbar" app:layout_constraintTop_toBottomOf="@id/iv_onboarding_choice_routine_speech_background" app:layout_constraintBottom_toTopOf="@id/btn_onboarding_routine_back_theme" diff --git a/app/src/main/res/layout/fragment_onboarding_choice_theme.xml b/app/src/main/res/layout/fragment_onboarding_choice_theme.xml index 83f3ec14..2778b5ac 100644 --- a/app/src/main/res/layout/fragment_onboarding_choice_theme.xml +++ b/app/src/main/res/layout/fragment_onboarding_choice_theme.xml @@ -23,11 +23,11 @@ + xmlns:app="http://schemas.android.com/apk/res-auto" + android:paddingHorizontal="10dp">