Skip to content

Commit 32908fd

Browse files
authored
Merge pull request #9 from msnodeve/feature/search
tag: update tag v1.0
2 parents 3623157 + fc3ee71 commit 32908fd

10 files changed

Lines changed: 48 additions & 61 deletions

File tree

.idea/gradle.xml

Lines changed: 1 addition & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/build.gradle

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ android {
2727
}
2828
}
2929
compileOptions {
30-
sourceCompatibility = '1.8'
31-
targetCompatibility = '1.8'
30+
sourceCompatibility JavaVersion.VERSION_1_8
31+
targetCompatibility JavaVersion.VERSION_1_8
3232
}
3333
testOptions {
3434
unitTests {
@@ -45,8 +45,6 @@ android {
4545
}
4646

4747
dependencies {
48-
def room_version = "2.2.5"
49-
5048
implementation fileTree(dir: 'libs', include: ['*.jar'])
5149
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
5250
implementation 'com.google.android.material:material:1.3.0-beta01'
@@ -63,6 +61,9 @@ dependencies {
6361
kapt "androidx.room:room-compiler:$room_version"
6462
androidTestImplementation "androidx.room:room-testing:$room_version"
6563

64+
// jsoup
65+
implementation 'org.jsoup:jsoup:1.13.1'
66+
6667
// test implementation
6768
testImplementation 'junit:junit:4.12'
6869
androidTestImplementation 'androidx.test:runner:1.2.0'
@@ -107,7 +108,6 @@ dependencies {
107108
kapt 'com.github.bumptech.glide:compiler:4.9.0'
108109

109110
// jsoup, anko
110-
implementation 'org.jsoup:jsoup:1.11.3'
111111
implementation "org.jetbrains.anko:anko:$rootProject.anko_version"
112112
implementation 'androidx.gridlayout:gridlayout:1.0.0'
113113

app/src/main/java/com/seok/gfd/utils/CommonUtils.kt

Lines changed: 0 additions & 32 deletions
This file was deleted.
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
package com.seok.gfd.utils
2+
3+
class ValidationCheck {
4+
companion object {
5+
fun validIsEmptyString(str: String): Boolean {
6+
return str.isEmpty() || str == ""
7+
}
8+
9+
fun isExistSite(str: String): Boolean{
10+
val url = "https://github.com/$str"
11+
12+
13+
14+
return true
15+
}
16+
}
17+
}

app/src/main/java/com/seok/gfd/v1/views/MainFragment.kt

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,14 @@ import com.ogaclejapan.smarttablayout.utils.v4.FragmentPagerItems
1717
import com.seok.gfd.R
1818
import com.seok.gfd.retrofit.domain.User
1919
import com.seok.gfd.retrofit.domain.resopnse.CommitsResponseDto
20-
import com.seok.gfd.utils.CommonUtils
2120
import com.seok.gfd.utils.ProgressbarDialog
2221
import com.seok.gfd.utils.SharedPreference
22+
import com.seok.gfd.utils.ValidationCheck
2323
import com.seok.gfd.viewmodel.GithubContributionViewModel
2424
import kotlinx.android.synthetic.main.fragment_main.*
2525
import java.time.LocalDate
2626

2727
class MainFragment : Fragment() {
28-
private lateinit var commonUtils: CommonUtils
2928
private lateinit var sharedPreference: SharedPreference
3029
private lateinit var progressbar: ProgressbarDialog
3130
private lateinit var githubContributionViewModel: GithubContributionViewModel
@@ -52,7 +51,6 @@ class MainFragment : Fragment() {
5251
progressbar.show()
5352
sharedPreference = SharedPreference(this.activity!!.application)
5453
user = sharedPreference.getValueObject(getString(R.string.user_info))
55-
commonUtils = CommonUtils.instance
5654
githubContributionViewModel =
5755
ViewModelProviders.of(this).get(GithubContributionViewModel::class.java)
5856
githubContributionViewModel.getContributions(user.login)
@@ -79,9 +77,6 @@ class MainFragment : Fragment() {
7977

8078
private fun initSetUI() {
8179
main_tv_today.text = LocalDate.now().toString()
82-
main_top_scalable_layout.scaleWidth = commonUtils.getScreenWidth()
83-
main_top_scalable_layout.scaleHeight = commonUtils.getScreenHeight()
84-
8580
main_tv_user_name.text = user.login
8681

8782
val requestOptions = RequestOptions().transform(CenterCrop(), RoundedCorners(50))

app/src/main/java/com/seok/gfd/v1/views/MainSub.kt

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ import androidx.fragment.app.Fragment
1212
import com.ogaclejapan.smarttablayout.utils.v4.Bundler
1313
import com.seok.gfd.R
1414
import com.seok.gfd.retrofit.domain.resopnse.CommitsResponseDto
15-
import com.seok.gfd.utils.CommonUtils
1615
import kotlinx.android.synthetic.main.fragment_main_sub.*
1716
import org.jetbrains.anko.backgroundColor
1817
import org.jetbrains.anko.textColor
@@ -27,8 +26,8 @@ class MainSub : Fragment() {
2726

2827
companion object {
2928
fun arguments(param: CommitsResponseDto): Bundle {
30-
val str = CommonUtils.gson.toJson(param)
31-
return Bundler().putString("year", str).get()
29+
// val str = CommonUtils.gson.toJson(param)
30+
return Bundler().putString("year", "str").get()
3231
}
3332
}
3433

@@ -55,7 +54,6 @@ class MainSub : Fragment() {
5554

5655
private fun init() {
5756
val yearContribution = arguments?.getString("year")
58-
commitResponse = CommonUtils.gson.fromJson(yearContribution, CommitsResponseDto::class.java)
5957
}
6058

6159
private fun createContributionUI(commitSize: Int, startDay: Int, commits : List<CommitsResponseDto.Contribution>) {

app/src/main/java/com/seok/gfd/views/SearchActivity.kt

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package com.seok.gfd.views
33
import android.os.Bundle
44
import android.text.Editable
55
import android.text.TextWatcher
6+
import android.view.View
67
import android.view.WindowManager
78
import android.view.animation.AnimationUtils
89
import androidx.appcompat.app.AppCompatActivity
@@ -11,9 +12,11 @@ import androidx.lifecycle.ViewModelProviders
1112
import androidx.recyclerview.widget.DividerItemDecoration
1213
import androidx.recyclerview.widget.GridLayoutManager
1314
import androidx.recyclerview.widget.LinearLayoutManager
15+
import com.google.android.material.snackbar.Snackbar
1416
import com.seok.gfd.R
1517
import com.seok.gfd.adapter.SearchGithubIdAdapter
1618
import com.seok.gfd.room.entity.SearchGithubId
19+
import com.seok.gfd.utils.ValidationCheck
1720
import com.seok.gfd.viewmodel.GithubIdViewModel
1821
import 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 컨넥션 끊기

app/src/main/res/layout/activity_search.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
33
xmlns:app="http://schemas.android.com/apk/res-auto"
44
xmlns:tools="http://schemas.android.com/tools"
5+
android:id="@+id/search_main_layout"
56
android:layout_width="match_parent"
67
android:layout_height="match_parent"
78
tools:context=".views.SearchActivity">

app/src/main/res/layout/item_search_github_id.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0" encoding="utf-8"?>
2-
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
2+
<androidx.constraintlayout.widget.ConstraintLayout
3+
xmlns:android="http://schemas.android.com/apk/res/android"
34
xmlns:app="http://schemas.android.com/apk/res-auto"
4-
xmlns:tools="http://schemas.android.com/tools"
55
android:layout_width="match_parent"
66
android:layout_height="50dp">
77

build.gradle

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22

33
buildscript {
44
ext {
5-
kotlin_version = '1.3.21'
5+
kotlin_version = '1.4.21'
66
coroutine_version = '1.0.0'
7-
anko_version = '0.10.5'
8-
room_version = '1.1.1'
7+
anko_version = '0.10.8'
8+
room_version = '2.2.5'
99
archlifecycle_version = '1.1.1'
1010
}
1111
repositories {
@@ -20,8 +20,11 @@ buildscript {
2020
// NOTE: Do not place your application dependencies here; they belong
2121
// in the individual module build.gradle files
2222
}
23+
2324
}
2425

26+
27+
2528
allprojects {
2629
repositories {
2730
google()

0 commit comments

Comments
 (0)