mirror of
https://github.com/jamessanford/kegs.git
synced 2025-01-07 22:32:56 +00:00
Better user experience, force filesystem sync before starting.
We write a large file to disk and then go to read it back. This was causing a multi second delay in the UI until the data had been flushed to disk. Now, we call sync() before claiming that the assets are ready to be used.
This commit is contained in:
parent
973d9c1422
commit
5f3f8e3b33
@ -262,6 +262,12 @@ void android_config_init(char *output, int maxlen) {
|
||||
(*g_env)->DeleteLocalRef(g_env, config_path);
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_com_froop_app_kegs_AssetImages_nativeSync( JNIEnv* env, jobject thiz) {
|
||||
sync();
|
||||
sync();
|
||||
}
|
||||
|
||||
// Instead of 'KegsView$KegsThread', the $ is encoded as _00024.
|
||||
// (not any more, but it was KegsView_00024KegsThread_mainLoop)
|
||||
JNIEXPORT void JNICALL
|
||||
|
@ -46,6 +46,7 @@ class AssetImages extends AsyncTask<Void, Void, Boolean> {
|
||||
mConfigFile.ensureAssetCopied(mConfigFile.getImagePath(),
|
||||
"System 6 Shareware.zip", "System 6.hdv");
|
||||
// TODO: could check to make sure they actually exist now.
|
||||
nativeSync();
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -56,4 +57,7 @@ class AssetImages extends AsyncTask<Void, Void, Boolean> {
|
||||
protected void onPostExecute(final Boolean result) {
|
||||
mNotify.onAssetsReady(result);
|
||||
}
|
||||
|
||||
// See jni/android_driver.c:nativeSync()
|
||||
private native void nativeSync();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user