diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 05662b167f..bfcf0a1f0e 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -123,6 +123,9 @@ android:name="android.support.FILE_PROVIDER_PATHS" android:resource="@xml/file_paths" /> - + diff --git a/app/src/main/AndroidManifest.xml.lite b/app/src/main/AndroidManifest.xml.lite index 820dd14adc..ad37497209 100644 --- a/app/src/main/AndroidManifest.xml.lite +++ b/app/src/main/AndroidManifest.xml.lite @@ -123,6 +123,9 @@ android:name="android.support.FILE_PROVIDER_PATHS" android:resource="@xml/file_paths" /> - + diff --git a/app/src/main/java/org/ole/planet/myplanet/base/BaseRecyclerFragment.kt b/app/src/main/java/org/ole/planet/myplanet/base/BaseRecyclerFragment.kt index cfb2abc90a..64dfbbb1f9 100644 --- a/app/src/main/java/org/ole/planet/myplanet/base/BaseRecyclerFragment.kt +++ b/app/src/main/java/org/ole/planet/myplanet/base/BaseRecyclerFragment.kt @@ -298,6 +298,7 @@ abstract class BaseRecyclerFragment
  • : BaseRecyclerParentFragment(), On "submission" -> (v as TextView).setText(R.string.no_submissions) "teams" -> (v as TextView).setText(R.string.no_teams) "chatHistory" -> (v as TextView).setText(R.string.no_chats) + "feedback" -> (v as TextView).setText(R.string.no_feedback) else -> (v as TextView).setText(R.string.no_data_available_please_check_and_try_again) } } diff --git a/app/src/main/java/org/ole/planet/myplanet/ui/feedback/FeedbackListFragment.kt b/app/src/main/java/org/ole/planet/myplanet/ui/feedback/FeedbackListFragment.kt index 09d5b33970..bf49250c18 100644 --- a/app/src/main/java/org/ole/planet/myplanet/ui/feedback/FeedbackListFragment.kt +++ b/app/src/main/java/org/ole/planet/myplanet/ui/feedback/FeedbackListFragment.kt @@ -14,6 +14,7 @@ import org.ole.planet.myplanet.model.RealmFeedback import org.ole.planet.myplanet.model.RealmUserModel import org.ole.planet.myplanet.service.UserProfileDbHandler import org.ole.planet.myplanet.ui.feedback.FeedbackFragment.OnFeedbackSubmittedListener +import org.ole.planet.myplanet.base.BaseRecyclerFragment.Companion.showNoData class FeedbackListFragment : Fragment(), OnFeedbackSubmittedListener { private lateinit var fragmentFeedbackListBinding: FragmentFeedbackListBinding @@ -25,6 +26,7 @@ class FeedbackListFragment : Fragment(), OnFeedbackSubmittedListener { fragmentFeedbackListBinding = FragmentFeedbackListBinding.inflate(inflater, container, false) mRealm = DatabaseService(requireActivity()).realmInstance userModel = UserProfileDbHandler(requireContext()).userModel + fragmentFeedbackListBinding.fab.setOnClickListener { val feedbackFragment = FeedbackFragment() feedbackFragment.setOnFeedbackSubmittedListener(this) @@ -33,15 +35,13 @@ class FeedbackListFragment : Fragment(), OnFeedbackSubmittedListener { } } - mRealm.executeTransactionAsync( - Realm.Transaction { }, - Realm.Transaction.OnSuccess { - feedbackList = mRealm.where(RealmFeedback::class.java) - .equalTo("owner", userModel?.name).findAllAsync() - feedbackList?.addChangeListener { results -> - updatedFeedbackList(results) - } - }) + feedbackList = mRealm.where(RealmFeedback::class.java) + .equalTo("owner", userModel?.name).findAllAsync() + + feedbackList?.addChangeListener { results -> + updatedFeedbackList(results) + } + return fragmentFeedbackListBinding.root } @@ -53,6 +53,11 @@ class FeedbackListFragment : Fragment(), OnFeedbackSubmittedListener { if (userModel?.isManager() == true) list = mRealm.where(RealmFeedback::class.java).findAll() val adapterFeedback = AdapterFeedback(requireActivity(), list) fragmentFeedbackListBinding.rvFeedback.adapter = adapterFeedback + + val itemCount = feedbackList?.size ?: 0 + showNoData(fragmentFeedbackListBinding.tvMessage, itemCount, "feedback") + + updateTextViewsVisibility(itemCount) } override fun onDestroy() { @@ -74,11 +79,25 @@ class FeedbackListFragment : Fragment(), OnFeedbackSubmittedListener { updatedFeedbackList(updatedList) }) } + private fun updatedFeedbackList(updatedList: RealmResults?) { activity?.runOnUiThread { val adapterFeedback = updatedList?.let { AdapterFeedback(requireActivity(), it) } fragmentFeedbackListBinding.rvFeedback.adapter = adapterFeedback adapterFeedback?.notifyDataSetChanged() + + val itemCount = updatedList?.size ?: 0 + showNoData(fragmentFeedbackListBinding.tvMessage, itemCount, "feedback") + updateTextViewsVisibility(itemCount) } } + + private fun updateTextViewsVisibility(itemCount: Int) { + val visibility = if (itemCount == 0) View.GONE else View.VISIBLE + fragmentFeedbackListBinding.tvTitle.visibility = visibility + fragmentFeedbackListBinding.tvType.visibility = visibility + fragmentFeedbackListBinding.tvPriority.visibility = visibility + fragmentFeedbackListBinding.tvStatus.visibility = visibility + fragmentFeedbackListBinding.tvOpenDate.visibility = visibility + } } diff --git a/app/src/main/res/layout/fragment_feedback_list.xml b/app/src/main/res/layout/fragment_feedback_list.xml index b430b2fde6..a566f95885 100644 --- a/app/src/main/res/layout/fragment_feedback_list.xml +++ b/app/src/main/res/layout/fragment_feedback_list.xml @@ -22,7 +22,6 @@ android:layout_width="match_parent" android:layout_height="wrap_content"> - - - - \ No newline at end of file + + diff --git a/app/src/main/res/values-ar/strings.xml b/app/src/main/res/values-ar/strings.xml index 228ad83a45..1ff4fea205 100644 --- a/app/src/main/res/values-ar/strings.xml +++ b/app/src/main/res/values-ar/strings.xml @@ -1051,6 +1051,7 @@ كوكب %s التقديمات غير متاحة لا توجد محادثات سابقة + لا توجد تعليقات متاحة %s diff --git a/app/src/main/res/values-es/strings.xml b/app/src/main/res/values-es/strings.xml index 47d2cb2eec..cc2c828a20 100644 --- a/app/src/main/res/values-es/strings.xml +++ b/app/src/main/res/values-es/strings.xml @@ -1051,6 +1051,7 @@ %s Planeta envíos no disponibles no hay chats anteriores + No hay comentarios aquí %s diff --git a/app/src/main/res/values-fr/strings.xml b/app/src/main/res/values-fr/strings.xml index 1c26669b65..e9f31a26a5 100644 --- a/app/src/main/res/values-fr/strings.xml +++ b/app/src/main/res/values-fr/strings.xml @@ -1051,6 +1051,7 @@ %s planète soumissions non disponibles aucune discussion précédente + aucun commentaire disponible %s diff --git a/app/src/main/res/values-ne/strings.xml b/app/src/main/res/values-ne/strings.xml index c75d0b674e..fe2a646d67 100644 --- a/app/src/main/res/values-ne/strings.xml +++ b/app/src/main/res/values-ne/strings.xml @@ -1046,11 +1046,11 @@ सर्भर जाँच गर्दै एप संस्करण अनुमत संस्करणभन्दा कम छ। कृपया अनुप्रयोगलाई नवीनतम संस्करणमा अद्यावधिक गर्नुहोस्। नोट थप्नुहोस् (वैकल्पिक) - %s (%d %s) टोलीहरू उपलब्ध छैनन् %s ग्रह पेशाहरू उपलब्ध छैनन् अघिल्ला कुराकानीहरू छैनन् + कुनै प्रतिक्रिया उपलब्ध छैन %s diff --git a/app/src/main/res/values-so/strings.xml b/app/src/main/res/values-so/strings.xml index 38c3ada43d..ccedfc34df 100644 --- a/app/src/main/res/values-so/strings.xml +++ b/app/src/main/res/values-so/strings.xml @@ -1051,6 +1051,7 @@ %s Meerah soo gudbin lama heli karo ma jiraan wada sheekaysi hore + wax jawaab celin ah lama hayo %s diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 599bfa36ff..f35f36b6e2 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -1051,6 +1051,7 @@ %s\'s Planet submissions not available no previous chats + no feedback available %s