Skip to content

Tourbook export broken for android 16 api 36#506

Merged
chrgernoe merged 4 commits into
masterfrom
502-tourbook-export-broken-for-android-16-api-36
Apr 13, 2026
Merged

Tourbook export broken for android 16 api 36#506
chrgernoe merged 4 commits into
masterfrom
502-tourbook-export-broken-for-android-16-api-36

Conversation

@chrgernoe

Copy link
Copy Markdown
Member

Fixes #502

@chrgernoe chrgernoe requested a review from paetz March 20, 2026 11:07
@chrgernoe chrgernoe linked an issue Mar 20, 2026 that may be closed by this pull request
@chrgernoe chrgernoe force-pushed the 502-tourbook-export-broken-for-android-16-api-36 branch from 3b1af95 to 2169e25 Compare March 20, 2026 11:23
@chrgernoe chrgernoe force-pushed the 502-tourbook-export-broken-for-android-16-api-36 branch from 2169e25 to a3641f4 Compare March 24, 2026 22:47
CSVPrinter(writer, csvFormat).apply {
_db.getAscends().forEach {
printRecord(TourbookEntryVerbose(it, _db).values())
withContext(Dispatchers.IO) {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this necessary here? Isn't this block only collecting the data while writeStrToUri() does the actual IO work that should be suspended?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The main IO load comes from the database request at this point. Therefore, it is required.

In general, we should define all database functions suspendable. This implementation is only a local fix.

import androidx.fragment.app.DialogFragment
import com.yacgroup.yacguide.databinding.ProgressDialogBinding

class ProgressDialog(private val _text: String?) : DialogFragment() {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about passing a non-nullable value with default argument ""?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fine for me. Is there a specific reason why you prefer an empty string over the null string implementation?

setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)
}
// Prevent closing the dialog when clicking outside
isCancelable = false

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am missing a timeout here after which an error should be thrown if not finished yet.

@chrgernoe chrgernoe Apr 10, 2026

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is now implemented inside the TourbookActivity.

@chrgernoe chrgernoe requested a review from paetz April 12, 2026 22:07

<!-- Timing constants in milliseconds -->
<integer name="popup_duration">5000</integer>
<integer name="tourbook_import_export_timeout">30000</integer>

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doing the database access at the IO thread seems to be slower than on the main thread, even though doing this on the IO thread is the right approach to not block the UI.
I have to understand the actual reason but independent of this there is a "N+1 query" inside the TourbookEntryVerbose class, that needs to be addressed first (see #509).

@chrgernoe chrgernoe force-pushed the 502-tourbook-export-broken-for-android-16-api-36 branch from 993beeb to 07b6419 Compare April 12, 2026 22:34
@chrgernoe chrgernoe merged commit b354a51 into master Apr 13, 2026
6 checks passed
@chrgernoe chrgernoe deleted the 502-tourbook-export-broken-for-android-16-api-36 branch April 13, 2026 22:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Tourbook export broken for Android 16 (API 36)

2 participants