Skip to content

Commit

Permalink
chats: smoother empty history (fixes #3725) (#3746)
Browse files Browse the repository at this point in the history
Co-authored-by: dogi <[email protected]>
  • Loading branch information
ewhang5 and dogi authored Jul 1, 2024
1 parent b8ff436 commit 2d1d244
Show file tree
Hide file tree
Showing 10 changed files with 26 additions and 3 deletions.
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ android {
applicationId "org.ole.planet.myplanet"
minSdkVersion 21
targetSdkVersion 34
versionCode 1639
versionName "0.16.39"
versionCode 1640
versionName "0.16.40"
ndkVersion '21.3.6528147'
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
vectorDrawables.useSupportLibrary = true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,7 @@ abstract class BaseRecyclerFragment<LI> : BaseRecyclerParentFragment<Any?>(), On
"discussions" -> (v as TextView).setText(R.string.no_news)
"survey" -> (v as TextView).setText(R.string.no_surveys)
"submission" -> (v as TextView).setText(R.string.no_submissions)
"chatHistory" -> (v as TextView).setText(R.string.no_chats)
else -> (v as TextView).setText(R.string.no_data_available_please_check_and_try_again)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import androidx.lifecycle.ViewModelProvider
import androidx.slidingpanelayout.widget.SlidingPaneLayout
import io.realm.*
import org.ole.planet.myplanet.R
import org.ole.planet.myplanet.base.BaseRecyclerFragment.Companion.showNoData
import org.ole.planet.myplanet.databinding.FragmentChatHistoryListBinding
import org.ole.planet.myplanet.datamanager.DatabaseService
import org.ole.planet.myplanet.model.*
Expand Down Expand Up @@ -67,6 +68,11 @@ class ChatHistoryListFragment : Fragment() {
filteredHistoryList.add(model)
}
}
showNoData(fragmentChatHistoryListBinding.noChats, filteredHistoryList.size, "chatHistory")
if (filteredHistoryList.isEmpty()) {
fragmentChatHistoryListBinding.searchBar.visibility = View.GONE
fragmentChatHistoryListBinding.recyclerView.visibility = View.GONE
}
val adapter = ChatHistoryListAdapter(requireContext(), list, this)
adapter.setChatHistoryItemClickListener(object : ChatHistoryListAdapter.ChatHistoryItemClickListener {
override fun onChatHistoryItemClicked(conversations: RealmList<Conversation>?, _id: String, _rev:String?) {
Expand Down
12 changes: 11 additions & 1 deletion app/src/main/res/layout/fragment_chat_history_list.xml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/newChat" />


<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recyclerView"
android:layout_width="match_parent"
Expand All @@ -55,6 +54,17 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/searchBar" />

<TextView
android:visibility="gone"
android:id="@+id/noChats"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent" />

</androidx.constraintlayout.widget.ConstraintLayout>

<androidx.fragment.app.FragmentContainerView
Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/values-ar/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1046,5 +1046,6 @@
<string name="below_min_apk">إصدار Apk أقل من المسموح. يرجى تحديث التطبيق إلى أحدث إصدار.</string>
<string name="add_note">إضافة ملاحظة (اختياري)</string>
<string name="no_submissions">التقديمات غير متاحة</string>
<string name="no_chats">لا توجد محادثات سابقة</string>

</resources>
1 change: 1 addition & 0 deletions app/src/main/res/values-es/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1046,5 +1046,6 @@
<string name="below_min_apk">la versión de la aplicación está por debajo de la permitida. Actualice la aplicación a la última versión.</string>
<string name="add_note">Agregar una nota (opcional)</string>
<string name="no_submissions">envíos no disponibles</string>
<string name="no_chats">no hay chats anteriores</string>

</resources>
1 change: 1 addition & 0 deletions app/src/main/res/values-fr/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1046,5 +1046,6 @@
<string name="below_min_apk">la version de l\'app est inférieure à celle autorisée. veuillez mettre à jour l\'application vers la dernière version.</string>
<string name="add_note">Ajouter une note (optionnel)</string>
<string name="no_submissions">soumissions non disponibles</string>
<string name="no_chats">aucune discussion précédente</string>

</resources>
1 change: 1 addition & 0 deletions app/src/main/res/values-ne/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1046,5 +1046,6 @@
<string name="below_min_apk">एप संस्करण अनुमत संस्करणभन्दा कम छ। कृपया अनुप्रयोगलाई नवीनतम संस्करणमा अद्यावधिक गर्नुहोस्।</string>
<string name="add_note">नोट थप्नुहोस् (वैकल्पिक)</string>
<string name="no_submissions">पेशाहरू उपलब्ध छैनन्</string>
<string name="no_chats">अघिल्ला कुराकानीहरू छैनन्</string>

</resources>
1 change: 1 addition & 0 deletions app/src/main/res/values-so/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1046,5 +1046,6 @@
<string name="below_min_apk">nooca app-ga waa ka hooseeyaa kan la oggol yahay. fadlan cusbooneysii app-ka nooca ugu dambeeya.</string>
<string name="add_note">Ku dar falanqeey (ixtiyaacsi ah)</string>
<string name="no_submissions">soo gudbin lama heli karo</string>
<string name="no_chats">ma jiraan wada sheekaysi hore</string>

</resources>
1 change: 1 addition & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1046,5 +1046,6 @@
<string name="below_min_apk">app is below allowed version. please update the app to the latest version.</string>
<string name="add_note">add a note (optional)</string>
<string name="no_submissions">submissions not available</string>
<string name="no_chats">no previous chats</string>

</resources>

0 comments on commit 2d1d244

Please sign in to comment.