diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 0507b6b..186b12f 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -21,7 +21,8 @@
-
+
diff --git a/app/src/main/java/com/mashup/app/login/LoginFragment.kt b/app/src/main/java/com/mashup/app/login/LoginFragment.kt
index 5b76693..e769112 100644
--- a/app/src/main/java/com/mashup/app/login/LoginFragment.kt
+++ b/app/src/main/java/com/mashup/app/login/LoginFragment.kt
@@ -1,10 +1,12 @@
package com.mashup.app.login
+import android.content.Context.INPUT_METHOD_SERVICE
import android.content.Intent
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
+import android.view.inputmethod.InputMethodManager
import androidx.fragment.app.Fragment
import com.google.android.material.snackbar.Snackbar
import com.mashup.app.main.MainActivity
@@ -45,12 +47,23 @@ class LoginFragment : Fragment() {
}
private fun setupEventObserver() {
- viewModel.isLoginSuccess.observe(this, EventObserver {
+ viewModel.isLoginSuccess.observe(viewLifecycleOwner, EventObserver {
if (it) {
activity?.finishAffinity()
val intent = Intent(this.context, MainActivity::class.java)
startActivity(intent)
}
})
+
+ viewModel.hideKeyboard.observe(viewLifecycleOwner, EventObserver {
+ if (it) {
+ hideSoftKeyBoard()
+ }
+ })
+ }
+
+ private fun hideSoftKeyBoard() {
+ val imm = context?.getSystemService(INPUT_METHOD_SERVICE) as InputMethodManager
+ imm.hideSoftInputFromWindow(viewDataBinding.layoutForm.windowToken, 0)
}
}
diff --git a/app/src/main/java/com/mashup/app/login/LoginViewModel.kt b/app/src/main/java/com/mashup/app/login/LoginViewModel.kt
index 74f61ad..a8c50e6 100644
--- a/app/src/main/java/com/mashup/app/login/LoginViewModel.kt
+++ b/app/src/main/java/com/mashup/app/login/LoginViewModel.kt
@@ -24,6 +24,9 @@ class LoginViewModel(
private val _snackbarText = MutableLiveData>()
val snackbarText: LiveData> = _snackbarText
+ private val _hideKeyboard = MutableLiveData>()
+ val hideKeyboard: LiveData> = _hideKeyboard
+
val email = MutableLiveData()
val password = MutableLiveData()
@@ -52,6 +55,7 @@ class LoginViewModel(
}
fun onClickLoginButton() {
+ _hideKeyboard.value = Event(true)
getAuthToken()
}
diff --git a/app/src/main/res/layout/login_fragment.xml b/app/src/main/res/layout/login_fragment.xml
index 788831c..3d679d0 100644
--- a/app/src/main/res/layout/login_fragment.xml
+++ b/app/src/main/res/layout/login_fragment.xml
@@ -10,145 +10,159 @@
type="com.mashup.app.login.LoginViewModel" />
-
+ android:fillViewport="true">
-
-
-
-
-
-
-
-
-
-
-
-
+ android:layout_height="wrap_content"
+ android:background="@color/colorBaseBg"
+ android:orientation="vertical">
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ android:layout_centerVertical="true"
+ android:layout_marginStart="20dp"
+ android:layout_marginEnd="20dp"
+ app:cardCornerRadius="@dimen/card_radius"
+ app:cardElevation="@dimen/card_elevation">
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
+ android:layout_below="@+id/layoutForm"
+ android:layout_alignParentBottom="true"
+ android:layout_centerHorizontal="true"
+ android:gravity="bottom|center"
+ android:paddingBottom="10dp"
+ android:text="@string/login_tv_welcome_msg"
+ android:textSize="15sp" />
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/notice_item.xml b/app/src/main/res/layout/notice_item.xml
index 6a9b81e..dd6585b 100644
--- a/app/src/main/res/layout/notice_item.xml
+++ b/app/src/main/res/layout/notice_item.xml
@@ -27,8 +27,8 @@
android:layout_marginEnd="30dp"
android:layout_marginBottom="50dp"
android:onClick="@{() -> viewmodel.onClickItem(notice)}"
- app:cardElevation="8dp"
- app:cardCornerRadius="8dp">
+ app:cardElevation="@dimen/card_elevation"
+ app:cardCornerRadius="@dimen/card_radius">
+ app:cardCornerRadius="@dimen/card_radius"
+ app:cardElevation="@dimen/card_elevation">
260dp
50dp
30dp
- 48dp
+ 30dp
30dp
30dp
12sp
14sp
22sp
+ 3dp
+ 8dp
\ No newline at end of file