Tourbook export broken for android 16 api 36#506
Conversation
3b1af95 to
2169e25
Compare
2169e25 to
a3641f4
Compare
| CSVPrinter(writer, csvFormat).apply { | ||
| _db.getAscends().forEach { | ||
| printRecord(TourbookEntryVerbose(it, _db).values()) | ||
| withContext(Dispatchers.IO) { |
There was a problem hiding this comment.
Why is this necessary here? Isn't this block only collecting the data while writeStrToUri() does the actual IO work that should be suspended?
There was a problem hiding this comment.
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() { |
There was a problem hiding this comment.
How about passing a non-nullable value with default argument ""?
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
I am missing a timeout here after which an error should be thrown if not finished yet.
There was a problem hiding this comment.
It is now implemented inside the TourbookActivity.
|
|
||
| <!-- Timing constants in milliseconds --> | ||
| <integer name="popup_duration">5000</integer> | ||
| <integer name="tourbook_import_export_timeout">30000</integer> |
There was a problem hiding this comment.
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).
993beeb to
07b6419
Compare
Fixes #502