From c0af343b53a853dd781f30a1edf0c969dc790ed1 Mon Sep 17 00:00:00 2001 From: Deep Vora Date: Fri, 27 Dec 2024 17:58:30 -0500 Subject: [PATCH 1/4] enhanced alert input --- .../planet/myplanet/ui/news/AdapterNews.kt | 12 ++++--- .../myplanet/ui/team/MyTeamsDetailFragment.kt | 9 ++++-- .../teamDiscussion/DiscussionListFragment.kt | 6 ++-- app/src/main/res/layout/alert_input.xml | 31 +++++++++++++++++-- 4 files changed, 45 insertions(+), 13 deletions(-) diff --git a/app/src/main/java/org/ole/planet/myplanet/ui/news/AdapterNews.kt b/app/src/main/java/org/ole/planet/myplanet/ui/news/AdapterNews.kt index 95d172e9a4..7b22e6b293 100644 --- a/app/src/main/java/org/ole/planet/myplanet/ui/news/AdapterNews.kt +++ b/app/src/main/java/org/ole/planet/myplanet/ui/news/AdapterNews.kt @@ -15,6 +15,7 @@ import android.widget.EditText import android.widget.ImageView import android.widget.LinearLayout import android.widget.PopupMenu +import android.widget.TextView import androidx.annotation.RequiresApi import androidx.appcompat.app.AlertDialog import androidx.appcompat.view.ContextThemeWrapper @@ -343,10 +344,15 @@ class AdapterNews(var context: Context, private val list: MutableList(R.id.ll_image).visibility = if (showBetaFeature(Constants.KEY_NEWSADDIMAGE, context)) View.VISIBLE else View.GONE val llImage = v.findViewById(R.id.ll_alert_image) v.findViewById(R.id.add_news_image).setOnClickListener { listener?.addImage(llImage) } + val message = v.findViewById(R.id.cust_msg) + message.text = context.getString(if (isEdit) R.string.edit_post else R.string.reply) + val icon = v.findViewById(R.id.alert_icon) + icon.setImageResource(R.drawable.ic_edit) + val news = mRealm.where(RealmNews::class.java).equalTo("id", id).findFirst() if (isEdit) et.setText(context.getString(R.string.message_placeholder, news?.message)) - val dialog = AlertDialog.Builder(context, R.style.AlertDialogTheme).setTitle(if (isEdit) R.string.edit_post else R.string.reply) - .setIcon(R.drawable.ic_edit).setView(v) + val dialog = AlertDialog.Builder(context, R.style.CustomAlertDialog) + .setView(v) .setPositiveButton(R.string.button_submit) { _: DialogInterface?, _: Int -> val s = et.text.toString() if (isEdit) { @@ -361,8 +367,6 @@ class AdapterNews(var context: Context, private val list: MutableList val msg = "${alertInputBinding.tlInput.editText?.text}".trim { it <= ' ' } if (msg.isEmpty()) { @@ -114,7 +116,8 @@ class MyTeamsDetailFragment : BaseNewsFragment() { map["messagePlanetCode"] = team?.teamPlanetCode!! createNews(map, mRealm, user, imageList) rvDiscussion.adapter?.notifyItemInserted(0) - }.setNegativeButton(R.string.cancel, null).show() + }.setNegativeButton(R.string.cancel, null).create() + dialog.show() } override fun onViewCreated(view: View, savedInstanceState: Bundle?) { diff --git a/app/src/main/java/org/ole/planet/myplanet/ui/team/teamDiscussion/DiscussionListFragment.kt b/app/src/main/java/org/ole/planet/myplanet/ui/team/teamDiscussion/DiscussionListFragment.kt index 19b2f5e46b..fecffaf9dd 100644 --- a/app/src/main/java/org/ole/planet/myplanet/ui/team/teamDiscussion/DiscussionListFragment.kt +++ b/app/src/main/java/org/ole/planet/myplanet/ui/team/teamDiscussion/DiscussionListFragment.kt @@ -157,9 +157,10 @@ class DiscussionListFragment : BaseTeamFragment() { binding.llImage.visibility = if (showBetaFeature(Constants.KEY_NEWSADDIMAGE, requireContext())) View.VISIBLE else View.GONE layout.hint = getString(R.string.enter_message) layout.editText?.setHintTextColor(ContextCompat.getColor(requireContext(), R.color.daynight_textColor)) + binding.custMsg.text = getString(R.string.add_message) + val dialog = AlertDialog.Builder(requireActivity(), R.style.CustomAlertDialog) .setView(binding.root) - .setTitle(getString(R.string.add_message)) .setPositiveButton(getString(R.string.save)) { _: DialogInterface?, _: Int -> val msg = "${layout.editText?.text}".trim { it <= ' ' } if (msg.isEmpty()) { @@ -188,8 +189,7 @@ class DiscussionListFragment : BaseTeamFragment() { .create() dialog.show() - dialog.getButton(AlertDialog.BUTTON_POSITIVE)?.setTextColor(ContextCompat.getColor(requireContext(), R.color.colorPrimaryWhite)) - dialog.getButton(AlertDialog.BUTTON_NEGATIVE)?.setTextColor(ContextCompat.getColor(requireContext(), R.color.colorPrimaryWhite)) + } override fun setData(list: List?) { diff --git a/app/src/main/res/layout/alert_input.xml b/app/src/main/res/layout/alert_input.xml index 7c22b251fd..996da400c6 100644 --- a/app/src/main/res/layout/alert_input.xml +++ b/app/src/main/res/layout/alert_input.xml @@ -3,8 +3,31 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical" - android:background="@color/secondary_bg" + android:background="@color/daynight_grey" android:padding="@dimen/padding_normal"> + + + + + + + - + android:textColorHint="@color/hint_color" + android:textColor="@color/daynight_textColor" + android:backgroundTint="@color/daynight_textColor" /> Date: Fri, 3 Jan 2025 21:03:34 +0300 Subject: [PATCH 2/4] Update DiscussionListFragment.kt --- .../myplanet/ui/team/teamDiscussion/DiscussionListFragment.kt | 1 - 1 file changed, 1 deletion(-) diff --git a/app/src/main/java/org/ole/planet/myplanet/ui/team/teamDiscussion/DiscussionListFragment.kt b/app/src/main/java/org/ole/planet/myplanet/ui/team/teamDiscussion/DiscussionListFragment.kt index fecffaf9dd..145f3f9498 100644 --- a/app/src/main/java/org/ole/planet/myplanet/ui/team/teamDiscussion/DiscussionListFragment.kt +++ b/app/src/main/java/org/ole/planet/myplanet/ui/team/teamDiscussion/DiscussionListFragment.kt @@ -189,7 +189,6 @@ class DiscussionListFragment : BaseTeamFragment() { .create() dialog.show() - } override fun setData(list: List?) { From 25abe90845e76fddd0ef94f365294b32f8711f95 Mon Sep 17 00:00:00 2001 From: dogi Date: Fri, 3 Jan 2025 13:22:20 -0500 Subject: [PATCH 3/4] Update alert_input.xml --- app/src/main/res/layout/alert_input.xml | 2 -- 1 file changed, 2 deletions(-) diff --git a/app/src/main/res/layout/alert_input.xml b/app/src/main/res/layout/alert_input.xml index 996da400c6..6de3758645 100644 --- a/app/src/main/res/layout/alert_input.xml +++ b/app/src/main/res/layout/alert_input.xml @@ -16,7 +16,6 @@ android:id="@+id/alert_icon" android:layout_width="wrap_content" android:layout_height="wrap_content" /> - - Date: Fri, 3 Jan 2025 13:27:24 -0500 Subject: [PATCH 4/4] Update build.gradle --- app/build.gradle | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 48ba07ac46..e28612d7a8 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -10,8 +10,8 @@ android { applicationId "org.ole.planet.myplanet" minSdkVersion 26 targetSdkVersion 34 - versionCode 2155 - versionName "0.21.55" + versionCode 2160 + versionName "0.21.60" ndkVersion '21.3.6528147' testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" vectorDrawables.useSupportLibrary = true