@@ -3,6 +3,7 @@ package com.seok.gfd.views
33import android.os.Bundle
44import android.text.Editable
55import android.text.TextWatcher
6+ import android.view.View
67import android.view.WindowManager
78import android.view.animation.AnimationUtils
89import androidx.appcompat.app.AppCompatActivity
@@ -11,9 +12,11 @@ import androidx.lifecycle.ViewModelProviders
1112import androidx.recyclerview.widget.DividerItemDecoration
1213import androidx.recyclerview.widget.GridLayoutManager
1314import androidx.recyclerview.widget.LinearLayoutManager
15+ import com.google.android.material.snackbar.Snackbar
1416import com.seok.gfd.R
1517import com.seok.gfd.adapter.SearchGithubIdAdapter
1618import com.seok.gfd.room.entity.SearchGithubId
19+ import com.seok.gfd.utils.ValidationCheck
1720import com.seok.gfd.viewmodel.GithubIdViewModel
1821import kotlinx.android.synthetic.main.activity_search.*
1922
@@ -36,12 +39,6 @@ class SearchActivity : AppCompatActivity() {
3639 }
3740
3841 private fun setListener () {
39- // EditText 포커싱 되었을 때
40- // search_edt_id.onFocusChangeListener = OnFocusChangeListener { _, hasFocus ->
41- // if (hasFocus) {
42- // githubIdsViewModel.getGithubId("")
43- // }
44- // }
4542 search_edt_id.addTextChangedListener(object : TextWatcher {
4643 override fun onTextChanged (p0 : CharSequence? , p1 : Int , p2 : Int , p3 : Int ) {
4744 githubIdsViewModel.getGithubId(search_edt_id.text.toString())
@@ -55,7 +52,16 @@ class SearchActivity : AppCompatActivity() {
5552 })
5653
5754 search_btn_ok.setOnClickListener {
58- githubIdsViewModel.insertGithubId(SearchGithubId (search_edt_id.text.toString()))
55+ val githubId = search_edt_id.text.toString()
56+ if (ValidationCheck .validIsEmptyString(githubId)){
57+ Snackbar .make(search_main_layout, " 아이디칸이 비어있네요!" , Snackbar .LENGTH_SHORT ).show()
58+ }else {
59+ if (ValidationCheck .isExistSite(githubId)){
60+
61+ }else {
62+ Snackbar .make(search_main_layout, " 존재하지 않는 아이디 같아요.\n 문제가 생겼다면 개발자에게 문의해주세요!" , Snackbar .LENGTH_SHORT ).show()
63+ }
64+ }
5965 }
6066
6167 // githubIdsViewModel.closeDatabase() db 컨넥션 끊기
0 commit comments