From 28ef08f2796da9c17f8bda041256df39a42d1c35 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E1=84=8B=E1=85=A1=E1=86=AB=E1=84=82=E1=85=A1=E1=84=8B?= =?UTF-8?q?=E1=85=A7=E1=86=BC?= Date: Fri, 12 May 2023 13:46:07 +0900 Subject: [PATCH 01/39] [FEAT] Android O SplashWithSignActivity Orientation fix (#858) --- app/src/main/AndroidManifest.xml | 10 +++++----- .../org/sopt/havit/ui/sign/SplashWithSignActivity.kt | 10 ++++++++++ 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 927a09a2..c2589706 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -152,9 +152,9 @@ android:screenOrientation="portrait" /> + android:screenOrientation="unspecified"> @@ -178,10 +178,10 @@ android:windowSoftInputMode="adjustResize" /> @@ -195,4 +195,4 @@ android:value="@string/kakao_app_key" /> - \ No newline at end of file + diff --git a/app/src/main/java/org/sopt/havit/ui/sign/SplashWithSignActivity.kt b/app/src/main/java/org/sopt/havit/ui/sign/SplashWithSignActivity.kt index 87c1bbac..e62c86c1 100644 --- a/app/src/main/java/org/sopt/havit/ui/sign/SplashWithSignActivity.kt +++ b/app/src/main/java/org/sopt/havit/ui/sign/SplashWithSignActivity.kt @@ -2,6 +2,8 @@ package org.sopt.havit.ui.sign import android.app.Activity import android.content.Intent +import android.content.pm.ActivityInfo +import android.os.Build import android.os.Bundle import android.view.animation.Animation import android.view.animation.AnimationUtils @@ -177,6 +179,14 @@ class SplashWithSignActivity : ) } + override fun setRequestedOrientation(requestedOrientation: Int) { + if (Build.VERSION.SDK_INT != Build.VERSION_CODES.O) { + super.setRequestedOrientation(requestedOrientation) + } else { + super.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT) + } + } + override fun onBackPressed() { super.onBackPressed() finish() From c98d9a0a06f34d7bfa56595bf2c015c47fbc67ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E1=84=8B=E1=85=A1=E1=86=AB=E1=84=82=E1=85=A1=E1=84=8B?= =?UTF-8?q?=E1=85=A7=E1=86=BC?= Date: Mon, 15 May 2023 12:20:09 +0900 Subject: [PATCH 02/39] =?UTF-8?q?[FIX]=20SplashWithSignActivity=20requeste?= =?UTF-8?q?dOrientation=20=EC=84=A4=EC=A0=95=20(#858)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/org/sopt/havit/ui/sign/SplashWithSignActivity.kt | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/app/src/main/java/org/sopt/havit/ui/sign/SplashWithSignActivity.kt b/app/src/main/java/org/sopt/havit/ui/sign/SplashWithSignActivity.kt index e62c86c1..e47a805a 100644 --- a/app/src/main/java/org/sopt/havit/ui/sign/SplashWithSignActivity.kt +++ b/app/src/main/java/org/sopt/havit/ui/sign/SplashWithSignActivity.kt @@ -55,6 +55,7 @@ class SplashWithSignActivity : override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(binding.root) + requestedOrientation = ActivityInfo.SCREEN_ORIENTATION_PORTRAIT binding.main = signInViewModel initFcmToken() initSuccessKakaoLoginObserver() @@ -182,8 +183,6 @@ class SplashWithSignActivity : override fun setRequestedOrientation(requestedOrientation: Int) { if (Build.VERSION.SDK_INT != Build.VERSION_CODES.O) { super.setRequestedOrientation(requestedOrientation) - } else { - super.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT) } } From 203a715a0e0a9f661038ed2ec7537ccd26d6249a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E1=84=8B=E1=85=A1=E1=86=AB=E1=84=82=E1=85=A1=E1=84=8B?= =?UTF-8?q?=E1=85=A7=E1=86=BC?= Date: Mon, 15 May 2023 12:31:49 +0900 Subject: [PATCH 03/39] =?UTF-8?q?[FIX]=20string.xml=20app=5Fkey=20?= =?UTF-8?q?=EC=A0=9C=EA=B1=B0=20(#860)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/src/main/AndroidManifest.xml | 4 ++-- app/src/main/res/values/strings.xml | 1 - 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 927a09a2..f934a7ed 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -192,7 +192,7 @@ + android:value="${KAKAO_NATIVE_APP_KEY}" /> - \ No newline at end of file + diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 72547780..dddb8383 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -4,7 +4,6 @@ Category MyPage HAVIT - 6069fb41c205cbbf8f213b32eec7f2c8 전체 카테고리 수정 전체 From 9d3c35f5050f289c2929b8b985dade0242c6e40a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E1=84=8B=E1=85=A1=E1=86=AB=E1=84=82=E1=85=A1=E1=84=8B?= =?UTF-8?q?=E1=85=A7=E1=86=BC?= Date: Tue, 16 May 2023 21:03:36 +0900 Subject: [PATCH 04/39] =?UTF-8?q?[FIX]=20icon=5Fsetting=20padding=208dp=20?= =?UTF-8?q?=EC=84=A4=EC=A0=95(#853)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/src/main/res/layout/fragment_my_page.xml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/app/src/main/res/layout/fragment_my_page.xml b/app/src/main/res/layout/fragment_my_page.xml index 7be9ae43..d264488d 100644 --- a/app/src/main/res/layout/fragment_my_page.xml +++ b/app/src/main/res/layout/fragment_my_page.xml @@ -66,8 +66,9 @@ android:id="@+id/ib_my_page_setting" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:layout_marginTop="49dp" - android:layout_marginEnd="17dp" + android:padding="8dp" + android:layout_marginTop="41dp" + android:layout_marginEnd="9dp" android:background="@android:color/transparent" android:src="@drawable/ic_setting" app:layout_constraintEnd_toEndOf="parent" @@ -298,4 +299,4 @@ app:layout_constraintTop_toTopOf="parent" /> - \ No newline at end of file + From a0242aff4f597e52a3bd2cb8da6148af687f5113 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E1=84=8B=E1=85=A1=E1=86=AB=E1=84=82=E1=85=A1=E1=84=8B?= =?UTF-8?q?=E1=85=A7=E1=86=BC?= Date: Tue, 16 May 2023 22:02:35 +0900 Subject: [PATCH 05/39] =?UTF-8?q?[FIX]=20=EB=A7=88=EC=9D=B4=ED=8E=98?= =?UTF-8?q?=EC=9D=B4=EC=A7=80=20=ED=8D=BC=EC=84=BC=ED=8A=B8=20=ED=85=8D?= =?UTF-8?q?=EC=8A=A4=ED=8A=B8=20margin=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/src/main/res/layout/fragment_my_page.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/src/main/res/layout/fragment_my_page.xml b/app/src/main/res/layout/fragment_my_page.xml index d264488d..bb91e22e 100644 --- a/app/src/main/res/layout/fragment_my_page.xml +++ b/app/src/main/res/layout/fragment_my_page.xml @@ -29,7 +29,7 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginStart="20dp" - android:layout_marginTop="58dp" + android:layout_marginTop="41dp" android:fontFamily="@font/pretendard_semibold" android:includeFontPadding="false" android:text="@{vm.rate.toString()}" @@ -42,7 +42,7 @@ android:id="@+id/tv_rate_percent" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:layout_marginTop="58dp" + android:layout_marginTop="41dp" android:fontFamily="@font/pretendard_semibold" android:includeFontPadding="false" android:text="@string/mypage_percent" From e7e21afceeb20bb94218ab85994110f19cf64fdf Mon Sep 17 00:00:00 2001 From: kxxhyorim Date: Wed, 17 May 2023 04:14:01 +0900 Subject: [PATCH 06/39] =?UTF-8?q?[REFACTOR]=20=EC=9D=B4=EC=A0=84=EC=97=90?= =?UTF-8?q?=20=EC=A0=9C=EB=AA=A9=EC=9D=84=20=EC=A0=80=EC=9E=A5=ED=95=A0?= =?UTF-8?q?=EB=95=8C=20=EC=82=AC=EC=9A=A9=ED=95=98=EB=8D=98=20sharedPrefer?= =?UTF-8?q?ence=20=EC=BD=94=EB=93=9C=20=EC=A0=95=EB=A6=AC=20(#863)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../org/sopt/havit/ui/share/ShareActivity.kt | 10 -------- .../ContentsSummeryFragment.kt | 10 ++++++-- .../sopt/havit/util/HavitSharedPreference.kt | 23 ------------------- 3 files changed, 8 insertions(+), 35 deletions(-) diff --git a/app/src/main/java/org/sopt/havit/ui/share/ShareActivity.kt b/app/src/main/java/org/sopt/havit/ui/share/ShareActivity.kt index e9ff98fa..69dcc5bb 100644 --- a/app/src/main/java/org/sopt/havit/ui/share/ShareActivity.kt +++ b/app/src/main/java/org/sopt/havit/ui/share/ShareActivity.kt @@ -12,16 +12,11 @@ import dagger.hilt.android.AndroidEntryPoint import org.sopt.havit.databinding.ActivityShareBinding import org.sopt.havit.ui.sign.SignInViewModel.Companion.SPLASH_FROM_SHARE import org.sopt.havit.ui.sign.SplashWithSignActivity -import org.sopt.havit.util.HavitSharedPreference import java.io.Serializable -import javax.inject.Inject @AndroidEntryPoint class ShareActivity : AppCompatActivity() { - @Inject - lateinit var preference: HavitSharedPreference - private val viewModel: ShareViewModel by viewModels() private lateinit var splashWithSignActivityLauncher: ActivityResultLauncher private lateinit var binding: ActivityShareBinding @@ -95,11 +90,6 @@ class ShareActivity : AppCompatActivity() { viewModel.setUrl(url) } - override fun onDestroy() { - super.onDestroy() - preference.clearTitle() - } - companion object { const val WHERE_SPLASH_COME_FROM = "WHERE_SPLASH_COME_FROM" const val ON_NETWORK_ERROR_DISMISS = "ON_NETWORK_ERROR_DISMISS" diff --git a/app/src/main/java/org/sopt/havit/ui/share/contents_summery/ContentsSummeryFragment.kt b/app/src/main/java/org/sopt/havit/ui/share/contents_summery/ContentsSummeryFragment.kt index f5b00f9e..a5b730ab 100644 --- a/app/src/main/java/org/sopt/havit/ui/share/contents_summery/ContentsSummeryFragment.kt +++ b/app/src/main/java/org/sopt/havit/ui/share/contents_summery/ContentsSummeryFragment.kt @@ -11,9 +11,15 @@ import org.sopt.havit.databinding.FragmentContentsSummeryBinding import org.sopt.havit.domain.model.NetworkStatus import org.sopt.havit.ui.base.BaseBindingFragment import org.sopt.havit.ui.share.ShareViewModel -import org.sopt.havit.util.* +import org.sopt.havit.util.ADD_CONTENT_TYPE +import org.sopt.havit.util.DialogUtil +import org.sopt.havit.util.GoogleAnalyticsUtil import org.sopt.havit.util.GoogleAnalyticsUtil.CLICK_COMPLETE_SAVE_CONTENT import org.sopt.havit.util.GoogleAnalyticsUtil.CONTENT_CUSTOM +import org.sopt.havit.util.HavitSharedPreference +import org.sopt.havit.util.ToastUtil +import org.sopt.havit.util.setOnSingleClickListener +import org.sopt.havit.util.setOnSinglePostClickListener import javax.inject.Inject @AndroidEntryPoint @@ -69,6 +75,7 @@ class ContentsSummeryFragment : setCustomToast() requireActivity().finish() } + else -> return@observe } } @@ -92,7 +99,6 @@ class ContentsSummeryFragment : } private fun finishSavingContents() { - preference.clearTitle() requireActivity().finish() } diff --git a/app/src/main/java/org/sopt/havit/util/HavitSharedPreference.kt b/app/src/main/java/org/sopt/havit/util/HavitSharedPreference.kt index c0880ed8..ea620d6e 100644 --- a/app/src/main/java/org/sopt/havit/util/HavitSharedPreference.kt +++ b/app/src/main/java/org/sopt/havit/util/HavitSharedPreference.kt @@ -8,31 +8,8 @@ import javax.inject.Inject class HavitSharedPreference @Inject constructor(@ApplicationContext private val context: Context) { companion object { - private const val STORAGE_KEY = "HAVIT" private const val X_AUTH_TOKEN_1 = "TOKEN" // 정아 - private const val CONTENTS_TITLE = "TITLE" private const val FIRST_USER = "FIRST_USER" - private const val NOTI_TIME = "notification_time" - } - - fun setTitle(title: String) { - val prefs: SharedPreferences = - context.getSharedPreferences(CONTENTS_TITLE, Context.MODE_PRIVATE) - val editor: SharedPreferences.Editor = prefs.edit() - editor.putString(CONTENTS_TITLE, title) - editor.apply() - } - - fun getTitle(): String { - val pref: SharedPreferences = - context.getSharedPreferences(CONTENTS_TITLE, Context.MODE_PRIVATE) - return pref.getString(CONTENTS_TITLE, "").toString() - } - - fun clearTitle() { - val pref: SharedPreferences = - context.getSharedPreferences(CONTENTS_TITLE, Context.MODE_PRIVATE) - pref.edit().clear().apply() } fun setXAuthToken(xAuthToken: String) { From 09313d9594d0b8325c5b6f28c0d8c92d99495c12 Mon Sep 17 00:00:00 2001 From: kxxhyorim Date: Wed, 17 May 2023 04:22:06 +0900 Subject: [PATCH 07/39] =?UTF-8?q?[REFACTOR]=20ShareActivity=20-BaseBinding?= =?UTF-8?q?Activity=20=EC=A0=81=EC=9A=A9=20(#863)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/org/sopt/havit/ui/share/ShareActivity.kt | 8 +++----- app/src/main/res/layout/activity_share.xml | 11 +++++++---- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/app/src/main/java/org/sopt/havit/ui/share/ShareActivity.kt b/app/src/main/java/org/sopt/havit/ui/share/ShareActivity.kt index 69dcc5bb..8f290b4f 100644 --- a/app/src/main/java/org/sopt/havit/ui/share/ShareActivity.kt +++ b/app/src/main/java/org/sopt/havit/ui/share/ShareActivity.kt @@ -7,24 +7,22 @@ import androidx.activity.result.ActivityResult import androidx.activity.result.ActivityResultLauncher import androidx.activity.result.contract.ActivityResultContracts import androidx.activity.viewModels -import androidx.appcompat.app.AppCompatActivity import dagger.hilt.android.AndroidEntryPoint +import org.sopt.havit.R import org.sopt.havit.databinding.ActivityShareBinding +import org.sopt.havit.ui.base.BaseBindingActivity import org.sopt.havit.ui.sign.SignInViewModel.Companion.SPLASH_FROM_SHARE import org.sopt.havit.ui.sign.SplashWithSignActivity import java.io.Serializable @AndroidEntryPoint -class ShareActivity : AppCompatActivity() { +class ShareActivity : BaseBindingActivity(R.layout.activity_share) { private val viewModel: ShareViewModel by viewModels() private lateinit var splashWithSignActivityLauncher: ActivityResultLauncher - private lateinit var binding: ActivityShareBinding override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) - binding = ActivityShareBinding.inflate(layoutInflater) - setContentView(binding.root) initActivityLauncher() makeSignIn() diff --git a/app/src/main/res/layout/activity_share.xml b/app/src/main/res/layout/activity_share.xml index ab9c6bd9..efa7d6a2 100644 --- a/app/src/main/res/layout/activity_share.xml +++ b/app/src/main/res/layout/activity_share.xml @@ -1,5 +1,8 @@ - \ No newline at end of file + + + + \ No newline at end of file From 1624ab84b6002ea0cf10b535c4f26f74583ec79b Mon Sep 17 00:00:00 2001 From: kxxhyorim Date: Wed, 17 May 2023 04:30:47 +0900 Subject: [PATCH 08/39] =?UTF-8?q?[REFACTOR]=20Contents=EB=B7=B0=20?= =?UTF-8?q?=EB=8D=94=EB=B3=B4=EA=B8=B0>=20=EA=B3=B5=EC=9C=A0=ED=95=98?= =?UTF-8?q?=EA=B8=B0>=20HAVIT=EC=9C=BC=EB=A1=9C=EB=8F=84=20=EA=B3=B5?= =?UTF-8?q?=EC=9C=A0=20=EA=B0=80=EB=8A=A5=ED=95=98=EA=B2=8C=20=EB=B3=80?= =?UTF-8?q?=EA=B2=BD=20(#863)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../org/sopt/havit/ui/contents/more/ContentsMoreFragment.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/java/org/sopt/havit/ui/contents/more/ContentsMoreFragment.kt b/app/src/main/java/org/sopt/havit/ui/contents/more/ContentsMoreFragment.kt index b658f4c5..41ab7104 100644 --- a/app/src/main/java/org/sopt/havit/ui/contents/more/ContentsMoreFragment.kt +++ b/app/src/main/java/org/sopt/havit/ui/contents/more/ContentsMoreFragment.kt @@ -88,7 +88,7 @@ class ContentsMoreFragment : BottomSheetDialogFragment() { binding.clEditShare.setOnSingleClickListener { val intent = Intent(Intent.ACTION_SEND).apply { putExtra(Intent.EXTRA_TEXT, contentsData.url) - type = "text/html" + type = "text/plain" } startActivity(Intent.createChooser(intent, null)) dismiss() From 4d5bead98499bb6ea0dc660272578d8ee15f819c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E1=84=8B=E1=85=A1=E1=86=AB=E1=84=82=E1=85=A1=E1=84=8B?= =?UTF-8?q?=E1=85=A7=E1=86=BC?= Date: Wed, 17 May 2023 14:22:40 +0900 Subject: [PATCH 09/39] =?UTF-8?q?[FIX]=20Android=20O=20=ED=88=AC=EB=AA=85?= =?UTF-8?q?=EB=B0=B0=EA=B2=BD=20&=20Orientation=20crash=20=ED=95=B4?= =?UTF-8?q?=EA=B2=B0=20(#859)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/src/main/AndroidManifest.xml | 8 ++++---- .../org/sopt/havit/ui/category/CategoryAddActivity.kt | 9 +++++++++ .../main/java/org/sopt/havit/ui/share/ShareActivity.kt | 10 +++++++++- 3 files changed, 22 insertions(+), 5 deletions(-) diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index c2589706..9d097af8 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -76,9 +76,9 @@ android:screenOrientation="portrait" /> diff --git a/app/src/main/java/org/sopt/havit/ui/category/CategoryAddActivity.kt b/app/src/main/java/org/sopt/havit/ui/category/CategoryAddActivity.kt index 691a7293..6bdbba60 100644 --- a/app/src/main/java/org/sopt/havit/ui/category/CategoryAddActivity.kt +++ b/app/src/main/java/org/sopt/havit/ui/category/CategoryAddActivity.kt @@ -1,5 +1,7 @@ package org.sopt.havit.ui.category +import android.content.pm.ActivityInfo +import android.os.Build import android.os.Bundle import androidx.appcompat.app.AppCompatActivity import dagger.hilt.android.AndroidEntryPoint @@ -13,6 +15,7 @@ class CategoryAddActivity : AppCompatActivity() { super.onCreate(savedInstanceState) binding = ActivityCategoryAddBinding.inflate(layoutInflater) setContentView(binding.root) + requestedOrientation = ActivityInfo.SCREEN_ORIENTATION_PORTRAIT startShareProcess() } @@ -20,4 +23,10 @@ class CategoryAddActivity : AppCompatActivity() { val bottomSheet = DialogCategoryAddFragment() bottomSheet.show(supportFragmentManager, bottomSheet.tag) } + + override fun setRequestedOrientation(requestedOrientation: Int) { + if (Build.VERSION.SDK_INT != Build.VERSION_CODES.O) { + super.setRequestedOrientation(requestedOrientation) + } + } } diff --git a/app/src/main/java/org/sopt/havit/ui/share/ShareActivity.kt b/app/src/main/java/org/sopt/havit/ui/share/ShareActivity.kt index e9ff98fa..9caefc17 100644 --- a/app/src/main/java/org/sopt/havit/ui/share/ShareActivity.kt +++ b/app/src/main/java/org/sopt/havit/ui/share/ShareActivity.kt @@ -2,6 +2,8 @@ package org.sopt.havit.ui.share import android.app.Activity import android.content.Intent +import android.content.pm.ActivityInfo +import android.os.Build import android.os.Bundle import androidx.activity.result.ActivityResult import androidx.activity.result.ActivityResultLauncher @@ -30,7 +32,7 @@ class ShareActivity : AppCompatActivity() { super.onCreate(savedInstanceState) binding = ActivityShareBinding.inflate(layoutInflater) setContentView(binding.root) - + requestedOrientation = ActivityInfo.SCREEN_ORIENTATION_PORTRAIT initActivityLauncher() makeSignIn() setUrlOnViewModel() @@ -95,6 +97,12 @@ class ShareActivity : AppCompatActivity() { viewModel.setUrl(url) } + override fun setRequestedOrientation(requestedOrientation: Int) { + if (Build.VERSION.SDK_INT != Build.VERSION_CODES.O) { + super.setRequestedOrientation(requestedOrientation) + } + } + override fun onDestroy() { super.onDestroy() preference.clearTitle() From 4f12a636f1a123fbb21bb6a68eed501f37126a75 Mon Sep 17 00:00:00 2001 From: hyein-kim <68214704+kimhyeing@users.noreply.github.com> Date: Wed, 17 May 2023 17:29:43 +0900 Subject: [PATCH 10/39] Update issue templates --- .github/ISSUE_TEMPLATE/havit-custom-issue-template.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/ISSUE_TEMPLATE/havit-custom-issue-template.md b/.github/ISSUE_TEMPLATE/havit-custom-issue-template.md index 15723e4d..5193aade 100644 --- a/.github/ISSUE_TEMPLATE/havit-custom-issue-template.md +++ b/.github/ISSUE_TEMPLATE/havit-custom-issue-template.md @@ -8,7 +8,7 @@ assignees: '' --- **📝 DESCRIPTION** -- Date : 2022.05. +- Date : 2023.05. **☑ TODO** - [ ] From 57d3caf26121ed66c562c5f3512dbf97d9a7dae9 Mon Sep 17 00:00:00 2001 From: hyein Date: Sun, 21 May 2023 19:42:39 +0900 Subject: [PATCH 11/39] =?UTF-8?q?[REFACTOR]=20contents,=20category=20?= =?UTF-8?q?=ED=8C=8C=EC=9D=BC=EC=97=90=EC=84=9C=20intent=EC=9D=98=20key?= =?UTF-8?q?=EA=B0=92=EC=9D=84=20=EC=83=81=EC=88=98=EB=A1=9C=20=EB=B3=80?= =?UTF-8?q?=EA=B2=BD=20(#867)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../category/CategoryContentModifyActivity.kt | 21 +++++++-------- .../havit/ui/category/CategoryFragment.kt | 1 + .../category/CategoryOrderModifyActivity.kt | 27 +++++++++++-------- .../havit/ui/contents/ContentsActivity.kt | 13 ++++++--- 4 files changed, 36 insertions(+), 26 deletions(-) diff --git a/app/src/main/java/org/sopt/havit/ui/category/CategoryContentModifyActivity.kt b/app/src/main/java/org/sopt/havit/ui/category/CategoryContentModifyActivity.kt index fda68931..7c15f60a 100644 --- a/app/src/main/java/org/sopt/havit/ui/category/CategoryContentModifyActivity.kt +++ b/app/src/main/java/org/sopt/havit/ui/category/CategoryContentModifyActivity.kt @@ -8,7 +8,6 @@ import android.view.inputmethod.InputMethodManager import android.widget.EditText import androidx.activity.viewModels import androidx.core.widget.addTextChangedListener -import androidx.fragment.app.viewModels import dagger.hilt.android.AndroidEntryPoint import org.sopt.havit.R import org.sopt.havit.databinding.ActivityCategoryContentModifyBinding @@ -17,6 +16,8 @@ import org.sopt.havit.ui.base.BaseBindingActivity import org.sopt.havit.ui.category.CategoryFragment.Companion.CATEGORY_ID import org.sopt.havit.ui.category.CategoryFragment.Companion.CATEGORY_IMAGE_ID import org.sopt.havit.ui.category.CategoryFragment.Companion.CATEGORY_NAME +import org.sopt.havit.ui.category.CategoryFragment.Companion.CATEGORY_NAME_LIST +import org.sopt.havit.ui.category.CategoryFragment.Companion.CATEGORY_POSITION import org.sopt.havit.ui.contents.ContentsActivity import org.sopt.havit.ui.share.add_category.IconAdapter import org.sopt.havit.ui.share.add_category.IconAdapter.Companion.clickedPosition @@ -74,9 +75,9 @@ class CategoryContentModifyActivity : intent.getStringExtra(CATEGORY_NAME).toString().also { originCategoryName = it } - position = intent.getIntExtra("position", 0) + position = intent.getIntExtra(CATEGORY_POSITION, 0) id = intent.getIntExtra(CATEGORY_ID, 0) - categoryTitleList = intent.getStringArrayListExtra("categoryNameList") as ArrayList + categoryTitleList = intent.getStringArrayListExtra(CATEGORY_NAME_LIST) as ArrayList preActivity = intent.getStringExtra("preActivity").toString() } @@ -165,14 +166,14 @@ class CategoryContentModifyActivity : private fun sendCategoryModifyResult() { // 카테고리 수정 관리 뷰로 보내는 intent val orderIntent = Intent(this, CategoryOrderModifyActivity::class.java).apply { - putExtra("position", position) - putExtra("categoryName", binding.categoryTitle) - putExtra("imageId", clickedPosition + 1) + putExtra(CATEGORY_POSITION, position) + putExtra(CATEGORY_NAME, binding.categoryTitle) + putExtra(CATEGORY_IMAGE_ID, clickedPosition + 1) } // 콘텐츠 뷰로 보내는 intent val contentsIntent = Intent(this, ContentsActivity::class.java).apply { - putExtra("categoryName", binding.categoryTitle) - putExtra("imageId", clickedPosition + 1) + putExtra(CATEGORY_NAME, binding.categoryTitle) + putExtra(CATEGORY_IMAGE_ID, clickedPosition + 1) } when (preActivity) { @@ -190,9 +191,7 @@ class CategoryContentModifyActivity : private fun sendCategoryDeleteResult() { // 카테고리 수정 관리 뷰로 보내는 intent val orderIntent = Intent(this, CategoryOrderModifyActivity::class.java).apply { - putExtra("position", position) - putExtra("categoryName", binding.etCategory.text) - putExtra("id", id) + putExtra(CATEGORY_POSITION, position) } // 콘텐츠 뷰로 보내는 intent val contentsIntent = Intent(this, ContentsActivity::class.java) diff --git a/app/src/main/java/org/sopt/havit/ui/category/CategoryFragment.kt b/app/src/main/java/org/sopt/havit/ui/category/CategoryFragment.kt index d6c37085..fe63f5b7 100644 --- a/app/src/main/java/org/sopt/havit/ui/category/CategoryFragment.kt +++ b/app/src/main/java/org/sopt/havit/ui/category/CategoryFragment.kt @@ -126,6 +126,7 @@ class CategoryFragment : BaseBindingFragment(R.layout.f const val CATEGORY_POSITION = "position" const val CATEGORY_IMAGE_ID = "imageId" const val CATEGORY_ITEM_LIST = "categoryItemList" + const val CATEGORY_NAME_LIST = "categoryNameList" const val MAIN_ACTIVITY = "MainActivity" } } diff --git a/app/src/main/java/org/sopt/havit/ui/category/CategoryOrderModifyActivity.kt b/app/src/main/java/org/sopt/havit/ui/category/CategoryOrderModifyActivity.kt index 5636e21b..ef6898b0 100644 --- a/app/src/main/java/org/sopt/havit/ui/category/CategoryOrderModifyActivity.kt +++ b/app/src/main/java/org/sopt/havit/ui/category/CategoryOrderModifyActivity.kt @@ -6,7 +6,6 @@ import android.view.View import androidx.activity.result.ActivityResultLauncher import androidx.activity.result.contract.ActivityResultContracts import androidx.activity.viewModels -import androidx.fragment.app.viewModels import androidx.recyclerview.widget.ItemTouchHelper import androidx.recyclerview.widget.RecyclerView import dagger.hilt.android.AndroidEntryPoint @@ -16,6 +15,12 @@ import org.sopt.havit.domain.entity.NetworkState import org.sopt.havit.ui.base.BaseBindingActivity import org.sopt.havit.ui.category.CategoryContentModifyActivity.Companion.RESULT_DELETE_CATEGORY import org.sopt.havit.ui.category.CategoryContentModifyActivity.Companion.RESULT_MODIFY_CATEGORY +import org.sopt.havit.ui.category.CategoryFragment.Companion.CATEGORY_ID +import org.sopt.havit.ui.category.CategoryFragment.Companion.CATEGORY_IMAGE_ID +import org.sopt.havit.ui.category.CategoryFragment.Companion.CATEGORY_ITEM_LIST +import org.sopt.havit.ui.category.CategoryFragment.Companion.CATEGORY_NAME +import org.sopt.havit.ui.category.CategoryFragment.Companion.CATEGORY_NAME_LIST +import org.sopt.havit.ui.category.CategoryFragment.Companion.CATEGORY_POSITION import org.sopt.havit.util.CustomToast import org.sopt.havit.util.DialogUtil import org.sopt.havit.util.setOnSingleClickListener @@ -74,7 +79,7 @@ class CategoryOrderModifyActivity : private fun setCategoryItemListData() { categoryOrderModifyAdapter.categoryList = - requireNotNull(intent.getParcelableArrayListExtra("categoryItemList")) + requireNotNull(intent.getParcelableArrayListExtra(CATEGORY_ITEM_LIST)) initOriginCategoryIdList() categoryOrderModifyAdapter.notifyDataSetChanged() @@ -92,7 +97,7 @@ class CategoryOrderModifyActivity : when (it.resultCode) { RESULT_DELETE_CATEGORY -> { // 삭제 // 삭제할 카테고리의 정보를 받아옴 - val position = it.data?.getIntExtra("position", 0) ?: 0 + val position = it.data?.getIntExtra(CATEGORY_POSITION, 0) ?: 0 // 리사이클러뷰 변경 categoryOrderModifyAdapter.removeData(position) @@ -101,9 +106,9 @@ class CategoryOrderModifyActivity : } RESULT_MODIFY_CATEGORY -> { // 카테고리 이름 & 아이콘 수정 // 수정할 카테고리의 정보를 받아옴 - val position = it.data?.getIntExtra("position", 0) ?: 0 - val name = it.data?.getStringExtra("categoryName") ?: "null" - val image = it.data?.getIntExtra("imageId", 0) ?: 0 + val position = it.data?.getIntExtra(CATEGORY_POSITION, 0) ?: 0 + val name = it.data?.getStringExtra(CATEGORY_NAME) ?: "null" + val image = it.data?.getIntExtra(CATEGORY_IMAGE_ID, 0) ?: 0 // 리사이클러뷰 변경 with(categoryOrderModifyAdapter.categoryList[position]) { @@ -129,12 +134,12 @@ class CategoryOrderModifyActivity : val intent = Intent(v.context, CategoryContentModifyActivity::class.java).apply { categoryOrderModifyAdapter.categoryList[position].let { - putExtra("categoryId", it.id) - putExtra("categoryName", it.title) - putExtra("imageId", it.imageId) + putExtra(CATEGORY_ID, it.id) + putExtra(CATEGORY_NAME, it.title) + putExtra(CATEGORY_IMAGE_ID, it.imageId) } - putExtra("position", position) - putStringArrayListExtra("categoryNameList", categoryTitleList) + putExtra(CATEGORY_POSITION, position) + putStringArrayListExtra(CATEGORY_NAME_LIST, categoryTitleList) putExtra("preActivity", "CategoryOrderModifyActivity") } diff --git a/app/src/main/java/org/sopt/havit/ui/contents/ContentsActivity.kt b/app/src/main/java/org/sopt/havit/ui/contents/ContentsActivity.kt index 9793e8a1..b3a4d3ab 100644 --- a/app/src/main/java/org/sopt/havit/ui/contents/ContentsActivity.kt +++ b/app/src/main/java/org/sopt/havit/ui/contents/ContentsActivity.kt @@ -24,6 +24,7 @@ import org.sopt.havit.ui.category.CategoryFragment.Companion.CATEGORY_ID import org.sopt.havit.ui.category.CategoryFragment.Companion.CATEGORY_IMAGE_ID import org.sopt.havit.ui.category.CategoryFragment.Companion.CATEGORY_ITEM_LIST import org.sopt.havit.ui.category.CategoryFragment.Companion.CATEGORY_NAME +import org.sopt.havit.ui.category.CategoryFragment.Companion.CATEGORY_NAME_LIST import org.sopt.havit.ui.category.CategoryFragment.Companion.CATEGORY_POSITION import org.sopt.havit.ui.category.CategoryViewModel import org.sopt.havit.ui.contents.DialogContentsFilterFragment.Companion.CONTENTS_FILTER @@ -261,9 +262,9 @@ class ContentsActivity : BaseBindingActivity(R.layout.a val intent = Intent(v.context, WebActivity::class.java) contentsViewModel.contentsList.value?.get(position) ?.let { - intent.putExtra("url", it.url) - intent.putExtra("contentsId", it.id) - intent.putExtra("isSeen", it.isSeen) + intent.putExtra(CONTENTS_URL, it.url) + intent.putExtra(CONTENT_ID, it.id) + intent.putExtra(CONTENT_IS_SEEN, it.isSeen) } startActivity(intent) } @@ -387,7 +388,7 @@ class ContentsActivity : BaseBindingActivity(R.layout.a putExtra(CATEGORY_ID, categoryId) putExtra(CATEGORY_NAME, categoryName) putExtra(CATEGORY_IMAGE_ID, categoryIconId) - putStringArrayListExtra("categoryNameList", categoryTitleList) + putStringArrayListExtra(CATEGORY_NAME_LIST, categoryTitleList) putExtra("preActivity", "ContentsActivity") } @@ -496,5 +497,9 @@ class ContentsActivity : BaseBindingActivity(R.layout.a const val GRID_LAYOUT = 2 const val LINEAR_MAX_LAYOUT = 3 var layout = 1 + + const val CONTENTS_URL = "url" + const val CONTENT_ID = "contentsId" + const val CONTENT_IS_SEEN = "isSeen" } } From 6355b41b8390e63af92c93b3215327e5afe6a84c Mon Sep 17 00:00:00 2001 From: hyein Date: Sun, 21 May 2023 23:57:14 +0900 Subject: [PATCH 12/39] =?UTF-8?q?[REFACTOR]=20=EC=B9=B4=ED=85=8C=EA=B3=A0?= =?UTF-8?q?=EB=A6=AC=20=EC=88=98=EC=A0=95=20=ED=99=94=EB=A9=B4=EC=9D=84=20?= =?UTF-8?q?=ED=98=B8=EC=B6=9C=ED=95=98=EB=8A=94=20activity=20=EA=B5=AC?= =?UTF-8?q?=EB=B6=84=20=EB=A1=9C=EC=A7=81=20=EB=B3=80=EA=B2=BD=20(#867)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../category/CategoryContentModifyActivity.kt | 57 ++++++------------- .../category/CategoryOrderModifyActivity.kt | 1 - .../havit/ui/contents/ContentsActivity.kt | 1 - 3 files changed, 18 insertions(+), 41 deletions(-) diff --git a/app/src/main/java/org/sopt/havit/ui/category/CategoryContentModifyActivity.kt b/app/src/main/java/org/sopt/havit/ui/category/CategoryContentModifyActivity.kt index 7c15f60a..aca47be9 100644 --- a/app/src/main/java/org/sopt/havit/ui/category/CategoryContentModifyActivity.kt +++ b/app/src/main/java/org/sopt/havit/ui/category/CategoryContentModifyActivity.kt @@ -18,7 +18,6 @@ import org.sopt.havit.ui.category.CategoryFragment.Companion.CATEGORY_IMAGE_ID import org.sopt.havit.ui.category.CategoryFragment.Companion.CATEGORY_NAME import org.sopt.havit.ui.category.CategoryFragment.Companion.CATEGORY_NAME_LIST import org.sopt.havit.ui.category.CategoryFragment.Companion.CATEGORY_POSITION -import org.sopt.havit.ui.contents.ContentsActivity import org.sopt.havit.ui.share.add_category.IconAdapter import org.sopt.havit.ui.share.add_category.IconAdapter.Companion.clickedPosition import org.sopt.havit.util.* @@ -33,7 +32,6 @@ class CategoryContentModifyActivity : private lateinit var originCategoryName: String private lateinit var iconAdapter: IconAdapter private lateinit var categoryTitleList: ArrayList - private lateinit var preActivity: String override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) @@ -78,7 +76,6 @@ class CategoryContentModifyActivity : position = intent.getIntExtra(CATEGORY_POSITION, 0) id = intent.getIntExtra(CATEGORY_ID, 0) categoryTitleList = intent.getStringArrayListExtra(CATEGORY_NAME_LIST) as ArrayList - preActivity = intent.getStringExtra("preActivity").toString() } private fun initIconAdapter() { @@ -164,47 +161,29 @@ class CategoryContentModifyActivity : } private fun sendCategoryModifyResult() { - // 카테고리 수정 관리 뷰로 보내는 intent - val orderIntent = Intent(this, CategoryOrderModifyActivity::class.java).apply { - putExtra(CATEGORY_POSITION, position) - putExtra(CATEGORY_NAME, binding.categoryTitle) - putExtra(CATEGORY_IMAGE_ID, clickedPosition + 1) - } - // 콘텐츠 뷰로 보내는 intent - val contentsIntent = Intent(this, ContentsActivity::class.java).apply { - putExtra(CATEGORY_NAME, binding.categoryTitle) - putExtra(CATEGORY_IMAGE_ID, clickedPosition + 1) - } + if (callingActivity != null) { + val callingActivityName = callingActivity!!.className - when (preActivity) { - "ContentsActivity" -> setResult( - RESULT_MODIFY_CATEGORY, - contentsIntent - ) // ContentsActivity로 데이터 전달 - "CategoryOrderModifyActivity" -> setResult( - RESULT_MODIFY_CATEGORY, - orderIntent - ) // CategoryOrderModifyActivity로 데이터 전달 + val intent = Intent(this, callingActivity!!.className.javaClass).apply { + putExtra(CATEGORY_NAME, binding.categoryTitle) + putExtra(CATEGORY_IMAGE_ID, clickedPosition + 1) + } + if (callingActivityName == CategoryOrderModifyActivity::class.java.name) { + intent.putExtra(CATEGORY_POSITION, position) + } + setResult(RESULT_MODIFY_CATEGORY, intent) } } private fun sendCategoryDeleteResult() { - // 카테고리 수정 관리 뷰로 보내는 intent - val orderIntent = Intent(this, CategoryOrderModifyActivity::class.java).apply { - putExtra(CATEGORY_POSITION, position) - } - // 콘텐츠 뷰로 보내는 intent - val contentsIntent = Intent(this, ContentsActivity::class.java) - - when (preActivity) { - "ContentsActivity" -> setResult( - RESULT_DELETE_CATEGORY, - contentsIntent - ) // ContentsActivity로 데이터 전달 - "CategoryOrderModifyActivity" -> setResult( - RESULT_DELETE_CATEGORY, - orderIntent - ) // CategoryOrderModifyActivity로 데이터 전달 + if (callingActivity != null) { + val callingActivityName = callingActivity!!.className + + val intent = Intent(this, callingActivity!!.className.javaClass) + if (callingActivityName == CategoryOrderModifyActivity::class.java.name) { + intent.putExtra(CATEGORY_POSITION, position) + } + setResult(RESULT_DELETE_CATEGORY, intent) } } diff --git a/app/src/main/java/org/sopt/havit/ui/category/CategoryOrderModifyActivity.kt b/app/src/main/java/org/sopt/havit/ui/category/CategoryOrderModifyActivity.kt index ef6898b0..a7557502 100644 --- a/app/src/main/java/org/sopt/havit/ui/category/CategoryOrderModifyActivity.kt +++ b/app/src/main/java/org/sopt/havit/ui/category/CategoryOrderModifyActivity.kt @@ -140,7 +140,6 @@ class CategoryOrderModifyActivity : } putExtra(CATEGORY_POSITION, position) putStringArrayListExtra(CATEGORY_NAME_LIST, categoryTitleList) - putExtra("preActivity", "CategoryOrderModifyActivity") } // 데이터를 담고 전달 diff --git a/app/src/main/java/org/sopt/havit/ui/contents/ContentsActivity.kt b/app/src/main/java/org/sopt/havit/ui/contents/ContentsActivity.kt index b3a4d3ab..edae3beb 100644 --- a/app/src/main/java/org/sopt/havit/ui/contents/ContentsActivity.kt +++ b/app/src/main/java/org/sopt/havit/ui/contents/ContentsActivity.kt @@ -389,7 +389,6 @@ class ContentsActivity : BaseBindingActivity(R.layout.a putExtra(CATEGORY_NAME, categoryName) putExtra(CATEGORY_IMAGE_ID, categoryIconId) putStringArrayListExtra(CATEGORY_NAME_LIST, categoryTitleList) - putExtra("preActivity", "ContentsActivity") } getResult.launch(intent) From 92e87213e80c102a7be66b39089a9df4248d00e3 Mon Sep 17 00:00:00 2001 From: hyein Date: Tue, 23 May 2023 21:02:47 +0900 Subject: [PATCH 13/39] =?UTF-8?q?[REFACTOR]=20null=20=EC=B2=B4=ED=81=AC=20?= =?UTF-8?q?=EB=B0=A9=EC=8B=9D=EC=9D=84=20let=EC=9D=84=20=EC=82=AC=EC=9A=A9?= =?UTF-8?q?=ED=95=9C=20=EB=A1=9C=EC=A7=81=EC=9C=BC=EB=A1=9C=20=EB=B3=80?= =?UTF-8?q?=EA=B2=BD=20(#867)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ui/category/CategoryContentModifyActivity.kt | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/app/src/main/java/org/sopt/havit/ui/category/CategoryContentModifyActivity.kt b/app/src/main/java/org/sopt/havit/ui/category/CategoryContentModifyActivity.kt index aca47be9..d6b17671 100644 --- a/app/src/main/java/org/sopt/havit/ui/category/CategoryContentModifyActivity.kt +++ b/app/src/main/java/org/sopt/havit/ui/category/CategoryContentModifyActivity.kt @@ -161,10 +161,10 @@ class CategoryContentModifyActivity : } private fun sendCategoryModifyResult() { - if (callingActivity != null) { - val callingActivityName = callingActivity!!.className + callingActivity?.let { callingActivity -> + val callingActivityName = callingActivity.className - val intent = Intent(this, callingActivity!!.className.javaClass).apply { + val intent = Intent(this, callingActivity.className.javaClass).apply { putExtra(CATEGORY_NAME, binding.categoryTitle) putExtra(CATEGORY_IMAGE_ID, clickedPosition + 1) } @@ -176,10 +176,10 @@ class CategoryContentModifyActivity : } private fun sendCategoryDeleteResult() { - if (callingActivity != null) { - val callingActivityName = callingActivity!!.className + callingActivity?.let { callingActivity -> + val callingActivityName = callingActivity.className - val intent = Intent(this, callingActivity!!.className.javaClass) + val intent = Intent(this, callingActivity.className.javaClass) if (callingActivityName == CategoryOrderModifyActivity::class.java.name) { intent.putExtra(CATEGORY_POSITION, position) } From e77cef0630622e437f04e672338b6f30c9dff018 Mon Sep 17 00:00:00 2001 From: hyein Date: Wed, 24 May 2023 19:04:34 +0900 Subject: [PATCH 14/39] =?UTF-8?q?[FIX]=20=EC=B9=B4=ED=85=8C=EA=B3=A0?= =?UTF-8?q?=EB=A6=AC=20orderIndex=EB=A5=BC=20adapterPosition=EC=9C=BC?= =?UTF-8?q?=EB=A1=9C=20=EB=B3=80=EA=B2=BD=20(#866)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/src/main/java/org/sopt/havit/domain/entity/Category.kt | 2 +- app/src/main/java/org/sopt/havit/ui/category/CategoryAdapter.kt | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/org/sopt/havit/domain/entity/Category.kt b/app/src/main/java/org/sopt/havit/domain/entity/Category.kt index 57eb2789..1bcffb42 100644 --- a/app/src/main/java/org/sopt/havit/domain/entity/Category.kt +++ b/app/src/main/java/org/sopt/havit/domain/entity/Category.kt @@ -11,6 +11,6 @@ data class Category( var imageId: Int, @SerializedName("imageUrl") var url: String, - val orderIndex: Int, + var orderIndex: Int, var title: String ) : Parcelable diff --git a/app/src/main/java/org/sopt/havit/ui/category/CategoryAdapter.kt b/app/src/main/java/org/sopt/havit/ui/category/CategoryAdapter.kt index 1b6a8eef..5badf257 100644 --- a/app/src/main/java/org/sopt/havit/ui/category/CategoryAdapter.kt +++ b/app/src/main/java/org/sopt/havit/ui/category/CategoryAdapter.kt @@ -30,6 +30,8 @@ class CategoryAdapter( } override fun onBindViewHolder(holder: CategoryViewHolder, position: Int) { + // 서버에서 불러온 orderIndex 값이 항상 update 되지 않기 때문에 adapterPosition으로 변경 + categoryList[position].orderIndex = holder.adapterPosition holder.onBind(categoryList[position]) } From 29436e7ff2d1cbf37afacfaad56f89e9c14cab3e Mon Sep 17 00:00:00 2001 From: kxxhyorim Date: Sat, 27 May 2023 21:13:43 +0900 Subject: [PATCH 15/39] =?UTF-8?q?[CHORE]=20=EB=B6=88=ED=95=84=EC=9A=94?= =?UTF-8?q?=ED=95=9C=20=EB=9D=BC=EC=9D=B4=EB=B8=8C=EB=9F=AC=EB=A6=AC=20?= =?UTF-8?q?=EC=A0=9C=EA=B1=B0=20=EB=B0=8F=20=EB=B2=84=EC=A0=84=20=EC=97=85?= =?UTF-8?q?=EB=8D=B0=EC=9D=B4=ED=8A=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/build.gradle | 11 +++-------- .../havit/data/local/HavitAuthLocalPreferences.kt | 1 - build.gradle | 2 +- 3 files changed, 4 insertions(+), 10 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index aa48e272..c4db3e5d 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -99,11 +99,7 @@ dependencies { implementation 'androidx.browser:browser:1.4.0' //kakao - implementation "com.kakao.sdk:v2-user:2.5.0" // 카카오 로그인 - implementation "com.kakao.sdk:v2-talk:2.3.0" // 친구, 메시지(카카오톡) - implementation "com.kakao.sdk:v2-story:2.3.0" // 카카오스토리 - implementation "com.kakao.sdk:v2-link:2.3.0" // 메시지(카카오링크) - implementation "com.kakao.sdk:v2-navi:2.3.0" // 카카오내비 + implementation "com.kakao.sdk:v2-user:2.11.0" // 카카오 로그인 implementation 'com.kakao.sdk:usermgmt:1.27.0' // 카카오 로그인 버튼 만들 때 사용 // Retrofit @@ -137,12 +133,11 @@ dependencies { * bom 이외의 sdk에 버전 지정을 하지 않게 주의 * */ - implementation platform('com.google.firebase:firebase-bom:31.5.0') - implementation 'com.google.firebase:firebase-analytics-ktx' + implementation platform('com.google.firebase:firebase-bom:32.0.0') implementation 'com.google.firebase:firebase-messaging' implementation 'com.google.firebase:firebase-messaging-ktx' implementation 'com.google.firebase:firebase-crashlytics-ktx' - + implementation 'com.google.firebase:firebase-analytics-ktx' // Jsoup implementation 'org.jsoup:jsoup:1.13.1' diff --git a/app/src/main/java/org/sopt/havit/data/local/HavitAuthLocalPreferences.kt b/app/src/main/java/org/sopt/havit/data/local/HavitAuthLocalPreferences.kt index b660cc1f..73c4d8cb 100644 --- a/app/src/main/java/org/sopt/havit/data/local/HavitAuthLocalPreferences.kt +++ b/app/src/main/java/org/sopt/havit/data/local/HavitAuthLocalPreferences.kt @@ -2,7 +2,6 @@ package org.sopt.havit.data.local import android.content.Context import android.content.SharedPreferences -import com.kakao.sdk.navi.Constants.USER_ID import dagger.hilt.android.qualifiers.ApplicationContext import javax.inject.Inject diff --git a/build.gradle b/build.gradle index 89ad0f1d..b0512d09 100644 --- a/build.gradle +++ b/build.gradle @@ -8,7 +8,7 @@ buildscript { classpath "com.android.tools.build:gradle:7.0.4" classpath 'org.jetbrains.kotlin:kotlin-gradle-plugin:1.7.10' classpath "androidx.navigation:navigation-safe-args-gradle-plugin:2.4.2" - classpath 'com.google.gms:google-services:4.3.10' + classpath 'com.google.gms:google-services:4.3.15' classpath 'com.google.dagger:hilt-android-gradle-plugin:2.42' classpath 'com.google.firebase:firebase-crashlytics-gradle:2.9.5' // NOTE: Do not place your application dependencies here; they belong From 19e4ac197ba2d1caa3b909f49433486654ad2ea7 Mon Sep 17 00:00:00 2001 From: kxxhyorim Date: Sun, 28 May 2023 23:18:41 +0900 Subject: [PATCH 16/39] =?UTF-8?q?[UI]=20=EC=A0=9C=EB=AA=A9=EC=97=90=20?= =?UTF-8?q?=EB=9D=84=EC=9B=8C=EC=93=B0=EA=B8=B0=EB=A7=8C=20=EC=82=AC?= =?UTF-8?q?=EC=9A=A9=ED=95=A0=20=EC=88=98=20=EC=97=86=EC=8A=B5=EB=8B=88?= =?UTF-8?q?=EB=8B=A4=20=EC=BB=B4=ED=8F=AC=EB=84=8C=ED=8A=B8=20=EC=83=9D?= =?UTF-8?q?=EC=84=B1=20(#871)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...yout_contents_title_whitespace_warning.xml | 29 +++++++++++++++++++ app/src/main/res/values/strings.xml | 1 + 2 files changed, 30 insertions(+) create mode 100644 app/src/main/res/layout/layout_contents_title_whitespace_warning.xml diff --git a/app/src/main/res/layout/layout_contents_title_whitespace_warning.xml b/app/src/main/res/layout/layout_contents_title_whitespace_warning.xml new file mode 100644 index 00000000..272677fc --- /dev/null +++ b/app/src/main/res/layout/layout_contents_title_whitespace_warning.xml @@ -0,0 +1,29 @@ + + + + + + + + + diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index dddb8383..9a4eaca8 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -282,4 +282,5 @@ 현재 버전  - 닉네임에 띄어쓰기는 사용할 수 없습니다. + 제목에 띄어쓰기만 사용할 수 없습니다. From a5f2c7a2ed9c3ba94220635e22c0747acddcf303 Mon Sep 17 00:00:00 2001 From: kxxhyorim Date: Sun, 28 May 2023 23:24:13 +0900 Subject: [PATCH 17/39] =?UTF-8?q?[CHORE]=20'layout=5Fbottom=5Fsheet=5Fnetw?= =?UTF-8?q?ork=5Ferror.xml'=20data=20binding=20=EC=A0=81=EC=9A=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../layout_bottom_sheet_network_error.xml | 146 +++++++++--------- 1 file changed, 75 insertions(+), 71 deletions(-) diff --git a/app/src/main/res/layout/layout_bottom_sheet_network_error.xml b/app/src/main/res/layout/layout_bottom_sheet_network_error.xml index cd6b4f3a..f15b9a6f 100644 --- a/app/src/main/res/layout/layout_bottom_sheet_network_error.xml +++ b/app/src/main/res/layout/layout_bottom_sheet_network_error.xml @@ -1,86 +1,90 @@ - + xmlns:tools="http://schemas.android.com/tools"> + android:layout_height="wrap_content"> - - - + app:layout_constraintTop_toTopOf="parent"> - + - + - + - - + + + + + - \ No newline at end of file + + + \ No newline at end of file From 09f458a0b4261079bd2c2e71722a2cce238fe408 Mon Sep 17 00:00:00 2001 From: kxxhyorim Date: Mon, 29 May 2023 01:27:35 +0900 Subject: [PATCH 18/39] =?UTF-8?q?[UI]=20=EC=BD=98=ED=85=90=EC=B8=A0=20?= =?UTF-8?q?=EC=A0=9C=EB=AA=A9=20=EC=84=A4=EC=A0=95=20-=20'=EA=B3=B5?= =?UTF-8?q?=EB=B0=B1=20warning'=20=EB=B7=B0=20=EC=B6=94=EA=B0=80=20(#871)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/res/layout/fragment_edit_title.xml | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/app/src/main/res/layout/fragment_edit_title.xml b/app/src/main/res/layout/fragment_edit_title.xml index aad3a868..61619759 100644 --- a/app/src/main/res/layout/fragment_edit_title.xml +++ b/app/src/main/res/layout/fragment_edit_title.xml @@ -93,7 +93,7 @@ + tools:layout_editor_absoluteX="22dp" + tools:text="콘텐츠 제목 어쩌구 저쩌구 블라블라 줄바꿈저쩌구 블라블라 줄바꿈 테스트으으ㅡ으 줄바꿈 테스트으으ㅡ으" /> + + + + + \ No newline at end of file From 77b8aadbeefeb93dc931678c2c7cc9c47bdddabf Mon Sep 17 00:00:00 2001 From: kxxhyorim Date: Mon, 29 May 2023 01:28:22 +0900 Subject: [PATCH 19/39] =?UTF-8?q?[UI]=20=EC=BD=98=ED=85=90=EC=B8=A0=20?= =?UTF-8?q?=EC=A0=9C=EB=AA=A9=20=EC=84=A4=EC=A0=95=20-=20'=EA=B3=B5?= =?UTF-8?q?=EB=B0=B1=20warning'=20=ED=82=A4=EB=B3=B4=EB=93=9C=20=ED=99=9C?= =?UTF-8?q?=EC=84=B1=ED=99=94=20=EC=9C=A0=EB=AC=B4=EC=97=90=20=EB=94=B0?= =?UTF-8?q?=EB=9D=BC=20position=20=EB=B3=80=EA=B2=BD=20(#871)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../havit/ui/share/edit_title/EditTitleFragment.kt | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/org/sopt/havit/ui/share/edit_title/EditTitleFragment.kt b/app/src/main/java/org/sopt/havit/ui/share/edit_title/EditTitleFragment.kt index b48ed9b0..162a4d78 100644 --- a/app/src/main/java/org/sopt/havit/ui/share/edit_title/EditTitleFragment.kt +++ b/app/src/main/java/org/sopt/havit/ui/share/edit_title/EditTitleFragment.kt @@ -11,9 +11,13 @@ import androidx.navigation.fragment.navArgs import dagger.hilt.android.AndroidEntryPoint import org.sopt.havit.databinding.FragmentEditTitleBinding import org.sopt.havit.ui.share.ShareViewModel -import org.sopt.havit.util.* +import org.sopt.havit.util.AutoClearedValue +import org.sopt.havit.util.DialogUtil +import org.sopt.havit.util.GoogleAnalyticsUtil import org.sopt.havit.util.GoogleAnalyticsUtil.CLICK_COMPLETE_MODIFY_TITLE import org.sopt.havit.util.GoogleAnalyticsUtil.MODIFY_TITLE +import org.sopt.havit.util.KeyBoardUtil +import org.sopt.havit.util.OnBackPressedHandler @AndroidEntryPoint class EditTitleFragment : Fragment(), OnBackPressedHandler { @@ -36,6 +40,7 @@ class EditTitleFragment : Fragment(), OnBackPressedHandler { initClickListener() setCursor() setScreenEventLogging() + adjustWarningMessagePositionToKeyBoard() } private fun setCursor() { @@ -63,6 +68,11 @@ class EditTitleFragment : Fragment(), OnBackPressedHandler { } } + private fun adjustWarningMessagePositionToKeyBoard() { + // 공백 warning 위/아래 움직이게 + this.view?.let { KeyBoardUtil.setUpAsSoftKeyboard(it) } + } + private fun setClickEventLogging() { GoogleAnalyticsUtil.logClickEvent(CLICK_COMPLETE_MODIFY_TITLE) } From baf6a4c0073efe00025dc32e6fe9acf3207a05c7 Mon Sep 17 00:00:00 2001 From: kxxhyorim Date: Mon, 29 May 2023 01:42:00 +0900 Subject: [PATCH 20/39] =?UTF-8?q?[CHORE]=20=EC=BD=98=ED=85=90=EC=B8=A0=20?= =?UTF-8?q?=EC=A0=80=EC=9E=A5=20=EC=8B=9C=20DEV=20=EB=AA=A8=EB=93=9C?= =?UTF-8?q?=EC=97=90=EC=84=9C=EB=A7=8C=20default=20URL=20=EC=84=A4?= =?UTF-8?q?=EC=A0=95=20(#872)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/org/sopt/havit/ui/share/ShareViewModel.kt | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/org/sopt/havit/ui/share/ShareViewModel.kt b/app/src/main/java/org/sopt/havit/ui/share/ShareViewModel.kt index b738e8cd..746dd469 100644 --- a/app/src/main/java/org/sopt/havit/ui/share/ShareViewModel.kt +++ b/app/src/main/java/org/sopt/havit/ui/share/ShareViewModel.kt @@ -9,6 +9,7 @@ import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.launch import org.jsoup.Jsoup import org.jsoup.nodes.Document +import org.sopt.havit.BuildConfig import org.sopt.havit.data.RetrofitObject import org.sopt.havit.data.mapper.CategoryMapper import org.sopt.havit.data.remote.ContentsSummeryData @@ -20,7 +21,8 @@ import org.sopt.havit.ui.share.notification.AfterTime import org.sopt.havit.util.CalenderUtil import org.sopt.havit.util.HavitAuthUtil import org.sopt.havit.util.HavitSharedPreference -import java.util.* +import java.util.Calendar +import java.util.Date import java.util.regex.Pattern import javax.inject.Inject @@ -58,7 +60,7 @@ class ShareViewModel @Inject constructor( val categoryList: LiveData> = _categoryList private var _selectedCategoryId = MutableLiveData>() - val selectedCategoryId: LiveData> = _selectedCategoryId + private val selectedCategoryId: LiveData> = _selectedCategoryId private val _categoryViewState = MutableLiveData(NetworkStatus.Init()) val categoryViewState: LiveData = _categoryViewState @@ -114,7 +116,7 @@ class ShareViewModel @Inject constructor( private fun extractUrl(content: String?): String { val urlPattern = Pattern.compile( - "(?:^|[\\W])((ht|f)tp(s?)://|www\\.)" + "(?:^|\\W)((ht|f)tp(s?)://|www\\.)" + "(([\\w\\-]+\\.)+?([\\w\\-.~]+/?)*" + "[\\p{Alnum}.,%_=?&#\\-+()\\[\\]*$~@!:/{};']*)", Pattern.CASE_INSENSITIVE or Pattern.MULTILINE or Pattern.DOTALL @@ -125,6 +127,7 @@ class ShareViewModel @Inject constructor( val matchEnd = matcher.end() return content?.substring(matchStart, matchEnd) ?: "" } + if (BuildConfig.IS_DEV) return "https://www.havit.app/" throw IllegalStateException() } From 091d7430939ec66f0b474f5540f0d4ab161d7525 Mon Sep 17 00:00:00 2001 From: kxxhyorim Date: Mon, 29 May 2023 02:10:29 +0900 Subject: [PATCH 21/39] =?UTF-8?q?[FEAT]=20=EC=BD=98=ED=85=90=EC=B8=A0=20?= =?UTF-8?q?=EC=A0=9C=EB=AA=A9=EC=9D=B4=20=EA=B3=B5=EB=B0=B1=EC=9C=BC?= =?UTF-8?q?=EB=A1=9C=EB=A7=8C=20=EC=9D=B4=EB=A3=A8=EC=96=B4=EC=A7=84=20?= =?UTF-8?q?=EA=B2=BD=EC=9A=B0,=20warning=20=ED=91=9C=EC=8B=9C=20(#871)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ui/share/edit_title/EditTitleFragment.kt | 17 ++++++++++++++++- app/src/main/res/layout/fragment_edit_title.xml | 2 ++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/org/sopt/havit/ui/share/edit_title/EditTitleFragment.kt b/app/src/main/java/org/sopt/havit/ui/share/edit_title/EditTitleFragment.kt index 162a4d78..e6a0b2f2 100644 --- a/app/src/main/java/org/sopt/havit/ui/share/edit_title/EditTitleFragment.kt +++ b/app/src/main/java/org/sopt/havit/ui/share/edit_title/EditTitleFragment.kt @@ -4,6 +4,7 @@ import android.os.Bundle import android.view.LayoutInflater import android.view.View import android.view.ViewGroup +import androidx.core.widget.addTextChangedListener import androidx.fragment.app.Fragment import androidx.fragment.app.activityViewModels import androidx.navigation.fragment.findNavController @@ -11,6 +12,7 @@ import androidx.navigation.fragment.navArgs import dagger.hilt.android.AndroidEntryPoint import org.sopt.havit.databinding.FragmentEditTitleBinding import org.sopt.havit.ui.share.ShareViewModel +import org.sopt.havit.ui.share.ShareViewModel.Companion.NO_TITLE_CONTENTS import org.sopt.havit.util.AutoClearedValue import org.sopt.havit.util.DialogUtil import org.sopt.havit.util.GoogleAnalyticsUtil @@ -41,6 +43,7 @@ class EditTitleFragment : Fragment(), OnBackPressedHandler { setCursor() setScreenEventLogging() adjustWarningMessagePositionToKeyBoard() + showWhitespaceWarningMessage() } private fun setCursor() { @@ -62,7 +65,8 @@ class EditTitleFragment : Fragment(), OnBackPressedHandler { private fun initClickListener() { binding.icBack.setOnClickListener { onBackClicked() } binding.tvComplete.setOnClickListener { - viewModel.ogData.value?.ogTitle = binding.etTitle.text.toString() + viewModel.ogData.value?.ogTitle = + binding.etTitle.text.toString().ifBlank { NO_TITLE_CONTENTS } setClickEventLogging() goBack() } @@ -73,6 +77,17 @@ class EditTitleFragment : Fragment(), OnBackPressedHandler { this.view?.let { KeyBoardUtil.setUpAsSoftKeyboard(it) } } + private fun showWhitespaceWarningMessage() { + binding.etTitle.addTextChangedListener { + val title = it.toString() + if (title.isNotEmpty() && title.isBlank()) { // 공백만 있는 경우 + binding.clWarningWhitespace.visibility = View.VISIBLE + } else { + binding.clWarningWhitespace.visibility = View.GONE + } + } + } + private fun setClickEventLogging() { GoogleAnalyticsUtil.logClickEvent(CLICK_COMPLETE_MODIFY_TITLE) } diff --git a/app/src/main/res/layout/fragment_edit_title.xml b/app/src/main/res/layout/fragment_edit_title.xml index 61619759..3813d713 100644 --- a/app/src/main/res/layout/fragment_edit_title.xml +++ b/app/src/main/res/layout/fragment_edit_title.xml @@ -113,10 +113,12 @@ tools:text="콘텐츠 제목 어쩌구 저쩌구 블라블라 줄바꿈저쩌구 블라블라 줄바꿈 테스트으으ㅡ으 줄바꿈 테스트으으ㅡ으" /> From 7e0ab309a36af0c5f710f28ce1cac3484f65cad5 Mon Sep 17 00:00:00 2001 From: kxxhyorim Date: Mon, 29 May 2023 03:24:43 +0900 Subject: [PATCH 22/39] =?UTF-8?q?[CHORE]=20=EB=8D=94=EC=9D=B4=EC=83=81=20?= =?UTF-8?q?=EC=82=AC=EC=9A=A9=ED=95=98=EC=A7=80=20=EC=95=8A=EB=8A=94=20Sha?= =?UTF-8?q?redPreference=20inject=20=EC=A0=9C=EA=B1=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ui/share/contents_summery/ContentsSummeryFragment.kt | 5 ----- 1 file changed, 5 deletions(-) diff --git a/app/src/main/java/org/sopt/havit/ui/share/contents_summery/ContentsSummeryFragment.kt b/app/src/main/java/org/sopt/havit/ui/share/contents_summery/ContentsSummeryFragment.kt index a5b730ab..27bca0f2 100644 --- a/app/src/main/java/org/sopt/havit/ui/share/contents_summery/ContentsSummeryFragment.kt +++ b/app/src/main/java/org/sopt/havit/ui/share/contents_summery/ContentsSummeryFragment.kt @@ -16,20 +16,15 @@ import org.sopt.havit.util.DialogUtil import org.sopt.havit.util.GoogleAnalyticsUtil import org.sopt.havit.util.GoogleAnalyticsUtil.CLICK_COMPLETE_SAVE_CONTENT import org.sopt.havit.util.GoogleAnalyticsUtil.CONTENT_CUSTOM -import org.sopt.havit.util.HavitSharedPreference import org.sopt.havit.util.ToastUtil import org.sopt.havit.util.setOnSingleClickListener import org.sopt.havit.util.setOnSinglePostClickListener -import javax.inject.Inject @AndroidEntryPoint class ContentsSummeryFragment : BaseBindingFragment(R.layout.fragment_contents_summery) { private val viewModel: ShareViewModel by activityViewModels() - @Inject - lateinit var preference: HavitSharedPreference - override fun onViewCreated(view: View, savedInstanceState: Bundle?) { super.onViewCreated(view, savedInstanceState) binding.viewModel = viewModel From 324493065441335853737511cc346c11f0ded85b Mon Sep 17 00:00:00 2001 From: hyein Date: Mon, 29 May 2023 19:58:25 +0900 Subject: [PATCH 23/39] =?UTF-8?q?[FEAT]=20=EC=B9=B4=ED=85=8C=EA=B3=A0?= =?UTF-8?q?=EB=A6=AC=20=EC=A0=9C=EB=AA=A9=20=EC=88=98=EC=A0=95=20=EC=8B=9C?= =?UTF-8?q?,=20=EC=95=9E=20=EB=92=A4=20=EA=B3=B5=EB=B0=B1=20=EC=A0=9C?= =?UTF-8?q?=EA=B1=B0=20=EB=B0=8F=20=EA=B3=B5=EB=B0=B1=EB=A7=8C=20=EC=9E=85?= =?UTF-8?q?=EB=A0=A5=EC=9D=84=20=EB=B9=84=ED=97=88=EC=9A=A9=20=EC=B2=98?= =?UTF-8?q?=EB=A6=AC=20(#845)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../category/CategoryContentModifyActivity.kt | 37 ++++++++++++------- .../activity_category_content_modify.xml | 16 +++++--- app/src/main/res/values/strings.xml | 1 + 3 files changed, 34 insertions(+), 20 deletions(-) diff --git a/app/src/main/java/org/sopt/havit/ui/category/CategoryContentModifyActivity.kt b/app/src/main/java/org/sopt/havit/ui/category/CategoryContentModifyActivity.kt index d6b17671..b7286114 100644 --- a/app/src/main/java/org/sopt/havit/ui/category/CategoryContentModifyActivity.kt +++ b/app/src/main/java/org/sopt/havit/ui/category/CategoryContentModifyActivity.kt @@ -39,7 +39,7 @@ class CategoryContentModifyActivity : initIconAdapter() setCategoryIntentData() - setTextWatcher() + checkCategoryTitleValidation() setBackBtnClickListener() setDeleteTitleBtnClickListener() setDeleteBtnClickListener() @@ -100,27 +100,37 @@ class CategoryContentModifyActivity : binding.ivDeleteText.setOnSingleClickListener { deleteCategoryTitle() } } - private fun setTextWatcher() { + private fun checkCategoryTitleValidation() { binding.etCategory.addTextChangedListener { - // 중복된 카테고리 명인지 검사 & 현재 카테고리 명인지 검사(현재 카테고리 명이라면 중복이 아님을 명시) - binding.isDuplicated = - (binding.categoryTitle in categoryTitleList && binding.categoryTitle != originCategoryName) + binding.categoryTitle?.let { categoryTitle -> + binding.isOnlySpace = isOnlySpace(categoryTitle) + binding.isDuplicated = isDuplicated(categoryTitle) + } } } + private fun isOnlySpace(categoryTitle: String): Boolean = + categoryTitle.isNotEmpty() && categoryTitle.trim().isEmpty() + + private fun isDuplicated(categoryTitle: String): Boolean = + (categoryTitle.trim() in categoryTitleList && categoryTitle.trim() != originCategoryName) + private fun deleteCategoryTitle() = binding.etCategory.text.clear() - // 뒤로가기 시 액션 private fun setBackPressedAction() { - if (isModified()) { + if (isNotModified()) { finish() } else { showBackAlertDialog() } } - private fun isModified() = - (binding.categoryTitle == originCategoryName && clickedPosition == originCategoryImageId) + private fun isNotModified(): Boolean { + binding.categoryTitle?.let { categoryTitle -> + return (categoryTitle.trim() == originCategoryName && clickedPosition == originCategoryImageId) + } + return false + } // 뒤로가기 시 뜨는 dialog private fun showBackAlertDialog() { @@ -142,16 +152,15 @@ class CategoryContentModifyActivity : private fun setModifyCompleteBtnClickListener() { binding.tvComplete.setOnSingleClickListener { requestCategoryModify() - } } private fun requestCategoryModify() { // 서버로 카테고리 내용 수정 요청 categoryViewModel.requestCategoryContent( - id, - clickedPosition + 1, - binding.categoryTitle.toString() + id = id, + imageId = clickedPosition + 1, + title = binding.categoryTitle!!.trim() ) } @@ -165,7 +174,7 @@ class CategoryContentModifyActivity : val callingActivityName = callingActivity.className val intent = Intent(this, callingActivity.className.javaClass).apply { - putExtra(CATEGORY_NAME, binding.categoryTitle) + putExtra(CATEGORY_NAME, binding.categoryTitle!!.trim()) putExtra(CATEGORY_IMAGE_ID, clickedPosition + 1) } if (callingActivityName == CategoryOrderModifyActivity::class.java.name) { diff --git a/app/src/main/res/layout/activity_category_content_modify.xml b/app/src/main/res/layout/activity_category_content_modify.xml index 50e53f3c..cc3ba469 100644 --- a/app/src/main/res/layout/activity_category_content_modify.xml +++ b/app/src/main/res/layout/activity_category_content_modify.xml @@ -11,6 +11,10 @@ name="isDuplicated" type="Boolean" /> + + @@ -59,12 +63,12 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginEnd="8dp" - android:enabled="@{(!isDuplicated && (categoryTitle.length() != 0))}" + android:enabled="@{(!isDuplicated && !isOnlySpace && (categoryTitle.length() != 0))}" android:paddingHorizontal="15dp" android:paddingVertical="6dp" android:text="@string/category_complete" android:textAppearance="@style/Text14Medium" - android:textColor="@{(!isDuplicated && (categoryTitle.length() != 0)) ? @color/white : @color/gray_1, default = @color/white}" + android:textColor="@{(!isDuplicated && !isOnlySpace && (categoryTitle.length() != 0)) ? @color/white : @color/gray_1, default = @color/white}" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintTop_toTopOf="parent" /> @@ -142,7 +146,7 @@ android:layout_height="wrap_content" android:layout_marginTop="7dp" android:src="@drawable/ic_notice_red" - android:visibility="@{isDuplicated ? View.VISIBLE : View.INVISIBLE, default = gone}" + android:visibility="@{(isDuplicated || isOnlySpace) ? View.VISIBLE : View.INVISIBLE, default = gone}" app:layout_constraintStart_toStartOf="@+id/et_category" app:layout_constraintTop_toBottomOf="@+id/et_category" /> @@ -150,10 +154,10 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginStart="4dp" - android:text="@string/duplicate_category" + android:text="@{isOnlySpace ? @string/notice_title_spacing : @string/duplicate_category}" android:textAppearance="@style/Sub12Regular" android:textColor="@color/havit_red" - android:visibility="@{isDuplicated ? View.VISIBLE : View.INVISIBLE, default = gone}" + android:visibility="@{(isDuplicated || isOnlySpace) ? View.VISIBLE : View.INVISIBLE, default = gone}" app:layout_constraintBottom_toBottomOf="@id/iv_notice" app:layout_constraintStart_toEndOf="@id/iv_notice" app:layout_constraintTop_toTopOf="@id/iv_notice" /> @@ -202,4 +206,4 @@ - \ No newline at end of file + diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index dddb8383..ea3d0a01 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -282,4 +282,5 @@ 현재 버전  - 닉네임에 띄어쓰기는 사용할 수 없습니다. + 제목에 띄어쓰기만 사용할 수 없습니다. From 16d9421306b3e134b60a0a5e53fba04d42c1c14c Mon Sep 17 00:00:00 2001 From: kxxhyorim Date: Thu, 1 Jun 2023 20:21:27 +0900 Subject: [PATCH 24/39] =?UTF-8?q?[FEAT]=20=EC=88=98=EC=A0=95=EB=90=9C=20?= =?UTF-8?q?=EC=BD=98=ED=85=90=EC=B8=A0=20=EC=A0=9C=EB=AA=A9=EC=9D=B4=20?= =?UTF-8?q?=EA=B3=B5=EB=B0=B1=EC=9C=BC=EB=A1=9C=EB=A7=8C=20=EC=9D=B4?= =?UTF-8?q?=EB=A3=A8=EC=96=B4=EC=A7=84=20=EA=B2=BD=EC=9A=B0,=20warning=20?= =?UTF-8?q?=ED=91=9C=EC=8B=9C=20(#871)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../edit_title/EditTitleFromMoreFragment.kt | 35 ++++++++++++++----- .../layout/fragment_edit_title_from_more.xml | 20 +++++++++-- 2 files changed, 45 insertions(+), 10 deletions(-) diff --git a/app/src/main/java/org/sopt/havit/ui/contents/more/edit_title/EditTitleFromMoreFragment.kt b/app/src/main/java/org/sopt/havit/ui/contents/more/edit_title/EditTitleFromMoreFragment.kt index 829fc9b0..c41dcb6c 100644 --- a/app/src/main/java/org/sopt/havit/ui/contents/more/edit_title/EditTitleFromMoreFragment.kt +++ b/app/src/main/java/org/sopt/havit/ui/contents/more/edit_title/EditTitleFromMoreFragment.kt @@ -1,11 +1,10 @@ package org.sopt.havit.ui.contents.more.edit_title -import android.content.Context.INPUT_METHOD_SERVICE import android.os.Bundle import android.os.Parcelable import android.view.View import android.view.WindowManager -import android.view.inputmethod.InputMethodManager +import androidx.core.widget.addTextChangedListener import androidx.fragment.app.viewModels import com.google.android.material.bottomsheet.BottomSheetDialogFragment import dagger.hilt.android.AndroidEntryPoint @@ -16,7 +15,14 @@ import org.sopt.havit.ui.base.BaseBindingFragment import org.sopt.havit.ui.contents.more.BottomSheetMoreFragment.Companion.CONTENTS_DATA import org.sopt.havit.ui.contents.more.edit_notification.EditNotificationFromMoreViewModel.Companion.FAIL import org.sopt.havit.ui.contents.more.edit_title.EditTitleFromMoreViewModel.Companion.SUCCESS -import org.sopt.havit.util.* +import org.sopt.havit.util.DialogUtil +import org.sopt.havit.util.ERROR_OCCUR_TYPE +import org.sopt.havit.util.EventObserver +import org.sopt.havit.util.KeyBoardUtil +import org.sopt.havit.util.MODIFY_TITLE_COMPLETE_TYPE +import org.sopt.havit.util.OnBackPressedHandler +import org.sopt.havit.util.ToastUtil +import org.sopt.havit.util.setOnSingleClickListener @AndroidEntryPoint class EditTitleFromMoreFragment : @@ -35,6 +41,8 @@ class EditTitleFromMoreFragment : setKeyBoardUp() setCursor() onCloseClicked() + adjustWarningMessagePositionToKeyBoard() + showWhitespaceWarningMessage() } private fun getBundleData(): Parcelable? { @@ -65,11 +73,6 @@ class EditTitleFromMoreFragment : private fun setKeyBoardUp() { bottomSheetDialogFragment.dialog?.window?.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE) - bottomSheetDialogFragment.dialog?.setOnShowListener { - val imm = - requireContext().getSystemService(INPUT_METHOD_SERVICE) as InputMethodManager - imm.toggleSoftInput(InputMethodManager.HIDE_IMPLICIT_ONLY, 0) - } } private fun setCursor() { @@ -83,6 +86,22 @@ class EditTitleFromMoreFragment : } } + private fun adjustWarningMessagePositionToKeyBoard() { + // 공백 warning 위/아래 움직이게 + this.view?.let { KeyBoardUtil.setUpAsSoftKeyboard(it) } + } + + private fun showWhitespaceWarningMessage() { + binding.etTitle.addTextChangedListener { + val title = it.toString() + if (title.isNotEmpty() && title.isBlank()) { // 공백만 있는 경우 + binding.clWarningWhitespace.visibility = View.VISIBLE + } else { + binding.clWarningWhitespace.visibility = View.GONE + } + } + } + private fun onCloseClicked() { binding.icClose.setOnSingleClickListener { if (viewModel.isTitleModified()) showEditTitleWarningDialog() diff --git a/app/src/main/res/layout/fragment_edit_title_from_more.xml b/app/src/main/res/layout/fragment_edit_title_from_more.xml index c722884f..ca7add6f 100644 --- a/app/src/main/res/layout/fragment_edit_title_from_more.xml +++ b/app/src/main/res/layout/fragment_edit_title_from_more.xml @@ -100,7 +100,7 @@ + tools:text="콘텐츠 제목 어쩌구 저쩌구 블라블라 줄바꿈저쩌구 블라블라 줄바꿈 테스트으으ㅡ으 줄바꿈 테스트으으ㅡ으" /> + + + + + From c6a41cf6c714c2148da48e571a6b6268e5c4ecff Mon Sep 17 00:00:00 2001 From: hyein Date: Sun, 4 Jun 2023 22:22:19 +0900 Subject: [PATCH 25/39] =?UTF-8?q?[REFACTOR]=20=EC=A4=91=EB=B3=B5=EB=90=9C?= =?UTF-8?q?=20string=20value=20=EC=A0=9C=EA=B1=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/src/main/res/layout/activity_category_content_modify.xml | 2 +- app/src/main/res/values/strings.xml | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/app/src/main/res/layout/activity_category_content_modify.xml b/app/src/main/res/layout/activity_category_content_modify.xml index cc3ba469..8c684c16 100644 --- a/app/src/main/res/layout/activity_category_content_modify.xml +++ b/app/src/main/res/layout/activity_category_content_modify.xml @@ -154,7 +154,7 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginStart="4dp" - android:text="@{isOnlySpace ? @string/notice_title_spacing : @string/duplicate_category}" + android:text="@{isOnlySpace ? @string/whitespace_disable_on_title : @string/duplicate_category}" android:textAppearance="@style/Sub12Regular" android:textColor="@color/havit_red" android:visibility="@{(isDuplicated || isOnlySpace) ? View.VISIBLE : View.INVISIBLE, default = gone}" diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index d2e0912a..096151ca 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -282,7 +282,6 @@ 현재 버전  - 닉네임에 띄어쓰기는 사용할 수 없습니다. - 제목에 띄어쓰기만 사용할 수 없습니다. 제목에 띄어쓰기만 사용할 수 없습니다. From d736c786ae8a0319b9bd6ae1372ec5658cfe29d2 Mon Sep 17 00:00:00 2001 From: hyein Date: Mon, 26 Jun 2023 14:30:49 +0900 Subject: [PATCH 26/39] =?UTF-8?q?[FEAT]=20release=20=EC=95=B1=EC=97=90?= =?UTF-8?q?=EC=84=9C=20Log=20=EC=A0=9C=EA=B1=B0=EB=90=98=EB=8F=84=EB=A1=9D?= =?UTF-8?q?=20proguard=20=EC=84=A4=EC=A0=95=20(#870)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/proguard-rules.pro | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro index df956bba..4b159654 100644 --- a/app/proguard-rules.pro +++ b/app/proguard-rules.pro @@ -23,4 +23,13 @@ -keep class com.kakao.sdk.**.model.* { ; } -keep class * extends com.google.gson.TypeAdapter -keep class org.sopt.havit.data.remote.** { *; } --keep class org.sopt.havit.domain.entity.** { *; } \ No newline at end of file +-keep class org.sopt.havit.domain.entity.** { *; } + +-assumenosideeffects class android.util.Log { + public static boolean isLoggable(java.lang.String, int); + public static int v(...); + public static int d(...); + public static int i(...); + public static int w(...); + public static int e(...); +} From bd115d2fd844caeda31d4fce574ccdfa43a02762 Mon Sep 17 00:00:00 2001 From: hyein Date: Mon, 26 Jun 2023 14:34:36 +0900 Subject: [PATCH 27/39] =?UTF-8?q?[FEAT]=20okhttp=EC=9D=98=20log=EB=A5=BC?= =?UTF-8?q?=20debug=EC=9D=BC=EB=95=8C=EB=A7=8C=20=EC=B6=9C=EB=A0=A5?= =?UTF-8?q?=ED=95=98=EB=8F=84=EB=A1=9D=20=EB=B3=80=EA=B2=BD=20(#870)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/org/sopt/havit/data/RetrofitObject.kt | 5 ++++- .../java/org/sopt/havit/di/RetrofitModule.kt | 17 ++++++++++------- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/app/src/main/java/org/sopt/havit/data/RetrofitObject.kt b/app/src/main/java/org/sopt/havit/data/RetrofitObject.kt index 6e8c6d6e..06372bc2 100644 --- a/app/src/main/java/org/sopt/havit/data/RetrofitObject.kt +++ b/app/src/main/java/org/sopt/havit/data/RetrofitObject.kt @@ -21,8 +21,11 @@ object RetrofitObject { readTimeout(20, TimeUnit.SECONDS) connectTimeout(20, TimeUnit.SECONDS) writeTimeout(5, TimeUnit.SECONDS) - addInterceptor(getLoggingInterceptor()) addInterceptor(getTokenInterceptor(jwt)) + + if (DEBUG) { + addInterceptor(getLoggingInterceptor()) + } }.build() private fun getTokenInterceptor(jwt: String) = Interceptor { diff --git a/app/src/main/java/org/sopt/havit/di/RetrofitModule.kt b/app/src/main/java/org/sopt/havit/di/RetrofitModule.kt index c231fd3e..d1cf3e88 100644 --- a/app/src/main/java/org/sopt/havit/di/RetrofitModule.kt +++ b/app/src/main/java/org/sopt/havit/di/RetrofitModule.kt @@ -38,15 +38,18 @@ object RetrofitModule { @Provides @Singleton - fun provideOkHttpInterceptor( + fun provideOkHttpClient( interceptor: Interceptor ): OkHttpClient { - return OkHttpClient.Builder() - .addInterceptor( - HttpLoggingInterceptor().apply { level = HttpLoggingInterceptor.Level.BODY } - ) - .addInterceptor(interceptor) - .build() + return OkHttpClient.Builder().apply { + addInterceptor(interceptor) + + if (DEBUG) { + addInterceptor(HttpLoggingInterceptor().apply { + level = HttpLoggingInterceptor.Level.BODY + }) + } + }.build() } @Provides From ee9702c21adaa9700ccfd60f880e24fa7da18215 Mon Sep 17 00:00:00 2001 From: kxxhyorim Date: Tue, 27 Jun 2023 11:51:10 +0900 Subject: [PATCH 28/39] =?UTF-8?q?[ADD]=20=EB=8B=89=EB=84=A4=EC=9E=84=20?= =?UTF-8?q?=EA=B3=B5=EB=B0=B1=20=EC=A3=BC=EC=9D=98=20=EB=A0=88=EC=9D=B4?= =?UTF-8?q?=EC=95=84=EC=9B=83=20=EC=B6=94=EA=B0=80=20(#842)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../layout_nickname_whitespace_warning.xml | 29 +++++++++++++++++++ app/src/main/res/values/strings.xml | 1 + 2 files changed, 30 insertions(+) create mode 100644 app/src/main/res/layout/layout_nickname_whitespace_warning.xml diff --git a/app/src/main/res/layout/layout_nickname_whitespace_warning.xml b/app/src/main/res/layout/layout_nickname_whitespace_warning.xml new file mode 100644 index 00000000..d4745886 --- /dev/null +++ b/app/src/main/res/layout/layout_nickname_whitespace_warning.xml @@ -0,0 +1,29 @@ + + + + + + + + + diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 9a4eaca8..472b1007 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -283,4 +283,5 @@ - 닉네임에 띄어쓰기는 사용할 수 없습니다. 제목에 띄어쓰기만 사용할 수 없습니다. + 닉네임에 띄어쓰기는 사용할 수 없습니다. From 7e687c314a16c0c5da49ce51d47b494fd704bc31 Mon Sep 17 00:00:00 2001 From: kxxhyorim Date: Tue, 27 Jun 2023 11:52:20 +0900 Subject: [PATCH 29/39] =?UTF-8?q?[FEAT]=20=EC=88=98=EC=A0=95=EB=90=9C=20?= =?UTF-8?q?=EB=8B=89=EB=84=A4=EC=9E=84=EC=9D=B4=20=EA=B3=B5=EB=B0=B1?= =?UTF-8?q?=EC=9C=BC=EB=A1=9C=EB=A7=8C=20=EC=9D=B4=EB=A3=A8=EC=96=B4?= =?UTF-8?q?=EC=A7=84=20=EA=B2=BD=EC=9A=B0,=20warning=20=ED=91=9C=EC=8B=9C?= =?UTF-8?q?=20(#842)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/src/main/AndroidManifest.xml | 1 + .../setting/SettingModifyNicknameActivity.kt | 21 ++++++++---- .../ui/setting/viewmodel/SettingViewModel.kt | 9 ++++- .../activity_setting_modify_nickname.xml | 33 ++++++++++++------- 4 files changed, 44 insertions(+), 20 deletions(-) diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index a5403384..00258316 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -63,6 +63,7 @@ = _isNicknameHasWhiteSpace + fun isNickNameContainWhiteSpace() { + _isNicknameHasWhiteSpace.value = nickname.value?.contains(" ") ?: false + } + fun removeHavitAuthToken() { authRepository.removeHavitAuthToken() } diff --git a/app/src/main/res/layout/activity_setting_modify_nickname.xml b/app/src/main/res/layout/activity_setting_modify_nickname.xml index 3de8c7e5..91a7421d 100644 --- a/app/src/main/res/layout/activity_setting_modify_nickname.xml +++ b/app/src/main/res/layout/activity_setting_modify_nickname.xml @@ -67,28 +67,37 @@ android:layout_width="0dp" android:layout_height="wrap_content" android:layout_marginHorizontal="17dp" - android:layout_marginTop="20dp" - android:background="@null" + android:layout_marginTop="27dp" + android:focusable="true" + android:focusableInTouchMode="true" android:hint="@string/edit_nickname" android:lines="1" android:maxLength="15" - android:paddingVertical="4dp" android:textAppearance="@style/Header18Medium" android:textColor="@color/havit_gray" android:textColorHint="@color/gray_2" android:textCursorDrawable="@drawable/rectangle_havit_purple_cursor" + android:theme="@style/PurpleEditTextStyle" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toBottomOf="@id/tv_nickname" /> - + + + + + Date: Tue, 27 Jun 2023 15:54:37 +0900 Subject: [PATCH 30/39] =?UTF-8?q?[FEAT]=20=EB=8B=89=EB=84=A4=EC=9E=84=20?= =?UTF-8?q?=EC=88=98=EC=A0=95=20enter=20=EB=B6=88=EA=B0=80=EB=8A=A5?= =?UTF-8?q?=ED=95=98=EA=B2=8C=20=EB=B3=80=EA=B2=BD=20(#842)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/src/main/res/layout/activity_setting_modify_nickname.xml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/src/main/res/layout/activity_setting_modify_nickname.xml b/app/src/main/res/layout/activity_setting_modify_nickname.xml index 91a7421d..cee42ceb 100644 --- a/app/src/main/res/layout/activity_setting_modify_nickname.xml +++ b/app/src/main/res/layout/activity_setting_modify_nickname.xml @@ -71,8 +71,10 @@ android:focusable="true" android:focusableInTouchMode="true" android:hint="@string/edit_nickname" + android:inputType="text" android:lines="1" android:maxLength="15" + android:maxLines="1" android:textAppearance="@style/Header18Medium" android:textColor="@color/havit_gray" android:textColorHint="@color/gray_2" From e25c627ac246fcab1607a1a638e96a65a4646a37 Mon Sep 17 00:00:00 2001 From: kxxhyorim Date: Tue, 27 Jun 2023 16:55:18 +0900 Subject: [PATCH 31/39] =?UTF-8?q?[FEAT]=20=EB=8B=89=EB=84=A4=EC=9E=84?= =?UTF-8?q?=EC=97=90=20=EA=B3=B5=EB=B0=B1=EC=9D=B4=20=ED=8F=AC=ED=95=A8?= =?UTF-8?q?=EB=90=98=EC=A7=80=20=EC=95=8A=EC=9C=BC=EB=A9=B4=EC=84=9C,=200?= =?UTF-8?q?=EC=9E=90=20=EC=9D=B4=EC=83=81=EC=9D=BC=20=EA=B2=BD=EC=9A=B0?= =?UTF-8?q?=EC=97=90=EB=A7=8C=20=EC=99=84=EB=A3=8C=20=EB=B2=84=ED=8A=BC=20?= =?UTF-8?q?=ED=99=9C=EC=84=B1=ED=99=94=20(#842)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../havit/ui/setting/SettingModifyNicknameActivity.kt | 1 + .../havit/ui/setting/viewmodel/SettingViewModel.kt | 10 +++++++++- .../res/layout/activity_setting_modify_nickname.xml | 4 ++-- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/org/sopt/havit/ui/setting/SettingModifyNicknameActivity.kt b/app/src/main/java/org/sopt/havit/ui/setting/SettingModifyNicknameActivity.kt index d00cc46b..8350672c 100644 --- a/app/src/main/java/org/sopt/havit/ui/setting/SettingModifyNicknameActivity.kt +++ b/app/src/main/java/org/sopt/havit/ui/setting/SettingModifyNicknameActivity.kt @@ -39,6 +39,7 @@ class SettingModifyNicknameActivity : val nickname = binding.etNickname.text.toString() settingViewModel.setNickname(nickname) settingViewModel.isNickNameContainWhiteSpace() + settingViewModel.isNicknameValid() } } diff --git a/app/src/main/java/org/sopt/havit/ui/setting/viewmodel/SettingViewModel.kt b/app/src/main/java/org/sopt/havit/ui/setting/viewmodel/SettingViewModel.kt index 657e48ad..c5b772a2 100644 --- a/app/src/main/java/org/sopt/havit/ui/setting/viewmodel/SettingViewModel.kt +++ b/app/src/main/java/org/sopt/havit/ui/setting/viewmodel/SettingViewModel.kt @@ -67,7 +67,15 @@ class SettingViewModel @Inject constructor( // 프로필수정뷰 - editText에 닉네임 초기화 fun setNickname(nickname: String) { _nickname.value = nickname + } + // 닉네임에 공백이 포함되지 않으면서, 0자 이상 + private val _isNicknameAvailable = MutableLiveData(true) + val isNicknameAvailable: LiveData = _isNicknameAvailable + fun isNicknameValid() { + val isNicknameNotBlank: Boolean = nickname.value?.isNotBlank() ?: false + val isNicknameHasWhiteSpace: Boolean = isNicknameHasWhiteSpace.value ?: false + _isNicknameAvailable.value = isNicknameNotBlank && !isNicknameHasWhiteSpace } // 프로필수정뷰 - 닉네임 수정 @@ -87,7 +95,7 @@ class SettingViewModel @Inject constructor( private val _isNicknameHasWhiteSpace = MutableLiveData(false) val isNicknameHasWhiteSpace: LiveData = _isNicknameHasWhiteSpace fun isNickNameContainWhiteSpace() { - _isNicknameHasWhiteSpace.value = nickname.value?.contains(" ") ?: false + _isNicknameHasWhiteSpace.value = nickname.value?.contains("\\s".toRegex()) ?: false } fun removeHavitAuthToken() { diff --git a/app/src/main/res/layout/activity_setting_modify_nickname.xml b/app/src/main/res/layout/activity_setting_modify_nickname.xml index cee42ceb..c2f6ab39 100644 --- a/app/src/main/res/layout/activity_setting_modify_nickname.xml +++ b/app/src/main/res/layout/activity_setting_modify_nickname.xml @@ -139,8 +139,8 @@ android:id="@+id/btn_complete" android:layout_width="match_parent" android:layout_height="56dp" - android:background="@{etNickname.text.length() > 0? @drawable/rectangle_havit_purple : @drawable/rectangle_gray_2}" - android:enabled="@{etNickname.text.length() > 0? true : false}" + android:background="@{vmSetting.isNicknameAvailable ? @drawable/rectangle_havit_purple : @drawable/rectangle_gray_2}" + android:enabled="@{vmSetting.isNicknameAvailable ? true : false}" android:text="@string/complete" android:textAppearance="@style/Text16Semibold" android:textColor="@color/white" From 8db8c31ffd74298c743372b23ab0dd1d170c2f1b Mon Sep 17 00:00:00 2001 From: kxxhyorim Date: Tue, 27 Jun 2023 17:18:37 +0900 Subject: [PATCH 32/39] =?UTF-8?q?[FEAT]=20=EC=B9=B4=ED=85=8C=EA=B3=A0?= =?UTF-8?q?=EB=A6=AC=20=EC=83=9D=EC=84=B1=20-=20=EB=9D=84=EC=96=B4?= =?UTF-8?q?=EC=93=B0=EA=B8=B0=EB=A7=8C=20=EC=82=AC=EC=9A=A9=20=EB=B6=88?= =?UTF-8?q?=EA=B0=80=20UI=20=EC=B6=94=EA=B0=80=20(#879)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/src/main/res/layout/fragment_edit_title.xml | 2 +- .../res/layout/fragment_edit_title_from_more.xml | 2 +- .../res/layout/fragment_enter_category_title.xml | 15 ++++++++++++++- ...ng.xml => layout_title_whitespace_warning.xml} | 0 4 files changed, 16 insertions(+), 3 deletions(-) rename app/src/main/res/layout/{layout_contents_title_whitespace_warning.xml => layout_title_whitespace_warning.xml} (100%) diff --git a/app/src/main/res/layout/fragment_edit_title.xml b/app/src/main/res/layout/fragment_edit_title.xml index 3813d713..f94227a4 100644 --- a/app/src/main/res/layout/fragment_edit_title.xml +++ b/app/src/main/res/layout/fragment_edit_title.xml @@ -123,7 +123,7 @@ app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent"> - + diff --git a/app/src/main/res/layout/fragment_edit_title_from_more.xml b/app/src/main/res/layout/fragment_edit_title_from_more.xml index ca7add6f..d1ffeb05 100644 --- a/app/src/main/res/layout/fragment_edit_title_from_more.xml +++ b/app/src/main/res/layout/fragment_edit_title_from_more.xml @@ -130,7 +130,7 @@ app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent"> - + diff --git a/app/src/main/res/layout/fragment_enter_category_title.xml b/app/src/main/res/layout/fragment_enter_category_title.xml index 24311616..ab1fa4dd 100644 --- a/app/src/main/res/layout/fragment_enter_category_title.xml +++ b/app/src/main/res/layout/fragment_enter_category_title.xml @@ -110,6 +110,18 @@ android:theme="@style/PurpleEditTextStyle" app:layout_constraintTop_toBottomOf="@id/tv_enter_title" /> + + + + + + -