Skip to content

Commit

Permalink
Merge pull request #9 from msnodeve/feature/search
Browse files Browse the repository at this point in the history
tag: update tag v1.0
  • Loading branch information
msnodeve authored Jan 10, 2021
2 parents 3623157 + fc3ee71 commit 32908fd
Show file tree
Hide file tree
Showing 10 changed files with 48 additions and 61 deletions.
3 changes: 1 addition & 2 deletions .idea/gradle.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ android {
}
}
compileOptions {
sourceCompatibility = '1.8'
targetCompatibility = '1.8'
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
testOptions {
unitTests {
Expand All @@ -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'
Expand All @@ -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'
Expand Down Expand Up @@ -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'

Expand Down
32 changes: 0 additions & 32 deletions app/src/main/java/com/seok/gfd/utils/CommonUtils.kt

This file was deleted.

17 changes: 17 additions & 0 deletions app/src/main/java/com/seok/gfd/utils/ValidationCheck.kt
Original file line number Diff line number Diff line change
@@ -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
}
}
}
7 changes: 1 addition & 6 deletions app/src/main/java/com/seok/gfd/v1/views/MainFragment.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)
Expand All @@ -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))
Expand Down
6 changes: 2 additions & 4 deletions app/src/main/java/com/seok/gfd/v1/views/MainSub.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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()
}
}

Expand All @@ -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<CommitsResponseDto.Contribution>) {
Expand Down
20 changes: 13 additions & 7 deletions app/src/main/java/com/seok/gfd/views/SearchActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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.*

Expand All @@ -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())
Expand All @@ -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 컨넥션 끊기
Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/layout/activity_search.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/search_main_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".views.SearchActivity">
Expand Down
4 changes: 2 additions & 2 deletions app/src/main/res/layout/item_search_github_id.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="50dp">

Expand Down
9 changes: 6 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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()
Expand Down

0 comments on commit 32908fd

Please sign in to comment.