Loading app/src/main/java/at/bitfire/davdroid/ui/DebugInfoActivity.kt +7 −2 Original line number Diff line number Diff line Loading @@ -145,6 +145,7 @@ class DebugInfoActivity: AppCompatActivity() { setOnClickListener { shareArchive() } isEnabled = true } binding.zipShare.setOnClickListener { shareArchive() } }) model.logFile.observe(this, { logs -> Loading Loading @@ -183,6 +184,7 @@ class DebugInfoActivity: AppCompatActivity() { val remoteResource = MutableLiveData<String>() val debugInfo = MutableLiveData<File>() val zipProgress = MutableLiveData<Boolean>(false) val zipFile = MutableLiveData<File>() // private storage, not readable by others Loading Loading @@ -473,11 +475,13 @@ class DebugInfoActivity: AppCompatActivity() { debugInfo.postValue(debugInfoFile) } fun generateZip(callback: (File) -> Unit) { fun generateZip(onSuccess: (File) -> Unit) { val context = getApplication<Application>() viewModelScope.launch(Dispatchers.IO) { try { zipProgress.postValue(true) val zipFile = File(debugInfoDir, "davx5-debug.zip") Logger.log.fine("Writing debug info to ${zipFile.absolutePath}") ZipOutputStream(zipFile.outputStream().buffered()).use { zip -> Loading @@ -501,13 +505,14 @@ class DebugInfoActivity: AppCompatActivity() { } withContext(Dispatchers.Main) { callback(zipFile) onSuccess(zipFile) } } catch(e: IOException) { // creating attachment with debug info failed Logger.log.log(Level.SEVERE, "Couldn't attach debug info", e) Toast.makeText(context, e.toString(), Toast.LENGTH_LONG).show() } zipProgress.postValue(false) } } Loading app/src/main/res/layout/activity_debug_info.xml +94 −10 Original line number Diff line number Diff line Loading @@ -41,17 +41,102 @@ android:visibility="@{model.debugInfo == null ? View.VISIBLE : View.GONE}" tools:visibility="visible" /> <TextView <com.google.android.material.card.MaterialCardView android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginTop="8dp" style="@style/TextAppearance.MaterialComponents.Body1" app:drawableStartCompat="@drawable/ic_share" app:drawableLeftCompat="@drawable/ic_share" android:drawablePadding="8dp" android:layout_marginBottom="8dp" app:drawableTint="?attr/colorControlNormal" android:text="@string/debug_info_use_share1"/> android:visibility="@{model.debugInfo != null ? View.VISIBLE : View.GONE}"> <androidx.constraintlayout.widget.ConstraintLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginBottom="@dimen/card_padding"> <androidx.constraintlayout.widget.Guideline android:id="@+id/zipStart" android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation="vertical" app:layout_constraintGuide_begin="@dimen/card_padding" /> <androidx.constraintlayout.widget.Guideline android:id="@+id/zipEnd" android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation="vertical" app:layout_constraintGuide_end="@dimen/card_padding" /> <ProgressBar android:id="@+id/zipProgress" android:layout_width="match_parent" android:layout_height="wrap_content" app:layout_constraintTop_toTopOf="parent" app:layout_constraintLeft_toLeftOf="parent" app:layout_constraintRight_toRightOf="parent" android:indeterminate="true" style="@style/Widget.AppCompat.ProgressBar.Horizontal" android:visibility="@{model.zipProgress ? View.VISIBLE : View.GONE}" tools:visibility="visible" /> <ImageView android:id="@+id/zipIcon" android:layout_width="44dp" android:layout_height="0dp" android:paddingEnd="12dp" android:layout_marginTop="@dimen/card_margin_title_text" app:layout_constraintTop_toBottomOf="@id/zipProgress" app:layout_constraintLeft_toLeftOf="@id/zipStart" app:layout_constraintRight_toLeftOf="@id/zipCaption" app:layout_constraintBottom_toBottomOf="@id/zipSubtitle" android:src="@drawable/ic_share" /> <TextView android:id="@+id/zipCaption" android:layout_width="0dp" android:layout_height="wrap_content" app:layout_constraintLeft_toRightOf="@id/zipIcon" app:layout_constraintTop_toTopOf="@id/zipIcon" app:layout_constraintRight_toRightOf="@id/zipEnd" app:layout_constraintBottom_toTopOf="@id/zipSubtitle" style="@style/TextAppearance.MaterialComponents.Headline6" android:text="@string/debug_info_archive_caption" /> <TextView android:id="@+id/zipSubtitle" android:layout_width="0dp" android:layout_height="wrap_content" app:layout_constraintLeft_toRightOf="@id/zipIcon" app:layout_constraintTop_toBottomOf="@id/zipCaption" app:layout_constraintRight_toRightOf="@id/zipEnd" app:layout_constraintBottom_toTopOf="@id/zipText" style="@style/TextAppearance.MaterialComponents.Subtitle1" android:text="@string/debug_info_archive_subtitle" /> <TextView android:id="@+id/zipText" android:layout_width="0dp" android:layout_height="wrap_content" app:layout_constraintTop_toBottomOf="@id/zipSubtitle" app:layout_constraintLeft_toLeftOf="@id/zipStart" app:layout_constraintRight_toRightOf="@id/zipEnd" android:layout_marginTop="@dimen/card_margin_title_text" style="@style/TextAppearance.MaterialComponents.Body1" android:text="@string/debug_info_archive_text"/> <com.google.android.material.button.MaterialButton android:id="@+id/zipShare" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginTop="@dimen/card_margin_title_text" app:layout_constraintTop_toBottomOf="@id/zipText" app:layout_constraintLeft_toLeftOf="@id/zipStart" app:layout_constraintBottom_toBottomOf="parent" style="@style/Widget.MaterialComponents.Button.TextButton" android:enabled="@{model.debugInfo != null && !model.zipProgress}" android:text="@string/debug_info_archive_share" /> </androidx.constraintlayout.widget.ConstraintLayout> </com.google.android.material.card.MaterialCardView> <com.google.android.material.card.MaterialCardView android:layout_width="match_parent" Loading Loading @@ -165,7 +250,6 @@ android:layout_marginBottom="@dimen/card_padding" android:orientation="vertical"> <androidx.constraintlayout.widget.Guideline android:id="@+id/debugInfoStart" android:layout_width="wrap_content" Loading Loading @@ -405,7 +489,7 @@ android:layout_gravity="bottom|right" android:layout_margin="@dimen/fab_margin" android:contentDescription="@string/share" android:enabled="false" android:enabled="@{model.debugInfo != null && !model.zipProgress}" android:src="@drawable/ic_share"/> </androidx.coordinatorlayout.widget.CoordinatorLayout> Loading app/src/main/res/values/strings.xml +4 −1 Original line number Diff line number Diff line Loading @@ -391,7 +391,10 @@ <!-- debugging and DebugInfoActivity --> <string name="authority_debug_provider" translatable="false">at.bitfire.davdroid.debug</string> <string name="debug_info_title">Debug info</string> <string name="debug_info_use_share1">Use the Share action to send the unmodified data, especially for support requests.</string> <string name="debug_info_archive_caption">ZIP archive</string> <string name="debug_info_archive_subtitle">Contains debug info and logs</string> <string name="debug_info_archive_text">Share the archive to transfer it to a computer, to send it by email or to attach it to a support ticket.</string> <string name="debug_info_archive_share">Share archive</string> <string name="debug_info_attached">Debug info attached to this message (requires attachment support of the receiving app).</string> <string name="debug_info_http_error">HTTP Error</string> <string name="debug_info_server_error">Server Error</string> Loading Loading
app/src/main/java/at/bitfire/davdroid/ui/DebugInfoActivity.kt +7 −2 Original line number Diff line number Diff line Loading @@ -145,6 +145,7 @@ class DebugInfoActivity: AppCompatActivity() { setOnClickListener { shareArchive() } isEnabled = true } binding.zipShare.setOnClickListener { shareArchive() } }) model.logFile.observe(this, { logs -> Loading Loading @@ -183,6 +184,7 @@ class DebugInfoActivity: AppCompatActivity() { val remoteResource = MutableLiveData<String>() val debugInfo = MutableLiveData<File>() val zipProgress = MutableLiveData<Boolean>(false) val zipFile = MutableLiveData<File>() // private storage, not readable by others Loading Loading @@ -473,11 +475,13 @@ class DebugInfoActivity: AppCompatActivity() { debugInfo.postValue(debugInfoFile) } fun generateZip(callback: (File) -> Unit) { fun generateZip(onSuccess: (File) -> Unit) { val context = getApplication<Application>() viewModelScope.launch(Dispatchers.IO) { try { zipProgress.postValue(true) val zipFile = File(debugInfoDir, "davx5-debug.zip") Logger.log.fine("Writing debug info to ${zipFile.absolutePath}") ZipOutputStream(zipFile.outputStream().buffered()).use { zip -> Loading @@ -501,13 +505,14 @@ class DebugInfoActivity: AppCompatActivity() { } withContext(Dispatchers.Main) { callback(zipFile) onSuccess(zipFile) } } catch(e: IOException) { // creating attachment with debug info failed Logger.log.log(Level.SEVERE, "Couldn't attach debug info", e) Toast.makeText(context, e.toString(), Toast.LENGTH_LONG).show() } zipProgress.postValue(false) } } Loading
app/src/main/res/layout/activity_debug_info.xml +94 −10 Original line number Diff line number Diff line Loading @@ -41,17 +41,102 @@ android:visibility="@{model.debugInfo == null ? View.VISIBLE : View.GONE}" tools:visibility="visible" /> <TextView <com.google.android.material.card.MaterialCardView android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginTop="8dp" style="@style/TextAppearance.MaterialComponents.Body1" app:drawableStartCompat="@drawable/ic_share" app:drawableLeftCompat="@drawable/ic_share" android:drawablePadding="8dp" android:layout_marginBottom="8dp" app:drawableTint="?attr/colorControlNormal" android:text="@string/debug_info_use_share1"/> android:visibility="@{model.debugInfo != null ? View.VISIBLE : View.GONE}"> <androidx.constraintlayout.widget.ConstraintLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginBottom="@dimen/card_padding"> <androidx.constraintlayout.widget.Guideline android:id="@+id/zipStart" android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation="vertical" app:layout_constraintGuide_begin="@dimen/card_padding" /> <androidx.constraintlayout.widget.Guideline android:id="@+id/zipEnd" android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation="vertical" app:layout_constraintGuide_end="@dimen/card_padding" /> <ProgressBar android:id="@+id/zipProgress" android:layout_width="match_parent" android:layout_height="wrap_content" app:layout_constraintTop_toTopOf="parent" app:layout_constraintLeft_toLeftOf="parent" app:layout_constraintRight_toRightOf="parent" android:indeterminate="true" style="@style/Widget.AppCompat.ProgressBar.Horizontal" android:visibility="@{model.zipProgress ? View.VISIBLE : View.GONE}" tools:visibility="visible" /> <ImageView android:id="@+id/zipIcon" android:layout_width="44dp" android:layout_height="0dp" android:paddingEnd="12dp" android:layout_marginTop="@dimen/card_margin_title_text" app:layout_constraintTop_toBottomOf="@id/zipProgress" app:layout_constraintLeft_toLeftOf="@id/zipStart" app:layout_constraintRight_toLeftOf="@id/zipCaption" app:layout_constraintBottom_toBottomOf="@id/zipSubtitle" android:src="@drawable/ic_share" /> <TextView android:id="@+id/zipCaption" android:layout_width="0dp" android:layout_height="wrap_content" app:layout_constraintLeft_toRightOf="@id/zipIcon" app:layout_constraintTop_toTopOf="@id/zipIcon" app:layout_constraintRight_toRightOf="@id/zipEnd" app:layout_constraintBottom_toTopOf="@id/zipSubtitle" style="@style/TextAppearance.MaterialComponents.Headline6" android:text="@string/debug_info_archive_caption" /> <TextView android:id="@+id/zipSubtitle" android:layout_width="0dp" android:layout_height="wrap_content" app:layout_constraintLeft_toRightOf="@id/zipIcon" app:layout_constraintTop_toBottomOf="@id/zipCaption" app:layout_constraintRight_toRightOf="@id/zipEnd" app:layout_constraintBottom_toTopOf="@id/zipText" style="@style/TextAppearance.MaterialComponents.Subtitle1" android:text="@string/debug_info_archive_subtitle" /> <TextView android:id="@+id/zipText" android:layout_width="0dp" android:layout_height="wrap_content" app:layout_constraintTop_toBottomOf="@id/zipSubtitle" app:layout_constraintLeft_toLeftOf="@id/zipStart" app:layout_constraintRight_toRightOf="@id/zipEnd" android:layout_marginTop="@dimen/card_margin_title_text" style="@style/TextAppearance.MaterialComponents.Body1" android:text="@string/debug_info_archive_text"/> <com.google.android.material.button.MaterialButton android:id="@+id/zipShare" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginTop="@dimen/card_margin_title_text" app:layout_constraintTop_toBottomOf="@id/zipText" app:layout_constraintLeft_toLeftOf="@id/zipStart" app:layout_constraintBottom_toBottomOf="parent" style="@style/Widget.MaterialComponents.Button.TextButton" android:enabled="@{model.debugInfo != null && !model.zipProgress}" android:text="@string/debug_info_archive_share" /> </androidx.constraintlayout.widget.ConstraintLayout> </com.google.android.material.card.MaterialCardView> <com.google.android.material.card.MaterialCardView android:layout_width="match_parent" Loading Loading @@ -165,7 +250,6 @@ android:layout_marginBottom="@dimen/card_padding" android:orientation="vertical"> <androidx.constraintlayout.widget.Guideline android:id="@+id/debugInfoStart" android:layout_width="wrap_content" Loading Loading @@ -405,7 +489,7 @@ android:layout_gravity="bottom|right" android:layout_margin="@dimen/fab_margin" android:contentDescription="@string/share" android:enabled="false" android:enabled="@{model.debugInfo != null && !model.zipProgress}" android:src="@drawable/ic_share"/> </androidx.coordinatorlayout.widget.CoordinatorLayout> Loading
app/src/main/res/values/strings.xml +4 −1 Original line number Diff line number Diff line Loading @@ -391,7 +391,10 @@ <!-- debugging and DebugInfoActivity --> <string name="authority_debug_provider" translatable="false">at.bitfire.davdroid.debug</string> <string name="debug_info_title">Debug info</string> <string name="debug_info_use_share1">Use the Share action to send the unmodified data, especially for support requests.</string> <string name="debug_info_archive_caption">ZIP archive</string> <string name="debug_info_archive_subtitle">Contains debug info and logs</string> <string name="debug_info_archive_text">Share the archive to transfer it to a computer, to send it by email or to attach it to a support ticket.</string> <string name="debug_info_archive_share">Share archive</string> <string name="debug_info_attached">Debug info attached to this message (requires attachment support of the receiving app).</string> <string name="debug_info_http_error">HTTP Error</string> <string name="debug_info_server_error">Server Error</string> Loading