1
0
mirror of https://github.com/wulkanowy/wulkanowy.git synced 2024-11-23 03:16:48 -06:00

Fix snackbar crash in grade statistics view (#1682)

This commit is contained in:
Rafał Borcz 2021-11-25 23:48:08 +01:00 committed by GitHub
parent 10ba36ba44
commit 495e385228
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 137 additions and 139 deletions

View File

@ -123,14 +123,6 @@ class FragmentLifecycleLogger @Inject constructor() :
Timber.d("${f::class.java.simpleName} VIEW DESTROYED") Timber.d("${f::class.java.simpleName} VIEW DESTROYED")
} }
override fun onFragmentActivityCreated(
fm: FragmentManager,
f: Fragment,
savedInstanceState: Bundle?
) {
Timber.d("${f::class.java.simpleName} ACTIVITY CREATED ${savedInstanceState.checkSavedState()}")
}
override fun onFragmentPaused(fm: FragmentManager, f: Fragment) { override fun onFragmentPaused(fm: FragmentManager, f: Fragment) {
Timber.d("${f::class.java.simpleName} PAUSED") Timber.d("${f::class.java.simpleName} PAUSED")
} }
@ -141,5 +133,5 @@ class FragmentLifecycleLogger @Inject constructor() :
} }
private fun Bundle?.checkSavedState() = private fun Bundle?.checkSavedState() =
if (this == null) "(STATE IS NULL)" else "(STATE IS NOT NULL)" if (this == null) "(STATE IS NULL)" else "(RESTORE STATE)"

View File

@ -1,158 +1,164 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <FrameLayout 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" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent">
android:orientation="vertical">
<io.github.wulkanowy.ui.widgets.MaterialLinearLayout <LinearLayout
android:id="@+id/gradeStatisticsSubjectsContainer"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="match_parent"
android:background="?android:windowBackground" android:orientation="vertical"
android:padding="5dp" tools:ignore="UselessParent">
android:visibility="visible"
app:layout_constraintTop_toTopOf="parent"
tools:ignore="UnusedAttribute"
tools:listitem="@layout/item_attendance_summary"
tools:visibility="visible">
<Spinner <io.github.wulkanowy.ui.widgets.MaterialLinearLayout
android:id="@+id/gradeStatisticsSubjects" android:id="@+id/gradeStatisticsSubjectsContainer"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:ellipsize="middle" android:background="?android:windowBackground"
android:paddingStart="10dp" android:padding="5dp"
android:paddingLeft="10dp" android:visibility="visible"
android:paddingTop="10dp" app:layout_constraintTop_toTopOf="parent"
android:paddingEnd="30dp" tools:ignore="UnusedAttribute"
android:paddingRight="30dp" tools:listitem="@layout/item_attendance_summary"
android:paddingBottom="10dp" tools:visibility="visible">
android:spinnerMode="dialog" />
</io.github.wulkanowy.ui.widgets.MaterialLinearLayout>
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout <Spinner
android:id="@+id/gradeStatisticsSwipe" android:id="@+id/gradeStatisticsSubjects"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent"> android:layout_height="wrap_content"
android:ellipsize="middle"
android:paddingStart="10dp"
android:paddingLeft="10dp"
android:paddingTop="10dp"
android:paddingEnd="30dp"
android:paddingRight="30dp"
android:paddingBottom="10dp"
android:spinnerMode="dialog" />
</io.github.wulkanowy.ui.widgets.MaterialLinearLayout>
<androidx.constraintlayout.widget.ConstraintLayout <androidx.swiperefreshlayout.widget.SwipeRefreshLayout
android:id="@+id/gradeStatisticsSwipe"
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.CircularProgressIndicator <androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/gradeStatisticsProgress"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:indeterminate="true"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:visibility="gone" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/gradeStatisticsRecycler"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="match_parent">
app:layout_constraintTop_toTopOf="parent"
tools:listitem="@layout/item_grade_statistics_pie"
tools:visibility="visible" />
<androidx.core.widget.NestedScrollView <com.google.android.material.progressindicator.CircularProgressIndicator
android:layout_width="match_parent" android:id="@+id/gradeStatisticsProgress"
android:layout_height="0dp" android:layout_width="wrap_content"
android:layout_marginTop="12dp" android:layout_height="wrap_content"
android:fillViewport="true" android:indeterminate="true"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintTop_toBottomOf="@id/gradeStatisticsRecycler"> app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:visibility="gone" />
<androidx.constraintlayout.widget.ConstraintLayout <androidx.recyclerview.widget.RecyclerView
android:id="@+id/gradeStatisticsRecycler"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content"> android:layout_height="wrap_content"
app:layout_constraintTop_toTopOf="parent"
tools:listitem="@layout/item_grade_statistics_pie"
tools:visibility="visible" />
<LinearLayout <androidx.core.widget.NestedScrollView
android:id="@+id/gradeStatisticsEmpty" android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_marginTop="12dp"
android:fillViewport="true"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintTop_toBottomOf="@id/gradeStatisticsRecycler">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content">
android:gravity="center"
android:orientation="vertical"
android:visibility="invisible"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:ignore="UseCompoundDrawables"
tools:visibility="gone">
<ImageView
android:layout_width="100dp"
android:layout_height="100dp"
app:srcCompat="@drawable/ic_main_grade"
app:tint="?colorOnBackground"
tools:ignore="contentDescription" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:gravity="center"
android:text="@string/grade_no_items"
android:textSize="20sp" />
</LinearLayout>
<LinearLayout
android:id="@+id/gradeStatisticsError"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:orientation="vertical"
android:visibility="gone"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:ignore="UseCompoundDrawables"
tools:visibility="gone">
<ImageView
android:layout_width="100dp"
android:layout_height="100dp"
app:srcCompat="@drawable/ic_error"
app:tint="?colorOnBackground"
tools:ignore="contentDescription" />
<TextView
android:id="@+id/gradeStatisticsErrorMessage"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:gravity="center"
android:padding="8dp"
android:text="@string/error_unknown"
android:textSize="20sp" />
<LinearLayout <LinearLayout
android:id="@+id/gradeStatisticsEmpty"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:gravity="center" android:gravity="center"
android:orientation="horizontal"> android:orientation="vertical"
android:visibility="invisible"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:ignore="UseCompoundDrawables"
tools:visibility="gone">
<com.google.android.material.button.MaterialButton <ImageView
android:id="@+id/gradeStatisticsErrorDetails" android:layout_width="100dp"
style="@style/Widget.MaterialComponents.Button.OutlinedButton" android:layout_height="100dp"
app:srcCompat="@drawable/ic_main_grade"
app:tint="?colorOnBackground"
tools:ignore="contentDescription" />
<TextView
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginEnd="8dp" android:layout_marginTop="20dp"
android:layout_marginRight="8dp" android:gravity="center"
android:text="@string/all_details" /> android:text="@string/grade_no_items"
android:textSize="20sp" />
<com.google.android.material.button.MaterialButton
android:id="@+id/gradeStatisticsErrorRetry"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/all_retry" />
</LinearLayout> </LinearLayout>
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout> <LinearLayout
</androidx.core.widget.NestedScrollView> android:id="@+id/gradeStatisticsError"
</androidx.constraintlayout.widget.ConstraintLayout> android:layout_width="match_parent"
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout> android:layout_height="wrap_content"
</LinearLayout> android:gravity="center"
android:orientation="vertical"
android:visibility="gone"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:ignore="UseCompoundDrawables"
tools:visibility="gone">
<ImageView
android:layout_width="100dp"
android:layout_height="100dp"
app:srcCompat="@drawable/ic_error"
app:tint="?colorOnBackground"
tools:ignore="contentDescription" />
<TextView
android:id="@+id/gradeStatisticsErrorMessage"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:gravity="center"
android:padding="8dp"
android:text="@string/error_unknown"
android:textSize="20sp" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:gravity="center"
android:orientation="horizontal">
<com.google.android.material.button.MaterialButton
android:id="@+id/gradeStatisticsErrorDetails"
style="@style/Widget.MaterialComponents.Button.OutlinedButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="8dp"
android:layout_marginRight="8dp"
android:text="@string/all_details" />
<com.google.android.material.button.MaterialButton
android:id="@+id/gradeStatisticsErrorRetry"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/all_retry" />
</LinearLayout>
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.core.widget.NestedScrollView>
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
</LinearLayout>
</FrameLayout>