diff --git a/.idea/codestream.xml b/.idea/codestream.xml index da00257..6f5a8ab 100644 --- a/.idea/codestream.xml +++ b/.idea/codestream.xml @@ -2,6 +2,6 @@ \ No newline at end of file diff --git a/app/src/main/java/com/kyhsgeekcode/dereinfo/SongListActivity.kt b/app/src/main/java/com/kyhsgeekcode/dereinfo/SongListActivity.kt index 9f36e2e..cd10477 100644 --- a/app/src/main/java/com/kyhsgeekcode/dereinfo/SongListActivity.kt +++ b/app/src/main/java/com/kyhsgeekcode/dereinfo/SongListActivity.kt @@ -65,10 +65,11 @@ class SongListActivity : AppCompatActivity() { } val publisher: (Int, Int, MusicInfo?) -> Unit = { total, progress, info -> CoroutineScope(Dispatchers.Main).launch { - circularType.setProgressMax(total) + val progress100 = progress.toDouble()/total.toDouble() * 100.0 + circularType.setProgressMax(100) if (info != null) adapter.addItem(info) - snackProgressBarManager.setProgress(progress) + snackProgressBarManager.setProgress(progress100.toInt()) } } val onFinish: () -> Unit = { diff --git a/app/src/main/java/com/kyhsgeekcode/dereinfo/model/DereDatabaseHelper.kt b/app/src/main/java/com/kyhsgeekcode/dereinfo/model/DereDatabaseHelper.kt index 5955157..244e6fa 100644 --- a/app/src/main/java/com/kyhsgeekcode/dereinfo/model/DereDatabaseHelper.kt +++ b/app/src/main/java/com/kyhsgeekcode/dereinfo/model/DereDatabaseHelper.kt @@ -138,14 +138,14 @@ class DereDatabaseHelper(context: Context) { ) musicIDToInfo[musicDataId] = musicInfo currentCount++ - publisher(currentCount, totalCount, musicInfo) + publisher(totalCount, currentCount, musicInfo) } cursorLiveData.close() fumensDB.close() } var musicNumberToFumenFile: MutableMap = HashMap() - suspend fun indexFumens(publisher: (Int, Int, MusicInfo?) -> Unit) { + fun indexFumens(publisher: (Int, Int, MusicInfo?) -> Unit) { var cursorFumens: Cursor? = null val fileList = fumenFolder.listFiles() for (fileWithIndex in fileList.withIndex()) { @@ -262,9 +262,12 @@ class DereDatabaseHelper(context: Context) { publisher(musicIDToInfo.size, musicInfo.index, musicInfo.value) } } else { + //publisher(100,0,null) parseDatabases(publisher) indexFumens(publisher) + publisher(100,50,null) saveToCache(context) + publisher(100,100,null) } Log.d(TAG, "size of databases:${musicIDToInfo.size}") Log.d(TAG, "Number of fumens:${musicNumberToFumenFile.size}")