Lazily load bottom info views in MainActivity

This commit is contained in:
Moez Bhatti
2018-09-22 05:35:20 -04:00
parent 1cf975bc26
commit 67cf4521a6
5 changed files with 158 additions and 101 deletions
@@ -107,99 +107,22 @@
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="?android:attr/divider"
app:layout_constraintBottom_toTopOf="@id/bottomDivider" />
app:layout_constraintBottom_toTopOf="@id/snackbar" />
<androidx.constraintlayout.widget.Barrier
android:id="@+id/bottomDivider"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:barrierDirection="top"
app:constraint_referenced_ids="snackbarTitle, snackbarMessage, syncingLabel, syncingProgress" />
<androidx.constraintlayout.widget.Group
<ViewStub
android:id="@+id/snackbar"
android:layout_width="wrap_content"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:visibility="gone"
app:constraint_referenced_ids="snackbarTitle, snackbarMessage, snackbarButton"
tools:visibility="visible" />
android:inflatedId="@id/snackbar"
android:layout="@layout/main_permission_hint"
app:layout_constraintBottom_toTopOf="@id/syncing" />
<androidx.constraintlayout.widget.Group
<ViewStub
android:id="@+id/syncing"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:visibility="gone"
app:constraint_referenced_ids="syncingProgress,syncingLabel"
tools:visibility="gone" />
<com.moez.QKSMS.common.widget.QkTextView
android:id="@+id/snackbarTitle"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:paddingTop="16dp"
android:textStyle="bold"
app:layout_constraintBottom_toTopOf="@id/snackbarMessage"
app:layout_constraintEnd_toStartOf="@id/snackbarButton"
app:layout_constraintHorizontal_bias="0"
app:layout_constraintStart_toStartOf="parent"
app:textColor="primary"
app:textSize="primary"
tools:text="Love texting again" />
<com.moez.QKSMS.common.widget.QkTextView
android:id="@+id/snackbarMessage"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="2dp"
android:paddingBottom="16dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@id/snackbarButton"
app:layout_constraintHorizontal_bias="0"
app:layout_constraintStart_toStartOf="parent"
app:textColor="secondary"
app:textSize="secondary"
tools:text="Make QKSMS your default SMS app" />
<com.moez.QKSMS.common.widget.QkTextView
android:id="@+id/snackbarButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="8dp"
android:background="?attr/selectableItemBackground"
android:padding="16dp"
android:textAllCaps="true"
android:textColor="@color/tools_theme"
android:textStyle="bold"
app:layout_constraintBottom_toBottomOf="@id/snackbarMessage"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="@id/snackbarTitle"
app:textColor="theme"
app:textSize="secondary"
tools:text="Change" />
<com.moez.QKSMS.common.widget.QkTextView
android:id="@+id/syncingLabel"
style="@style/TextPrimary"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginEnd="16dp"
android:layout_marginStart="16dp"
android:paddingTop="16dp"
android:text="@string/main_syncing"
android:textStyle="bold"
app:layout_constraintBottom_toTopOf="@id/syncingProgress" />
<ProgressBar
android:id="@+id/syncingProgress"
style="@style/Widget.AppCompat.ProgressBar.Horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="16dp"
android:layout_marginEnd="16dp"
android:layout_marginStart="16dp"
android:indeterminate="true"
android:inflatedId="@id/syncing"
android:layout="@layout/main_syncing"
app:layout_constraintBottom_toBottomOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
@@ -0,0 +1,73 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Copyright (C) 2017 Moez Bhatti <moez.bhatti@gmail.com>
~
~ This file is part of QKSMS.
~
~ QKSMS is free software: you can redistribute it and/or modify
~ it under the terms of the GNU General Public License as published by
~ the Free Software Foundation, either version 3 of the License, or
~ (at your option) any later version.
~
~ QKSMS is distributed in the hope that it will be useful,
~ but WITHOUT ANY WARRANTY; without even the implied warranty of
~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
~ GNU General Public License for more details.
~
~ You should have received a copy of the GNU General Public License
~ along with QKSMS. If not, see <http://www.gnu.org/licenses/>.
-->
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<com.moez.QKSMS.common.widget.QkTextView
android:id="@+id/snackbarTitle"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:paddingTop="16dp"
android:textStyle="bold"
app:layout_constraintBottom_toTopOf="@id/snackbarMessage"
app:layout_constraintEnd_toStartOf="@id/snackbarButton"
app:layout_constraintHorizontal_bias="0"
app:layout_constraintStart_toStartOf="parent"
app:textColor="primary"
app:textSize="primary"
tools:text="Love texting again" />
<com.moez.QKSMS.common.widget.QkTextView
android:id="@+id/snackbarMessage"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="2dp"
android:paddingBottom="16dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@id/snackbarButton"
app:layout_constraintHorizontal_bias="0"
app:layout_constraintStart_toStartOf="parent"
app:textColor="secondary"
app:textSize="secondary"
tools:text="Make QKSMS your default SMS app" />
<com.moez.QKSMS.common.widget.QkTextView
android:id="@+id/snackbarButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="8dp"
android:background="?attr/selectableItemBackground"
android:padding="16dp"
android:textAllCaps="true"
android:textColor="@color/tools_theme"
android:textStyle="bold"
app:layout_constraintBottom_toBottomOf="@id/snackbarMessage"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="@id/snackbarTitle"
app:textColor="theme"
app:textSize="secondary"
tools:text="Change" />
</androidx.constraintlayout.widget.ConstraintLayout>
@@ -0,0 +1,46 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Copyright (C) 2017 Moez Bhatti <moez.bhatti@gmail.com>
~
~ This file is part of QKSMS.
~
~ QKSMS is free software: you can redistribute it and/or modify
~ it under the terms of the GNU General Public License as published by
~ the Free Software Foundation, either version 3 of the License, or
~ (at your option) any later version.
~
~ QKSMS is distributed in the hope that it will be useful,
~ but WITHOUT ANY WARRANTY; without even the implied warranty of
~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
~ GNU General Public License for more details.
~
~ You should have received a copy of the GNU General Public License
~ along with QKSMS. If not, see <http://www.gnu.org/licenses/>.
-->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<com.moez.QKSMS.common.widget.QkTextView
android:id="@+id/syncingLabel"
style="@style/TextPrimary"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginEnd="16dp"
android:layout_marginStart="16dp"
android:paddingTop="16dp"
android:text="@string/main_syncing"
android:textStyle="bold" />
<ProgressBar
android:id="@+id/syncingProgress"
style="@style/Widget.AppCompat.ProgressBar.Horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="16dp"
android:layout_marginEnd="16dp"
android:layout_marginStart="16dp"
android:indeterminate="true" />
</LinearLayout>