diff --git a/.idea/gradle.xml b/.idea/gradle.xml
index 9bba60d..526b4c2 100644
--- a/.idea/gradle.xml
+++ b/.idea/gradle.xml
@@ -4,7 +4,7 @@
diff --git a/app/build.gradle b/app/build.gradle
index 7cc8827..4432676 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -27,8 +27,8 @@ android {
}
}
compileOptions {
- sourceCompatibility = '1.8'
- targetCompatibility = '1.8'
+ sourceCompatibility JavaVersion.VERSION_1_8
+ targetCompatibility JavaVersion.VERSION_1_8
}
testOptions {
unitTests {
@@ -45,8 +45,6 @@ android {
}
dependencies {
- def room_version = "2.2.5"
-
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'com.google.android.material:material:1.3.0-beta01'
@@ -63,6 +61,9 @@ dependencies {
kapt "androidx.room:room-compiler:$room_version"
androidTestImplementation "androidx.room:room-testing:$room_version"
+ // jsoup
+ implementation 'org.jsoup:jsoup:1.13.1'
+
// test implementation
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.2.0'
@@ -107,7 +108,6 @@ dependencies {
kapt 'com.github.bumptech.glide:compiler:4.9.0'
// jsoup, anko
- implementation 'org.jsoup:jsoup:1.11.3'
implementation "org.jetbrains.anko:anko:$rootProject.anko_version"
implementation 'androidx.gridlayout:gridlayout:1.0.0'
diff --git a/app/src/main/java/com/seok/gfd/utils/CommonUtils.kt b/app/src/main/java/com/seok/gfd/utils/CommonUtils.kt
deleted file mode 100644
index 64a4edf..0000000
--- a/app/src/main/java/com/seok/gfd/utils/CommonUtils.kt
+++ /dev/null
@@ -1,32 +0,0 @@
-package com.seok.gfd.utils
-
-import com.google.gson.Gson
-import com.google.gson.GsonBuilder
-
-class CommonUtils private constructor(){
- private object INSTANCE{
- val instance = CommonUtils()
- val gson = GsonBuilder().create()
- }
-
- private var screenWidth = 0f
- private var screenHeight = 0f
-
- companion object{
- val instance : CommonUtils by lazy { INSTANCE.instance }
- val gson : Gson by lazy { INSTANCE.gson }
- }
-
- fun getScreenWidth(): Float {
- return screenWidth
- }
- fun setScreenWidth(screenWidth: Float){
- this.screenWidth = screenWidth
- }
- fun getScreenHeight(): Float{
- return screenHeight
- }
- fun setScreenHeight(screenHeight : Float){
- this.screenHeight = screenHeight
- }
-}
\ No newline at end of file
diff --git a/app/src/main/java/com/seok/gfd/utils/ValidationCheck.kt b/app/src/main/java/com/seok/gfd/utils/ValidationCheck.kt
new file mode 100644
index 0000000..22b6991
--- /dev/null
+++ b/app/src/main/java/com/seok/gfd/utils/ValidationCheck.kt
@@ -0,0 +1,17 @@
+package com.seok.gfd.utils
+
+class ValidationCheck {
+ companion object {
+ fun validIsEmptyString(str: String): Boolean {
+ return str.isEmpty() || str == ""
+ }
+
+ fun isExistSite(str: String): Boolean{
+ val url = "https://github.com/$str"
+
+
+
+ return true
+ }
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/seok/gfd/v1/views/MainFragment.kt b/app/src/main/java/com/seok/gfd/v1/views/MainFragment.kt
index 8345f73..0a3a10a 100644
--- a/app/src/main/java/com/seok/gfd/v1/views/MainFragment.kt
+++ b/app/src/main/java/com/seok/gfd/v1/views/MainFragment.kt
@@ -17,15 +17,14 @@ import com.ogaclejapan.smarttablayout.utils.v4.FragmentPagerItems
import com.seok.gfd.R
import com.seok.gfd.retrofit.domain.User
import com.seok.gfd.retrofit.domain.resopnse.CommitsResponseDto
-import com.seok.gfd.utils.CommonUtils
import com.seok.gfd.utils.ProgressbarDialog
import com.seok.gfd.utils.SharedPreference
+import com.seok.gfd.utils.ValidationCheck
import com.seok.gfd.viewmodel.GithubContributionViewModel
import kotlinx.android.synthetic.main.fragment_main.*
import java.time.LocalDate
class MainFragment : Fragment() {
- private lateinit var commonUtils: CommonUtils
private lateinit var sharedPreference: SharedPreference
private lateinit var progressbar: ProgressbarDialog
private lateinit var githubContributionViewModel: GithubContributionViewModel
@@ -52,7 +51,6 @@ class MainFragment : Fragment() {
progressbar.show()
sharedPreference = SharedPreference(this.activity!!.application)
user = sharedPreference.getValueObject(getString(R.string.user_info))
- commonUtils = CommonUtils.instance
githubContributionViewModel =
ViewModelProviders.of(this).get(GithubContributionViewModel::class.java)
githubContributionViewModel.getContributions(user.login)
@@ -79,9 +77,6 @@ class MainFragment : Fragment() {
private fun initSetUI() {
main_tv_today.text = LocalDate.now().toString()
- main_top_scalable_layout.scaleWidth = commonUtils.getScreenWidth()
- main_top_scalable_layout.scaleHeight = commonUtils.getScreenHeight()
-
main_tv_user_name.text = user.login
val requestOptions = RequestOptions().transform(CenterCrop(), RoundedCorners(50))
diff --git a/app/src/main/java/com/seok/gfd/v1/views/MainSub.kt b/app/src/main/java/com/seok/gfd/v1/views/MainSub.kt
index 8985582..c4fd288 100644
--- a/app/src/main/java/com/seok/gfd/v1/views/MainSub.kt
+++ b/app/src/main/java/com/seok/gfd/v1/views/MainSub.kt
@@ -12,7 +12,6 @@ import androidx.fragment.app.Fragment
import com.ogaclejapan.smarttablayout.utils.v4.Bundler
import com.seok.gfd.R
import com.seok.gfd.retrofit.domain.resopnse.CommitsResponseDto
-import com.seok.gfd.utils.CommonUtils
import kotlinx.android.synthetic.main.fragment_main_sub.*
import org.jetbrains.anko.backgroundColor
import org.jetbrains.anko.textColor
@@ -27,8 +26,8 @@ class MainSub : Fragment() {
companion object {
fun arguments(param: CommitsResponseDto): Bundle {
- val str = CommonUtils.gson.toJson(param)
- return Bundler().putString("year", str).get()
+// val str = CommonUtils.gson.toJson(param)
+ return Bundler().putString("year", "str").get()
}
}
@@ -55,7 +54,6 @@ class MainSub : Fragment() {
private fun init() {
val yearContribution = arguments?.getString("year")
- commitResponse = CommonUtils.gson.fromJson(yearContribution, CommitsResponseDto::class.java)
}
private fun createContributionUI(commitSize: Int, startDay: Int, commits : List) {
diff --git a/app/src/main/java/com/seok/gfd/views/SearchActivity.kt b/app/src/main/java/com/seok/gfd/views/SearchActivity.kt
index 5176e6b..0479212 100644
--- a/app/src/main/java/com/seok/gfd/views/SearchActivity.kt
+++ b/app/src/main/java/com/seok/gfd/views/SearchActivity.kt
@@ -3,6 +3,7 @@ package com.seok.gfd.views
import android.os.Bundle
import android.text.Editable
import android.text.TextWatcher
+import android.view.View
import android.view.WindowManager
import android.view.animation.AnimationUtils
import androidx.appcompat.app.AppCompatActivity
@@ -11,9 +12,11 @@ import androidx.lifecycle.ViewModelProviders
import androidx.recyclerview.widget.DividerItemDecoration
import androidx.recyclerview.widget.GridLayoutManager
import androidx.recyclerview.widget.LinearLayoutManager
+import com.google.android.material.snackbar.Snackbar
import com.seok.gfd.R
import com.seok.gfd.adapter.SearchGithubIdAdapter
import com.seok.gfd.room.entity.SearchGithubId
+import com.seok.gfd.utils.ValidationCheck
import com.seok.gfd.viewmodel.GithubIdViewModel
import kotlinx.android.synthetic.main.activity_search.*
@@ -36,12 +39,6 @@ class SearchActivity : AppCompatActivity() {
}
private fun setListener() {
- // EditText 포커싱 되었을 때
-// search_edt_id.onFocusChangeListener = OnFocusChangeListener { _, hasFocus ->
-// if (hasFocus) {
-// githubIdsViewModel.getGithubId("")
-// }
-// }
search_edt_id.addTextChangedListener(object : TextWatcher {
override fun onTextChanged(p0: CharSequence?, p1: Int, p2: Int, p3: Int) {
githubIdsViewModel.getGithubId(search_edt_id.text.toString())
@@ -55,7 +52,16 @@ class SearchActivity : AppCompatActivity() {
})
search_btn_ok.setOnClickListener {
- githubIdsViewModel.insertGithubId(SearchGithubId(search_edt_id.text.toString()))
+ val githubId = search_edt_id.text.toString()
+ if(ValidationCheck.validIsEmptyString(githubId)){
+ Snackbar.make(search_main_layout, "아이디칸이 비어있네요!", Snackbar.LENGTH_SHORT).show()
+ }else{
+ if(ValidationCheck.isExistSite(githubId)){
+
+ }else{
+ Snackbar.make(search_main_layout, "존재하지 않는 아이디 같아요.\n문제가 생겼다면 개발자에게 문의해주세요!", Snackbar.LENGTH_SHORT).show()
+ }
+ }
}
// githubIdsViewModel.closeDatabase() db 컨넥션 끊기
diff --git a/app/src/main/res/layout/activity_search.xml b/app/src/main/res/layout/activity_search.xml
index d9c7523..304d0d8 100644
--- a/app/src/main/res/layout/activity_search.xml
+++ b/app/src/main/res/layout/activity_search.xml
@@ -2,6 +2,7 @@
diff --git a/app/src/main/res/layout/item_search_github_id.xml b/app/src/main/res/layout/item_search_github_id.xml
index 8d0a956..6097228 100644
--- a/app/src/main/res/layout/item_search_github_id.xml
+++ b/app/src/main/res/layout/item_search_github_id.xml
@@ -1,7 +1,7 @@
-
diff --git a/build.gradle b/build.gradle
index 17c138e..52e53d4 100644
--- a/build.gradle
+++ b/build.gradle
@@ -2,10 +2,10 @@
buildscript {
ext {
- kotlin_version = '1.3.21'
+ kotlin_version = '1.4.21'
coroutine_version = '1.0.0'
- anko_version = '0.10.5'
- room_version = '1.1.1'
+ anko_version = '0.10.8'
+ room_version = '2.2.5'
archlifecycle_version = '1.1.1'
}
repositories {
@@ -20,8 +20,11 @@ buildscript {
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
+
}
+
+
allprojects {
repositories {
google()