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

Commit

Permalink
Merge pull request #660 from TeamBeMe/release/1.1.2
Browse files Browse the repository at this point in the history
Release/1.1.2
  • Loading branch information
l2hyunwoo authored Apr 5, 2021
2 parents ff1467c + a01d288 commit 6d99255
Show file tree
Hide file tree
Showing 30 changed files with 613 additions and 384 deletions.
55 changes: 55 additions & 0 deletions .idea/sonarIssues.xml

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

4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<h1 align="center"> BeMe </h1>

<p align="center">
<img src="https://img.shields.io/badge/Kotlin-1.4.30-yellowgreen?logo=kotlin"/>
<img src="https://img.shields.io/badge/Android-4.1.2-blue?logo=Android+Studio"/>
<img src="https://img.shields.io/badge/Kotlin-1.4.32-yellowgreen?logo=kotlin"/>
<img src="https://img.shields.io/badge/Android-4.1.3-blue?logo=Android+Studio"/>
<img src="https://img.shields.io/badge/targetSdk-30-green?logo=Android"/>
<img src="https://img.shields.io/badge/minSdk-26-green?logo=Android"/>
<img src="https://github.com/TeamBeMe/BeMeAndroid/actions/workflows/build.yml/badge.svg?branch=develop"/>
Expand Down
12 changes: 8 additions & 4 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ android {
applicationId "com.teambeme.beme"
minSdkVersion 26
targetSdkVersion 30
versionCode 8
versionName "1.1.1"
versionCode 9
versionName "1.1.2"

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
Expand All @@ -41,7 +41,8 @@ android {
}

dependencies {
implementation 'org.jetbrains.kotlin:kotlin-stdlib:1.4.31'
implementation 'org.jetbrains.kotlin:kotlin-stdlib:1.4.32'
implementation "androidx.lifecycle:lifecycle-livedata-ktx:2.3.1"
implementation 'androidx.core:core-ktx:1.3.2'
implementation "androidx.fragment:fragment-ktx:1.3.2"
implementation 'androidx.appcompat:appcompat:1.2.0'
Expand All @@ -56,7 +57,7 @@ dependencies {
implementation 'de.hdodenhof:circleimageview:3.1.0'

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

// Glide
implementation 'com.github.bumptech.glide:glide:4.12.0'
Expand Down Expand Up @@ -110,4 +111,7 @@ dependencies {

// Google Play Store API
implementation 'com.google.android.play:core:1.10.0'

// Kotlin Coroutines for Android
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.4.1'
}
1 change: 1 addition & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@
android:screenOrientation="portrait" />
<activity
android:name=".answer.view.AnswerActivity"
android:windowSoftInputMode="adjustPan"
android:screenOrientation="portrait" />
<activity
android:name=".notification.view.NotificationActivity"
Expand Down
4 changes: 2 additions & 2 deletions app/src/main/java/com/teambeme/beme/BeMeApplication.kt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.teambeme.beme

import android.app.Application
import com.teambeme.beme.data.local.singleton.BeMeAuthPreference
import com.teambeme.beme.data.local.singleton.BeMeRepository
import com.teambeme.beme.util.PixelRatio
import dagger.hilt.android.HiltAndroidApp

Expand All @@ -10,7 +10,7 @@ class BeMeApplication : Application() {
override fun onCreate() {
super.onCreate()
initPixelUtil()
BeMeAuthPreference.init(this)
BeMeRepository.init(this)
}

private fun initPixelUtil() {
Expand Down
50 changes: 43 additions & 7 deletions app/src/main/java/com/teambeme/beme/answer/view/AnswerActivity.kt
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
package com.teambeme.beme.answer.view

import android.animation.ValueAnimator
import android.content.Context
import android.graphics.Color
import android.os.Bundle
import android.text.Spannable
import android.text.SpannableStringBuilder
import android.text.style.ForegroundColorSpan
import android.text.style.UnderlineSpan
import android.util.Log
import android.view.ViewGroup
import android.view.inputmethod.InputMethodManager
import androidx.activity.viewModels
import androidx.constraintlayout.widget.ConstraintLayout
import androidx.lifecycle.lifecycleScope
Expand All @@ -18,6 +21,7 @@ import com.teambeme.beme.answer.viewmodel.AnswerViewModel
import com.teambeme.beme.base.BindingActivity
import com.teambeme.beme.data.local.entity.AnswerData
import com.teambeme.beme.databinding.ActivityAnswerBinding
import com.teambeme.beme.util.KeyboardVisibilityUtils
import com.teambeme.beme.util.StatusBarUtil
import com.teambeme.beme.util.dp
import com.teambeme.beme.util.recordClickEvent
Expand All @@ -28,6 +32,7 @@ import kotlinx.coroutines.launch
@AndroidEntryPoint
class AnswerActivity : BindingActivity<ActivityAnswerBinding>(R.layout.activity_answer) {
private val answerViewModel: AnswerViewModel by viewModels()
private lateinit var keyboardVisibilityUtils: KeyboardVisibilityUtils
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
binding.lifecycleOwner = this
Expand All @@ -38,8 +43,6 @@ class AnswerActivity : BindingActivity<ActivityAnswerBinding>(R.layout.activity_
val intentAnswerData = intent.getParcelableExtra<IntentAnswerData>("intentAnswerData")!!
val isChange = intent.getIntExtra(IS_CHANGE, IS_WRITE_VALUE)
answerViewModel.setIntentAnswerData(intentAnswerData)
Log.d("answer", intentAnswerData.toString())
Log.d("answer", "isChange == IS_CHANGE_VALUE is ${isChange == IS_CHANGE_VALUE}")
binding.txtAnswerData.text = intentAnswerData.createdAt
if (isChange != IS_CHANGE_VALUE) {
answerViewModel.checkStored(intentAnswerData.questionId)
Expand All @@ -48,19 +51,44 @@ class AnswerActivity : BindingActivity<ActivityAnswerBinding>(R.layout.activity_
}
answerViewModel.answerData.observe(this) {
if (it != null) {
Log.d("answer", "it is not null")
answerViewModel.initEditText()
setTitleText(it)
} else {
Log.d("answer", "it is null")
answerViewModel.initAnswerData(intentAnswerData)
}
}
binding.txtAnswerComplete.setOnClickListener {
submitAnswer(isChange)
}
binding.txtAnswerComplete.setOnClickListener { submitAnswer(isChange) }
setSwitchListener()
observePublicSwitch()
setHideKeyboard()
setEditTextWhenOpenKeyboard()
}

private fun setHideKeyboard() {
binding.constraintAnswer.setOnClickListener {
val keyboard = getSystemService(Context.INPUT_METHOD_SERVICE) as InputMethodManager
keyboard.hideSoftInputFromWindow(binding.txtAnswerAnswer.windowToken, 0)
}
}

private fun setEditTextWhenOpenKeyboard() {
val param = binding.txtAnswerAnswer.layoutParams as ViewGroup.MarginLayoutParams
keyboardVisibilityUtils = KeyboardVisibilityUtils(window,
onShowKeyboard = { keyboardHeight, _ ->
param.setMargins(
param.leftMargin,
param.topMargin,
param.rightMargin,
keyboardHeight - 300
)
binding.txtAnswerAnswer.layoutParams = param
Log.d("keyboard", keyboardHeight.toString())
},
onHideKeyboard = {
param.setMargins(param.leftMargin, param.topMargin, param.rightMargin, 30)
binding.txtAnswerAnswer.layoutParams = param
}
)
}

private fun setTitleText(answerData: AnswerData) {
Expand Down Expand Up @@ -97,6 +125,10 @@ class AnswerActivity : BindingActivity<ActivityAnswerBinding>(R.layout.activity_
lifecycleScope.launch {
answerViewModel.registerAnswer(requestAnswerData)
delay(500)
recordClickEvent(
"BUTTON",
"CLICK_ANSWER_SUBMIT"
)
val position = intent.getIntExtra("position", -1)
intent.putExtra("position", position)
intent.putExtra("content", answerViewModel.answer.value)
Expand All @@ -106,6 +138,10 @@ class AnswerActivity : BindingActivity<ActivityAnswerBinding>(R.layout.activity_
} else if (status == IS_CHANGE_VALUE) {
lifecycleScope.launch {
answerViewModel.modifyAnswer(requestAnswerData)
recordClickEvent(
"BUTTON",
"CLICK_ANSWER_MODIFY"
)
delay(500)
finish()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,14 @@ import android.content.SharedPreferences
import androidx.security.crypto.EncryptedSharedPreferences
import androidx.security.crypto.MasterKeys

object BeMeAuthPreference {
object BeMeRepository {
private const val AUTH_KEY = "AUTH_TOKEN"
private const val FB_KEY = "FB_TOKEN"
private const val PREF_KEY = "haskhey"
private const val ID_KEY = "ID_KEY"
private const val PASSWORD_KEY = "PASSWORD_KEY"
private const val IS_FIRST_KEY = "ONBOARDING_KEY"
private const val MODIFY_DATE = "MODIFY_DATE_KEY"

private lateinit var preferences: SharedPreferences
private lateinit var authPreferences: SharedPreferences
Expand Down Expand Up @@ -54,4 +55,8 @@ object BeMeAuthPreference {
var isFirst: Boolean
get() = authPreferences.getBoolean(IS_FIRST_KEY, true)
set(value) = authPreferences.edit { it.putBoolean(IS_FIRST_KEY, value) }

var modifyDate: String
get() = authPreferences.getString(MODIFY_DATE, "") ?: ""
set(value) = authPreferences.edit { it.putString(MODIFY_DATE, value) }
}
Original file line number Diff line number Diff line change
@@ -1,28 +1,25 @@
package com.teambeme.beme.data.remote.api

import com.teambeme.beme.idsearchfollowing.model.*
import retrofit2.Call
import retrofit2.http.*

interface IdSearchService {
@Headers("Content-type: application/json")

@GET("users/search")
fun idSearch(
suspend fun idSearch(
@Query("query") query: String,
@Query("range") range: String
): Call<ResponseIdSearchData>
): ResponseIdSearchData

@DELETE("users/search/{searchedId}")
fun deleteRecentSearchRecord(
suspend fun deleteRecentSearchRecord(
@Path("searchedId") searchedId: Int
): Call<ResponseDeleteRecentSearchRecord>
): ResponseDeleteRecentSearchRecord

@GET("users/search/history")
fun getRecentSearchRecord(): Call<ResponseRecentSearchRecord>
suspend fun getRecentSearchRecord(): ResponseRecentSearchRecord

@PUT("follow")
fun putFollowAndFollowing(
suspend fun putFollowAndFollowing(
@Body body: RequestFollowAndFollowing
): Call<ResponseFollowAndFollowing>
): ResponseFollowAndFollowing
}
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
package com.teambeme.beme.data.remote.datasource

import com.teambeme.beme.idsearchfollowing.model.*
import retrofit2.Call

interface IdSearchDataSource {
fun idSearch(query: String, range: String): Call<ResponseIdSearchData>
fun getRecentSearchRecord(): Call<ResponseRecentSearchRecord>
fun deleteRecentSearchRecord(searchedId: Int): Call<ResponseDeleteRecentSearchRecord>
fun putFollowAndFollowing(
body: RequestFollowAndFollowing
): Call<ResponseFollowAndFollowing>
suspend fun idSearch(query: String, range: String): ResponseIdSearchData
suspend fun getRecentSearchRecord(): ResponseRecentSearchRecord
suspend fun deleteRecentSearchRecord(searchedId: Int): ResponseDeleteRecentSearchRecord
suspend fun putFollowAndFollowing(body: RequestFollowAndFollowing): ResponseFollowAndFollowing
}
Loading

0 comments on commit 6d99255

Please sign in to comment.