diff --git a/app_fenrir/build.gradle b/app_fenrir/build.gradle index c97fda905..701245674 100644 --- a/app_fenrir/build.gradle +++ b/app_fenrir/build.gradle @@ -40,7 +40,7 @@ android { buildConfigField("String", "SERVICE_TOKEN", asStringVar(vk_service_token)) buildConfigField("String", "FAKE_ABI", asStringVar(fake_abi)) buildConfigField("String", "FAKE_DEVICE", asStringVar(fake_device)) - buildConfigField("boolean", "MANAGE_SCOPED_STORAGE", "true") + buildConfigField("Integer", "TARGET_SDK", appTargetSDK.toString()) buildConfigField("boolean", "FORCE_DEVELOPER_MODE", is_developer_build ? "true" : "false") ndk { @@ -56,16 +56,13 @@ android { } compileOptions { - // Flag to enable support for the new language APIs - coreLibraryDesugaringEnabled = appMinSDK < 26 - - sourceCompatibility = JavaVersion.VERSION_1_8 - targetCompatibility = JavaVersion.VERSION_1_8 + sourceCompatibility = JavaVersion.VERSION_21 + targetCompatibility = JavaVersion.VERSION_21 encoding = "utf-8" } kotlinOptions { - jvmTarget = "1.8" + jvmTarget = "21" freeCompilerArgs = ["-opt-in=kotlin.contracts.ExperimentalContracts", "-opt-in=kotlinx.serialization.ExperimentalSerializationApi", "-opt-in=kotlinx.coroutines.ExperimentalCoroutinesApi", @@ -110,7 +107,7 @@ static def asStringVar(String str) { } dependencies { - implementation fileTree(include: "*.aar", dir: "../compiled_native") + implementation fileTree('../compiled_native') { include '*.aar' } implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version") implementation("org.jetbrains.kotlin:kotlin-parcelize-runtime:$kotlin_version") implementation("org.jetbrains.kotlin:kotlin-android-extensions-runtime:$kotlin_version") @@ -118,7 +115,6 @@ dependencies { implementation("org.jetbrains.kotlinx:kotlinx-coroutines-android:$kotlin_coroutines") compileOnly("org.jetbrains.kotlin:kotlin-annotations-jvm:$kotlin_version") implementation("com.google.guava:guava:$guavaVersion") - coreLibraryDesugaring("com.android.tools:desugar_jdk_libs:$desugarLibraryVersion") implementation("androidx.core:core-ktx:$coreVersion") implementation("androidx.lifecycle:lifecycle-runtime-ktx:$lifecycleVersion") implementation("androidx.lifecycle:lifecycle-viewmodel-ktx:$lifecycleVersion") @@ -136,15 +132,15 @@ dependencies { implementation("com.google.firebase:firebase-messaging:$firebaseMessagingVersion") { exclude group: "com.google.firebase", module: "firebase-installations" } - //implementation project(path: ":libfenrir") - implementation project(path: ":fenrir_common") - implementation project(path: ":firebase-installations") - implementation project(path: ":picasso3") - implementation project(path: ":image") - implementation project(path: ":recyclerview") - implementation project(path: ":material") - implementation project(path: ":preference") - implementation project(path: ":camera2") + //implementation project(":libfenrir") + implementation project(":fenrir_common") + implementation project(":firebase-installations") + implementation project(":picasso3") + implementation project(":image") + implementation project(":recyclerview") + implementation project(":material") + implementation project(":preference") + implementation project(":camera2") implementation("com.squareup.okhttp3:okhttp-android:$okhttpLibraryVersion") //implementation("com.squareup.okhttp3:logging-interceptor:$okhttpLibraryVersion") implementation("com.squareup.okio:okio:$okioVersion") diff --git a/app_fenrir/src/fenrir/res/drawable-v24/ic_launcher_foreground.xml b/app_fenrir/src/fenrir/res/drawable/ic_launcher_foreground.xml similarity index 100% rename from app_fenrir/src/fenrir/res/drawable-v24/ic_launcher_foreground.xml rename to app_fenrir/src/fenrir/res/drawable/ic_launcher_foreground.xml diff --git a/app_fenrir/src/fenrir/res/drawable-v24/ic_launcher_monochrome.xml b/app_fenrir/src/fenrir/res/drawable/ic_launcher_monochrome.xml similarity index 100% rename from app_fenrir/src/fenrir/res/drawable-v24/ic_launcher_monochrome.xml rename to app_fenrir/src/fenrir/res/drawable/ic_launcher_monochrome.xml diff --git a/app_fenrir/src/fenrir/res/drawable-v24/splash.xml b/app_fenrir/src/fenrir/res/drawable/splash.xml similarity index 100% rename from app_fenrir/src/fenrir/res/drawable-v24/splash.xml rename to app_fenrir/src/fenrir/res/drawable/splash.xml diff --git a/app_fenrir/src/fenrir/res/mipmap-hdpi/ic_launcher.png b/app_fenrir/src/fenrir/res/mipmap-hdpi/ic_launcher.png deleted file mode 100644 index 5f952918b..000000000 Binary files a/app_fenrir/src/fenrir/res/mipmap-hdpi/ic_launcher.png and /dev/null differ diff --git a/app_fenrir/src/fenrir/res/mipmap-hdpi/ic_launcher_round.png b/app_fenrir/src/fenrir/res/mipmap-hdpi/ic_launcher_round.png deleted file mode 100644 index 27e831a46..000000000 Binary files a/app_fenrir/src/fenrir/res/mipmap-hdpi/ic_launcher_round.png and /dev/null differ diff --git a/app_fenrir/src/fenrir/res/mipmap-mdpi/ic_launcher.png b/app_fenrir/src/fenrir/res/mipmap-mdpi/ic_launcher.png deleted file mode 100644 index b4cd66d86..000000000 Binary files a/app_fenrir/src/fenrir/res/mipmap-mdpi/ic_launcher.png and /dev/null differ diff --git a/app_fenrir/src/fenrir/res/mipmap-mdpi/ic_launcher_round.png b/app_fenrir/src/fenrir/res/mipmap-mdpi/ic_launcher_round.png deleted file mode 100644 index 604aee240..000000000 Binary files a/app_fenrir/src/fenrir/res/mipmap-mdpi/ic_launcher_round.png and /dev/null differ diff --git a/app_fenrir/src/fenrir/res/mipmap-xhdpi/ic_launcher.png b/app_fenrir/src/fenrir/res/mipmap-xhdpi/ic_launcher.png deleted file mode 100644 index dbb392ac1..000000000 Binary files a/app_fenrir/src/fenrir/res/mipmap-xhdpi/ic_launcher.png and /dev/null differ diff --git a/app_fenrir/src/fenrir/res/mipmap-xhdpi/ic_launcher_round.png b/app_fenrir/src/fenrir/res/mipmap-xhdpi/ic_launcher_round.png deleted file mode 100644 index 5cf9b007a..000000000 Binary files a/app_fenrir/src/fenrir/res/mipmap-xhdpi/ic_launcher_round.png and /dev/null differ diff --git a/app_fenrir/src/fenrir/res/mipmap-xxhdpi/ic_launcher.png b/app_fenrir/src/fenrir/res/mipmap-xxhdpi/ic_launcher.png deleted file mode 100644 index 52728da8a..000000000 Binary files a/app_fenrir/src/fenrir/res/mipmap-xxhdpi/ic_launcher.png and /dev/null differ diff --git a/app_fenrir/src/fenrir/res/mipmap-xxhdpi/ic_launcher_round.png b/app_fenrir/src/fenrir/res/mipmap-xxhdpi/ic_launcher_round.png deleted file mode 100644 index 453ff7b7e..000000000 Binary files a/app_fenrir/src/fenrir/res/mipmap-xxhdpi/ic_launcher_round.png and /dev/null differ diff --git a/app_fenrir/src/fenrir/res/mipmap-xxxhdpi/ic_launcher.png b/app_fenrir/src/fenrir/res/mipmap-xxxhdpi/ic_launcher.png deleted file mode 100644 index da3cbe30e..000000000 Binary files a/app_fenrir/src/fenrir/res/mipmap-xxxhdpi/ic_launcher.png and /dev/null differ diff --git a/app_fenrir/src/fenrir/res/mipmap-xxxhdpi/ic_launcher_round.png b/app_fenrir/src/fenrir/res/mipmap-xxxhdpi/ic_launcher_round.png deleted file mode 100644 index abd079893..000000000 Binary files a/app_fenrir/src/fenrir/res/mipmap-xxxhdpi/ic_launcher_round.png and /dev/null differ diff --git a/app_fenrir/src/kate/res/drawable-v24/ic_launcher_foreground.xml b/app_fenrir/src/kate/res/drawable/ic_launcher_foreground.xml similarity index 100% rename from app_fenrir/src/kate/res/drawable-v24/ic_launcher_foreground.xml rename to app_fenrir/src/kate/res/drawable/ic_launcher_foreground.xml diff --git a/app_fenrir/src/kate/res/drawable-v24/ic_launcher_monochrome.xml b/app_fenrir/src/kate/res/drawable/ic_launcher_monochrome.xml similarity index 100% rename from app_fenrir/src/kate/res/drawable-v24/ic_launcher_monochrome.xml rename to app_fenrir/src/kate/res/drawable/ic_launcher_monochrome.xml diff --git a/app_fenrir/src/kate/res/drawable-v24/splash.xml b/app_fenrir/src/kate/res/drawable/splash.xml similarity index 100% rename from app_fenrir/src/kate/res/drawable-v24/splash.xml rename to app_fenrir/src/kate/res/drawable/splash.xml diff --git a/app_fenrir/src/kate/res/mipmap-hdpi/ic_launcher.png b/app_fenrir/src/kate/res/mipmap-hdpi/ic_launcher.png deleted file mode 100644 index 8dec68297..000000000 Binary files a/app_fenrir/src/kate/res/mipmap-hdpi/ic_launcher.png and /dev/null differ diff --git a/app_fenrir/src/kate/res/mipmap-hdpi/ic_launcher_round.png b/app_fenrir/src/kate/res/mipmap-hdpi/ic_launcher_round.png deleted file mode 100644 index bd84419ad..000000000 Binary files a/app_fenrir/src/kate/res/mipmap-hdpi/ic_launcher_round.png and /dev/null differ diff --git a/app_fenrir/src/kate/res/mipmap-mdpi/ic_launcher.png b/app_fenrir/src/kate/res/mipmap-mdpi/ic_launcher.png deleted file mode 100644 index 0d3f06fe2..000000000 Binary files a/app_fenrir/src/kate/res/mipmap-mdpi/ic_launcher.png and /dev/null differ diff --git a/app_fenrir/src/kate/res/mipmap-mdpi/ic_launcher_round.png b/app_fenrir/src/kate/res/mipmap-mdpi/ic_launcher_round.png deleted file mode 100644 index 6f8b864b2..000000000 Binary files a/app_fenrir/src/kate/res/mipmap-mdpi/ic_launcher_round.png and /dev/null differ diff --git a/app_fenrir/src/kate/res/mipmap-xhdpi/ic_launcher.png b/app_fenrir/src/kate/res/mipmap-xhdpi/ic_launcher.png deleted file mode 100644 index 1c4f9be1b..000000000 Binary files a/app_fenrir/src/kate/res/mipmap-xhdpi/ic_launcher.png and /dev/null differ diff --git a/app_fenrir/src/kate/res/mipmap-xhdpi/ic_launcher_round.png b/app_fenrir/src/kate/res/mipmap-xhdpi/ic_launcher_round.png deleted file mode 100644 index 0cb4ce7bc..000000000 Binary files a/app_fenrir/src/kate/res/mipmap-xhdpi/ic_launcher_round.png and /dev/null differ diff --git a/app_fenrir/src/kate/res/mipmap-xxhdpi/ic_launcher.png b/app_fenrir/src/kate/res/mipmap-xxhdpi/ic_launcher.png deleted file mode 100644 index 34b86f45c..000000000 Binary files a/app_fenrir/src/kate/res/mipmap-xxhdpi/ic_launcher.png and /dev/null differ diff --git a/app_fenrir/src/kate/res/mipmap-xxhdpi/ic_launcher_round.png b/app_fenrir/src/kate/res/mipmap-xxhdpi/ic_launcher_round.png deleted file mode 100644 index 647ee7d51..000000000 Binary files a/app_fenrir/src/kate/res/mipmap-xxhdpi/ic_launcher_round.png and /dev/null differ diff --git a/app_fenrir/src/kate/res/mipmap-xxxhdpi/ic_launcher.png b/app_fenrir/src/kate/res/mipmap-xxxhdpi/ic_launcher.png deleted file mode 100644 index a9a636c6d..000000000 Binary files a/app_fenrir/src/kate/res/mipmap-xxxhdpi/ic_launcher.png and /dev/null differ diff --git a/app_fenrir/src/kate/res/mipmap-xxxhdpi/ic_launcher_round.png b/app_fenrir/src/kate/res/mipmap-xxxhdpi/ic_launcher_round.png deleted file mode 100644 index 627c3ec8a..000000000 Binary files a/app_fenrir/src/kate/res/mipmap-xxxhdpi/ic_launcher_round.png and /dev/null differ diff --git a/app_fenrir/src/main/AndroidManifest.xml b/app_fenrir/src/main/AndroidManifest.xml index 60c29ea58..26fb8dcc3 100644 --- a/app_fenrir/src/main/AndroidManifest.xml +++ b/app_fenrir/src/main/AndroidManifest.xml @@ -104,13 +104,6 @@ android:theme="@style/App.DayNight" tools:ignore="DiscouragedApi,LockedOrientationActivity" /> - - T?.trimmedIsNullOrEmpty(): Boolean { contract { returns(false) implies (this@trimmedIsNullOrEmpty != null) } - return this == null || this.trim { it <= ' ' }.isEmpty() + return this == null || this.trim().isEmpty() } inline fun T?.trimmedNonNullNoEmpty(): Boolean { contract { returns(true) implies (this@trimmedNonNullNoEmpty != null) } - return this != null && this.trim { it <= ' ' }.isNotEmpty() + return this != null && this.trim().isNotEmpty() } inline fun T?.nonNullNoEmpty(block: (T) -> Unit) { @@ -272,7 +272,7 @@ inline fun > E?.nonNullNoEmptyOr( inline fun T?.trimmedNonNullNoEmpty(block: (T) -> Unit) { this?.let { - if (trim { it <= ' ' }.isNotEmpty()) { + if (trim().isNotEmpty()) { apply(block) } } diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/FcmListenerService.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/FcmListenerService.kt index 2eb31d713..dd34b192f 100644 --- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/FcmListenerService.kt +++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/FcmListenerService.kt @@ -95,10 +95,10 @@ class FcmListenerService : FirebaseMessagingService() { ?.notify(context, accountId) PushType.NEW_POST -> NewPostPushMessage.fromRemoteMessage(accountId, message) - .notifyIfNeed(context) + .notify(context) PushType.LIKE -> LikeFCMMessage.fromRemoteMessage(accountId, message) - ?.notifyIfNeed(context) + ?.notify(context) PushType.REPLY -> ReplyFCMMessage.fromRemoteMessage(message) ?.notify(context, accountId) diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/Includes.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/Includes.kt index bcb404720..6552dc939 100644 --- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/Includes.kt +++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/Includes.kt @@ -52,8 +52,6 @@ object Includes { networkInterfaces ) } - - val uploadManager: IUploadManager by lazy { UploadManagerImpl( instance, networkInterfaces, @@ -68,8 +66,6 @@ object Includes { val validationProvider: IValidateProvider by lazy { ValidateProvider(provideApplicationContext()) } - - val attachmentsRepository: IAttachmentsRepository by lazy { AttachmentsRepository(stores.attachments(), owners) } diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/activity/ActivityUtils.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/activity/ActivityUtils.kt index 2645cc1d5..e5afaa11d 100644 --- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/activity/ActivityUtils.kt +++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/activity/ActivityUtils.kt @@ -101,7 +101,6 @@ object ActivityUtils { ) == true } - fun supportToolbarFor(fragment: Fragment): ActionBar? { return if (fragment.activity == null) { null diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/activity/ChatActivity.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/activity/ChatActivity.kt index 3c3051076..4ce49453f 100644 --- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/activity/ChatActivity.kt +++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/activity/ChatActivity.kt @@ -6,7 +6,6 @@ import android.content.ServiceConnection import android.graphics.Color import android.os.Bundle import android.os.IBinder -import android.view.WindowManager import android.view.inputmethod.InputMethodManager import androidx.core.view.WindowInsetsControllerCompat import androidx.fragment.app.Fragment @@ -34,7 +33,7 @@ import dev.ragnarok.fenrir.place.PlaceProvider import dev.ragnarok.fenrir.settings.CurrentTheme import dev.ragnarok.fenrir.util.Logger import dev.ragnarok.fenrir.util.Utils -import dev.ragnarok.fenrir.util.Utils.hasVanillaIceCream +import dev.ragnarok.fenrir.util.Utils.hasVanillaIceCreamTarget import dev.ragnarok.fenrir.util.ViewUtils class ChatActivity : NoMainActivity(), PlaceProvider, AppStyleable, ServiceConnection { @@ -114,7 +113,7 @@ class ChatActivity : NoMainActivity(), PlaceProvider, AppStyleable, ServiceConne window.decorView.rootView.windowToken, InputMethodManager.HIDE_NOT_ALWAYS ) - } catch (ignored: Exception) { + } catch (_: Exception) { } } @@ -212,7 +211,7 @@ class ChatActivity : NoMainActivity(), PlaceProvider, AppStyleable, ServiceConne @Suppress("DEPRECATION") override fun setStatusbarColored(colored: Boolean, invertIcons: Boolean) { val w = window - if (!hasVanillaIceCream()) { + if (!hasVanillaIceCreamTarget()) { w.statusBarColor = if (colored) CurrentTheme.getStatusBarColor(this) else CurrentTheme.getStatusBarNonColored( this @@ -223,11 +222,6 @@ class ChatActivity : NoMainActivity(), PlaceProvider, AppStyleable, ServiceConne val ins = WindowInsetsControllerCompat(w, w.decorView) ins.isAppearanceLightStatusBars = invertIcons ins.isAppearanceLightNavigationBars = invertIcons - - if (!Utils.hasMarshmallow()) { - w.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS) - w.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS) - } } companion object { diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/activity/ChatActivityBubbles.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/activity/ChatActivityBubbles.kt index 493011550..65cba8e6a 100644 --- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/activity/ChatActivityBubbles.kt +++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/activity/ChatActivityBubbles.kt @@ -7,7 +7,6 @@ import android.content.ServiceConnection import android.graphics.Color import android.os.Bundle import android.os.IBinder -import android.view.WindowManager import android.view.inputmethod.InputMethodManager import androidx.core.view.WindowInsetsControllerCompat import androidx.fragment.app.Fragment @@ -38,7 +37,7 @@ import dev.ragnarok.fenrir.place.PlaceProvider import dev.ragnarok.fenrir.settings.CurrentTheme import dev.ragnarok.fenrir.util.Logger import dev.ragnarok.fenrir.util.Utils -import dev.ragnarok.fenrir.util.Utils.hasVanillaIceCream +import dev.ragnarok.fenrir.util.Utils.hasVanillaIceCreamTarget import dev.ragnarok.fenrir.util.ViewUtils class ChatActivityBubbles : NoMainActivity(), PlaceProvider, AppStyleable, ServiceConnection { @@ -124,7 +123,7 @@ class ChatActivityBubbles : NoMainActivity(), PlaceProvider, AppStyleable, Servi window.decorView.rootView.windowToken, InputMethodManager.HIDE_NOT_ALWAYS ) - } catch (ignored: Exception) { + } catch (_: Exception) { } } @@ -233,7 +232,7 @@ class ChatActivityBubbles : NoMainActivity(), PlaceProvider, AppStyleable, Servi @Suppress("DEPRECATION") override fun setStatusbarColored(colored: Boolean, invertIcons: Boolean) { val w = window - if (!hasVanillaIceCream()) { + if (!hasVanillaIceCreamTarget()) { w.statusBarColor = if (colored) CurrentTheme.getStatusBarColor(this) else CurrentTheme.getStatusBarNonColored( this @@ -244,11 +243,6 @@ class ChatActivityBubbles : NoMainActivity(), PlaceProvider, AppStyleable, Servi val ins = WindowInsetsControllerCompat(w, w.decorView) ins.isAppearanceLightStatusBars = invertIcons ins.isAppearanceLightNavigationBars = invertIcons - - if (!Utils.hasMarshmallow()) { - w.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS) - w.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS) - } } companion object { diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/activity/DeltaOwnerActivity.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/activity/DeltaOwnerActivity.kt index a8ff398d8..3f0c26def 100644 --- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/activity/DeltaOwnerActivity.kt +++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/activity/DeltaOwnerActivity.kt @@ -9,7 +9,6 @@ import android.os.Bundle import android.view.LayoutInflater import android.view.View import android.view.ViewGroup -import android.view.WindowManager import android.widget.ImageView import android.widget.TextView import androidx.appcompat.app.AppCompatActivity @@ -49,7 +48,7 @@ import dev.ragnarok.fenrir.settings.theme.ThemesController import dev.ragnarok.fenrir.util.AppTextUtils.getDateFromUnixTime import dev.ragnarok.fenrir.util.DownloadWorkUtils import dev.ragnarok.fenrir.util.Utils -import dev.ragnarok.fenrir.util.Utils.hasVanillaIceCream +import dev.ragnarok.fenrir.util.Utils.hasVanillaIceCreamTarget import dev.ragnarok.fenrir.util.coroutines.CancelableJob import dev.ragnarok.fenrir.util.coroutines.CoroutinesUtils.fromIOToMain import dev.ragnarok.fenrir.util.serializeble.json.Json @@ -182,7 +181,7 @@ class DeltaOwnerActivity : AppCompatActivity(), PlaceProvider, AppStyleable { EmptyAvatar.visibility = View.VISIBLE var name: String = owner.owner.fullName.orEmpty() if (name.length > 2) name = name.substring(0, 2) - name = name.trim { it <= ' ' } + name = name.trim() EmptyAvatar.text = name } else { EmptyAvatar.visibility = View.GONE @@ -216,13 +215,8 @@ class DeltaOwnerActivity : AppCompatActivity(), PlaceProvider, AppStyleable { tab.text = adapter.DeltaOwner.content[position].name }.attach() - if (!hasVanillaIceCream()) { + if (!hasVanillaIceCreamTarget()) { val w = window - if (!Utils.hasMarshmallow()) { - w.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS) - w.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS) - } - w.statusBarColor = getStatusBarColor(this) w.navigationBarColor = getNavigationBarColor(this) } @@ -291,7 +285,7 @@ class DeltaOwnerActivity : AppCompatActivity(), PlaceProvider, AppStyleable { @Suppress("DEPRECATION") override fun setStatusbarColored(colored: Boolean, invertIcons: Boolean) { val w = window - if (!hasVanillaIceCream()) { + if (!hasVanillaIceCreamTarget()) { w.statusBarColor = if (colored) getStatusBarColor(this) else getStatusBarNonColored( this @@ -302,11 +296,6 @@ class DeltaOwnerActivity : AppCompatActivity(), PlaceProvider, AppStyleable { val ins = WindowInsetsControllerCompat(w, w.decorView) ins.isAppearanceLightStatusBars = invertIcons ins.isAppearanceLightNavigationBars = invertIcons - - if (!Utils.hasMarshmallow()) { - w.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS) - w.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS) - } } companion object { diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/activity/LocalJsonToChatActivity.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/activity/LocalJsonToChatActivity.kt index c80ba851e..da1b1804f 100644 --- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/activity/LocalJsonToChatActivity.kt +++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/activity/LocalJsonToChatActivity.kt @@ -6,7 +6,6 @@ import android.content.ServiceConnection import android.graphics.Color import android.os.Bundle import android.os.IBinder -import android.view.WindowManager import android.view.inputmethod.InputMethodManager import androidx.core.view.WindowInsetsControllerCompat import androidx.fragment.app.Fragment @@ -32,7 +31,7 @@ import dev.ragnarok.fenrir.settings.ISettings import dev.ragnarok.fenrir.settings.Settings import dev.ragnarok.fenrir.util.Logger import dev.ragnarok.fenrir.util.Utils -import dev.ragnarok.fenrir.util.Utils.hasVanillaIceCream +import dev.ragnarok.fenrir.util.Utils.hasVanillaIceCreamTarget import dev.ragnarok.fenrir.util.ViewUtils class LocalJsonToChatActivity : NoMainActivity(), PlaceProvider, AppStyleable, ServiceConnection { @@ -112,7 +111,7 @@ class LocalJsonToChatActivity : NoMainActivity(), PlaceProvider, AppStyleable, S window.decorView.rootView.windowToken, InputMethodManager.HIDE_NOT_ALWAYS ) - } catch (ignored: Exception) { + } catch (_: Exception) { } } @@ -200,7 +199,7 @@ class LocalJsonToChatActivity : NoMainActivity(), PlaceProvider, AppStyleable, S @Suppress("DEPRECATION") override fun setStatusbarColored(colored: Boolean, invertIcons: Boolean) { val w = window - if (!hasVanillaIceCream()) { + if (!hasVanillaIceCreamTarget()) { w.statusBarColor = if (colored) CurrentTheme.getStatusBarColor(this) else CurrentTheme.getStatusBarNonColored( this @@ -211,10 +210,5 @@ class LocalJsonToChatActivity : NoMainActivity(), PlaceProvider, AppStyleable, S val ins = WindowInsetsControllerCompat(w, w.decorView) ins.isAppearanceLightStatusBars = invertIcons ins.isAppearanceLightNavigationBars = invertIcons - - if (!Utils.hasMarshmallow()) { - w.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS) - w.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS) - } } } \ No newline at end of file diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/activity/LoginActivity.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/activity/LoginActivity.kt index 563e5ab3a..0954c3dca 100644 --- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/activity/LoginActivity.kt +++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/activity/LoginActivity.kt @@ -81,7 +81,7 @@ class LoginActivity : AppCompatActivity() { try { val tokens = tryExtractAccessTokens(url) intent.putParcelableArrayListExtra("group_tokens", tokens) - } catch (e: Exception) { + } catch (_: Exception) { val accessToken = tryExtractAccessToken(url) val userId = tryExtractUserId(url) intent.putExtra(Extra.TOKEN, accessToken) @@ -137,7 +137,6 @@ class LoginActivity : AppCompatActivity() { .putExtra(EXTRA_SAVE, isSave) } - fun createIntent( context: Context?, clientId: String?, diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/activity/LottieActivity.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/activity/LottieActivity.kt index 63d64b22a..b6676a1b3 100644 --- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/activity/LottieActivity.kt +++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/activity/LottieActivity.kt @@ -7,7 +7,6 @@ import android.content.Intent import android.graphics.Color import android.os.Bundle import android.os.Environment -import android.view.WindowManager import android.widget.TextView import androidx.activity.result.contract.ActivityResultContracts import androidx.appcompat.app.AppCompatActivity @@ -26,7 +25,7 @@ import dev.ragnarok.fenrir.settings.theme.ThemesController.currentStyle import dev.ragnarok.fenrir.util.AppPerms import dev.ragnarok.fenrir.util.AppPerms.requestPermissionsAbs import dev.ragnarok.fenrir.util.Utils -import dev.ragnarok.fenrir.util.Utils.hasVanillaIceCream +import dev.ragnarok.fenrir.util.Utils.hasVanillaIceCreamTarget import dev.ragnarok.fenrir.view.natives.rlottie.RLottieImageView import java.io.File @@ -99,7 +98,7 @@ class LottieActivity : AppCompatActivity() { private var lottie: RLottieImageView? = null private var lg: TextView? = null internal fun log(log: String?) { - lg?.post { lg?.text = log?.trim { it <= ' ' } } + lg?.post { lg?.text = log?.trim() } } override fun attachBaseContext(newBase: Context) { @@ -135,13 +134,8 @@ class LottieActivity : AppCompatActivity() { } startExportGif() } - if (!hasVanillaIceCream()) { + if (!hasVanillaIceCreamTarget()) { val w = window - if (!Utils.hasMarshmallow()) { - w.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS) - w.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS) - } - w.statusBarColor = CurrentTheme.getStatusBarColor(this) w.navigationBarColor = CurrentTheme.getNavigationBarColor(this) } diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/activity/MainActivity.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/activity/MainActivity.kt index de1d8bade..cb67d9c0d 100644 --- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/activity/MainActivity.kt +++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/activity/MainActivity.kt @@ -10,14 +10,12 @@ import android.content.Intent import android.content.ServiceConnection import android.graphics.Color import android.net.Uri -import android.os.Build import android.os.Bundle import android.os.IBinder import android.view.MenuItem import android.view.MotionEvent import android.view.View import android.view.ViewGroup -import android.view.WindowManager import android.view.animation.LinearInterpolator import android.view.inputmethod.InputMethodManager import androidx.activity.OnBackPressedCallback @@ -55,7 +53,6 @@ import dev.ragnarok.fenrir.domain.InteractorFactory import dev.ragnarok.fenrir.domain.impl.CountersInteractor import dev.ragnarok.fenrir.fragment.BrowserFragment import dev.ragnarok.fenrir.fragment.DocPreviewFragment -import dev.ragnarok.fenrir.fragment.NotificationPreferencesFragment import dev.ragnarok.fenrir.fragment.PreferencesFragment import dev.ragnarok.fenrir.fragment.PreferencesFragment.Companion.cleanCache import dev.ragnarok.fenrir.fragment.SecurityPreferencesFragment @@ -191,14 +188,12 @@ import dev.ragnarok.fenrir.settings.theme.ThemesController.nextRandom import dev.ragnarok.fenrir.upload.UploadUtils import dev.ragnarok.fenrir.util.Accounts import dev.ragnarok.fenrir.util.Action -import dev.ragnarok.fenrir.util.HelperSimple -import dev.ragnarok.fenrir.util.HelperSimple.needHelp import dev.ragnarok.fenrir.util.Logger import dev.ragnarok.fenrir.util.MainActivityTransforms import dev.ragnarok.fenrir.util.Pair import dev.ragnarok.fenrir.util.Pair.Companion.create import dev.ragnarok.fenrir.util.Utils -import dev.ragnarok.fenrir.util.Utils.hasVanillaIceCream +import dev.ragnarok.fenrir.util.Utils.hasVanillaIceCreamTarget import dev.ragnarok.fenrir.util.coroutines.CompositeJob import dev.ragnarok.fenrir.util.coroutines.CoroutinesUtils.andThen import dev.ragnarok.fenrir.util.coroutines.CoroutinesUtils.delayedFlow @@ -254,7 +249,7 @@ open class MainActivity : AppCompatActivity(), NavigationDrawerCallbacks, OnSect return@registerForActivityResult } } - } catch (ignored: NumberFormatException) { + } catch (_: NumberFormatException) { } MaterialAlertDialogBuilder(this) @@ -331,22 +326,7 @@ open class MainActivity : AppCompatActivity(), NavigationDrawerCallbacks, OnSect Settings.get().ui().getDefaultPage(mAccountId).tryOpenWith(this) checkFCMRegistration(true) - if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.LOLLIPOP && needHelp( - HelperSimple.LOLLIPOP_21, - 1 - ) - ) { - MaterialAlertDialogBuilder(this) - .setTitle(R.string.info) - .setMessage(R.string.lollipop21) - .setCancelable(false) - .setPositiveButton(R.string.button_ok) { _, _ -> - if (!Settings.get().security().isUsePinForSecurity) { - startCreatePinActivity() - } - } - .show() - } else if (!Settings.get().security().isUsePinForSecurity) { + if (!Settings.get().security().isUsePinForSecurity) { startCreatePinActivity() } } @@ -452,12 +432,7 @@ open class MainActivity : AppCompatActivity(), NavigationDrawerCallbacks, OnSect } navigationView?.setStatesCallback(object : AbsNavigationView.NavigationStatesCallbacks { override fun onMove(slideOffset: Float) { - if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP_MR1) { - anim.currentPlayTime = - (slideOffset * anim.duration).toLong().coerceAtMost(anim.duration) - } else { - anim.setCurrentFraction(slideOffset) - } + anim.setCurrentFraction(slideOffset) } override fun onOpened() { @@ -1230,7 +1205,7 @@ open class MainActivity : AppCompatActivity(), NavigationDrawerCallbacks, OnSect window.decorView.rootView.windowToken, InputMethodManager.HIDE_NOT_ALWAYS ) - } catch (ignored: Exception) { + } catch (_: Exception) { } } @@ -1321,7 +1296,7 @@ open class MainActivity : AppCompatActivity(), NavigationDrawerCallbacks, OnSect @Suppress("DEPRECATION") override fun setStatusbarColored(colored: Boolean, invertIcons: Boolean) { val w = window - if (!hasVanillaIceCream()) { + if (!hasVanillaIceCreamTarget()) { w.statusBarColor = if (colored) getStatusBarColor(this) else getStatusBarNonColored( this @@ -1332,11 +1307,6 @@ open class MainActivity : AppCompatActivity(), NavigationDrawerCallbacks, OnSect val ins = WindowInsetsControllerCompat(w, w.decorView) ins.isAppearanceLightStatusBars = invertIcons ins.isAppearanceLightNavigationBars = invertIcons - - if (!Utils.hasMarshmallow()) { - w.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS) - w.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS) - } } override fun hideMenu(hide: Boolean) { @@ -1566,7 +1536,6 @@ open class MainActivity : AppCompatActivity(), NavigationDrawerCallbacks, OnSect startActivity(intent) } - Place.NOTIFICATION_SETTINGS -> attachToFront(NotificationPreferencesFragment()) Place.LIKES_AND_COPIES -> attachToFront(LikesFragment.newInstance(args)) Place.STORIES_VIEWS -> attachToFront(StoriesViewFragment.newInstance(args)) Place.CREATE_PHOTO_ALBUM, Place.EDIT_PHOTO_ALBUM -> { diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/activity/NoMainActivity.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/activity/NoMainActivity.kt index 02baa0b5a..4b41681ec 100644 --- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/activity/NoMainActivity.kt +++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/activity/NoMainActivity.kt @@ -3,7 +3,6 @@ package dev.ragnarok.fenrir.activity import android.content.Context import android.os.Bundle import android.view.MotionEvent -import android.view.WindowManager import androidx.activity.OnBackPressedCallback import androidx.annotation.IdRes import androidx.annotation.LayoutRes @@ -16,7 +15,7 @@ import dev.ragnarok.fenrir.settings.CurrentTheme import dev.ragnarok.fenrir.settings.Settings import dev.ragnarok.fenrir.settings.theme.ThemesController.currentStyle import dev.ragnarok.fenrir.util.Utils -import dev.ragnarok.fenrir.util.Utils.hasVanillaIceCream +import dev.ragnarok.fenrir.util.Utils.hasVanillaIceCreamTarget import dev.ragnarok.fenrir.view.zoomhelper.ZoomHelper.Companion.getInstance abstract class NoMainActivity : AppCompatActivity() { @@ -38,13 +37,8 @@ abstract class NoMainActivity : AppCompatActivity() { super.onCreate(savedInstanceState) isZoomPhoto = Settings.get().main().isDo_zoom_photo setContentView(getNoMainContentView()) - if (!hasVanillaIceCream()) { + if (!hasVanillaIceCreamTarget()) { val w = window - if (!Utils.hasMarshmallow()) { - w.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS) - w.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS) - } - w.statusBarColor = CurrentTheme.getStatusBarColor(this) w.navigationBarColor = CurrentTheme.getNavigationBarColor(this) } diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/activity/NotReadMessagesActivity.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/activity/NotReadMessagesActivity.kt index 406237d5f..688553c3a 100644 --- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/activity/NotReadMessagesActivity.kt +++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/activity/NotReadMessagesActivity.kt @@ -3,7 +3,6 @@ package dev.ragnarok.fenrir.activity import android.content.Intent import android.graphics.Color import android.os.Bundle -import android.view.WindowManager import android.view.inputmethod.InputMethodManager import androidx.core.view.WindowInsetsControllerCompat import androidx.fragment.app.Fragment @@ -33,7 +32,7 @@ import dev.ragnarok.fenrir.settings.CurrentTheme.getNavigationBarColor import dev.ragnarok.fenrir.settings.CurrentTheme.getStatusBarColor import dev.ragnarok.fenrir.settings.CurrentTheme.getStatusBarNonColored import dev.ragnarok.fenrir.util.Utils -import dev.ragnarok.fenrir.util.Utils.hasVanillaIceCream +import dev.ragnarok.fenrir.util.Utils.hasVanillaIceCreamTarget import dev.ragnarok.fenrir.util.ViewUtils class NotReadMessagesActivity : NoMainActivity(), PlaceProvider, AppStyleable { @@ -88,7 +87,7 @@ class NotReadMessagesActivity : NoMainActivity(), PlaceProvider, AppStyleable { window.decorView.rootView.windowToken, InputMethodManager.HIDE_NOT_ALWAYS ) - } catch (ignored: Exception) { + } catch (_: Exception) { } } @@ -185,7 +184,7 @@ class NotReadMessagesActivity : NoMainActivity(), PlaceProvider, AppStyleable { @Suppress("DEPRECATION") override fun setStatusbarColored(colored: Boolean, invertIcons: Boolean) { val w = window - if (!hasVanillaIceCream()) { + if (!hasVanillaIceCreamTarget()) { w.statusBarColor = if (colored) getStatusBarColor(this) else getStatusBarNonColored( this @@ -196,11 +195,6 @@ class NotReadMessagesActivity : NoMainActivity(), PlaceProvider, AppStyleable { val ins = WindowInsetsControllerCompat(w, w.decorView) ins.isAppearanceLightStatusBars = invertIcons ins.isAppearanceLightNavigationBars = invertIcons - - if (!Utils.hasMarshmallow()) { - w.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS) - w.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS) - } } companion object { diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/activity/QuickAnswerActivity.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/activity/QuickAnswerActivity.kt deleted file mode 100644 index 2c3fc52c3..000000000 --- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/activity/QuickAnswerActivity.kt +++ /dev/null @@ -1,383 +0,0 @@ -package dev.ragnarok.fenrir.activity - -import android.Manifest -import android.content.Context -import android.content.Intent -import android.os.Bundle -import android.text.Editable -import android.view.View -import android.view.ViewGroup -import android.view.WindowManager -import android.widget.ImageButton -import android.widget.ImageView -import android.widget.TextView -import android.widget.Toast -import androidx.annotation.StyleRes -import androidx.appcompat.app.AppCompatActivity -import androidx.appcompat.widget.Toolbar -import com.google.android.material.textfield.TextInputEditText -import dev.ragnarok.fenrir.Extra -import dev.ragnarok.fenrir.R -import dev.ragnarok.fenrir.crypt.KeyLocationPolicy -import dev.ragnarok.fenrir.domain.IMessagesRepository -import dev.ragnarok.fenrir.domain.Repository.messages -import dev.ragnarok.fenrir.fragment.base.AttachmentsHolder -import dev.ragnarok.fenrir.fragment.base.AttachmentsViewBinder -import dev.ragnarok.fenrir.fragment.base.AttachmentsViewBinder.OnAttachmentsActionCallback -import dev.ragnarok.fenrir.fragment.base.AttachmentsViewBinder.VoiceActionListener -import dev.ragnarok.fenrir.getParcelableCompat -import dev.ragnarok.fenrir.link.LinkHelper -import dev.ragnarok.fenrir.listener.TextWatcherAdapter -import dev.ragnarok.fenrir.longpoll.NotificationHelper -import dev.ragnarok.fenrir.media.music.MusicPlaybackService.Companion.startForPlayList -import dev.ragnarok.fenrir.model.Article -import dev.ragnarok.fenrir.model.Audio -import dev.ragnarok.fenrir.model.AudioArtist -import dev.ragnarok.fenrir.model.AudioPlaylist -import dev.ragnarok.fenrir.model.Document -import dev.ragnarok.fenrir.model.Keyboard -import dev.ragnarok.fenrir.model.Link -import dev.ragnarok.fenrir.model.Market -import dev.ragnarok.fenrir.model.MarketAlbum -import dev.ragnarok.fenrir.model.Message -import dev.ragnarok.fenrir.model.Narratives -import dev.ragnarok.fenrir.model.Peer -import dev.ragnarok.fenrir.model.Photo -import dev.ragnarok.fenrir.model.PhotoAlbum -import dev.ragnarok.fenrir.model.Poll -import dev.ragnarok.fenrir.model.Post -import dev.ragnarok.fenrir.model.SaveMessageBuilder -import dev.ragnarok.fenrir.model.Story -import dev.ragnarok.fenrir.model.Video -import dev.ragnarok.fenrir.model.VoiceMessage -import dev.ragnarok.fenrir.model.WallReply -import dev.ragnarok.fenrir.model.WikiPage -import dev.ragnarok.fenrir.nonNullNoEmpty -import dev.ragnarok.fenrir.orZero -import dev.ragnarok.fenrir.place.PlaceFactory -import dev.ragnarok.fenrir.settings.CurrentTheme -import dev.ragnarok.fenrir.settings.Settings -import dev.ragnarok.fenrir.settings.theme.ThemeOverlay -import dev.ragnarok.fenrir.util.AppPerms.requestPermissionsAbs -import dev.ragnarok.fenrir.util.AppTextUtils -import dev.ragnarok.fenrir.util.TextingNotifier -import dev.ragnarok.fenrir.util.Utils -import dev.ragnarok.fenrir.util.ViewUtils -import dev.ragnarok.fenrir.util.coroutines.CompositeJob -import dev.ragnarok.fenrir.util.coroutines.CoroutinesUtils.delayTaskFlow -import dev.ragnarok.fenrir.util.coroutines.CoroutinesUtils.fromIOToMain -import dev.ragnarok.fenrir.util.coroutines.CoroutinesUtils.hiddenIO -import dev.ragnarok.fenrir.util.coroutines.CoroutinesUtils.toMain -import dev.ragnarok.fenrir.util.toast.CustomToast.Companion.createCustomToast -import dev.ragnarok.fenrir.view.emoji.BotKeyboardView -import dev.ragnarok.fenrir.view.emoji.BotKeyboardView.BotKeyboardViewDelegate - -class QuickAnswerActivity : AppCompatActivity() { - private val mLiveSubscription = CompositeJob() - private val compositeDisposable = CompositeJob() - private val requestWritePermission = requestPermissionsAbs( - arrayOf( - Manifest.permission.WRITE_EXTERNAL_STORAGE, - Manifest.permission.READ_EXTERNAL_STORAGE - ) - ) { - createCustomToast(this@QuickAnswerActivity).showToast(R.string.permission_all_granted_text) - } - private var etText: TextInputEditText? = null - private var notifier: TextingNotifier? = null - private var accountId = 0L - private lateinit var msg: Message - private var messageIsRead = false - private var messagesRepository: IMessagesRepository = messages - override fun attachBaseContext(newBase: Context) { - super.attachBaseContext(Utils.updateActivityContext(newBase)) - } - - override fun onCreate(savedInstanceState: Bundle?) { - @StyleRes val theme: Int = when (Settings.get().main().themeOverlay) { - ThemeOverlay.AMOLED -> R.style.QuickReply_Amoled - ThemeOverlay.MD1 -> R.style.QuickReply_MD1 - ThemeOverlay.OFF -> R.style.QuickReply - else -> R.style.QuickReply - } - setTheme(theme) - super.onCreate(savedInstanceState) - val focusToField = intent.getBooleanExtra(EXTRA_FOCUS_TO_FIELD, true) - if (!focusToField) { - window.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN) - } - msg = (intent.extras?.getParcelableCompat(Extra.MESSAGE) ?: return) - accountId = (intent.extras ?: return).getLong(Extra.ACCOUNT_ID) - notifier = TextingNotifier(accountId) - setContentView(R.layout.activity_quick_answer) - val toolbar = findViewById(R.id.toolbar) - toolbar?.setNavigationIcon(R.drawable.arrow_left) - setSupportActionBar(toolbar) - val tvMessage = findViewById(R.id.item_message_text) - val tvTime = findViewById(R.id.item_message_time) - etText = findViewById(R.id.activity_quick_answer_edit_text) - val ivAvatar = findViewById(R.id.avatar) - val btnToDialog = findViewById(R.id.activity_quick_answer_to_dialog) - val btnSend = findViewById(R.id.activity_quick_answer_send) - val messageTime = AppTextUtils.getDateFromUnixTime(this, msg.date) - val title = intent.getStringExtra(Extra.TITLE) - supportActionBar?.title = title - tvMessage.setText(intent.getStringExtra(PARAM_TEXT), TextView.BufferType.SPANNABLE) - tvTime.text = messageTime - val transformation = CurrentTheme.createTransformationForAvatar() - val imgUrl = intent.getStringExtra(Extra.IMAGE) - if (ivAvatar != null) { - ViewUtils.displayAvatar(ivAvatar, transformation, imgUrl, null) - } - val forwardMessagesRoot = findViewById(R.id.forward_messages) - val attachmentsRoot = findViewById(R.id.item_message_attachment_container) - val attachmentsHolder = AttachmentsHolder() - attachmentsHolder.setVgAudios(attachmentsRoot.findViewById(R.id.audio_attachments)) - .setVgVideos(attachmentsRoot.findViewById(R.id.video_attachments)) - .setVgDocs(attachmentsRoot.findViewById(R.id.docs_attachments)) - .setVgArticles(attachmentsRoot.findViewById(R.id.articles_attachments)) - .setVgBigLinks(attachmentsRoot.findViewById(R.id.biglinks_attachments)) - .setVgPhotos(attachmentsRoot.findViewById(R.id.photo_attachments)) - .setVgPosts(attachmentsRoot.findViewById(R.id.posts_attachments)) - .setVoiceMessageRoot(attachmentsRoot.findViewById(R.id.voice_message_attachments)) - val botKeyboardView = findViewById(R.id.input_keyboard_container) - if (botKeyboardView != null) { - val msgKeyboard = msg.keyboard - if (msgKeyboard != null && msgKeyboard.inline && msgKeyboard.buttons?.size.orZero() > 0) { - botKeyboardView.visibility = View.VISIBLE - botKeyboardView.setButtons(msgKeyboard.buttons, false) - } else { - botKeyboardView.visibility = View.GONE - } - botKeyboardView.setDelegate(object : BotKeyboardViewDelegate { - override fun didPressedButton(button: Keyboard.Button, needClose: Boolean) { - if (button.type == "open_link") { - LinkHelper.openLinkInBrowser(this@QuickAnswerActivity, button.link) - return - } - val builder = SaveMessageBuilder(accountId, msg.peerId) - .setPayload(button.payload).setText(button.label) - compositeDisposable.add( - messagesRepository.put(builder) - .fromIOToMain({ onMessageSaved() }) { throwable -> - onSavingError( - throwable - ) - }) - } - }) - } - val hasAttachments = - msg.fwd.nonNullNoEmpty() || msg.attachments?.hasAttachments == true - attachmentsRoot.visibility = if (hasAttachments) View.VISIBLE else View.GONE - if (hasAttachments) { - val attachmentsViewBinder = - AttachmentsViewBinder(this, object : OnAttachmentsActionCallback { - override fun onPollOpen(poll: Poll) {} - override fun onVideoPlay(video: Video) {} - override fun onAudioPlay( - position: Int, - audios: ArrayList