show a loading progress bar at first app load

This commit is contained in:
tibbi 2023-01-12 16:18:14 +01:00
parent 37f1f807f6
commit 63dedaa9b7
2 changed files with 18 additions and 0 deletions

View File

@ -114,6 +114,8 @@ class MainActivity : SimpleActivity() {
no_conversations_placeholder_2.setTextColor(properPrimaryColor) no_conversations_placeholder_2.setTextColor(properPrimaryColor)
no_conversations_placeholder_2.underlineText() no_conversations_placeholder_2.underlineText()
conversations_fastscroller.updateColors(properPrimaryColor) conversations_fastscroller.updateColors(properPrimaryColor)
conversations_progress_bar.setIndicatorColor(properPrimaryColor)
conversations_progress_bar.trackColor = properPrimaryColor.adjustAlpha(LOWER_ALPHA)
checkShortcut() checkShortcut()
(conversations_fab?.layoutParams as? CoordinatorLayout.LayoutParams)?.bottomMargin = (conversations_fab?.layoutParams as? CoordinatorLayout.LayoutParams)?.bottomMargin =
navigationBarHeight + resources.getDimension(R.dimen.activity_margin).toInt() navigationBarHeight + resources.getDimension(R.dimen.activity_margin).toInt()
@ -361,6 +363,9 @@ class MainActivity : SimpleActivity() {
if (!hasConversations && config.appRunCount == 1) { if (!hasConversations && config.appRunCount == 1) {
no_conversations_placeholder.text = getString(R.string.loading_messages) no_conversations_placeholder.text = getString(R.string.loading_messages)
no_conversations_placeholder_2.beGone() no_conversations_placeholder_2.beGone()
conversations_progress_bar.beVisible()
} else {
conversations_progress_bar.beGone()
} }
try { try {

View File

@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android" <androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/main_coordinator" android:id="@+id/main_coordinator"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent"> android:layout_height="match_parent">
@ -28,6 +29,18 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent"> android:layout_height="match_parent">
<com.google.android.material.progressindicator.LinearProgressIndicator
android:id="@+id/conversations_progress_bar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:indeterminate="true"
android:visibility="gone"
app:hideAnimationBehavior="outward"
app:showAnimationBehavior="inward"
app:showDelay="250"
tools:visibility="visible" />
<com.simplemobiletools.commons.views.MyTextView <com.simplemobiletools.commons.views.MyTextView
android:id="@+id/no_conversations_placeholder" android:id="@+id/no_conversations_placeholder"
android:layout_width="match_parent" android:layout_width="match_parent"