Skip to content

Commit 63dedaa

Browse files
committed
show a loading progress bar at first app load
1 parent 37f1f80 commit 63dedaa

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

app/src/main/kotlin/com/simplemobiletools/smsmessenger/activities/MainActivity.kt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,8 @@ class MainActivity : SimpleActivity() {
114114
no_conversations_placeholder_2.setTextColor(properPrimaryColor)
115115
no_conversations_placeholder_2.underlineText()
116116
conversations_fastscroller.updateColors(properPrimaryColor)
117+
conversations_progress_bar.setIndicatorColor(properPrimaryColor)
118+
conversations_progress_bar.trackColor = properPrimaryColor.adjustAlpha(LOWER_ALPHA)
117119
checkShortcut()
118120
(conversations_fab?.layoutParams as? CoordinatorLayout.LayoutParams)?.bottomMargin =
119121
navigationBarHeight + resources.getDimension(R.dimen.activity_margin).toInt()
@@ -361,6 +363,9 @@ class MainActivity : SimpleActivity() {
361363
if (!hasConversations && config.appRunCount == 1) {
362364
no_conversations_placeholder.text = getString(R.string.loading_messages)
363365
no_conversations_placeholder_2.beGone()
366+
conversations_progress_bar.beVisible()
367+
} else {
368+
conversations_progress_bar.beGone()
364369
}
365370

366371
try {

app/src/main/res/layout/activity_main.xml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
33
xmlns:app="http://schemas.android.com/apk/res-auto"
4+
xmlns:tools="http://schemas.android.com/tools"
45
android:id="@+id/main_coordinator"
56
android:layout_width="match_parent"
67
android:layout_height="match_parent">
@@ -28,6 +29,18 @@
2829
android:layout_width="match_parent"
2930
android:layout_height="match_parent">
3031

32+
<com.google.android.material.progressindicator.LinearProgressIndicator
33+
android:id="@+id/conversations_progress_bar"
34+
android:layout_width="match_parent"
35+
android:layout_height="wrap_content"
36+
android:layout_alignParentTop="true"
37+
android:indeterminate="true"
38+
android:visibility="gone"
39+
app:hideAnimationBehavior="outward"
40+
app:showAnimationBehavior="inward"
41+
app:showDelay="250"
42+
tools:visibility="visible" />
43+
3144
<com.simplemobiletools.commons.views.MyTextView
3245
android:id="@+id/no_conversations_placeholder"
3346
android:layout_width="match_parent"

0 commit comments

Comments
 (0)