From 91121b14d4ed741ec50ae3e4069014a8627d38f3 Mon Sep 17 00:00:00 2001 From: Reco1l Date: Wed, 24 Apr 2024 23:46:34 -0300 Subject: [PATCH 01/22] Remove 'extensions' package and upgrade 'net' package --- build.gradle | 9 +- src/com/reco1l/api/ibancho/LobbyAPI.kt | 89 ++++---- .../reco1l/framework/{data => }/IniReader.kt | 81 +++---- src/com/reco1l/framework/data/IniException.kt | 9 - .../reco1l/framework/extensions/JsonExt.kt | 75 ------- .../reco1l/framework/extensions/KotlinExt.kt | 98 --------- src/com/reco1l/framework/extensions/LogExt.kt | 51 ----- .../reco1l/framework/extensions/StringExt.kt | 29 --- src/com/reco1l/framework/net/Downloader.kt | 202 ------------------ src/com/reco1l/framework/net/FileRequest.kt | 129 +++++++++++ .../framework/net/IDownloaderObserver.kt | 27 --- src/com/reco1l/framework/net/JsonContent.kt | 100 --------- src/com/reco1l/framework/net/JsonRequest.kt | 100 +++++++++ src/com/reco1l/framework/net/JsonRequester.kt | 78 ------- src/com/reco1l/framework/net/QueryContent.kt | 32 --- src/com/reco1l/framework/net/Requester.kt | 173 --------------- .../reco1l/framework/net/ResponseException.kt | 14 -- src/com/reco1l/framework/net/SizeMeasure.kt | 10 - src/com/reco1l/framework/net/WebRequest.kt | 151 +++++++++++++ src/com/reco1l/legacy/Multiplayer.kt | 12 +- src/com/reco1l/legacy/UpdateManager.kt | 43 ++-- src/com/reco1l/legacy/data/SkinConverter.kt | 2 +- src/com/reco1l/legacy/engine/VideoTexture.kt | 6 +- src/com/reco1l/legacy/ui/DownloadFragment.kt | 6 +- .../ui/beatmapdownloader/BeatmapDownloader.kt | 61 +++--- .../ui/beatmapdownloader/BeatmapListing.kt | 15 +- .../legacy/ui/multiplayer/LobbyRoomList.kt | 19 +- .../legacy/ui/multiplayer/LobbyScene.kt | 94 ++++---- .../reco1l/legacy/ui/multiplayer/RoomChat.kt | 12 +- .../reco1l/legacy/ui/multiplayer/RoomScene.kt | 4 +- .../rian/osu/beatmap/parser/BeatmapParser.kt | 4 +- .../nsu/ccfit/zuev/osu/ResourceManager.java | 2 +- 32 files changed, 615 insertions(+), 1122 deletions(-) rename src/com/reco1l/framework/{data => }/IniReader.kt (62%) delete mode 100644 src/com/reco1l/framework/data/IniException.kt delete mode 100644 src/com/reco1l/framework/extensions/JsonExt.kt delete mode 100644 src/com/reco1l/framework/extensions/KotlinExt.kt delete mode 100644 src/com/reco1l/framework/extensions/LogExt.kt delete mode 100644 src/com/reco1l/framework/extensions/StringExt.kt delete mode 100644 src/com/reco1l/framework/net/Downloader.kt create mode 100644 src/com/reco1l/framework/net/FileRequest.kt delete mode 100644 src/com/reco1l/framework/net/IDownloaderObserver.kt delete mode 100644 src/com/reco1l/framework/net/JsonContent.kt create mode 100644 src/com/reco1l/framework/net/JsonRequest.kt delete mode 100644 src/com/reco1l/framework/net/JsonRequester.kt delete mode 100644 src/com/reco1l/framework/net/QueryContent.kt delete mode 100644 src/com/reco1l/framework/net/Requester.kt delete mode 100644 src/com/reco1l/framework/net/ResponseException.kt delete mode 100644 src/com/reco1l/framework/net/SizeMeasure.kt create mode 100644 src/com/reco1l/framework/net/WebRequest.kt diff --git a/build.gradle b/build.gradle index 1ab80feb3..84e883cfd 100644 --- a/build.gradle +++ b/build.gradle @@ -158,6 +158,7 @@ android { dependencies { implementation project(':AndEngine') + implementation project(':LibBASS') implementation project(':andnext_markdown') implementation 'androidx.legacy:legacy-support-v4:1.0.0' implementation 'androidx.preference:preference:1.2.1' @@ -166,22 +167,18 @@ dependencies { implementation 'com.google.firebase:firebase-analytics:21.5.1' implementation 'com.google.firebase:firebase-messaging:23.4.1' - // implementation 'io.reactivex.rxjava2:rxandroid:2.1.1' - // implementation 'io.reactivex.rxjava2:rxjava:2.2.21' implementation 'com.squareup.okhttp3:okhttp:4.12.0' - // implementation 'com.squareup.retrofit2:adapter-rxjava2:2.9.0' implementation 'com.google.code.gson:gson:2.10.1' - //implementation 'com.github.tbruyelle:rxpermissions:0.12' implementation 'pub.devrel:easypermissions:3.0.0' implementation 'net.lingala.zip4j:zip4j:2.11.5' implementation 'com.github.EdrowsLuo:osudroidstrings:bd9507b289' implementation 'com.github.EdrowsLuo.EdlGameFramework:EdlJavaExt:d91c53fcff' implementation 'com.github.EdrowsLuo.EdlGameFramework:EdlOsbSupport:d91c53fcff' - implementation project(path: ':LibBASS') + // Tools + implementation 'com.github.Reco1I:Toolkt:1.1.9' implementation 'commons-io:commons-io:2.15.1' - implementation 'com.github.delight-im:Android-AdvancedWebView:v3.2.1' // Multiplayer implementation('org.jetbrains.kotlinx:kotlinx-coroutines-core:1.7.3') diff --git a/src/com/reco1l/api/ibancho/LobbyAPI.kt b/src/com/reco1l/api/ibancho/LobbyAPI.kt index 104c86ecc..35bfa1fba 100644 --- a/src/com/reco1l/api/ibancho/LobbyAPI.kt +++ b/src/com/reco1l/api/ibancho/LobbyAPI.kt @@ -1,10 +1,9 @@ package com.reco1l.api.ibancho import com.reco1l.api.ibancho.data.* -import com.reco1l.framework.extensions.orCatch -import com.reco1l.framework.net.JsonContent -import com.reco1l.framework.net.JsonRequester -import com.reco1l.framework.net.QueryContent +import com.reco1l.framework.net.JsonArrayRequest +import com.reco1l.framework.net.JsonObjectRequest +import com.reco1l.toolkt.data.putObject object LobbyAPI { @@ -34,39 +33,38 @@ object LobbyAPI */ fun getRooms(query: String?, sign: String?): List { - JsonRequester("$HOST$GET_ROOMS").use { + JsonArrayRequest("$HOST$GET_ROOMS").use { - it.log = false - - if (sign != null || query != null) - it.query = QueryContent().apply { - put("sign", sign) - put("query", query) + if (sign != null || query != null) { + it.buildUrl { + addQueryParameter("sign", sign) + addQueryParameter("query", query) } + } - val array = it.executeAndGetJson().toArray() ?: return emptyList() - - return List(array.length()) { i -> + return List(it.json.length()) { i -> - val json = array.optJSONObject(i) + val json = it.json.optJSONObject(i) - return@List { + return@List try { Room( - id = json.getLong("id"), - name = json.getString("name"), - isLocked = json.getBoolean("isLocked"), - maxPlayers = json.getInt("maxPlayers"), - mods = parseMods(json.getJSONObject("mods")), - gameplaySettings = parseGameplaySettings(json.getJSONObject("gameplaySettings")), - teamMode = TeamMode.from(json.getInt("teamMode")), - winCondition = WinCondition.from(json.getInt("winCondition")), - playerCount = json.getInt("playerCount"), - playerNames = json.getString("playerNames"), - status = RoomStatus.from(json.getInt("status")) + id = json.getLong("id"), + name = json.getString("name"), + isLocked = json.getBoolean("isLocked"), + maxPlayers = json.getInt("maxPlayers"), + mods = parseMods(json.getJSONObject("mods")), + gameplaySettings = parseGameplaySettings(json.getJSONObject("gameplaySettings")), + teamMode = TeamMode.from(json.getInt("teamMode")), + winCondition = WinCondition.from(json.getInt("winCondition")), + playerCount = json.getInt("playerCount"), + playerNames = json.getString("playerNames"), + status = RoomStatus.from(json.getInt("status")) ) - }.orCatch { null } + } catch (e: Exception) { + null + } }.filterNotNull() } @@ -77,34 +75,37 @@ object LobbyAPI */ fun createRoom(name: String, beatmap: RoomBeatmap?, hostUID: Long, hostUsername: String, sign: String?, password: String? = null, maxPlayers: Int = 8): Long { - JsonRequester("$HOST$CREATE_ROOM").use { request -> + JsonObjectRequest("$HOST$CREATE_ROOM").use { request -> - request.jsonInsertion = JsonContent().apply { + request.buildRequestBody { put("name", name) put("maxPlayers", maxPlayers) - putGroup("host") - .put("uid", hostUID.toString()) - .put("username", hostUsername) - - if (beatmap != null) - { - putGroup("beatmap") - .put("md5", beatmap.md5) - .put("title", beatmap.title) - .put("artist", beatmap.artist) - .put("creator", beatmap.creator) - .put("version", beatmap.version) + putObject("host") { + put("uid", hostUID.toString()) + put("username", hostUsername) } - if (!password.isNullOrBlank()) + if (beatmap != null) { + putObject("beatmap") { + put("md5", beatmap.md5) + put("title", beatmap.title) + put("artist", beatmap.artist) + put("creator", beatmap.creator) + put("version", beatmap.version) + } + } + + if (!password.isNullOrBlank()) { put("password", password) + } put("sign", sign) + } - return request.executeAndGetJson().getString("id").toLong() + return request.execute().json.getString("id").toLong() } } } \ No newline at end of file diff --git a/src/com/reco1l/framework/data/IniReader.kt b/src/com/reco1l/framework/IniReader.kt similarity index 62% rename from src/com/reco1l/framework/data/IniReader.kt rename to src/com/reco1l/framework/IniReader.kt index c797c3ec0..290c08f03 100644 --- a/src/com/reco1l/framework/data/IniReader.kt +++ b/src/com/reco1l/framework/IniReader.kt @@ -1,24 +1,18 @@ -/* - * @author Reco1l - */ - -package com.reco1l.framework.data +package com.reco1l.framework import android.util.Log import okhttp3.internal.toImmutableMap import okio.buffer import okio.source +import ru.nsu.ccfit.zuev.osuplus.BuildConfig import java.io.Closeable import java.io.File +import java.io.IOException /** * Basic INI reader meant only for osu! skin.ini format. - * It only supports [Boolean], [Int], [Float] and [IntArray] types. - * - * @author Reco1l */ -class IniReader(file: File) : Closeable -{ +class IniReader(file: File) : Closeable { val map = HashMap>() @@ -28,61 +22,52 @@ class IniReader(file: File) : Closeable private var currentSection: HashMap? = null - //----------------------------------------------------------------------------------------------------------------// - init - { + init { if (file.extension.lowercase() != EXTENSION) - { throw IniException("Not an INI file.") - } + read() } + override fun close() = buffer.close() - //----------------------------------------------------------------------------------------------------------------// - private fun parseObject(input: String): Any - { + private fun parseObject(input: String): Any { + val value = input.trim() val sanitized = value.substringBefore("//").trim() // Boolean - if (value == "0" || value == "1") - { + if (value == "0" || value == "1") { return value == "1" } // Integer - if (Regex("^-?\\d+$").matches(sanitized)) - { + if (Regex("^-?\\d+$").matches(sanitized)) { return sanitized.toIntOrNull() ?: value } // Decimal - if (Regex("^-?\\d+\\.\\d+$").matches(sanitized)) - { + if (Regex("^-?\\d+\\.\\d+$").matches(sanitized)) { return sanitized.toFloatOrNull() ?: value } // IntArray - if (Regex("^\\d+(?:\\s*,\\s*\\d+)*$").matches(sanitized)) - { + if (Regex("^\\d+(?:\\s*,\\s*\\d+)*$").matches(sanitized)) { return sanitized.split(",") - .mapNotNull { it.trim().toIntOrNull() } - .takeUnless { it.isEmpty() } - ?.toIntArray() ?: value + .mapNotNull { it.trim().toIntOrNull() } + .takeUnless { it.isEmpty() } + ?.toIntArray() ?: value } // String return value } - //----------------------------------------------------------------------------------------------------------------// - private fun readNextLine(): Boolean - { + private fun readNextLine(): Boolean { currentLine = buffer.readUtf8Line() return currentLine != null } @@ -90,28 +75,21 @@ class IniReader(file: File) : Closeable /** * Read the INI loaded, consider using it inside a try-catch statement. */ - fun read() - { + fun read() { // Using mr. Rian code as reference. while (readNextLine()) currentLine?.let { input -> val line = input.trim() - // Handle C++ style comments and empty lines if (line.startsWith("//") || line.isEmpty()) - { return@let - } - // [SectionName] - if (line.startsWith("[") && line.endsWith("]")) - { + if (line.startsWith("[") && line.endsWith("]")) { val sectionName = line.substring(1, line.length - 1) if (map[sectionName] == null) - { map[sectionName] = HashMap() - } + currentSection = map[sectionName] Log.i("IniReader", line) @@ -124,12 +102,13 @@ class IniReader(file: File) : Closeable val o = parseObject(value) currentSection?.put(command, o) - Log.i("IniReader", "$command: ${if (o is IntArray) o.contentToString() else o}") + if (BuildConfig.DEBUG) { + Log.i("IniReader", "$command: ${if (o is IntArray) o.contentToString() else o}") + } } buffer.close() } - //----------------------------------------------------------------------------------------------------------------// /** * Returns the desired section map. @@ -139,12 +118,11 @@ class IniReader(file: File) : Closeable /** * Returns the value from the desired command and section cast as the inferred type or `null`. */ - inline operator fun get(section: String, key: String): T? - { + inline operator fun get(section: String, key: String): T? { val value = map[section]?.get(key) ?: return null if (T::class == Boolean::class && value is Int) { - return when(value) { + return when (value) { 0 -> false as T 1 -> true as T else -> null @@ -154,13 +132,14 @@ class IniReader(file: File) : Closeable return value as? T } - //----------------------------------------------------------------------------------------------------------------// - companion object - { + companion object { /** * `.ini` extension constant. */ const val EXTENSION = "ini" } -} \ No newline at end of file +} + + +class IniException(override val message: String?) : IOException() diff --git a/src/com/reco1l/framework/data/IniException.kt b/src/com/reco1l/framework/data/IniException.kt deleted file mode 100644 index 1808efd14..000000000 --- a/src/com/reco1l/framework/data/IniException.kt +++ /dev/null @@ -1,9 +0,0 @@ -/* - * @author Reco1l - */ - -package com.reco1l.framework.data - -import java.io.IOException - -class IniException(override val message: String?) : IOException() diff --git a/src/com/reco1l/framework/extensions/JsonExt.kt b/src/com/reco1l/framework/extensions/JsonExt.kt deleted file mode 100644 index 5721a1ae8..000000000 --- a/src/com/reco1l/framework/extensions/JsonExt.kt +++ /dev/null @@ -1,75 +0,0 @@ -@file:JvmName("JsonUtil") -/* - * @author Reco1l - */ - -package com.reco1l.framework.extensions - -import org.json.JSONArray -import org.json.JSONObject -import kotlin.reflect.full.primaryConstructor - - -/** - * Iterate over all objects on a [JSONArray]. - * - * Note: Objects of type [JSONArray] wrapped on the array will be converted into a [JSONObject] - */ -inline fun JSONArray.forEach(action: (JSONObject) -> Unit) -{ - for (i in 0 until length()) - { - // Handling wrapped JSONArray converting them into a JSONObject. - val o = optJSONObject(i) ?: toJSONObject(optJSONArray(i) ?: continue) - action(o) - } -} - - -/** - * Map a JSONObject into a data class. - * - * It'll only map arguments from the constructor of the class, the arguments name should match with the JSON keys. - * Extremely recommended to use nullable arguments to handle not found keys in a JSON. - * - * @throws Exception Advise to catch any conversion error. - */ -inline fun JSONObject.mapInto(): T? -{ - val constructor = T::class.primaryConstructor ?: return null - val parameters = constructor.parameters - - val arguments = parameters.associateWith { opt(it.name) } - - return constructor.callBy(arguments) -} - -/** - * Map a JSONArray into a MutableList containing mapped data classes for every JSONObject inside. - * - * @see [JSONObject.mapInto] - * @throws Exception Advise to catch any conversion error. - */ -inline fun JSONArray.mapIntoListOf(): MutableList? -{ - val list = mutableListOf() - - forEach { list.add(it.mapInto() ?: return null) } - - return list.takeUnless { it.isEmpty() } -} - - -operator fun JSONArray.iterator(): Iterator = object : Iterator -{ - private var index = 0 - - override fun hasNext() = index < length() - - override fun next(): Any - { - val element = get(index) - index++ - return element - } -} diff --git a/src/com/reco1l/framework/extensions/KotlinExt.kt b/src/com/reco1l/framework/extensions/KotlinExt.kt deleted file mode 100644 index 2b8f7df62..000000000 --- a/src/com/reco1l/framework/extensions/KotlinExt.kt +++ /dev/null @@ -1,98 +0,0 @@ -@file:JvmName("LangUtil") - -package com.reco1l.framework.extensions - -import com.reco1l.framework.lang.async -import ru.nsu.ccfit.zuev.osuplus.BuildConfig -import kotlin.reflect.KClass -import kotlin.reflect.full.createInstance -import kotlin.reflect.full.isSubclassOf -import kotlin.reflect.full.superclasses - -/** - * [Class.getSimpleName] - */ -val Any?.className: String - get() = this?.javaClass?.simpleName ?: "Null" - -/** - * Create a new instance with the given parameters. - */ -fun KClass.createInstance(vararg parameters: Any?): T -{ - if (parameters.isEmpty()) - { - return createInstance() - } - - val constructor = constructors.first { it.parameters.size == parameters.size } - val params = constructor.parameters - - val arguments = params.associateWith { parameters[params.indexOf(it)] } - - return constructor.callBy(arguments) -} - -/** - * Improved comparator with ascending boolean property. - */ -inline fun compareBy(ascending: Boolean, crossinline selector: (T) -> Comparable<*>?) = Comparator { a, b -> - - if (ascending) - { - compareValuesBy(a, b, selector) - } - else compareValuesBy(b, a, selector) -} - -/** - * Special block to ignore exceptions - */ -inline fun ignoreException(block: () -> Unit) -{ - try - { - block() - } - catch (e: Exception) - { - if (BuildConfig.DEBUG) - e.printStackTrace() - } -} - -/** - * Prettier try-catch with result returning. - */ -inline fun (() -> T).orCatch(onException: (e: Exception) -> T): T -{ - return try { this() } catch (e: Exception) { onException(e) } -} - -/** - * Prettier try-catch on async thread. - */ -fun (() -> Any).orAsyncCatch(onException: ((e: Exception) -> Unit)?) -{ - async { try { this() } catch (e: Exception) { onException?.invoke(e) } } -} - -/** - * Get all subclasses of a type from a package. - */ -inline fun getSubclassesOf(packageName: String): List> -{ - val `package` = Class.forName(packageName) - - return `package`.declaredClasses.filter { it.kotlin.isSubclassOf(T::class) } -} - -/** - * Get all sub interfaces of a type from a package. - */ -inline fun getSubInterfacesOf(packageName: String) = getSubclassesOf(packageName).filter { it.isInterface } - -/** - * Get all superclasses of the desired type. - */ -fun KClass<*>.superClassesOfType(base: KClass<*>) = this.superclasses.filter { it.isSubclassOf(base) } diff --git a/src/com/reco1l/framework/extensions/LogExt.kt b/src/com/reco1l/framework/extensions/LogExt.kt deleted file mode 100644 index d6950508a..000000000 --- a/src/com/reco1l/framework/extensions/LogExt.kt +++ /dev/null @@ -1,51 +0,0 @@ -@file:JvmName("Logger") -/* - * @author Reco1l - */ - -package com.reco1l.framework.extensions - -import android.util.Log -import ru.nsu.ccfit.zuev.osuplus.BuildConfig - - -/** - * Notify new instance creation of a class. - */ -fun Any.logInit() = "New instance created: ${className}@${hashCode()}".logI("JVM") - -/** - * Notify VM load of a class. - */ -fun Class<*>.logLoad() = "Class static loaded: $simpleName".logI("JVM") - - -/** - * As specified on [Log.i] - */ -fun String.logI(tag: Any) = Log.i(tag.toString(), this) - -/** - * As specified on [Log.w] - */ -fun String.logW(tag: Any) = Log.w(tag.toString(), this) - -/** - * As specified on [Log.e] - */ -fun String.logE(tag: Any) = Log.e(tag.toString(), this) - -/** - * Print a log if the current build is debug. - */ -fun String.logIfDebug(tag: Any) -{ - if (BuildConfig.DEBUG) - { - Log.i(tag.toString(), this) - } -} - - -inline fun Throwable.logWithMessage(tag: Any, message: () -> String) = Log.e(tag.toString(), message(), this) - diff --git a/src/com/reco1l/framework/extensions/StringExt.kt b/src/com/reco1l/framework/extensions/StringExt.kt deleted file mode 100644 index d6b2ae066..000000000 --- a/src/com/reco1l/framework/extensions/StringExt.kt +++ /dev/null @@ -1,29 +0,0 @@ -@file:JvmName("StringUtil") -/* - * @author Reco1l - */ - -package com.reco1l.framework.extensions - -import android.text.format.DateFormat -import java.net.URLDecoder -import java.nio.charset.StandardCharsets -import java.util.* - - -/** - * Converts a date pattern to a real date using [DateFormat]. - */ -fun String.toDate() = DateFormat.format(this, Date()).toString() - -/** - * Decode in UTF8 the filename from an encoded URL String. - * - * @see [URLDecoder.decode] - */ -fun String.decodeUtf8(): String = URLDecoder.decode(this, StandardCharsets.UTF_8.name()) - -/** - * Remove all characters in a filename that are invalid in the filesystem. - */ -fun String.forFilesystem() = replace("[^a-zA-Z0-9.\\-]".toRegex(), "_") diff --git a/src/com/reco1l/framework/net/Downloader.kt b/src/com/reco1l/framework/net/Downloader.kt deleted file mode 100644 index 3f49afaba..000000000 --- a/src/com/reco1l/framework/net/Downloader.kt +++ /dev/null @@ -1,202 +0,0 @@ -package com.reco1l.framework.net - -import com.reco1l.framework.extensions.className -import com.reco1l.framework.extensions.logE -import com.reco1l.framework.lang.async -import com.reco1l.framework.net.SizeMeasure.* -import okhttp3.ResponseBody -import java.io.File -import java.io.IOException - -class Downloader(val file: File, private val url: String) -{ - - var observer: IDownloaderObserver? = null - - /** - * The exception got in case the download failed. - */ - var exception: Exception? = null - private set - - /** - * `true` if this downloader has already been used and cannot be used anymore. - */ - var isValid = true - private set - - /** - * Define if the downloader should execute in asynchronous, keep in mind executing on main thread will throw an exception. - */ - var runOnAsync = true - - /** - * `true` if currently downloading. - */ - var isDownloading = false - private set - - /** - * `true` if the download has been completed successfully. - */ - val isCompleted: Boolean - get() = progress == 100.0 - - /** - * The current download speed in B/s. - */ - var speed = 0.0 - private set - - /** - * The current download progress, it'll be `-1` if the download hasn't been started. - */ - var progress = -1.0 - private set - - /** - * Set the download buffer size, by default [DEFAULT_BUFFER_SIZE]. - */ - var bufferSize = DEFAULT_BUFFER_SIZE - - - - constructor(path: String, url: String) : this(File(path), url) - - - - /** - * Returns the current download speed in the desired measure - * - * @param measure The measurement for the return value, setting this to null will use Byte/s. - * @see SizeMeasure - */ - fun getSpeed(measure: SizeMeasure?): Double - { - return if (measure != null) - { - when (measure) - { - KBPS -> speed / 1024 * 1e9 - MBPS -> speed / (1024 * 1024) * 1e9 - } - } - else speed - } - - - - private fun handleDownload() - { - try - { - Requester(url).use { onRequestSuccess(it.executeAndGetBody()) } - } - catch (e: Exception) - { - clear() - exception = e - - observer?.onDownloadFail(this) - } - } - - private fun onRequestSuccess(body: ResponseBody) - { - val length = body.contentLength() * 1.0 - val buffer = ByteArray(bufferSize) - val stream = body.byteStream() - - var total = 0L - var bytes: Int - - try - { - stream.buffered(bufferSize).use { - - file.outputStream().use { out -> - - isDownloading = true - observer?.onDownloadStart(this) - - val startTime = System.nanoTime() - - while (it.read(buffer).also { bytes = it } != -1 && isDownloading) - { - out.write(buffer, 0, bytes) - total += bytes.toLong() - - val elapsedTime = (System.nanoTime() - startTime).toDouble() - - progress = total / length * 100 - speed = total / elapsedTime - - observer?.onDownloadUpdate(this) - } - onLoopExit() - } - } - } - catch (e: IOException) - { - // We don't call clear() here to leave the last progress and the last speed when the download failed. - isDownloading = false - exception = e - - observer?.onDownloadFail(this) - } - } - - private fun onLoopExit() - { - if (isDownloading || isCompleted) - { - isDownloading = false - observer?.onDownloadEnd(this) - return - } - - // This mean the file wasn't fully downloaded. - if (file.exists()) - { - file.delete() - } - observer?.onDownloadCancel(this) - } - - - - fun download() - { - if (!isValid) - { - "This Downloader isn't more valid, it has already been used.".logE(className) - return - } - isValid = false - - if (runOnAsync) - { - async { handleDownload() } - } - else - { - handleDownload() - } - } - - /** - * Keep in mind if the file completed download the onCancel callback will not run. - */ - fun cancel() - { - isDownloading = false - } - - private fun clear() - { - isDownloading = false - progress = -1.0 - speed = 0.0 - } -} diff --git a/src/com/reco1l/framework/net/FileRequest.kt b/src/com/reco1l/framework/net/FileRequest.kt new file mode 100644 index 000000000..5337aaad9 --- /dev/null +++ b/src/com/reco1l/framework/net/FileRequest.kt @@ -0,0 +1,129 @@ +package com.reco1l.framework.net + +import okhttp3.Response +import java.io.File + +class FileRequest(val file: File, url: String): WebRequest(url) { + + /** + * The download observer. + */ + var observer: IDownloaderObserver? = null + + /** + * Whether the download is in progress, this is set to true once [execute] is called. + */ + var isDownloading = false + private set + + /** + * Whether the download has been completed successfully. + */ + val isCompleted: Boolean + get() = progress == 100.0 + + /** + * The current download speed in kilobytes per second. + */ + var speedKbps = 0f + private set + + /** + * The current download progress in 0 to 1 range. + */ + var progress = -1.0 + private set + + /** + * The download buffer size, by default [DEFAULT_BUFFER_SIZE]. + */ + var bufferSize = DEFAULT_BUFFER_SIZE + + + + override fun onResponseSuccess(response: Response) { + + val length = response.body!!.contentLength() * 1.0 + val stream = response.body!!.byteStream() + + val bytes = ByteArray(bufferSize) + + var totalBytes = 0L + var bytesRead = 0 + + stream.buffered(bufferSize).use { buffer -> + + file.outputStream().use { out -> + + isDownloading = true + val startTime = System.currentTimeMillis() + + while (isDownloading && buffer.read(bytes).also { bytesRead = it } != -1) { + + out.write(bytes, 0, bytesRead) + totalBytes += bytesRead.toLong() + + val elapsedMilliseconds = (System.currentTimeMillis() - startTime).toFloat() + + progress = totalBytes / length * 100 + speedKbps = (totalBytes / elapsedMilliseconds) / 1024f * 1000f + + observer?.onDownloadUpdate(this) + } + + if (isDownloading || isCompleted) { + isDownloading = false + observer?.onDownloadEnd(this) + return + } + + // This mean the file wasn't fully downloaded. + if (file.exists()) { + file.delete() + } + observer?.onDownloadCancel(this) + } + } + + } + + override fun onResponseFail(exception: Exception) { + + isDownloading = false + observer?.onDownloadFail(this, exception) ?: throw exception + } + + + /** + * Cancels the current download. + * + * If [execute] wasn't called at this point or the download has finished, this will not have any + * effect. + */ + fun cancel() { + isDownloading = false + } + + + override fun execute(): FileRequest { + try { + super.execute() + } catch (e: Exception) { + observer?.onDownloadFail(this, e) ?: throw e + } + return this + } + +} + + +interface IDownloaderObserver +{ + fun onDownloadEnd(downloader: FileRequest) = Unit + + fun onDownloadCancel(downloader: FileRequest) = Unit + + fun onDownloadUpdate(downloader: FileRequest) = Unit + + fun onDownloadFail(downloader: FileRequest, exception: Exception) = Unit +} diff --git a/src/com/reco1l/framework/net/IDownloaderObserver.kt b/src/com/reco1l/framework/net/IDownloaderObserver.kt deleted file mode 100644 index daef21a5d..000000000 --- a/src/com/reco1l/framework/net/IDownloaderObserver.kt +++ /dev/null @@ -1,27 +0,0 @@ -package com.reco1l.framework.net - -/** - * @author Reco1l - */ -interface IDownloaderObserver -{ - fun onDownloadStart(downloader: Downloader) - { - } - - fun onDownloadEnd(downloader: Downloader) - { - } - - fun onDownloadCancel(downloader: Downloader) - { - } - - fun onDownloadUpdate(downloader: Downloader) - { - } - - fun onDownloadFail(downloader: Downloader) - { - } -} diff --git a/src/com/reco1l/framework/net/JsonContent.kt b/src/com/reco1l/framework/net/JsonContent.kt deleted file mode 100644 index 0c0d4e650..000000000 --- a/src/com/reco1l/framework/net/JsonContent.kt +++ /dev/null @@ -1,100 +0,0 @@ -package com.reco1l.framework.net - -import com.reco1l.framework.extensions.iterator -import org.json.JSONArray -import org.json.JSONException -import org.json.JSONObject -import org.json.JSONTokener - -class JsonContent() : JSONObject() -{ - - /** - * This can only be `true` if it was created from a String, and it was a [JSONArray]. - */ - var isConvertedArray = false - private set - - - - /** - * This constructor parses objects and arrays into a [JSONObject]. - * In the case of arrays it puts every array entry with the index as it name. - */ - constructor(source: String) : this() - { - val t = JSONTokener(source) - val o = t.nextValue() - - if (o is JSONObject) - { - val names = o.names() - - if (names != null) - { - for (name in names) - { - put(name as String, o.get(name)) - } - } - return - } - else if (o is JSONArray) - { - isConvertedArray = true - - for (i in 0 until o.length()) - { - put(i.toString(), o[i]) - } - return - } - throw JSONException(source) - } - - - - /** - * Puts inside a new [JsonContent] and returns it. - */ - fun putGroup(header: String): JsonContent - { - val group = JsonContent() - put(header, group) - return group - } - - /** - * If this content is a [JSONArray] converted it'll will return the object by its index. - * - * @throws JSONException If this content is not an array converted. - */ - fun get(index: Int): Any - { - if (!isConvertedArray) - { - throw JSONException("This object is not an array converted") - } - if (index > length()) - { - throw IndexOutOfBoundsException() - } - return get(index.toString()) - } - - - - /** - * If this content correspond to an array converted it'll convert it back to [JSONArray]. - * - * @see isConvertedArray - */ - fun toArray(): JSONArray? - { - if (isConvertedArray) - { - return toJSONArray(names()) - } - throw JSONException("This object is not an array converted") - } -} diff --git a/src/com/reco1l/framework/net/JsonRequest.kt b/src/com/reco1l/framework/net/JsonRequest.kt new file mode 100644 index 000000000..d996c2646 --- /dev/null +++ b/src/com/reco1l/framework/net/JsonRequest.kt @@ -0,0 +1,100 @@ +package com.reco1l.framework.net + +import android.util.Log +import com.reco1l.toolkt.data.asJSONObject +import com.reco1l.toolkt.kotlin.isBetween +import okhttp3.MediaType.Companion.toMediaTypeOrNull +import okhttp3.RequestBody.Companion.toRequestBody +import okhttp3.Response +import okio.IOException +import org.json.JSONArray +import org.json.JSONException +import org.json.JSONObject +import ru.nsu.ccfit.zuev.osuplus.BuildConfig + +sealed class JsonRequest(url: String) : WebRequest(url) +{ + + /** + * Whether response should be logged. + */ + var logResponse = false + + /** + * The response JSON. + */ + lateinit var json: T + private set + + + fun buildRequestBody(unit: JSONObject.() -> Unit) { + + buildRequest { + + val json = JSONObject() + json.unit() + post(json.toString().toRequestBody(JSON_UTF_8)) + + + if (BuildConfig.DEBUG) { + Log.i("JsonRequest", "Inserting JSON: " + json.toString(4)) + } + } + } + + + protected abstract fun onCreateResponseJson(responseBody: String): T + + + override fun onResponse(response: Response) { + json = onCreateResponseJson(responseBody.string()) + } + + + @Suppress("UNCHECKED_CAST") + override fun execute() = super.execute() as JsonRequest + + + companion object { + + var JSON_UTF_8 = "application/json; charset=utf-8".toMediaTypeOrNull() + } +} + + +class JsonObjectRequest(url: String) : JsonRequest(url) { + + override fun onCreateResponseJson(responseBody: String): JSONObject { + + if (!responseBody.isBetween('{' to '}')) { + throw JSONException("Response is not a JSON object.\n$responseBody") + } + + val json = JSONObject(responseBody) + + if (BuildConfig.DEBUG) { + Log.i("JsonRequester", "Received JSON: " + json.toString(4)) + } + + return json + } + +} + +class JsonArrayRequest(url: String) : JsonRequest(url) { + + override fun onCreateResponseJson(responseBody: String): JSONArray { + + if (!responseBody.isBetween('[' to ']')) { + throw JSONException("Response is not a JSON array.\n$responseBody") + } + + val json = JSONArray(responseBody) + + if (BuildConfig.DEBUG) { + Log.i("JsonRequester", "Received JSON: " + json.toString(4)) + } + + return json + } +} \ No newline at end of file diff --git a/src/com/reco1l/framework/net/JsonRequester.kt b/src/com/reco1l/framework/net/JsonRequester.kt deleted file mode 100644 index eee59cf77..000000000 --- a/src/com/reco1l/framework/net/JsonRequester.kt +++ /dev/null @@ -1,78 +0,0 @@ -package com.reco1l.framework.net - -import com.reco1l.framework.extensions.className -import com.reco1l.framework.extensions.logIfDebug -import okhttp3.MediaType.Companion.toMediaTypeOrNull -import okhttp3.RequestBody.Companion.toRequestBody -import okhttp3.Response -import org.json.JSONObject - -class JsonRequester(url: String) : Requester(url) -{ - - /** - * Whether response JSON should be logged. - */ - var logResponse = false - - /** - * Validate the received Json from the server, this validator will only be used if the response was successful. - */ - var jsonValidator: ((JsonContent) -> Unit)? = null - - /** - * Data insertion for POST requests. - */ - var jsonInsertion: JSONObject? = null - set(value) - { - if (value != null) - { - buildRequest { - - "Inserted JSON: ${value.toString(4)}".logIfDebug(className) - - it.post(value.toString().toRequestBody(JSON_UTF8)) - } - } - field = value - } - - /** - * The response JSON. - */ - lateinit var json: JsonContent - private set - - - - @Throws(Exception::class) - override fun onResponse(response: Response?) - { - json = JsonContent(responseBody.string()) - - if (logResponse) - "Received JSON: ${json.toString(4)}".logIfDebug(className) - } - - @Throws(Exception::class) - override fun onResponseSuccess(response: Response?) - { - super.onResponseSuccess(response) - - jsonValidator?.invoke(json) - } - - @Throws(Exception::class) - override fun execute() = super.execute() as JsonRequester - - @Throws(Exception::class) - fun executeAndGetJson(): JsonContent = execute().use { requester -> return requester.json } - - - - companion object - { - var JSON_UTF8 = "application/json; charset=utf-8".toMediaTypeOrNull() - } -} diff --git a/src/com/reco1l/framework/net/QueryContent.kt b/src/com/reco1l/framework/net/QueryContent.kt deleted file mode 100644 index bf6609a6c..000000000 --- a/src/com/reco1l/framework/net/QueryContent.kt +++ /dev/null @@ -1,32 +0,0 @@ -package com.reco1l.framework.net - -/** - * @author Reco1l - */ -class QueryContent -{ - - private val builder = StringBuilder("?") - - private var useAmpersand = false - - - fun put(key: String, value: Any?) - { - val string = value?.toString()?.trim()?.takeUnless { it.isBlank() } ?: return - - if (useAmpersand) - { - builder.append('&') - } - else - { - useAmpersand = true - } - builder.append(key).append('=').append(string) - } - - - - override fun toString() = builder.toString() -} diff --git a/src/com/reco1l/framework/net/Requester.kt b/src/com/reco1l/framework/net/Requester.kt deleted file mode 100644 index e1f0250bf..000000000 --- a/src/com/reco1l/framework/net/Requester.kt +++ /dev/null @@ -1,173 +0,0 @@ -package com.reco1l.framework.net - -import com.reco1l.framework.extensions.className -import com.reco1l.framework.extensions.logIfDebug -import okhttp3.* -import java.util.* -import java.util.concurrent.TimeUnit - -/** - * @author Reco1l - */ -open class Requester(url: String) : AutoCloseable -{ - - /** - * Indicates if the requester should log responses. - */ - var log = true - - /** - * The request query. - */ - var query: QueryContent? = null - - /** - * The call executed by the client, don't use it before calling [execute]. - */ - lateinit var call: Call - - /** - * The response get, don't use it before calling [execute]. - */ - lateinit var response: Response - - /** - * The response body, don't use it before calling [execute]. - */ - lateinit var responseBody: ResponseBody - - - - private var client: OkHttpClient? = DEFAULT_CLIENT - - private var request: Request? = defaultRequest(url) - - - - fun buildClient(unit: (OkHttpClient.Builder) -> Unit) - { - val builder = client?.newBuilder() ?: OkHttpClient.Builder() - - unit(builder) - client = builder.build() - } - - fun buildRequest(unit: (Request.Builder) -> Unit) - { - val builder = request?.newBuilder() ?: Request.Builder() - - unit(builder) - request = builder.build() - } - - - - /** - * Called as soon the response and response body is created. - */ - @Throws(Exception::class) - protected open fun onResponse(response: Response?) - { - } - - /** - * Called when response code isn't 200-299, this can also be called from inherited [onResponseSuccess] exception thrown. - */ - @Throws(Exception::class) - protected fun onResponseFail(exception: Exception) - { - throw exception - } - - /** - * Called when response code is 200-299. - */ - @Throws(Exception::class) - protected open fun onResponseSuccess(response: Response?) - { - } - - - - override fun close() - { - if (::response.isInitialized) - { - response.close() - } - if (::responseBody.isInitialized) - { - responseBody.close() - } - } - - - - /** - * Make sure to call before call close() or inside the try-with-resources statement. - */ - @Throws(Exception::class) - open fun execute(): Requester - { - requireNotNull(client) - requireNotNull(request) - - if (query != null) - { - request = request!!.newBuilder().url("${request!!.url}$query").build() - } - - call = client!!.newCall(request!!) - - try - { - if (log) - "Inserted url: ${request!!.url}".logIfDebug(className) - - response = call.execute() - responseBody = response.body!! - - onResponse(response) - - if (response.isSuccessful) - { - onResponseSuccess(response) - } - else - { - throw ResponseException(response) - } - } - catch (e: Exception) - { - onResponseFail(e) - } - return this - } - - /** - * Make sure to call before call [close] or inside the try-with-resources statement. - * - * @return The response body. - */ - @Throws(Exception::class) - fun executeAndGetBody(): ResponseBody = execute().responseBody - - - - companion object - { - const val DEFAULT_TIMEOUT = 10000 - - val DEFAULT_CLIENT = OkHttpClient - .Builder() - .connectTimeout(DEFAULT_TIMEOUT.toLong(), TimeUnit.MILLISECONDS) - .build() - - fun defaultRequest(url: String) = Request - .Builder() - .url(url) - .build() - } -} diff --git a/src/com/reco1l/framework/net/ResponseException.kt b/src/com/reco1l/framework/net/ResponseException.kt deleted file mode 100644 index 344f01418..000000000 --- a/src/com/reco1l/framework/net/ResponseException.kt +++ /dev/null @@ -1,14 +0,0 @@ -package com.reco1l.framework.net - -import okhttp3.Response -import java.io.IOException - -/** - * @author Reco1l - */ -class ResponseException(response: Response) : IOException("Unexpected response: $response") -{ - - val code: Int = response.code - -} diff --git a/src/com/reco1l/framework/net/SizeMeasure.kt b/src/com/reco1l/framework/net/SizeMeasure.kt deleted file mode 100644 index a85c3af3c..000000000 --- a/src/com/reco1l/framework/net/SizeMeasure.kt +++ /dev/null @@ -1,10 +0,0 @@ -package com.reco1l.framework.net - -/** - * @author Reco1l - */ -enum class SizeMeasure -{ - KBPS, - MBPS -} diff --git a/src/com/reco1l/framework/net/WebRequest.kt b/src/com/reco1l/framework/net/WebRequest.kt new file mode 100644 index 000000000..278e23b87 --- /dev/null +++ b/src/com/reco1l/framework/net/WebRequest.kt @@ -0,0 +1,151 @@ +package com.reco1l.framework.net + +import android.util.Log +import okhttp3.* +import okhttp3.HttpUrl.Companion.toHttpUrl +import ru.nsu.ccfit.zuev.osuplus.BuildConfig +import java.io.IOException +import java.util.* +import java.util.concurrent.TimeUnit + +/** + * @author Reco1l + */ +open class WebRequest(link: String) : AutoCloseable { + + + /** + * The response got upon request, this will not be initialized until [execute] has been + * successfully called. + */ + lateinit var response: Response + + /** + * The response body got upon request, this will not be initialized until [execute] has been + * successfully called. + */ + lateinit var responseBody: ResponseBody + + + private var url = link.toHttpUrl() + + private var client = DEFAULT_CLIENT + + private var request = Request.Builder().url(url).build() + + + /** + * Builds a new Okio HTTP client upon the current one. + */ + fun buildClient(unit: OkHttpClient.Builder.() -> Unit) { + val builder = client.newBuilder() + builder.unit() + client = builder.build() + } + + /** + * Builds a new request upon the current one. + */ + fun buildRequest(unit: Request.Builder.() -> Unit) { + val builder = request.newBuilder() + builder.unit() + request = builder.build() + } + + /** + * Builds an HTTP URL upon the current one. + */ + fun buildUrl(unit: HttpUrl.Builder.() -> Unit) { + val builder = url.newBuilder() + builder.unit() + url = builder.build() + } + + + /** + * Called as soon the response and response body is created. + */ + protected open fun onResponse(response: Response) = Unit + + /** + * Called when response code isn't 200-299, this can also be called from inherited + * [onResponseSuccess] exception thrown. + */ + protected open fun onResponseFail(exception: Exception): Unit = throw exception + + /** + * Called when response code is 200-299. + */ + protected open fun onResponseSuccess(response: Response) = Unit + + + override fun close() { + + if (::response.isInitialized) { + response.close() + } + + if (::responseBody.isInitialized) { + responseBody.close() + } + + } + + + /** + * Executes the request. + * + * Make sure to call before call close() or inside the try-with-resources statement. + */ + @Throws(Exception::class) + open fun execute(): WebRequest { + + val call = client.newCall(request) + + try { + + if (BuildConfig.DEBUG) { + Log.i("WebRequest", "Request to: " + request.url) + } + + response = call.execute() + responseBody = response.body!! + + onResponse(response) + + if (response.isSuccessful) { + onResponseSuccess(response) + } else { + throw ResponseException(response) + } + + } catch (e: Exception) { + onResponseFail(e) + } + + return this + } + + + companion object { + + /** + * The default Okio HTTP client. + * + * This client uses by default a 10 seconds timeout configuration. + */ + val DEFAULT_CLIENT = OkHttpClient + .Builder() + .connectTimeout(10000, TimeUnit.MILLISECONDS) + .build() + + } +} + + +/** + * Denotes a response that is not successful. + */ +class ResponseException(response: Response) : IOException("Unexpected response: $response") { + val code: Int = response.code +} diff --git a/src/com/reco1l/legacy/Multiplayer.kt b/src/com/reco1l/legacy/Multiplayer.kt index b548d147a..6e03ecd44 100644 --- a/src/com/reco1l/legacy/Multiplayer.kt +++ b/src/com/reco1l/legacy/Multiplayer.kt @@ -5,11 +5,12 @@ import android.util.Log import com.reco1l.api.ibancho.RoomAPI import com.reco1l.api.ibancho.data.Room import com.reco1l.api.ibancho.data.RoomPlayer -import com.reco1l.framework.extensions.className import com.reco1l.framework.extensions.toDate import com.reco1l.legacy.data.jsonToScoreboardItem import com.reco1l.legacy.data.jsonToStatistic import com.reco1l.legacy.ui.multiplayer.RoomScene +import com.reco1l.toolkt.kotlin.formatTimeMilliseconds +import com.reco1l.toolkt.kotlin.fromDate import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.launch @@ -96,7 +97,8 @@ object Multiplayer init { - LOG_FILE.writeText("[${"yyyy/MM/dd hh:mm:ss".toDate()}] Client ${MainActivity.versionName} started.") + val time = "yyyy/MM/dd hh:mm:ss".fromDate() + LOG_FILE.writeText("[$time] Client ${MainActivity.versionName} started.") } @@ -257,9 +259,11 @@ object Multiplayer @JvmStatic fun log(e: Throwable) { - val timestamp = DateFormat.format("hh:mm:ss", System.currentTimeMillis()) + val time = "hh:mm:ss".formatTimeMilliseconds(System.currentTimeMillis()) + val stacktrace = Log.getStackTraceString(e) + + LOG_FILE.appendText("\n[$time] EXCEPTION: ${e.javaClass.simpleName}\n$stacktrace") - LOG_FILE.appendText("\n[$timestamp] EXCEPTION: ${e.className}\n${Log.getStackTraceString(e)}") Log.e("Multiplayer", "An exception has been thrown.", e) } } \ No newline at end of file diff --git a/src/com/reco1l/legacy/UpdateManager.kt b/src/com/reco1l/legacy/UpdateManager.kt index e4b122c5f..aff784ac9 100644 --- a/src/com/reco1l/legacy/UpdateManager.kt +++ b/src/com/reco1l/legacy/UpdateManager.kt @@ -10,7 +10,7 @@ import com.google.android.material.snackbar.BaseTransientBottomBar.LENGTH_SHORT import com.google.android.material.snackbar.Snackbar import com.reco1l.framework.lang.async import com.reco1l.framework.lang.mainThread -import com.reco1l.framework.net.Downloader +import com.reco1l.framework.net.FileRequest import com.reco1l.framework.net.IDownloaderObserver import okhttp3.Request import org.json.JSONObject @@ -198,9 +198,24 @@ object UpdateManager: IDownloaderObserver // empty string so the downloader invokes onDownloadFail() and a prompt is shown to user rather than nothing. val url = downloadURL ?: "" - val downloader = Downloader(file, url) + val downloader = FileRequest(file, url) downloader.observer = this - downloader.download() + + async { + downloader.execute() + + mainThread { + snackBar.apply { + + duration = LENGTH_INDEFINITE + + setText(StringTable.format(update_info_downloading, 0)) + setAction(beatmap_downloader_cancel) { downloader.cancel() } + show() + } + } + } + } @@ -270,32 +285,20 @@ object UpdateManager: IDownloaderObserver } } - - override fun onDownloadStart(downloader: Downloader) = mainThread { - - snackBar.apply { - - duration = LENGTH_INDEFINITE - - setText(StringTable.format(update_info_downloading, 0)) - setAction(beatmap_downloader_cancel) { downloader.cancel() } - show() - } - } - override fun onDownloadUpdate(downloader: Downloader) = mainThread { + override fun onDownloadUpdate(downloader: FileRequest) = mainThread { snackBar.setText(StringTable.format(update_info_downloading, downloader.progress.toInt())) } - override fun onDownloadEnd(downloader: Downloader) { + override fun onDownloadEnd(downloader: FileRequest) { mainThread(snackBar::dismiss) onInstallNewUpdate(downloader.file) } - override fun onDownloadFail(downloader: Downloader) { + override fun onDownloadFail(downloader: FileRequest, exception: Exception) { - downloader.exception?.printStackTrace() + exception.printStackTrace() mainThread { snackBar.apply { @@ -310,7 +313,7 @@ object UpdateManager: IDownloaderObserver downloader.file.delete() } - override fun onDownloadCancel(downloader: Downloader) { + override fun onDownloadCancel(downloader: FileRequest) { mainThread { snackBar.apply { diff --git a/src/com/reco1l/legacy/data/SkinConverter.kt b/src/com/reco1l/legacy/data/SkinConverter.kt index 777266caf..86ce9c04f 100644 --- a/src/com/reco1l/legacy/data/SkinConverter.kt +++ b/src/com/reco1l/legacy/data/SkinConverter.kt @@ -7,7 +7,7 @@ import android.graphics.Bitmap.CompressFormat import android.graphics.Bitmap.Config import android.graphics.BitmapFactory import android.graphics.Color -import com.reco1l.framework.data.IniReader +import com.reco1l.framework.IniReader import com.reco1l.framework.net.JsonContent import org.json.JSONArray import java.io.File diff --git a/src/com/reco1l/legacy/engine/VideoTexture.kt b/src/com/reco1l/legacy/engine/VideoTexture.kt index 19d26e9b6..d3a386908 100644 --- a/src/com/reco1l/legacy/engine/VideoTexture.kt +++ b/src/com/reco1l/legacy/engine/VideoTexture.kt @@ -71,7 +71,11 @@ class VideoTexture(val source: String) surface.release() } - { surfaceTexture?.updateTexImage() }.orCatch { isUpdateOnHardwareNeeded = true } + try { + surfaceTexture?.updateTexImage() + } catch (_: Exception) { + isUpdateOnHardwareNeeded = true + } } fun play() = player.start() diff --git a/src/com/reco1l/legacy/ui/DownloadFragment.kt b/src/com/reco1l/legacy/ui/DownloadFragment.kt index 86591a0a6..a3fe74d47 100644 --- a/src/com/reco1l/legacy/ui/DownloadFragment.kt +++ b/src/com/reco1l/legacy/ui/DownloadFragment.kt @@ -6,7 +6,7 @@ import android.widget.Button import android.widget.TextView import com.edlplan.ui.fragment.LoadingFragment import com.google.android.material.progressindicator.CircularProgressIndicator -import com.reco1l.framework.net.Downloader +import com.reco1l.framework.net.FileRequest import ru.nsu.ccfit.zuev.osuplus.R class DownloadFragment : LoadingFragment() { @@ -14,7 +14,7 @@ class DownloadFragment : LoadingFragment() { override val layoutID = R.layout.fragment_downloading - private lateinit var downloader: Downloader + private lateinit var downloader: FileRequest private lateinit var onLoad: Runnable @@ -40,7 +40,7 @@ class DownloadFragment : LoadingFragment() { } - fun setDownloader(downloader: Downloader, onLoad: Runnable) { + fun setDownloader(downloader: FileRequest, onLoad: Runnable) { this.onLoad = onLoad this.downloader = downloader } diff --git a/src/com/reco1l/legacy/ui/beatmapdownloader/BeatmapDownloader.kt b/src/com/reco1l/legacy/ui/beatmapdownloader/BeatmapDownloader.kt index de96fe1f4..0f358356d 100644 --- a/src/com/reco1l/legacy/ui/beatmapdownloader/BeatmapDownloader.kt +++ b/src/com/reco1l/legacy/ui/beatmapdownloader/BeatmapDownloader.kt @@ -2,14 +2,15 @@ package com.reco1l.legacy.ui.beatmapdownloader import android.os.Environment.DIRECTORY_DOWNLOADS import android.view.View -import com.reco1l.framework.extensions.decodeUtf8 -import com.reco1l.framework.extensions.forFilesystem -import com.reco1l.framework.net.Downloader +import com.reco1l.framework.lang.mainThread +import com.reco1l.framework.net.FileRequest import com.reco1l.framework.net.IDownloaderObserver -import com.reco1l.framework.net.SizeMeasure import com.reco1l.legacy.Multiplayer import com.reco1l.legacy.ui.DownloadFragment import com.reco1l.legacy.ui.multiplayer.RoomScene +import com.reco1l.toolkt.kotlin.async +import com.reco1l.toolkt.kotlin.decodeAsURL +import com.reco1l.toolkt.kotlin.replaceAlphanumeric import net.lingala.zip4j.ZipFile import org.apache.commons.io.FilenameUtils import ru.nsu.ccfit.zuev.osu.Config @@ -20,6 +21,7 @@ import ru.nsu.ccfit.zuev.osu.helper.FileUtils import ru.nsu.ccfit.zuev.osu.helper.StringTable import ru.nsu.ccfit.zuev.osuplus.R import java.io.IOException +import java.lang.Exception object BeatmapDownloader : IDownloaderObserver { @@ -41,8 +43,8 @@ object BeatmapDownloader : IDownloaderObserver { } isDownloading = true - val name = suggestedFilename.decodeUtf8() - val filename = name.forFilesystem() + val name = suggestedFilename.decodeAsURL() + val filename = name.replaceAlphanumeric(with = "_") if (!filename.endsWith(".osz")) { ToastLogger.showText("Failed to start download. Invalid file extension", true) @@ -54,7 +56,7 @@ object BeatmapDownloader : IDownloaderObserver { val directory = context.getExternalFilesDir(DIRECTORY_DOWNLOADS) val file = directory?.resolve("$filename.osz")!! - val downloader = Downloader(file, url) + val downloader = FileRequest(file, url) fragment = DownloadFragment() fragment.setDownloader(downloader) { @@ -66,7 +68,14 @@ object BeatmapDownloader : IDownloaderObserver { fragment.button.text = context.getString(R.string.beatmap_downloader_cancel) downloader.observer = this@BeatmapDownloader - downloader.download() + + async { + downloader.execute() + + mainThread { + fragment.text.text = StringTable.format(R.string.beatmap_downloader_downloading, currentFilename) + } + } fragment.button.setOnClickListener { downloader.cancel() @@ -76,14 +85,8 @@ object BeatmapDownloader : IDownloaderObserver { } - override fun onDownloadStart(downloader: Downloader) { - context.runOnUiThread { - fragment.text.text = StringTable.format(R.string.beatmap_downloader_downloading, currentFilename) - } - } - - override fun onDownloadEnd(downloader: Downloader) { - context.runOnUiThread { + override fun onDownloadEnd(downloader: FileRequest) { + mainThread { fragment.progressBar.visibility = View.GONE fragment.progressBar.isIndeterminate = true fragment.progressBar.visibility = View.VISIBLE @@ -97,13 +100,13 @@ object BeatmapDownloader : IDownloaderObserver { try { ZipFile(file).use { if (!it.isValidZipFile) { - context.runOnUiThread(fragment::dismiss) + mainThread(fragment::dismiss) ToastLogger.showText("Import failed, invalid ZIP file.", true) return } if (!FileUtils.extractZip(file.path, Config.getBeatmapPath())) { - context.runOnUiThread(fragment::dismiss) + mainThread(fragment::dismiss) ToastLogger.showText("Import failed, failed to extract ZIP file.", true) return } @@ -114,7 +117,7 @@ object BeatmapDownloader : IDownloaderObserver { ToastLogger.showText("Import failed:" + e.message, true) } - context.runOnUiThread(fragment::dismiss) + mainThread(fragment::dismiss) if (Multiplayer.isConnected) RoomScene.onRoomBeatmapChange(Multiplayer.room!!.beatmap) @@ -122,30 +125,28 @@ object BeatmapDownloader : IDownloaderObserver { isDownloading = false } - override fun onDownloadCancel(downloader: Downloader) { + override fun onDownloadCancel(downloader: FileRequest) { ToastLogger.showText("Download canceled.", true) - context.runOnUiThread(fragment::dismiss) + mainThread(fragment::dismiss) isDownloading = false } - override fun onDownloadUpdate(downloader: Downloader) { + override fun onDownloadUpdate(downloader: FileRequest) { - val info = "\n%.3f kb/s (%d%%)".format(downloader.getSpeed(SizeMeasure.MBPS), downloader.progress.toInt()) + val info = "\n%.3f kb/s (%d%%)".format(downloader.speedKbps / 1024, downloader.progress.toInt()) - context.runOnUiThread { - fragment.text.text = context.getString(R.string.beatmap_downloader_downloading).format( - currentFilename - ) + info + mainThread { + fragment.text.text = context.getString(R.string.beatmap_downloader_downloading).format(currentFilename) + info fragment.progressBar.isIndeterminate = false fragment.progressBar.progress = downloader.progress.toInt() } } - override fun onDownloadFail(downloader: Downloader) { - ToastLogger.showText("Download failed. " + downloader.exception?.message, true) + override fun onDownloadFail(downloader: FileRequest, exception: Exception) { + ToastLogger.showText("Download failed. " + exception.message, true) - context.runOnUiThread(fragment::dismiss) + mainThread(fragment::dismiss) isDownloading = false } } \ No newline at end of file diff --git a/src/com/reco1l/legacy/ui/beatmapdownloader/BeatmapListing.kt b/src/com/reco1l/legacy/ui/beatmapdownloader/BeatmapListing.kt index 34a8001e6..70815d62d 100644 --- a/src/com/reco1l/legacy/ui/beatmapdownloader/BeatmapListing.kt +++ b/src/com/reco1l/legacy/ui/beatmapdownloader/BeatmapListing.kt @@ -19,8 +19,7 @@ import com.google.android.material.progressindicator.CircularProgressIndicator import com.reco1l.framework.bass.URLBassStream import com.reco1l.framework.lang.mainThread import com.reco1l.framework.net.IDownloaderObserver -import com.reco1l.framework.net.JsonRequester -import com.reco1l.framework.net.QueryContent +import com.reco1l.framework.net.JsonArrayRequest import com.reco1l.legacy.ui.OsuColors import kotlinx.coroutines.CoroutineExceptionHandler import kotlinx.coroutines.CoroutineScope @@ -134,16 +133,16 @@ object BeatmapListing : BaseFragment(), mainThread { adapter.notifyItemRangeRemoved(0, itemCount) } } - JsonRequester(mirror.search.endpoint).use { request -> + JsonArrayRequest(mirror.search.endpoint).use { request -> - request.query = QueryContent().apply { + request.buildUrl { - put("mode", 0) - put("query", searchBox.text) - put("offset", offset) + addQueryParameter("mode", "0") + addQueryParameter("query", searchBox.text.toString()) + addQueryParameter("offset", offset.toString()) } - val beatmapSets = mirror.search.mapResponse(request.executeAndGetJson().toArray()!!) + val beatmapSets = mirror.search.mapResponse(request.execute().json) adapter.data.addAll(beatmapSets) mainThread { diff --git a/src/com/reco1l/legacy/ui/multiplayer/LobbyRoomList.kt b/src/com/reco1l/legacy/ui/multiplayer/LobbyRoomList.kt index e1af7ee7f..e956d5848 100644 --- a/src/com/reco1l/legacy/ui/multiplayer/LobbyRoomList.kt +++ b/src/com/reco1l/legacy/ui/multiplayer/LobbyRoomList.kt @@ -9,11 +9,10 @@ import com.reco1l.api.ibancho.data.RoomStatus.* import com.reco1l.api.ibancho.data.TeamMode.HEAD_TO_HEAD import com.reco1l.api.ibancho.data.TeamMode.TEAM_VS_TEAM import com.reco1l.api.ibancho.data.WinCondition.* -import com.reco1l.framework.extensions.className -import com.reco1l.framework.extensions.orAsyncCatch import com.reco1l.framework.lang.mainThread import com.reco1l.legacy.Multiplayer import com.reco1l.legacy.ui.entity.ScrollableList +import com.reco1l.toolkt.kotlin.async import org.anddev.andengine.entity.sprite.Sprite import org.anddev.andengine.entity.text.Text import org.anddev.andengine.input.touch.TouchEvent @@ -66,13 +65,19 @@ class LobbyRoomList : ScrollableList() Multiplayer.log("Trying to connect socket...") LobbyScene.search.dismiss() - LoadingScreen().show(); + LoadingScreen().show() - { RoomAPI.connectToRoom(room.id, getOnline().userId, getOnline().username, password) }.orAsyncCatch { + async { - ToastLogger.showText("Failed to connect to the room: ${it.className} - ${it.message}", true) - Multiplayer.log(it) - LobbyScene.show() + try { + RoomAPI.connectToRoom(room.id, getOnline().userId, getOnline().username, password) + } catch (e: Exception) { + + ToastLogger.showText("Failed to connect to the room: ${e.javaClass} - ${e.message}", true) + Multiplayer.log(e) + + LobbyScene.show() + } } } diff --git a/src/com/reco1l/legacy/ui/multiplayer/LobbyScene.kt b/src/com/reco1l/legacy/ui/multiplayer/LobbyScene.kt index fd37fa9e9..dbee34ce3 100644 --- a/src/com/reco1l/legacy/ui/multiplayer/LobbyScene.kt +++ b/src/com/reco1l/legacy/ui/multiplayer/LobbyScene.kt @@ -1,13 +1,13 @@ package com.reco1l.legacy.ui.multiplayer import android.net.Uri +import android.util.Log import com.dgsrz.bancho.security.SecurityUtils import com.reco1l.api.ibancho.LobbyAPI import com.reco1l.api.ibancho.RoomAPI -import com.reco1l.framework.extensions.className -import com.reco1l.framework.extensions.orAsyncCatch import com.reco1l.framework.lang.updateThread import com.reco1l.legacy.Multiplayer +import com.reco1l.toolkt.kotlin.async import org.anddev.andengine.entity.modifier.LoopEntityModifier import org.anddev.andengine.entity.modifier.RotationByModifier import org.anddev.andengine.entity.primitive.Rectangle @@ -218,27 +218,33 @@ object LobbyScene : Scene() getGlobal().songService.isGaming = true Multiplayer.isMultiplayer = true - { - LoadingScreen().show() + async { + + try { + LoadingScreen().show() + + getGlobal().mainActivity.checkNewSkins() + getGlobal().mainActivity.checkNewBeatmaps() + LibraryManager.INSTANCE.updateLibrary(true) + + RoomScene.load() + load() - getGlobal().mainActivity.checkNewSkins() - getGlobal().mainActivity.checkNewBeatmaps() - LibraryManager.INSTANCE.updateLibrary(true) + val roomID = link.pathSegments[0].toLong() + val password = if (link.pathSegments.size > 1) link.pathSegments[1] else null - RoomScene.load() - load() + RoomAPI.connectToRoom(roomID, getOnline().userId, getOnline().username, password) - val roomID = link.pathSegments[0].toLong() - val password = if (link.pathSegments.size > 1) link.pathSegments[1] else null + } catch (e: Exception) { + ToastLogger.showText("Failed to connect to the room: ${e.javaClass} - ${e.message}", true) + Log.e("LobbyScene", "Failed to connect to room.", e) - RoomAPI.connectToRoom(roomID, getOnline().userId, getOnline().username, password) + back() + } - }.orAsyncCatch { - ToastLogger.showText("Failed to connect to the room: ${it.className} - ${it.message}", true) - it.printStackTrace() - back() } + } // Update events @@ -267,39 +273,45 @@ object LobbyScene : Scene() loading.registerEntityModifier(LoopEntityModifier(RotationByModifier(2f, 360f))) awaitList = true - { - val list = LobbyAPI.getRooms(searchQuery, SecurityUtils.signRequest(searchQuery ?: "")) + async { + + try { + val list = LobbyAPI.getRooms(searchQuery, SecurityUtils.signRequest(searchQuery ?: "")) + + // Updating list + updateThread { + roomList.setList(list) + awaitList = false + val roomCount = roomList.childCount + + // Updating info text + infoText.text = if (searchQuery.isNullOrEmpty()) + { + "Showing $roomCount ${if (roomCount == 1) "match" else "matches"}." + } + else "Searching for \"$searchQuery\", showing $roomCount ${if (roomCount == 1) "result" else "results"}." + } - // Updating list - updateThread { - roomList.setList(list) - awaitList = false - val roomCount = roomList.childCount + // Hiding loading icon + loading.isVisible = false + loading.clearEntityModifiers() - // Updating info text - infoText.text = if (searchQuery.isNullOrEmpty()) - { - "Showing $roomCount ${if (roomCount == 1) "match" else "matches"}." - } - else "Searching for \"$searchQuery\", showing $roomCount ${if (roomCount == 1) "result" else "results"}." - } + // Showing buttons + createButton?.isVisible = true + refreshButton?.isVisible = true - // Hiding loading icon - loading.isVisible = false - loading.clearEntityModifiers() - // Showing buttons - createButton?.isVisible = true - refreshButton?.isVisible = true + } catch (e: Exception) { + awaitList = false - }.orAsyncCatch { + ToastLogger.showText("Multiplayer server is unavailable, try again later.", true) + Log.e("LobbyScene", "Failed to get room list", e) - awaitList = false - it.printStackTrace() + back() + } - back() - ToastLogger.showText("Multiplayer server is unavailable, try again later.", true) } + } private fun updateBackground() diff --git a/src/com/reco1l/legacy/ui/multiplayer/RoomChat.kt b/src/com/reco1l/legacy/ui/multiplayer/RoomChat.kt index 90bfb3c93..bf6391d7a 100644 --- a/src/com/reco1l/legacy/ui/multiplayer/RoomChat.kt +++ b/src/com/reco1l/legacy/ui/multiplayer/RoomChat.kt @@ -26,6 +26,7 @@ import com.reco1l.api.ibancho.data.RoomPlayer import com.reco1l.framework.extensions.orAsyncCatch import com.reco1l.framework.lang.mainThread import com.reco1l.legacy.Multiplayer +import com.reco1l.toolkt.kotlin.async import org.anddev.andengine.input.touch.TouchEvent import ru.nsu.ccfit.zuev.osu.RGBColor import ru.nsu.ccfit.zuev.osu.ResourceManager @@ -144,12 +145,17 @@ class RoomChat : BaseFragment(), OnEditorActionListener, OnKeyListener val message = field?.text.takeUnless { it.isNullOrEmpty() } ?: return field?.text = null - { RoomAPI.sendMessage(message.toString()) }.orAsyncCatch { - onSystemChatMessage("Error to send message: ${it.message}", "#FF0000") - it.printStackTrace() + async { + try { + RoomAPI.sendMessage(message.toString()) + } catch (e: Exception) { + onSystemChatMessage("Error to send message: ${e.message}", "#FF0000") + e.printStackTrace() + } } + } override fun onEditorAction(v: TextView?, actionId: Int, event: KeyEvent?): Boolean diff --git a/src/com/reco1l/legacy/ui/multiplayer/RoomScene.kt b/src/com/reco1l/legacy/ui/multiplayer/RoomScene.kt index 574abdbf8..e2a6b8a41 100644 --- a/src/com/reco1l/legacy/ui/multiplayer/RoomScene.kt +++ b/src/com/reco1l/legacy/ui/multiplayer/RoomScene.kt @@ -11,7 +11,7 @@ import com.reco1l.api.ibancho.data.RoomTeam.RED import com.reco1l.api.ibancho.data.TeamMode.HEAD_TO_HEAD import com.reco1l.api.ibancho.data.TeamMode.TEAM_VS_TEAM import com.reco1l.api.ibancho.data.WinCondition.* -import com.reco1l.framework.extensions.ignoreException +import com.reco1l.toolkt.kotlin.runSafe import com.reco1l.framework.lang.updateThread import com.reco1l.framework.lang.mainThread import com.reco1l.legacy.Multiplayer @@ -636,7 +636,7 @@ object RoomScene : Scene(), IRoomEventListener, IPlayerEventListener // Stopping the attempt loop if user cancels reconnection. Multiplayer.isReconnecting = false - ignoreException { RoomAPI.disconnect() } + runSafe { RoomAPI.disconnect() } clear() LobbyScene.show() } diff --git a/src/com/rian/osu/beatmap/parser/BeatmapParser.kt b/src/com/rian/osu/beatmap/parser/BeatmapParser.kt index 7cdeb6753..ab76b5aff 100644 --- a/src/com/rian/osu/beatmap/parser/BeatmapParser.kt +++ b/src/com/rian/osu/beatmap/parser/BeatmapParser.kt @@ -1,7 +1,7 @@ package com.rian.osu.beatmap.parser import android.util.Log -import com.reco1l.framework.extensions.ignoreException +import com.reco1l.toolkt.kotlin.runSafe import com.rian.osu.GameMode import com.rian.osu.beatmap.Beatmap import com.rian.osu.beatmap.BeatmapProcessor @@ -194,7 +194,7 @@ class BeatmapParser : Closeable { } override fun close() { - ignoreException { source?.close() } + runSafe { source?.close() } source = null } diff --git a/src/ru/nsu/ccfit/zuev/osu/ResourceManager.java b/src/ru/nsu/ccfit/zuev/osu/ResourceManager.java index 6f71b1812..108264c0a 100644 --- a/src/ru/nsu/ccfit/zuev/osu/ResourceManager.java +++ b/src/ru/nsu/ccfit/zuev/osu/ResourceManager.java @@ -7,7 +7,7 @@ import com.dgsrz.bancho.security.SecurityUtils; -import com.reco1l.framework.data.IniReader; +import com.reco1l.framework.IniReader; import com.reco1l.legacy.data.SkinConverter; import com.reco1l.legacy.engine.BlankTextureRegion; import org.anddev.andengine.engine.Engine; From b1b2e857aaa927973124bfdef6413f6cda42de2f Mon Sep 17 00:00:00 2001 From: Reco1l Date: Wed, 24 Apr 2024 23:48:40 -0300 Subject: [PATCH 02/22] Rename 'legacy' package to 'osu' --- .../osu/support/slider/SliderBody2D.java | 2 +- .../edlplan/ui/fragment/FilterMenuFragment.kt | 2 +- .../edlplan/ui/fragment/InGameSettingMenu.kt | 4 ++-- src/com/reco1l/api/ibancho/Parsing.kt | 2 +- src/com/reco1l/api/ibancho/RoomAPI.kt | 2 +- src/com/reco1l/api/ibancho/data/Room.kt | 2 +- src/com/reco1l/api/ibancho/data/RoomMods.kt | 4 ++-- .../{legacy => osu}/AccessibilityDetector.kt | 2 +- .../{framework/lang => osu}/Execution.kt | 2 +- src/com/reco1l/{legacy => osu}/Multiplayer.kt | 9 ++++---- .../reco1l/{legacy => osu}/UpdateManager.kt | 4 +--- .../data/MultiplayerConverter.kt | 2 +- .../{legacy => osu}/data/SkinConverter.kt | 2 +- .../engine/BlankTextureRegion.kt | 2 +- .../{legacy => osu}/engine/VideoSprite.kt | 2 +- .../{legacy => osu}/engine/VideoTexture.kt | 3 +-- src/com/reco1l/{legacy => osu}/ui/Colors.kt | 2 +- .../{legacy => osu}/ui/DownloadFragment.kt | 2 +- src/com/reco1l/{legacy => osu}/ui/MainMenu.kt | 12 +++++----- .../ui/beatmapdownloader/BeatmapDownloader.kt | 10 ++++----- .../ui/beatmapdownloader/BeatmapListing.kt | 6 ++--- .../ui/beatmapdownloader/BeatmapMirror.kt | 2 +- .../ui/beatmapdownloader/BeatmapModel.kt | 2 +- .../ui/entity/BeatmapButton.kt | 12 +++++----- .../{legacy => osu}/ui/entity/ComposedText.kt | 2 +- .../ui/entity/InGameLeaderboard.kt | 4 ++-- .../ui/entity/ScrollableList.kt | 2 +- .../ui/entity/StatisticSelector.kt | 4 ++-- .../ui/multiplayer/LobbyCreateRoom.kt | 6 ++--- .../ui/multiplayer/LobbyRoomList.kt | 8 +++---- .../ui/multiplayer/LobbyScene.kt | 6 ++--- .../ui/multiplayer/LobbySearch.kt | 2 +- .../ui/multiplayer/RoomChat.kt | 7 +++--- .../ui/multiplayer/RoomOptions.kt | 8 +++---- .../ui/multiplayer/RoomPlayerList.kt | 6 ++--- .../ui/multiplayer/RoomPlayerMenu.kt | 4 ++-- .../ui/multiplayer/RoomScene.kt | 22 +++++++++---------- .../osu/ui/DifficultyAlgorithmSwitcher.kt | 4 ++-- src/ru/nsu/ccfit/zuev/osu/AppException.java | 2 +- src/ru/nsu/ccfit/zuev/osu/Config.java | 2 +- src/ru/nsu/ccfit/zuev/osu/LibraryManager.java | 2 +- src/ru/nsu/ccfit/zuev/osu/MainActivity.java | 12 +++++----- src/ru/nsu/ccfit/zuev/osu/MainScene.java | 6 ++--- .../nsu/ccfit/zuev/osu/ResourceManager.java | 4 ++-- .../ccfit/zuev/osu/game/BreakAnimator.java | 4 ++-- .../nsu/ccfit/zuev/osu/game/GameEffect.java | 2 +- src/ru/nsu/ccfit/zuev/osu/game/GameScene.java | 12 +++++----- .../ccfit/zuev/osu/game/ModernSpinner.java | 2 +- src/ru/nsu/ccfit/zuev/osu/game/Slider.java | 2 +- src/ru/nsu/ccfit/zuev/osu/game/Spinner.java | 2 +- src/ru/nsu/ccfit/zuev/osu/menu/ModMenu.java | 8 +++---- .../nsu/ccfit/zuev/osu/menu/ScoreBoard.java | 5 +++-- .../ccfit/zuev/osu/menu/ScoreBoardItem.java | 2 +- .../nsu/ccfit/zuev/osu/menu/SettingsMenu.java | 4 ++-- src/ru/nsu/ccfit/zuev/osu/menu/SongMenu.java | 6 ++--- .../nsu/ccfit/zuev/osu/menu/SplashScene.java | 2 +- .../ccfit/zuev/osu/online/OnlineScoring.java | 6 ++--- .../ccfit/zuev/osu/scoring/ScoringScene.java | 8 +++---- .../ccfit/zuev/osu/scoring/StatisticV2.java | 2 +- 59 files changed, 135 insertions(+), 139 deletions(-) rename src/com/reco1l/{legacy => osu}/AccessibilityDetector.kt (99%) rename src/com/reco1l/{framework/lang => osu}/Execution.kt (96%) rename src/com/reco1l/{legacy => osu}/Multiplayer.kt (97%) rename src/com/reco1l/{legacy => osu}/UpdateManager.kt (98%) rename src/com/reco1l/{legacy => osu}/data/MultiplayerConverter.kt (99%) rename src/com/reco1l/{legacy => osu}/data/SkinConverter.kt (99%) rename src/com/reco1l/{legacy => osu}/engine/BlankTextureRegion.kt (93%) rename src/com/reco1l/{legacy => osu}/engine/VideoSprite.kt (96%) rename src/com/reco1l/{legacy => osu}/engine/VideoTexture.kt (97%) rename src/com/reco1l/{legacy => osu}/ui/Colors.kt (99%) rename src/com/reco1l/{legacy => osu}/ui/DownloadFragment.kt (98%) rename src/com/reco1l/{legacy => osu}/ui/MainMenu.kt (96%) rename src/com/reco1l/{legacy => osu}/ui/beatmapdownloader/BeatmapDownloader.kt (95%) rename src/com/reco1l/{legacy => osu}/ui/beatmapdownloader/BeatmapListing.kt (99%) rename src/com/reco1l/{legacy => osu}/ui/beatmapdownloader/BeatmapMirror.kt (98%) rename src/com/reco1l/{legacy => osu}/ui/beatmapdownloader/BeatmapModel.kt (94%) rename src/com/reco1l/{legacy => osu}/ui/entity/BeatmapButton.kt (94%) rename src/com/reco1l/{legacy => osu}/ui/entity/ComposedText.kt (95%) rename src/com/reco1l/{legacy => osu}/ui/entity/InGameLeaderboard.kt (99%) rename src/com/reco1l/{legacy => osu}/ui/entity/ScrollableList.kt (99%) rename src/com/reco1l/{legacy => osu}/ui/entity/StatisticSelector.kt (98%) rename src/com/reco1l/{legacy => osu}/ui/multiplayer/LobbyCreateRoom.kt (97%) rename src/com/reco1l/{legacy => osu}/ui/multiplayer/LobbyRoomList.kt (97%) rename src/com/reco1l/{legacy => osu}/ui/multiplayer/LobbyScene.kt (98%) rename src/com/reco1l/{legacy => osu}/ui/multiplayer/LobbySearch.kt (99%) rename src/com/reco1l/{legacy => osu}/ui/multiplayer/RoomChat.kt (98%) rename src/com/reco1l/{legacy => osu}/ui/multiplayer/RoomOptions.kt (98%) rename src/com/reco1l/{legacy => osu}/ui/multiplayer/RoomPlayerList.kt (97%) rename src/com/reco1l/{legacy => osu}/ui/multiplayer/RoomPlayerMenu.kt (98%) rename src/com/reco1l/{legacy => osu}/ui/multiplayer/RoomScene.kt (98%) diff --git a/src/com/edlplan/osu/support/slider/SliderBody2D.java b/src/com/edlplan/osu/support/slider/SliderBody2D.java index 58f29e83d..51c763ffc 100644 --- a/src/com/edlplan/osu/support/slider/SliderBody2D.java +++ b/src/com/edlplan/osu/support/slider/SliderBody2D.java @@ -5,7 +5,7 @@ import com.edlplan.andengine.TrianglePack; import com.edlplan.framework.math.Color4; import com.edlplan.framework.math.line.LinePath; -import com.reco1l.framework.lang.Execution; +import com.reco1l.osu.Execution; import org.anddev.andengine.entity.IEntity; import org.anddev.andengine.entity.modifier.*; diff --git a/src/com/edlplan/ui/fragment/FilterMenuFragment.kt b/src/com/edlplan/ui/fragment/FilterMenuFragment.kt index 88abd6ca3..b0b9bcd48 100644 --- a/src/com/edlplan/ui/fragment/FilterMenuFragment.kt +++ b/src/com/edlplan/ui/fragment/FilterMenuFragment.kt @@ -16,7 +16,7 @@ import com.edlplan.framework.easing.Easing import com.edlplan.framework.support.util.Updater import com.edlplan.ui.BaseAnimationListener import com.edlplan.ui.EasingHelper -import com.reco1l.framework.lang.mainThread +import com.reco1l.osu.mainThread import org.anddev.andengine.engine.handler.IUpdateHandler import org.anddev.andengine.entity.scene.Scene import ru.nsu.ccfit.zuev.osu.helper.InputManager diff --git a/src/com/edlplan/ui/fragment/InGameSettingMenu.kt b/src/com/edlplan/ui/fragment/InGameSettingMenu.kt index f85109f64..016af65cd 100644 --- a/src/com/edlplan/ui/fragment/InGameSettingMenu.kt +++ b/src/com/edlplan/ui/fragment/InGameSettingMenu.kt @@ -14,8 +14,8 @@ import com.edlplan.framework.easing.Easing import com.edlplan.framework.math.FMath import com.edlplan.ui.BaseAnimationListener import com.edlplan.ui.EasingHelper -import com.reco1l.framework.lang.mainThread -import com.reco1l.legacy.Multiplayer +import com.reco1l.osu.mainThread +import com.reco1l.osu.Multiplayer import org.anddev.andengine.input.touch.TouchEvent import ru.nsu.ccfit.zuev.osu.Config import ru.nsu.ccfit.zuev.osu.GlobalManager diff --git a/src/com/reco1l/api/ibancho/Parsing.kt b/src/com/reco1l/api/ibancho/Parsing.kt index 9a9264ca0..8b366d903 100644 --- a/src/com/reco1l/api/ibancho/Parsing.kt +++ b/src/com/reco1l/api/ibancho/Parsing.kt @@ -1,7 +1,7 @@ package com.reco1l.api.ibancho import com.reco1l.api.ibancho.data.* -import com.reco1l.legacy.data.stringToMods +import com.reco1l.osu.data.stringToMods import org.json.JSONArray import org.json.JSONObject diff --git a/src/com/reco1l/api/ibancho/RoomAPI.kt b/src/com/reco1l/api/ibancho/RoomAPI.kt index 0cbcce58d..530ee5b21 100644 --- a/src/com/reco1l/api/ibancho/RoomAPI.kt +++ b/src/com/reco1l/api/ibancho/RoomAPI.kt @@ -4,7 +4,7 @@ import com.dgsrz.bancho.security.SecurityUtils import com.reco1l.api.ibancho.data.* import com.reco1l.api.ibancho.data.Room import com.reco1l.api.ibancho.data.RoomTeam -import com.reco1l.legacy.Multiplayer +import com.reco1l.osu.Multiplayer import io.socket.client.IO import io.socket.client.Socket import io.socket.emitter.Emitter.Listener diff --git a/src/com/reco1l/api/ibancho/data/Room.kt b/src/com/reco1l/api/ibancho/data/Room.kt index 5f28bf4bb..fef384ce4 100644 --- a/src/com/reco1l/api/ibancho/data/Room.kt +++ b/src/com/reco1l/api/ibancho/data/Room.kt @@ -1,6 +1,6 @@ package com.reco1l.api.ibancho.data -import com.reco1l.legacy.Multiplayer +import com.reco1l.osu.Multiplayer data class Room( /** diff --git a/src/com/reco1l/api/ibancho/data/RoomMods.kt b/src/com/reco1l/api/ibancho/data/RoomMods.kt index 179af9cf0..9107b36bc 100644 --- a/src/com/reco1l/api/ibancho/data/RoomMods.kt +++ b/src/com/reco1l/api/ibancho/data/RoomMods.kt @@ -1,7 +1,7 @@ package com.reco1l.api.ibancho.data -import com.reco1l.legacy.data.modsToReadable -import com.reco1l.legacy.Multiplayer +import com.reco1l.osu.data.modsToReadable +import com.reco1l.osu.Multiplayer import ru.nsu.ccfit.zuev.osu.game.mods.GameMod import ru.nsu.ccfit.zuev.osu.game.mods.GameMod.* import java.util.* diff --git a/src/com/reco1l/legacy/AccessibilityDetector.kt b/src/com/reco1l/osu/AccessibilityDetector.kt similarity index 99% rename from src/com/reco1l/legacy/AccessibilityDetector.kt rename to src/com/reco1l/osu/AccessibilityDetector.kt index 3d8eaaefe..a95788421 100644 --- a/src/com/reco1l/legacy/AccessibilityDetector.kt +++ b/src/com/reco1l/osu/AccessibilityDetector.kt @@ -1,4 +1,4 @@ -package com.reco1l.legacy +package com.reco1l.osu import android.accessibilityservice.AccessibilityServiceInfo import android.accessibilityservice.AccessibilityServiceInfo.CAPABILITY_CAN_PERFORM_GESTURES diff --git a/src/com/reco1l/framework/lang/Execution.kt b/src/com/reco1l/osu/Execution.kt similarity index 96% rename from src/com/reco1l/framework/lang/Execution.kt rename to src/com/reco1l/osu/Execution.kt index fa4984272..6d33c16a7 100644 --- a/src/com/reco1l/framework/lang/Execution.kt +++ b/src/com/reco1l/osu/Execution.kt @@ -5,7 +5,7 @@ @file:OptIn(DelicateCoroutinesApi::class) @file:JvmName("Execution") -package com.reco1l.framework.lang +package com.reco1l.osu import kotlinx.coroutines.* import kotlinx.coroutines.Runnable diff --git a/src/com/reco1l/legacy/Multiplayer.kt b/src/com/reco1l/osu/Multiplayer.kt similarity index 97% rename from src/com/reco1l/legacy/Multiplayer.kt rename to src/com/reco1l/osu/Multiplayer.kt index 6e03ecd44..a3dfc6b2e 100644 --- a/src/com/reco1l/legacy/Multiplayer.kt +++ b/src/com/reco1l/osu/Multiplayer.kt @@ -1,14 +1,13 @@ -package com.reco1l.legacy +package com.reco1l.osu import android.text.format.DateFormat import android.util.Log import com.reco1l.api.ibancho.RoomAPI import com.reco1l.api.ibancho.data.Room import com.reco1l.api.ibancho.data.RoomPlayer -import com.reco1l.framework.extensions.toDate -import com.reco1l.legacy.data.jsonToScoreboardItem -import com.reco1l.legacy.data.jsonToStatistic -import com.reco1l.legacy.ui.multiplayer.RoomScene +import com.reco1l.osu.data.jsonToScoreboardItem +import com.reco1l.osu.data.jsonToStatistic +import com.reco1l.osu.ui.multiplayer.RoomScene import com.reco1l.toolkt.kotlin.formatTimeMilliseconds import com.reco1l.toolkt.kotlin.fromDate import kotlinx.coroutines.CoroutineScope diff --git a/src/com/reco1l/legacy/UpdateManager.kt b/src/com/reco1l/osu/UpdateManager.kt similarity index 98% rename from src/com/reco1l/legacy/UpdateManager.kt rename to src/com/reco1l/osu/UpdateManager.kt index aff784ac9..a4ed276cc 100644 --- a/src/com/reco1l/legacy/UpdateManager.kt +++ b/src/com/reco1l/osu/UpdateManager.kt @@ -1,4 +1,4 @@ -package com.reco1l.legacy +package com.reco1l.osu import android.content.Intent import android.content.Intent.* @@ -8,8 +8,6 @@ import com.edlplan.ui.fragment.MarkdownFragment import com.google.android.material.snackbar.BaseTransientBottomBar.LENGTH_INDEFINITE import com.google.android.material.snackbar.BaseTransientBottomBar.LENGTH_SHORT import com.google.android.material.snackbar.Snackbar -import com.reco1l.framework.lang.async -import com.reco1l.framework.lang.mainThread import com.reco1l.framework.net.FileRequest import com.reco1l.framework.net.IDownloaderObserver import okhttp3.Request diff --git a/src/com/reco1l/legacy/data/MultiplayerConverter.kt b/src/com/reco1l/osu/data/MultiplayerConverter.kt similarity index 99% rename from src/com/reco1l/legacy/data/MultiplayerConverter.kt rename to src/com/reco1l/osu/data/MultiplayerConverter.kt index e1ff60b63..7327b11c0 100644 --- a/src/com/reco1l/legacy/data/MultiplayerConverter.kt +++ b/src/com/reco1l/osu/data/MultiplayerConverter.kt @@ -1,6 +1,6 @@ @file:JvmName("MultiplayerConverter") -package com.reco1l.legacy.data +package com.reco1l.osu.data import org.json.JSONObject import ru.nsu.ccfit.zuev.osu.game.mods.GameMod diff --git a/src/com/reco1l/legacy/data/SkinConverter.kt b/src/com/reco1l/osu/data/SkinConverter.kt similarity index 99% rename from src/com/reco1l/legacy/data/SkinConverter.kt rename to src/com/reco1l/osu/data/SkinConverter.kt index 86ce9c04f..267b069af 100644 --- a/src/com/reco1l/legacy/data/SkinConverter.kt +++ b/src/com/reco1l/osu/data/SkinConverter.kt @@ -1,6 +1,6 @@ @file:JvmName("SkinConverter") -package com.reco1l.legacy.data +package com.reco1l.osu.data import android.graphics.Bitmap import android.graphics.Bitmap.CompressFormat diff --git a/src/com/reco1l/legacy/engine/BlankTextureRegion.kt b/src/com/reco1l/osu/engine/BlankTextureRegion.kt similarity index 93% rename from src/com/reco1l/legacy/engine/BlankTextureRegion.kt rename to src/com/reco1l/osu/engine/BlankTextureRegion.kt index 04b3adb75..37411baf2 100644 --- a/src/com/reco1l/legacy/engine/BlankTextureRegion.kt +++ b/src/com/reco1l/osu/engine/BlankTextureRegion.kt @@ -1,4 +1,4 @@ -package com.reco1l.legacy.engine +package com.reco1l.osu.engine import org.anddev.andengine.opengl.texture.Texture import org.anddev.andengine.opengl.texture.TextureOptions diff --git a/src/com/reco1l/legacy/engine/VideoSprite.kt b/src/com/reco1l/osu/engine/VideoSprite.kt similarity index 96% rename from src/com/reco1l/legacy/engine/VideoSprite.kt rename to src/com/reco1l/osu/engine/VideoSprite.kt index 31d126222..8b1a9d061 100644 --- a/src/com/reco1l/legacy/engine/VideoSprite.kt +++ b/src/com/reco1l/osu/engine/VideoSprite.kt @@ -1,4 +1,4 @@ -package com.reco1l.legacy.engine +package com.reco1l.osu.engine import android.opengl.GLES11Ext.GL_TEXTURE_EXTERNAL_OES import org.anddev.andengine.engine.Engine diff --git a/src/com/reco1l/legacy/engine/VideoTexture.kt b/src/com/reco1l/osu/engine/VideoTexture.kt similarity index 97% rename from src/com/reco1l/legacy/engine/VideoTexture.kt rename to src/com/reco1l/osu/engine/VideoTexture.kt index d3a386908..519554d5c 100644 --- a/src/com/reco1l/legacy/engine/VideoTexture.kt +++ b/src/com/reco1l/osu/engine/VideoTexture.kt @@ -1,11 +1,10 @@ -package com.reco1l.legacy.engine +package com.reco1l.osu.engine import android.graphics.SurfaceTexture import android.media.MediaPlayer import android.opengl.GLES11Ext.GL_TEXTURE_EXTERNAL_OES import android.os.Build import android.view.Surface -import com.reco1l.framework.extensions.orCatch import org.anddev.andengine.opengl.texture.Texture import org.anddev.andengine.opengl.texture.TextureOptions import org.anddev.andengine.opengl.texture.region.TextureRegion diff --git a/src/com/reco1l/legacy/ui/Colors.kt b/src/com/reco1l/osu/ui/Colors.kt similarity index 99% rename from src/com/reco1l/legacy/ui/Colors.kt rename to src/com/reco1l/osu/ui/Colors.kt index eb9da6917..e042ef424 100644 --- a/src/com/reco1l/legacy/ui/Colors.kt +++ b/src/com/reco1l/osu/ui/Colors.kt @@ -1,4 +1,4 @@ -package com.reco1l.legacy.ui +package com.reco1l.osu.ui import android.graphics.Color import org.anddev.andengine.util.modifier.ease.EaseLinear diff --git a/src/com/reco1l/legacy/ui/DownloadFragment.kt b/src/com/reco1l/osu/ui/DownloadFragment.kt similarity index 98% rename from src/com/reco1l/legacy/ui/DownloadFragment.kt rename to src/com/reco1l/osu/ui/DownloadFragment.kt index a3fe74d47..424203be6 100644 --- a/src/com/reco1l/legacy/ui/DownloadFragment.kt +++ b/src/com/reco1l/osu/ui/DownloadFragment.kt @@ -1,4 +1,4 @@ -package com.reco1l.legacy.ui +package com.reco1l.osu.ui import android.text.TextUtils import android.view.View diff --git a/src/com/reco1l/legacy/ui/MainMenu.kt b/src/com/reco1l/osu/ui/MainMenu.kt similarity index 96% rename from src/com/reco1l/legacy/ui/MainMenu.kt rename to src/com/reco1l/osu/ui/MainMenu.kt index a433cb82a..10ca1fc91 100644 --- a/src/com/reco1l/legacy/ui/MainMenu.kt +++ b/src/com/reco1l/osu/ui/MainMenu.kt @@ -1,10 +1,10 @@ -package com.reco1l.legacy.ui +package com.reco1l.osu.ui -import com.reco1l.framework.lang.async -import com.reco1l.legacy.ui.multiplayer.LobbyScene -import com.reco1l.legacy.Multiplayer -import com.reco1l.legacy.ui.beatmapdownloader.BeatmapListing -import com.reco1l.legacy.ui.multiplayer.RoomScene +import com.reco1l.osu.async +import com.reco1l.osu.ui.multiplayer.LobbyScene +import com.reco1l.osu.Multiplayer +import com.reco1l.osu.ui.beatmapdownloader.BeatmapListing +import com.reco1l.osu.ui.multiplayer.RoomScene import org.anddev.andengine.input.touch.TouchEvent import ru.nsu.ccfit.zuev.osu.LibraryManager import ru.nsu.ccfit.zuev.osu.MainScene diff --git a/src/com/reco1l/legacy/ui/beatmapdownloader/BeatmapDownloader.kt b/src/com/reco1l/osu/ui/beatmapdownloader/BeatmapDownloader.kt similarity index 95% rename from src/com/reco1l/legacy/ui/beatmapdownloader/BeatmapDownloader.kt rename to src/com/reco1l/osu/ui/beatmapdownloader/BeatmapDownloader.kt index 0f358356d..dce296a80 100644 --- a/src/com/reco1l/legacy/ui/beatmapdownloader/BeatmapDownloader.kt +++ b/src/com/reco1l/osu/ui/beatmapdownloader/BeatmapDownloader.kt @@ -1,13 +1,13 @@ -package com.reco1l.legacy.ui.beatmapdownloader +package com.reco1l.osu.ui.beatmapdownloader import android.os.Environment.DIRECTORY_DOWNLOADS import android.view.View -import com.reco1l.framework.lang.mainThread +import com.reco1l.osu.mainThread import com.reco1l.framework.net.FileRequest import com.reco1l.framework.net.IDownloaderObserver -import com.reco1l.legacy.Multiplayer -import com.reco1l.legacy.ui.DownloadFragment -import com.reco1l.legacy.ui.multiplayer.RoomScene +import com.reco1l.osu.Multiplayer +import com.reco1l.osu.ui.DownloadFragment +import com.reco1l.osu.ui.multiplayer.RoomScene import com.reco1l.toolkt.kotlin.async import com.reco1l.toolkt.kotlin.decodeAsURL import com.reco1l.toolkt.kotlin.replaceAlphanumeric diff --git a/src/com/reco1l/legacy/ui/beatmapdownloader/BeatmapListing.kt b/src/com/reco1l/osu/ui/beatmapdownloader/BeatmapListing.kt similarity index 99% rename from src/com/reco1l/legacy/ui/beatmapdownloader/BeatmapListing.kt rename to src/com/reco1l/osu/ui/beatmapdownloader/BeatmapListing.kt index 70815d62d..f66664770 100644 --- a/src/com/reco1l/legacy/ui/beatmapdownloader/BeatmapListing.kt +++ b/src/com/reco1l/osu/ui/beatmapdownloader/BeatmapListing.kt @@ -1,4 +1,4 @@ -package com.reco1l.legacy.ui.beatmapdownloader +package com.reco1l.osu.ui.beatmapdownloader import android.graphics.BitmapFactory import android.util.Log @@ -17,10 +17,10 @@ import androidx.recyclerview.widget.RecyclerView.OnScrollListener import com.edlplan.ui.fragment.BaseFragment import com.google.android.material.progressindicator.CircularProgressIndicator import com.reco1l.framework.bass.URLBassStream -import com.reco1l.framework.lang.mainThread +import com.reco1l.osu.mainThread import com.reco1l.framework.net.IDownloaderObserver import com.reco1l.framework.net.JsonArrayRequest -import com.reco1l.legacy.ui.OsuColors +import com.reco1l.osu.ui.OsuColors import kotlinx.coroutines.CoroutineExceptionHandler import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.Dispatchers diff --git a/src/com/reco1l/legacy/ui/beatmapdownloader/BeatmapMirror.kt b/src/com/reco1l/osu/ui/beatmapdownloader/BeatmapMirror.kt similarity index 98% rename from src/com/reco1l/legacy/ui/beatmapdownloader/BeatmapMirror.kt rename to src/com/reco1l/osu/ui/beatmapdownloader/BeatmapMirror.kt index d4ac9de52..b6855765e 100644 --- a/src/com/reco1l/legacy/ui/beatmapdownloader/BeatmapMirror.kt +++ b/src/com/reco1l/osu/ui/beatmapdownloader/BeatmapMirror.kt @@ -1,4 +1,4 @@ -package com.reco1l.legacy.ui.beatmapdownloader +package com.reco1l.osu.ui.beatmapdownloader import org.json.JSONArray import ru.nsu.ccfit.zuev.osu.RankedStatus diff --git a/src/com/reco1l/legacy/ui/beatmapdownloader/BeatmapModel.kt b/src/com/reco1l/osu/ui/beatmapdownloader/BeatmapModel.kt similarity index 94% rename from src/com/reco1l/legacy/ui/beatmapdownloader/BeatmapModel.kt rename to src/com/reco1l/osu/ui/beatmapdownloader/BeatmapModel.kt index b091816cb..385db8bac 100644 --- a/src/com/reco1l/legacy/ui/beatmapdownloader/BeatmapModel.kt +++ b/src/com/reco1l/osu/ui/beatmapdownloader/BeatmapModel.kt @@ -1,4 +1,4 @@ -package com.reco1l.legacy.ui.beatmapdownloader +package com.reco1l.osu.ui.beatmapdownloader import ru.nsu.ccfit.zuev.osu.RankedStatus diff --git a/src/com/reco1l/legacy/ui/entity/BeatmapButton.kt b/src/com/reco1l/osu/ui/entity/BeatmapButton.kt similarity index 94% rename from src/com/reco1l/legacy/ui/entity/BeatmapButton.kt rename to src/com/reco1l/osu/ui/entity/BeatmapButton.kt index 7b6f392e4..18c822248 100644 --- a/src/com/reco1l/legacy/ui/entity/BeatmapButton.kt +++ b/src/com/reco1l/osu/ui/entity/BeatmapButton.kt @@ -1,13 +1,13 @@ -package com.reco1l.legacy.ui.entity +package com.reco1l.osu.ui.entity import com.reco1l.api.ibancho.RoomAPI import com.reco1l.api.ibancho.data.PlayerStatus.READY import com.reco1l.api.ibancho.data.RoomBeatmap -import com.reco1l.framework.lang.async -import com.reco1l.legacy.Multiplayer -import com.reco1l.legacy.ui.beatmapdownloader.BeatmapDownloader -import com.reco1l.legacy.ui.beatmapdownloader.BeatmapListing -import com.reco1l.legacy.ui.multiplayer.RoomScene +import com.reco1l.osu.async +import com.reco1l.osu.Multiplayer +import com.reco1l.osu.ui.beatmapdownloader.BeatmapDownloader +import com.reco1l.osu.ui.beatmapdownloader.BeatmapListing +import com.reco1l.osu.ui.multiplayer.RoomScene import org.anddev.andengine.entity.sprite.Sprite import org.anddev.andengine.entity.text.ChangeableText import org.anddev.andengine.input.touch.TouchEvent diff --git a/src/com/reco1l/legacy/ui/entity/ComposedText.kt b/src/com/reco1l/osu/ui/entity/ComposedText.kt similarity index 95% rename from src/com/reco1l/legacy/ui/entity/ComposedText.kt rename to src/com/reco1l/osu/ui/entity/ComposedText.kt index eaa0d4ad6..af698c70b 100644 --- a/src/com/reco1l/legacy/ui/entity/ComposedText.kt +++ b/src/com/reco1l/osu/ui/entity/ComposedText.kt @@ -1,4 +1,4 @@ -package com.reco1l.legacy.ui.entity +package com.reco1l.osu.ui.entity import org.anddev.andengine.entity.Entity import org.anddev.andengine.entity.text.ChangeableText diff --git a/src/com/reco1l/legacy/ui/entity/InGameLeaderboard.kt b/src/com/reco1l/osu/ui/entity/InGameLeaderboard.kt similarity index 99% rename from src/com/reco1l/legacy/ui/entity/InGameLeaderboard.kt rename to src/com/reco1l/osu/ui/entity/InGameLeaderboard.kt index d8b0bf5f2..a5fbc8055 100644 --- a/src/com/reco1l/legacy/ui/entity/InGameLeaderboard.kt +++ b/src/com/reco1l/osu/ui/entity/InGameLeaderboard.kt @@ -1,7 +1,7 @@ -package com.reco1l.legacy.ui.entity +package com.reco1l.osu.ui.entity import android.opengl.GLES20 -import com.reco1l.legacy.Multiplayer.isMultiplayer +import com.reco1l.osu.Multiplayer.isMultiplayer import org.anddev.andengine.entity.Entity import org.anddev.andengine.entity.sprite.Sprite import org.anddev.andengine.entity.text.ChangeableText diff --git a/src/com/reco1l/legacy/ui/entity/ScrollableList.kt b/src/com/reco1l/osu/ui/entity/ScrollableList.kt similarity index 99% rename from src/com/reco1l/legacy/ui/entity/ScrollableList.kt rename to src/com/reco1l/osu/ui/entity/ScrollableList.kt index ae487146e..790f9a1ac 100644 --- a/src/com/reco1l/legacy/ui/entity/ScrollableList.kt +++ b/src/com/reco1l/osu/ui/entity/ScrollableList.kt @@ -1,4 +1,4 @@ -package com.reco1l.legacy.ui.entity +package com.reco1l.osu.ui.entity import org.anddev.andengine.entity.scene.Scene import org.anddev.andengine.entity.shape.Shape diff --git a/src/com/reco1l/legacy/ui/entity/StatisticSelector.kt b/src/com/reco1l/osu/ui/entity/StatisticSelector.kt similarity index 98% rename from src/com/reco1l/legacy/ui/entity/StatisticSelector.kt rename to src/com/reco1l/osu/ui/entity/StatisticSelector.kt index 16e4408b6..89121f02f 100644 --- a/src/com/reco1l/legacy/ui/entity/StatisticSelector.kt +++ b/src/com/reco1l/osu/ui/entity/StatisticSelector.kt @@ -1,8 +1,8 @@ -package com.reco1l.legacy.ui.entity +package com.reco1l.osu.ui.entity import android.opengl.GLES20 import com.reco1l.api.ibancho.data.WinCondition.ACCURACY -import com.reco1l.legacy.Multiplayer +import com.reco1l.osu.Multiplayer import org.anddev.andengine.entity.scene.Scene.ITouchArea import org.anddev.andengine.entity.sprite.Sprite import org.anddev.andengine.entity.text.ChangeableText diff --git a/src/com/reco1l/legacy/ui/multiplayer/LobbyCreateRoom.kt b/src/com/reco1l/osu/ui/multiplayer/LobbyCreateRoom.kt similarity index 97% rename from src/com/reco1l/legacy/ui/multiplayer/LobbyCreateRoom.kt rename to src/com/reco1l/osu/ui/multiplayer/LobbyCreateRoom.kt index 566d2b129..4f3a5e02c 100644 --- a/src/com/reco1l/legacy/ui/multiplayer/LobbyCreateRoom.kt +++ b/src/com/reco1l/osu/ui/multiplayer/LobbyCreateRoom.kt @@ -1,4 +1,4 @@ -package com.reco1l.legacy.ui.multiplayer +package com.reco1l.osu.ui.multiplayer import android.animation.Animator import android.view.View @@ -14,8 +14,8 @@ import com.edlplan.ui.fragment.BaseFragment import com.reco1l.api.ibancho.LobbyAPI import com.reco1l.api.ibancho.RoomAPI import com.reco1l.api.ibancho.data.RoomBeatmap -import com.reco1l.framework.lang.async -import com.reco1l.framework.lang.mainThread +import com.reco1l.osu.async +import com.reco1l.osu.mainThread import ru.nsu.ccfit.zuev.osu.ToastLogger import ru.nsu.ccfit.zuev.osu.menu.LoadingScreen import ru.nsu.ccfit.zuev.osuplus.R diff --git a/src/com/reco1l/legacy/ui/multiplayer/LobbyRoomList.kt b/src/com/reco1l/osu/ui/multiplayer/LobbyRoomList.kt similarity index 97% rename from src/com/reco1l/legacy/ui/multiplayer/LobbyRoomList.kt rename to src/com/reco1l/osu/ui/multiplayer/LobbyRoomList.kt index e956d5848..3901685aa 100644 --- a/src/com/reco1l/legacy/ui/multiplayer/LobbyRoomList.kt +++ b/src/com/reco1l/osu/ui/multiplayer/LobbyRoomList.kt @@ -1,4 +1,4 @@ -package com.reco1l.legacy.ui.multiplayer +package com.reco1l.osu.ui.multiplayer import android.app.AlertDialog import android.view.inputmethod.EditorInfo @@ -9,9 +9,9 @@ import com.reco1l.api.ibancho.data.RoomStatus.* import com.reco1l.api.ibancho.data.TeamMode.HEAD_TO_HEAD import com.reco1l.api.ibancho.data.TeamMode.TEAM_VS_TEAM import com.reco1l.api.ibancho.data.WinCondition.* -import com.reco1l.framework.lang.mainThread -import com.reco1l.legacy.Multiplayer -import com.reco1l.legacy.ui.entity.ScrollableList +import com.reco1l.osu.mainThread +import com.reco1l.osu.Multiplayer +import com.reco1l.osu.ui.entity.ScrollableList import com.reco1l.toolkt.kotlin.async import org.anddev.andengine.entity.sprite.Sprite import org.anddev.andengine.entity.text.Text diff --git a/src/com/reco1l/legacy/ui/multiplayer/LobbyScene.kt b/src/com/reco1l/osu/ui/multiplayer/LobbyScene.kt similarity index 98% rename from src/com/reco1l/legacy/ui/multiplayer/LobbyScene.kt rename to src/com/reco1l/osu/ui/multiplayer/LobbyScene.kt index dbee34ce3..347ce8387 100644 --- a/src/com/reco1l/legacy/ui/multiplayer/LobbyScene.kt +++ b/src/com/reco1l/osu/ui/multiplayer/LobbyScene.kt @@ -1,12 +1,12 @@ -package com.reco1l.legacy.ui.multiplayer +package com.reco1l.osu.ui.multiplayer import android.net.Uri import android.util.Log import com.dgsrz.bancho.security.SecurityUtils import com.reco1l.api.ibancho.LobbyAPI import com.reco1l.api.ibancho.RoomAPI -import com.reco1l.framework.lang.updateThread -import com.reco1l.legacy.Multiplayer +import com.reco1l.osu.updateThread +import com.reco1l.osu.Multiplayer import com.reco1l.toolkt.kotlin.async import org.anddev.andengine.entity.modifier.LoopEntityModifier import org.anddev.andengine.entity.modifier.RotationByModifier diff --git a/src/com/reco1l/legacy/ui/multiplayer/LobbySearch.kt b/src/com/reco1l/osu/ui/multiplayer/LobbySearch.kt similarity index 99% rename from src/com/reco1l/legacy/ui/multiplayer/LobbySearch.kt rename to src/com/reco1l/osu/ui/multiplayer/LobbySearch.kt index d9907bd81..29bf0dab5 100644 --- a/src/com/reco1l/legacy/ui/multiplayer/LobbySearch.kt +++ b/src/com/reco1l/osu/ui/multiplayer/LobbySearch.kt @@ -1,4 +1,4 @@ -package com.reco1l.legacy.ui.multiplayer +package com.reco1l.osu.ui.multiplayer import android.animation.Animator import android.annotation.SuppressLint diff --git a/src/com/reco1l/legacy/ui/multiplayer/RoomChat.kt b/src/com/reco1l/osu/ui/multiplayer/RoomChat.kt similarity index 98% rename from src/com/reco1l/legacy/ui/multiplayer/RoomChat.kt rename to src/com/reco1l/osu/ui/multiplayer/RoomChat.kt index bf6391d7a..3785f6a71 100644 --- a/src/com/reco1l/legacy/ui/multiplayer/RoomChat.kt +++ b/src/com/reco1l/osu/ui/multiplayer/RoomChat.kt @@ -1,4 +1,4 @@ -package com.reco1l.legacy.ui.multiplayer +package com.reco1l.osu.ui.multiplayer import android.animation.Animator import android.annotation.SuppressLint @@ -23,9 +23,8 @@ import com.edlplan.ui.EasingHelper import com.edlplan.ui.fragment.BaseFragment import com.reco1l.api.ibancho.RoomAPI import com.reco1l.api.ibancho.data.RoomPlayer -import com.reco1l.framework.extensions.orAsyncCatch -import com.reco1l.framework.lang.mainThread -import com.reco1l.legacy.Multiplayer +import com.reco1l.osu.mainThread +import com.reco1l.osu.Multiplayer import com.reco1l.toolkt.kotlin.async import org.anddev.andengine.input.touch.TouchEvent import ru.nsu.ccfit.zuev.osu.RGBColor diff --git a/src/com/reco1l/legacy/ui/multiplayer/RoomOptions.kt b/src/com/reco1l/osu/ui/multiplayer/RoomOptions.kt similarity index 98% rename from src/com/reco1l/legacy/ui/multiplayer/RoomOptions.kt rename to src/com/reco1l/osu/ui/multiplayer/RoomOptions.kt index fac735017..2cc8cb96e 100644 --- a/src/com/reco1l/legacy/ui/multiplayer/RoomOptions.kt +++ b/src/com/reco1l/osu/ui/multiplayer/RoomOptions.kt @@ -1,4 +1,4 @@ -package com.reco1l.legacy.ui.multiplayer +package com.reco1l.osu.ui.multiplayer import android.animation.Animator import android.content.ClipData @@ -27,9 +27,9 @@ import com.reco1l.api.ibancho.RoomAPI import com.reco1l.api.ibancho.data.RoomTeam import com.reco1l.api.ibancho.data.TeamMode import com.reco1l.api.ibancho.data.WinCondition -import com.reco1l.framework.lang.async -import com.reco1l.framework.lang.mainThread -import com.reco1l.legacy.Multiplayer +import com.reco1l.osu.async +import com.reco1l.osu.mainThread +import com.reco1l.osu.Multiplayer import ru.nsu.ccfit.zuev.osu.Config import ru.nsu.ccfit.zuev.osu.MainActivity import ru.nsu.ccfit.zuev.osu.ToastLogger diff --git a/src/com/reco1l/legacy/ui/multiplayer/RoomPlayerList.kt b/src/com/reco1l/osu/ui/multiplayer/RoomPlayerList.kt similarity index 97% rename from src/com/reco1l/legacy/ui/multiplayer/RoomPlayerList.kt rename to src/com/reco1l/osu/ui/multiplayer/RoomPlayerList.kt index 5e331b346..57daa5196 100644 --- a/src/com/reco1l/legacy/ui/multiplayer/RoomPlayerList.kt +++ b/src/com/reco1l/osu/ui/multiplayer/RoomPlayerList.kt @@ -1,10 +1,10 @@ -package com.reco1l.legacy.ui.multiplayer +package com.reco1l.osu.ui.multiplayer import com.reco1l.api.ibancho.data.* import com.reco1l.api.ibancho.data.PlayerStatus.* import com.reco1l.api.ibancho.data.RoomTeam.* -import com.reco1l.legacy.Multiplayer -import com.reco1l.legacy.ui.entity.ScrollableList +import com.reco1l.osu.Multiplayer +import com.reco1l.osu.ui.entity.ScrollableList import org.anddev.andengine.entity.primitive.Rectangle import org.anddev.andengine.entity.sprite.Sprite import org.anddev.andengine.entity.text.ChangeableText diff --git a/src/com/reco1l/legacy/ui/multiplayer/RoomPlayerMenu.kt b/src/com/reco1l/osu/ui/multiplayer/RoomPlayerMenu.kt similarity index 98% rename from src/com/reco1l/legacy/ui/multiplayer/RoomPlayerMenu.kt rename to src/com/reco1l/osu/ui/multiplayer/RoomPlayerMenu.kt index e9555a92c..0ab08d608 100644 --- a/src/com/reco1l/legacy/ui/multiplayer/RoomPlayerMenu.kt +++ b/src/com/reco1l/osu/ui/multiplayer/RoomPlayerMenu.kt @@ -1,4 +1,4 @@ -package com.reco1l.legacy.ui.multiplayer +package com.reco1l.osu.ui.multiplayer import android.animation.Animator import android.app.AlertDialog @@ -11,7 +11,7 @@ import com.edlplan.ui.fragment.BaseFragment import com.edlplan.ui.fragment.WebViewFragment import com.reco1l.api.ibancho.RoomAPI import com.reco1l.api.ibancho.data.RoomPlayer -import com.reco1l.legacy.Multiplayer +import com.reco1l.osu.Multiplayer import ru.nsu.ccfit.zuev.osuplus.R import ru.nsu.ccfit.zuev.osu.GlobalManager.getInstance as getGlobal diff --git a/src/com/reco1l/legacy/ui/multiplayer/RoomScene.kt b/src/com/reco1l/osu/ui/multiplayer/RoomScene.kt similarity index 98% rename from src/com/reco1l/legacy/ui/multiplayer/RoomScene.kt rename to src/com/reco1l/osu/ui/multiplayer/RoomScene.kt index e2a6b8a41..1ed04e2d0 100644 --- a/src/com/reco1l/legacy/ui/multiplayer/RoomScene.kt +++ b/src/com/reco1l/osu/ui/multiplayer/RoomScene.kt @@ -1,4 +1,4 @@ -package com.reco1l.legacy.ui.multiplayer +package com.reco1l.osu.ui.multiplayer import android.app.AlertDialog import com.reco1l.api.ibancho.IPlayerEventListener @@ -12,16 +12,16 @@ import com.reco1l.api.ibancho.data.TeamMode.HEAD_TO_HEAD import com.reco1l.api.ibancho.data.TeamMode.TEAM_VS_TEAM import com.reco1l.api.ibancho.data.WinCondition.* import com.reco1l.toolkt.kotlin.runSafe -import com.reco1l.framework.lang.updateThread -import com.reco1l.framework.lang.mainThread -import com.reco1l.legacy.Multiplayer -import com.reco1l.legacy.Multiplayer.isConnected -import com.reco1l.legacy.Multiplayer.isRoomHost -import com.reco1l.legacy.Multiplayer.player -import com.reco1l.legacy.Multiplayer.room -import com.reco1l.legacy.data.modsToString -import com.reco1l.legacy.ui.entity.BeatmapButton -import com.reco1l.legacy.ui.entity.ComposedText +import com.reco1l.osu.updateThread +import com.reco1l.osu.mainThread +import com.reco1l.osu.Multiplayer +import com.reco1l.osu.Multiplayer.isConnected +import com.reco1l.osu.Multiplayer.isRoomHost +import com.reco1l.osu.Multiplayer.player +import com.reco1l.osu.Multiplayer.room +import com.reco1l.osu.data.modsToString +import com.reco1l.osu.ui.entity.BeatmapButton +import com.reco1l.osu.ui.entity.ComposedText import com.rian.osu.ui.DifficultyAlgorithmSwitcher import org.anddev.andengine.engine.camera.SmoothCamera import org.anddev.andengine.entity.primitive.Rectangle diff --git a/src/com/rian/osu/ui/DifficultyAlgorithmSwitcher.kt b/src/com/rian/osu/ui/DifficultyAlgorithmSwitcher.kt index d6e2b348d..d0f1f8ca1 100644 --- a/src/com/rian/osu/ui/DifficultyAlgorithmSwitcher.kt +++ b/src/com/rian/osu/ui/DifficultyAlgorithmSwitcher.kt @@ -1,7 +1,7 @@ package com.rian.osu.ui -import com.reco1l.legacy.Multiplayer -import com.reco1l.legacy.ui.multiplayer.RoomScene +import com.reco1l.osu.Multiplayer +import com.reco1l.osu.ui.multiplayer.RoomScene import org.anddev.andengine.input.touch.TouchEvent import org.anddev.andengine.util.MathUtils import ru.nsu.ccfit.zuev.osu.Config diff --git a/src/ru/nsu/ccfit/zuev/osu/AppException.java b/src/ru/nsu/ccfit/zuev/osu/AppException.java index e74eb2b21..532047757 100644 --- a/src/ru/nsu/ccfit/zuev/osu/AppException.java +++ b/src/ru/nsu/ccfit/zuev/osu/AppException.java @@ -13,7 +13,7 @@ import android.util.Log; import android.widget.Toast; -import com.reco1l.legacy.Multiplayer; +import com.reco1l.osu.Multiplayer; import org.apache.http.HttpException; import org.json.JSONException; import org.json.JSONObject; diff --git a/src/ru/nsu/ccfit/zuev/osu/Config.java b/src/ru/nsu/ccfit/zuev/osu/Config.java index 8db83669b..165adb905 100644 --- a/src/ru/nsu/ccfit/zuev/osu/Config.java +++ b/src/ru/nsu/ccfit/zuev/osu/Config.java @@ -18,7 +18,7 @@ import java.util.Map; import java.util.UUID; -import com.reco1l.legacy.Multiplayer; +import com.reco1l.osu.Multiplayer; import net.margaritov.preference.colorpicker.ColorPickerPreference; import org.anddev.andengine.util.Debug; diff --git a/src/ru/nsu/ccfit/zuev/osu/LibraryManager.java b/src/ru/nsu/ccfit/zuev/osu/LibraryManager.java index 246d177c9..ada396bed 100644 --- a/src/ru/nsu/ccfit/zuev/osu/LibraryManager.java +++ b/src/ru/nsu/ccfit/zuev/osu/LibraryManager.java @@ -1,7 +1,7 @@ package ru.nsu.ccfit.zuev.osu; import android.os.Build; -import com.reco1l.legacy.engine.VideoTexture; +import com.reco1l.osu.engine.VideoTexture; import com.rian.osu.beatmap.parser.BeatmapParser; import org.anddev.andengine.util.Debug; import org.jetbrains.annotations.Nullable; diff --git a/src/ru/nsu/ccfit/zuev/osu/MainActivity.java b/src/ru/nsu/ccfit/zuev/osu/MainActivity.java index b960820c5..969c10316 100644 --- a/src/ru/nsu/ccfit/zuev/osu/MainActivity.java +++ b/src/ru/nsu/ccfit/zuev/osu/MainActivity.java @@ -42,12 +42,12 @@ import com.google.firebase.analytics.FirebaseAnalytics; import com.google.firebase.crashlytics.FirebaseCrashlytics; import com.reco1l.api.ibancho.LobbyAPI; -import com.reco1l.framework.lang.Execution; -import com.reco1l.legacy.AccessibilityDetector; -import com.reco1l.legacy.Multiplayer; -import com.reco1l.legacy.UpdateManager; -import com.reco1l.legacy.ui.multiplayer.LobbyScene; -import com.reco1l.legacy.ui.multiplayer.RoomScene; +import com.reco1l.osu.AccessibilityDetector; +import com.reco1l.osu.Execution; +import com.reco1l.osu.Multiplayer; +import com.reco1l.osu.UpdateManager; +import com.reco1l.osu.ui.multiplayer.LobbyScene; +import com.reco1l.osu.ui.multiplayer.RoomScene; import com.rian.osu.difficulty.BeatmapDifficultyCalculator; import net.lingala.zip4j.ZipFile; diff --git a/src/ru/nsu/ccfit/zuev/osu/MainScene.java b/src/ru/nsu/ccfit/zuev/osu/MainScene.java index ca88a1acc..1f6eacf32 100644 --- a/src/ru/nsu/ccfit/zuev/osu/MainScene.java +++ b/src/ru/nsu/ccfit/zuev/osu/MainScene.java @@ -8,10 +8,10 @@ import android.util.Log; import com.edlplan.ui.fragment.ConfirmDialogFragment; -import com.reco1l.framework.lang.Execution; -import com.reco1l.legacy.ui.MainMenu; +import com.reco1l.osu.Execution; +import com.reco1l.osu.ui.MainMenu; -import com.reco1l.legacy.ui.beatmapdownloader.BeatmapListing; +import com.reco1l.osu.ui.beatmapdownloader.BeatmapListing; import com.rian.osu.beatmap.parser.BeatmapParser; import org.anddev.andengine.engine.handler.IUpdateHandler; import org.anddev.andengine.entity.IEntity; diff --git a/src/ru/nsu/ccfit/zuev/osu/ResourceManager.java b/src/ru/nsu/ccfit/zuev/osu/ResourceManager.java index 108264c0a..da52e8572 100644 --- a/src/ru/nsu/ccfit/zuev/osu/ResourceManager.java +++ b/src/ru/nsu/ccfit/zuev/osu/ResourceManager.java @@ -8,8 +8,8 @@ import com.dgsrz.bancho.security.SecurityUtils; import com.reco1l.framework.IniReader; -import com.reco1l.legacy.data.SkinConverter; -import com.reco1l.legacy.engine.BlankTextureRegion; +import com.reco1l.osu.data.SkinConverter; +import com.reco1l.osu.engine.BlankTextureRegion; import org.anddev.andengine.engine.Engine; import org.anddev.andengine.opengl.font.Font; import org.anddev.andengine.opengl.font.FontFactory; diff --git a/src/ru/nsu/ccfit/zuev/osu/game/BreakAnimator.java b/src/ru/nsu/ccfit/zuev/osu/game/BreakAnimator.java index e5c386049..4c896fd85 100644 --- a/src/ru/nsu/ccfit/zuev/osu/game/BreakAnimator.java +++ b/src/ru/nsu/ccfit/zuev/osu/game/BreakAnimator.java @@ -2,8 +2,8 @@ import android.graphics.PointF; -import com.reco1l.legacy.Multiplayer; -import com.reco1l.legacy.ui.multiplayer.RoomScene; +import com.reco1l.osu.Multiplayer; +import com.reco1l.osu.ui.multiplayer.RoomScene; import org.anddev.andengine.entity.modifier.*; import org.anddev.andengine.entity.primitive.Rectangle; import org.anddev.andengine.entity.scene.Scene; diff --git a/src/ru/nsu/ccfit/zuev/osu/game/GameEffect.java b/src/ru/nsu/ccfit/zuev/osu/game/GameEffect.java index 089da8c13..107f01eae 100644 --- a/src/ru/nsu/ccfit/zuev/osu/game/GameEffect.java +++ b/src/ru/nsu/ccfit/zuev/osu/game/GameEffect.java @@ -2,7 +2,7 @@ import android.graphics.PointF; -import com.reco1l.framework.lang.Execution; +import com.reco1l.osu.Execution; import org.anddev.andengine.entity.IEntity; import org.anddev.andengine.entity.modifier.IEntityModifier; diff --git a/src/ru/nsu/ccfit/zuev/osu/game/GameScene.java b/src/ru/nsu/ccfit/zuev/osu/game/GameScene.java index 0cee1ac03..499c82077 100644 --- a/src/ru/nsu/ccfit/zuev/osu/game/GameScene.java +++ b/src/ru/nsu/ccfit/zuev/osu/game/GameScene.java @@ -12,12 +12,12 @@ import com.edlplan.osu.support.timing.TimingPoints; import com.edlplan.osu.support.timing.controlpoint.ControlPoints; import com.reco1l.api.ibancho.RoomAPI; -import com.reco1l.framework.lang.Execution; -import com.reco1l.legacy.engine.BlankTextureRegion; -import com.reco1l.legacy.engine.VideoSprite; -import com.reco1l.legacy.ui.entity.InGameLeaderboard; -import com.reco1l.legacy.Multiplayer; -import com.reco1l.legacy.ui.multiplayer.RoomScene; +import com.reco1l.osu.Execution; +import com.reco1l.osu.engine.BlankTextureRegion; +import com.reco1l.osu.engine.VideoSprite; +import com.reco1l.osu.ui.entity.InGameLeaderboard; +import com.reco1l.osu.Multiplayer; +import com.reco1l.osu.ui.multiplayer.RoomScene; import com.rian.osu.beatmap.Beatmap; import com.rian.osu.beatmap.constants.BeatmapCountdown; diff --git a/src/ru/nsu/ccfit/zuev/osu/game/ModernSpinner.java b/src/ru/nsu/ccfit/zuev/osu/game/ModernSpinner.java index 687ad5591..eaf0b7bc3 100644 --- a/src/ru/nsu/ccfit/zuev/osu/game/ModernSpinner.java +++ b/src/ru/nsu/ccfit/zuev/osu/game/ModernSpinner.java @@ -2,7 +2,7 @@ import android.graphics.PointF; -import com.reco1l.framework.lang.Execution; +import com.reco1l.osu.Execution; import org.anddev.andengine.entity.IEntity; import org.anddev.andengine.entity.modifier.AlphaModifier; diff --git a/src/ru/nsu/ccfit/zuev/osu/game/Slider.java b/src/ru/nsu/ccfit/zuev/osu/game/Slider.java index 7c6de2ffd..2ac45e0a7 100644 --- a/src/ru/nsu/ccfit/zuev/osu/game/Slider.java +++ b/src/ru/nsu/ccfit/zuev/osu/game/Slider.java @@ -5,7 +5,7 @@ import com.edlplan.framework.math.line.LinePath; import com.edlplan.osu.support.slider.SliderBody2D; import com.edlplan.osu.support.timing.controlpoint.TimingControlPoint; -import com.reco1l.framework.lang.Execution; +import com.reco1l.osu.Execution; import org.anddev.andengine.entity.IEntity; import org.anddev.andengine.entity.modifier.*; diff --git a/src/ru/nsu/ccfit/zuev/osu/game/Spinner.java b/src/ru/nsu/ccfit/zuev/osu/game/Spinner.java index 250621c03..3e34ec339 100644 --- a/src/ru/nsu/ccfit/zuev/osu/game/Spinner.java +++ b/src/ru/nsu/ccfit/zuev/osu/game/Spinner.java @@ -2,7 +2,7 @@ import android.graphics.PointF; -import com.reco1l.framework.lang.Execution; +import com.reco1l.osu.Execution; import org.anddev.andengine.entity.IEntity; import org.anddev.andengine.entity.modifier.AlphaModifier; diff --git a/src/ru/nsu/ccfit/zuev/osu/menu/ModMenu.java b/src/ru/nsu/ccfit/zuev/osu/menu/ModMenu.java index 768a0d0ed..6522759fa 100644 --- a/src/ru/nsu/ccfit/zuev/osu/menu/ModMenu.java +++ b/src/ru/nsu/ccfit/zuev/osu/menu/ModMenu.java @@ -2,11 +2,11 @@ import com.edlplan.ui.fragment.InGameSettingMenu; import com.reco1l.api.ibancho.RoomAPI; -import com.reco1l.framework.lang.Execution; -import com.reco1l.legacy.data.MultiplayerConverter; -import com.reco1l.legacy.Multiplayer; +import com.reco1l.osu.Execution; +import com.reco1l.osu.data.MultiplayerConverter; +import com.reco1l.osu.Multiplayer; import com.reco1l.api.ibancho.data.RoomMods; -import com.reco1l.legacy.ui.multiplayer.RoomScene; +import com.reco1l.osu.ui.multiplayer.RoomScene; import com.rian.osu.beatmap.parser.BeatmapParser; import com.rian.osu.difficulty.BeatmapDifficultyCalculator; diff --git a/src/ru/nsu/ccfit/zuev/osu/menu/ScoreBoard.java b/src/ru/nsu/ccfit/zuev/osu/menu/ScoreBoard.java index aeea83919..fcea1e79a 100644 --- a/src/ru/nsu/ccfit/zuev/osu/menu/ScoreBoard.java +++ b/src/ru/nsu/ccfit/zuev/osu/menu/ScoreBoard.java @@ -2,8 +2,9 @@ import android.database.Cursor; -import com.reco1l.framework.lang.Execution; -import com.reco1l.legacy.Multiplayer; +import com.reco1l.osu.Execution; +import com.reco1l.osu.Multiplayer; + import org.anddev.andengine.entity.Entity; import org.anddev.andengine.entity.scene.Scene; import org.anddev.andengine.entity.sprite.Sprite; diff --git a/src/ru/nsu/ccfit/zuev/osu/menu/ScoreBoardItem.java b/src/ru/nsu/ccfit/zuev/osu/menu/ScoreBoardItem.java index c10c8eb61..5ae751d0f 100644 --- a/src/ru/nsu/ccfit/zuev/osu/menu/ScoreBoardItem.java +++ b/src/ru/nsu/ccfit/zuev/osu/menu/ScoreBoardItem.java @@ -3,7 +3,7 @@ import androidx.annotation.NonNull; import androidx.annotation.Nullable; import com.reco1l.api.ibancho.data.WinCondition; -import com.reco1l.legacy.Multiplayer; +import com.reco1l.osu.Multiplayer; import org.json.JSONObject; import java.text.NumberFormat; diff --git a/src/ru/nsu/ccfit/zuev/osu/menu/SettingsMenu.java b/src/ru/nsu/ccfit/zuev/osu/menu/SettingsMenu.java index 8f4116866..aece927f2 100644 --- a/src/ru/nsu/ccfit/zuev/osu/menu/SettingsMenu.java +++ b/src/ru/nsu/ccfit/zuev/osu/menu/SettingsMenu.java @@ -31,8 +31,8 @@ import java.io.File; import java.util.Objects; -import com.reco1l.framework.lang.Execution; -import com.reco1l.legacy.UpdateManager; +import com.reco1l.osu.Execution; +import com.reco1l.osu.UpdateManager; import ru.nsu.ccfit.zuev.osu.Config; import ru.nsu.ccfit.zuev.osu.GlobalManager; diff --git a/src/ru/nsu/ccfit/zuev/osu/menu/SongMenu.java b/src/ru/nsu/ccfit/zuev/osu/menu/SongMenu.java index 2fa71d569..367f9f4d8 100644 --- a/src/ru/nsu/ccfit/zuev/osu/menu/SongMenu.java +++ b/src/ru/nsu/ccfit/zuev/osu/menu/SongMenu.java @@ -10,9 +10,9 @@ import com.edlplan.ui.fragment.PropsMenuFragment; import com.edlplan.ui.fragment.ScoreMenuFragment; import com.reco1l.api.ibancho.RoomAPI; -import com.reco1l.framework.lang.Execution; -import com.reco1l.legacy.Multiplayer; -import com.reco1l.legacy.ui.multiplayer.RoomScene; +import com.reco1l.osu.Execution; +import com.reco1l.osu.Multiplayer; +import com.reco1l.osu.ui.multiplayer.RoomScene; import com.rian.osu.beatmap.parser.BeatmapParser; import com.rian.osu.difficulty.BeatmapDifficultyCalculator; diff --git a/src/ru/nsu/ccfit/zuev/osu/menu/SplashScene.java b/src/ru/nsu/ccfit/zuev/osu/menu/SplashScene.java index a2d574545..81f4ae488 100644 --- a/src/ru/nsu/ccfit/zuev/osu/menu/SplashScene.java +++ b/src/ru/nsu/ccfit/zuev/osu/menu/SplashScene.java @@ -1,6 +1,6 @@ package ru.nsu.ccfit.zuev.osu.menu; -import com.reco1l.framework.lang.Execution; +import com.reco1l.osu.Execution; import org.anddev.andengine.engine.handler.IUpdateHandler; import org.anddev.andengine.entity.modifier.*; diff --git a/src/ru/nsu/ccfit/zuev/osu/online/OnlineScoring.java b/src/ru/nsu/ccfit/zuev/osu/online/OnlineScoring.java index 5c28bedda..51c955a7a 100644 --- a/src/ru/nsu/ccfit/zuev/osu/online/OnlineScoring.java +++ b/src/ru/nsu/ccfit/zuev/osu/online/OnlineScoring.java @@ -1,8 +1,8 @@ package ru.nsu.ccfit.zuev.osu.online; -import com.reco1l.framework.lang.Execution; -import com.reco1l.legacy.ui.multiplayer.LobbyScene; -import com.reco1l.legacy.ui.multiplayer.RoomScene; +import com.reco1l.osu.Execution; +import com.reco1l.osu.ui.multiplayer.LobbyScene; +import com.reco1l.osu.ui.multiplayer.RoomScene; import com.rian.osu.ui.SendingPanel; import org.anddev.andengine.util.Debug; diff --git a/src/ru/nsu/ccfit/zuev/osu/scoring/ScoringScene.java b/src/ru/nsu/ccfit/zuev/osu/scoring/ScoringScene.java index f2e24c533..b6382ba55 100644 --- a/src/ru/nsu/ccfit/zuev/osu/scoring/ScoringScene.java +++ b/src/ru/nsu/ccfit/zuev/osu/scoring/ScoringScene.java @@ -1,10 +1,10 @@ package ru.nsu.ccfit.zuev.osu.scoring; import com.edlplan.framework.utils.functionality.SmartIterator; -import com.reco1l.framework.lang.Execution; -import com.reco1l.legacy.Multiplayer; -import com.reco1l.legacy.ui.multiplayer.RoomScene; -import com.reco1l.legacy.ui.entity.StatisticSelector; +import com.reco1l.osu.Execution; +import com.reco1l.osu.Multiplayer; +import com.reco1l.osu.ui.multiplayer.RoomScene; +import com.reco1l.osu.ui.entity.StatisticSelector; import com.rian.osu.beatmap.Beatmap; import com.rian.osu.beatmap.parser.BeatmapParser; diff --git a/src/ru/nsu/ccfit/zuev/osu/scoring/StatisticV2.java b/src/ru/nsu/ccfit/zuev/osu/scoring/StatisticV2.java index 9492a90b7..c07e9f06b 100644 --- a/src/ru/nsu/ccfit/zuev/osu/scoring/StatisticV2.java +++ b/src/ru/nsu/ccfit/zuev/osu/scoring/StatisticV2.java @@ -8,7 +8,7 @@ import java.util.Random; import com.reco1l.api.ibancho.data.WinCondition; -import com.reco1l.legacy.Multiplayer; +import com.reco1l.osu.Multiplayer; import org.jetbrains.annotations.Nullable; import org.json.JSONObject; import ru.nsu.ccfit.zuev.osu.Config; From 454b2c610699517abe91eb74437a2996f55e2a4b Mon Sep 17 00:00:00 2001 From: Reco1l Date: Wed, 24 Apr 2024 23:51:52 -0300 Subject: [PATCH 03/22] Refactor 'osu.data' package as 'osu.conversion' --- src/com/reco1l/api/ibancho/Parsing.kt | 2 +- src/com/reco1l/api/ibancho/data/RoomMods.kt | 2 +- src/com/reco1l/osu/Multiplayer.kt | 4 ++-- .../MultiplayerConversion.kt} | 2 +- .../SkinConverter.kt => conversion/SkinningConversion.kt} | 2 +- src/com/reco1l/osu/ui/multiplayer/RoomScene.kt | 2 +- src/ru/nsu/ccfit/zuev/osu/ResourceManager.java | 2 +- src/ru/nsu/ccfit/zuev/osu/menu/ModMenu.java | 2 +- 8 files changed, 9 insertions(+), 9 deletions(-) rename src/com/reco1l/osu/{data/MultiplayerConverter.kt => conversion/MultiplayerConversion.kt} (99%) rename src/com/reco1l/osu/{data/SkinConverter.kt => conversion/SkinningConversion.kt} (99%) diff --git a/src/com/reco1l/api/ibancho/Parsing.kt b/src/com/reco1l/api/ibancho/Parsing.kt index 8b366d903..002a1580f 100644 --- a/src/com/reco1l/api/ibancho/Parsing.kt +++ b/src/com/reco1l/api/ibancho/Parsing.kt @@ -1,7 +1,7 @@ package com.reco1l.api.ibancho import com.reco1l.api.ibancho.data.* -import com.reco1l.osu.data.stringToMods +import com.reco1l.osu.conversion.stringToMods import org.json.JSONArray import org.json.JSONObject diff --git a/src/com/reco1l/api/ibancho/data/RoomMods.kt b/src/com/reco1l/api/ibancho/data/RoomMods.kt index 9107b36bc..e2c9e860c 100644 --- a/src/com/reco1l/api/ibancho/data/RoomMods.kt +++ b/src/com/reco1l/api/ibancho/data/RoomMods.kt @@ -1,6 +1,6 @@ package com.reco1l.api.ibancho.data -import com.reco1l.osu.data.modsToReadable +import com.reco1l.osu.conversion.modsToReadable import com.reco1l.osu.Multiplayer import ru.nsu.ccfit.zuev.osu.game.mods.GameMod import ru.nsu.ccfit.zuev.osu.game.mods.GameMod.* diff --git a/src/com/reco1l/osu/Multiplayer.kt b/src/com/reco1l/osu/Multiplayer.kt index a3dfc6b2e..c420fc681 100644 --- a/src/com/reco1l/osu/Multiplayer.kt +++ b/src/com/reco1l/osu/Multiplayer.kt @@ -5,8 +5,8 @@ import android.util.Log import com.reco1l.api.ibancho.RoomAPI import com.reco1l.api.ibancho.data.Room import com.reco1l.api.ibancho.data.RoomPlayer -import com.reco1l.osu.data.jsonToScoreboardItem -import com.reco1l.osu.data.jsonToStatistic +import com.reco1l.osu.conversion.jsonToScoreboardItem +import com.reco1l.osu.conversion.jsonToStatistic import com.reco1l.osu.ui.multiplayer.RoomScene import com.reco1l.toolkt.kotlin.formatTimeMilliseconds import com.reco1l.toolkt.kotlin.fromDate diff --git a/src/com/reco1l/osu/data/MultiplayerConverter.kt b/src/com/reco1l/osu/conversion/MultiplayerConversion.kt similarity index 99% rename from src/com/reco1l/osu/data/MultiplayerConverter.kt rename to src/com/reco1l/osu/conversion/MultiplayerConversion.kt index 7327b11c0..77f75f474 100644 --- a/src/com/reco1l/osu/data/MultiplayerConverter.kt +++ b/src/com/reco1l/osu/conversion/MultiplayerConversion.kt @@ -1,6 +1,6 @@ @file:JvmName("MultiplayerConverter") -package com.reco1l.osu.data +package com.reco1l.osu.conversion import org.json.JSONObject import ru.nsu.ccfit.zuev.osu.game.mods.GameMod diff --git a/src/com/reco1l/osu/data/SkinConverter.kt b/src/com/reco1l/osu/conversion/SkinningConversion.kt similarity index 99% rename from src/com/reco1l/osu/data/SkinConverter.kt rename to src/com/reco1l/osu/conversion/SkinningConversion.kt index 267b069af..f4f74a8f6 100644 --- a/src/com/reco1l/osu/data/SkinConverter.kt +++ b/src/com/reco1l/osu/conversion/SkinningConversion.kt @@ -1,6 +1,6 @@ @file:JvmName("SkinConverter") -package com.reco1l.osu.data +package com.reco1l.osu.conversion import android.graphics.Bitmap import android.graphics.Bitmap.CompressFormat diff --git a/src/com/reco1l/osu/ui/multiplayer/RoomScene.kt b/src/com/reco1l/osu/ui/multiplayer/RoomScene.kt index 1ed04e2d0..0350a134c 100644 --- a/src/com/reco1l/osu/ui/multiplayer/RoomScene.kt +++ b/src/com/reco1l/osu/ui/multiplayer/RoomScene.kt @@ -19,7 +19,7 @@ import com.reco1l.osu.Multiplayer.isConnected import com.reco1l.osu.Multiplayer.isRoomHost import com.reco1l.osu.Multiplayer.player import com.reco1l.osu.Multiplayer.room -import com.reco1l.osu.data.modsToString +import com.reco1l.osu.conversion.modsToString import com.reco1l.osu.ui.entity.BeatmapButton import com.reco1l.osu.ui.entity.ComposedText import com.rian.osu.ui.DifficultyAlgorithmSwitcher diff --git a/src/ru/nsu/ccfit/zuev/osu/ResourceManager.java b/src/ru/nsu/ccfit/zuev/osu/ResourceManager.java index da52e8572..befd1f5c6 100644 --- a/src/ru/nsu/ccfit/zuev/osu/ResourceManager.java +++ b/src/ru/nsu/ccfit/zuev/osu/ResourceManager.java @@ -8,7 +8,7 @@ import com.dgsrz.bancho.security.SecurityUtils; import com.reco1l.framework.IniReader; -import com.reco1l.osu.data.SkinConverter; +import com.reco1l.osu.conversion.SkinConverter; import com.reco1l.osu.engine.BlankTextureRegion; import org.anddev.andengine.engine.Engine; import org.anddev.andengine.opengl.font.Font; diff --git a/src/ru/nsu/ccfit/zuev/osu/menu/ModMenu.java b/src/ru/nsu/ccfit/zuev/osu/menu/ModMenu.java index 6522759fa..6421e3fe8 100644 --- a/src/ru/nsu/ccfit/zuev/osu/menu/ModMenu.java +++ b/src/ru/nsu/ccfit/zuev/osu/menu/ModMenu.java @@ -3,7 +3,7 @@ import com.edlplan.ui.fragment.InGameSettingMenu; import com.reco1l.api.ibancho.RoomAPI; import com.reco1l.osu.Execution; -import com.reco1l.osu.data.MultiplayerConverter; +import com.reco1l.osu.conversion.MultiplayerConverter; import com.reco1l.osu.Multiplayer; import com.reco1l.api.ibancho.data.RoomMods; import com.reco1l.osu.ui.multiplayer.RoomScene; From 2fe6f5f20c2e28eb7e7773a678dd5bc0493dfa27 Mon Sep 17 00:00:00 2001 From: Reco1l Date: Wed, 24 Apr 2024 23:53:28 -0300 Subject: [PATCH 04/22] Merge 'VideoTexture' into 'VideoSprite.kt' --- src/com/reco1l/osu/engine/VideoSprite.kt | 114 +++++++++++++++++++++ src/com/reco1l/osu/engine/VideoTexture.kt | 117 ---------------------- 2 files changed, 114 insertions(+), 117 deletions(-) delete mode 100644 src/com/reco1l/osu/engine/VideoTexture.kt diff --git a/src/com/reco1l/osu/engine/VideoSprite.kt b/src/com/reco1l/osu/engine/VideoSprite.kt index 8b1a9d061..9f4a0c282 100644 --- a/src/com/reco1l/osu/engine/VideoSprite.kt +++ b/src/com/reco1l/osu/engine/VideoSprite.kt @@ -1,9 +1,17 @@ package com.reco1l.osu.engine +import android.graphics.SurfaceTexture +import android.media.MediaPlayer import android.opengl.GLES11Ext.GL_TEXTURE_EXTERNAL_OES +import android.os.Build +import android.view.Surface import org.anddev.andengine.engine.Engine import org.anddev.andengine.engine.camera.Camera import org.anddev.andengine.entity.sprite.Sprite +import org.anddev.andengine.opengl.texture.Texture +import org.anddev.andengine.opengl.texture.TextureOptions +import org.anddev.andengine.opengl.texture.region.TextureRegion +import java.io.File import javax.microedition.khronos.opengles.GL10 class VideoSprite(source: String, private val engine: Engine) : Sprite(0f, 0f, VideoTexture(source).toRegion()) @@ -40,4 +48,110 @@ class VideoSprite(source: String, private val engine: Engine) : Sprite(0f, 0f, V release() super.finalize() } +} + + +class VideoTexture(val source: String) + + : Texture( + PixelFormat.UNDEFINED, + TextureOptions( + GL10.GL_NEAREST, + GL10.GL_LINEAR, + GL10.GL_CLAMP_TO_EDGE, + GL10.GL_CLAMP_TO_EDGE, + false + ), null) +{ + + private val player = MediaPlayer().apply { + + setDataSource(source) + setVolume(0f, 0f) + isLooping = false + prepare() + } + + + private var surfaceTexture: SurfaceTexture? = null + + + override fun getWidth() = player.videoWidth + + override fun getHeight() = player.videoHeight + + + override fun writeTextureToHardware(pGL: GL10) = Unit + + override fun bindTextureOnHardware(pGL: GL10) = pGL.glBindTexture(GL_TEXTURE_EXTERNAL_OES, mHardwareTextureID) + + override fun deleteTextureOnHardware(pGL: GL10?) + { + surfaceTexture?.release() + surfaceTexture = null + super.deleteTextureOnHardware(pGL) + } + + + override fun bind(pGL: GL10) + { + if (!isLoadedToHardware) + return + + bindTextureOnHardware(pGL) + applyTextureOptions(pGL) + + if (surfaceTexture == null) + { + surfaceTexture = SurfaceTexture(mHardwareTextureID) + + val surface = Surface(surfaceTexture) + player.setSurface(surface) + surface.release() + } + + try { + surfaceTexture?.updateTexImage() + } catch (_: Exception) { + isUpdateOnHardwareNeeded = true + } + } + + fun play() = player.start() + + fun pause() = player.pause() + + fun release() = player.release() + + fun seekTo(ms: Int) + { + // Unfortunately in old versions we can't seek at closest frame from the desired position. + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) + player.seekTo(ms.toLong(), MediaPlayer.SEEK_CLOSEST) + else + player.seekTo(ms) + } + + fun setPlaybackSpeed(speed: Float) + { + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) + { + val newParams = player.playbackParams.setSpeed(speed) + player.playbackParams = newParams + } + } + + + fun toRegion() = TextureRegion(this, 0, 0, width, height) + + + companion object + { + /** + * See [MediaPlayer documentation](https://developer.android.com/guide/topics/media/platform/supported-formats) + */ + val SUPPORTED_VIDEO_FORMATS = arrayOf("3gp", "mp4", "mkv", "webm") + + fun isSupportedVideo(file: File): Boolean = file.extension.lowercase() in SUPPORTED_VIDEO_FORMATS + } } \ No newline at end of file diff --git a/src/com/reco1l/osu/engine/VideoTexture.kt b/src/com/reco1l/osu/engine/VideoTexture.kt deleted file mode 100644 index 519554d5c..000000000 --- a/src/com/reco1l/osu/engine/VideoTexture.kt +++ /dev/null @@ -1,117 +0,0 @@ -package com.reco1l.osu.engine - -import android.graphics.SurfaceTexture -import android.media.MediaPlayer -import android.opengl.GLES11Ext.GL_TEXTURE_EXTERNAL_OES -import android.os.Build -import android.view.Surface -import org.anddev.andengine.opengl.texture.Texture -import org.anddev.andengine.opengl.texture.TextureOptions -import org.anddev.andengine.opengl.texture.region.TextureRegion -import java.io.File -import javax.microedition.khronos.opengles.GL10 - -class VideoTexture(val source: String) - - : Texture( - PixelFormat.UNDEFINED, - TextureOptions( - GL10.GL_NEAREST, - GL10.GL_LINEAR, - GL10.GL_CLAMP_TO_EDGE, - GL10.GL_CLAMP_TO_EDGE, - false - ), null) -{ - - private val player = MediaPlayer().apply { - - setDataSource(source) - setVolume(0f, 0f) - isLooping = false - prepare() - } - - - private var surfaceTexture: SurfaceTexture? = null - - - override fun getWidth() = player.videoWidth - - override fun getHeight() = player.videoHeight - - - override fun writeTextureToHardware(pGL: GL10) = Unit - - override fun bindTextureOnHardware(pGL: GL10) = pGL.glBindTexture(GL_TEXTURE_EXTERNAL_OES, mHardwareTextureID) - - override fun deleteTextureOnHardware(pGL: GL10?) - { - surfaceTexture?.release() - surfaceTexture = null - super.deleteTextureOnHardware(pGL) - } - - - override fun bind(pGL: GL10) - { - if (!isLoadedToHardware) - return - - bindTextureOnHardware(pGL) - applyTextureOptions(pGL) - - if (surfaceTexture == null) - { - surfaceTexture = SurfaceTexture(mHardwareTextureID) - - val surface = Surface(surfaceTexture) - player.setSurface(surface) - surface.release() - } - - try { - surfaceTexture?.updateTexImage() - } catch (_: Exception) { - isUpdateOnHardwareNeeded = true - } - } - - fun play() = player.start() - - fun pause() = player.pause() - - fun release() = player.release() - - fun seekTo(ms: Int) - { - // Unfortunately in old versions we can't seek at closest frame from the desired position. - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) - player.seekTo(ms.toLong(), MediaPlayer.SEEK_CLOSEST) - else - player.seekTo(ms) - } - - fun setPlaybackSpeed(speed: Float) - { - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) - { - val newParams = player.playbackParams.setSpeed(speed) - player.playbackParams = newParams - } - } - - - fun toRegion() = TextureRegion(this, 0, 0, width, height) - - - companion object - { - /** - * See [MediaPlayer documentation](https://developer.android.com/guide/topics/media/platform/supported-formats) - */ - val SUPPORTED_VIDEO_FORMATS = arrayOf("3gp", "mp4", "mkv", "webm") - - fun isSupportedVideo(file: File): Boolean = file.extension.lowercase() in SUPPORTED_VIDEO_FORMATS - } -} \ No newline at end of file From 866c37365ee6ce030808cbb3863694d9ffc6c2eb Mon Sep 17 00:00:00 2001 From: Reco1l Date: Wed, 24 Apr 2024 23:54:42 -0300 Subject: [PATCH 05/22] Move and rename 'beatmapdownloader' package to top level as 'beatmaplisting' --- .../BeatmapDownloader.kt | 6 ++++-- .../BeatmapListing.kt | 14 ++++++++++---- .../BeatmapMirror.kt | 4 ++-- .../BeatmapModel.kt | 2 +- src/com/reco1l/osu/ui/MainMenu.kt | 2 +- src/com/reco1l/osu/ui/entity/BeatmapButton.kt | 4 ++-- src/ru/nsu/ccfit/zuev/osu/MainScene.java | 2 +- 7 files changed, 21 insertions(+), 13 deletions(-) rename src/com/reco1l/osu/{ui/beatmapdownloader => beatmaplisting}/BeatmapDownloader.kt (97%) rename src/com/reco1l/osu/{ui/beatmapdownloader => beatmaplisting}/BeatmapListing.kt (97%) rename src/com/reco1l/osu/{ui/beatmapdownloader => beatmaplisting}/BeatmapMirror.kt (98%) rename src/com/reco1l/osu/{ui/beatmapdownloader => beatmaplisting}/BeatmapModel.kt (94%) diff --git a/src/com/reco1l/osu/ui/beatmapdownloader/BeatmapDownloader.kt b/src/com/reco1l/osu/beatmaplisting/BeatmapDownloader.kt similarity index 97% rename from src/com/reco1l/osu/ui/beatmapdownloader/BeatmapDownloader.kt rename to src/com/reco1l/osu/beatmaplisting/BeatmapDownloader.kt index dce296a80..44073952e 100644 --- a/src/com/reco1l/osu/ui/beatmapdownloader/BeatmapDownloader.kt +++ b/src/com/reco1l/osu/beatmaplisting/BeatmapDownloader.kt @@ -1,4 +1,4 @@ -package com.reco1l.osu.ui.beatmapdownloader +package com.reco1l.osu.beatmaplisting import android.os.Environment.DIRECTORY_DOWNLOADS import android.view.View @@ -137,7 +137,9 @@ object BeatmapDownloader : IDownloaderObserver { val info = "\n%.3f kb/s (%d%%)".format(downloader.speedKbps / 1024, downloader.progress.toInt()) mainThread { - fragment.text.text = context.getString(R.string.beatmap_downloader_downloading).format(currentFilename) + info + fragment.text.text = context.getString(R.string.beatmap_downloader_downloading).format( + currentFilename + ) + info fragment.progressBar.isIndeterminate = false fragment.progressBar.progress = downloader.progress.toInt() } diff --git a/src/com/reco1l/osu/ui/beatmapdownloader/BeatmapListing.kt b/src/com/reco1l/osu/beatmaplisting/BeatmapListing.kt similarity index 97% rename from src/com/reco1l/osu/ui/beatmapdownloader/BeatmapListing.kt rename to src/com/reco1l/osu/beatmaplisting/BeatmapListing.kt index f66664770..a016c3c1a 100644 --- a/src/com/reco1l/osu/ui/beatmapdownloader/BeatmapListing.kt +++ b/src/com/reco1l/osu/beatmaplisting/BeatmapListing.kt @@ -1,4 +1,4 @@ -package com.reco1l.osu.ui.beatmapdownloader +package com.reco1l.osu.beatmaplisting import android.graphics.BitmapFactory import android.util.Log @@ -156,7 +156,7 @@ object BeatmapListing : BaseFragment(), } fun stopPreviews(shouldResumeMusic: Boolean) { - if (!::recyclerView.isInitialized) { + if (!BeatmapListing::recyclerView.isInitialized) { return } @@ -298,7 +298,10 @@ class BeatmapSetDetails(val beatmapSet: BeatmapSetModel, val holder: BeatmapSetV downloadButton.setOnClickListener { val url = BeatmapListing.mirror.downloadEndpoint(beatmapSet.id) - BeatmapDownloader.download(url, "${beatmapSet.id} ${beatmapSet.artist} - ${beatmapSet.title}.osz") + BeatmapDownloader.download( + url, + "${beatmapSet.id} ${beatmapSet.artist} - ${beatmapSet.title}.osz" + ) } cover.setImageDrawable(holder.cover.drawable) @@ -497,7 +500,10 @@ class BeatmapSetViewHolder(itemView: View, private val mediaScope: CoroutineScop downloadButton.setOnClickListener { val url = BeatmapListing.mirror.downloadEndpoint(beatmapSet.id) - BeatmapDownloader.download(url, "${beatmapSet.id} ${beatmapSet.artist} - ${beatmapSet.title}.osz") + BeatmapDownloader.download( + url, + "${beatmapSet.id} ${beatmapSet.artist} - ${beatmapSet.title}.osz" + ) } diff --git a/src/com/reco1l/osu/ui/beatmapdownloader/BeatmapMirror.kt b/src/com/reco1l/osu/beatmaplisting/BeatmapMirror.kt similarity index 98% rename from src/com/reco1l/osu/ui/beatmapdownloader/BeatmapMirror.kt rename to src/com/reco1l/osu/beatmaplisting/BeatmapMirror.kt index b6855765e..dc221d150 100644 --- a/src/com/reco1l/osu/ui/beatmapdownloader/BeatmapMirror.kt +++ b/src/com/reco1l/osu/beatmaplisting/BeatmapMirror.kt @@ -1,4 +1,4 @@ -package com.reco1l.osu.ui.beatmapdownloader +package com.reco1l.osu.beatmaplisting import org.json.JSONArray import ru.nsu.ccfit.zuev.osu.RankedStatus @@ -36,7 +36,7 @@ enum class BeatmapMirror( val previewEndpoint: (Long) -> String, -) { + ) { /** * osu.direct beatmap mirror. diff --git a/src/com/reco1l/osu/ui/beatmapdownloader/BeatmapModel.kt b/src/com/reco1l/osu/beatmaplisting/BeatmapModel.kt similarity index 94% rename from src/com/reco1l/osu/ui/beatmapdownloader/BeatmapModel.kt rename to src/com/reco1l/osu/beatmaplisting/BeatmapModel.kt index 385db8bac..67a4c9ac8 100644 --- a/src/com/reco1l/osu/ui/beatmapdownloader/BeatmapModel.kt +++ b/src/com/reco1l/osu/beatmaplisting/BeatmapModel.kt @@ -1,4 +1,4 @@ -package com.reco1l.osu.ui.beatmapdownloader +package com.reco1l.osu.beatmaplisting import ru.nsu.ccfit.zuev.osu.RankedStatus diff --git a/src/com/reco1l/osu/ui/MainMenu.kt b/src/com/reco1l/osu/ui/MainMenu.kt index 10ca1fc91..0c9f5aa24 100644 --- a/src/com/reco1l/osu/ui/MainMenu.kt +++ b/src/com/reco1l/osu/ui/MainMenu.kt @@ -3,7 +3,7 @@ package com.reco1l.osu.ui import com.reco1l.osu.async import com.reco1l.osu.ui.multiplayer.LobbyScene import com.reco1l.osu.Multiplayer -import com.reco1l.osu.ui.beatmapdownloader.BeatmapListing +import com.reco1l.osu.beatmaplisting.BeatmapListing import com.reco1l.osu.ui.multiplayer.RoomScene import org.anddev.andengine.input.touch.TouchEvent import ru.nsu.ccfit.zuev.osu.LibraryManager diff --git a/src/com/reco1l/osu/ui/entity/BeatmapButton.kt b/src/com/reco1l/osu/ui/entity/BeatmapButton.kt index 18c822248..cc04b4d73 100644 --- a/src/com/reco1l/osu/ui/entity/BeatmapButton.kt +++ b/src/com/reco1l/osu/ui/entity/BeatmapButton.kt @@ -5,8 +5,8 @@ import com.reco1l.api.ibancho.data.PlayerStatus.READY import com.reco1l.api.ibancho.data.RoomBeatmap import com.reco1l.osu.async import com.reco1l.osu.Multiplayer -import com.reco1l.osu.ui.beatmapdownloader.BeatmapDownloader -import com.reco1l.osu.ui.beatmapdownloader.BeatmapListing +import com.reco1l.osu.beatmaplisting.BeatmapDownloader +import com.reco1l.osu.beatmaplisting.BeatmapListing import com.reco1l.osu.ui.multiplayer.RoomScene import org.anddev.andengine.entity.sprite.Sprite import org.anddev.andengine.entity.text.ChangeableText diff --git a/src/ru/nsu/ccfit/zuev/osu/MainScene.java b/src/ru/nsu/ccfit/zuev/osu/MainScene.java index 1f6eacf32..745f5387b 100644 --- a/src/ru/nsu/ccfit/zuev/osu/MainScene.java +++ b/src/ru/nsu/ccfit/zuev/osu/MainScene.java @@ -11,7 +11,7 @@ import com.reco1l.osu.Execution; import com.reco1l.osu.ui.MainMenu; -import com.reco1l.osu.ui.beatmapdownloader.BeatmapListing; +import com.reco1l.osu.beatmaplisting.BeatmapListing; import com.rian.osu.beatmap.parser.BeatmapParser; import org.anddev.andengine.engine.handler.IUpdateHandler; import org.anddev.andengine.entity.IEntity; From fc013ba43ce94b895fc48d01ae02b0646185c981 Mon Sep 17 00:00:00 2001 From: Reco1l Date: Wed, 24 Apr 2024 23:55:43 -0300 Subject: [PATCH 06/22] Rename 'engine' package to 'graphics' --- .../BlankTextureRegion.kt => graphics/BlankTexture.kt} | 2 +- src/com/reco1l/osu/{engine => graphics}/VideoSprite.kt | 2 +- src/ru/nsu/ccfit/zuev/osu/LibraryManager.java | 2 +- src/ru/nsu/ccfit/zuev/osu/ResourceManager.java | 2 +- src/ru/nsu/ccfit/zuev/osu/game/GameScene.java | 4 ++-- 5 files changed, 6 insertions(+), 6 deletions(-) rename src/com/reco1l/osu/{engine/BlankTextureRegion.kt => graphics/BlankTexture.kt} (94%) rename src/com/reco1l/osu/{engine => graphics}/VideoSprite.kt (99%) diff --git a/src/com/reco1l/osu/engine/BlankTextureRegion.kt b/src/com/reco1l/osu/graphics/BlankTexture.kt similarity index 94% rename from src/com/reco1l/osu/engine/BlankTextureRegion.kt rename to src/com/reco1l/osu/graphics/BlankTexture.kt index 37411baf2..16d189d60 100644 --- a/src/com/reco1l/osu/engine/BlankTextureRegion.kt +++ b/src/com/reco1l/osu/graphics/BlankTexture.kt @@ -1,4 +1,4 @@ -package com.reco1l.osu.engine +package com.reco1l.osu.graphics import org.anddev.andengine.opengl.texture.Texture import org.anddev.andengine.opengl.texture.TextureOptions diff --git a/src/com/reco1l/osu/engine/VideoSprite.kt b/src/com/reco1l/osu/graphics/VideoSprite.kt similarity index 99% rename from src/com/reco1l/osu/engine/VideoSprite.kt rename to src/com/reco1l/osu/graphics/VideoSprite.kt index 9f4a0c282..996ef8e6f 100644 --- a/src/com/reco1l/osu/engine/VideoSprite.kt +++ b/src/com/reco1l/osu/graphics/VideoSprite.kt @@ -1,4 +1,4 @@ -package com.reco1l.osu.engine +package com.reco1l.osu.graphics import android.graphics.SurfaceTexture import android.media.MediaPlayer diff --git a/src/ru/nsu/ccfit/zuev/osu/LibraryManager.java b/src/ru/nsu/ccfit/zuev/osu/LibraryManager.java index ada396bed..17c507b00 100644 --- a/src/ru/nsu/ccfit/zuev/osu/LibraryManager.java +++ b/src/ru/nsu/ccfit/zuev/osu/LibraryManager.java @@ -1,7 +1,7 @@ package ru.nsu.ccfit.zuev.osu; import android.os.Build; -import com.reco1l.osu.engine.VideoTexture; +import com.reco1l.osu.graphics.VideoTexture; import com.rian.osu.beatmap.parser.BeatmapParser; import org.anddev.andengine.util.Debug; import org.jetbrains.annotations.Nullable; diff --git a/src/ru/nsu/ccfit/zuev/osu/ResourceManager.java b/src/ru/nsu/ccfit/zuev/osu/ResourceManager.java index befd1f5c6..bd4064e19 100644 --- a/src/ru/nsu/ccfit/zuev/osu/ResourceManager.java +++ b/src/ru/nsu/ccfit/zuev/osu/ResourceManager.java @@ -9,7 +9,7 @@ import com.reco1l.framework.IniReader; import com.reco1l.osu.conversion.SkinConverter; -import com.reco1l.osu.engine.BlankTextureRegion; +import com.reco1l.osu.graphics.BlankTextureRegion; import org.anddev.andengine.engine.Engine; import org.anddev.andengine.opengl.font.Font; import org.anddev.andengine.opengl.font.FontFactory; diff --git a/src/ru/nsu/ccfit/zuev/osu/game/GameScene.java b/src/ru/nsu/ccfit/zuev/osu/game/GameScene.java index 499c82077..ddff5888f 100644 --- a/src/ru/nsu/ccfit/zuev/osu/game/GameScene.java +++ b/src/ru/nsu/ccfit/zuev/osu/game/GameScene.java @@ -13,8 +13,8 @@ import com.edlplan.osu.support.timing.controlpoint.ControlPoints; import com.reco1l.api.ibancho.RoomAPI; import com.reco1l.osu.Execution; -import com.reco1l.osu.engine.BlankTextureRegion; -import com.reco1l.osu.engine.VideoSprite; +import com.reco1l.osu.graphics.BlankTextureRegion; +import com.reco1l.osu.graphics.VideoSprite; import com.reco1l.osu.ui.entity.InGameLeaderboard; import com.reco1l.osu.Multiplayer; import com.reco1l.osu.ui.multiplayer.RoomScene; From d717c7f7f27a4eb02a0ecd8f59ae2b06955238eb Mon Sep 17 00:00:00 2001 From: Reco1l Date: Wed, 24 Apr 2024 23:58:26 -0300 Subject: [PATCH 07/22] Move 'multiplayer' package to top level --- src/com/reco1l/osu/Multiplayer.kt | 2 +- src/com/reco1l/osu/beatmaplisting/BeatmapDownloader.kt | 2 +- src/com/reco1l/osu/graphics/BlankTexture.kt | 6 +----- src/com/reco1l/osu/{ui => }/multiplayer/LobbyCreateRoom.kt | 2 +- src/com/reco1l/osu/{ui => }/multiplayer/LobbyRoomList.kt | 2 +- src/com/reco1l/osu/{ui => }/multiplayer/LobbyScene.kt | 2 +- src/com/reco1l/osu/{ui => }/multiplayer/LobbySearch.kt | 2 +- src/com/reco1l/osu/{ui => }/multiplayer/RoomChat.kt | 2 +- src/com/reco1l/osu/{ui => }/multiplayer/RoomOptions.kt | 2 +- src/com/reco1l/osu/{ui => }/multiplayer/RoomPlayerList.kt | 2 +- src/com/reco1l/osu/{ui => }/multiplayer/RoomPlayerMenu.kt | 2 +- src/com/reco1l/osu/{ui => }/multiplayer/RoomScene.kt | 6 ++++-- src/com/reco1l/osu/ui/MainMenu.kt | 4 ++-- src/com/reco1l/osu/ui/entity/BeatmapButton.kt | 2 +- src/com/rian/osu/ui/DifficultyAlgorithmSwitcher.kt | 2 +- src/ru/nsu/ccfit/zuev/osu/MainActivity.java | 4 ++-- src/ru/nsu/ccfit/zuev/osu/game/BreakAnimator.java | 2 +- src/ru/nsu/ccfit/zuev/osu/game/GameScene.java | 2 +- src/ru/nsu/ccfit/zuev/osu/menu/ModMenu.java | 2 +- src/ru/nsu/ccfit/zuev/osu/menu/SongMenu.java | 2 +- src/ru/nsu/ccfit/zuev/osu/online/OnlineScoring.java | 4 ++-- src/ru/nsu/ccfit/zuev/osu/scoring/ScoringScene.java | 2 +- 22 files changed, 28 insertions(+), 30 deletions(-) rename src/com/reco1l/osu/{ui => }/multiplayer/LobbyCreateRoom.kt (99%) rename src/com/reco1l/osu/{ui => }/multiplayer/LobbyRoomList.kt (99%) rename src/com/reco1l/osu/{ui => }/multiplayer/LobbyScene.kt (99%) rename src/com/reco1l/osu/{ui => }/multiplayer/LobbySearch.kt (99%) rename src/com/reco1l/osu/{ui => }/multiplayer/RoomChat.kt (99%) rename src/com/reco1l/osu/{ui => }/multiplayer/RoomOptions.kt (99%) rename src/com/reco1l/osu/{ui => }/multiplayer/RoomPlayerList.kt (99%) rename src/com/reco1l/osu/{ui => }/multiplayer/RoomPlayerMenu.kt (99%) rename src/com/reco1l/osu/{ui => }/multiplayer/RoomScene.kt (99%) diff --git a/src/com/reco1l/osu/Multiplayer.kt b/src/com/reco1l/osu/Multiplayer.kt index c420fc681..e361dee95 100644 --- a/src/com/reco1l/osu/Multiplayer.kt +++ b/src/com/reco1l/osu/Multiplayer.kt @@ -7,7 +7,7 @@ import com.reco1l.api.ibancho.data.Room import com.reco1l.api.ibancho.data.RoomPlayer import com.reco1l.osu.conversion.jsonToScoreboardItem import com.reco1l.osu.conversion.jsonToStatistic -import com.reco1l.osu.ui.multiplayer.RoomScene +import com.reco1l.osu.multiplayer.RoomScene import com.reco1l.toolkt.kotlin.formatTimeMilliseconds import com.reco1l.toolkt.kotlin.fromDate import kotlinx.coroutines.CoroutineScope diff --git a/src/com/reco1l/osu/beatmaplisting/BeatmapDownloader.kt b/src/com/reco1l/osu/beatmaplisting/BeatmapDownloader.kt index 44073952e..f13483179 100644 --- a/src/com/reco1l/osu/beatmaplisting/BeatmapDownloader.kt +++ b/src/com/reco1l/osu/beatmaplisting/BeatmapDownloader.kt @@ -7,7 +7,7 @@ import com.reco1l.framework.net.FileRequest import com.reco1l.framework.net.IDownloaderObserver import com.reco1l.osu.Multiplayer import com.reco1l.osu.ui.DownloadFragment -import com.reco1l.osu.ui.multiplayer.RoomScene +import com.reco1l.osu.multiplayer.RoomScene import com.reco1l.toolkt.kotlin.async import com.reco1l.toolkt.kotlin.decodeAsURL import com.reco1l.toolkt.kotlin.replaceAlphanumeric diff --git a/src/com/reco1l/osu/graphics/BlankTexture.kt b/src/com/reco1l/osu/graphics/BlankTexture.kt index 16d189d60..c43b81edd 100644 --- a/src/com/reco1l/osu/graphics/BlankTexture.kt +++ b/src/com/reco1l/osu/graphics/BlankTexture.kt @@ -10,10 +10,6 @@ class BlankTextureRegion : TextureRegion(BlankTexture(), 0, 0, 1, 1) class BlankTexture : Texture(PixelFormat.RGBA_8888, TextureOptions.DEFAULT, null) { override fun getWidth() = 1 - override fun getHeight() = 1 - - override fun writeTextureToHardware(pGL: GL10?) - { - } + override fun writeTextureToHardware(gl: GL10) = Unit } \ No newline at end of file diff --git a/src/com/reco1l/osu/ui/multiplayer/LobbyCreateRoom.kt b/src/com/reco1l/osu/multiplayer/LobbyCreateRoom.kt similarity index 99% rename from src/com/reco1l/osu/ui/multiplayer/LobbyCreateRoom.kt rename to src/com/reco1l/osu/multiplayer/LobbyCreateRoom.kt index 4f3a5e02c..afc6591f9 100644 --- a/src/com/reco1l/osu/ui/multiplayer/LobbyCreateRoom.kt +++ b/src/com/reco1l/osu/multiplayer/LobbyCreateRoom.kt @@ -1,4 +1,4 @@ -package com.reco1l.osu.ui.multiplayer +package com.reco1l.osu.multiplayer import android.animation.Animator import android.view.View diff --git a/src/com/reco1l/osu/ui/multiplayer/LobbyRoomList.kt b/src/com/reco1l/osu/multiplayer/LobbyRoomList.kt similarity index 99% rename from src/com/reco1l/osu/ui/multiplayer/LobbyRoomList.kt rename to src/com/reco1l/osu/multiplayer/LobbyRoomList.kt index 3901685aa..185802cc4 100644 --- a/src/com/reco1l/osu/ui/multiplayer/LobbyRoomList.kt +++ b/src/com/reco1l/osu/multiplayer/LobbyRoomList.kt @@ -1,4 +1,4 @@ -package com.reco1l.osu.ui.multiplayer +package com.reco1l.osu.multiplayer import android.app.AlertDialog import android.view.inputmethod.EditorInfo diff --git a/src/com/reco1l/osu/ui/multiplayer/LobbyScene.kt b/src/com/reco1l/osu/multiplayer/LobbyScene.kt similarity index 99% rename from src/com/reco1l/osu/ui/multiplayer/LobbyScene.kt rename to src/com/reco1l/osu/multiplayer/LobbyScene.kt index 347ce8387..19555e766 100644 --- a/src/com/reco1l/osu/ui/multiplayer/LobbyScene.kt +++ b/src/com/reco1l/osu/multiplayer/LobbyScene.kt @@ -1,4 +1,4 @@ -package com.reco1l.osu.ui.multiplayer +package com.reco1l.osu.multiplayer import android.net.Uri import android.util.Log diff --git a/src/com/reco1l/osu/ui/multiplayer/LobbySearch.kt b/src/com/reco1l/osu/multiplayer/LobbySearch.kt similarity index 99% rename from src/com/reco1l/osu/ui/multiplayer/LobbySearch.kt rename to src/com/reco1l/osu/multiplayer/LobbySearch.kt index 29bf0dab5..1478e4812 100644 --- a/src/com/reco1l/osu/ui/multiplayer/LobbySearch.kt +++ b/src/com/reco1l/osu/multiplayer/LobbySearch.kt @@ -1,4 +1,4 @@ -package com.reco1l.osu.ui.multiplayer +package com.reco1l.osu.multiplayer import android.animation.Animator import android.annotation.SuppressLint diff --git a/src/com/reco1l/osu/ui/multiplayer/RoomChat.kt b/src/com/reco1l/osu/multiplayer/RoomChat.kt similarity index 99% rename from src/com/reco1l/osu/ui/multiplayer/RoomChat.kt rename to src/com/reco1l/osu/multiplayer/RoomChat.kt index 3785f6a71..f70237e90 100644 --- a/src/com/reco1l/osu/ui/multiplayer/RoomChat.kt +++ b/src/com/reco1l/osu/multiplayer/RoomChat.kt @@ -1,4 +1,4 @@ -package com.reco1l.osu.ui.multiplayer +package com.reco1l.osu.multiplayer import android.animation.Animator import android.annotation.SuppressLint diff --git a/src/com/reco1l/osu/ui/multiplayer/RoomOptions.kt b/src/com/reco1l/osu/multiplayer/RoomOptions.kt similarity index 99% rename from src/com/reco1l/osu/ui/multiplayer/RoomOptions.kt rename to src/com/reco1l/osu/multiplayer/RoomOptions.kt index 2cc8cb96e..279bba135 100644 --- a/src/com/reco1l/osu/ui/multiplayer/RoomOptions.kt +++ b/src/com/reco1l/osu/multiplayer/RoomOptions.kt @@ -1,4 +1,4 @@ -package com.reco1l.osu.ui.multiplayer +package com.reco1l.osu.multiplayer import android.animation.Animator import android.content.ClipData diff --git a/src/com/reco1l/osu/ui/multiplayer/RoomPlayerList.kt b/src/com/reco1l/osu/multiplayer/RoomPlayerList.kt similarity index 99% rename from src/com/reco1l/osu/ui/multiplayer/RoomPlayerList.kt rename to src/com/reco1l/osu/multiplayer/RoomPlayerList.kt index 57daa5196..c99cd41f5 100644 --- a/src/com/reco1l/osu/ui/multiplayer/RoomPlayerList.kt +++ b/src/com/reco1l/osu/multiplayer/RoomPlayerList.kt @@ -1,4 +1,4 @@ -package com.reco1l.osu.ui.multiplayer +package com.reco1l.osu.multiplayer import com.reco1l.api.ibancho.data.* import com.reco1l.api.ibancho.data.PlayerStatus.* diff --git a/src/com/reco1l/osu/ui/multiplayer/RoomPlayerMenu.kt b/src/com/reco1l/osu/multiplayer/RoomPlayerMenu.kt similarity index 99% rename from src/com/reco1l/osu/ui/multiplayer/RoomPlayerMenu.kt rename to src/com/reco1l/osu/multiplayer/RoomPlayerMenu.kt index 0ab08d608..eb6e07b47 100644 --- a/src/com/reco1l/osu/ui/multiplayer/RoomPlayerMenu.kt +++ b/src/com/reco1l/osu/multiplayer/RoomPlayerMenu.kt @@ -1,4 +1,4 @@ -package com.reco1l.osu.ui.multiplayer +package com.reco1l.osu.multiplayer import android.animation.Animator import android.app.AlertDialog diff --git a/src/com/reco1l/osu/ui/multiplayer/RoomScene.kt b/src/com/reco1l/osu/multiplayer/RoomScene.kt similarity index 99% rename from src/com/reco1l/osu/ui/multiplayer/RoomScene.kt rename to src/com/reco1l/osu/multiplayer/RoomScene.kt index 0350a134c..8491b8f06 100644 --- a/src/com/reco1l/osu/ui/multiplayer/RoomScene.kt +++ b/src/com/reco1l/osu/multiplayer/RoomScene.kt @@ -1,4 +1,4 @@ -package com.reco1l.osu.ui.multiplayer +package com.reco1l.osu.multiplayer import android.app.AlertDialog import com.reco1l.api.ibancho.IPlayerEventListener @@ -182,7 +182,9 @@ object RoomScene : Scene(), IRoomEventListener, IPlayerEventListener attachChild(it) } - OsuSkin.get().getColor("MenuItemDefaultTextColor", BeatmapButton.DEFAULT_TEXT_COLOR).apply(beatmapInfoText) + OsuSkin.get().getColor("MenuItemDefaultTextColor", BeatmapButton.DEFAULT_TEXT_COLOR).apply( + beatmapInfoText + ) // Ready button, this button will switch player status readyButton = object : TextButton(getResources().getFont("CaptionFont"), "Ready") diff --git a/src/com/reco1l/osu/ui/MainMenu.kt b/src/com/reco1l/osu/ui/MainMenu.kt index 0c9f5aa24..a21f0214c 100644 --- a/src/com/reco1l/osu/ui/MainMenu.kt +++ b/src/com/reco1l/osu/ui/MainMenu.kt @@ -1,10 +1,10 @@ package com.reco1l.osu.ui import com.reco1l.osu.async -import com.reco1l.osu.ui.multiplayer.LobbyScene +import com.reco1l.osu.multiplayer.LobbyScene import com.reco1l.osu.Multiplayer import com.reco1l.osu.beatmaplisting.BeatmapListing -import com.reco1l.osu.ui.multiplayer.RoomScene +import com.reco1l.osu.multiplayer.RoomScene import org.anddev.andengine.input.touch.TouchEvent import ru.nsu.ccfit.zuev.osu.LibraryManager import ru.nsu.ccfit.zuev.osu.MainScene diff --git a/src/com/reco1l/osu/ui/entity/BeatmapButton.kt b/src/com/reco1l/osu/ui/entity/BeatmapButton.kt index cc04b4d73..59f09540c 100644 --- a/src/com/reco1l/osu/ui/entity/BeatmapButton.kt +++ b/src/com/reco1l/osu/ui/entity/BeatmapButton.kt @@ -7,7 +7,7 @@ import com.reco1l.osu.async import com.reco1l.osu.Multiplayer import com.reco1l.osu.beatmaplisting.BeatmapDownloader import com.reco1l.osu.beatmaplisting.BeatmapListing -import com.reco1l.osu.ui.multiplayer.RoomScene +import com.reco1l.osu.multiplayer.RoomScene import org.anddev.andengine.entity.sprite.Sprite import org.anddev.andengine.entity.text.ChangeableText import org.anddev.andengine.input.touch.TouchEvent diff --git a/src/com/rian/osu/ui/DifficultyAlgorithmSwitcher.kt b/src/com/rian/osu/ui/DifficultyAlgorithmSwitcher.kt index d0f1f8ca1..909249fad 100644 --- a/src/com/rian/osu/ui/DifficultyAlgorithmSwitcher.kt +++ b/src/com/rian/osu/ui/DifficultyAlgorithmSwitcher.kt @@ -1,7 +1,7 @@ package com.rian.osu.ui import com.reco1l.osu.Multiplayer -import com.reco1l.osu.ui.multiplayer.RoomScene +import com.reco1l.osu.multiplayer.RoomScene import org.anddev.andengine.input.touch.TouchEvent import org.anddev.andengine.util.MathUtils import ru.nsu.ccfit.zuev.osu.Config diff --git a/src/ru/nsu/ccfit/zuev/osu/MainActivity.java b/src/ru/nsu/ccfit/zuev/osu/MainActivity.java index 969c10316..9a77c922a 100644 --- a/src/ru/nsu/ccfit/zuev/osu/MainActivity.java +++ b/src/ru/nsu/ccfit/zuev/osu/MainActivity.java @@ -46,8 +46,8 @@ import com.reco1l.osu.Execution; import com.reco1l.osu.Multiplayer; import com.reco1l.osu.UpdateManager; -import com.reco1l.osu.ui.multiplayer.LobbyScene; -import com.reco1l.osu.ui.multiplayer.RoomScene; +import com.reco1l.osu.multiplayer.LobbyScene; +import com.reco1l.osu.multiplayer.RoomScene; import com.rian.osu.difficulty.BeatmapDifficultyCalculator; import net.lingala.zip4j.ZipFile; diff --git a/src/ru/nsu/ccfit/zuev/osu/game/BreakAnimator.java b/src/ru/nsu/ccfit/zuev/osu/game/BreakAnimator.java index 4c896fd85..921a6561f 100644 --- a/src/ru/nsu/ccfit/zuev/osu/game/BreakAnimator.java +++ b/src/ru/nsu/ccfit/zuev/osu/game/BreakAnimator.java @@ -3,7 +3,7 @@ import android.graphics.PointF; import com.reco1l.osu.Multiplayer; -import com.reco1l.osu.ui.multiplayer.RoomScene; +import com.reco1l.osu.multiplayer.RoomScene; import org.anddev.andengine.entity.modifier.*; import org.anddev.andengine.entity.primitive.Rectangle; import org.anddev.andengine.entity.scene.Scene; diff --git a/src/ru/nsu/ccfit/zuev/osu/game/GameScene.java b/src/ru/nsu/ccfit/zuev/osu/game/GameScene.java index ddff5888f..e5d93adf5 100644 --- a/src/ru/nsu/ccfit/zuev/osu/game/GameScene.java +++ b/src/ru/nsu/ccfit/zuev/osu/game/GameScene.java @@ -17,7 +17,7 @@ import com.reco1l.osu.graphics.VideoSprite; import com.reco1l.osu.ui.entity.InGameLeaderboard; import com.reco1l.osu.Multiplayer; -import com.reco1l.osu.ui.multiplayer.RoomScene; +import com.reco1l.osu.multiplayer.RoomScene; import com.rian.osu.beatmap.Beatmap; import com.rian.osu.beatmap.constants.BeatmapCountdown; diff --git a/src/ru/nsu/ccfit/zuev/osu/menu/ModMenu.java b/src/ru/nsu/ccfit/zuev/osu/menu/ModMenu.java index 6421e3fe8..747b294e0 100644 --- a/src/ru/nsu/ccfit/zuev/osu/menu/ModMenu.java +++ b/src/ru/nsu/ccfit/zuev/osu/menu/ModMenu.java @@ -6,7 +6,7 @@ import com.reco1l.osu.conversion.MultiplayerConverter; import com.reco1l.osu.Multiplayer; import com.reco1l.api.ibancho.data.RoomMods; -import com.reco1l.osu.ui.multiplayer.RoomScene; +import com.reco1l.osu.multiplayer.RoomScene; import com.rian.osu.beatmap.parser.BeatmapParser; import com.rian.osu.difficulty.BeatmapDifficultyCalculator; diff --git a/src/ru/nsu/ccfit/zuev/osu/menu/SongMenu.java b/src/ru/nsu/ccfit/zuev/osu/menu/SongMenu.java index 367f9f4d8..d7811181e 100644 --- a/src/ru/nsu/ccfit/zuev/osu/menu/SongMenu.java +++ b/src/ru/nsu/ccfit/zuev/osu/menu/SongMenu.java @@ -12,7 +12,7 @@ import com.reco1l.api.ibancho.RoomAPI; import com.reco1l.osu.Execution; import com.reco1l.osu.Multiplayer; -import com.reco1l.osu.ui.multiplayer.RoomScene; +import com.reco1l.osu.multiplayer.RoomScene; import com.rian.osu.beatmap.parser.BeatmapParser; import com.rian.osu.difficulty.BeatmapDifficultyCalculator; diff --git a/src/ru/nsu/ccfit/zuev/osu/online/OnlineScoring.java b/src/ru/nsu/ccfit/zuev/osu/online/OnlineScoring.java index 51c955a7a..e12178895 100644 --- a/src/ru/nsu/ccfit/zuev/osu/online/OnlineScoring.java +++ b/src/ru/nsu/ccfit/zuev/osu/online/OnlineScoring.java @@ -1,8 +1,8 @@ package ru.nsu.ccfit.zuev.osu.online; import com.reco1l.osu.Execution; -import com.reco1l.osu.ui.multiplayer.LobbyScene; -import com.reco1l.osu.ui.multiplayer.RoomScene; +import com.reco1l.osu.multiplayer.LobbyScene; +import com.reco1l.osu.multiplayer.RoomScene; import com.rian.osu.ui.SendingPanel; import org.anddev.andengine.util.Debug; diff --git a/src/ru/nsu/ccfit/zuev/osu/scoring/ScoringScene.java b/src/ru/nsu/ccfit/zuev/osu/scoring/ScoringScene.java index b6382ba55..528d4f175 100644 --- a/src/ru/nsu/ccfit/zuev/osu/scoring/ScoringScene.java +++ b/src/ru/nsu/ccfit/zuev/osu/scoring/ScoringScene.java @@ -3,7 +3,7 @@ import com.edlplan.framework.utils.functionality.SmartIterator; import com.reco1l.osu.Execution; import com.reco1l.osu.Multiplayer; -import com.reco1l.osu.ui.multiplayer.RoomScene; +import com.reco1l.osu.multiplayer.RoomScene; import com.reco1l.osu.ui.entity.StatisticSelector; import com.rian.osu.beatmap.Beatmap; From 7665679bac5e25b45a5067b07c4022aae8ab8b2e Mon Sep 17 00:00:00 2001 From: Reco1l Date: Thu, 25 Apr 2024 00:00:08 -0300 Subject: [PATCH 08/22] Merge 'entity' package with top level 'ui' --- src/com/reco1l/osu/{ui => }/Colors.kt | 2 +- src/com/reco1l/osu/beatmaplisting/BeatmapListing.kt | 2 +- src/com/reco1l/osu/multiplayer/LobbyRoomList.kt | 2 +- src/com/reco1l/osu/multiplayer/RoomPlayerList.kt | 2 +- src/com/reco1l/osu/multiplayer/RoomScene.kt | 4 ++-- src/com/reco1l/osu/ui/{entity => }/BeatmapButton.kt | 2 +- src/com/reco1l/osu/ui/{entity => }/ComposedText.kt | 2 +- src/com/reco1l/osu/ui/{entity => }/InGameLeaderboard.kt | 2 +- src/com/reco1l/osu/ui/{entity => }/ScrollableList.kt | 2 +- src/com/reco1l/osu/ui/{entity => }/StatisticSelector.kt | 2 +- src/ru/nsu/ccfit/zuev/osu/game/GameScene.java | 2 +- src/ru/nsu/ccfit/zuev/osu/scoring/ScoringScene.java | 2 +- 12 files changed, 13 insertions(+), 13 deletions(-) rename src/com/reco1l/osu/{ui => }/Colors.kt (99%) rename src/com/reco1l/osu/ui/{entity => }/BeatmapButton.kt (99%) rename src/com/reco1l/osu/ui/{entity => }/ComposedText.kt (95%) rename src/com/reco1l/osu/ui/{entity => }/InGameLeaderboard.kt (99%) rename src/com/reco1l/osu/ui/{entity => }/ScrollableList.kt (99%) rename src/com/reco1l/osu/ui/{entity => }/StatisticSelector.kt (99%) diff --git a/src/com/reco1l/osu/ui/Colors.kt b/src/com/reco1l/osu/Colors.kt similarity index 99% rename from src/com/reco1l/osu/ui/Colors.kt rename to src/com/reco1l/osu/Colors.kt index e042ef424..061008661 100644 --- a/src/com/reco1l/osu/ui/Colors.kt +++ b/src/com/reco1l/osu/Colors.kt @@ -1,4 +1,4 @@ -package com.reco1l.osu.ui +package com.reco1l.osu import android.graphics.Color import org.anddev.andengine.util.modifier.ease.EaseLinear diff --git a/src/com/reco1l/osu/beatmaplisting/BeatmapListing.kt b/src/com/reco1l/osu/beatmaplisting/BeatmapListing.kt index a016c3c1a..28352eb8a 100644 --- a/src/com/reco1l/osu/beatmaplisting/BeatmapListing.kt +++ b/src/com/reco1l/osu/beatmaplisting/BeatmapListing.kt @@ -20,7 +20,7 @@ import com.reco1l.framework.bass.URLBassStream import com.reco1l.osu.mainThread import com.reco1l.framework.net.IDownloaderObserver import com.reco1l.framework.net.JsonArrayRequest -import com.reco1l.osu.ui.OsuColors +import com.reco1l.osu.OsuColors import kotlinx.coroutines.CoroutineExceptionHandler import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.Dispatchers diff --git a/src/com/reco1l/osu/multiplayer/LobbyRoomList.kt b/src/com/reco1l/osu/multiplayer/LobbyRoomList.kt index 185802cc4..89592ffa2 100644 --- a/src/com/reco1l/osu/multiplayer/LobbyRoomList.kt +++ b/src/com/reco1l/osu/multiplayer/LobbyRoomList.kt @@ -11,7 +11,7 @@ import com.reco1l.api.ibancho.data.TeamMode.TEAM_VS_TEAM import com.reco1l.api.ibancho.data.WinCondition.* import com.reco1l.osu.mainThread import com.reco1l.osu.Multiplayer -import com.reco1l.osu.ui.entity.ScrollableList +import com.reco1l.osu.ui.ScrollableList import com.reco1l.toolkt.kotlin.async import org.anddev.andengine.entity.sprite.Sprite import org.anddev.andengine.entity.text.Text diff --git a/src/com/reco1l/osu/multiplayer/RoomPlayerList.kt b/src/com/reco1l/osu/multiplayer/RoomPlayerList.kt index c99cd41f5..18a3f4bc7 100644 --- a/src/com/reco1l/osu/multiplayer/RoomPlayerList.kt +++ b/src/com/reco1l/osu/multiplayer/RoomPlayerList.kt @@ -4,7 +4,7 @@ import com.reco1l.api.ibancho.data.* import com.reco1l.api.ibancho.data.PlayerStatus.* import com.reco1l.api.ibancho.data.RoomTeam.* import com.reco1l.osu.Multiplayer -import com.reco1l.osu.ui.entity.ScrollableList +import com.reco1l.osu.ui.ScrollableList import org.anddev.andengine.entity.primitive.Rectangle import org.anddev.andengine.entity.sprite.Sprite import org.anddev.andengine.entity.text.ChangeableText diff --git a/src/com/reco1l/osu/multiplayer/RoomScene.kt b/src/com/reco1l/osu/multiplayer/RoomScene.kt index 8491b8f06..b3fb6a471 100644 --- a/src/com/reco1l/osu/multiplayer/RoomScene.kt +++ b/src/com/reco1l/osu/multiplayer/RoomScene.kt @@ -20,8 +20,8 @@ import com.reco1l.osu.Multiplayer.isRoomHost import com.reco1l.osu.Multiplayer.player import com.reco1l.osu.Multiplayer.room import com.reco1l.osu.conversion.modsToString -import com.reco1l.osu.ui.entity.BeatmapButton -import com.reco1l.osu.ui.entity.ComposedText +import com.reco1l.osu.ui.BeatmapButton +import com.reco1l.osu.ui.ComposedText import com.rian.osu.ui.DifficultyAlgorithmSwitcher import org.anddev.andengine.engine.camera.SmoothCamera import org.anddev.andengine.entity.primitive.Rectangle diff --git a/src/com/reco1l/osu/ui/entity/BeatmapButton.kt b/src/com/reco1l/osu/ui/BeatmapButton.kt similarity index 99% rename from src/com/reco1l/osu/ui/entity/BeatmapButton.kt rename to src/com/reco1l/osu/ui/BeatmapButton.kt index 59f09540c..b4d38b4ca 100644 --- a/src/com/reco1l/osu/ui/entity/BeatmapButton.kt +++ b/src/com/reco1l/osu/ui/BeatmapButton.kt @@ -1,4 +1,4 @@ -package com.reco1l.osu.ui.entity +package com.reco1l.osu.ui import com.reco1l.api.ibancho.RoomAPI import com.reco1l.api.ibancho.data.PlayerStatus.READY diff --git a/src/com/reco1l/osu/ui/entity/ComposedText.kt b/src/com/reco1l/osu/ui/ComposedText.kt similarity index 95% rename from src/com/reco1l/osu/ui/entity/ComposedText.kt rename to src/com/reco1l/osu/ui/ComposedText.kt index af698c70b..ae5ec367f 100644 --- a/src/com/reco1l/osu/ui/entity/ComposedText.kt +++ b/src/com/reco1l/osu/ui/ComposedText.kt @@ -1,4 +1,4 @@ -package com.reco1l.osu.ui.entity +package com.reco1l.osu.ui import org.anddev.andengine.entity.Entity import org.anddev.andengine.entity.text.ChangeableText diff --git a/src/com/reco1l/osu/ui/entity/InGameLeaderboard.kt b/src/com/reco1l/osu/ui/InGameLeaderboard.kt similarity index 99% rename from src/com/reco1l/osu/ui/entity/InGameLeaderboard.kt rename to src/com/reco1l/osu/ui/InGameLeaderboard.kt index a5fbc8055..61cbb7e3f 100644 --- a/src/com/reco1l/osu/ui/entity/InGameLeaderboard.kt +++ b/src/com/reco1l/osu/ui/InGameLeaderboard.kt @@ -1,4 +1,4 @@ -package com.reco1l.osu.ui.entity +package com.reco1l.osu.ui import android.opengl.GLES20 import com.reco1l.osu.Multiplayer.isMultiplayer diff --git a/src/com/reco1l/osu/ui/entity/ScrollableList.kt b/src/com/reco1l/osu/ui/ScrollableList.kt similarity index 99% rename from src/com/reco1l/osu/ui/entity/ScrollableList.kt rename to src/com/reco1l/osu/ui/ScrollableList.kt index 790f9a1ac..47f8f8f0e 100644 --- a/src/com/reco1l/osu/ui/entity/ScrollableList.kt +++ b/src/com/reco1l/osu/ui/ScrollableList.kt @@ -1,4 +1,4 @@ -package com.reco1l.osu.ui.entity +package com.reco1l.osu.ui import org.anddev.andengine.entity.scene.Scene import org.anddev.andengine.entity.shape.Shape diff --git a/src/com/reco1l/osu/ui/entity/StatisticSelector.kt b/src/com/reco1l/osu/ui/StatisticSelector.kt similarity index 99% rename from src/com/reco1l/osu/ui/entity/StatisticSelector.kt rename to src/com/reco1l/osu/ui/StatisticSelector.kt index 89121f02f..a8cc615c0 100644 --- a/src/com/reco1l/osu/ui/entity/StatisticSelector.kt +++ b/src/com/reco1l/osu/ui/StatisticSelector.kt @@ -1,4 +1,4 @@ -package com.reco1l.osu.ui.entity +package com.reco1l.osu.ui import android.opengl.GLES20 import com.reco1l.api.ibancho.data.WinCondition.ACCURACY diff --git a/src/ru/nsu/ccfit/zuev/osu/game/GameScene.java b/src/ru/nsu/ccfit/zuev/osu/game/GameScene.java index e5d93adf5..08c28b345 100644 --- a/src/ru/nsu/ccfit/zuev/osu/game/GameScene.java +++ b/src/ru/nsu/ccfit/zuev/osu/game/GameScene.java @@ -15,7 +15,7 @@ import com.reco1l.osu.Execution; import com.reco1l.osu.graphics.BlankTextureRegion; import com.reco1l.osu.graphics.VideoSprite; -import com.reco1l.osu.ui.entity.InGameLeaderboard; +import com.reco1l.osu.ui.InGameLeaderboard; import com.reco1l.osu.Multiplayer; import com.reco1l.osu.multiplayer.RoomScene; diff --git a/src/ru/nsu/ccfit/zuev/osu/scoring/ScoringScene.java b/src/ru/nsu/ccfit/zuev/osu/scoring/ScoringScene.java index 528d4f175..bca207859 100644 --- a/src/ru/nsu/ccfit/zuev/osu/scoring/ScoringScene.java +++ b/src/ru/nsu/ccfit/zuev/osu/scoring/ScoringScene.java @@ -4,7 +4,7 @@ import com.reco1l.osu.Execution; import com.reco1l.osu.Multiplayer; import com.reco1l.osu.multiplayer.RoomScene; -import com.reco1l.osu.ui.entity.StatisticSelector; +import com.reco1l.osu.ui.StatisticSelector; import com.rian.osu.beatmap.Beatmap; import com.rian.osu.beatmap.parser.BeatmapParser; From 93dfcc7454d8b13804f7003379298fa7c5c3bc3d Mon Sep 17 00:00:00 2001 From: Reco1l Date: Thu, 25 Apr 2024 00:01:04 -0300 Subject: [PATCH 09/22] Move 'Multiplayer' object to 'multiplayer' package --- src/com/edlplan/ui/fragment/InGameSettingMenu.kt | 2 +- src/com/reco1l/api/ibancho/RoomAPI.kt | 2 +- src/com/reco1l/api/ibancho/data/Room.kt | 2 +- src/com/reco1l/api/ibancho/data/RoomMods.kt | 2 +- src/com/reco1l/osu/beatmaplisting/BeatmapDownloader.kt | 2 +- src/com/reco1l/osu/multiplayer/LobbyRoomList.kt | 1 - src/com/reco1l/osu/multiplayer/LobbyScene.kt | 1 - src/com/reco1l/osu/{ => multiplayer}/Multiplayer.kt | 3 +-- src/com/reco1l/osu/multiplayer/RoomChat.kt | 1 - src/com/reco1l/osu/multiplayer/RoomOptions.kt | 1 - src/com/reco1l/osu/multiplayer/RoomPlayerList.kt | 1 - src/com/reco1l/osu/multiplayer/RoomPlayerMenu.kt | 1 - src/com/reco1l/osu/multiplayer/RoomScene.kt | 9 ++++----- src/com/reco1l/osu/ui/BeatmapButton.kt | 2 +- src/com/reco1l/osu/ui/InGameLeaderboard.kt | 2 +- src/com/reco1l/osu/ui/MainMenu.kt | 2 +- src/com/reco1l/osu/ui/StatisticSelector.kt | 2 +- src/com/rian/osu/ui/DifficultyAlgorithmSwitcher.kt | 2 +- src/ru/nsu/ccfit/zuev/osu/AppException.java | 2 +- src/ru/nsu/ccfit/zuev/osu/Config.java | 2 +- src/ru/nsu/ccfit/zuev/osu/MainActivity.java | 2 +- src/ru/nsu/ccfit/zuev/osu/game/BreakAnimator.java | 2 +- src/ru/nsu/ccfit/zuev/osu/game/GameScene.java | 2 +- src/ru/nsu/ccfit/zuev/osu/menu/ModMenu.java | 2 +- src/ru/nsu/ccfit/zuev/osu/menu/ScoreBoard.java | 2 +- src/ru/nsu/ccfit/zuev/osu/menu/ScoreBoardItem.java | 2 +- src/ru/nsu/ccfit/zuev/osu/menu/SongMenu.java | 2 +- src/ru/nsu/ccfit/zuev/osu/scoring/ScoringScene.java | 2 +- src/ru/nsu/ccfit/zuev/osu/scoring/StatisticV2.java | 2 +- 29 files changed, 26 insertions(+), 34 deletions(-) rename src/com/reco1l/osu/{ => multiplayer}/Multiplayer.kt (99%) diff --git a/src/com/edlplan/ui/fragment/InGameSettingMenu.kt b/src/com/edlplan/ui/fragment/InGameSettingMenu.kt index 016af65cd..d7a043608 100644 --- a/src/com/edlplan/ui/fragment/InGameSettingMenu.kt +++ b/src/com/edlplan/ui/fragment/InGameSettingMenu.kt @@ -15,7 +15,7 @@ import com.edlplan.framework.math.FMath import com.edlplan.ui.BaseAnimationListener import com.edlplan.ui.EasingHelper import com.reco1l.osu.mainThread -import com.reco1l.osu.Multiplayer +import com.reco1l.osu.multiplayer.Multiplayer import org.anddev.andengine.input.touch.TouchEvent import ru.nsu.ccfit.zuev.osu.Config import ru.nsu.ccfit.zuev.osu.GlobalManager diff --git a/src/com/reco1l/api/ibancho/RoomAPI.kt b/src/com/reco1l/api/ibancho/RoomAPI.kt index 530ee5b21..7c171568d 100644 --- a/src/com/reco1l/api/ibancho/RoomAPI.kt +++ b/src/com/reco1l/api/ibancho/RoomAPI.kt @@ -4,7 +4,7 @@ import com.dgsrz.bancho.security.SecurityUtils import com.reco1l.api.ibancho.data.* import com.reco1l.api.ibancho.data.Room import com.reco1l.api.ibancho.data.RoomTeam -import com.reco1l.osu.Multiplayer +import com.reco1l.osu.multiplayer.Multiplayer import io.socket.client.IO import io.socket.client.Socket import io.socket.emitter.Emitter.Listener diff --git a/src/com/reco1l/api/ibancho/data/Room.kt b/src/com/reco1l/api/ibancho/data/Room.kt index fef384ce4..afc259f5a 100644 --- a/src/com/reco1l/api/ibancho/data/Room.kt +++ b/src/com/reco1l/api/ibancho/data/Room.kt @@ -1,6 +1,6 @@ package com.reco1l.api.ibancho.data -import com.reco1l.osu.Multiplayer +import com.reco1l.osu.multiplayer.Multiplayer data class Room( /** diff --git a/src/com/reco1l/api/ibancho/data/RoomMods.kt b/src/com/reco1l/api/ibancho/data/RoomMods.kt index e2c9e860c..2d6d93f88 100644 --- a/src/com/reco1l/api/ibancho/data/RoomMods.kt +++ b/src/com/reco1l/api/ibancho/data/RoomMods.kt @@ -1,7 +1,7 @@ package com.reco1l.api.ibancho.data import com.reco1l.osu.conversion.modsToReadable -import com.reco1l.osu.Multiplayer +import com.reco1l.osu.multiplayer.Multiplayer import ru.nsu.ccfit.zuev.osu.game.mods.GameMod import ru.nsu.ccfit.zuev.osu.game.mods.GameMod.* import java.util.* diff --git a/src/com/reco1l/osu/beatmaplisting/BeatmapDownloader.kt b/src/com/reco1l/osu/beatmaplisting/BeatmapDownloader.kt index f13483179..8ef717f8a 100644 --- a/src/com/reco1l/osu/beatmaplisting/BeatmapDownloader.kt +++ b/src/com/reco1l/osu/beatmaplisting/BeatmapDownloader.kt @@ -5,7 +5,7 @@ import android.view.View import com.reco1l.osu.mainThread import com.reco1l.framework.net.FileRequest import com.reco1l.framework.net.IDownloaderObserver -import com.reco1l.osu.Multiplayer +import com.reco1l.osu.multiplayer.Multiplayer import com.reco1l.osu.ui.DownloadFragment import com.reco1l.osu.multiplayer.RoomScene import com.reco1l.toolkt.kotlin.async diff --git a/src/com/reco1l/osu/multiplayer/LobbyRoomList.kt b/src/com/reco1l/osu/multiplayer/LobbyRoomList.kt index 89592ffa2..97f93c809 100644 --- a/src/com/reco1l/osu/multiplayer/LobbyRoomList.kt +++ b/src/com/reco1l/osu/multiplayer/LobbyRoomList.kt @@ -10,7 +10,6 @@ import com.reco1l.api.ibancho.data.TeamMode.HEAD_TO_HEAD import com.reco1l.api.ibancho.data.TeamMode.TEAM_VS_TEAM import com.reco1l.api.ibancho.data.WinCondition.* import com.reco1l.osu.mainThread -import com.reco1l.osu.Multiplayer import com.reco1l.osu.ui.ScrollableList import com.reco1l.toolkt.kotlin.async import org.anddev.andengine.entity.sprite.Sprite diff --git a/src/com/reco1l/osu/multiplayer/LobbyScene.kt b/src/com/reco1l/osu/multiplayer/LobbyScene.kt index 19555e766..0ab8d79aa 100644 --- a/src/com/reco1l/osu/multiplayer/LobbyScene.kt +++ b/src/com/reco1l/osu/multiplayer/LobbyScene.kt @@ -6,7 +6,6 @@ import com.dgsrz.bancho.security.SecurityUtils import com.reco1l.api.ibancho.LobbyAPI import com.reco1l.api.ibancho.RoomAPI import com.reco1l.osu.updateThread -import com.reco1l.osu.Multiplayer import com.reco1l.toolkt.kotlin.async import org.anddev.andengine.entity.modifier.LoopEntityModifier import org.anddev.andengine.entity.modifier.RotationByModifier diff --git a/src/com/reco1l/osu/Multiplayer.kt b/src/com/reco1l/osu/multiplayer/Multiplayer.kt similarity index 99% rename from src/com/reco1l/osu/Multiplayer.kt rename to src/com/reco1l/osu/multiplayer/Multiplayer.kt index e361dee95..a8d0b673c 100644 --- a/src/com/reco1l/osu/Multiplayer.kt +++ b/src/com/reco1l/osu/multiplayer/Multiplayer.kt @@ -1,4 +1,4 @@ -package com.reco1l.osu +package com.reco1l.osu.multiplayer import android.text.format.DateFormat import android.util.Log @@ -7,7 +7,6 @@ import com.reco1l.api.ibancho.data.Room import com.reco1l.api.ibancho.data.RoomPlayer import com.reco1l.osu.conversion.jsonToScoreboardItem import com.reco1l.osu.conversion.jsonToStatistic -import com.reco1l.osu.multiplayer.RoomScene import com.reco1l.toolkt.kotlin.formatTimeMilliseconds import com.reco1l.toolkt.kotlin.fromDate import kotlinx.coroutines.CoroutineScope diff --git a/src/com/reco1l/osu/multiplayer/RoomChat.kt b/src/com/reco1l/osu/multiplayer/RoomChat.kt index f70237e90..0d64f3f34 100644 --- a/src/com/reco1l/osu/multiplayer/RoomChat.kt +++ b/src/com/reco1l/osu/multiplayer/RoomChat.kt @@ -24,7 +24,6 @@ import com.edlplan.ui.fragment.BaseFragment import com.reco1l.api.ibancho.RoomAPI import com.reco1l.api.ibancho.data.RoomPlayer import com.reco1l.osu.mainThread -import com.reco1l.osu.Multiplayer import com.reco1l.toolkt.kotlin.async import org.anddev.andengine.input.touch.TouchEvent import ru.nsu.ccfit.zuev.osu.RGBColor diff --git a/src/com/reco1l/osu/multiplayer/RoomOptions.kt b/src/com/reco1l/osu/multiplayer/RoomOptions.kt index 279bba135..fcc6a7d5e 100644 --- a/src/com/reco1l/osu/multiplayer/RoomOptions.kt +++ b/src/com/reco1l/osu/multiplayer/RoomOptions.kt @@ -29,7 +29,6 @@ import com.reco1l.api.ibancho.data.TeamMode import com.reco1l.api.ibancho.data.WinCondition import com.reco1l.osu.async import com.reco1l.osu.mainThread -import com.reco1l.osu.Multiplayer import ru.nsu.ccfit.zuev.osu.Config import ru.nsu.ccfit.zuev.osu.MainActivity import ru.nsu.ccfit.zuev.osu.ToastLogger diff --git a/src/com/reco1l/osu/multiplayer/RoomPlayerList.kt b/src/com/reco1l/osu/multiplayer/RoomPlayerList.kt index 18a3f4bc7..79d9baf48 100644 --- a/src/com/reco1l/osu/multiplayer/RoomPlayerList.kt +++ b/src/com/reco1l/osu/multiplayer/RoomPlayerList.kt @@ -3,7 +3,6 @@ package com.reco1l.osu.multiplayer import com.reco1l.api.ibancho.data.* import com.reco1l.api.ibancho.data.PlayerStatus.* import com.reco1l.api.ibancho.data.RoomTeam.* -import com.reco1l.osu.Multiplayer import com.reco1l.osu.ui.ScrollableList import org.anddev.andengine.entity.primitive.Rectangle import org.anddev.andengine.entity.sprite.Sprite diff --git a/src/com/reco1l/osu/multiplayer/RoomPlayerMenu.kt b/src/com/reco1l/osu/multiplayer/RoomPlayerMenu.kt index eb6e07b47..d3f6a0a2f 100644 --- a/src/com/reco1l/osu/multiplayer/RoomPlayerMenu.kt +++ b/src/com/reco1l/osu/multiplayer/RoomPlayerMenu.kt @@ -11,7 +11,6 @@ import com.edlplan.ui.fragment.BaseFragment import com.edlplan.ui.fragment.WebViewFragment import com.reco1l.api.ibancho.RoomAPI import com.reco1l.api.ibancho.data.RoomPlayer -import com.reco1l.osu.Multiplayer import ru.nsu.ccfit.zuev.osuplus.R import ru.nsu.ccfit.zuev.osu.GlobalManager.getInstance as getGlobal diff --git a/src/com/reco1l/osu/multiplayer/RoomScene.kt b/src/com/reco1l/osu/multiplayer/RoomScene.kt index b3fb6a471..5bce73fe9 100644 --- a/src/com/reco1l/osu/multiplayer/RoomScene.kt +++ b/src/com/reco1l/osu/multiplayer/RoomScene.kt @@ -14,11 +14,10 @@ import com.reco1l.api.ibancho.data.WinCondition.* import com.reco1l.toolkt.kotlin.runSafe import com.reco1l.osu.updateThread import com.reco1l.osu.mainThread -import com.reco1l.osu.Multiplayer -import com.reco1l.osu.Multiplayer.isConnected -import com.reco1l.osu.Multiplayer.isRoomHost -import com.reco1l.osu.Multiplayer.player -import com.reco1l.osu.Multiplayer.room +import com.reco1l.osu.multiplayer.Multiplayer.isConnected +import com.reco1l.osu.multiplayer.Multiplayer.isRoomHost +import com.reco1l.osu.multiplayer.Multiplayer.player +import com.reco1l.osu.multiplayer.Multiplayer.room import com.reco1l.osu.conversion.modsToString import com.reco1l.osu.ui.BeatmapButton import com.reco1l.osu.ui.ComposedText diff --git a/src/com/reco1l/osu/ui/BeatmapButton.kt b/src/com/reco1l/osu/ui/BeatmapButton.kt index b4d38b4ca..f89559fa1 100644 --- a/src/com/reco1l/osu/ui/BeatmapButton.kt +++ b/src/com/reco1l/osu/ui/BeatmapButton.kt @@ -4,7 +4,7 @@ import com.reco1l.api.ibancho.RoomAPI import com.reco1l.api.ibancho.data.PlayerStatus.READY import com.reco1l.api.ibancho.data.RoomBeatmap import com.reco1l.osu.async -import com.reco1l.osu.Multiplayer +import com.reco1l.osu.multiplayer.Multiplayer import com.reco1l.osu.beatmaplisting.BeatmapDownloader import com.reco1l.osu.beatmaplisting.BeatmapListing import com.reco1l.osu.multiplayer.RoomScene diff --git a/src/com/reco1l/osu/ui/InGameLeaderboard.kt b/src/com/reco1l/osu/ui/InGameLeaderboard.kt index 61cbb7e3f..0235ff9f3 100644 --- a/src/com/reco1l/osu/ui/InGameLeaderboard.kt +++ b/src/com/reco1l/osu/ui/InGameLeaderboard.kt @@ -1,7 +1,7 @@ package com.reco1l.osu.ui import android.opengl.GLES20 -import com.reco1l.osu.Multiplayer.isMultiplayer +import com.reco1l.osu.multiplayer.Multiplayer.isMultiplayer import org.anddev.andengine.entity.Entity import org.anddev.andengine.entity.sprite.Sprite import org.anddev.andengine.entity.text.ChangeableText diff --git a/src/com/reco1l/osu/ui/MainMenu.kt b/src/com/reco1l/osu/ui/MainMenu.kt index a21f0214c..b16ca2d33 100644 --- a/src/com/reco1l/osu/ui/MainMenu.kt +++ b/src/com/reco1l/osu/ui/MainMenu.kt @@ -2,7 +2,7 @@ package com.reco1l.osu.ui import com.reco1l.osu.async import com.reco1l.osu.multiplayer.LobbyScene -import com.reco1l.osu.Multiplayer +import com.reco1l.osu.multiplayer.Multiplayer import com.reco1l.osu.beatmaplisting.BeatmapListing import com.reco1l.osu.multiplayer.RoomScene import org.anddev.andengine.input.touch.TouchEvent diff --git a/src/com/reco1l/osu/ui/StatisticSelector.kt b/src/com/reco1l/osu/ui/StatisticSelector.kt index a8cc615c0..b46861b21 100644 --- a/src/com/reco1l/osu/ui/StatisticSelector.kt +++ b/src/com/reco1l/osu/ui/StatisticSelector.kt @@ -2,7 +2,7 @@ package com.reco1l.osu.ui import android.opengl.GLES20 import com.reco1l.api.ibancho.data.WinCondition.ACCURACY -import com.reco1l.osu.Multiplayer +import com.reco1l.osu.multiplayer.Multiplayer import org.anddev.andengine.entity.scene.Scene.ITouchArea import org.anddev.andengine.entity.sprite.Sprite import org.anddev.andengine.entity.text.ChangeableText diff --git a/src/com/rian/osu/ui/DifficultyAlgorithmSwitcher.kt b/src/com/rian/osu/ui/DifficultyAlgorithmSwitcher.kt index 909249fad..4f06d1da4 100644 --- a/src/com/rian/osu/ui/DifficultyAlgorithmSwitcher.kt +++ b/src/com/rian/osu/ui/DifficultyAlgorithmSwitcher.kt @@ -1,6 +1,6 @@ package com.rian.osu.ui -import com.reco1l.osu.Multiplayer +import com.reco1l.osu.multiplayer.Multiplayer import com.reco1l.osu.multiplayer.RoomScene import org.anddev.andengine.input.touch.TouchEvent import org.anddev.andengine.util.MathUtils diff --git a/src/ru/nsu/ccfit/zuev/osu/AppException.java b/src/ru/nsu/ccfit/zuev/osu/AppException.java index 532047757..c6b5fd867 100644 --- a/src/ru/nsu/ccfit/zuev/osu/AppException.java +++ b/src/ru/nsu/ccfit/zuev/osu/AppException.java @@ -13,7 +13,7 @@ import android.util.Log; import android.widget.Toast; -import com.reco1l.osu.Multiplayer; +import com.reco1l.osu.multiplayer.Multiplayer; import org.apache.http.HttpException; import org.json.JSONException; import org.json.JSONObject; diff --git a/src/ru/nsu/ccfit/zuev/osu/Config.java b/src/ru/nsu/ccfit/zuev/osu/Config.java index 165adb905..441fa4e81 100644 --- a/src/ru/nsu/ccfit/zuev/osu/Config.java +++ b/src/ru/nsu/ccfit/zuev/osu/Config.java @@ -18,7 +18,7 @@ import java.util.Map; import java.util.UUID; -import com.reco1l.osu.Multiplayer; +import com.reco1l.osu.multiplayer.Multiplayer; import net.margaritov.preference.colorpicker.ColorPickerPreference; import org.anddev.andengine.util.Debug; diff --git a/src/ru/nsu/ccfit/zuev/osu/MainActivity.java b/src/ru/nsu/ccfit/zuev/osu/MainActivity.java index 9a77c922a..2190819eb 100644 --- a/src/ru/nsu/ccfit/zuev/osu/MainActivity.java +++ b/src/ru/nsu/ccfit/zuev/osu/MainActivity.java @@ -44,7 +44,7 @@ import com.reco1l.api.ibancho.LobbyAPI; import com.reco1l.osu.AccessibilityDetector; import com.reco1l.osu.Execution; -import com.reco1l.osu.Multiplayer; +import com.reco1l.osu.multiplayer.Multiplayer; import com.reco1l.osu.UpdateManager; import com.reco1l.osu.multiplayer.LobbyScene; import com.reco1l.osu.multiplayer.RoomScene; diff --git a/src/ru/nsu/ccfit/zuev/osu/game/BreakAnimator.java b/src/ru/nsu/ccfit/zuev/osu/game/BreakAnimator.java index 921a6561f..c85d521cf 100644 --- a/src/ru/nsu/ccfit/zuev/osu/game/BreakAnimator.java +++ b/src/ru/nsu/ccfit/zuev/osu/game/BreakAnimator.java @@ -2,7 +2,7 @@ import android.graphics.PointF; -import com.reco1l.osu.Multiplayer; +import com.reco1l.osu.multiplayer.Multiplayer; import com.reco1l.osu.multiplayer.RoomScene; import org.anddev.andengine.entity.modifier.*; import org.anddev.andengine.entity.primitive.Rectangle; diff --git a/src/ru/nsu/ccfit/zuev/osu/game/GameScene.java b/src/ru/nsu/ccfit/zuev/osu/game/GameScene.java index 08c28b345..1df96c152 100644 --- a/src/ru/nsu/ccfit/zuev/osu/game/GameScene.java +++ b/src/ru/nsu/ccfit/zuev/osu/game/GameScene.java @@ -16,7 +16,7 @@ import com.reco1l.osu.graphics.BlankTextureRegion; import com.reco1l.osu.graphics.VideoSprite; import com.reco1l.osu.ui.InGameLeaderboard; -import com.reco1l.osu.Multiplayer; +import com.reco1l.osu.multiplayer.Multiplayer; import com.reco1l.osu.multiplayer.RoomScene; import com.rian.osu.beatmap.Beatmap; diff --git a/src/ru/nsu/ccfit/zuev/osu/menu/ModMenu.java b/src/ru/nsu/ccfit/zuev/osu/menu/ModMenu.java index 747b294e0..624e3797c 100644 --- a/src/ru/nsu/ccfit/zuev/osu/menu/ModMenu.java +++ b/src/ru/nsu/ccfit/zuev/osu/menu/ModMenu.java @@ -4,7 +4,7 @@ import com.reco1l.api.ibancho.RoomAPI; import com.reco1l.osu.Execution; import com.reco1l.osu.conversion.MultiplayerConverter; -import com.reco1l.osu.Multiplayer; +import com.reco1l.osu.multiplayer.Multiplayer; import com.reco1l.api.ibancho.data.RoomMods; import com.reco1l.osu.multiplayer.RoomScene; diff --git a/src/ru/nsu/ccfit/zuev/osu/menu/ScoreBoard.java b/src/ru/nsu/ccfit/zuev/osu/menu/ScoreBoard.java index fcea1e79a..f792c04db 100644 --- a/src/ru/nsu/ccfit/zuev/osu/menu/ScoreBoard.java +++ b/src/ru/nsu/ccfit/zuev/osu/menu/ScoreBoard.java @@ -3,7 +3,7 @@ import android.database.Cursor; import com.reco1l.osu.Execution; -import com.reco1l.osu.Multiplayer; +import com.reco1l.osu.multiplayer.Multiplayer; import org.anddev.andengine.entity.Entity; import org.anddev.andengine.entity.scene.Scene; diff --git a/src/ru/nsu/ccfit/zuev/osu/menu/ScoreBoardItem.java b/src/ru/nsu/ccfit/zuev/osu/menu/ScoreBoardItem.java index 5ae751d0f..b3a2fe072 100644 --- a/src/ru/nsu/ccfit/zuev/osu/menu/ScoreBoardItem.java +++ b/src/ru/nsu/ccfit/zuev/osu/menu/ScoreBoardItem.java @@ -3,7 +3,7 @@ import androidx.annotation.NonNull; import androidx.annotation.Nullable; import com.reco1l.api.ibancho.data.WinCondition; -import com.reco1l.osu.Multiplayer; +import com.reco1l.osu.multiplayer.Multiplayer; import org.json.JSONObject; import java.text.NumberFormat; diff --git a/src/ru/nsu/ccfit/zuev/osu/menu/SongMenu.java b/src/ru/nsu/ccfit/zuev/osu/menu/SongMenu.java index d7811181e..087da576b 100644 --- a/src/ru/nsu/ccfit/zuev/osu/menu/SongMenu.java +++ b/src/ru/nsu/ccfit/zuev/osu/menu/SongMenu.java @@ -11,7 +11,7 @@ import com.edlplan.ui.fragment.ScoreMenuFragment; import com.reco1l.api.ibancho.RoomAPI; import com.reco1l.osu.Execution; -import com.reco1l.osu.Multiplayer; +import com.reco1l.osu.multiplayer.Multiplayer; import com.reco1l.osu.multiplayer.RoomScene; import com.rian.osu.beatmap.parser.BeatmapParser; diff --git a/src/ru/nsu/ccfit/zuev/osu/scoring/ScoringScene.java b/src/ru/nsu/ccfit/zuev/osu/scoring/ScoringScene.java index bca207859..76b90081d 100644 --- a/src/ru/nsu/ccfit/zuev/osu/scoring/ScoringScene.java +++ b/src/ru/nsu/ccfit/zuev/osu/scoring/ScoringScene.java @@ -2,7 +2,7 @@ import com.edlplan.framework.utils.functionality.SmartIterator; import com.reco1l.osu.Execution; -import com.reco1l.osu.Multiplayer; +import com.reco1l.osu.multiplayer.Multiplayer; import com.reco1l.osu.multiplayer.RoomScene; import com.reco1l.osu.ui.StatisticSelector; diff --git a/src/ru/nsu/ccfit/zuev/osu/scoring/StatisticV2.java b/src/ru/nsu/ccfit/zuev/osu/scoring/StatisticV2.java index c07e9f06b..e11411c0d 100644 --- a/src/ru/nsu/ccfit/zuev/osu/scoring/StatisticV2.java +++ b/src/ru/nsu/ccfit/zuev/osu/scoring/StatisticV2.java @@ -8,7 +8,7 @@ import java.util.Random; import com.reco1l.api.ibancho.data.WinCondition; -import com.reco1l.osu.Multiplayer; +import com.reco1l.osu.multiplayer.Multiplayer; import org.jetbrains.annotations.Nullable; import org.json.JSONObject; import ru.nsu.ccfit.zuev.osu.Config; From c6b4f277b10ccb49efa10a86f6b9572498a6bc70 Mon Sep 17 00:00:00 2001 From: Reco1l Date: Thu, 25 Apr 2024 00:02:41 -0300 Subject: [PATCH 10/22] Move 'IniReader' to 'osu' package --- src/com/reco1l/{framework => osu}/IniReader.kt | 2 +- src/com/reco1l/osu/conversion/SkinningConversion.kt | 2 +- src/ru/nsu/ccfit/zuev/osu/ResourceManager.java | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) rename src/com/reco1l/{framework => osu}/IniReader.kt (99%) diff --git a/src/com/reco1l/framework/IniReader.kt b/src/com/reco1l/osu/IniReader.kt similarity index 99% rename from src/com/reco1l/framework/IniReader.kt rename to src/com/reco1l/osu/IniReader.kt index 290c08f03..0883a6c52 100644 --- a/src/com/reco1l/framework/IniReader.kt +++ b/src/com/reco1l/osu/IniReader.kt @@ -1,4 +1,4 @@ -package com.reco1l.framework +package com.reco1l.osu import android.util.Log import okhttp3.internal.toImmutableMap diff --git a/src/com/reco1l/osu/conversion/SkinningConversion.kt b/src/com/reco1l/osu/conversion/SkinningConversion.kt index f4f74a8f6..9b846fd8a 100644 --- a/src/com/reco1l/osu/conversion/SkinningConversion.kt +++ b/src/com/reco1l/osu/conversion/SkinningConversion.kt @@ -7,7 +7,7 @@ import android.graphics.Bitmap.CompressFormat import android.graphics.Bitmap.Config import android.graphics.BitmapFactory import android.graphics.Color -import com.reco1l.framework.IniReader +import com.reco1l.osu.IniReader import com.reco1l.framework.net.JsonContent import org.json.JSONArray import java.io.File diff --git a/src/ru/nsu/ccfit/zuev/osu/ResourceManager.java b/src/ru/nsu/ccfit/zuev/osu/ResourceManager.java index bd4064e19..ea82b448d 100644 --- a/src/ru/nsu/ccfit/zuev/osu/ResourceManager.java +++ b/src/ru/nsu/ccfit/zuev/osu/ResourceManager.java @@ -7,7 +7,7 @@ import com.dgsrz.bancho.security.SecurityUtils; -import com.reco1l.framework.IniReader; +import com.reco1l.osu.IniReader; import com.reco1l.osu.conversion.SkinConverter; import com.reco1l.osu.graphics.BlankTextureRegion; import org.anddev.andengine.engine.Engine; From 714980de4e750e58ee5d09fcdd7979cc8d004e10 Mon Sep 17 00:00:00 2001 From: Reco1l Date: Thu, 25 Apr 2024 00:07:24 -0300 Subject: [PATCH 11/22] Move 'api.ibancho' package to top level 'com.reco1l' package --- .../{api => }/ibancho/IPlayerEventListener.kt | 10 +++---- .../{api => }/ibancho/IRoomEventListener.kt | 11 ++++++-- src/com/reco1l/{api => }/ibancho/LobbyAPI.kt | 10 +++++-- src/com/reco1l/{api => }/ibancho/RoomAPI.kt | 16 ++++++++--- .../{api/ibancho => ibancho/data}/Parsing.kt | 3 +- .../{api => }/ibancho/data/PlayerStatus.kt | 2 +- src/com/reco1l/{api => }/ibancho/data/Room.kt | 2 +- .../{api => }/ibancho/data/RoomBeatmap.kt | 2 +- .../ibancho/data/RoomGameplaySettings.kt | 2 +- .../reco1l/{api => }/ibancho/data/RoomMods.kt | 2 +- .../{api => }/ibancho/data/RoomPlayer.kt | 12 ++++---- .../{api => }/ibancho/data/RoomStatus.kt | 2 +- .../reco1l/{api => }/ibancho/data/RoomTeam.kt | 2 +- .../reco1l/{api => }/ibancho/data/TeamMode.kt | 2 +- .../{api => }/ibancho/data/WinCondition.kt | 2 +- .../reco1l/osu/multiplayer/LobbyCreateRoom.kt | 6 ++-- .../reco1l/osu/multiplayer/LobbyRoomList.kt | 12 ++++---- src/com/reco1l/osu/multiplayer/LobbyScene.kt | 4 +-- src/com/reco1l/osu/multiplayer/Multiplayer.kt | 6 ++-- src/com/reco1l/osu/multiplayer/RoomChat.kt | 4 +-- src/com/reco1l/osu/multiplayer/RoomOptions.kt | 10 +++---- .../reco1l/osu/multiplayer/RoomPlayerList.kt | 8 ++++-- .../reco1l/osu/multiplayer/RoomPlayerMenu.kt | 4 +-- src/com/reco1l/osu/multiplayer/RoomScene.kt | 28 ++++++++++++------- src/com/reco1l/osu/ui/BeatmapButton.kt | 6 ++-- src/com/reco1l/osu/ui/StatisticSelector.kt | 2 +- src/ru/nsu/ccfit/zuev/osu/MainActivity.java | 2 +- src/ru/nsu/ccfit/zuev/osu/game/GameScene.java | 2 +- src/ru/nsu/ccfit/zuev/osu/menu/ModMenu.java | 4 +-- .../ccfit/zuev/osu/menu/ScoreBoardItem.java | 2 +- src/ru/nsu/ccfit/zuev/osu/menu/SongMenu.java | 2 +- .../ccfit/zuev/osu/scoring/StatisticV2.java | 2 +- 32 files changed, 106 insertions(+), 78 deletions(-) rename src/com/reco1l/{api => }/ibancho/IPlayerEventListener.kt (81%) rename src/com/reco1l/{api => }/ibancho/IRoomEventListener.kt (90%) rename src/com/reco1l/{api => }/ibancho/LobbyAPI.kt (90%) rename src/com/reco1l/{api => }/ibancho/RoomAPI.kt (97%) rename src/com/reco1l/{api/ibancho => ibancho/data}/Parsing.kt (97%) rename src/com/reco1l/{api => }/ibancho/data/PlayerStatus.kt (82%) rename src/com/reco1l/{api => }/ibancho/data/Room.kt (99%) rename src/com/reco1l/{api => }/ibancho/data/RoomBeatmap.kt (85%) rename src/com/reco1l/{api => }/ibancho/data/RoomGameplaySettings.kt (92%) rename src/com/reco1l/{api => }/ibancho/data/RoomMods.kt (98%) rename src/com/reco1l/{api => }/ibancho/data/RoomPlayer.kt (86%) rename src/com/reco1l/{api => }/ibancho/data/RoomStatus.kt (81%) rename src/com/reco1l/{api => }/ibancho/data/RoomTeam.kt (86%) rename src/com/reco1l/{api => }/ibancho/data/TeamMode.kt (80%) rename src/com/reco1l/{api => }/ibancho/data/WinCondition.kt (82%) diff --git a/src/com/reco1l/api/ibancho/IPlayerEventListener.kt b/src/com/reco1l/ibancho/IPlayerEventListener.kt similarity index 81% rename from src/com/reco1l/api/ibancho/IPlayerEventListener.kt rename to src/com/reco1l/ibancho/IPlayerEventListener.kt index cc99887cd..42a3efbf5 100644 --- a/src/com/reco1l/api/ibancho/IPlayerEventListener.kt +++ b/src/com/reco1l/ibancho/IPlayerEventListener.kt @@ -1,9 +1,9 @@ -package com.reco1l.api.ibancho +package com.reco1l.ibancho -import com.reco1l.api.ibancho.data.PlayerStatus -import com.reco1l.api.ibancho.data.RoomPlayer -import com.reco1l.api.ibancho.data.RoomTeam -import com.reco1l.api.ibancho.data.RoomMods +import com.reco1l.ibancho.data.PlayerStatus +import com.reco1l.ibancho.data.RoomPlayer +import com.reco1l.ibancho.data.RoomTeam +import com.reco1l.ibancho.data.RoomMods interface IPlayerEventListener { diff --git a/src/com/reco1l/api/ibancho/IRoomEventListener.kt b/src/com/reco1l/ibancho/IRoomEventListener.kt similarity index 90% rename from src/com/reco1l/api/ibancho/IRoomEventListener.kt rename to src/com/reco1l/ibancho/IRoomEventListener.kt index c4cf9c54d..81779a79b 100644 --- a/src/com/reco1l/api/ibancho/IRoomEventListener.kt +++ b/src/com/reco1l/ibancho/IRoomEventListener.kt @@ -1,6 +1,11 @@ -package com.reco1l.api.ibancho - -import com.reco1l.api.ibancho.data.* +package com.reco1l.ibancho + +import com.reco1l.ibancho.data.Room +import com.reco1l.ibancho.data.RoomBeatmap +import com.reco1l.ibancho.data.RoomGameplaySettings +import com.reco1l.ibancho.data.RoomMods +import com.reco1l.ibancho.data.TeamMode +import com.reco1l.ibancho.data.WinCondition import org.json.JSONArray interface IRoomEventListener diff --git a/src/com/reco1l/api/ibancho/LobbyAPI.kt b/src/com/reco1l/ibancho/LobbyAPI.kt similarity index 90% rename from src/com/reco1l/api/ibancho/LobbyAPI.kt rename to src/com/reco1l/ibancho/LobbyAPI.kt index 35bfa1fba..feb07a403 100644 --- a/src/com/reco1l/api/ibancho/LobbyAPI.kt +++ b/src/com/reco1l/ibancho/LobbyAPI.kt @@ -1,8 +1,14 @@ -package com.reco1l.api.ibancho +package com.reco1l.ibancho -import com.reco1l.api.ibancho.data.* import com.reco1l.framework.net.JsonArrayRequest import com.reco1l.framework.net.JsonObjectRequest +import com.reco1l.ibancho.data.Room +import com.reco1l.ibancho.data.RoomBeatmap +import com.reco1l.ibancho.data.RoomStatus +import com.reco1l.ibancho.data.TeamMode +import com.reco1l.ibancho.data.WinCondition +import com.reco1l.ibancho.data.parseGameplaySettings +import com.reco1l.ibancho.data.parseMods import com.reco1l.toolkt.data.putObject object LobbyAPI diff --git a/src/com/reco1l/api/ibancho/RoomAPI.kt b/src/com/reco1l/ibancho/RoomAPI.kt similarity index 97% rename from src/com/reco1l/api/ibancho/RoomAPI.kt rename to src/com/reco1l/ibancho/RoomAPI.kt index 7c171568d..f905bf110 100644 --- a/src/com/reco1l/api/ibancho/RoomAPI.kt +++ b/src/com/reco1l/ibancho/RoomAPI.kt @@ -1,9 +1,17 @@ -package com.reco1l.api.ibancho +package com.reco1l.ibancho import com.dgsrz.bancho.security.SecurityUtils -import com.reco1l.api.ibancho.data.* -import com.reco1l.api.ibancho.data.Room -import com.reco1l.api.ibancho.data.RoomTeam +import com.reco1l.ibancho.data.Room +import com.reco1l.ibancho.data.PlayerStatus +import com.reco1l.ibancho.data.RoomStatus +import com.reco1l.ibancho.data.RoomTeam +import com.reco1l.ibancho.data.TeamMode +import com.reco1l.ibancho.data.WinCondition +import com.reco1l.ibancho.data.parseBeatmap +import com.reco1l.ibancho.data.parseGameplaySettings +import com.reco1l.ibancho.data.parseMods +import com.reco1l.ibancho.data.parsePlayer +import com.reco1l.ibancho.data.parsePlayers import com.reco1l.osu.multiplayer.Multiplayer import io.socket.client.IO import io.socket.client.Socket diff --git a/src/com/reco1l/api/ibancho/Parsing.kt b/src/com/reco1l/ibancho/data/Parsing.kt similarity index 97% rename from src/com/reco1l/api/ibancho/Parsing.kt rename to src/com/reco1l/ibancho/data/Parsing.kt index 002a1580f..6923a53cd 100644 --- a/src/com/reco1l/api/ibancho/Parsing.kt +++ b/src/com/reco1l/ibancho/data/Parsing.kt @@ -1,6 +1,5 @@ -package com.reco1l.api.ibancho +package com.reco1l.ibancho.data -import com.reco1l.api.ibancho.data.* import com.reco1l.osu.conversion.stringToMods import org.json.JSONArray import org.json.JSONObject diff --git a/src/com/reco1l/api/ibancho/data/PlayerStatus.kt b/src/com/reco1l/ibancho/data/PlayerStatus.kt similarity index 82% rename from src/com/reco1l/api/ibancho/data/PlayerStatus.kt rename to src/com/reco1l/ibancho/data/PlayerStatus.kt index 92eb9efa2..97210e7f6 100644 --- a/src/com/reco1l/api/ibancho/data/PlayerStatus.kt +++ b/src/com/reco1l/ibancho/data/PlayerStatus.kt @@ -1,4 +1,4 @@ -package com.reco1l.api.ibancho.data +package com.reco1l.ibancho.data enum class PlayerStatus { diff --git a/src/com/reco1l/api/ibancho/data/Room.kt b/src/com/reco1l/ibancho/data/Room.kt similarity index 99% rename from src/com/reco1l/api/ibancho/data/Room.kt rename to src/com/reco1l/ibancho/data/Room.kt index afc259f5a..a2f2b41ef 100644 --- a/src/com/reco1l/api/ibancho/data/Room.kt +++ b/src/com/reco1l/ibancho/data/Room.kt @@ -1,4 +1,4 @@ -package com.reco1l.api.ibancho.data +package com.reco1l.ibancho.data import com.reco1l.osu.multiplayer.Multiplayer diff --git a/src/com/reco1l/api/ibancho/data/RoomBeatmap.kt b/src/com/reco1l/ibancho/data/RoomBeatmap.kt similarity index 85% rename from src/com/reco1l/api/ibancho/data/RoomBeatmap.kt rename to src/com/reco1l/ibancho/data/RoomBeatmap.kt index e88c122b1..10f2edd6b 100644 --- a/src/com/reco1l/api/ibancho/data/RoomBeatmap.kt +++ b/src/com/reco1l/ibancho/data/RoomBeatmap.kt @@ -1,4 +1,4 @@ -package com.reco1l.api.ibancho.data +package com.reco1l.ibancho.data data class RoomBeatmap ( diff --git a/src/com/reco1l/api/ibancho/data/RoomGameplaySettings.kt b/src/com/reco1l/ibancho/data/RoomGameplaySettings.kt similarity index 92% rename from src/com/reco1l/api/ibancho/data/RoomGameplaySettings.kt rename to src/com/reco1l/ibancho/data/RoomGameplaySettings.kt index 0bc18cf7f..93106114d 100644 --- a/src/com/reco1l/api/ibancho/data/RoomGameplaySettings.kt +++ b/src/com/reco1l/ibancho/data/RoomGameplaySettings.kt @@ -1,4 +1,4 @@ -package com.reco1l.api.ibancho.data +package com.reco1l.ibancho.data /** * Represents gameplay-related settings of a multiplayer room. diff --git a/src/com/reco1l/api/ibancho/data/RoomMods.kt b/src/com/reco1l/ibancho/data/RoomMods.kt similarity index 98% rename from src/com/reco1l/api/ibancho/data/RoomMods.kt rename to src/com/reco1l/ibancho/data/RoomMods.kt index 2d6d93f88..bda4282aa 100644 --- a/src/com/reco1l/api/ibancho/data/RoomMods.kt +++ b/src/com/reco1l/ibancho/data/RoomMods.kt @@ -1,4 +1,4 @@ -package com.reco1l.api.ibancho.data +package com.reco1l.ibancho.data import com.reco1l.osu.conversion.modsToReadable import com.reco1l.osu.multiplayer.Multiplayer diff --git a/src/com/reco1l/api/ibancho/data/RoomPlayer.kt b/src/com/reco1l/ibancho/data/RoomPlayer.kt similarity index 86% rename from src/com/reco1l/api/ibancho/data/RoomPlayer.kt rename to src/com/reco1l/ibancho/data/RoomPlayer.kt index 192458d8e..641701054 100644 --- a/src/com/reco1l/api/ibancho/data/RoomPlayer.kt +++ b/src/com/reco1l/ibancho/data/RoomPlayer.kt @@ -1,28 +1,28 @@ -package com.reco1l.api.ibancho.data +package com.reco1l.ibancho.data data class RoomPlayer ( - /** + /** * The user ID. */ val id: Long, - /** + /** * The username. */ val name: String, - /** + /** * The player status. */ var status: PlayerStatus, - /** + /** * The player team if the mode is set to team versus. */ var team: RoomTeam?, - /** + /** * The player mods. */ var mods: RoomMods diff --git a/src/com/reco1l/api/ibancho/data/RoomStatus.kt b/src/com/reco1l/ibancho/data/RoomStatus.kt similarity index 81% rename from src/com/reco1l/api/ibancho/data/RoomStatus.kt rename to src/com/reco1l/ibancho/data/RoomStatus.kt index 9e14a5514..e38fb04ba 100644 --- a/src/com/reco1l/api/ibancho/data/RoomStatus.kt +++ b/src/com/reco1l/ibancho/data/RoomStatus.kt @@ -1,4 +1,4 @@ -package com.reco1l.api.ibancho.data +package com.reco1l.ibancho.data enum class RoomStatus { diff --git a/src/com/reco1l/api/ibancho/data/RoomTeam.kt b/src/com/reco1l/ibancho/data/RoomTeam.kt similarity index 86% rename from src/com/reco1l/api/ibancho/data/RoomTeam.kt rename to src/com/reco1l/ibancho/data/RoomTeam.kt index a3160d516..ce87893e2 100644 --- a/src/com/reco1l/api/ibancho/data/RoomTeam.kt +++ b/src/com/reco1l/ibancho/data/RoomTeam.kt @@ -1,4 +1,4 @@ -package com.reco1l.api.ibancho.data +package com.reco1l.ibancho.data enum class RoomTeam { diff --git a/src/com/reco1l/api/ibancho/data/TeamMode.kt b/src/com/reco1l/ibancho/data/TeamMode.kt similarity index 80% rename from src/com/reco1l/api/ibancho/data/TeamMode.kt rename to src/com/reco1l/ibancho/data/TeamMode.kt index 186b1ce6a..115de9d45 100644 --- a/src/com/reco1l/api/ibancho/data/TeamMode.kt +++ b/src/com/reco1l/ibancho/data/TeamMode.kt @@ -1,4 +1,4 @@ -package com.reco1l.api.ibancho.data +package com.reco1l.ibancho.data enum class TeamMode { diff --git a/src/com/reco1l/api/ibancho/data/WinCondition.kt b/src/com/reco1l/ibancho/data/WinCondition.kt similarity index 82% rename from src/com/reco1l/api/ibancho/data/WinCondition.kt rename to src/com/reco1l/ibancho/data/WinCondition.kt index 40c34ccd1..4cb1082dd 100644 --- a/src/com/reco1l/api/ibancho/data/WinCondition.kt +++ b/src/com/reco1l/ibancho/data/WinCondition.kt @@ -1,4 +1,4 @@ -package com.reco1l.api.ibancho.data +package com.reco1l.ibancho.data enum class WinCondition { diff --git a/src/com/reco1l/osu/multiplayer/LobbyCreateRoom.kt b/src/com/reco1l/osu/multiplayer/LobbyCreateRoom.kt index afc6591f9..3b8dcf26e 100644 --- a/src/com/reco1l/osu/multiplayer/LobbyCreateRoom.kt +++ b/src/com/reco1l/osu/multiplayer/LobbyCreateRoom.kt @@ -11,9 +11,9 @@ import com.edlplan.framework.easing.Easing import com.edlplan.ui.BaseAnimationListener import com.edlplan.ui.EasingHelper import com.edlplan.ui.fragment.BaseFragment -import com.reco1l.api.ibancho.LobbyAPI -import com.reco1l.api.ibancho.RoomAPI -import com.reco1l.api.ibancho.data.RoomBeatmap +import com.reco1l.ibancho.LobbyAPI +import com.reco1l.ibancho.RoomAPI +import com.reco1l.ibancho.data.RoomBeatmap import com.reco1l.osu.async import com.reco1l.osu.mainThread import ru.nsu.ccfit.zuev.osu.ToastLogger diff --git a/src/com/reco1l/osu/multiplayer/LobbyRoomList.kt b/src/com/reco1l/osu/multiplayer/LobbyRoomList.kt index 97f93c809..acd4bb760 100644 --- a/src/com/reco1l/osu/multiplayer/LobbyRoomList.kt +++ b/src/com/reco1l/osu/multiplayer/LobbyRoomList.kt @@ -3,12 +3,12 @@ package com.reco1l.osu.multiplayer import android.app.AlertDialog import android.view.inputmethod.EditorInfo import android.widget.EditText -import com.reco1l.api.ibancho.RoomAPI -import com.reco1l.api.ibancho.data.Room -import com.reco1l.api.ibancho.data.RoomStatus.* -import com.reco1l.api.ibancho.data.TeamMode.HEAD_TO_HEAD -import com.reco1l.api.ibancho.data.TeamMode.TEAM_VS_TEAM -import com.reco1l.api.ibancho.data.WinCondition.* +import com.reco1l.ibancho.RoomAPI +import com.reco1l.ibancho.data.Room +import com.reco1l.ibancho.data.RoomStatus.* +import com.reco1l.ibancho.data.TeamMode.HEAD_TO_HEAD +import com.reco1l.ibancho.data.TeamMode.TEAM_VS_TEAM +import com.reco1l.ibancho.data.WinCondition.* import com.reco1l.osu.mainThread import com.reco1l.osu.ui.ScrollableList import com.reco1l.toolkt.kotlin.async diff --git a/src/com/reco1l/osu/multiplayer/LobbyScene.kt b/src/com/reco1l/osu/multiplayer/LobbyScene.kt index 0ab8d79aa..346fafd32 100644 --- a/src/com/reco1l/osu/multiplayer/LobbyScene.kt +++ b/src/com/reco1l/osu/multiplayer/LobbyScene.kt @@ -3,8 +3,8 @@ package com.reco1l.osu.multiplayer import android.net.Uri import android.util.Log import com.dgsrz.bancho.security.SecurityUtils -import com.reco1l.api.ibancho.LobbyAPI -import com.reco1l.api.ibancho.RoomAPI +import com.reco1l.ibancho.LobbyAPI +import com.reco1l.ibancho.RoomAPI import com.reco1l.osu.updateThread import com.reco1l.toolkt.kotlin.async import org.anddev.andengine.entity.modifier.LoopEntityModifier diff --git a/src/com/reco1l/osu/multiplayer/Multiplayer.kt b/src/com/reco1l/osu/multiplayer/Multiplayer.kt index a8d0b673c..2c1b42021 100644 --- a/src/com/reco1l/osu/multiplayer/Multiplayer.kt +++ b/src/com/reco1l/osu/multiplayer/Multiplayer.kt @@ -2,9 +2,9 @@ package com.reco1l.osu.multiplayer import android.text.format.DateFormat import android.util.Log -import com.reco1l.api.ibancho.RoomAPI -import com.reco1l.api.ibancho.data.Room -import com.reco1l.api.ibancho.data.RoomPlayer +import com.reco1l.ibancho.RoomAPI +import com.reco1l.ibancho.data.Room +import com.reco1l.ibancho.data.RoomPlayer import com.reco1l.osu.conversion.jsonToScoreboardItem import com.reco1l.osu.conversion.jsonToStatistic import com.reco1l.toolkt.kotlin.formatTimeMilliseconds diff --git a/src/com/reco1l/osu/multiplayer/RoomChat.kt b/src/com/reco1l/osu/multiplayer/RoomChat.kt index 0d64f3f34..b540fe1a0 100644 --- a/src/com/reco1l/osu/multiplayer/RoomChat.kt +++ b/src/com/reco1l/osu/multiplayer/RoomChat.kt @@ -21,8 +21,8 @@ import com.edlplan.framework.easing.Easing import com.edlplan.ui.BaseAnimationListener import com.edlplan.ui.EasingHelper import com.edlplan.ui.fragment.BaseFragment -import com.reco1l.api.ibancho.RoomAPI -import com.reco1l.api.ibancho.data.RoomPlayer +import com.reco1l.ibancho.RoomAPI +import com.reco1l.ibancho.data.RoomPlayer import com.reco1l.osu.mainThread import com.reco1l.toolkt.kotlin.async import org.anddev.andengine.input.touch.TouchEvent diff --git a/src/com/reco1l/osu/multiplayer/RoomOptions.kt b/src/com/reco1l/osu/multiplayer/RoomOptions.kt index fcc6a7d5e..91ca950df 100644 --- a/src/com/reco1l/osu/multiplayer/RoomOptions.kt +++ b/src/com/reco1l/osu/multiplayer/RoomOptions.kt @@ -22,11 +22,11 @@ import com.edlplan.ui.EasingHelper import com.edlplan.ui.SkinPathPreference import com.edlplan.ui.fragment.LoadingFragment import com.edlplan.ui.fragment.SettingsFragment -import com.reco1l.api.ibancho.LobbyAPI -import com.reco1l.api.ibancho.RoomAPI -import com.reco1l.api.ibancho.data.RoomTeam -import com.reco1l.api.ibancho.data.TeamMode -import com.reco1l.api.ibancho.data.WinCondition +import com.reco1l.ibancho.LobbyAPI +import com.reco1l.ibancho.RoomAPI +import com.reco1l.ibancho.data.RoomTeam +import com.reco1l.ibancho.data.TeamMode +import com.reco1l.ibancho.data.WinCondition import com.reco1l.osu.async import com.reco1l.osu.mainThread import ru.nsu.ccfit.zuev.osu.Config diff --git a/src/com/reco1l/osu/multiplayer/RoomPlayerList.kt b/src/com/reco1l/osu/multiplayer/RoomPlayerList.kt index 79d9baf48..0189a96ce 100644 --- a/src/com/reco1l/osu/multiplayer/RoomPlayerList.kt +++ b/src/com/reco1l/osu/multiplayer/RoomPlayerList.kt @@ -1,8 +1,10 @@ package com.reco1l.osu.multiplayer -import com.reco1l.api.ibancho.data.* -import com.reco1l.api.ibancho.data.PlayerStatus.* -import com.reco1l.api.ibancho.data.RoomTeam.* +import com.reco1l.ibancho.data.PlayerStatus.* +import com.reco1l.ibancho.data.Room +import com.reco1l.ibancho.data.RoomPlayer +import com.reco1l.ibancho.data.RoomTeam.* +import com.reco1l.ibancho.data.TeamMode import com.reco1l.osu.ui.ScrollableList import org.anddev.andengine.entity.primitive.Rectangle import org.anddev.andengine.entity.sprite.Sprite diff --git a/src/com/reco1l/osu/multiplayer/RoomPlayerMenu.kt b/src/com/reco1l/osu/multiplayer/RoomPlayerMenu.kt index d3f6a0a2f..a8e4d5394 100644 --- a/src/com/reco1l/osu/multiplayer/RoomPlayerMenu.kt +++ b/src/com/reco1l/osu/multiplayer/RoomPlayerMenu.kt @@ -9,8 +9,8 @@ import com.edlplan.ui.BaseAnimationListener import com.edlplan.ui.EasingHelper import com.edlplan.ui.fragment.BaseFragment import com.edlplan.ui.fragment.WebViewFragment -import com.reco1l.api.ibancho.RoomAPI -import com.reco1l.api.ibancho.data.RoomPlayer +import com.reco1l.ibancho.RoomAPI +import com.reco1l.ibancho.data.RoomPlayer import ru.nsu.ccfit.zuev.osuplus.R import ru.nsu.ccfit.zuev.osu.GlobalManager.getInstance as getGlobal diff --git a/src/com/reco1l/osu/multiplayer/RoomScene.kt b/src/com/reco1l/osu/multiplayer/RoomScene.kt index 5bce73fe9..5e464ac15 100644 --- a/src/com/reco1l/osu/multiplayer/RoomScene.kt +++ b/src/com/reco1l/osu/multiplayer/RoomScene.kt @@ -1,16 +1,24 @@ package com.reco1l.osu.multiplayer import android.app.AlertDialog -import com.reco1l.api.ibancho.IPlayerEventListener -import com.reco1l.api.ibancho.IRoomEventListener -import com.reco1l.api.ibancho.RoomAPI -import com.reco1l.api.ibancho.data.* -import com.reco1l.api.ibancho.data.PlayerStatus.* -import com.reco1l.api.ibancho.data.RoomTeam.BLUE -import com.reco1l.api.ibancho.data.RoomTeam.RED -import com.reco1l.api.ibancho.data.TeamMode.HEAD_TO_HEAD -import com.reco1l.api.ibancho.data.TeamMode.TEAM_VS_TEAM -import com.reco1l.api.ibancho.data.WinCondition.* +import com.reco1l.ibancho.IPlayerEventListener +import com.reco1l.ibancho.IRoomEventListener +import com.reco1l.ibancho.RoomAPI +import com.reco1l.ibancho.data.PlayerStatus.* +import com.reco1l.ibancho.data.RoomTeam.BLUE +import com.reco1l.ibancho.data.RoomTeam.RED +import com.reco1l.ibancho.data.TeamMode.HEAD_TO_HEAD +import com.reco1l.ibancho.data.TeamMode.TEAM_VS_TEAM +import com.reco1l.ibancho.data.WinCondition.* +import com.reco1l.ibancho.data.PlayerStatus +import com.reco1l.ibancho.data.Room +import com.reco1l.ibancho.data.RoomBeatmap +import com.reco1l.ibancho.data.RoomGameplaySettings +import com.reco1l.ibancho.data.RoomMods +import com.reco1l.ibancho.data.RoomPlayer +import com.reco1l.ibancho.data.RoomTeam +import com.reco1l.ibancho.data.TeamMode +import com.reco1l.ibancho.data.WinCondition import com.reco1l.toolkt.kotlin.runSafe import com.reco1l.osu.updateThread import com.reco1l.osu.mainThread diff --git a/src/com/reco1l/osu/ui/BeatmapButton.kt b/src/com/reco1l/osu/ui/BeatmapButton.kt index f89559fa1..828c00097 100644 --- a/src/com/reco1l/osu/ui/BeatmapButton.kt +++ b/src/com/reco1l/osu/ui/BeatmapButton.kt @@ -1,8 +1,8 @@ package com.reco1l.osu.ui -import com.reco1l.api.ibancho.RoomAPI -import com.reco1l.api.ibancho.data.PlayerStatus.READY -import com.reco1l.api.ibancho.data.RoomBeatmap +import com.reco1l.ibancho.RoomAPI +import com.reco1l.ibancho.data.PlayerStatus.READY +import com.reco1l.ibancho.data.RoomBeatmap import com.reco1l.osu.async import com.reco1l.osu.multiplayer.Multiplayer import com.reco1l.osu.beatmaplisting.BeatmapDownloader diff --git a/src/com/reco1l/osu/ui/StatisticSelector.kt b/src/com/reco1l/osu/ui/StatisticSelector.kt index b46861b21..ed30e527a 100644 --- a/src/com/reco1l/osu/ui/StatisticSelector.kt +++ b/src/com/reco1l/osu/ui/StatisticSelector.kt @@ -1,7 +1,7 @@ package com.reco1l.osu.ui import android.opengl.GLES20 -import com.reco1l.api.ibancho.data.WinCondition.ACCURACY +import com.reco1l.ibancho.data.WinCondition.ACCURACY import com.reco1l.osu.multiplayer.Multiplayer import org.anddev.andengine.entity.scene.Scene.ITouchArea import org.anddev.andengine.entity.sprite.Sprite diff --git a/src/ru/nsu/ccfit/zuev/osu/MainActivity.java b/src/ru/nsu/ccfit/zuev/osu/MainActivity.java index 2190819eb..74a686716 100644 --- a/src/ru/nsu/ccfit/zuev/osu/MainActivity.java +++ b/src/ru/nsu/ccfit/zuev/osu/MainActivity.java @@ -41,7 +41,7 @@ import com.edlplan.ui.ActivityOverlay; import com.google.firebase.analytics.FirebaseAnalytics; import com.google.firebase.crashlytics.FirebaseCrashlytics; -import com.reco1l.api.ibancho.LobbyAPI; +import com.reco1l.ibancho.LobbyAPI; import com.reco1l.osu.AccessibilityDetector; import com.reco1l.osu.Execution; import com.reco1l.osu.multiplayer.Multiplayer; diff --git a/src/ru/nsu/ccfit/zuev/osu/game/GameScene.java b/src/ru/nsu/ccfit/zuev/osu/game/GameScene.java index 1df96c152..7c4dcf257 100644 --- a/src/ru/nsu/ccfit/zuev/osu/game/GameScene.java +++ b/src/ru/nsu/ccfit/zuev/osu/game/GameScene.java @@ -11,7 +11,7 @@ import com.edlplan.framework.utils.functionality.SmartIterator; import com.edlplan.osu.support.timing.TimingPoints; import com.edlplan.osu.support.timing.controlpoint.ControlPoints; -import com.reco1l.api.ibancho.RoomAPI; +import com.reco1l.ibancho.RoomAPI; import com.reco1l.osu.Execution; import com.reco1l.osu.graphics.BlankTextureRegion; import com.reco1l.osu.graphics.VideoSprite; diff --git a/src/ru/nsu/ccfit/zuev/osu/menu/ModMenu.java b/src/ru/nsu/ccfit/zuev/osu/menu/ModMenu.java index 624e3797c..716a285e7 100644 --- a/src/ru/nsu/ccfit/zuev/osu/menu/ModMenu.java +++ b/src/ru/nsu/ccfit/zuev/osu/menu/ModMenu.java @@ -1,11 +1,11 @@ package ru.nsu.ccfit.zuev.osu.menu; import com.edlplan.ui.fragment.InGameSettingMenu; -import com.reco1l.api.ibancho.RoomAPI; +import com.reco1l.ibancho.RoomAPI; import com.reco1l.osu.Execution; import com.reco1l.osu.conversion.MultiplayerConverter; import com.reco1l.osu.multiplayer.Multiplayer; -import com.reco1l.api.ibancho.data.RoomMods; +import com.reco1l.ibancho.data.RoomMods; import com.reco1l.osu.multiplayer.RoomScene; import com.rian.osu.beatmap.parser.BeatmapParser; diff --git a/src/ru/nsu/ccfit/zuev/osu/menu/ScoreBoardItem.java b/src/ru/nsu/ccfit/zuev/osu/menu/ScoreBoardItem.java index b3a2fe072..8d9eebe5a 100644 --- a/src/ru/nsu/ccfit/zuev/osu/menu/ScoreBoardItem.java +++ b/src/ru/nsu/ccfit/zuev/osu/menu/ScoreBoardItem.java @@ -2,7 +2,7 @@ import androidx.annotation.NonNull; import androidx.annotation.Nullable; -import com.reco1l.api.ibancho.data.WinCondition; +import com.reco1l.ibancho.data.WinCondition; import com.reco1l.osu.multiplayer.Multiplayer; import org.json.JSONObject; diff --git a/src/ru/nsu/ccfit/zuev/osu/menu/SongMenu.java b/src/ru/nsu/ccfit/zuev/osu/menu/SongMenu.java index 087da576b..df0f652b4 100644 --- a/src/ru/nsu/ccfit/zuev/osu/menu/SongMenu.java +++ b/src/ru/nsu/ccfit/zuev/osu/menu/SongMenu.java @@ -9,7 +9,7 @@ import com.edlplan.ui.fragment.FilterMenuFragment; import com.edlplan.ui.fragment.PropsMenuFragment; import com.edlplan.ui.fragment.ScoreMenuFragment; -import com.reco1l.api.ibancho.RoomAPI; +import com.reco1l.ibancho.RoomAPI; import com.reco1l.osu.Execution; import com.reco1l.osu.multiplayer.Multiplayer; import com.reco1l.osu.multiplayer.RoomScene; diff --git a/src/ru/nsu/ccfit/zuev/osu/scoring/StatisticV2.java b/src/ru/nsu/ccfit/zuev/osu/scoring/StatisticV2.java index e11411c0d..74180ee68 100644 --- a/src/ru/nsu/ccfit/zuev/osu/scoring/StatisticV2.java +++ b/src/ru/nsu/ccfit/zuev/osu/scoring/StatisticV2.java @@ -7,7 +7,7 @@ import java.util.Locale; import java.util.Random; -import com.reco1l.api.ibancho.data.WinCondition; +import com.reco1l.ibancho.data.WinCondition; import com.reco1l.osu.multiplayer.Multiplayer; import org.jetbrains.annotations.Nullable; import org.json.JSONObject; From df2daf229fe8157cdba448f6f3a9d9ee9fd43d55 Mon Sep 17 00:00:00 2001 From: Reco1l Date: Thu, 25 Apr 2024 00:13:59 -0300 Subject: [PATCH 12/22] Move 'SkinConversion' to its own package --- src/com/reco1l/ibancho/data/Parsing.kt | 2 +- src/com/reco1l/ibancho/data/RoomMods.kt | 2 +- src/com/reco1l/osu/multiplayer/Multiplayer.kt | 2 -- .../MultiplayerConversion.kt | 2 +- src/com/reco1l/osu/multiplayer/RoomScene.kt | 1 - .../reco1l/osu/{ => skinning}/IniReader.kt | 11 ++------ .../SkinConversion.kt} | 26 ++++++++++--------- .../nsu/ccfit/zuev/osu/ResourceManager.java | 4 +-- src/ru/nsu/ccfit/zuev/osu/menu/ModMenu.java | 2 +- 9 files changed, 22 insertions(+), 30 deletions(-) rename src/com/reco1l/osu/{conversion => multiplayer}/MultiplayerConversion.kt (99%) rename src/com/reco1l/osu/{ => skinning}/IniReader.kt (94%) rename src/com/reco1l/osu/{conversion/SkinningConversion.kt => skinning/SkinConversion.kt} (89%) diff --git a/src/com/reco1l/ibancho/data/Parsing.kt b/src/com/reco1l/ibancho/data/Parsing.kt index 6923a53cd..cb8f60094 100644 --- a/src/com/reco1l/ibancho/data/Parsing.kt +++ b/src/com/reco1l/ibancho/data/Parsing.kt @@ -1,6 +1,6 @@ package com.reco1l.ibancho.data -import com.reco1l.osu.conversion.stringToMods +import com.reco1l.osu.multiplayer.stringToMods import org.json.JSONArray import org.json.JSONObject diff --git a/src/com/reco1l/ibancho/data/RoomMods.kt b/src/com/reco1l/ibancho/data/RoomMods.kt index bda4282aa..f50d4b82e 100644 --- a/src/com/reco1l/ibancho/data/RoomMods.kt +++ b/src/com/reco1l/ibancho/data/RoomMods.kt @@ -1,6 +1,6 @@ package com.reco1l.ibancho.data -import com.reco1l.osu.conversion.modsToReadable +import com.reco1l.osu.multiplayer.modsToReadable import com.reco1l.osu.multiplayer.Multiplayer import ru.nsu.ccfit.zuev.osu.game.mods.GameMod import ru.nsu.ccfit.zuev.osu.game.mods.GameMod.* diff --git a/src/com/reco1l/osu/multiplayer/Multiplayer.kt b/src/com/reco1l/osu/multiplayer/Multiplayer.kt index 2c1b42021..bd557cda6 100644 --- a/src/com/reco1l/osu/multiplayer/Multiplayer.kt +++ b/src/com/reco1l/osu/multiplayer/Multiplayer.kt @@ -5,8 +5,6 @@ import android.util.Log import com.reco1l.ibancho.RoomAPI import com.reco1l.ibancho.data.Room import com.reco1l.ibancho.data.RoomPlayer -import com.reco1l.osu.conversion.jsonToScoreboardItem -import com.reco1l.osu.conversion.jsonToStatistic import com.reco1l.toolkt.kotlin.formatTimeMilliseconds import com.reco1l.toolkt.kotlin.fromDate import kotlinx.coroutines.CoroutineScope diff --git a/src/com/reco1l/osu/conversion/MultiplayerConversion.kt b/src/com/reco1l/osu/multiplayer/MultiplayerConversion.kt similarity index 99% rename from src/com/reco1l/osu/conversion/MultiplayerConversion.kt rename to src/com/reco1l/osu/multiplayer/MultiplayerConversion.kt index 77f75f474..725751645 100644 --- a/src/com/reco1l/osu/conversion/MultiplayerConversion.kt +++ b/src/com/reco1l/osu/multiplayer/MultiplayerConversion.kt @@ -1,6 +1,6 @@ @file:JvmName("MultiplayerConverter") -package com.reco1l.osu.conversion +package com.reco1l.osu.multiplayer import org.json.JSONObject import ru.nsu.ccfit.zuev.osu.game.mods.GameMod diff --git a/src/com/reco1l/osu/multiplayer/RoomScene.kt b/src/com/reco1l/osu/multiplayer/RoomScene.kt index 5e464ac15..8b7c3cd46 100644 --- a/src/com/reco1l/osu/multiplayer/RoomScene.kt +++ b/src/com/reco1l/osu/multiplayer/RoomScene.kt @@ -26,7 +26,6 @@ import com.reco1l.osu.multiplayer.Multiplayer.isConnected import com.reco1l.osu.multiplayer.Multiplayer.isRoomHost import com.reco1l.osu.multiplayer.Multiplayer.player import com.reco1l.osu.multiplayer.Multiplayer.room -import com.reco1l.osu.conversion.modsToString import com.reco1l.osu.ui.BeatmapButton import com.reco1l.osu.ui.ComposedText import com.rian.osu.ui.DifficultyAlgorithmSwitcher diff --git a/src/com/reco1l/osu/IniReader.kt b/src/com/reco1l/osu/skinning/IniReader.kt similarity index 94% rename from src/com/reco1l/osu/IniReader.kt rename to src/com/reco1l/osu/skinning/IniReader.kt index 0883a6c52..c29fd041e 100644 --- a/src/com/reco1l/osu/IniReader.kt +++ b/src/com/reco1l/osu/skinning/IniReader.kt @@ -1,4 +1,4 @@ -package com.reco1l.osu +package com.reco1l.osu.skinning import android.util.Log import okhttp3.internal.toImmutableMap @@ -24,7 +24,7 @@ class IniReader(file: File) : Closeable { init { - if (file.extension.lowercase() != EXTENSION) + if (file.extension.lowercase() != "ini") throw IniException("Not an INI file.") read() @@ -132,13 +132,6 @@ class IniReader(file: File) : Closeable { return value as? T } - - companion object { - /** - * `.ini` extension constant. - */ - const val EXTENSION = "ini" - } } diff --git a/src/com/reco1l/osu/conversion/SkinningConversion.kt b/src/com/reco1l/osu/skinning/SkinConversion.kt similarity index 89% rename from src/com/reco1l/osu/conversion/SkinningConversion.kt rename to src/com/reco1l/osu/skinning/SkinConversion.kt index 9b846fd8a..7c71c1033 100644 --- a/src/com/reco1l/osu/conversion/SkinningConversion.kt +++ b/src/com/reco1l/osu/skinning/SkinConversion.kt @@ -1,22 +1,22 @@ @file:JvmName("SkinConverter") -package com.reco1l.osu.conversion +package com.reco1l.osu.skinning import android.graphics.Bitmap import android.graphics.Bitmap.CompressFormat import android.graphics.Bitmap.Config import android.graphics.BitmapFactory import android.graphics.Color -import com.reco1l.osu.IniReader -import com.reco1l.framework.net.JsonContent +import com.reco1l.toolkt.data.putObject import org.json.JSONArray +import org.json.JSONObject import java.io.File import java.io.FileOutputStream import java.io.IOException import kotlin.math.min -fun convertToJson(ini: IniReader) = JsonContent().apply { +fun convertToJson(ini: IniReader) = JSONObject().apply { fun convertToHex(ints: IntArray?): String? { @@ -46,12 +46,12 @@ fun convertToJson(ini: IniReader) = JsonContent().apply { }.takeUnless { it.isEmpty() }?.toTypedArray() - putGroup("Cursor").apply { + putObject("Cursor") { put("rotateCursor", ini["General", "CursorRotate"] ?: true) } - putGroup("ComboColor").apply { + putObject("ComboColor") { parseComboColors(ini)?.also { @@ -62,7 +62,7 @@ fun convertToJson(ini: IniReader) = JsonContent().apply { } } - putGroup("Slider").apply { + putObject("Slider") { ini.get("Colours", "SliderTrackOverride")?.also { trackColor -> @@ -88,14 +88,14 @@ fun convertToJson(ini: IniReader) = JsonContent().apply { put("sliderBorderColor", convertToHex(ini["Colours", "SliderBorder"]) ?: "#FFFFFF") } - putGroup("Color").apply { + putObject("Color") { put("MenuItemSelectedTextColor", convertToHex(ini["Colours", "SongSelectActiveText"]) ?: "#FFFFFF") put("MenuItemDefaultTextColor", convertToHex(ini["Colours", "SongSelectInactiveText"]) ?: "#000000") put("MenuItemDefaultColor", "#EB4999") // Matching osu! stable inactive color. } - putGroup("Fonts").apply { + putObject("Fonts") { put("hitCirclePrefix", ini["Fonts", "HitCirclePrefix"] ?: "default") put("hitCircleOverlap", ini["Fonts", "HitCircleOverlap"] ?: -2) @@ -103,13 +103,15 @@ fun convertToJson(ini: IniReader) = JsonContent().apply { put("comboPrefix", ini["Fonts", "ComboPrefix"] ?: "score") } - putGroup("Utils").apply { + putObject("Utils") { put("comboTextScale", 0.8f) } - putGroup("Layout").apply { + putObject("Layout") { - putGroup("BackButton").put("scaleWhenHold", false) + putObject("BackButton") { + put("scaleWhenHold", false) + } } } diff --git a/src/ru/nsu/ccfit/zuev/osu/ResourceManager.java b/src/ru/nsu/ccfit/zuev/osu/ResourceManager.java index ea82b448d..a776d0488 100644 --- a/src/ru/nsu/ccfit/zuev/osu/ResourceManager.java +++ b/src/ru/nsu/ccfit/zuev/osu/ResourceManager.java @@ -7,8 +7,8 @@ import com.dgsrz.bancho.security.SecurityUtils; -import com.reco1l.osu.IniReader; -import com.reco1l.osu.conversion.SkinConverter; +import com.reco1l.osu.skinning.IniReader; +import com.reco1l.osu.skinning.SkinConverter; import com.reco1l.osu.graphics.BlankTextureRegion; import org.anddev.andengine.engine.Engine; import org.anddev.andengine.opengl.font.Font; diff --git a/src/ru/nsu/ccfit/zuev/osu/menu/ModMenu.java b/src/ru/nsu/ccfit/zuev/osu/menu/ModMenu.java index 716a285e7..c972a4b6a 100644 --- a/src/ru/nsu/ccfit/zuev/osu/menu/ModMenu.java +++ b/src/ru/nsu/ccfit/zuev/osu/menu/ModMenu.java @@ -3,9 +3,9 @@ import com.edlplan.ui.fragment.InGameSettingMenu; import com.reco1l.ibancho.RoomAPI; import com.reco1l.osu.Execution; -import com.reco1l.osu.conversion.MultiplayerConverter; import com.reco1l.osu.multiplayer.Multiplayer; import com.reco1l.ibancho.data.RoomMods; +import com.reco1l.osu.multiplayer.MultiplayerConverter; import com.reco1l.osu.multiplayer.RoomScene; import com.rian.osu.beatmap.parser.BeatmapParser; From f2bafcb203253129eebd29b738bb66a4842045d9 Mon Sep 17 00:00:00 2001 From: Reco1l Date: Thu, 25 Apr 2024 00:21:01 -0300 Subject: [PATCH 13/22] Replace some Execution.kt methods with Toolkt library equivalents --- src/com/reco1l/osu/Execution.kt | 28 +++++-------------- src/ru/nsu/ccfit/zuev/osu/MainActivity.java | 2 +- src/ru/nsu/ccfit/zuev/osu/game/GameScene.java | 8 +++--- 3 files changed, 12 insertions(+), 26 deletions(-) diff --git a/src/com/reco1l/osu/Execution.kt b/src/com/reco1l/osu/Execution.kt index 6d33c16a7..54619a03e 100644 --- a/src/com/reco1l/osu/Execution.kt +++ b/src/com/reco1l/osu/Execution.kt @@ -1,40 +1,26 @@ -/* - * @author Reco1l - */ - -@file:OptIn(DelicateCoroutinesApi::class) @file:JvmName("Execution") package com.reco1l.osu -import kotlinx.coroutines.* import kotlinx.coroutines.Runnable import ru.nsu.ccfit.zuev.osu.GlobalManager.getInstance as getGlobal + /** - * Run a task on asynchronous using Kotlin Coroutines API. + * @see [com.reco1l.toolkt.kotlin.async] */ -fun async(block: Runnable) = GlobalScope.launch { - block.run() -} +fun async(block: Runnable) = com.reco1l.toolkt.kotlin.async { block.run() } /** - * Run a task ignoring exceptions on asynchronous using Kotlin Coroutines API. + * @see [com.reco1l.toolkt.kotlin.runSafe] */ -fun asyncIgnoreExceptions(block: Runnable) = GlobalScope.launch { - try { block.run() } catch (e: Exception) { e.printStackTrace() } -} +fun runSafe(block: Runnable) = com.reco1l.toolkt.kotlin.runSafe { block.run() } /** - * Run a delayed task on asynchronous using Kotlin Coroutines API. + * @see [com.reco1l.toolkt.kotlin.delayed] */ -fun delayed(time: Long, block: Runnable) = GlobalScope.launch { - delay(time) - block.run() -} - +fun delayed(time: Long, block: Runnable) = com.reco1l.toolkt.kotlin.delayed(time) { block.run() } -// Exclusive osu!droid fun mainThread(block: Runnable) = getGlobal().mainActivity.runOnUiThread(block) diff --git a/src/ru/nsu/ccfit/zuev/osu/MainActivity.java b/src/ru/nsu/ccfit/zuev/osu/MainActivity.java index 74a686716..4a34d40ea 100644 --- a/src/ru/nsu/ccfit/zuev/osu/MainActivity.java +++ b/src/ru/nsu/ccfit/zuev/osu/MainActivity.java @@ -723,7 +723,7 @@ && getEngine().getScene() == GlobalManager.getInstance().getGameScene().getScene if (Multiplayer.isConnected() && (getEngine().getScene() == RoomScene.INSTANCE || getEngine().getScene() == GlobalManager.getInstance().getSongMenu().getScene())) { - Execution.asyncIgnoreExceptions(RoomScene.INSTANCE::invalidateStatus); + Execution.async(() -> Execution.runSafe(RoomScene.INSTANCE::invalidateStatus)); } } diff --git a/src/ru/nsu/ccfit/zuev/osu/game/GameScene.java b/src/ru/nsu/ccfit/zuev/osu/game/GameScene.java index 7c4dcf257..2494104a3 100644 --- a/src/ru/nsu/ccfit/zuev/osu/game/GameScene.java +++ b/src/ru/nsu/ccfit/zuev/osu/game/GameScene.java @@ -1153,7 +1153,7 @@ public void onUpdate(final float pSecondsElapsed) { if (!Objects.equals(liveScore, lastScoreSent)) { lastScoreSent = liveScore; - Execution.asyncIgnoreExceptions(() -> RoomAPI.submitLiveScore(lastScoreSent.toJson())); + Execution.async(() -> Execution.runSafe(() -> RoomAPI.submitLiveScore(lastScoreSent.toJson()))); } } } @@ -1724,7 +1724,7 @@ public void onUpdate(final float pSecondsElapsed) { Multiplayer.log("Match ended, moving to results scene."); RoomScene.INSTANCE.getChat().show(); - Execution.asyncIgnoreExceptions(() -> RoomAPI.submitFinalScore(stat.toJson())); + Execution.async(() -> Execution.runSafe(() -> RoomAPI.submitFinalScore(stat.toJson()))); ToastLogger.showText("Loading room statistics...", false); } @@ -2419,7 +2419,7 @@ public void pause() { { // Room being null can happen when the player disconnects from socket while playing if (Multiplayer.isConnected()) - Execution.asyncIgnoreExceptions(() -> RoomAPI.submitFinalScore(stat.toJson())); + Execution.async(() -> Execution.runSafe(() -> RoomAPI.submitFinalScore(stat.toJson()))); Multiplayer.log("Player left the match."); quit(); @@ -2471,7 +2471,7 @@ public void gameover() { if (Multiplayer.isConnected()) { Multiplayer.log("Player has lost, moving to room scene."); - Execution.asyncIgnoreExceptions(() -> RoomAPI.submitFinalScore(stat.toJson())); + Execution.async(() -> Execution.runSafe(() -> RoomAPI.submitFinalScore(stat.toJson()))); } quit(); return; From e5390120bfbacf45a4cc20c1c234f7635e9192b1 Mon Sep 17 00:00:00 2001 From: Reco1l Date: Thu, 25 Apr 2024 00:27:52 -0300 Subject: [PATCH 14/22] Fix compiler warning upon SDK upgrade. --- src/ru/nsu/ccfit/zuev/push/PushNotificationService.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ru/nsu/ccfit/zuev/push/PushNotificationService.java b/src/ru/nsu/ccfit/zuev/push/PushNotificationService.java index a75f74463..76412e4a6 100644 --- a/src/ru/nsu/ccfit/zuev/push/PushNotificationService.java +++ b/src/ru/nsu/ccfit/zuev/push/PushNotificationService.java @@ -60,7 +60,7 @@ public void onMessageReceived(RemoteMessage remoteMessage) { notificationBuilder.setLargeIcon(bitmap) .setStyle(new NotificationCompat.BigPictureStyle() .bigPicture(bitmap) - .bigLargeIcon(null)); + .bigLargeIcon((Bitmap) null)); } } From 1bb55415e7eaaf452107da4d2effc2eec8d8e6bd Mon Sep 17 00:00:00 2001 From: Reco1l Date: Thu, 25 Apr 2024 11:36:42 -0300 Subject: [PATCH 15/22] Add secondary constructors for WebRequest types --- src/com/reco1l/framework/net/FileRequest.kt | 7 ++++++- src/com/reco1l/framework/net/JsonRequest.kt | 20 ++++++++++++++------ src/com/reco1l/framework/net/WebRequest.kt | 9 +++------ 3 files changed, 23 insertions(+), 13 deletions(-) diff --git a/src/com/reco1l/framework/net/FileRequest.kt b/src/com/reco1l/framework/net/FileRequest.kt index 5337aaad9..aac3307b6 100644 --- a/src/com/reco1l/framework/net/FileRequest.kt +++ b/src/com/reco1l/framework/net/FileRequest.kt @@ -1,9 +1,14 @@ package com.reco1l.framework.net +import okhttp3.HttpUrl +import okhttp3.HttpUrl.Companion.toHttpUrl import okhttp3.Response import java.io.File -class FileRequest(val file: File, url: String): WebRequest(url) { +class FileRequest(val file: File, url: HttpUrl): WebRequest(url) { + + constructor(file: File, url: String): this(file, url.toHttpUrl()) + /** * The download observer. diff --git a/src/com/reco1l/framework/net/JsonRequest.kt b/src/com/reco1l/framework/net/JsonRequest.kt index d996c2646..a4a5c0929 100644 --- a/src/com/reco1l/framework/net/JsonRequest.kt +++ b/src/com/reco1l/framework/net/JsonRequest.kt @@ -1,19 +1,21 @@ package com.reco1l.framework.net import android.util.Log -import com.reco1l.toolkt.data.asJSONObject import com.reco1l.toolkt.kotlin.isBetween +import okhttp3.HttpUrl +import okhttp3.HttpUrl.Companion.toHttpUrl import okhttp3.MediaType.Companion.toMediaTypeOrNull import okhttp3.RequestBody.Companion.toRequestBody import okhttp3.Response -import okio.IOException import org.json.JSONArray import org.json.JSONException import org.json.JSONObject import ru.nsu.ccfit.zuev.osuplus.BuildConfig -sealed class JsonRequest(url: String) : WebRequest(url) -{ +sealed class JsonRequest(url: HttpUrl) : WebRequest(url) { + + constructor(url: String): this(url.toHttpUrl()) + /** * Whether response should be logged. @@ -62,7 +64,10 @@ sealed class JsonRequest(url: String) : WebRequest(url) } -class JsonObjectRequest(url: String) : JsonRequest(url) { +class JsonObjectRequest(url: HttpUrl) : JsonRequest(url) { + + constructor(url: String): this(url.toHttpUrl()) + override fun onCreateResponseJson(responseBody: String): JSONObject { @@ -81,7 +86,10 @@ class JsonObjectRequest(url: String) : JsonRequest(url) { } -class JsonArrayRequest(url: String) : JsonRequest(url) { +class JsonArrayRequest(url: HttpUrl) : JsonRequest(url) { + + constructor(url: String): this(url.toHttpUrl()) + override fun onCreateResponseJson(responseBody: String): JSONArray { diff --git a/src/com/reco1l/framework/net/WebRequest.kt b/src/com/reco1l/framework/net/WebRequest.kt index 278e23b87..019a4f9bf 100644 --- a/src/com/reco1l/framework/net/WebRequest.kt +++ b/src/com/reco1l/framework/net/WebRequest.kt @@ -8,10 +8,9 @@ import java.io.IOException import java.util.* import java.util.concurrent.TimeUnit -/** - * @author Reco1l - */ -open class WebRequest(link: String) : AutoCloseable { +open class WebRequest(private var url: HttpUrl) : AutoCloseable { + + constructor(url: String): this(url.toHttpUrl()) /** @@ -27,8 +26,6 @@ open class WebRequest(link: String) : AutoCloseable { lateinit var responseBody: ResponseBody - private var url = link.toHttpUrl() - private var client = DEFAULT_CLIENT private var request = Request.Builder().url(url).build() From 5c39d0e1139a48a63c86204e71c75adc82add381 Mon Sep 17 00:00:00 2001 From: Reco1l Date: Thu, 25 Apr 2024 11:38:08 -0300 Subject: [PATCH 16/22] Add missing access modifier --- src/com/reco1l/framework/net/WebRequest.kt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/com/reco1l/framework/net/WebRequest.kt b/src/com/reco1l/framework/net/WebRequest.kt index 019a4f9bf..87a54d164 100644 --- a/src/com/reco1l/framework/net/WebRequest.kt +++ b/src/com/reco1l/framework/net/WebRequest.kt @@ -18,12 +18,14 @@ open class WebRequest(private var url: HttpUrl) : AutoCloseable { * successfully called. */ lateinit var response: Response + protected set /** * The response body got upon request, this will not be initialized until [execute] has been * successfully called. */ lateinit var responseBody: ResponseBody + protected set private var client = DEFAULT_CLIENT From 08b42ac6173d9622c36f723926f5371074df2f7b Mon Sep 17 00:00:00 2001 From: Reco1l Date: Fri, 26 Apr 2024 22:47:13 -0300 Subject: [PATCH 17/22] Add missing execute() call --- src/com/reco1l/ibancho/LobbyAPI.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/com/reco1l/ibancho/LobbyAPI.kt b/src/com/reco1l/ibancho/LobbyAPI.kt index feb07a403..de41f22b7 100644 --- a/src/com/reco1l/ibancho/LobbyAPI.kt +++ b/src/com/reco1l/ibancho/LobbyAPI.kt @@ -48,7 +48,7 @@ object LobbyAPI } } - return List(it.json.length()) { i -> + return List(it.execute().json.length()) { i -> val json = it.json.optJSONObject(i) From 850f588bb7aa9779783079227a99ba43b239712e Mon Sep 17 00:00:00 2001 From: Reco1l Date: Fri, 26 Apr 2024 23:43:42 -0300 Subject: [PATCH 18/22] Rename 'InGameLeaderboard' to 'GameplayLeaderboard' --- .../osu/ui/{InGameLeaderboard.kt => GameplayLeaderboard.kt} | 2 +- src/ru/nsu/ccfit/zuev/osu/game/GameScene.java | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) rename src/com/reco1l/osu/ui/{InGameLeaderboard.kt => GameplayLeaderboard.kt} (99%) diff --git a/src/com/reco1l/osu/ui/InGameLeaderboard.kt b/src/com/reco1l/osu/ui/GameplayLeaderboard.kt similarity index 99% rename from src/com/reco1l/osu/ui/InGameLeaderboard.kt rename to src/com/reco1l/osu/ui/GameplayLeaderboard.kt index 0235ff9f3..8a5cb2924 100644 --- a/src/com/reco1l/osu/ui/InGameLeaderboard.kt +++ b/src/com/reco1l/osu/ui/GameplayLeaderboard.kt @@ -11,7 +11,7 @@ import ru.nsu.ccfit.zuev.osu.scoring.StatisticV2 import ru.nsu.ccfit.zuev.osu.GlobalManager.getInstance as getGlobal import ru.nsu.ccfit.zuev.osu.ResourceManager.getInstance as getResources -class InGameLeaderboard(var playerName: String, private val stats: StatisticV2) : Entity(0f, 0f) +class GameplayLeaderboard(var playerName: String, private val stats: StatisticV2) : Entity(0f, 0f) { var nextItems: List? = null diff --git a/src/ru/nsu/ccfit/zuev/osu/game/GameScene.java b/src/ru/nsu/ccfit/zuev/osu/game/GameScene.java index 2494104a3..803de52c7 100644 --- a/src/ru/nsu/ccfit/zuev/osu/game/GameScene.java +++ b/src/ru/nsu/ccfit/zuev/osu/game/GameScene.java @@ -15,7 +15,7 @@ import com.reco1l.osu.Execution; import com.reco1l.osu.graphics.BlankTextureRegion; import com.reco1l.osu.graphics.VideoSprite; -import com.reco1l.osu.ui.InGameLeaderboard; +import com.reco1l.osu.ui.GameplayLeaderboard; import com.reco1l.osu.multiplayer.Multiplayer; import com.reco1l.osu.multiplayer.RoomScene; @@ -141,7 +141,7 @@ public class GameScene implements IUpdateHandler, GameObjectListener, private Queue breakPeriods = new LinkedList<>(); private BreakAnimator breakAnimator; private ScoreBar scorebar; - public InGameLeaderboard scoreBoard; + public GameplayLeaderboard scoreBoard; private HitErrorMeter hitErrorMeter; private Metronome metronome; private boolean isFirst = true; @@ -1068,7 +1068,7 @@ public void onUpdate(final float pSecondsElapsed) { } if (Config.isShowScoreboard()) { - scoreBoard = new InGameLeaderboard(playname, stat); + scoreBoard = new GameplayLeaderboard(playname, stat); fgScene.attachChild(scoreBoard); } From dd1b12d4cc574f2f4d023818a99a50cb40230aa8 Mon Sep 17 00:00:00 2001 From: Reco1l Date: Tue, 30 Apr 2024 14:17:56 -0300 Subject: [PATCH 19/22] Optimize imports --- src/com/reco1l/ibancho/RoomAPI.kt | 12 +++++++- .../osu/beatmaplisting/BeatmapListing.kt | 28 +++++++++++++++---- src/com/reco1l/osu/multiplayer/RoomScene.kt | 24 ++++++++++------ 3 files changed, 48 insertions(+), 16 deletions(-) diff --git a/src/com/reco1l/ibancho/RoomAPI.kt b/src/com/reco1l/ibancho/RoomAPI.kt index 1b0005c61..37f101a54 100644 --- a/src/com/reco1l/ibancho/RoomAPI.kt +++ b/src/com/reco1l/ibancho/RoomAPI.kt @@ -1,7 +1,17 @@ package com.reco1l.ibancho import com.dgsrz.bancho.security.SecurityUtils -import com.reco1l.ibancho.data.* +import com.reco1l.ibancho.data.PlayerStatus +import com.reco1l.ibancho.data.Room +import com.reco1l.ibancho.data.RoomStatus +import com.reco1l.ibancho.data.RoomTeam +import com.reco1l.ibancho.data.TeamMode +import com.reco1l.ibancho.data.WinCondition +import com.reco1l.ibancho.data.parseBeatmap +import com.reco1l.ibancho.data.parseGameplaySettings +import com.reco1l.ibancho.data.parseMods +import com.reco1l.ibancho.data.parsePlayer +import com.reco1l.ibancho.data.parsePlayers import com.reco1l.osu.multiplayer.Multiplayer import io.socket.client.IO import io.socket.client.Socket diff --git a/src/com/reco1l/osu/beatmaplisting/BeatmapListing.kt b/src/com/reco1l/osu/beatmaplisting/BeatmapListing.kt index b17c93ae1..2569b3c45 100644 --- a/src/com/reco1l/osu/beatmaplisting/BeatmapListing.kt +++ b/src/com/reco1l/osu/beatmaplisting/BeatmapListing.kt @@ -2,10 +2,22 @@ package com.reco1l.osu.beatmaplisting import android.graphics.BitmapFactory import android.util.Log -import android.view.* -import android.view.View.* +import android.view.ContextThemeWrapper +import android.view.KeyEvent +import android.view.LayoutInflater +import android.view.View +import android.view.View.GONE +import android.view.View.OnKeyListener +import android.view.View.VISIBLE +import android.view.ViewGroup +import android.view.ViewOutlineProvider import android.view.inputmethod.EditorInfo -import android.widget.* +import android.widget.Button +import android.widget.EditText +import android.widget.ImageButton +import android.widget.ImageView +import android.widget.LinearLayout +import android.widget.TextView import android.widget.TextView.OnEditorActionListener import androidx.core.text.buildSpannedString import androidx.core.text.color @@ -17,11 +29,15 @@ import androidx.recyclerview.widget.RecyclerView.OnScrollListener import com.edlplan.ui.fragment.BaseFragment import com.google.android.material.progressindicator.CircularProgressIndicator import com.reco1l.framework.bass.URLBassStream -import com.reco1l.osu.mainThread import com.reco1l.framework.net.IDownloaderObserver import com.reco1l.framework.net.JsonArrayRequest import com.reco1l.osu.OsuColors -import kotlinx.coroutines.* +import com.reco1l.osu.mainThread +import kotlinx.coroutines.CoroutineExceptionHandler +import kotlinx.coroutines.CoroutineScope +import kotlinx.coroutines.Dispatchers +import kotlinx.coroutines.Job +import kotlinx.coroutines.launch import ru.nsu.ccfit.zuev.audio.Status import ru.nsu.ccfit.zuev.osu.Config import ru.nsu.ccfit.zuev.osu.GlobalManager @@ -30,7 +46,7 @@ import ru.nsu.ccfit.zuev.osu.ToastLogger import ru.nsu.ccfit.zuev.osuplus.R import java.net.URL import java.text.SimpleDateFormat -import java.util.* +import java.util.TimeZone object BeatmapListing : BaseFragment(), diff --git a/src/com/reco1l/osu/multiplayer/RoomScene.kt b/src/com/reco1l/osu/multiplayer/RoomScene.kt index 8aeafd782..c4d2334a0 100644 --- a/src/com/reco1l/osu/multiplayer/RoomScene.kt +++ b/src/com/reco1l/osu/multiplayer/RoomScene.kt @@ -4,23 +4,27 @@ import android.app.AlertDialog import com.reco1l.ibancho.IPlayerEventListener import com.reco1l.ibancho.IRoomEventListener import com.reco1l.ibancho.RoomAPI -import com.reco1l.ibancho.data.PlayerStatus.* -import com.reco1l.ibancho.data.RoomTeam.BLUE -import com.reco1l.ibancho.data.RoomTeam.RED -import com.reco1l.ibancho.data.TeamMode.HEAD_TO_HEAD -import com.reco1l.ibancho.data.TeamMode.TEAM_VS_TEAM -import com.reco1l.ibancho.data.WinCondition.* import com.reco1l.ibancho.data.PlayerStatus +import com.reco1l.ibancho.data.PlayerStatus.MISSING_BEATMAP +import com.reco1l.ibancho.data.PlayerStatus.NOT_READY +import com.reco1l.ibancho.data.PlayerStatus.PLAYING +import com.reco1l.ibancho.data.PlayerStatus.READY import com.reco1l.ibancho.data.Room import com.reco1l.ibancho.data.RoomBeatmap import com.reco1l.ibancho.data.RoomGameplaySettings import com.reco1l.ibancho.data.RoomMods import com.reco1l.ibancho.data.RoomPlayer import com.reco1l.ibancho.data.RoomTeam +import com.reco1l.ibancho.data.RoomTeam.BLUE +import com.reco1l.ibancho.data.RoomTeam.RED import com.reco1l.ibancho.data.TeamMode +import com.reco1l.ibancho.data.TeamMode.HEAD_TO_HEAD +import com.reco1l.ibancho.data.TeamMode.TEAM_VS_TEAM import com.reco1l.ibancho.data.WinCondition -import com.reco1l.toolkt.kotlin.runSafe -import com.reco1l.osu.updateThread +import com.reco1l.ibancho.data.WinCondition.ACCURACY +import com.reco1l.ibancho.data.WinCondition.MAX_COMBO +import com.reco1l.ibancho.data.WinCondition.SCORE_V1 +import com.reco1l.ibancho.data.WinCondition.SCORE_V2 import com.reco1l.osu.mainThread import com.reco1l.osu.multiplayer.Multiplayer.isConnected import com.reco1l.osu.multiplayer.Multiplayer.isRoomHost @@ -28,6 +32,8 @@ import com.reco1l.osu.multiplayer.Multiplayer.player import com.reco1l.osu.multiplayer.Multiplayer.room import com.reco1l.osu.ui.BeatmapButton import com.reco1l.osu.ui.ComposedText +import com.reco1l.osu.updateThread +import com.reco1l.toolkt.kotlin.runSafe import com.rian.osu.ui.DifficultyAlgorithmSwitcher import org.anddev.andengine.engine.camera.SmoothCamera import org.anddev.andengine.entity.primitive.Rectangle @@ -49,7 +55,7 @@ import ru.nsu.ccfit.zuev.osu.online.OnlinePanel import ru.nsu.ccfit.zuev.osu.scoring.Replay import ru.nsu.ccfit.zuev.skins.OsuSkin import java.text.SimpleDateFormat -import java.util.* +import java.util.TimeZone import ru.nsu.ccfit.zuev.osu.GlobalManager.getInstance as getGlobal import ru.nsu.ccfit.zuev.osu.LibraryManager.INSTANCE as library import ru.nsu.ccfit.zuev.osu.ResourceManager.getInstance as getResources From 35a0eccce289d2b8c1cdc2b580de3e904baab33c Mon Sep 17 00:00:00 2001 From: Reco1l Date: Tue, 30 Apr 2024 14:22:07 -0300 Subject: [PATCH 20/22] Rename 'IniReader.kt' to 'SkinIniReader.kt' --- src/com/reco1l/osu/skinning/{IniReader.kt => SkinIniReader.kt} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename src/com/reco1l/osu/skinning/{IniReader.kt => SkinIniReader.kt} (100%) diff --git a/src/com/reco1l/osu/skinning/IniReader.kt b/src/com/reco1l/osu/skinning/SkinIniReader.kt similarity index 100% rename from src/com/reco1l/osu/skinning/IniReader.kt rename to src/com/reco1l/osu/skinning/SkinIniReader.kt From f71d02d3d291e9d680e47ca09dfcea8b4d8ba3fe Mon Sep 17 00:00:00 2001 From: Reco1l Date: Tue, 30 Apr 2024 14:36:46 -0300 Subject: [PATCH 21/22] Fix wrong \n in beatmap set card --- src/com/reco1l/osu/beatmaplisting/BeatmapListing.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/com/reco1l/osu/beatmaplisting/BeatmapListing.kt b/src/com/reco1l/osu/beatmaplisting/BeatmapListing.kt index 2569b3c45..ef3bb8958 100644 --- a/src/com/reco1l/osu/beatmaplisting/BeatmapListing.kt +++ b/src/com/reco1l/osu/beatmaplisting/BeatmapListing.kt @@ -350,7 +350,7 @@ class BeatmapSetDetails(val beatmapSet: BeatmapSetModel, val holder: BeatmapSetV append("Star rating: ${beatmap.starRating}") appendLine() - append("AR: ${beatmap.ar} - OD: ${beatmap.od} - CS: ${beatmap.cs} - HP: ${beatmap.hp}\n") + append("AR: ${beatmap.ar} - OD: ${beatmap.od} - CS: ${beatmap.cs} - HP: ${beatmap.hp}") appendLine() append("Circles: ${beatmap.circleCount} - Sliders: ${beatmap.sliderCount} - Spinners: ${beatmap.spinnerCount}") From 8a13193b9ae49b7ee4968bdf2e4037e72677d18e Mon Sep 17 00:00:00 2001 From: "Rian (Reza Mouna Hendrian)" <52914632+Rian8337@users.noreply.github.com> Date: Wed, 1 May 2024 15:23:19 +0800 Subject: [PATCH 22/22] Fix few CodeFactor inspections --- src/com/reco1l/framework/net/FileRequest.kt | 2 +- src/com/reco1l/ibancho/data/RoomMods.kt | 6 ++--- src/com/reco1l/osu/multiplayer/RoomScene.kt | 30 ++++++--------------- src/com/reco1l/osu/ui/StatisticSelector.kt | 2 +- 4 files changed, 13 insertions(+), 27 deletions(-) diff --git a/src/com/reco1l/framework/net/FileRequest.kt b/src/com/reco1l/framework/net/FileRequest.kt index aac3307b6..54a5ea4d6 100644 --- a/src/com/reco1l/framework/net/FileRequest.kt +++ b/src/com/reco1l/framework/net/FileRequest.kt @@ -71,7 +71,7 @@ class FileRequest(val file: File, url: HttpUrl): WebRequest(url) { val elapsedMilliseconds = (System.currentTimeMillis() - startTime).toFloat() progress = totalBytes / length * 100 - speedKbps = (totalBytes / elapsedMilliseconds) / 1024f * 1000f + speedKbps = totalBytes / elapsedMilliseconds / 1024f * 1000f observer?.onDownloadUpdate(this) } diff --git a/src/com/reco1l/ibancho/data/RoomMods.kt b/src/com/reco1l/ibancho/data/RoomMods.kt index f50d4b82e..4d4d87b87 100644 --- a/src/com/reco1l/ibancho/data/RoomMods.kt +++ b/src/com/reco1l/ibancho/data/RoomMods.kt @@ -1,7 +1,7 @@ package com.reco1l.ibancho.data -import com.reco1l.osu.multiplayer.modsToReadable import com.reco1l.osu.multiplayer.Multiplayer +import com.reco1l.osu.multiplayer.modsToReadable import ru.nsu.ccfit.zuev.osu.game.mods.GameMod import ru.nsu.ccfit.zuev.osu.game.mods.GameMod.* import java.util.* @@ -73,9 +73,9 @@ data class RoomMods( // DoubleTime and NightCore, comparing them as one. && (MOD_DOUBLETIME in set || MOD_NIGHTCORE in set) == (MOD_DOUBLETIME in other.set || MOD_NIGHTCORE in other.set) // HalfTime - && (MOD_HALFTIME in set == MOD_HALFTIME in other.set) + && MOD_HALFTIME in set == MOD_HALFTIME in other.set // ScoreV2 - && (MOD_SCOREV2 in set == MOD_SCOREV2 in other.set) + && MOD_SCOREV2 in set == MOD_SCOREV2 in other.set || set == other.set diff --git a/src/com/reco1l/osu/multiplayer/RoomScene.kt b/src/com/reco1l/osu/multiplayer/RoomScene.kt index c4d2334a0..f4c623253 100644 --- a/src/com/reco1l/osu/multiplayer/RoomScene.kt +++ b/src/com/reco1l/osu/multiplayer/RoomScene.kt @@ -4,27 +4,13 @@ import android.app.AlertDialog import com.reco1l.ibancho.IPlayerEventListener import com.reco1l.ibancho.IRoomEventListener import com.reco1l.ibancho.RoomAPI -import com.reco1l.ibancho.data.PlayerStatus -import com.reco1l.ibancho.data.PlayerStatus.MISSING_BEATMAP -import com.reco1l.ibancho.data.PlayerStatus.NOT_READY -import com.reco1l.ibancho.data.PlayerStatus.PLAYING -import com.reco1l.ibancho.data.PlayerStatus.READY -import com.reco1l.ibancho.data.Room -import com.reco1l.ibancho.data.RoomBeatmap -import com.reco1l.ibancho.data.RoomGameplaySettings -import com.reco1l.ibancho.data.RoomMods -import com.reco1l.ibancho.data.RoomPlayer -import com.reco1l.ibancho.data.RoomTeam +import com.reco1l.ibancho.data.* +import com.reco1l.ibancho.data.PlayerStatus.* import com.reco1l.ibancho.data.RoomTeam.BLUE import com.reco1l.ibancho.data.RoomTeam.RED -import com.reco1l.ibancho.data.TeamMode import com.reco1l.ibancho.data.TeamMode.HEAD_TO_HEAD import com.reco1l.ibancho.data.TeamMode.TEAM_VS_TEAM -import com.reco1l.ibancho.data.WinCondition -import com.reco1l.ibancho.data.WinCondition.ACCURACY -import com.reco1l.ibancho.data.WinCondition.MAX_COMBO -import com.reco1l.ibancho.data.WinCondition.SCORE_V1 -import com.reco1l.ibancho.data.WinCondition.SCORE_V2 +import com.reco1l.ibancho.data.WinCondition.* import com.reco1l.osu.mainThread import com.reco1l.osu.multiplayer.Multiplayer.isConnected import com.reco1l.osu.multiplayer.Multiplayer.isRoomHost @@ -55,7 +41,7 @@ import ru.nsu.ccfit.zuev.osu.online.OnlinePanel import ru.nsu.ccfit.zuev.osu.scoring.Replay import ru.nsu.ccfit.zuev.skins.OsuSkin import java.text.SimpleDateFormat -import java.util.TimeZone +import java.util.* import ru.nsu.ccfit.zuev.osu.GlobalManager.getInstance as getGlobal import ru.nsu.ccfit.zuev.osu.LibraryManager.INSTANCE as library import ru.nsu.ccfit.zuev.osu.ResourceManager.getInstance as getResources @@ -423,7 +409,7 @@ object RoomScene : Scene(), IRoomEventListener, IPlayerEventListener layoutMods?.baseApply(it) it.setPosition(backButton!!.x + backButton!!.width, Config.getRES_HEIGHT() - it.heightScaled) } - else it.setPosition(backButton!!.x + backButton!!.width, (Config.getRES_HEIGHT() - 90f)) + else it.setPosition(backButton!!.x + backButton!!.width, Config.getRES_HEIGHT() - 90f) } // Difficulty switcher @@ -447,8 +433,8 @@ object RoomScene : Scene(), IRoomEventListener, IPlayerEventListener beatmapInfoRectangle?.isVisible = getGlobal().selectedTrack != null && !event.isActionUp && - event.x in it.x..(it.x + it.width) && - event.y in it.y..(it.y + it.height) + event.x in it.x..it.x + it.width && + event.y in it.y..it.y + it.height } return super.onSceneTouchEvent(event) @@ -468,7 +454,7 @@ object RoomScene : Scene(), IRoomEventListener, IPlayerEventListener val texture = if (path != null && !Config.isSafeBeatmapBg()) getResources().loadBackground(path) else getResources().getTexture("menu-background") - val height = texture.height * (Config.getRES_WIDTH() / texture.width.toFloat()) + val height = texture.height * Config.getRES_WIDTH() / texture.width.toFloat() val width = Config.getRES_WIDTH().toFloat() background = SpriteBackground(Sprite(0f, (Config.getRES_HEIGHT() - height) / 2f, width, height, texture)) diff --git a/src/com/reco1l/osu/ui/StatisticSelector.kt b/src/com/reco1l/osu/ui/StatisticSelector.kt index ed30e527a..89b462e4e 100644 --- a/src/com/reco1l/osu/ui/StatisticSelector.kt +++ b/src/com/reco1l/osu/ui/StatisticSelector.kt @@ -147,7 +147,7 @@ class StatisticSelector(stats: Array?) : ScrollableList(), ITouchAr } } - override fun contains(pX: Float, pY: Float): Boolean = pX in (570f .. 570f + 140f) + override fun contains(pX: Float, pY: Float): Boolean = pX in 570f .. 570f + 140f override fun onAreaTouched(event: TouchEvent?, x: Float, y: Float) = super.onSceneTouchEvent(event) }