Skip to content
This repository was archived by the owner on Nov 3, 2022. It is now read-only.

Commit 6d99255

Browse files
authored
Merge pull request #660 from TeamBeMe/release/1.1.2
Release/1.1.2
2 parents ff1467c + a01d288 commit 6d99255

30 files changed

Lines changed: 613 additions & 384 deletions

.idea/sonarIssues.xml

Lines changed: 55 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<h1 align="center"> BeMe </h1>
22

33
<p align="center">
4-
<img src="https://img.shields.io/badge/Kotlin-1.4.30-yellowgreen?logo=kotlin"/>
5-
<img src="https://img.shields.io/badge/Android-4.1.2-blue?logo=Android+Studio"/>
4+
<img src="https://img.shields.io/badge/Kotlin-1.4.32-yellowgreen?logo=kotlin"/>
5+
<img src="https://img.shields.io/badge/Android-4.1.3-blue?logo=Android+Studio"/>
66
<img src="https://img.shields.io/badge/targetSdk-30-green?logo=Android"/>
77
<img src="https://img.shields.io/badge/minSdk-26-green?logo=Android"/>
88
<img src="https://github.com/TeamBeMe/BeMeAndroid/actions/workflows/build.yml/badge.svg?branch=develop"/>

app/build.gradle

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ android {
1515
applicationId "com.teambeme.beme"
1616
minSdkVersion 26
1717
targetSdkVersion 30
18-
versionCode 8
19-
versionName "1.1.1"
18+
versionCode 9
19+
versionName "1.1.2"
2020

2121
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
2222
}
@@ -41,7 +41,8 @@ android {
4141
}
4242

4343
dependencies {
44-
implementation 'org.jetbrains.kotlin:kotlin-stdlib:1.4.31'
44+
implementation 'org.jetbrains.kotlin:kotlin-stdlib:1.4.32'
45+
implementation "androidx.lifecycle:lifecycle-livedata-ktx:2.3.1"
4546
implementation 'androidx.core:core-ktx:1.3.2'
4647
implementation "androidx.fragment:fragment-ktx:1.3.2"
4748
implementation 'androidx.appcompat:appcompat:1.2.0'
@@ -56,7 +57,7 @@ dependencies {
5657
implementation 'de.hdodenhof:circleimageview:3.1.0'
5758

5859
// Material 관련 컴포넌트 사용
59-
implementation 'com.google.android.material:material:1.4.0-alpha01'
60+
implementation 'com.google.android.material:material:1.4.0-alpha02'
6061

6162
// Glide
6263
implementation 'com.github.bumptech.glide:glide:4.12.0'
@@ -110,4 +111,7 @@ dependencies {
110111

111112
// Google Play Store API
112113
implementation 'com.google.android.play:core:1.10.0'
114+
115+
// Kotlin Coroutines for Android
116+
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.4.1'
113117
}

app/src/main/AndroidManifest.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@
6363
android:screenOrientation="portrait" />
6464
<activity
6565
android:name=".answer.view.AnswerActivity"
66+
android:windowSoftInputMode="adjustPan"
6667
android:screenOrientation="portrait" />
6768
<activity
6869
android:name=".notification.view.NotificationActivity"

app/src/main/java/com/teambeme/beme/BeMeApplication.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package com.teambeme.beme
22

33
import android.app.Application
4-
import com.teambeme.beme.data.local.singleton.BeMeAuthPreference
4+
import com.teambeme.beme.data.local.singleton.BeMeRepository
55
import com.teambeme.beme.util.PixelRatio
66
import dagger.hilt.android.HiltAndroidApp
77

@@ -10,7 +10,7 @@ class BeMeApplication : Application() {
1010
override fun onCreate() {
1111
super.onCreate()
1212
initPixelUtil()
13-
BeMeAuthPreference.init(this)
13+
BeMeRepository.init(this)
1414
}
1515

1616
private fun initPixelUtil() {

app/src/main/java/com/teambeme/beme/answer/view/AnswerActivity.kt

Lines changed: 43 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,16 @@
11
package com.teambeme.beme.answer.view
22

33
import android.animation.ValueAnimator
4+
import android.content.Context
45
import android.graphics.Color
56
import android.os.Bundle
67
import android.text.Spannable
78
import android.text.SpannableStringBuilder
89
import android.text.style.ForegroundColorSpan
910
import android.text.style.UnderlineSpan
1011
import android.util.Log
12+
import android.view.ViewGroup
13+
import android.view.inputmethod.InputMethodManager
1114
import androidx.activity.viewModels
1215
import androidx.constraintlayout.widget.ConstraintLayout
1316
import androidx.lifecycle.lifecycleScope
@@ -18,6 +21,7 @@ import com.teambeme.beme.answer.viewmodel.AnswerViewModel
1821
import com.teambeme.beme.base.BindingActivity
1922
import com.teambeme.beme.data.local.entity.AnswerData
2023
import com.teambeme.beme.databinding.ActivityAnswerBinding
24+
import com.teambeme.beme.util.KeyboardVisibilityUtils
2125
import com.teambeme.beme.util.StatusBarUtil
2226
import com.teambeme.beme.util.dp
2327
import com.teambeme.beme.util.recordClickEvent
@@ -28,6 +32,7 @@ import kotlinx.coroutines.launch
2832
@AndroidEntryPoint
2933
class AnswerActivity : BindingActivity<ActivityAnswerBinding>(R.layout.activity_answer) {
3034
private val answerViewModel: AnswerViewModel by viewModels()
35+
private lateinit var keyboardVisibilityUtils: KeyboardVisibilityUtils
3136
override fun onCreate(savedInstanceState: Bundle?) {
3237
super.onCreate(savedInstanceState)
3338
binding.lifecycleOwner = this
@@ -38,8 +43,6 @@ class AnswerActivity : BindingActivity<ActivityAnswerBinding>(R.layout.activity_
3843
val intentAnswerData = intent.getParcelableExtra<IntentAnswerData>("intentAnswerData")!!
3944
val isChange = intent.getIntExtra(IS_CHANGE, IS_WRITE_VALUE)
4045
answerViewModel.setIntentAnswerData(intentAnswerData)
41-
Log.d("answer", intentAnswerData.toString())
42-
Log.d("answer", "isChange == IS_CHANGE_VALUE is ${isChange == IS_CHANGE_VALUE}")
4346
binding.txtAnswerData.text = intentAnswerData.createdAt
4447
if (isChange != IS_CHANGE_VALUE) {
4548
answerViewModel.checkStored(intentAnswerData.questionId)
@@ -48,19 +51,44 @@ class AnswerActivity : BindingActivity<ActivityAnswerBinding>(R.layout.activity_
4851
}
4952
answerViewModel.answerData.observe(this) {
5053
if (it != null) {
51-
Log.d("answer", "it is not null")
5254
answerViewModel.initEditText()
5355
setTitleText(it)
5456
} else {
55-
Log.d("answer", "it is null")
5657
answerViewModel.initAnswerData(intentAnswerData)
5758
}
5859
}
59-
binding.txtAnswerComplete.setOnClickListener {
60-
submitAnswer(isChange)
61-
}
60+
binding.txtAnswerComplete.setOnClickListener { submitAnswer(isChange) }
6261
setSwitchListener()
6362
observePublicSwitch()
63+
setHideKeyboard()
64+
setEditTextWhenOpenKeyboard()
65+
}
66+
67+
private fun setHideKeyboard() {
68+
binding.constraintAnswer.setOnClickListener {
69+
val keyboard = getSystemService(Context.INPUT_METHOD_SERVICE) as InputMethodManager
70+
keyboard.hideSoftInputFromWindow(binding.txtAnswerAnswer.windowToken, 0)
71+
}
72+
}
73+
74+
private fun setEditTextWhenOpenKeyboard() {
75+
val param = binding.txtAnswerAnswer.layoutParams as ViewGroup.MarginLayoutParams
76+
keyboardVisibilityUtils = KeyboardVisibilityUtils(window,
77+
onShowKeyboard = { keyboardHeight, _ ->
78+
param.setMargins(
79+
param.leftMargin,
80+
param.topMargin,
81+
param.rightMargin,
82+
keyboardHeight - 300
83+
)
84+
binding.txtAnswerAnswer.layoutParams = param
85+
Log.d("keyboard", keyboardHeight.toString())
86+
},
87+
onHideKeyboard = {
88+
param.setMargins(param.leftMargin, param.topMargin, param.rightMargin, 30)
89+
binding.txtAnswerAnswer.layoutParams = param
90+
}
91+
)
6492
}
6593

6694
private fun setTitleText(answerData: AnswerData) {
@@ -97,6 +125,10 @@ class AnswerActivity : BindingActivity<ActivityAnswerBinding>(R.layout.activity_
97125
lifecycleScope.launch {
98126
answerViewModel.registerAnswer(requestAnswerData)
99127
delay(500)
128+
recordClickEvent(
129+
"BUTTON",
130+
"CLICK_ANSWER_SUBMIT"
131+
)
100132
val position = intent.getIntExtra("position", -1)
101133
intent.putExtra("position", position)
102134
intent.putExtra("content", answerViewModel.answer.value)
@@ -106,6 +138,10 @@ class AnswerActivity : BindingActivity<ActivityAnswerBinding>(R.layout.activity_
106138
} else if (status == IS_CHANGE_VALUE) {
107139
lifecycleScope.launch {
108140
answerViewModel.modifyAnswer(requestAnswerData)
141+
recordClickEvent(
142+
"BUTTON",
143+
"CLICK_ANSWER_MODIFY"
144+
)
109145
delay(500)
110146
finish()
111147
}

app/src/main/java/com/teambeme/beme/data/local/singleton/BeMeAuthPreference.kt renamed to app/src/main/java/com/teambeme/beme/data/local/singleton/BeMeRepository.kt

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,14 @@ import android.content.SharedPreferences
55
import androidx.security.crypto.EncryptedSharedPreferences
66
import androidx.security.crypto.MasterKeys
77

8-
object BeMeAuthPreference {
8+
object BeMeRepository {
99
private const val AUTH_KEY = "AUTH_TOKEN"
1010
private const val FB_KEY = "FB_TOKEN"
1111
private const val PREF_KEY = "haskhey"
1212
private const val ID_KEY = "ID_KEY"
1313
private const val PASSWORD_KEY = "PASSWORD_KEY"
1414
private const val IS_FIRST_KEY = "ONBOARDING_KEY"
15+
private const val MODIFY_DATE = "MODIFY_DATE_KEY"
1516

1617
private lateinit var preferences: SharedPreferences
1718
private lateinit var authPreferences: SharedPreferences
@@ -54,4 +55,8 @@ object BeMeAuthPreference {
5455
var isFirst: Boolean
5556
get() = authPreferences.getBoolean(IS_FIRST_KEY, true)
5657
set(value) = authPreferences.edit { it.putBoolean(IS_FIRST_KEY, value) }
58+
59+
var modifyDate: String
60+
get() = authPreferences.getString(MODIFY_DATE, "") ?: ""
61+
set(value) = authPreferences.edit { it.putString(MODIFY_DATE, value) }
5762
}
Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,25 @@
11
package com.teambeme.beme.data.remote.api
22

33
import com.teambeme.beme.idsearchfollowing.model.*
4-
import retrofit2.Call
54
import retrofit2.http.*
65

76
interface IdSearchService {
8-
@Headers("Content-type: application/json")
9-
107
@GET("users/search")
11-
fun idSearch(
8+
suspend fun idSearch(
129
@Query("query") query: String,
1310
@Query("range") range: String
14-
): Call<ResponseIdSearchData>
11+
): ResponseIdSearchData
1512

1613
@DELETE("users/search/{searchedId}")
17-
fun deleteRecentSearchRecord(
14+
suspend fun deleteRecentSearchRecord(
1815
@Path("searchedId") searchedId: Int
19-
): Call<ResponseDeleteRecentSearchRecord>
16+
): ResponseDeleteRecentSearchRecord
2017

2118
@GET("users/search/history")
22-
fun getRecentSearchRecord(): Call<ResponseRecentSearchRecord>
19+
suspend fun getRecentSearchRecord(): ResponseRecentSearchRecord
2320

2421
@PUT("follow")
25-
fun putFollowAndFollowing(
22+
suspend fun putFollowAndFollowing(
2623
@Body body: RequestFollowAndFollowing
27-
): Call<ResponseFollowAndFollowing>
24+
): ResponseFollowAndFollowing
2825
}
Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,10 @@
11
package com.teambeme.beme.data.remote.datasource
22

33
import com.teambeme.beme.idsearchfollowing.model.*
4-
import retrofit2.Call
54

65
interface IdSearchDataSource {
7-
fun idSearch(query: String, range: String): Call<ResponseIdSearchData>
8-
fun getRecentSearchRecord(): Call<ResponseRecentSearchRecord>
9-
fun deleteRecentSearchRecord(searchedId: Int): Call<ResponseDeleteRecentSearchRecord>
10-
fun putFollowAndFollowing(
11-
body: RequestFollowAndFollowing
12-
): Call<ResponseFollowAndFollowing>
6+
suspend fun idSearch(query: String, range: String): ResponseIdSearchData
7+
suspend fun getRecentSearchRecord(): ResponseRecentSearchRecord
8+
suspend fun deleteRecentSearchRecord(searchedId: Int): ResponseDeleteRecentSearchRecord
9+
suspend fun putFollowAndFollowing(body: RequestFollowAndFollowing): ResponseFollowAndFollowing
1310
}

0 commit comments

Comments
 (0)