diff --git a/app/build.gradle.kts b/app/build.gradle.kts index a0c31cf7891ae8476b862d8163a67cd18aecb682..dfe4810e63ce1cbae3a57c0479757c39db9bbff1 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -1,204 +1,61 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2019 Janne Mareike Koschinski - * Copyright (c) 2019 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ +import de.kuschku.justcode.properties +import de.kuschku.justcode.signingData plugins { id("com.android.application") - kotlin("android") - kotlin("kapt") + id("kotlin-android") + id("de.kuschku.justcode") } -android { - compileSdkVersion(29) - - signingConfigs { - SigningData.of(project.rootProject.properties("signing.properties"))?.let { - create("default") { - storeFile = file(it.storeFile) - storePassword = it.storePassword - keyAlias = it.keyAlias - keyPassword = it.keyPassword - } - } - } +val composeVersion: String by extra +android { defaultConfig { - minSdkVersion(20) - targetSdkVersion(29) + setMinSdkVersion(21) + setTargetSdkVersion(30) applicationId = "com.iskrembilen.quasseldroid" - versionCode = cmd("git", "rev-list", "--count", "HEAD")?.toIntOrNull() ?: 1 - versionName = cmd("git", "describe", "--always", "--tags", "HEAD") ?: "1.0.0" - - buildConfigField("String", "GIT_HEAD", "\"${cmd("git", "rev-parse", "HEAD") ?: ""}\"") - buildConfigField("String", "FANCY_VERSION_NAME", "\"${fancyVersionName() ?: ""}\"") - buildConfigField("long", "GIT_COMMIT_DATE", "${cmd("git", "show", "-s", "--format=%ct") ?: 0}L") - - signingConfig = signingConfigs.findByName("default") - - resConfigs("en", "en-rGB", "de", "fr", "fr-rCA", "it", "lt", "pt", "sr") - - vectorDrawables.useSupportLibrary = true - - setProperty("archivesBaseName", "Quasseldroid-$versionName") - // Disable test runner analytics - testInstrumentationRunnerArguments = mapOf( - "disableAnalytics" to "true" - ) - testInstrumentationRunner = "de.kuschku.quasseldroid.util.TestRunner" + testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" } buildTypes { - getByName("release") { - isZipAlignEnabled = true - isMinifyEnabled = true - isShrinkResources = true - - multiDexEnabled = false - - proguardFiles( - getDefaultProguardFile("proguard-android.txt"), - "proguard-rules.pro" + release { + setMinifyEnabled(false) + setProguardFiles( + listOf( + getDefaultProguardFile("proguard-android-optimize.txt"), + "proguard-rules.pro" + ) ) } - - getByName("debug") { - applicationIdSuffix = ".debug" - - multiDexEnabled = true - } } - compileOptions { sourceCompatibility = JavaVersion.VERSION_1_8 targetCompatibility = JavaVersion.VERSION_1_8 } - - testOptions { - unitTests.isIncludeAndroidResources = true + kotlinOptions { + jvmTarget = "1.8" + useIR = true } - - lintOptions { - isWarningsAsErrors = true - setLintConfig(file("../lint.xml")) + buildFeatures { + compose = true } - - viewBinding { - isEnabled = true + composeOptions { + kotlinCompilerExtensionVersion = composeVersion } } dependencies { - implementation(kotlin("stdlib", "1.3.72")) - - // App Compat - implementation("com.google.android.material", "material", "1.1.0-alpha10") - - implementation("androidx.appcompat", "appcompat", "1.1.0") - implementation("androidx.browser", "browser", "1.2.0") - implementation("androidx.cardview", "cardview", "1.0.0") - implementation("androidx.recyclerview", "recyclerview", "1.1.0") - implementation("androidx.swiperefreshlayout", "swiperefreshlayout", "1.1.0-beta01") - implementation("androidx.preference", "preference", "1.1.0") - // Only needed for ringtone preference - implementation("androidx.legacy", "legacy-preference-v14", "1.0.0") - implementation("androidx.constraintlayout", "constraintlayout", "2.0.0-beta4") - - withVersion("2.2.5") { - implementation("androidx.room", "room-runtime", version) - kapt("androidx.room", "room-compiler", version) - implementation("androidx.room", "room-rxjava2", version) - testImplementation("androidx.room", "room-testing", version) - } - withVersion("2.2.0") { - implementation("androidx.lifecycle", "lifecycle-extensions", version) - implementation("androidx.lifecycle", "lifecycle-reactivestreams", version) - } - testImplementation("androidx.arch.core", "core-testing", "2.1.0") - implementation(project(":lifecycle-ktx")) - - implementation("androidx.paging", "paging-runtime", "2.1.2") - - implementation("androidx.multidex", "multidex", "2.0.1") - - // Utility - implementation("io.reactivex.rxjava2", "rxandroid", "2.1.1") - implementation("io.reactivex.rxjava2", "rxjava", "2.2.12") - implementation("org.threeten", "threetenbp", "1.4.0", classifier = "no-tzdb") - implementation("org.jetbrains", "annotations", "17.0.0") - implementation("com.google.code.gson", "gson", "2.8.5") - implementation("commons-codec", "commons-codec", "1.13") - implementation("com.squareup.retrofit2", "retrofit", "2.6.1") - implementation("com.squareup.retrofit2", "converter-gson", "2.6.1") - implementation("com.github.pwittchen", "reactivenetwork-rx2", "3.0.6") - withVersion("10.1.0") { - implementation("com.jakewharton", "butterknife", version) - kapt("com.jakewharton", "butterknife-compiler", version) - } - - // Quassel - implementation(project(":viewmodel")) - implementation(project(":persistence")) - implementation(project(":lib")) { - exclude(group = "org.threeten", module = "threetenbp") - } - - // UI - implementation("com.leinardi.android", "speed-dial", "3.0.0") - implementation("me.zhanghai.android.materialprogressbar", "library", "1.6.1") - implementation("com.google.android", "flexbox", "1.1.0") - implementation(project(":ui_spinner")) - withVersion("0.9.6.0") { - implementation("com.afollestad.material-dialogs", "core", version) - implementation("com.afollestad.material-dialogs", "commons", version) - } - withVersion("4.9.0") { - implementation("com.github.bumptech.glide", "glide", version) - implementation("com.github.bumptech.glide", "recyclerview-integration", version) - kapt("com.github.bumptech.glide", "compiler", version) - } - - // Quality Assurance - implementation(project(":malheur")) - withVersion("2.2") { - debugImplementation("com.squareup.leakcanary", "leakcanary-android", version) - } - - // Dependency Injection - withVersion("2.24") { - implementation("com.google.dagger", "dagger", version) - kapt("com.google.dagger", "dagger-compiler", version) - kapt("com.google.dagger", "dagger-android-processor", version) - implementation("com.google.dagger", "dagger-android", version) - implementation("com.google.dagger", "dagger-android-support", version) - } - - testImplementation("junit", "junit", "4.12") - testImplementation("org.robolectric", "robolectric", "4.3.1") { - exclude(group = "org.threeten", module = "threetenbp") - exclude(group = "com.google.auto.service", module = "auto-service") - } - - androidTestImplementation("junit", "junit", "4.12") - androidTestImplementation("androidx.test.espresso", "espresso-core", "3.3.0-alpha02") - androidTestImplementation("androidx.test.espresso", "espresso-contrib", "3.3.0-alpha02") - androidTestImplementation("androidx.test.ext", "junit", "1.1.2-alpha02") - androidTestImplementation("androidx.test", "runner", "1.3.0-alpha02") - androidTestImplementation("androidx.test", "rules", "1.3.0-alpha02") + implementation("androidx.core:core-ktx:1.3.2") + implementation("androidx.appcompat:appcompat:1.2.0") + implementation("com.google.android.material:material:1.2.1") + implementation("androidx.compose.ui:ui:$composeVersion") + implementation("androidx.compose.material:material:$composeVersion") + implementation("androidx.compose.ui:ui-tooling:$composeVersion") + implementation("androidx.lifecycle:lifecycle-runtime-ktx:2.3.0-rc01") + + testImplementation("junit:junit:4.13.1") + androidTestImplementation("androidx.test.ext:junit:1.1.2") + androidTestImplementation("androidx.test.espresso:espresso-core:3.3.0") } diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro index bcbaf4e513609f887056b7f4e44210695837a7a4..2f9dc5a47edc8241c18c1374b3f1fcf6396a829d 100644 --- a/app/proguard-rules.pro +++ b/app/proguard-rules.pro @@ -1,14 +1,10 @@ # Add project specific ProGuard rules here. -# By default, the flags in this file are appended to flags specified -# in /usr/lib/android-sdk/tools/proguard/proguard-android.txt -# You can edit the include path and order by changing the proguardFiles -# directive in build.gradle.kts. +# You can control the set of applied configuration files using the +# proguardFiles setting in build.gradle.kts. # # For more details, see # http://developer.android.com/guide/developing/tools/proguard.html -# Add any project specific keep options here: - # If your project uses WebView with JS, uncomment the following # and specify the fully qualified class name to the JavaScript interface # class: @@ -23,37 +19,3 @@ # If you keep the line number information, uncomment this to # hide the original source file name. #-renamesourcefileattribute SourceFile - -# The project is GPL anyway, obfuscation is useless. --dontobfuscate - -# Keep our invokers --keep class * implements de.kuschku.libquassel.quassel.syncables.interfaces.invokers.Invoker { - static ** INSTANCE; -} - -# remove unnecessary warnings -# Android HTTP Libs --dontnote android.net.http.** --dontnote org.apache.http.** -# Kotlin stuff --dontnote kotlin.** -# Gson --dontnote com.google.gson.** -# Dagger --dontwarn com.google.errorprone.annotations.* -# Retrofit --dontwarn retrofit2.** -# Annotation used by Retrofit on Java 8 VMs --dontwarn javax.annotation.Nullable --dontwarn javax.annotation.ParametersAreNonnullByDefault --dontwarn javax.annotation.concurrent.GuardedBy -# Retain generic type information for use by reflection by converters and adapters. --keepattributes Signature -# Retain declared checked exceptions for use by a Proxy instance. --keepattributes Exceptions -# Okio --dontwarn okio.** --dontwarn org.conscrypt.** -# OkHttp3 --dontwarn okhttp3.** diff --git a/app/redex.config b/app/redex.config deleted file mode 100644 index 54f7cc70fdfbb8fb8228af187f9713127e35e6ca..0000000000000000000000000000000000000000 --- a/app/redex.config +++ /dev/null @@ -1,121 +0,0 @@ -{ - "redex" : { - "passes" : [ - "MethodDevirtualizationPass", - "ReBindRefsPass", - "FinalInlinePass", - "DelSuperPass", - "SingleImplPass", - "PeepholePass", - "ConstantPropagationPass", - "LocalDcePass", - "AnnoKillPass", - "ReorderInterfacesPass", - "RemoveEmptyClassesPass", - "SingleImplPass", - "InterDexPass", - "RemoveGotosPass", - "DedupBlocksPass", - "ShortenSrcStringsPass", - "RegAllocPass", - "CopyPropagationPass", - "LocalDcePass", - "DedupBlocksPass", - "StripDebugInfoPass" - ] - }, - "RegAllocPass" : { - "live_range_splitting": "0" - }, - "SimpleInlinePass": { - "throws": true, - "multiple_callers": true, - "no_inline_annos" : [ - "Lcom/fasterxml/jackson/databind/annotation/JsonDeserialize;" - ], - "black_list": [], - "caller_black_list": [] - }, - "ShortenSrcStringsPass" : { - "filename_mappings" : "filename_mappings.txt" - }, - "FinalInlinePass" : { - "propagate_static_finals": true, - "replace_encodable_clinits": true, - "black_list_types" : [] - }, - "AnnoKillPass" : { - "keep_annos": [ - "Landroid/view/ViewDebug$CapturedViewProperty;", - "Landroid/view/ViewDebug$ExportedProperty;", - "Landroid/webkit/JavascriptInterface;", - "Landroid/widget/RemoteViews$RemoteView;", - "Lcom/google/android/gms/common/annotation/KeepName;" - ], - "kill_annos" : [ - "Lcom/google/inject/BindingAnnotation;" - ], - "force_kill_annos" : [ - "Ldalvik/annotation/EnclosingClass;", - "Ldalvik/annotation/EnclosingMethod;", - "Ldalvik/annotation/InnerClass;", - "Ldalvik/annotation/MemberClasses;", - "Ldalvik/annotation/Throws;" - ] - }, - "ConstantPropagationPass" : { - "blacklist": [], - "replace_moves_with_consts": true, - "fold_arithmetic": true - }, - "CopyPropagationPass" : { - "eliminate_const_literals": false, - "full_method_analysis": true - }, - "MethodDevirtualizationPass" : { - "staticize_vmethods_not_using_this" : true, - "staticize_dmethods_not_using_this" : true - }, - "StripDebugInfoPass" : { - "drop_all_dbg_info" : "0", - "drop_local_variables" : "1", - "drop_line_numbers" : "0", - "drop_src_files" : "0", - "use_whitelist" : "0", - "cls_whitelist" : [], - "method_whitelist" : [], - "drop_prologue_end" : "1", - "drop_epilogue_begin" : "1", - "drop_all_dbg_info_if_empty" : "1" - }, - "PeepholePass" : { - "disabled_peepholes": [ - "Replace_PutGet", - "Replace_PutGetWide", - "Replace_PutGetObject", - "Replace_PutGetShort", - "Replace_PutGetChar", - "Replace_PutGetByte", - "Replace_PutGetBoolean" - ] - }, - "keep_packages": [ - "Lcom/fasterxml/jackson/", - "Lcom/google/dexmaker/mockito/" - ], - "keep_annotations": [ - "Lcom/google/common/annotations/VisibleForTesting;" - ], - "proguard_map_output": "redex_pg_mapping.txt", - "stats_output": "stats.txt", - "bytecode_offset_map": "bytecode_offset_map.txt", - "line_number_map_v2": "redex-line-number-map-v2", - "method_move_map" : "redex-moved-methods-map.txt", - "string_sort_mode" : "class_order", - "bytecode_sort_mode" : "class_order", - "ir_type_checker": { - "run_after_each_pass" : false, - "polymorphic_constants" : false, - "verify_moves" : false - } -} diff --git a/app/sampledata/channels.json b/app/sampledata/channels.json deleted file mode 100644 index 60acd6fc5c9cd6de57d0881824f525a42e808aef..0000000000000000000000000000000000000000 --- a/app/sampledata/channels.json +++ /dev/null @@ -1,34 +0,0 @@ -{ - "data": [ - { - "name": "#fdroid", - "topic": "Due to spam you temporarily need to be registered to speak. | https://f-droid.org | https://forum.f-droid.org | https://mastodon.technology/@fdroidorg | For development discussion use #fdroid-dev | This channel is logged via matrix at https://view.matrix.org/alias/%23fdroid:f-droid.org", - "users": "673 users" - }, - { - "name": "#fdroid-dev", - "topic": "Due to spam you temporarily need to be registered to speak. | | F-Droid development discussion only, use #fdroid for general, app and repo-related matters | This channel is logged via matrix at https://view.matrix.org/alias/%23fdroid-dev:f-droid.org", - "users": "59 users" - }, - { - "name": "#ircdocs", - "topic": "http://ircdocs.horse/ and associated projects - http://defs.ircdocs.horse/ - http://stats.ircdocs.horse/ - http://modern.ircdocs.horse/ - https://wooooms.ircdocs.horse/ - https://github.com/irc-archive/ - combating IRC spec nonsense, one document at a time <3 👌😩 < merivingian~", - "users": "54 users" - }, - { - "name": "#ircv3", - "topic": "https://ircv3.net | Roadmap: https://git.io/IRCv3-Roadmap | Code of conduct: https://ircv3.net/conduct", - "users": "202 users" - }, - { - "name": "#quassel", - "topic": "Quassel IRC - https://quassel-irc.org || Latest: 0.13.0 || Mailing Lists: https://lists.quassel-irc.org || Tracker: https://bugs.quassel-irc.org || Activity RSS: #quassel-announce || German: #quassel.de || Quassel on Android: #quasseldroid; on iOS: #woboquassel", - "users": "667 users" - }, - { - "name": "#quasseldroid", - "topic": "Quasseldroid is an Android client for #quassel ♥ https://quasseldroid.info/ ♥ Requires a Quassel 0.13 Core for full functionality: https://quasseldroid.info/releases/ ♥ https://git.kuschku.de/justjanne/Quasseldroid-NG/", - "users": "165 users" - } - ] -} diff --git a/app/sampledata/contributors.json b/app/sampledata/contributors.json deleted file mode 100644 index 7eb06eb3501a295c7a9ffcf356aee724e281afbc..0000000000000000000000000000000000000000 --- a/app/sampledata/contributors.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "data": [ - { - "name": "Janne Mareike Koschinski", - "nickname": "justJanne", - "description": "Rewrite, UI, Annotation Processors, Backend" - }, - { - "name": "Frederik M. J. Vestre", - "nickname": "freqmod", - "description": "Initial qdatastream deserialization attempts" - }, - { - "name": "Martin “Java Sucks” Sandsmark", - "nickname": "sandsmark", - "description": "Legacy protocol implementation, (de)serializers, project (de)moralizer" - }, - { - "name": "Magnus Fjell", - "nickname": "magnuf", - "description": "Legacy UI" - }, - { - "name": "Ken Børge Viktil", - "nickname": "Kenji", - "description": "Legacy UI" - } - ] -} diff --git a/app/sampledata/features.json b/app/sampledata/features.json deleted file mode 100644 index d49f8a321db97515c14e9ed48bd349ab6e66e84c..0000000000000000000000000000000000000000 --- a/app/sampledata/features.json +++ /dev/null @@ -1,64 +0,0 @@ -{ - "data": [ - { - "name": "SynchronizedMarkerLine", - "description": "Required for synchronizing the last position in channels" - }, - { - "name": "SaslAuthentication", - "description": "Required for SASL" - }, - { - "name": "SaslExternal", - "description": "Required for SASL with certificates" - }, - { - "name": "HideInactiveNetworks", - "description": "Required for hiding inactive networks from chat lists" - }, - { - "name": "PasswordChange", - "description": "Required for changing passwords from the client" - }, - { - "name": "CapNegotiation", - "description": "Required for IRCv3 capabilities" - }, - { - "name": "VerifyServerSSL", - "description": "Required for verifying the SSL certificate of IRC networks you connect to" - }, - { - "name": "CustomRateLimits", - "description": "Required for custom rate limits for IRC networks" - }, - { - "name": "AwayFormatTimestamp", - "description": "Required for custom formatted timestamps in away messages" - }, - { - "name": "BufferActivitySync", - "description": "Required for seeing activity of chats in the chat list" - }, - { - "name": "CoreSideHighlights", - "description": "Required for highlights" - }, - { - "name": "SenderPrefixes", - "description": "Required for seeing prefix modes (+, @) of users in channels" - }, - { - "name": "RemoteDisconnect", - "description": "Required for remote disconnects of your own clients" - }, - { - "name": "RichMessages", - "description": "Required for seeing real names or IRCv3 or Gravatar avatars in messages" - }, - { - "name": "BacklogFilterType", - "description": "Required for receiving past notifications after connecting" - } - ] -} diff --git a/app/sampledata/libraries.json b/app/sampledata/libraries.json deleted file mode 100644 index 5031bdb06e2607e3262b9a907f393ec673986685..0000000000000000000000000000000000000000 --- a/app/sampledata/libraries.json +++ /dev/null @@ -1,204 +0,0 @@ -{ - "data": [ - { - "name": "AndroidX", - "license": { - "short_name": "Apache-2.0", - "full_name": "Apache License" - }, - "url": "https://developer.android.com/jetpack/androidx" - }, - { - "name": "atinject", - "license": { - "short_name": "Apache-2.0", - "full_name": "Apache License" - }, - "url": "https://code.google.com/archive/p/atinject/" - }, - { - "name": "AutoService", - "version": "1.0-rc4", - "license": { - "short_name": "Apache-2.0", - "full_name": "Apache License" - }, - "url": "https://github.com/google/auto/tree/master/service" - }, - { - "name": "Better Link Movement Method", - "version": "2.1.0", - "license": { - "short_name": "Apache-2.0", - "full_name": "Apache License" - }, - "url": "https://github.com/Saketme/Better-Link-Movement-Method" - }, - { - "name": "Butter Knife", - "version": "8.8.1", - "license": { - "short_name": "Apache-2.0", - "full_name": "Apache License" - }, - "url": "http://jakewharton.github.io/butterknife/" - }, - { - "name": "Dagger 2", - "version": "2.15", - "license": { - "short_name": "Apache-2.0", - "full_name": "Apache License" - }, - "url": "https://google.github.io/dagger/" - }, - { - "name": "Dracula", - "license": { - "short_name": "MIT", - "full_name": "The MIT License (MIT}" - }, - "url": "https://draculatheme.com/" - }, - { - "name": "Glide", - "version": "4.6.1", - "license": { - "short_name": "Apache-2.0", - "full_name": "Apache License" - }, - "url": "https://bumptech.github.io/glide/" - }, - { - "name": "Gson", - "version": "2.8.2", - "license": { - "short_name": "Apache-2.0", - "full_name": "Apache License" - }, - "url": "https://github.com/google/gson" - }, - { - "name": "Gruvbox", - "license": { - "short_name": "MIT", - "full_name": "The MIT License (MIT}" - }, - "url": "https://github.com/morhetz/gruvbox" - }, - { - "name": "JavaPoet", - "version": "1.10.0", - "license": { - "short_name": "Apache-2.0", - "full_name": "Apache License" - }, - "url": "https://github.com/square/javapoet" - }, - { - "name": "JetBrains Java Annotations", - "version": "16.0.1", - "license": { - "short_name": "Apache-2.0", - "full_name": "Apache License" - }, - "url": "https://github.com/JetBrains/java-annotations" - }, - { - "name": "Kotlin Standard Library", - "version": "1.3.20", - "license": { - "short_name": "Apache-2.0", - "full_name": "Apache License" - }, - "url": "https://kotlinlang.org/" - }, - { - "name": "LeakCanary", - "version": "1.5.4", - "license": { - "short_name": "Apache-2.0", - "full_name": "Apache License" - }, - "url": "https://github.com/square/leakcanary" - }, - { - "name": "Material Design Icons: Community", - "license": { - "short_name": "SIL Open Font License v1.1", - "full_name": "SIL OPEN FONT LICENSE" - }, - "url": "https://github.com/Templarian/MaterialDesign" - }, - { - "name": "Material Design Icons: Google", - "version": "3.0.1", - "license": { - "short_name": "Apache-2.0", - "full_name": "Apache License" - }, - "url": "https://github.com/google/material-design-icons" - }, - { - "name": "Material Dialogs", - "version": "0.9.6.0", - "license": { - "short_name": "MIT", - "full_name": "The MIT License (MIT}" - }, - "url": "https://github.com/afollestad/material-dialogs" - }, - { - "name": "MaterialProgressBar", - "version": "1.4.2", - "license": { - "short_name": "Apache-2.0", - "full_name": "Apache License" - }, - "url": "https://github.com/DreaminginCodeZH/MaterialProgressBar" - }, - { - "name": "Quassel", - "version": "0.13.0", - "license": { - "short_name": "GPLv3", - "full_name": "GNU GENERAL PUBLIC LICENSE" - }, - "url": "https://quassel-irc.org/" - }, - { - "name": "Reactive Streams", - "version": "1.0.2", - "license": { - "short_name": "CC0", - "full_name": "Creative Commons CC0 1.0 Universal" - }, - "url": "https://github.com/ReactiveX/RxJava" - }, - { - "name": "RxJava", - "version": "2.1.9", - "license": { - "short_name": "Apache-2.0", - "full_name": "Apache License" - }, - "url": "https://github.com/ReactiveX/RxJava" - }, - { - "name": "Solarized", - "license": { - "short_name": "MIT", - "full_name": "The MIT License (MIT}" - }, - "url": "http://ethanschoonover.com/solarized" - }, - { - "name": "ThreeTen backport project", - "version": "1.4.0", - "license": { - "short_name": "BSD 3-clause" - }, - "url": "http://www.threeten.org/threetenbp/" - } - ] -} diff --git a/app/sampledata/messages.json b/app/sampledata/messages.json deleted file mode 100644 index b2a72e5334e9dde756ef9c3feb2c1bc05bc51ec8..0000000000000000000000000000000000000000 --- a/app/sampledata/messages.json +++ /dev/null @@ -1,358 +0,0 @@ -{ - "data": [ - [ - [ - { - "id": 35465155, - "time": "02:51", - "message": "justJanne: https://s3.kuschku.de/releases/quasseldroid-ng/QuasseldroidNG-v0.3.0-197-g8f556b6-release.apk", - "sender": "justJanne", - "content": "https://s3.kuschku.de/releases/quasseldroid-ng/QuasseldroidNG-v0.3.0-197-g8f556b6-release.apk" - }, - { - "id": 35465242, - "time": "02:53", - "message": "justJanne: personally, I always use solarized light during the day, and solarized dark during the night", - "sender": "justJanne", - "content": "personally, I always use solarized light during the day, and solarized dark during the night" - }, - { - "id": 35465311, - "time": "02:55", - "message": "captainepoch: are colours being customizable? :S", - "sender": "captainepoch", - "content": "are colours being customizable? :S" - }, - { - "id": 35465417, - "time": "02:57", - "message": "Exterminador: maybe ™", - "sender": "Exterminador", - "content": "maybe ™" - }, - { - "id": 35465419, - "time": "02:57", - "message": "Exterminador: lol", - "sender": "Exterminador", - "content": "lol" - }, - { - "id": 35465428, - "time": "02:57", - "message": "justJanne: captainepoch: I tried that in -NG, it’s basically impossible in Android", - "sender": "justJanne", - "content": "captainepoch: I tried that in -NG, it’s basically impossible in Android" - }, - { - "id": 35465436, - "time": "02:57", - "message": "justJanne: if you suggest a theme, I’ll add it, though", - "sender": "justJanne", - "content": "if you suggest a theme, I’ll add it, though" - }, - { - "id": 35465475, - "time": "02:58", - "message": "romibi: good thing then that you can do the impossible :D … (at least it appears like it sometimes)", - "sender": "romibi", - "content": "good thing then that you can do the impossible :D … (at least it appears like it sometimes)" - }, - { - "id": 35465477, - "time": "02:58", - "message": "romibi: :P", - "sender": "romibi", - "content": ":P" - }, - { - "id": 35465481, - "time": "02:58", - "message": "captainepoch: It's not that I appreciate the effort, but I never liked the solarized theme... I could work in one, maybe", - "sender": "captainepoch", - "content": "It's not that I appreciate the effort, but I never liked the solarized theme... I could work in one, maybe" - }, - { - "id": 35465487, - "time": "02:58", - "message": "captainepoch: I use the dark theme in the actual quasseldroid f-droid's build", - "sender": "captainepoch", - "content": "I use the dark theme in the actual quasseldroid f-droid's build" - }, - { - "id": 35465490, - "time": "02:58", - "message": "captainepoch: I like it", - "sender": "captainepoch", - "content": "I like it" - }, - { - "id": 35465509, - "time": "02:58", - "message": "justJanne: captainepoch: look at https://quasseldroid.info/#make_it_yours", - "sender": "justJanne", - "content": "captainepoch: look at https://quasseldroid.info/#make_it_yours" - }, - { - "id": 35465513, - "time": "02:59", - "message": "justJanne: it has more than just one theme already", - "sender": "justJanne", - "content": "it has more than just one theme already" - }, - { - "id": 35465563, - "time": "03:00", - "message": "captainepoch: the second or the last one are of my liking :)", - "sender": "captainepoch", - "content": "the second or the last one are of my liking :)" - }, - { - "id": 35465716, - "time": "03:03", - "message": "romibi: oh … those are quite new screenshots", - "sender": "romibi", - "content": "oh … those are quite new screenshots" - }, - { - "id": 35465798, - "time": "03:05", - "message": "captainepoch: I installed the new client", - "sender": "captainepoch", - "content": "I installed the new client" - }, - { - "id": 35465800, - "time": "03:05", - "message": "captainepoch: Pretty awesome", - "sender": "captainepoch", - "content": "Pretty awesome" - }, - { - "id": 35466133, - "time": "03:13", - "message": "amiconn: justJanne: Late4st build is still showing an empty list...?", - "sender": "amiconn", - "content": "justJanne: Late4st build is still showing an empty list...?" - }, - { - "id": 35466403, - "time": "03:21", - "message": "Exterminador: uninstall and reinstall", - "sender": "Exterminador", - "content": "uninstall and reinstall" - }, - { - "id": 35466407, - "time": "03:21", - "message": "Exterminador: I had to do that", - "sender": "Exterminador", - "content": "I had to do that" - }, - { - "id": 35466414, - "time": "03:21", - "message": "amiconn: eek", - "sender": "amiconn", - "content": "eek" - }, - { - "id": 35466439, - "time": "03:22", - "message": "Exterminador: like justJanne said, it's a test product, don't have migrations in place yet", - "sender": "Exterminador", - "content": "like justJanne said, it's a test product, don't have migrations in place yet" - }, - { - "id": 35466544, - "time": "03:25", - "message": "amiconn: Deleting data was sufficient.", - "sender": "amiconn", - "content": "Deleting data was sufficient." - }, - { - "id": 35466578, - "time": "03:26", - "message": "amiconn: Enter seems to work properly now, thanks :)", - "sender": "amiconn", - "content": "Enter seems to work properly now, thanks :)" - }, - { - "id": 35466616, - "time": "03:27", - "message": "amiconn: Unfortunately there's a new bug: in the input box, the top part of full-height letters is cut of", - "sender": "amiconn", - "content": "Unfortunately there's a new bug: in the input box, the top part of full-height letters is cut of" - }, - { - "id": 35466767, - "time": "03:34", - "message": "Exterminador: in my soft keyboard, I have the emoji button", - "sender": "Exterminador", - "content": "in my soft keyboard, I have the emoji button" - }, - { - "id": 35466770, - "time": "03:34", - "message": "Exterminador: I have to use the on screen send button", - "sender": "Exterminador", - "content": "I have to use the on screen send button" - }, - { - "id": 35467009, - "time": "03:43", - "message": "Exterminador: justJanne, no pressure on this tho. but can the netsplit message be improved to display the users that have quitted due to the netsplit?", - "sender": "Exterminador", - "content": "justJanne, no pressure on this tho. but can the netsplit message be improved to display the users that have quitted due to the netsplit?" - }, - { - "id": 35467031, - "time": "03:43", - "message": "Exterminador: right now we now how many users have splitted but not which", - "sender": "Exterminador", - "content": "right now we now how many users have splitted but not which" - }, - { - "id": 35467158, - "time": "03:48", - "message": "justJanne: Exterminador: It'll soon have a button to expand the message, at which time it will show all users. Soon.", - "sender": "justJanne", - "content": "Exterminador: It'll soon have a button to expand the message, at which time it will show all users. Soon." - }, - { - "id": 35467183, - "time": "03:49", - "message": "Exterminador: alright!", - "sender": "Exterminador", - "content": "alright!" - }, - { - "id": 35467237, - "time": "03:52", - "message": "Exterminador: justJanne: (big) bug. there's one person that have pmed me and isn't appearing in the list. although it appears in other chat app when I connect to the znc", - "sender": "Exterminador", - "content": "justJanne: (big) bug. there's one person that have pmed me and isn't appearing in the list. although it appears in other chat app when I connect to the znc" - }, - { - "id": 35467394, - "time": "03:55", - "message": "Exterminador: wait..", - "sender": "Exterminador", - "content": "wait.." - }, - { - "id": 35467429, - "time": "03:56", - "message": "Exterminador: my bad. sorry. :x", - "sender": "Exterminador", - "content": "my bad. sorry. :x" - }, - { - "id": 35467442, - "time": "03:56", - "message": "Exterminador: I was looking in the wrong network", - "sender": "Exterminador", - "content": "I was looking in the wrong network" - }, - { - "id": 35468622, - "time": "04:25", - "message": "justJanne: New version! https://s3.kuschku.de/releases/quasseldroid-ng/QuasseldroidNG-v0.3.0-199-gac691ac-release.apk", - "sender": "justJanne", - "content": "New version! https://s3.kuschku.de/releases/quasseldroid-ng/QuasseldroidNG-v0.3.0-199-gac691ac-release.apk" - }, - { - "id": 35468623, - "time": "04:25", - "message": "justJanne: New themes! https://quasseldroid.info/#make_it_yours", - "sender": "justJanne", - "content": "New themes! https://quasseldroid.info/#make_it_yours" - }, - { - "id": 35468635, - "time": "04:26", - "message": "captainepoch: another release?", - "sender": "captainepoch", - "content": "another release?" - }, - { - "id": 35468637, - "time": "04:26", - "message": "captainepoch: leul", - "sender": "captainepoch", - "content": "leul" - }, - { - "id": 35468645, - "time": "04:26", - "message": "captainepoch: what is the changelog? :|", - "sender": "captainepoch", - "content": "what is the changelog? :|" - }, - { - "id": 35468682, - "time": "04:28", - "message": "justJanne: captainepoch: there’s new themes", - "sender": "justJanne", - "content": "captainepoch: there’s new themes" - }, - { - "id": 35468684, - "time": "04:28", - "message": "justJanne: and some minor bugfixes", - "sender": "justJanne", - "content": "and some minor bugfixes" - }, - { - "id": 35468701, - "time": "04:28", - "message": "justJanne: captainepoch: this is an alpha – new versions are published every few hours", - "sender": "justJanne", - "content": "captainepoch: this is an alpha – new versions are published every few hours" - }, - { - "id": 35468702, - "time": "04:28", - "message": "captainepoch: wou", - "sender": "captainepoch", - "content": "wou" - }, - { - "id": 35468705, - "time": "04:28", - "message": "justJanne: every time with new features, new bugfixes, and new bugs", - "sender": "justJanne", - "content": "every time with new features, new bugfixes, and new bugs" - }, - { - "id": 35468722, - "time": "04:28", - "message": "captainepoch: I'd love to contribute to the project but I don't have enough time :(", - "sender": "captainepoch", - "content": "I'd love to contribute to the project but I don't have enough time :(" - }, - { - "id": 35469529, - "time": "04:46", - "message": "Exterminador: great! monospace font!", - "sender": "Exterminador", - "content": "great! monospace font!" - }, - { - "id": 35469533, - "time": "04:46", - "message": "Exterminador: xD", - "sender": "Exterminador", - "content": "xD" - }, - { - "id": 35469623, - "time": "04:49", - "message": "Exterminador: justJanne, auto completion button next! :P", - "sender": "Exterminador", - "content": "justJanne, auto completion button next! :P" - } - ] - ] - ] -} diff --git a/app/sampledata/networks.json b/app/sampledata/networks.json deleted file mode 100644 index 079e43fe6343cf43c149bb58915d2944ecf32240..0000000000000000000000000000000000000000 --- a/app/sampledata/networks.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "data": [ - { - "host": "ipv6-irc.snoonet.org", - "port": "6697" - }, - { - "host": "irc.snoonet.org", - "port": "6697" - }, - { - "host": "eu-irc.snoonet.org", - "port": "6697" - }, - { - "host": "alt-irc.snoonet.org", - "port": "6697" - }, - { - "host": "asiapac-irc.snoonet.org", - "port": "6697" - } - ] -} diff --git a/app/sampledata/recent_messages.json b/app/sampledata/recent_messages.json deleted file mode 100644 index c2534df0b84bbf9b59e3c1749ae511dc286e2c78..0000000000000000000000000000000000000000 --- a/app/sampledata/recent_messages.json +++ /dev/null @@ -1,106 +0,0 @@ -{ - "data": [ - [ - { - "id": 35468705, - "time": "04:28", - "message": "every time with new features, new bugfixes, and new bugs" - }, - { - "id": 35468701, - "time": "04:28", - "message": "captainepoch: this is an alpha – new versions are published every few hours" - }, - { - "id": 35468684, - "time": "04:28", - "message": "and some minor bugfixes" - }, - { - "id": 35468682, - "time": "04:28", - "message": "captainepoch: there’s new themes" - }, - { - "id": 35468623, - "time": "04:25", - "message": "New themes! https://quasseldroid.info/#make_it_yours" - }, - { - "id": 35468622, - "time": "04:25", - "message": "New version! https://s3.kuschku.de/releases/quasseldroid-ng/QuasseldroidNG-v0.3.0-199-gac691ac-release.apk" - }, - { - "id": 35467158, - "time": "03:48", - "message": "Exterminador: It'll soon have a button to expand the message, at which time it will show all users. Soon." - }, - { - "id": 35465513, - "time": "02:59", - "message": "it has more than just one theme already" - }, - { - "id": 35465509, - "time": "02:58", - "message": "captainepoch: look at https://quasseldroid.info/#make_it_yours" - }, - { - "id": 35465436, - "time": "02:57", - "message": "if you suggest a theme, I’ll add it, though" - }, - { - "id": 35465428, - "time": "02:57", - "message": "captainepoch: I tried that in -NG, it’s basically impossible in Android" - }, - { - "id": 35465242, - "time": "02:53", - "message": "personally, I always use solarized light during the day, and solarized dark during the night" - }, - { - "id": 35465155, - "time": "02:51", - "message": "https://s3.kuschku.de/releases/quasseldroid-ng/QuasseldroidNG-v0.3.0-197-g8f556b6-release.apk" - }, - { - "id": 35465130, - "time": "02:51", - "message": "4 more bugfixes on their way" - }, - { - "id": 35464766, - "time": "02:42", - "message": "thanks, will do" - }, - { - "id": 35464762, - "time": "02:42", - "message": "captainepoch: good point, I know what I forgot!" - }, - { - "id": 35464674, - "time": "02:40", - "message": "So, we’re here: The minimum viable product is out" - }, - { - "id": 35464636, - "time": "02:39", - "message": "https://i.imgur.com/JdKiRIm.png" - }, - { - "id": 35464607, - "time": "02:39", - "message": "fixed" - }, - { - "id": 35464606, - "time": "02:39", - "message": "Exterminador: https://s3.kuschku.de/releases/quasseldroid-ng/QuasseldroidNG-v0.3.0-194-g08dc2bf-release.apk" - } - ] - ] -} diff --git a/app/sampledata/userinfo_basic.json b/app/sampledata/userinfo_basic.json deleted file mode 100644 index b7b4a432bd56c653cc2a4b090b793f4f2aa3c844..0000000000000000000000000000000000000000 --- a/app/sampledata/userinfo_basic.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "data": [ - { - "name": "Nickname", - "value": "justJanne" - }, - { - "name": "Ident", - "value": "~justJanne" - }, - { - "name": "host", - "value": "lithium.kuschku.de" - }, - { - "name": "Real Name", - "value": "Janne Mareike Koschinski https://kuschku.de/" - }, - { - "name": "Account", - "value": "justJanne" - } - ] -} diff --git a/app/sampledata/userinfo_groups.json b/app/sampledata/userinfo_groups.json deleted file mode 100644 index ccefa8e52022a97052b273634e2521bb009d30f1..0000000000000000000000000000000000000000 --- a/app/sampledata/userinfo_groups.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "data": [ - { - "id": 0, - "name": "User" - }, - { - "id": 1, - "name": "Away" - } - ] -} \ No newline at end of file diff --git a/app/src/androidTest/java/de/kuschku/quasseldroid/AccountBehaviorTest.kt b/app/src/androidTest/java/de/kuschku/quasseldroid/AccountBehaviorTest.kt deleted file mode 100644 index 06b2ce8dd261075ca9cc7b5fa559f8d961abcd52..0000000000000000000000000000000000000000 --- a/app/src/androidTest/java/de/kuschku/quasseldroid/AccountBehaviorTest.kt +++ /dev/null @@ -1,171 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid - -import android.view.View -import androidx.recyclerview.widget.RecyclerView -import androidx.test.espresso.Espresso.onView -import androidx.test.espresso.action.ViewActions.* -import androidx.test.espresso.contrib.RecyclerViewActions -import androidx.test.espresso.matcher.ViewMatchers -import androidx.test.espresso.matcher.ViewMatchers.withEffectiveVisibility -import androidx.test.espresso.matcher.ViewMatchers.withId -import androidx.test.ext.junit.runners.AndroidJUnit4 -import androidx.test.filters.LargeTest -import androidx.test.platform.app.InstrumentationRegistry -import androidx.test.rule.ActivityTestRule -import com.google.android.material.floatingactionbutton.FloatingActionButton -import com.google.android.material.textfield.TextInputEditText -import de.kuschku.quasseldroid.ui.chat.ChatActivity -import de.kuschku.quasseldroid.ui.setup.accounts.selection.AccountSelectionActivity -import de.kuschku.quasseldroid.util.conditionwatcher.ConditionWatcher.waitForCondition -import de.kuschku.quasseldroid.util.conditionwatcher.Instruction -import de.kuschku.quasseldroid.util.matcher.IsFullyRenderedMatcher.Companion.isFullyRendered -import de.kuschku.quasseldroid.util.matches -import org.junit.Rule -import org.junit.Test -import org.junit.runner.RunWith -import java.lang.Thread.sleep - - -@RunWith(AndroidJUnit4::class) -@LargeTest -class AccountBehaviorTest { - @get:Rule - val activityActivityTestRule = ActivityTestRule(ChatActivity::class.java) - - data class TestData( - val host: String, - val port: Int, - val requireSsl: Boolean, - val user: String, - val pass: String - ) - - @Test - fun actuallyTestThisThing() { - val testData = TestData( - host = InstrumentationRegistry.getArguments().getString("host", "localhost"), - port = InstrumentationRegistry.getArguments().getInt("port", 4242), - requireSsl = InstrumentationRegistry.getArguments().getBoolean("requireSsl"), - user = InstrumentationRegistry.getArguments().getString("user", "test"), - pass = InstrumentationRegistry.getArguments().getString("pass", "test") - ) - - onView(withId(R.id.host)) - .perform(typeText(testData.host)) - - onView(withId(R.id.port)) - .perform( - clearText(), - typeText(testData.port.toString()) - ) - - if (testData.requireSsl) { - onView(withId(R.id.require_ssl)) - .perform(click()) - } - - waitForCondition(1_000, Instruction("next button should be visible") { - activity?.findViewById<FloatingActionButton>(R.id.next_button).matches( - isFullyRendered() - ) - }) - - onView(withId(R.id.next_button)) - .perform(click()) - - waitForCondition(1_000, Instruction("user input should be visible") { - activity?.findViewById<TextInputEditText>(R.id.user).matches( - isFullyRendered() - ) - }) - - onView(withId(R.id.user)) - .perform( - clearText(), - typeText(testData.user) - ) - - onView(withId(R.id.pass)) - .perform( - clearText(), - typeText(testData.pass) - ) - - waitForCondition(1_000, Instruction("next button should be visible") { - activity?.findViewById<FloatingActionButton>(R.id.next_button).matches( - isFullyRendered() - ) - }) - - onView(withId(R.id.next_button)) - .perform(click()) - - waitForCondition(1_000, Instruction("name input should be visible") { - activity?.findViewById<TextInputEditText>(R.id.name).matches( - isFullyRendered() - ) - }) - - onView(withId(R.id.name)) - .perform( - clearText(), - typeText("Remote Test") - ) - - waitForCondition(1_000, Instruction("next button should be visible") { - activity?.findViewById<FloatingActionButton>(R.id.next_button).matches( - isFullyRendered() - ) - }) - - onView(withId(R.id.next_button)) - .perform(click()) - - waitForCondition(1_000, Instruction("selection activity should be shown") { - activity is AccountSelectionActivity - }) - - sleep(500) - - onView(withId(R.id.account_list)) - .perform(RecyclerViewActions.actionOnItemAtPosition<RecyclerView.ViewHolder>(0, click())) - - waitForCondition(1_000, Instruction("next button should be visible") { - activity?.findViewById<FloatingActionButton>(R.id.next_button).matches( - isFullyRendered() - ) - }) - - onView(withId(R.id.next_button)) - .perform(click()) - - waitForCondition(1_000, Instruction("chat activity should be shown") { - activity is ChatActivity - }) - - waitForCondition(10_000, Instruction("connection display should not be shown") { - activity?.findViewById<View>(R.id.connection_status).matches( - withEffectiveVisibility(ViewMatchers.Visibility.GONE) - ) - }) - } -} diff --git a/app/src/androidTest/java/de/kuschku/quasseldroid/ActivityLifecycleHandler.kt b/app/src/androidTest/java/de/kuschku/quasseldroid/ActivityLifecycleHandler.kt deleted file mode 100644 index 629e9f2bd3e39dc20f06fc891ef420af1a4f21c1..0000000000000000000000000000000000000000 --- a/app/src/androidTest/java/de/kuschku/quasseldroid/ActivityLifecycleHandler.kt +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid - -import android.app.Activity -import android.app.Application -import android.os.Bundle - -class ActivityLifecycleHandler : Application.ActivityLifecycleCallbacks { - var currentActivity: Activity? = null - private set - - override fun onActivityCreated(activity: Activity?, savedInstanceState: Bundle?) = Unit - override fun onActivityStarted(activity: Activity?) = Unit - override fun onActivityResumed(activity: Activity?) { - currentActivity = activity - } - - override fun onActivityPaused(activity: Activity?) { - currentActivity = null - } - - override fun onActivityStopped(activity: Activity?) = Unit - override fun onActivitySaveInstanceState(activity: Activity?, outState: Bundle?) = Unit - override fun onActivityDestroyed(activity: Activity?) = Unit -} diff --git a/app/src/androidTest/java/de/kuschku/quasseldroid/ExampleInstrumentedTest.kt b/app/src/androidTest/java/de/kuschku/quasseldroid/ExampleInstrumentedTest.kt new file mode 100644 index 0000000000000000000000000000000000000000..5df983b03b579463530a45ed0fe96809a812bd49 --- /dev/null +++ b/app/src/androidTest/java/de/kuschku/quasseldroid/ExampleInstrumentedTest.kt @@ -0,0 +1,24 @@ +package de.kuschku.quasseldroid + +import androidx.test.platform.app.InstrumentationRegistry +import androidx.test.ext.junit.runners.AndroidJUnit4 + +import org.junit.Test +import org.junit.runner.RunWith + +import org.junit.Assert.* + +/** + * Instrumented test, which will execute on an Android device. + * + * See [testing documentation](http://d.android.com/tools/testing). + */ +@RunWith(AndroidJUnit4::class) +class ExampleInstrumentedTest { + @Test + fun useAppContext() { + // Context of the app under test. + val appContext = InstrumentationRegistry.getInstrumentation().targetContext + assertEquals("de.kuschku.quasseldroid", appContext.packageName) + } +} \ No newline at end of file diff --git a/app/src/androidTest/java/de/kuschku/quasseldroid/QuasseldroidAndroidTest.kt b/app/src/androidTest/java/de/kuschku/quasseldroid/QuasseldroidAndroidTest.kt deleted file mode 100644 index 0dd6094c50f9f816efca9e088db70d24a8efee48..0000000000000000000000000000000000000000 --- a/app/src/androidTest/java/de/kuschku/quasseldroid/QuasseldroidAndroidTest.kt +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid - -import de.kuschku.quasseldroid.app.QuasseldroidBaseDelegate - -class QuasseldroidAndroidTest : Quasseldroid() { - val activityLifecycleHandler = ActivityLifecycleHandler() - - override val delegate = QuasseldroidBaseDelegate(this) - - override fun onCreate() { - super.onCreate() - registerActivityLifecycleCallbacks(activityLifecycleHandler) - } -} diff --git a/app/src/androidTest/java/de/kuschku/quasseldroid/util/TestRunner.kt b/app/src/androidTest/java/de/kuschku/quasseldroid/util/TestRunner.kt deleted file mode 100644 index 311857c645cda2236dd01104a34d2104d3c0234b..0000000000000000000000000000000000000000 --- a/app/src/androidTest/java/de/kuschku/quasseldroid/util/TestRunner.kt +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.util - -import android.app.Application -import android.content.Context -import androidx.test.runner.AndroidJUnitRunner -import de.kuschku.quasseldroid.Quasseldroid -import de.kuschku.quasseldroid.QuasseldroidAndroidTest - -class TestRunner : AndroidJUnitRunner() { - override fun newApplication(cl: ClassLoader?, className: String?, - context: Context?): Application { - return super.newApplication( - cl, - if (className == Quasseldroid::class.java.canonicalName) QuasseldroidAndroidTest::class.java.canonicalName - else className, - context - ) - } -} diff --git a/app/src/androidTest/java/de/kuschku/quasseldroid/util/ViewUtil.kt b/app/src/androidTest/java/de/kuschku/quasseldroid/util/ViewUtil.kt deleted file mode 100644 index d51bfab8756b98032f2d580d834b94171ec9e9bc..0000000000000000000000000000000000000000 --- a/app/src/androidTest/java/de/kuschku/quasseldroid/util/ViewUtil.kt +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.util - -import org.hamcrest.Matcher - -fun <T> T?.matches(vararg matchers: Matcher<T>): Boolean = this != null && matchers.all { - it.matches(this) -} diff --git a/app/src/androidTest/java/de/kuschku/quasseldroid/util/conditionwatcher/ConditionWatcher.java b/app/src/androidTest/java/de/kuschku/quasseldroid/util/conditionwatcher/ConditionWatcher.java deleted file mode 100644 index 685ca385a1da4dadf664f2d832868f90c2f1a946..0000000000000000000000000000000000000000 --- a/app/src/androidTest/java/de/kuschku/quasseldroid/util/conditionwatcher/ConditionWatcher.java +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.util.conditionwatcher; - -/** - * Created by F1sherKK on 08/10/15. - */ -public class ConditionWatcher { - - public static final int CONDITION_NOT_MET = 0; - public static final int CONDITION_MET = 1; - public static final int TIMEOUT = 2; - - public static final int DEFAULT_TIMEOUT_LIMIT = 1000 * 60; - public static final int DEFAULT_INTERVAL = 250; - private static ConditionWatcher conditionWatcher; - private int timeoutLimit = DEFAULT_TIMEOUT_LIMIT; - private int watchInterval = DEFAULT_INTERVAL; - - private ConditionWatcher() { - super(); - } - - public static ConditionWatcher getInstance() { - if (conditionWatcher == null) { - conditionWatcher = new ConditionWatcher(); - } - return conditionWatcher; - } - - public static void waitForCondition(int timeoutLimit, Instruction instruction) throws Exception { - setTimeoutLimit(timeoutLimit); - waitForCondition(instruction); - } - - public static void waitForCondition(Instruction instruction) throws Exception { - int status = CONDITION_NOT_MET; - int elapsedTime = 0; - - do { - if (instruction.checkCondition()) { - status = CONDITION_MET; - } else { - elapsedTime += getInstance().watchInterval; - Thread.sleep(getInstance().watchInterval); - } - - if (elapsedTime >= getInstance().timeoutLimit) { - status = TIMEOUT; - break; - } - } while (status != CONDITION_MET); - - if (status == TIMEOUT) - throw new Exception(instruction.getDescription() + " - took more than " + getInstance().timeoutLimit / 1000 + " seconds. Test stopped."); - } - - public static void setWatchInterval(int watchInterval) { - getInstance().watchInterval = watchInterval; - } - - public static void setTimeoutLimit(int ms) { - getInstance().timeoutLimit = ms; - } -} diff --git a/app/src/androidTest/java/de/kuschku/quasseldroid/util/conditionwatcher/Instruction.kt b/app/src/androidTest/java/de/kuschku/quasseldroid/util/conditionwatcher/Instruction.kt deleted file mode 100644 index 05223b5241819470f29e8d317ac41bdcd92c82f5..0000000000000000000000000000000000000000 --- a/app/src/androidTest/java/de/kuschku/quasseldroid/util/conditionwatcher/Instruction.kt +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.util.conditionwatcher - -import androidx.test.platform.app.InstrumentationRegistry -import de.kuschku.quasseldroid.QuasseldroidAndroidTest - -class Instruction( - val description: String, - private val condition: InstructionContext.() -> Boolean -) { - fun checkCondition(): Boolean = condition.invoke(InstructionContext) - - object InstructionContext { - val application - get() = (InstrumentationRegistry.getInstrumentation().targetContext.applicationContext as QuasseldroidAndroidTest) - - val activity - get() = application.activityLifecycleHandler.currentActivity - } -} diff --git a/app/src/androidTest/java/de/kuschku/quasseldroid/util/matcher/IsFullyRenderedMatcher.kt b/app/src/androidTest/java/de/kuschku/quasseldroid/util/matcher/IsFullyRenderedMatcher.kt deleted file mode 100644 index 9598700a2aec8f4eb5bbb4bead49acc4fe99882e..0000000000000000000000000000000000000000 --- a/app/src/androidTest/java/de/kuschku/quasseldroid/util/matcher/IsFullyRenderedMatcher.kt +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.util.matcher - -import android.view.View -import androidx.test.espresso.matcher.ViewMatchers -import androidx.test.espresso.remote.annotation.RemoteMsgConstructor -import de.kuschku.quasseldroid.util.matches -import org.hamcrest.Description -import org.hamcrest.TypeSafeMatcher - -class IsFullyRenderedMatcher @RemoteMsgConstructor internal constructor( - areaPercentage: Int -) : TypeSafeMatcher<View>() { - - private val isDisplayingAtLeastMatcher = ViewMatchers.isDisplayingAtLeast( - areaPercentage) - private val withEffectiveVisibilityMatcher = ViewMatchers.withEffectiveVisibility( - ViewMatchers.Visibility.VISIBLE) - - override fun describeTo(description: Description) { - description.appendText("view is fully rendered") - } - - public override fun matchesSafely(view: View) = view.matches( - isDisplayingAtLeastMatcher, - withEffectiveVisibilityMatcher - ) - - companion object { - fun isFullyRendered(areaPercentage: Int = 100) = IsFullyRenderedMatcher( - areaPercentage) - } -} diff --git a/app/src/debug/res/values/colors.xml b/app/src/debug/res/values/colors.xml deleted file mode 100644 index 90c54e64fcaab219db486bac29fb9377b4d7ef50..0000000000000000000000000000000000000000 --- a/app/src/debug/res/values/colors.xml +++ /dev/null @@ -1,27 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<resources> - <color name="colorPrimary">#c0700a</color> - <color name="colorPrimaryDark">#945a10</color> - <color name="colorAccent">#ffaf3b</color> - - <color name="colorIconLight">#e79102</color> - <color name="colorIconDark">#994e12</color> -</resources> diff --git a/app/src/debug/res/values/strings.xml b/app/src/debug/res/values/strings.xml deleted file mode 100644 index 0eafaf1f64d11554dc732700edf839a616cedc8e..0000000000000000000000000000000000000000 --- a/app/src/debug/res/values/strings.xml +++ /dev/null @@ -1,22 +0,0 @@ -<!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<resources> - <string name="app_name">QuasselTest</string> -</resources> diff --git a/app/src/debug/res/values/strings_constants.xml b/app/src/debug/res/values/strings_constants.xml deleted file mode 100644 index 479d5b95c5f82ddb509f6e118deae26896e61760..0000000000000000000000000000000000000000 --- a/app/src/debug/res/values/strings_constants.xml +++ /dev/null @@ -1,22 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<resources> - <string name="package_name" translatable="false">com.iskrembilen.quasseldroid.debug</string> -</resources> diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index c9d62a77e67efe4d65360e80f891d2f362dd0fa7..72659f21495d77c9023a01c3facd7a08ebec5e11 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -1,326 +1,24 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2019 Janne Mareike Koschinski - Copyright (c) 2019 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - +<?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="de.kuschku.quasseldroid"> - <uses-feature - android:name="android.hardware.type.pc" - android:required="false" /> - <uses-feature - android:name="android.hardware.touchscreen" - android:required="false" /> - - <uses-permission android:name="android.permission.INTERNET" /> - <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> - - <uses-permission android:name="android.permission.FOREGROUND_SERVICE" /> - <application - android:name=".Quasseldroid" android:allowBackup="true" - android:description="@string/app_description" - android:fullBackupContent="@xml/backup_content" + android:fullBackupContent="@xml/backup_descriptor" android:icon="@mipmap/ic_launcher" android:label="@string/app_name" + android:roundIcon="@mipmap/ic_launcher_round" android:supportsRtl="true" - android:theme="@style/Theme.SplashTheme"> - + android:theme="@style/Theme.Quasseldroid"> <activity - android:name=".ui.chat.ChatActivity" - android:exported="true" + android:name=".MainActivity" android:label="@string/app_name" - android:launchMode="singleTask" - android:windowSoftInputMode="adjustResize"> + android:theme="@style/Theme.Quasseldroid.NoActionBar"> <intent-filter> <action android:name="android.intent.action.MAIN" /> - <action android:name="android.intent.action.VIEW" /> - <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> - <intent-filter> - <action android:name="android.intent.action.SEND" /> - <category android:name="android.intent.category.DEFAULT" /> - <data android:mimeType="text/plain" /> - </intent-filter> - <intent-filter> - <action android:name="android.intent.action.VIEW" /> - - <category android:name="android.intent.category.DEFAULT" /> - <category android:name="android.intent.category.BROWSABLE" /> - - <data android:scheme="irc" /> - <data android:scheme="ircs" /> - </intent-filter> </activity> - <activity - android:name="de.kuschku.quasseldroid.ui.info.user.UserInfoActivity" - android:exported="false" - android:label="@string/label_info_user" - android:parentActivityName=".ui.chat.ChatActivity" - android:windowSoftInputMode="adjustResize" /> - - <!-- Normal Chat --> - <activity - android:name="de.kuschku.quasseldroid.ui.info.channel.ChannelInfoActivity" - android:exported="false" - android:label="@string/label_info_channel" - android:parentActivityName=".ui.chat.ChatActivity" - android:windowSoftInputMode="adjustResize" /> - - <!-- Info --> - <activity - android:name="de.kuschku.quasseldroid.ui.info.core.CoreInfoActivity" - android:exported="false" - android:label="@string/label_info_core" - android:parentActivityName=".ui.chat.ChatActivity" - android:windowSoftInputMode="adjustResize" /> - <activity - android:name="de.kuschku.quasseldroid.ui.chat.topic.TopicActivity" - android:exported="false" - android:label="@string/label_topic" - android:windowSoftInputMode="adjustResize" /> - <activity - android:name="de.kuschku.quasseldroid.ui.info.channellist.ChannelListActivity" - android:exported="false" - android:label="@string/label_info_channellist" - android:windowSoftInputMode="adjustResize" /> - <activity - android:name="de.kuschku.quasseldroid.ui.info.certificate.CertificateInfoActivity" - android:exported="false" - android:label="@string/label_info_certificate" - android:windowSoftInputMode="adjustResize" /> - <activity - android:name="de.kuschku.quasseldroid.ui.chat.archive.ArchiveActivity" - android:exported="false" - android:label="@string/label_archived_chats" - android:windowSoftInputMode="adjustResize" /> - <activity - android:name="de.kuschku.quasseldroid.ui.chat.add.create.ChannelCreateActivity" - android:exported="false" - android:label="@string/label_create_channel" - android:windowSoftInputMode="adjustResize" /> - - <!-- Archive --> - <activity - android:name="de.kuschku.quasseldroid.ui.chat.add.join.ChannelJoinActivity" - android:exported="false" - android:label="@string/label_join_long" - android:windowSoftInputMode="adjustResize" /> - - <!-- Add --> - <activity - android:name="de.kuschku.quasseldroid.ui.chat.add.query.QueryCreateActivity" - android:exported="false" - android:label="@string/label_query_medium" - android:windowSoftInputMode="adjustResize" /> - <activity - android:name=".ui.coresettings.CoreSettingsActivity" - android:exported="false" - android:label="@string/label_settings_core" - android:parentActivityName=".ui.chat.ChatActivity" - android:windowSoftInputMode="adjustResize" /> - <activity - android:name=".ui.coresettings.network.NetworkCreateActivity" - android:exported="false" - android:label="@string/settings_network_title" - android:parentActivityName=".ui.coresettings.CoreSettingsActivity" - android:windowSoftInputMode="adjustResize" /> - - <!-- Core Settings --> - <activity - android:name=".ui.coresettings.network.NetworkEditActivity" - android:exported="false" - android:label="@string/settings_network_title" - android:parentActivityName=".ui.coresettings.CoreSettingsActivity" - android:windowSoftInputMode="adjustResize" /> - <activity - android:name=".ui.coresettings.networkserver.NetworkServerActivity" - android:exported="false" - android:label="@string/settings_networkserver_title" - android:windowSoftInputMode="adjustResize" /> - <activity - android:name=".ui.coresettings.identity.IdentityCreateActivity" - android:exported="false" - android:label="@string/settings_identity_title" - android:parentActivityName=".ui.coresettings.CoreSettingsActivity" - android:windowSoftInputMode="adjustResize" /> - <activity - android:name=".ui.coresettings.identity.IdentityEditActivity" - android:exported="false" - android:label="@string/settings_identity_title" - android:parentActivityName=".ui.coresettings.CoreSettingsActivity" - android:windowSoftInputMode="adjustResize" /> - <activity - android:name=".ui.coresettings.chatlist.ChatlistCreateActivity" - android:exported="false" - android:label="@string/settings_chatlist_title" - android:parentActivityName=".ui.coresettings.CoreSettingsActivity" - android:windowSoftInputMode="adjustResize" /> - <activity - android:name=".ui.coresettings.chatlist.ChatlistEditActivity" - android:exported="false" - android:label="@string/settings_chatlist_title" - android:parentActivityName=".ui.coresettings.CoreSettingsActivity" - android:windowSoftInputMode="adjustResize" /> - <activity - android:name=".ui.coresettings.ignorelist.IgnoreListActivity" - android:exported="false" - android:label="@string/settings_ignorelist_title" - android:parentActivityName=".ui.coresettings.CoreSettingsActivity" - android:windowSoftInputMode="adjustResize" /> - <activity - android:name=".ui.coresettings.ignoreitem.IgnoreItemActivity" - android:exported="false" - android:label="@string/settings_ignoreitem_title" - android:parentActivityName=".ui.coresettings.ignorelist.IgnoreListActivity" - android:windowSoftInputMode="adjustResize" /> - <activity - android:name=".ui.coresettings.highlightlist.HighlightListActivity" - android:exported="false" - android:label="@string/settings_highlightlist_title" - android:parentActivityName=".ui.coresettings.CoreSettingsActivity" - android:windowSoftInputMode="adjustResize" /> - <activity - android:name=".ui.coresettings.highlightrule.HighlightRuleActivity" - android:exported="false" - android:label="@string/settings_highlightrule_title" - android:parentActivityName=".ui.coresettings.highlightlist.HighlightListActivity" - android:windowSoftInputMode="adjustResize" /> - <activity - android:name=".ui.coresettings.aliaslist.AliasListActivity" - android:exported="false" - android:label="@string/settings_aliaslist_title" - android:parentActivityName=".ui.coresettings.CoreSettingsActivity" - android:windowSoftInputMode="adjustResize" /> - <activity - android:name=".ui.coresettings.aliasitem.AliasItemActivity" - android:exported="false" - android:label="@string/settings_aliasitem_title" - android:parentActivityName=".ui.coresettings.aliaslist.AliasListActivity" - android:windowSoftInputMode="adjustResize" /> - <activity - android:name=".ui.coresettings.networkconfig.NetworkConfigActivity" - android:exported="false" - android:label="@string/settings_networkconfig_title" - android:parentActivityName=".ui.coresettings.CoreSettingsActivity" - android:windowSoftInputMode="adjustResize" /> - <activity - android:name="de.kuschku.quasseldroid.ui.coresettings.passwordchange.PasswordChangeActivity" - android:exported="false" - android:label="@string/label_password_change" - android:windowSoftInputMode="adjustResize" /> - <activity - android:name=".ui.clientsettings.client.ClientSettingsActivity" - android:exported="false" - android:label="@string/label_settings_client" - android:windowSoftInputMode="adjustResize" /> - <activity - android:name=".ui.clientsettings.crash.CrashActivity" - android:exported="false" - android:label="@string/label_crashes" - android:windowSoftInputMode="adjustResize" /> - - <!-- Client Settings --> - <activity - android:name=".ui.clientsettings.whitelist.WhitelistActivity" - android:exported="false" - android:label="@string/label_certificates" - android:windowSoftInputMode="adjustResize" /> - <activity - android:name=".ui.clientsettings.about.AboutActivity" - android:exported="false" - android:label="@string/label_about" - android:windowSoftInputMode="adjustResize" /> - <activity - android:name=".ui.clientsettings.license.LicenseActivity" - android:exported="false" - android:label="@string/label_license" - android:parentActivityName=".ui.clientsettings.about.AboutActivity" - android:windowSoftInputMode="adjustResize" /> - <activity - android:name=".ui.setup.accounts.selection.AccountSelectionActivity" - android:exported="false" - android:label="@string/app_name" - android:parentActivityName=".ui.chat.ChatActivity" - android:windowSoftInputMode="adjustResize" /> - <activity - android:name=".ui.setup.accounts.setup.AccountSetupActivity" - android:exported="false" - android:label="@string/app_name" - android:parentActivityName=".ui.setup.accounts.selection.AccountSelectionActivity" - android:windowSoftInputMode="adjustResize" /> - - <!-- Client Setup Flow --> - <activity - android:name=".ui.setup.accounts.edit.AccountEditActivity" - android:exported="false" - android:label="@string/app_name" - android:parentActivityName=".ui.setup.accounts.selection.AccountSelectionActivity" - android:windowSoftInputMode="adjustResize" /> - <activity - android:name=".ui.setup.core.CoreSetupActivity" - android:exported="false" - android:label="@string/setup_core_title" - android:parentActivityName=".ui.chat.ChatActivity" - android:windowSoftInputMode="adjustResize" /> - <activity - android:name=".ui.setup.user.UserSetupActivity" - android:exported="false" - android:label="@string/setup_user_title" - android:parentActivityName=".ui.chat.ChatActivity" - android:windowSoftInputMode="adjustResize" /> - - <!-- Core Setup Flow --> - <activity - android:name=".ui.setup.network.NetworkSetupActivity" - android:exported="false" - android:label="@string/setup_network_title" - android:parentActivityName=".ui.chat.ChatActivity" - android:windowSoftInputMode="adjustResize" /> - - <!-- Core User Setup Flow --> - <meta-data - android:name="WindowManagerPreference:FreeformWindowSize" - android:value="tablet" /> - - <!-- Network Setup Flow --> - <meta-data - android:name="WindowManagerPreference:FreeformWindowOrientation" - android:value="landscape" /> - - <!-- Services --> - <provider - android:name="androidx.core.content.FileProvider" - android:authorities="${applicationId}.fileprovider" - android:exported="false" - android:grantUriPermissions="true"> - <meta-data - android:name="android.support.FILE_PROVIDER_PATHS" - android:resource="@xml/filepaths" /> - </provider> - - <service - android:name=".service.QuasselService" - android:description="@string/connection_service_description" - android:exported="false" - android:label="@string/connection_service_title" /> </application> </manifest> diff --git a/app/src/main/assets/TZDB.dat b/app/src/main/assets/TZDB.dat deleted file mode 100644 index a9b6c361e2c345eb75c706874a3ed48edef4013d..0000000000000000000000000000000000000000 Binary files a/app/src/main/assets/TZDB.dat and /dev/null differ diff --git a/app/src/main/assets/emoji.json b/app/src/main/assets/emoji.json deleted file mode 100644 index 16303c22f39152ffca89ffbc7265d332dae9136c..0000000000000000000000000000000000000000 --- a/app/src/main/assets/emoji.json +++ /dev/null @@ -1,6042 +0,0 @@ -[ - { - "shortcode": ":100:", - "replacement": "\ud83d\udcaf" - }, - { - "shortcode": ":1234:", - "replacement": "\ud83d\udd22" - }, - { - "shortcode": ":+1:", - "replacement": "\ud83d\udc4d" - }, - { - "shortcode": ":-1:", - "replacement": "\ud83d\udc4e" - }, - { - "shortcode": ":1st_place_medal:", - "replacement": "\ud83e\udd47" - }, - { - "shortcode": ":2nd_place_medal:", - "replacement": "\ud83e\udd48" - }, - { - "shortcode": ":3rd_place_medal:", - "replacement": "\ud83e\udd49" - }, - { - "shortcode": ":8ball:", - "replacement": "\ud83c\udfb1" - }, - { - "shortcode": ":a:", - "replacement": "\ud83c\udd70" - }, - { - "shortcode": ":ab:", - "replacement": "\ud83c\udd8e" - }, - { - "shortcode": ":abc:", - "replacement": "\ud83d\udd24" - }, - { - "shortcode": ":abcd:", - "replacement": "\ud83d\udd21" - }, - { - "shortcode": ":accept:", - "replacement": "\ud83c\ude51" - }, - { - "shortcode": ":aerial_tramway:", - "replacement": "\ud83d\udea1" - }, - { - "shortcode": ":afghanistan:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":airplane:", - "replacement": "\ud7c9\udf08" - }, - { - "shortcode": ":aland_islands:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":alarm_clock:", - "replacement": "\ud7c8\udff0" - }, - { - "shortcode": ":albania:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":alembic:", - "replacement": "\ud7c9\ude97" - }, - { - "shortcode": ":algeria:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":alien:", - "replacement": "\ud83d\udc7d" - }, - { - "shortcode": ":ambulance:", - "replacement": "\ud83d\ude91" - }, - { - "shortcode": ":american_samoa:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":amphora:", - "replacement": "\ud83c\udffa" - }, - { - "shortcode": ":anchor:", - "replacement": "\ud7c9\ude93" - }, - { - "shortcode": ":andorra:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":angel:", - "replacement": "\ud83d\udc7c" - }, - { - "shortcode": ":anger:", - "replacement": "\ud83d\udca2" - }, - { - "shortcode": ":angola:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":angry:", - "replacement": "\ud83d\ude20" - }, - { - "shortcode": ":anguilla:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":anguished:", - "replacement": "\ud83d\ude27" - }, - { - "shortcode": ":ant:", - "replacement": "\ud83d\udc1c" - }, - { - "shortcode": ":antarctica:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":antigua_barbuda:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":apple:", - "replacement": "\ud83c\udf4e" - }, - { - "shortcode": ":aquarius:", - "replacement": "\ud7c9\ude52" - }, - { - "shortcode": ":argentina:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":aries:", - "replacement": "\ud7c9\ude48" - }, - { - "shortcode": ":armenia:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":arrow_backward:", - "replacement": "\ud7c9\uddc0" - }, - { - "shortcode": ":arrow_double_down:", - "replacement": "\ud7c8\udfec" - }, - { - "shortcode": ":arrow_double_up:", - "replacement": "\ud7c8\udfeb" - }, - { - "shortcode": ":arrow_down:", - "replacement": "\ud7ca\udf07" - }, - { - "shortcode": ":arrow_down_small:", - "replacement": "\ud83d\udd3d" - }, - { - "shortcode": ":arrow_forward:", - "replacement": "\ud7c9\uddb6" - }, - { - "shortcode": ":arrow_heading_down:", - "replacement": "\ud7ca\udd35" - }, - { - "shortcode": ":arrow_heading_up:", - "replacement": "\ud7ca\udd34" - }, - { - "shortcode": ":arrow_left:", - "replacement": "\ud7ca\udf05" - }, - { - "shortcode": ":arrow_lower_left:", - "replacement": "\ud7c8\udd99" - }, - { - "shortcode": ":arrow_lower_right:", - "replacement": "\ud7c8\udd98" - }, - { - "shortcode": ":arrow_right:", - "replacement": "\ud7c9\udfa1" - }, - { - "shortcode": ":arrow_right_hook:", - "replacement": "\ud7c8\uddaa" - }, - { - "shortcode": ":arrow_up:", - "replacement": "\ud7ca\udf06" - }, - { - "shortcode": ":arrow_up_down:", - "replacement": "\ud7c8\udd95" - }, - { - "shortcode": ":arrow_up_small:", - "replacement": "\ud83d\udd3c" - }, - { - "shortcode": ":arrow_upper_left:", - "replacement": "\ud7c8\udd96" - }, - { - "shortcode": ":arrow_upper_right:", - "replacement": "\ud7c8\udd97" - }, - { - "shortcode": ":arrows_clockwise:", - "replacement": "\ud83d\udd03" - }, - { - "shortcode": ":arrows_counterclockwise:", - "replacement": "\ud83d\udd04" - }, - { - "shortcode": ":art:", - "replacement": "\ud83c\udfa8" - }, - { - "shortcode": ":articulated_lorry:", - "replacement": "\ud83d\ude9b" - }, - { - "shortcode": ":artificial_satellite:", - "replacement": "\ud83d\udef0" - }, - { - "shortcode": ":aruba:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":asterisk:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":astonished:", - "replacement": "\ud83d\ude32" - }, - { - "shortcode": ":athletic_shoe:", - "replacement": "\ud83d\udc5f" - }, - { - "shortcode": ":atm:", - "replacement": "\ud83c\udfe7" - }, - { - "shortcode": ":atom:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":atom_symbol:", - "replacement": "\ud7c9\ude9b" - }, - { - "shortcode": ":australia:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":austria:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":avocado:", - "replacement": "\ud83e\udd51" - }, - { - "shortcode": ":azerbaijan:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":b:", - "replacement": "\ud83c\udd71" - }, - { - "shortcode": ":baby:", - "replacement": "\ud83d\udc76" - }, - { - "shortcode": ":baby_bottle:", - "replacement": "\ud83c\udf7c" - }, - { - "shortcode": ":baby_chick:", - "replacement": "\ud83d\udc24" - }, - { - "shortcode": ":baby_symbol:", - "replacement": "\ud83d\udebc" - }, - { - "shortcode": ":back:", - "replacement": "\ud83d\udd19" - }, - { - "shortcode": ":bacon:", - "replacement": "\ud83e\udd53" - }, - { - "shortcode": ":badminton:", - "replacement": "\ud83c\udff8" - }, - { - "shortcode": ":baggage_claim:", - "replacement": "\ud83d\udec4" - }, - { - "shortcode": ":baguette_bread:", - "replacement": "\ud83e\udd56" - }, - { - "shortcode": ":bahamas:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":bahrain:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":balance_scale:", - "replacement": "\ud7c9\ude96" - }, - { - "shortcode": ":balloon:", - "replacement": "\ud83c\udf88" - }, - { - "shortcode": ":ballot_box:", - "replacement": "\ud83d\uddf3" - }, - { - "shortcode": ":ballot_box_with_check:", - "replacement": "\ud7c9\ude11" - }, - { - "shortcode": ":bamboo:", - "replacement": "\ud83c\udf8d" - }, - { - "shortcode": ":banana:", - "replacement": "\ud83c\udf4c" - }, - { - "shortcode": ":bangbang:", - "replacement": "\ud7c8\udc3c" - }, - { - "shortcode": ":bangladesh:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":bank:", - "replacement": "\ud83c\udfe6" - }, - { - "shortcode": ":bar_chart:", - "replacement": "\ud83d\udcca" - }, - { - "shortcode": ":barbados:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":barber:", - "replacement": "\ud83d\udc88" - }, - { - "shortcode": ":baseball:", - "replacement": "\ud7c9\udebe" - }, - { - "shortcode": ":basecamp:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":basecampy:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":basketball:", - "replacement": "\ud83c\udfc0" - }, - { - "shortcode": ":basketball_man:", - "replacement": "\ud7c9\udef9" - }, - { - "shortcode": ":basketball_woman:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":bat:", - "replacement": "\ud83e\udd87" - }, - { - "shortcode": ":bath:", - "replacement": "\ud83d\udec0" - }, - { - "shortcode": ":bathtub:", - "replacement": "\ud83d\udec1" - }, - { - "shortcode": ":battery:", - "replacement": "\ud83d\udd0b" - }, - { - "shortcode": ":beach_umbrella:", - "replacement": "\ud83c\udfd6" - }, - { - "shortcode": ":bear:", - "replacement": "\ud83d\udc3b" - }, - { - "shortcode": ":bed:", - "replacement": "\ud83d\udecf" - }, - { - "shortcode": ":bee:", - "replacement": "\ud83d\udc1d" - }, - { - "shortcode": ":beer:", - "replacement": "\ud83c\udf7a" - }, - { - "shortcode": ":beers:", - "replacement": "\ud83c\udf7b" - }, - { - "shortcode": ":beetle:", - "replacement": "\ud83d\udc1e" - }, - { - "shortcode": ":beginner:", - "replacement": "\ud83d\udd30" - }, - { - "shortcode": ":belarus:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":belgium:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":belize:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":bell:", - "replacement": "\ud83d\udd14" - }, - { - "shortcode": ":bellhop_bell:", - "replacement": "\ud83d\udece" - }, - { - "shortcode": ":benin:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":bento:", - "replacement": "\ud83c\udf71" - }, - { - "shortcode": ":bermuda:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":bhutan:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":bicyclist:", - "replacement": "\ud83d\udeb4" - }, - { - "shortcode": ":bike:", - "replacement": "\ud83d\udeb2" - }, - { - "shortcode": ":biking_man:", - "replacement": "\ud83d\udeb4" - }, - { - "shortcode": ":biking_woman:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":bikini:", - "replacement": "\ud83d\udc59" - }, - { - "shortcode": ":biohazard:", - "replacement": "\ud7c9\ude23" - }, - { - "shortcode": ":bird:", - "replacement": "\ud83d\udc26" - }, - { - "shortcode": ":birthday:", - "replacement": "\ud83c\udf82" - }, - { - "shortcode": ":black_circle:", - "replacement": "\ud7c9\udeab" - }, - { - "shortcode": ":black_flag:", - "replacement": "\ud83c\udff4" - }, - { - "shortcode": ":black_heart:", - "replacement": "\ud83d\udda4" - }, - { - "shortcode": ":black_joker:", - "replacement": "\ud83c\udccf" - }, - { - "shortcode": ":black_large_square:", - "replacement": "\ud7ca\udf1b" - }, - { - "shortcode": ":black_medium_small_square:", - "replacement": "\ud7c9\uddfe" - }, - { - "shortcode": ":black_medium_square:", - "replacement": "\ud7c9\uddfc" - }, - { - "shortcode": ":black_nib:", - "replacement": "\ud7c9\udf12" - }, - { - "shortcode": ":black_small_square:", - "replacement": "\ud7c9\uddaa" - }, - { - "shortcode": ":black_square_button:", - "replacement": "\ud83d\udd32" - }, - { - "shortcode": ":blonde_man:", - "replacement": "\ud83d\udc71" - }, - { - "shortcode": ":blonde_woman:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":blossom:", - "replacement": "\ud83c\udf3c" - }, - { - "shortcode": ":blowfish:", - "replacement": "\ud83d\udc21" - }, - { - "shortcode": ":blue_book:", - "replacement": "\ud83d\udcd8" - }, - { - "shortcode": ":blue_car:", - "replacement": "\ud83d\ude99" - }, - { - "shortcode": ":blue_heart:", - "replacement": "\ud83d\udc99" - }, - { - "shortcode": ":blush:", - "replacement": "\ud83d\ude0a" - }, - { - "shortcode": ":boar:", - "replacement": "\ud83d\udc17" - }, - { - "shortcode": ":boat:", - "replacement": "\ud7c9\udef5" - }, - { - "shortcode": ":bolivia:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":bomb:", - "replacement": "\ud83d\udca3" - }, - { - "shortcode": ":book:", - "replacement": "\ud83d\udcd6" - }, - { - "shortcode": ":bookmark:", - "replacement": "\ud83d\udd16" - }, - { - "shortcode": ":bookmark_tabs:", - "replacement": "\ud83d\udcd1" - }, - { - "shortcode": ":books:", - "replacement": "\ud83d\udcda" - }, - { - "shortcode": ":boom:", - "replacement": "\ud83d\udca5" - }, - { - "shortcode": ":boot:", - "replacement": "\ud83d\udc62" - }, - { - "shortcode": ":bosnia_herzegovina:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":botswana:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":bouquet:", - "replacement": "\ud83d\udc90" - }, - { - "shortcode": ":bow:", - "replacement": "\ud83d\ude47" - }, - { - "shortcode": ":bow_and_arrow:", - "replacement": "\ud83c\udff9" - }, - { - "shortcode": ":bowing_man:", - "replacement": "\ud83d\ude47" - }, - { - "shortcode": ":bowing_woman:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":bowling:", - "replacement": "\ud83c\udfb3" - }, - { - "shortcode": ":bowtie:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":boxing_glove:", - "replacement": "\ud83e\udd4a" - }, - { - "shortcode": ":boy:", - "replacement": "\ud83d\udc66" - }, - { - "shortcode": ":brazil:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":bread:", - "replacement": "\ud83c\udf5e" - }, - { - "shortcode": ":bride_with_veil:", - "replacement": "\ud83d\udc70" - }, - { - "shortcode": ":bridge_at_night:", - "replacement": "\ud83c\udf09" - }, - { - "shortcode": ":briefcase:", - "replacement": "\ud83d\udcbc" - }, - { - "shortcode": ":british_indian_ocean_territory:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":british_virgin_islands:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":broken_heart:", - "replacement": "\ud83d\udc94" - }, - { - "shortcode": ":brunei:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":bug:", - "replacement": "\ud83d\udc1b" - }, - { - "shortcode": ":building_construction:", - "replacement": "\ud83c\udfd7" - }, - { - "shortcode": ":bulb:", - "replacement": "\ud83d\udca1" - }, - { - "shortcode": ":bulgaria:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":bullettrain_front:", - "replacement": "\ud83d\ude85" - }, - { - "shortcode": ":bullettrain_side:", - "replacement": "\ud83d\ude84" - }, - { - "shortcode": ":burkina_faso:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":burrito:", - "replacement": "\ud83c\udf2f" - }, - { - "shortcode": ":burundi:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":bus:", - "replacement": "\ud83d\ude8c" - }, - { - "shortcode": ":business_suit_levitating:", - "replacement": "\ud83d\udd74" - }, - { - "shortcode": ":busstop:", - "replacement": "\ud83d\ude8f" - }, - { - "shortcode": ":bust_in_silhouette:", - "replacement": "\ud83d\udc64" - }, - { - "shortcode": ":busts_in_silhouette:", - "replacement": "\ud83d\udc65" - }, - { - "shortcode": ":butterfly:", - "replacement": "\ud83e\udd8b" - }, - { - "shortcode": ":cactus:", - "replacement": "\ud83c\udf35" - }, - { - "shortcode": ":cake:", - "replacement": "\ud83c\udf70" - }, - { - "shortcode": ":calendar:", - "replacement": "\ud83d\udcc6" - }, - { - "shortcode": ":call_me_hand:", - "replacement": "\ud83e\udd19" - }, - { - "shortcode": ":calling:", - "replacement": "\ud83d\udcf2" - }, - { - "shortcode": ":cambodia:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":camel:", - "replacement": "\ud83d\udc2b" - }, - { - "shortcode": ":camera:", - "replacement": "\ud83d\udcf7" - }, - { - "shortcode": ":camera_flash:", - "replacement": "\ud83d\udcf8" - }, - { - "shortcode": ":cameroon:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":camping:", - "replacement": "\ud83c\udfd5" - }, - { - "shortcode": ":canada:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":canary_islands:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":cancer:", - "replacement": "\ud7c9\ude4b" - }, - { - "shortcode": ":candle:", - "replacement": "\ud83d\udd6f" - }, - { - "shortcode": ":candy:", - "replacement": "\ud83c\udf6c" - }, - { - "shortcode": ":canoe:", - "replacement": "\ud83d\udef6" - }, - { - "shortcode": ":cape_verde:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":capital_abcd:", - "replacement": "\ud83d\udd20" - }, - { - "shortcode": ":capricorn:", - "replacement": "\ud7c9\ude51" - }, - { - "shortcode": ":car:", - "replacement": "\ud83d\ude97" - }, - { - "shortcode": ":card_file_box:", - "replacement": "\ud83d\uddc3" - }, - { - "shortcode": ":card_index:", - "replacement": "\ud83d\udcc7" - }, - { - "shortcode": ":card_index_dividers:", - "replacement": "\ud83d\uddc2" - }, - { - "shortcode": ":caribbean_netherlands:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":carousel_horse:", - "replacement": "\ud83c\udfa0" - }, - { - "shortcode": ":carrot:", - "replacement": "\ud83e\udd55" - }, - { - "shortcode": ":cat:", - "replacement": "\ud83d\udc31" - }, - { - "shortcode": ":cat2:", - "replacement": "\ud83d\udc08" - }, - { - "shortcode": ":cayman_islands:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":cd:", - "replacement": "\ud83d\udcbf" - }, - { - "shortcode": ":central_african_republic:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":chad:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":chains:", - "replacement": "\ud7c9\uded3" - }, - { - "shortcode": ":champagne:", - "replacement": "\ud83c\udf7e" - }, - { - "shortcode": ":chart:", - "replacement": "\ud83d\udcb9" - }, - { - "shortcode": ":chart_with_downwards_trend:", - "replacement": "\ud83d\udcc9" - }, - { - "shortcode": ":chart_with_upwards_trend:", - "replacement": "\ud83d\udcc8" - }, - { - "shortcode": ":checkered_flag:", - "replacement": "\ud83c\udfc1" - }, - { - "shortcode": ":cheese:", - "replacement": "\ud83e\uddc0" - }, - { - "shortcode": ":cherries:", - "replacement": "\ud83c\udf52" - }, - { - "shortcode": ":cherry_blossom:", - "replacement": "\ud83c\udf38" - }, - { - "shortcode": ":chestnut:", - "replacement": "\ud83c\udf30" - }, - { - "shortcode": ":chicken:", - "replacement": "\ud83d\udc14" - }, - { - "shortcode": ":children_crossing:", - "replacement": "\ud83d\udeb8" - }, - { - "shortcode": ":chile:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":chipmunk:", - "replacement": "\ud83d\udc3f" - }, - { - "shortcode": ":chocolate_bar:", - "replacement": "\ud83c\udf6b" - }, - { - "shortcode": ":christmas_island:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":christmas_tree:", - "replacement": "\ud83c\udf84" - }, - { - "shortcode": ":church:", - "replacement": "\ud7c9\udeea" - }, - { - "shortcode": ":cinema:", - "replacement": "\ud83c\udfa6" - }, - { - "shortcode": ":circus_tent:", - "replacement": "\ud83c\udfaa" - }, - { - "shortcode": ":city_sunrise:", - "replacement": "\ud83c\udf07" - }, - { - "shortcode": ":city_sunset:", - "replacement": "\ud83c\udf06" - }, - { - "shortcode": ":cityscape:", - "replacement": "\ud83c\udfd9" - }, - { - "shortcode": ":cl:", - "replacement": "\ud83c\udd91" - }, - { - "shortcode": ":clamp:", - "replacement": "\ud83d\udddc" - }, - { - "shortcode": ":clap:", - "replacement": "\ud83d\udc4f" - }, - { - "shortcode": ":clapper:", - "replacement": "\ud83c\udfac" - }, - { - "shortcode": ":classical_building:", - "replacement": "\ud83c\udfdb" - }, - { - "shortcode": ":clinking_glasses:", - "replacement": "\ud83e\udd42" - }, - { - "shortcode": ":clipboard:", - "replacement": "\ud83d\udccb" - }, - { - "shortcode": ":clock1:", - "replacement": "\ud83d\udd50" - }, - { - "shortcode": ":clock10:", - "replacement": "\ud83d\udd59" - }, - { - "shortcode": ":clock1030:", - "replacement": "\ud83d\udd65" - }, - { - "shortcode": ":clock11:", - "replacement": "\ud83d\udd5a" - }, - { - "shortcode": ":clock1130:", - "replacement": "\ud83d\udd66" - }, - { - "shortcode": ":clock12:", - "replacement": "\ud83d\udd5b" - }, - { - "shortcode": ":clock1230:", - "replacement": "\ud83d\udd67" - }, - { - "shortcode": ":clock130:", - "replacement": "\ud83d\udd5c" - }, - { - "shortcode": ":clock2:", - "replacement": "\ud83d\udd51" - }, - { - "shortcode": ":clock230:", - "replacement": "\ud83d\udd5d" - }, - { - "shortcode": ":clock3:", - "replacement": "\ud83d\udd52" - }, - { - "shortcode": ":clock330:", - "replacement": "\ud83d\udd5e" - }, - { - "shortcode": ":clock4:", - "replacement": "\ud83d\udd53" - }, - { - "shortcode": ":clock430:", - "replacement": "\ud83d\udd5f" - }, - { - "shortcode": ":clock5:", - "replacement": "\ud83d\udd54" - }, - { - "shortcode": ":clock530:", - "replacement": "\ud83d\udd60" - }, - { - "shortcode": ":clock6:", - "replacement": "\ud83d\udd55" - }, - { - "shortcode": ":clock630:", - "replacement": "\ud83d\udd61" - }, - { - "shortcode": ":clock7:", - "replacement": "\ud83d\udd56" - }, - { - "shortcode": ":clock730:", - "replacement": "\ud83d\udd62" - }, - { - "shortcode": ":clock8:", - "replacement": "\ud83d\udd57" - }, - { - "shortcode": ":clock830:", - "replacement": "\ud83d\udd63" - }, - { - "shortcode": ":clock9:", - "replacement": "\ud83d\udd58" - }, - { - "shortcode": ":clock930:", - "replacement": "\ud83d\udd64" - }, - { - "shortcode": ":closed_book:", - "replacement": "\ud83d\udcd5" - }, - { - "shortcode": ":closed_lock_with_key:", - "replacement": "\ud83d\udd10" - }, - { - "shortcode": ":closed_umbrella:", - "replacement": "\ud83c\udf02" - }, - { - "shortcode": ":cloud:", - "replacement": "\ud7c9\ude01" - }, - { - "shortcode": ":cloud_with_lightning:", - "replacement": "\ud83c\udf29" - }, - { - "shortcode": ":cloud_with_lightning_and_rain:", - "replacement": "\ud7c9\udec8" - }, - { - "shortcode": ":cloud_with_rain:", - "replacement": "\ud83c\udf27" - }, - { - "shortcode": ":cloud_with_snow:", - "replacement": "\ud83c\udf28" - }, - { - "shortcode": ":clown_face:", - "replacement": "\ud83e\udd21" - }, - { - "shortcode": ":clubs:", - "replacement": "\ud7c9\ude63" - }, - { - "shortcode": ":cn:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":cocktail:", - "replacement": "\ud83c\udf78" - }, - { - "shortcode": ":cocos_islands:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":coffee:", - "replacement": "\ud7c9\ude15" - }, - { - "shortcode": ":coffin:", - "replacement": "\ud7c9\udeb0" - }, - { - "shortcode": ":cold_sweat:", - "replacement": "\ud83d\ude30" - }, - { - "shortcode": ":collision:", - "replacement": "\ud83d\udca5" - }, - { - "shortcode": ":colombia:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":comet:", - "replacement": "\ud7c9\ude04" - }, - { - "shortcode": ":comoros:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":computer:", - "replacement": "\ud83d\udcbb" - }, - { - "shortcode": ":computer_mouse:", - "replacement": "\ud83d\uddb1" - }, - { - "shortcode": ":confetti_ball:", - "replacement": "\ud83c\udf8a" - }, - { - "shortcode": ":confounded:", - "replacement": "\ud83d\ude16" - }, - { - "shortcode": ":confused:", - "replacement": "\ud83d\ude15" - }, - { - "shortcode": ":congo_brazzaville:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":congo_kinshasa:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":congratulations:", - "replacement": "\ud7cc\ude97" - }, - { - "shortcode": ":construction:", - "replacement": "\ud83d\udea7" - }, - { - "shortcode": ":construction_worker:", - "replacement": "\ud83d\udc77" - }, - { - "shortcode": ":construction_worker_man:", - "replacement": "\ud83d\udc77" - }, - { - "shortcode": ":construction_worker_woman:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":control_knobs:", - "replacement": "\ud83c\udf9b" - }, - { - "shortcode": ":convenience_store:", - "replacement": "\ud83c\udfea" - }, - { - "shortcode": ":cook_islands:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":cookie:", - "replacement": "\ud83c\udf6a" - }, - { - "shortcode": ":cool:", - "replacement": "\ud83c\udd92" - }, - { - "shortcode": ":cop:", - "replacement": "\ud83d\udc6e" - }, - { - "shortcode": ":copyright:", - "replacement": "\ud7c0\udca9" - }, - { - "shortcode": ":corn:", - "replacement": "\ud83c\udf3d" - }, - { - "shortcode": ":costa_rica:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":cote_divoire:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":couch_and_lamp:", - "replacement": "\ud83d\udecb" - }, - { - "shortcode": ":couple:", - "replacement": "\ud83d\udc6b" - }, - { - "shortcode": ":couple_with_heart:", - "replacement": "\ud83d\udc91" - }, - { - "shortcode": ":couple_with_heart_man_man:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":couple_with_heart_woman_man:", - "replacement": "\ud83d\udc91" - }, - { - "shortcode": ":couple_with_heart_woman_woman:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":couplekiss_man_man:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":couplekiss_man_woman:", - "replacement": "\ud83d\udc8f" - }, - { - "shortcode": ":couplekiss_woman_woman:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":cow:", - "replacement": "\ud83d\udc2e" - }, - { - "shortcode": ":cow2:", - "replacement": "\ud83d\udc04" - }, - { - "shortcode": ":cowboy_hat_face:", - "replacement": "\ud83e\udd20" - }, - { - "shortcode": ":crab:", - "replacement": "\ud83e\udd80" - }, - { - "shortcode": ":crayon:", - "replacement": "\ud83d\udd8d" - }, - { - "shortcode": ":credit_card:", - "replacement": "\ud83d\udcb3" - }, - { - "shortcode": ":crescent_moon:", - "replacement": "\ud83c\udf19" - }, - { - "shortcode": ":cricket:", - "replacement": "\ud83c\udfcf" - }, - { - "shortcode": ":croatia:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":crocodile:", - "replacement": "\ud83d\udc0a" - }, - { - "shortcode": ":croissant:", - "replacement": "\ud83e\udd50" - }, - { - "shortcode": ":crossed_fingers:", - "replacement": "\ud83e\udd1e" - }, - { - "shortcode": ":crossed_flags:", - "replacement": "\ud83c\udf8c" - }, - { - "shortcode": ":crossed_swords:", - "replacement": "\ud7c9\ude94" - }, - { - "shortcode": ":crown:", - "replacement": "\ud83d\udc51" - }, - { - "shortcode": ":cry:", - "replacement": "\ud83d\ude22" - }, - { - "shortcode": ":crying_cat_face:", - "replacement": "\ud83d\ude3f" - }, - { - "shortcode": ":crystal_ball:", - "replacement": "\ud83d\udd2e" - }, - { - "shortcode": ":cuba:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":cucumber:", - "replacement": "\ud83e\udd52" - }, - { - "shortcode": ":cupid:", - "replacement": "\ud83d\udc98" - }, - { - "shortcode": ":curacao:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":curly_loop:", - "replacement": "\ud7c9\udfb0" - }, - { - "shortcode": ":currency_exchange:", - "replacement": "\ud83d\udcb1" - }, - { - "shortcode": ":curry:", - "replacement": "\ud83c\udf5b" - }, - { - "shortcode": ":custard:", - "replacement": "\ud83c\udf6e" - }, - { - "shortcode": ":customs:", - "replacement": "\ud83d\udec3" - }, - { - "shortcode": ":cyclone:", - "replacement": "\ud83c\udf00" - }, - { - "shortcode": ":cyprus:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":czech_republic:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":dagger:", - "replacement": "\ud83d\udde1" - }, - { - "shortcode": ":dancer:", - "replacement": "\ud83d\udc83" - }, - { - "shortcode": ":dancers:", - "replacement": "\ud83d\udc6f" - }, - { - "shortcode": ":dancing_men:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":dancing_women:", - "replacement": "\ud83d\udc6f" - }, - { - "shortcode": ":dango:", - "replacement": "\ud83c\udf61" - }, - { - "shortcode": ":dark_sunglasses:", - "replacement": "\ud83d\udd76" - }, - { - "shortcode": ":dart:", - "replacement": "\ud83c\udfaf" - }, - { - "shortcode": ":dash:", - "replacement": "\ud83d\udca8" - }, - { - "shortcode": ":date:", - "replacement": "\ud83d\udcc5" - }, - { - "shortcode": ":de:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":deciduous_tree:", - "replacement": "\ud83c\udf33" - }, - { - "shortcode": ":deer:", - "replacement": "\ud83e\udd8c" - }, - { - "shortcode": ":denmark:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":department_store:", - "replacement": "\ud83c\udfec" - }, - { - "shortcode": ":derelict_house:", - "replacement": "\ud83c\udfda" - }, - { - "shortcode": ":desert:", - "replacement": "\ud83c\udfdc" - }, - { - "shortcode": ":desert_island:", - "replacement": "\ud83c\udfdd" - }, - { - "shortcode": ":desktop_computer:", - "replacement": "\ud83d\udda5" - }, - { - "shortcode": ":detective:", - "replacement": "\ud83d\udd75" - }, - { - "shortcode": ":diamond_shape_with_a_dot_inside:", - "replacement": "\ud83d\udca0" - }, - { - "shortcode": ":diamonds:", - "replacement": "\ud7c9\ude66" - }, - { - "shortcode": ":disappointed:", - "replacement": "\ud83d\ude1e" - }, - { - "shortcode": ":disappointed_relieved:", - "replacement": "\ud83d\ude25" - }, - { - "shortcode": ":dizzy:", - "replacement": "\ud83d\udcab" - }, - { - "shortcode": ":dizzy_face:", - "replacement": "\ud83d\ude35" - }, - { - "shortcode": ":djibouti:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":do_not_litter:", - "replacement": "\ud83d\udeaf" - }, - { - "shortcode": ":dog:", - "replacement": "\ud83d\udc36" - }, - { - "shortcode": ":dog2:", - "replacement": "\ud83d\udc15" - }, - { - "shortcode": ":dollar:", - "replacement": "\ud83d\udcb5" - }, - { - "shortcode": ":dolls:", - "replacement": "\ud83c\udf8e" - }, - { - "shortcode": ":dolphin:", - "replacement": "\ud83d\udc2c" - }, - { - "shortcode": ":dominica:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":dominican_republic:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":door:", - "replacement": "\ud83d\udeaa" - }, - { - "shortcode": ":doughnut:", - "replacement": "\ud83c\udf69" - }, - { - "shortcode": ":dove:", - "replacement": "\ud83d\udd4a" - }, - { - "shortcode": ":dragon:", - "replacement": "\ud83d\udc09" - }, - { - "shortcode": ":dragon_face:", - "replacement": "\ud83d\udc32" - }, - { - "shortcode": ":dress:", - "replacement": "\ud83d\udc57" - }, - { - "shortcode": ":dromedary_camel:", - "replacement": "\ud83d\udc2a" - }, - { - "shortcode": ":drooling_face:", - "replacement": "\ud83e\udd24" - }, - { - "shortcode": ":droplet:", - "replacement": "\ud83d\udca7" - }, - { - "shortcode": ":drum:", - "replacement": "\ud83e\udd41" - }, - { - "shortcode": ":duck:", - "replacement": "\ud83e\udd86" - }, - { - "shortcode": ":dvd:", - "replacement": "\ud83d\udcc0" - }, - { - "shortcode": ":e-mail:", - "replacement": "\ud83d\udce7" - }, - { - "shortcode": ":eagle:", - "replacement": "\ud83e\udd85" - }, - { - "shortcode": ":ear:", - "replacement": "\ud83d\udc42" - }, - { - "shortcode": ":ear_of_rice:", - "replacement": "\ud83c\udf3e" - }, - { - "shortcode": ":earth_africa:", - "replacement": "\ud83c\udf0d" - }, - { - "shortcode": ":earth_americas:", - "replacement": "\ud83c\udf0e" - }, - { - "shortcode": ":earth_asia:", - "replacement": "\ud83c\udf0f" - }, - { - "shortcode": ":ecuador:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":egg:", - "replacement": "\ud83e\udd5a" - }, - { - "shortcode": ":eggplant:", - "replacement": "\ud83c\udf46" - }, - { - "shortcode": ":egypt:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":eight:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":eight_pointed_black_star:", - "replacement": "\ud7c9\udf34" - }, - { - "shortcode": ":eight_spoked_asterisk:", - "replacement": "\ud7c9\udf33" - }, - { - "shortcode": ":el_salvador:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":electric_plug:", - "replacement": "\ud83d\udd0c" - }, - { - "shortcode": ":electron:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":elephant:", - "replacement": "\ud83d\udc18" - }, - { - "shortcode": ":email:", - "replacement": "\ud7c9\udf09" - }, - { - "shortcode": ":end:", - "replacement": "\ud83d\udd1a" - }, - { - "shortcode": ":envelope:", - "replacement": "\ud7c9\udf09" - }, - { - "shortcode": ":envelope_with_arrow:", - "replacement": "\ud83d\udce9" - }, - { - "shortcode": ":equatorial_guinea:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":eritrea:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":es:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":estonia:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":ethiopia:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":eu:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":euro:", - "replacement": "\ud83d\udcb6" - }, - { - "shortcode": ":european_castle:", - "replacement": "\ud83c\udff0" - }, - { - "shortcode": ":european_post_office:", - "replacement": "\ud83c\udfe4" - }, - { - "shortcode": ":european_union:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":evergreen_tree:", - "replacement": "\ud83c\udf32" - }, - { - "shortcode": ":exclamation:", - "replacement": "\ud7c9\udf57" - }, - { - "shortcode": ":expressionless:", - "replacement": "\ud83d\ude11" - }, - { - "shortcode": ":eye:", - "replacement": "\ud83d\udc41" - }, - { - "shortcode": ":eye_speech_bubble:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":eyeglasses:", - "replacement": "\ud83d\udc53" - }, - { - "shortcode": ":eyes:", - "replacement": "\ud83d\udc40" - }, - { - "shortcode": ":face_with_head_bandage:", - "replacement": "\ud83e\udd15" - }, - { - "shortcode": ":face_with_thermometer:", - "replacement": "\ud83e\udd12" - }, - { - "shortcode": ":facepunch:", - "replacement": "\ud83d\udc4a" - }, - { - "shortcode": ":factory:", - "replacement": "\ud83c\udfed" - }, - { - "shortcode": ":falkland_islands:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":fallen_leaf:", - "replacement": "\ud83c\udf42" - }, - { - "shortcode": ":family:", - "replacement": "\ud83d\udc6a" - }, - { - "shortcode": ":family_man_boy:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":family_man_boy_boy:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":family_man_girl:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":family_man_girl_boy:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":family_man_girl_girl:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":family_man_man_boy:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":family_man_man_boy_boy:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":family_man_man_girl:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":family_man_man_girl_boy:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":family_man_man_girl_girl:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":family_man_woman_boy:", - "replacement": "\ud83d\udc6a" - }, - { - "shortcode": ":family_man_woman_boy_boy:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":family_man_woman_girl:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":family_man_woman_girl_boy:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":family_man_woman_girl_girl:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":family_woman_boy:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":family_woman_boy_boy:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":family_woman_girl:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":family_woman_girl_boy:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":family_woman_girl_girl:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":family_woman_woman_boy:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":family_woman_woman_boy_boy:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":family_woman_woman_girl:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":family_woman_woman_girl_boy:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":family_woman_woman_girl_girl:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":faroe_islands:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":fast_forward:", - "replacement": "\ud7c8\udfe9" - }, - { - "shortcode": ":fax:", - "replacement": "\ud83d\udce0" - }, - { - "shortcode": ":fearful:", - "replacement": "\ud83d\ude28" - }, - { - "shortcode": ":feelsgood:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":feet:", - "replacement": "\ud83d\udc3e" - }, - { - "shortcode": ":female_detective:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":ferris_wheel:", - "replacement": "\ud83c\udfa1" - }, - { - "shortcode": ":ferry:", - "replacement": "\ud7c9\udef4" - }, - { - "shortcode": ":field_hockey:", - "replacement": "\ud83c\udfd1" - }, - { - "shortcode": ":fiji:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":file_cabinet:", - "replacement": "\ud83d\uddc4" - }, - { - "shortcode": ":file_folder:", - "replacement": "\ud83d\udcc1" - }, - { - "shortcode": ":film_projector:", - "replacement": "\ud83d\udcfd" - }, - { - "shortcode": ":film_strip:", - "replacement": "\ud83c\udf9e" - }, - { - "shortcode": ":finland:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":finnadie:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":fire:", - "replacement": "\ud83d\udd25" - }, - { - "shortcode": ":fire_engine:", - "replacement": "\ud83d\ude92" - }, - { - "shortcode": ":fireworks:", - "replacement": "\ud83c\udf86" - }, - { - "shortcode": ":first_quarter_moon:", - "replacement": "\ud83c\udf13" - }, - { - "shortcode": ":first_quarter_moon_with_face:", - "replacement": "\ud83c\udf1b" - }, - { - "shortcode": ":fish:", - "replacement": "\ud83d\udc1f" - }, - { - "shortcode": ":fish_cake:", - "replacement": "\ud83c\udf65" - }, - { - "shortcode": ":fishing_pole_and_fish:", - "replacement": "\ud83c\udfa3" - }, - { - "shortcode": ":fist:", - "replacement": "\ud7c9\udf0a" - }, - { - "shortcode": ":fist_left:", - "replacement": "\ud83e\udd1b" - }, - { - "shortcode": ":fist_oncoming:", - "replacement": "\ud83d\udc4a" - }, - { - "shortcode": ":fist_raised:", - "replacement": "\ud7c9\udf0a" - }, - { - "shortcode": ":fist_right:", - "replacement": "\ud83e\udd1c" - }, - { - "shortcode": ":five:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":flags:", - "replacement": "\ud83c\udf8f" - }, - { - "shortcode": ":flashlight:", - "replacement": "\ud83d\udd26" - }, - { - "shortcode": ":fleur_de_lis:", - "replacement": "\ud7c9\ude9c" - }, - { - "shortcode": ":flight_arrival:", - "replacement": "\ud83d\udeec" - }, - { - "shortcode": ":flight_departure:", - "replacement": "\ud83d\udeeb" - }, - { - "shortcode": ":flipper:", - "replacement": "\ud83d\udc2c" - }, - { - "shortcode": ":floppy_disk:", - "replacement": "\ud83d\udcbe" - }, - { - "shortcode": ":flower_playing_cards:", - "replacement": "\ud83c\udfb4" - }, - { - "shortcode": ":flushed:", - "replacement": "\ud83d\ude33" - }, - { - "shortcode": ":fog:", - "replacement": "\ud83c\udf2b" - }, - { - "shortcode": ":foggy:", - "replacement": "\ud83c\udf01" - }, - { - "shortcode": ":football:", - "replacement": "\ud83c\udfc8" - }, - { - "shortcode": ":footprints:", - "replacement": "\ud83d\udc63" - }, - { - "shortcode": ":fork_and_knife:", - "replacement": "\ud83c\udf74" - }, - { - "shortcode": ":fountain:", - "replacement": "\ud7c9\udef2" - }, - { - "shortcode": ":fountain_pen:", - "replacement": "\ud83d\udd8b" - }, - { - "shortcode": ":four:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":four_leaf_clover:", - "replacement": "\ud83c\udf40" - }, - { - "shortcode": ":fox_face:", - "replacement": "\ud83e\udd8a" - }, - { - "shortcode": ":fr:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":framed_picture:", - "replacement": "\ud83d\uddbc" - }, - { - "shortcode": ":free:", - "replacement": "\ud83c\udd93" - }, - { - "shortcode": ":french_guiana:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":french_polynesia:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":french_southern_territories:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":fried_egg:", - "replacement": "\ud83c\udf73" - }, - { - "shortcode": ":fried_shrimp:", - "replacement": "\ud83c\udf64" - }, - { - "shortcode": ":fries:", - "replacement": "\ud83c\udf5f" - }, - { - "shortcode": ":frog:", - "replacement": "\ud83d\udc38" - }, - { - "shortcode": ":frowning:", - "replacement": "\ud83d\ude26" - }, - { - "shortcode": ":frowning_face:", - "replacement": "\ud7c9\ude39" - }, - { - "shortcode": ":frowning_man:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":frowning_woman:", - "replacement": "\ud83d\ude4d" - }, - { - "shortcode": ":fu:", - "replacement": "\ud83d\udd95" - }, - { - "shortcode": ":fuelpump:", - "replacement": "\ud7c9\udefd" - }, - { - "shortcode": ":full_moon:", - "replacement": "\ud83c\udf15" - }, - { - "shortcode": ":full_moon_with_face:", - "replacement": "\ud83c\udf1d" - }, - { - "shortcode": ":funeral_urn:", - "replacement": "\ud7c9\udeb1" - }, - { - "shortcode": ":gabon:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":gambia:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":game_die:", - "replacement": "\ud83c\udfb2" - }, - { - "shortcode": ":gb:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":gear:", - "replacement": "\ud7c9\ude99" - }, - { - "shortcode": ":gem:", - "replacement": "\ud83d\udc8e" - }, - { - "shortcode": ":gemini:", - "replacement": "\ud7c9\ude4a" - }, - { - "shortcode": ":georgia:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":ghana:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":ghost:", - "replacement": "\ud83d\udc7b" - }, - { - "shortcode": ":gibraltar:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":gift:", - "replacement": "\ud83c\udf81" - }, - { - "shortcode": ":gift_heart:", - "replacement": "\ud83d\udc9d" - }, - { - "shortcode": ":girl:", - "replacement": "\ud83d\udc67" - }, - { - "shortcode": ":globe_with_meridians:", - "replacement": "\ud83c\udf10" - }, - { - "shortcode": ":goal_net:", - "replacement": "\ud83e\udd45" - }, - { - "shortcode": ":goat:", - "replacement": "\ud83d\udc10" - }, - { - "shortcode": ":goberserk:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":godmode:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":golf:", - "replacement": "\ud7c9\udef3" - }, - { - "shortcode": ":golfing_man:", - "replacement": "\ud83c\udfcc" - }, - { - "shortcode": ":golfing_woman:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":gorilla:", - "replacement": "\ud83e\udd8d" - }, - { - "shortcode": ":grapes:", - "replacement": "\ud83c\udf47" - }, - { - "shortcode": ":greece:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":green_apple:", - "replacement": "\ud83c\udf4f" - }, - { - "shortcode": ":green_book:", - "replacement": "\ud83d\udcd7" - }, - { - "shortcode": ":green_heart:", - "replacement": "\ud83d\udc9a" - }, - { - "shortcode": ":green_salad:", - "replacement": "\ud83e\udd57" - }, - { - "shortcode": ":greenland:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":grenada:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":grey_exclamation:", - "replacement": "\ud7c9\udf55" - }, - { - "shortcode": ":grey_question:", - "replacement": "\ud7c9\udf54" - }, - { - "shortcode": ":grimacing:", - "replacement": "\ud83d\ude2c" - }, - { - "shortcode": ":grin:", - "replacement": "\ud83d\ude01" - }, - { - "shortcode": ":grinning:", - "replacement": "\ud83d\ude00" - }, - { - "shortcode": ":guadeloupe:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":guam:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":guardsman:", - "replacement": "\ud83d\udc82" - }, - { - "shortcode": ":guardswoman:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":guatemala:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":guernsey:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":guinea:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":guinea_bissau:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":guitar:", - "replacement": "\ud83c\udfb8" - }, - { - "shortcode": ":gun:", - "replacement": "\ud83d\udd2b" - }, - { - "shortcode": ":guyana:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":haircut:", - "replacement": "\ud83d\udc87" - }, - { - "shortcode": ":haircut_man:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":haircut_woman:", - "replacement": "\ud83d\udc87" - }, - { - "shortcode": ":haiti:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":hamburger:", - "replacement": "\ud83c\udf54" - }, - { - "shortcode": ":hammer:", - "replacement": "\ud83d\udd28" - }, - { - "shortcode": ":hammer_and_pick:", - "replacement": "\ud7c9\ude92" - }, - { - "shortcode": ":hammer_and_wrench:", - "replacement": "\ud83d\udee0" - }, - { - "shortcode": ":hamster:", - "replacement": "\ud83d\udc39" - }, - { - "shortcode": ":hand:", - "replacement": "\ud7c9\udf0b" - }, - { - "shortcode": ":handbag:", - "replacement": "\ud83d\udc5c" - }, - { - "shortcode": ":handshake:", - "replacement": "\ud83e\udd1d" - }, - { - "shortcode": ":hankey:", - "replacement": "\ud83d\udca9" - }, - { - "shortcode": ":hash:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":hatched_chick:", - "replacement": "\ud83d\udc25" - }, - { - "shortcode": ":hatching_chick:", - "replacement": "\ud83d\udc23" - }, - { - "shortcode": ":headphones:", - "replacement": "\ud83c\udfa7" - }, - { - "shortcode": ":hear_no_evil:", - "replacement": "\ud83d\ude49" - }, - { - "shortcode": ":heart:", - "replacement": "\ud7c9\udf64" - }, - { - "shortcode": ":heart_decoration:", - "replacement": "\ud83d\udc9f" - }, - { - "shortcode": ":heart_eyes:", - "replacement": "\ud83d\ude0d" - }, - { - "shortcode": ":heart_eyes_cat:", - "replacement": "\ud83d\ude3b" - }, - { - "shortcode": ":heartbeat:", - "replacement": "\ud83d\udc93" - }, - { - "shortcode": ":heartpulse:", - "replacement": "\ud83d\udc97" - }, - { - "shortcode": ":hearts:", - "replacement": "\ud7c9\ude65" - }, - { - "shortcode": ":heavy_check_mark:", - "replacement": "\ud7c9\udf14" - }, - { - "shortcode": ":heavy_division_sign:", - "replacement": "\ud7c9\udf97" - }, - { - "shortcode": ":heavy_dollar_sign:", - "replacement": "\ud83d\udcb2" - }, - { - "shortcode": ":heavy_exclamation_mark:", - "replacement": "\ud7c9\udf57" - }, - { - "shortcode": ":heavy_heart_exclamation:", - "replacement": "\ud7c9\udf63" - }, - { - "shortcode": ":heavy_minus_sign:", - "replacement": "\ud7c9\udf96" - }, - { - "shortcode": ":heavy_multiplication_x:", - "replacement": "\ud7c9\udf16" - }, - { - "shortcode": ":heavy_plus_sign:", - "replacement": "\ud7c9\udf95" - }, - { - "shortcode": ":helicopter:", - "replacement": "\ud83d\ude81" - }, - { - "shortcode": ":herb:", - "replacement": "\ud83c\udf3f" - }, - { - "shortcode": ":hibiscus:", - "replacement": "\ud83c\udf3a" - }, - { - "shortcode": ":high_brightness:", - "replacement": "\ud83d\udd06" - }, - { - "shortcode": ":high_heel:", - "replacement": "\ud83d\udc60" - }, - { - "shortcode": ":hocho:", - "replacement": "\ud83d\udd2a" - }, - { - "shortcode": ":hole:", - "replacement": "\ud83d\udd73" - }, - { - "shortcode": ":honduras:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":honey_pot:", - "replacement": "\ud83c\udf6f" - }, - { - "shortcode": ":honeybee:", - "replacement": "\ud83d\udc1d" - }, - { - "shortcode": ":hong_kong:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":horse:", - "replacement": "\ud83d\udc34" - }, - { - "shortcode": ":horse_racing:", - "replacement": "\ud83c\udfc7" - }, - { - "shortcode": ":hospital:", - "replacement": "\ud83c\udfe5" - }, - { - "shortcode": ":hot_pepper:", - "replacement": "\ud83c\udf36" - }, - { - "shortcode": ":hotdog:", - "replacement": "\ud83c\udf2d" - }, - { - "shortcode": ":hotel:", - "replacement": "\ud83c\udfe8" - }, - { - "shortcode": ":hotsprings:", - "replacement": "\ud7c9\ude68" - }, - { - "shortcode": ":hourglass:", - "replacement": "\ud7c8\udf1b" - }, - { - "shortcode": ":hourglass_flowing_sand:", - "replacement": "\ud7c8\udff3" - }, - { - "shortcode": ":house:", - "replacement": "\ud83c\udfe0" - }, - { - "shortcode": ":house_with_garden:", - "replacement": "\ud83c\udfe1" - }, - { - "shortcode": ":houses:", - "replacement": "\ud83c\udfd8" - }, - { - "shortcode": ":hugs:", - "replacement": "\ud83e\udd17" - }, - { - "shortcode": ":hungary:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":hurtrealbad:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":hushed:", - "replacement": "\ud83d\ude2f" - }, - { - "shortcode": ":ice_cream:", - "replacement": "\ud83c\udf68" - }, - { - "shortcode": ":ice_hockey:", - "replacement": "\ud83c\udfd2" - }, - { - "shortcode": ":ice_skate:", - "replacement": "\ud7c9\udef8" - }, - { - "shortcode": ":icecream:", - "replacement": "\ud83c\udf66" - }, - { - "shortcode": ":iceland:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":id:", - "replacement": "\ud83c\udd94" - }, - { - "shortcode": ":ideograph_advantage:", - "replacement": "\ud83c\ude50" - }, - { - "shortcode": ":imp:", - "replacement": "\ud83d\udc7f" - }, - { - "shortcode": ":inbox_tray:", - "replacement": "\ud83d\udce5" - }, - { - "shortcode": ":incoming_envelope:", - "replacement": "\ud83d\udce8" - }, - { - "shortcode": ":india:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":indonesia:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":information_desk_person:", - "replacement": "\ud83d\udc81" - }, - { - "shortcode": ":information_source:", - "replacement": "\ud7c8\udd39" - }, - { - "shortcode": ":innocent:", - "replacement": "\ud83d\ude07" - }, - { - "shortcode": ":interrobang:", - "replacement": "\ud7c8\udc49" - }, - { - "shortcode": ":iphone:", - "replacement": "\ud83d\udcf1" - }, - { - "shortcode": ":iran:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":iraq:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":ireland:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":isle_of_man:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":israel:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":it:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":izakaya_lantern:", - "replacement": "\ud83c\udfee" - }, - { - "shortcode": ":jack_o_lantern:", - "replacement": "\ud83c\udf83" - }, - { - "shortcode": ":jamaica:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":japan:", - "replacement": "\ud83d\uddfe" - }, - { - "shortcode": ":japanese_castle:", - "replacement": "\ud83c\udfef" - }, - { - "shortcode": ":japanese_goblin:", - "replacement": "\ud83d\udc7a" - }, - { - "shortcode": ":japanese_ogre:", - "replacement": "\ud83d\udc79" - }, - { - "shortcode": ":jeans:", - "replacement": "\ud83d\udc56" - }, - { - "shortcode": ":jersey:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":jordan:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":joy:", - "replacement": "\ud83d\ude02" - }, - { - "shortcode": ":joy_cat:", - "replacement": "\ud83d\ude39" - }, - { - "shortcode": ":joystick:", - "replacement": "\ud83d\udd79" - }, - { - "shortcode": ":jp:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":kaaba:", - "replacement": "\ud83d\udd4b" - }, - { - "shortcode": ":kazakhstan:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":kenya:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":key:", - "replacement": "\ud83d\udd11" - }, - { - "shortcode": ":keyboard:", - "replacement": "\ud7c8\udf28" - }, - { - "shortcode": ":keycap_ten:", - "replacement": "\ud83d\udd1f" - }, - { - "shortcode": ":kick_scooter:", - "replacement": "\ud83d\udef4" - }, - { - "shortcode": ":kimono:", - "replacement": "\ud83d\udc58" - }, - { - "shortcode": ":kiribati:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":kiss:", - "replacement": "\ud83d\udc8b" - }, - { - "shortcode": ":kissing:", - "replacement": "\ud83d\ude17" - }, - { - "shortcode": ":kissing_cat:", - "replacement": "\ud83d\ude3d" - }, - { - "shortcode": ":kissing_closed_eyes:", - "replacement": "\ud83d\ude1a" - }, - { - "shortcode": ":kissing_heart:", - "replacement": "\ud83d\ude18" - }, - { - "shortcode": ":kissing_smiling_eyes:", - "replacement": "\ud83d\ude19" - }, - { - "shortcode": ":kiwi_fruit:", - "replacement": "\ud83e\udd5d" - }, - { - "shortcode": ":knife:", - "replacement": "\ud83d\udd2a" - }, - { - "shortcode": ":koala:", - "replacement": "\ud83d\udc28" - }, - { - "shortcode": ":koko:", - "replacement": "\ud83c\ude01" - }, - { - "shortcode": ":kosovo:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":kr:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":kuwait:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":kyrgyzstan:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":label:", - "replacement": "\ud83c\udff7" - }, - { - "shortcode": ":lantern:", - "replacement": "\ud83c\udfee" - }, - { - "shortcode": ":laos:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":large_blue_circle:", - "replacement": "\ud83d\udd35" - }, - { - "shortcode": ":large_blue_diamond:", - "replacement": "\ud83d\udd37" - }, - { - "shortcode": ":large_orange_diamond:", - "replacement": "\ud83d\udd36" - }, - { - "shortcode": ":last_quarter_moon:", - "replacement": "\ud83c\udf17" - }, - { - "shortcode": ":last_quarter_moon_with_face:", - "replacement": "\ud83c\udf1c" - }, - { - "shortcode": ":latin_cross:", - "replacement": "\ud7c9\udf1d" - }, - { - "shortcode": ":latvia:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":laughing:", - "replacement": "\ud83d\ude06" - }, - { - "shortcode": ":leaves:", - "replacement": "\ud83c\udf43" - }, - { - "shortcode": ":lebanon:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":ledger:", - "replacement": "\ud83d\udcd2" - }, - { - "shortcode": ":left_luggage:", - "replacement": "\ud83d\udec5" - }, - { - "shortcode": ":left_right_arrow:", - "replacement": "\ud7c8\udd94" - }, - { - "shortcode": ":leftwards_arrow_with_hook:", - "replacement": "\ud7c8\udda9" - }, - { - "shortcode": ":lemon:", - "replacement": "\ud83c\udf4b" - }, - { - "shortcode": ":leo:", - "replacement": "\ud7c9\ude4c" - }, - { - "shortcode": ":leopard:", - "replacement": "\ud83d\udc06" - }, - { - "shortcode": ":lesotho:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":level_slider:", - "replacement": "\ud83c\udf9a" - }, - { - "shortcode": ":liberia:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":libra:", - "replacement": "\ud7c9\ude4e" - }, - { - "shortcode": ":libya:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":liechtenstein:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":light_rail:", - "replacement": "\ud83d\ude88" - }, - { - "shortcode": ":link:", - "replacement": "\ud83d\udd17" - }, - { - "shortcode": ":lion:", - "replacement": "\ud83e\udd81" - }, - { - "shortcode": ":lips:", - "replacement": "\ud83d\udc44" - }, - { - "shortcode": ":lipstick:", - "replacement": "\ud83d\udc84" - }, - { - "shortcode": ":lithuania:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":lizard:", - "replacement": "\ud83e\udd8e" - }, - { - "shortcode": ":lock:", - "replacement": "\ud83d\udd12" - }, - { - "shortcode": ":lock_with_ink_pen:", - "replacement": "\ud83d\udd0f" - }, - { - "shortcode": ":lollipop:", - "replacement": "\ud83c\udf6d" - }, - { - "shortcode": ":loop:", - "replacement": "\ud7c9\udfbf" - }, - { - "shortcode": ":loud_sound:", - "replacement": "\ud83d\udd0a" - }, - { - "shortcode": ":loudspeaker:", - "replacement": "\ud83d\udce2" - }, - { - "shortcode": ":love_hotel:", - "replacement": "\ud83c\udfe9" - }, - { - "shortcode": ":love_letter:", - "replacement": "\ud83d\udc8c" - }, - { - "shortcode": ":low_brightness:", - "replacement": "\ud83d\udd05" - }, - { - "shortcode": ":luxembourg:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":lying_face:", - "replacement": "\ud83e\udd25" - }, - { - "shortcode": ":m:", - "replacement": "\ud7c9\udcc2" - }, - { - "shortcode": ":macau:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":macedonia:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":madagascar:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":mag:", - "replacement": "\ud83d\udd0d" - }, - { - "shortcode": ":mag_right:", - "replacement": "\ud83d\udd0e" - }, - { - "shortcode": ":mahjong:", - "replacement": "\ud83c\udc04" - }, - { - "shortcode": ":mailbox:", - "replacement": "\ud83d\udceb" - }, - { - "shortcode": ":mailbox_closed:", - "replacement": "\ud83d\udcea" - }, - { - "shortcode": ":mailbox_with_mail:", - "replacement": "\ud83d\udcec" - }, - { - "shortcode": ":mailbox_with_no_mail:", - "replacement": "\ud83d\udced" - }, - { - "shortcode": ":malawi:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":malaysia:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":maldives:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":male_detective:", - "replacement": "\ud83d\udd75" - }, - { - "shortcode": ":mali:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":malta:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":man:", - "replacement": "\ud83d\udc68" - }, - { - "shortcode": ":man_artist:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":man_astronaut:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":man_cartwheeling:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":man_cook:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":man_dancing:", - "replacement": "\ud83d\udd7a" - }, - { - "shortcode": ":man_facepalming:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":man_factory_worker:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":man_farmer:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":man_firefighter:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":man_health_worker:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":man_in_tuxedo:", - "replacement": "\ud83e\udd35" - }, - { - "shortcode": ":man_judge:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":man_juggling:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":man_mechanic:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":man_office_worker:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":man_pilot:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":man_playing_handball:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":man_playing_water_polo:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":man_scientist:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":man_shrugging:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":man_singer:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":man_student:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":man_teacher:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":man_technologist:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":man_with_gua_pi_mao:", - "replacement": "\ud83d\udc72" - }, - { - "shortcode": ":man_with_turban:", - "replacement": "\ud83d\udc73" - }, - { - "shortcode": ":mandarin:", - "replacement": "\ud83c\udf4a" - }, - { - "shortcode": ":mans_shoe:", - "replacement": "\ud83d\udc5e" - }, - { - "shortcode": ":mantelpiece_clock:", - "replacement": "\ud83d\udd70" - }, - { - "shortcode": ":maple_leaf:", - "replacement": "\ud83c\udf41" - }, - { - "shortcode": ":marshall_islands:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":martial_arts_uniform:", - "replacement": "\ud83e\udd4b" - }, - { - "shortcode": ":martinique:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":mask:", - "replacement": "\ud83d\ude37" - }, - { - "shortcode": ":massage:", - "replacement": "\ud83d\udc86" - }, - { - "shortcode": ":massage_man:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":massage_woman:", - "replacement": "\ud83d\udc86" - }, - { - "shortcode": ":mauritania:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":mauritius:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":mayotte:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":meat_on_bone:", - "replacement": "\ud83c\udf56" - }, - { - "shortcode": ":medal_military:", - "replacement": "\ud83c\udf96" - }, - { - "shortcode": ":medal_sports:", - "replacement": "\ud83c\udfc5" - }, - { - "shortcode": ":mega:", - "replacement": "\ud83d\udce3" - }, - { - "shortcode": ":melon:", - "replacement": "\ud83c\udf48" - }, - { - "shortcode": ":memo:", - "replacement": "\ud83d\udcdd" - }, - { - "shortcode": ":men_wrestling:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":menorah:", - "replacement": "\ud83d\udd4e" - }, - { - "shortcode": ":mens:", - "replacement": "\ud83d\udeb9" - }, - { - "shortcode": ":metal:", - "replacement": "\ud83e\udd18" - }, - { - "shortcode": ":metro:", - "replacement": "\ud83d\ude87" - }, - { - "shortcode": ":mexico:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":micronesia:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":microphone:", - "replacement": "\ud83c\udfa4" - }, - { - "shortcode": ":microscope:", - "replacement": "\ud83d\udd2c" - }, - { - "shortcode": ":middle_finger:", - "replacement": "\ud83d\udd95" - }, - { - "shortcode": ":milk_glass:", - "replacement": "\ud83e\udd5b" - }, - { - "shortcode": ":milky_way:", - "replacement": "\ud83c\udf0c" - }, - { - "shortcode": ":minibus:", - "replacement": "\ud83d\ude90" - }, - { - "shortcode": ":minidisc:", - "replacement": "\ud83d\udcbd" - }, - { - "shortcode": ":mobile_phone_off:", - "replacement": "\ud83d\udcf4" - }, - { - "shortcode": ":moldova:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":monaco:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":money_mouth_face:", - "replacement": "\ud83e\udd11" - }, - { - "shortcode": ":money_with_wings:", - "replacement": "\ud83d\udcb8" - }, - { - "shortcode": ":moneybag:", - "replacement": "\ud83d\udcb0" - }, - { - "shortcode": ":mongolia:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":monkey:", - "replacement": "\ud83d\udc12" - }, - { - "shortcode": ":monkey_face:", - "replacement": "\ud83d\udc35" - }, - { - "shortcode": ":monorail:", - "replacement": "\ud83d\ude9d" - }, - { - "shortcode": ":montenegro:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":montserrat:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":moon:", - "replacement": "\ud83c\udf14" - }, - { - "shortcode": ":morocco:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":mortar_board:", - "replacement": "\ud83c\udf93" - }, - { - "shortcode": ":mosque:", - "replacement": "\ud83d\udd4c" - }, - { - "shortcode": ":motor_boat:", - "replacement": "\ud83d\udee5" - }, - { - "shortcode": ":motor_scooter:", - "replacement": "\ud83d\udef5" - }, - { - "shortcode": ":motorcycle:", - "replacement": "\ud83c\udfcd" - }, - { - "shortcode": ":motorway:", - "replacement": "\ud83d\udee3" - }, - { - "shortcode": ":mount_fuji:", - "replacement": "\ud83d\uddfb" - }, - { - "shortcode": ":mountain:", - "replacement": "\ud7c9\udef0" - }, - { - "shortcode": ":mountain_bicyclist:", - "replacement": "\ud83d\udeb5" - }, - { - "shortcode": ":mountain_biking_man:", - "replacement": "\ud83d\udeb5" - }, - { - "shortcode": ":mountain_biking_woman:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":mountain_cableway:", - "replacement": "\ud83d\udea0" - }, - { - "shortcode": ":mountain_railway:", - "replacement": "\ud83d\ude9e" - }, - { - "shortcode": ":mountain_snow:", - "replacement": "\ud83c\udfd4" - }, - { - "shortcode": ":mouse:", - "replacement": "\ud83d\udc2d" - }, - { - "shortcode": ":mouse2:", - "replacement": "\ud83d\udc01" - }, - { - "shortcode": ":movie_camera:", - "replacement": "\ud83c\udfa5" - }, - { - "shortcode": ":moyai:", - "replacement": "\ud83d\uddff" - }, - { - "shortcode": ":mozambique:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":mrs_claus:", - "replacement": "\ud83e\udd36" - }, - { - "shortcode": ":muscle:", - "replacement": "\ud83d\udcaa" - }, - { - "shortcode": ":mushroom:", - "replacement": "\ud83c\udf44" - }, - { - "shortcode": ":musical_keyboard:", - "replacement": "\ud83c\udfb9" - }, - { - "shortcode": ":musical_note:", - "replacement": "\ud83c\udfb5" - }, - { - "shortcode": ":musical_score:", - "replacement": "\ud83c\udfbc" - }, - { - "shortcode": ":mute:", - "replacement": "\ud83d\udd07" - }, - { - "shortcode": ":myanmar:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":nail_care:", - "replacement": "\ud83d\udc85" - }, - { - "shortcode": ":name_badge:", - "replacement": "\ud83d\udcdb" - }, - { - "shortcode": ":namibia:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":national_park:", - "replacement": "\ud83c\udfde" - }, - { - "shortcode": ":nauru:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":nauseated_face:", - "replacement": "\ud83e\udd22" - }, - { - "shortcode": ":neckbeard:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":necktie:", - "replacement": "\ud83d\udc54" - }, - { - "shortcode": ":negative_squared_cross_mark:", - "replacement": "\ud7c9\udf4e" - }, - { - "shortcode": ":nepal:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":nerd_face:", - "replacement": "\ud83e\udd13" - }, - { - "shortcode": ":netherlands:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":neutral_face:", - "replacement": "\ud83d\ude10" - }, - { - "shortcode": ":new:", - "replacement": "\ud83c\udd95" - }, - { - "shortcode": ":new_caledonia:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":new_moon:", - "replacement": "\ud83c\udf11" - }, - { - "shortcode": ":new_moon_with_face:", - "replacement": "\ud83c\udf1a" - }, - { - "shortcode": ":new_zealand:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":newspaper:", - "replacement": "\ud83d\udcf0" - }, - { - "shortcode": ":newspaper_roll:", - "replacement": "\ud83d\uddde" - }, - { - "shortcode": ":next_track_button:", - "replacement": "\ud7c8\udfed" - }, - { - "shortcode": ":ng:", - "replacement": "\ud83c\udd96" - }, - { - "shortcode": ":ng_man:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":ng_woman:", - "replacement": "\ud83d\ude45" - }, - { - "shortcode": ":nicaragua:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":niger:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":nigeria:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":night_with_stars:", - "replacement": "\ud83c\udf03" - }, - { - "shortcode": ":nine:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":niue:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":no_bell:", - "replacement": "\ud83d\udd15" - }, - { - "shortcode": ":no_bicycles:", - "replacement": "\ud83d\udeb3" - }, - { - "shortcode": ":no_entry:", - "replacement": "\ud7c9\uded4" - }, - { - "shortcode": ":no_entry_sign:", - "replacement": "\ud83d\udeab" - }, - { - "shortcode": ":no_good:", - "replacement": "\ud83d\ude45" - }, - { - "shortcode": ":no_good_man:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":no_good_woman:", - "replacement": "\ud83d\ude45" - }, - { - "shortcode": ":no_mobile_phones:", - "replacement": "\ud83d\udcf5" - }, - { - "shortcode": ":no_mouth:", - "replacement": "\ud83d\ude36" - }, - { - "shortcode": ":no_pedestrians:", - "replacement": "\ud83d\udeb7" - }, - { - "shortcode": ":no_smoking:", - "replacement": "\ud83d\udead" - }, - { - "shortcode": ":non-potable_water:", - "replacement": "\ud83d\udeb1" - }, - { - "shortcode": ":norfolk_island:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":north_korea:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":northern_mariana_islands:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":norway:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":nose:", - "replacement": "\ud83d\udc43" - }, - { - "shortcode": ":notebook:", - "replacement": "\ud83d\udcd3" - }, - { - "shortcode": ":notebook_with_decorative_cover:", - "replacement": "\ud83d\udcd4" - }, - { - "shortcode": ":notes:", - "replacement": "\ud83c\udfb6" - }, - { - "shortcode": ":nut_and_bolt:", - "replacement": "\ud83d\udd29" - }, - { - "shortcode": ":o:", - "replacement": "\ud7ca\udf55" - }, - { - "shortcode": ":o2:", - "replacement": "\ud83c\udd7e" - }, - { - "shortcode": ":ocean:", - "replacement": "\ud83c\udf0a" - }, - { - "shortcode": ":octocat:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":octopus:", - "replacement": "\ud83d\udc19" - }, - { - "shortcode": ":oden:", - "replacement": "\ud83c\udf62" - }, - { - "shortcode": ":office:", - "replacement": "\ud83c\udfe2" - }, - { - "shortcode": ":oil_drum:", - "replacement": "\ud83d\udee2" - }, - { - "shortcode": ":ok:", - "replacement": "\ud83c\udd97" - }, - { - "shortcode": ":ok_hand:", - "replacement": "\ud83d\udc4c" - }, - { - "shortcode": ":ok_man:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":ok_woman:", - "replacement": "\ud83d\ude46" - }, - { - "shortcode": ":old_key:", - "replacement": "\ud83d\udddd" - }, - { - "shortcode": ":older_man:", - "replacement": "\ud83d\udc74" - }, - { - "shortcode": ":older_woman:", - "replacement": "\ud83d\udc75" - }, - { - "shortcode": ":om:", - "replacement": "\ud83d\udd49" - }, - { - "shortcode": ":oman:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":on:", - "replacement": "\ud83d\udd1b" - }, - { - "shortcode": ":oncoming_automobile:", - "replacement": "\ud83d\ude98" - }, - { - "shortcode": ":oncoming_bus:", - "replacement": "\ud83d\ude8d" - }, - { - "shortcode": ":oncoming_police_car:", - "replacement": "\ud83d\ude94" - }, - { - "shortcode": ":oncoming_taxi:", - "replacement": "\ud83d\ude96" - }, - { - "shortcode": ":one:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":open_book:", - "replacement": "\ud83d\udcd6" - }, - { - "shortcode": ":open_file_folder:", - "replacement": "\ud83d\udcc2" - }, - { - "shortcode": ":open_hands:", - "replacement": "\ud83d\udc50" - }, - { - "shortcode": ":open_mouth:", - "replacement": "\ud83d\ude2e" - }, - { - "shortcode": ":open_umbrella:", - "replacement": "\ud7c9\ude02" - }, - { - "shortcode": ":ophiuchus:", - "replacement": "\ud7c9\udece" - }, - { - "shortcode": ":orange:", - "replacement": "\ud83c\udf4a" - }, - { - "shortcode": ":orange_book:", - "replacement": "\ud83d\udcd9" - }, - { - "shortcode": ":orthodox_cross:", - "replacement": "\ud7c9\ude26" - }, - { - "shortcode": ":outbox_tray:", - "replacement": "\ud83d\udce4" - }, - { - "shortcode": ":owl:", - "replacement": "\ud83e\udd89" - }, - { - "shortcode": ":ox:", - "replacement": "\ud83d\udc02" - }, - { - "shortcode": ":package:", - "replacement": "\ud83d\udce6" - }, - { - "shortcode": ":page_facing_up:", - "replacement": "\ud83d\udcc4" - }, - { - "shortcode": ":page_with_curl:", - "replacement": "\ud83d\udcc3" - }, - { - "shortcode": ":pager:", - "replacement": "\ud83d\udcdf" - }, - { - "shortcode": ":paintbrush:", - "replacement": "\ud83d\udd8c" - }, - { - "shortcode": ":pakistan:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":palau:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":palestinian_territories:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":palm_tree:", - "replacement": "\ud83c\udf34" - }, - { - "shortcode": ":panama:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":pancakes:", - "replacement": "\ud83e\udd5e" - }, - { - "shortcode": ":panda_face:", - "replacement": "\ud83d\udc3c" - }, - { - "shortcode": ":paperclip:", - "replacement": "\ud83d\udcce" - }, - { - "shortcode": ":paperclips:", - "replacement": "\ud83d\udd87" - }, - { - "shortcode": ":papua_new_guinea:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":paraguay:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":parasol_on_ground:", - "replacement": "\ud7c9\udef1" - }, - { - "shortcode": ":parking:", - "replacement": "\ud83c\udd7f" - }, - { - "shortcode": ":part_alternation_mark:", - "replacement": "\ud7cc\udc3d" - }, - { - "shortcode": ":partly_sunny:", - "replacement": "\ud7c9\udec5" - }, - { - "shortcode": ":passenger_ship:", - "replacement": "\ud83d\udef3" - }, - { - "shortcode": ":passport_control:", - "replacement": "\ud83d\udec2" - }, - { - "shortcode": ":pause_button:", - "replacement": "\ud7c8\udff8" - }, - { - "shortcode": ":paw_prints:", - "replacement": "\ud83d\udc3e" - }, - { - "shortcode": ":peace_symbol:", - "replacement": "\ud7c9\ude2e" - }, - { - "shortcode": ":peach:", - "replacement": "\ud83c\udf51" - }, - { - "shortcode": ":peanuts:", - "replacement": "\ud83e\udd5c" - }, - { - "shortcode": ":pear:", - "replacement": "\ud83c\udf50" - }, - { - "shortcode": ":pen:", - "replacement": "\ud83d\udd8a" - }, - { - "shortcode": ":pencil:", - "replacement": "\ud83d\udcdd" - }, - { - "shortcode": ":pencil2:", - "replacement": "\ud7c9\udf0f" - }, - { - "shortcode": ":penguin:", - "replacement": "\ud83d\udc27" - }, - { - "shortcode": ":pensive:", - "replacement": "\ud83d\ude14" - }, - { - "shortcode": ":performing_arts:", - "replacement": "\ud83c\udfad" - }, - { - "shortcode": ":persevere:", - "replacement": "\ud83d\ude23" - }, - { - "shortcode": ":person_fencing:", - "replacement": "\ud83e\udd3a" - }, - { - "shortcode": ":person_frowning:", - "replacement": "\ud83d\ude4d" - }, - { - "shortcode": ":person_with_blond_hair:", - "replacement": "\ud83d\udc71" - }, - { - "shortcode": ":person_with_pouting_face:", - "replacement": "\ud83d\ude4e" - }, - { - "shortcode": ":peru:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":philippines:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":phone:", - "replacement": "\ud7c9\ude0e" - }, - { - "shortcode": ":pick:", - "replacement": "\ud7c9\udecf" - }, - { - "shortcode": ":pig:", - "replacement": "\ud83d\udc37" - }, - { - "shortcode": ":pig2:", - "replacement": "\ud83d\udc16" - }, - { - "shortcode": ":pig_nose:", - "replacement": "\ud83d\udc3d" - }, - { - "shortcode": ":pill:", - "replacement": "\ud83d\udc8a" - }, - { - "shortcode": ":pineapple:", - "replacement": "\ud83c\udf4d" - }, - { - "shortcode": ":ping_pong:", - "replacement": "\ud83c\udfd3" - }, - { - "shortcode": ":pisces:", - "replacement": "\ud7c9\ude53" - }, - { - "shortcode": ":pitcairn_islands:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":pizza:", - "replacement": "\ud83c\udf55" - }, - { - "shortcode": ":place_of_worship:", - "replacement": "\ud83d\uded0" - }, - { - "shortcode": ":plate_with_cutlery:", - "replacement": "\ud83c\udf7d" - }, - { - "shortcode": ":play_or_pause_button:", - "replacement": "\ud7c8\udfef" - }, - { - "shortcode": ":point_down:", - "replacement": "\ud83d\udc47" - }, - { - "shortcode": ":point_left:", - "replacement": "\ud83d\udc48" - }, - { - "shortcode": ":point_right:", - "replacement": "\ud83d\udc49" - }, - { - "shortcode": ":point_up:", - "replacement": "\ud7c9\ude1d" - }, - { - "shortcode": ":point_up_2:", - "replacement": "\ud83d\udc46" - }, - { - "shortcode": ":poland:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":police_car:", - "replacement": "\ud83d\ude93" - }, - { - "shortcode": ":policeman:", - "replacement": "\ud83d\udc6e" - }, - { - "shortcode": ":policewoman:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":poodle:", - "replacement": "\ud83d\udc29" - }, - { - "shortcode": ":poop:", - "replacement": "\ud83d\udca9" - }, - { - "shortcode": ":popcorn:", - "replacement": "\ud83c\udf7f" - }, - { - "shortcode": ":portugal:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":post_office:", - "replacement": "\ud83c\udfe3" - }, - { - "shortcode": ":postal_horn:", - "replacement": "\ud83d\udcef" - }, - { - "shortcode": ":postbox:", - "replacement": "\ud83d\udcee" - }, - { - "shortcode": ":potable_water:", - "replacement": "\ud83d\udeb0" - }, - { - "shortcode": ":potato:", - "replacement": "\ud83e\udd54" - }, - { - "shortcode": ":pouch:", - "replacement": "\ud83d\udc5d" - }, - { - "shortcode": ":poultry_leg:", - "replacement": "\ud83c\udf57" - }, - { - "shortcode": ":pound:", - "replacement": "\ud83d\udcb7" - }, - { - "shortcode": ":pout:", - "replacement": "\ud83d\ude21" - }, - { - "shortcode": ":pouting_cat:", - "replacement": "\ud83d\ude3e" - }, - { - "shortcode": ":pouting_man:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":pouting_woman:", - "replacement": "\ud83d\ude4e" - }, - { - "shortcode": ":pray:", - "replacement": "\ud83d\ude4f" - }, - { - "shortcode": ":prayer_beads:", - "replacement": "\ud83d\udcff" - }, - { - "shortcode": ":pregnant_woman:", - "replacement": "\ud83e\udd30" - }, - { - "shortcode": ":previous_track_button:", - "replacement": "\ud7c8\udfee" - }, - { - "shortcode": ":prince:", - "replacement": "\ud83e\udd34" - }, - { - "shortcode": ":princess:", - "replacement": "\ud83d\udc78" - }, - { - "shortcode": ":printer:", - "replacement": "\ud83d\udda8" - }, - { - "shortcode": ":puerto_rico:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":punch:", - "replacement": "\ud83d\udc4a" - }, - { - "shortcode": ":purple_heart:", - "replacement": "\ud83d\udc9c" - }, - { - "shortcode": ":purse:", - "replacement": "\ud83d\udc5b" - }, - { - "shortcode": ":pushpin:", - "replacement": "\ud83d\udccc" - }, - { - "shortcode": ":put_litter_in_its_place:", - "replacement": "\ud83d\udeae" - }, - { - "shortcode": ":qatar:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":question:", - "replacement": "\ud7c9\udf53" - }, - { - "shortcode": ":rabbit:", - "replacement": "\ud83d\udc30" - }, - { - "shortcode": ":rabbit2:", - "replacement": "\ud83d\udc07" - }, - { - "shortcode": ":racehorse:", - "replacement": "\ud83d\udc0e" - }, - { - "shortcode": ":racing_car:", - "replacement": "\ud83c\udfce" - }, - { - "shortcode": ":radio:", - "replacement": "\ud83d\udcfb" - }, - { - "shortcode": ":radio_button:", - "replacement": "\ud83d\udd18" - }, - { - "shortcode": ":radioactive:", - "replacement": "\ud7c9\ude22" - }, - { - "shortcode": ":rage:", - "replacement": "\ud83d\ude21" - }, - { - "shortcode": ":rage1:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":rage2:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":rage3:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":rage4:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":railway_car:", - "replacement": "\ud83d\ude83" - }, - { - "shortcode": ":railway_track:", - "replacement": "\ud83d\udee4" - }, - { - "shortcode": ":rainbow:", - "replacement": "\ud83c\udf08" - }, - { - "shortcode": ":rainbow_flag:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":raised_back_of_hand:", - "replacement": "\ud83e\udd1a" - }, - { - "shortcode": ":raised_hand:", - "replacement": "\ud7c9\udf0b" - }, - { - "shortcode": ":raised_hand_with_fingers_splayed:", - "replacement": "\ud83d\udd90" - }, - { - "shortcode": ":raised_hands:", - "replacement": "\ud83d\ude4c" - }, - { - "shortcode": ":raising_hand:", - "replacement": "\ud83d\ude4b" - }, - { - "shortcode": ":raising_hand_man:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":raising_hand_woman:", - "replacement": "\ud83d\ude4b" - }, - { - "shortcode": ":ram:", - "replacement": "\ud83d\udc0f" - }, - { - "shortcode": ":ramen:", - "replacement": "\ud83c\udf5c" - }, - { - "shortcode": ":rat:", - "replacement": "\ud83d\udc00" - }, - { - "shortcode": ":record_button:", - "replacement": "\ud7c8\udffa" - }, - { - "shortcode": ":recycle:", - "replacement": "\ud7c9\ude7b" - }, - { - "shortcode": ":red_car:", - "replacement": "\ud83d\ude97" - }, - { - "shortcode": ":red_circle:", - "replacement": "\ud83d\udd34" - }, - { - "shortcode": ":registered:", - "replacement": "\ud7c0\udcae" - }, - { - "shortcode": ":relaxed:", - "replacement": "\ud7c9\ude3a" - }, - { - "shortcode": ":relieved:", - "replacement": "\ud83d\ude0c" - }, - { - "shortcode": ":reminder_ribbon:", - "replacement": "\ud83c\udf97" - }, - { - "shortcode": ":repeat:", - "replacement": "\ud83d\udd01" - }, - { - "shortcode": ":repeat_one:", - "replacement": "\ud83d\udd02" - }, - { - "shortcode": ":rescue_worker_helmet:", - "replacement": "\ud7c9\uded1" - }, - { - "shortcode": ":restroom:", - "replacement": "\ud83d\udebb" - }, - { - "shortcode": ":reunion:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":revolving_hearts:", - "replacement": "\ud83d\udc9e" - }, - { - "shortcode": ":rewind:", - "replacement": "\ud7c8\udfea" - }, - { - "shortcode": ":rhinoceros:", - "replacement": "\ud83e\udd8f" - }, - { - "shortcode": ":ribbon:", - "replacement": "\ud83c\udf80" - }, - { - "shortcode": ":rice:", - "replacement": "\ud83c\udf5a" - }, - { - "shortcode": ":rice_ball:", - "replacement": "\ud83c\udf59" - }, - { - "shortcode": ":rice_cracker:", - "replacement": "\ud83c\udf58" - }, - { - "shortcode": ":rice_scene:", - "replacement": "\ud83c\udf91" - }, - { - "shortcode": ":right_anger_bubble:", - "replacement": "\ud83d\uddef" - }, - { - "shortcode": ":ring:", - "replacement": "\ud83d\udc8d" - }, - { - "shortcode": ":robot:", - "replacement": "\ud83e\udd16" - }, - { - "shortcode": ":rocket:", - "replacement": "\ud83d\ude80" - }, - { - "shortcode": ":rofl:", - "replacement": "\ud83e\udd23" - }, - { - "shortcode": ":roll_eyes:", - "replacement": "\ud83d\ude44" - }, - { - "shortcode": ":roller_coaster:", - "replacement": "\ud83c\udfa2" - }, - { - "shortcode": ":romania:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":rooster:", - "replacement": "\ud83d\udc13" - }, - { - "shortcode": ":rose:", - "replacement": "\ud83c\udf39" - }, - { - "shortcode": ":rosette:", - "replacement": "\ud83c\udff5" - }, - { - "shortcode": ":rotating_light:", - "replacement": "\ud83d\udea8" - }, - { - "shortcode": ":round_pushpin:", - "replacement": "\ud83d\udccd" - }, - { - "shortcode": ":rowboat:", - "replacement": "\ud83d\udea3" - }, - { - "shortcode": ":rowing_man:", - "replacement": "\ud83d\udea3" - }, - { - "shortcode": ":rowing_woman:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":ru:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":rugby_football:", - "replacement": "\ud83c\udfc9" - }, - { - "shortcode": ":runner:", - "replacement": "\ud83c\udfc3" - }, - { - "shortcode": ":running:", - "replacement": "\ud83c\udfc3" - }, - { - "shortcode": ":running_man:", - "replacement": "\ud83c\udfc3" - }, - { - "shortcode": ":running_shirt_with_sash:", - "replacement": "\ud83c\udfbd" - }, - { - "shortcode": ":running_woman:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":rwanda:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":sa:", - "replacement": "\ud83c\ude02" - }, - { - "shortcode": ":sagittarius:", - "replacement": "\ud7c9\ude50" - }, - { - "shortcode": ":sailboat:", - "replacement": "\ud7c9\udef5" - }, - { - "shortcode": ":sake:", - "replacement": "\ud83c\udf76" - }, - { - "shortcode": ":samoa:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":san_marino:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":sandal:", - "replacement": "\ud83d\udc61" - }, - { - "shortcode": ":santa:", - "replacement": "\ud83c\udf85" - }, - { - "shortcode": ":sao_tome_principe:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":sassy_man:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":sassy_woman:", - "replacement": "\ud83d\udc81" - }, - { - "shortcode": ":satellite:", - "replacement": "\ud83d\udce1" - }, - { - "shortcode": ":satisfied:", - "replacement": "\ud83d\ude06" - }, - { - "shortcode": ":saudi_arabia:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":saxophone:", - "replacement": "\ud83c\udfb7" - }, - { - "shortcode": ":school:", - "replacement": "\ud83c\udfeb" - }, - { - "shortcode": ":school_satchel:", - "replacement": "\ud83c\udf92" - }, - { - "shortcode": ":scissors:", - "replacement": "\ud7c9\udf02" - }, - { - "shortcode": ":scorpion:", - "replacement": "\ud83e\udd82" - }, - { - "shortcode": ":scorpius:", - "replacement": "\ud7c9\ude4f" - }, - { - "shortcode": ":scream:", - "replacement": "\ud83d\ude31" - }, - { - "shortcode": ":scream_cat:", - "replacement": "\ud83d\ude40" - }, - { - "shortcode": ":scroll:", - "replacement": "\ud83d\udcdc" - }, - { - "shortcode": ":seat:", - "replacement": "\ud83d\udcba" - }, - { - "shortcode": ":secret:", - "replacement": "\ud7cc\ude99" - }, - { - "shortcode": ":see_no_evil:", - "replacement": "\ud83d\ude48" - }, - { - "shortcode": ":seedling:", - "replacement": "\ud83c\udf31" - }, - { - "shortcode": ":selfie:", - "replacement": "\ud83e\udd33" - }, - { - "shortcode": ":senegal:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":serbia:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":seven:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":seychelles:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":shallow_pan_of_food:", - "replacement": "\ud83e\udd58" - }, - { - "shortcode": ":shamrock:", - "replacement": "\ud7c9\ude18" - }, - { - "shortcode": ":shark:", - "replacement": "\ud83e\udd88" - }, - { - "shortcode": ":shaved_ice:", - "replacement": "\ud83c\udf67" - }, - { - "shortcode": ":sheep:", - "replacement": "\ud83d\udc11" - }, - { - "shortcode": ":shell:", - "replacement": "\ud83d\udc1a" - }, - { - "shortcode": ":shield:", - "replacement": "\ud83d\udee1" - }, - { - "shortcode": ":shinto_shrine:", - "replacement": "\ud7c9\udee9" - }, - { - "shortcode": ":ship:", - "replacement": "\ud83d\udea2" - }, - { - "shortcode": ":shipit:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":shirt:", - "replacement": "\ud83d\udc55" - }, - { - "shortcode": ":shit:", - "replacement": "\ud83d\udca9" - }, - { - "shortcode": ":shoe:", - "replacement": "\ud83d\udc5e" - }, - { - "shortcode": ":shopping:", - "replacement": "\ud83d\udecd" - }, - { - "shortcode": ":shopping_cart:", - "replacement": "\ud83d\uded2" - }, - { - "shortcode": ":shower:", - "replacement": "\ud83d\udebf" - }, - { - "shortcode": ":shrimp:", - "replacement": "\ud83e\udd90" - }, - { - "shortcode": ":sierra_leone:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":signal_strength:", - "replacement": "\ud83d\udcf6" - }, - { - "shortcode": ":singapore:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":sint_maarten:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":six:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":six_pointed_star:", - "replacement": "\ud83d\udd2f" - }, - { - "shortcode": ":ski:", - "replacement": "\ud83c\udfbf" - }, - { - "shortcode": ":skier:", - "replacement": "\ud7c9\udef7" - }, - { - "shortcode": ":skull:", - "replacement": "\ud83d\udc80" - }, - { - "shortcode": ":skull_and_crossbones:", - "replacement": "\ud7c9\ude20" - }, - { - "shortcode": ":sleeping:", - "replacement": "\ud83d\ude34" - }, - { - "shortcode": ":sleeping_bed:", - "replacement": "\ud83d\udecc" - }, - { - "shortcode": ":sleepy:", - "replacement": "\ud83d\ude2a" - }, - { - "shortcode": ":slightly_frowning_face:", - "replacement": "\ud83d\ude41" - }, - { - "shortcode": ":slightly_smiling_face:", - "replacement": "\ud83d\ude42" - }, - { - "shortcode": ":slot_machine:", - "replacement": "\ud83c\udfb0" - }, - { - "shortcode": ":slovakia:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":slovenia:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":small_airplane:", - "replacement": "\ud83d\udee9" - }, - { - "shortcode": ":small_blue_diamond:", - "replacement": "\ud83d\udd39" - }, - { - "shortcode": ":small_orange_diamond:", - "replacement": "\ud83d\udd38" - }, - { - "shortcode": ":small_red_triangle:", - "replacement": "\ud83d\udd3a" - }, - { - "shortcode": ":small_red_triangle_down:", - "replacement": "\ud83d\udd3b" - }, - { - "shortcode": ":smile:", - "replacement": "\ud83d\ude04" - }, - { - "shortcode": ":smile_cat:", - "replacement": "\ud83d\ude38" - }, - { - "shortcode": ":smiley:", - "replacement": "\ud83d\ude03" - }, - { - "shortcode": ":smiley_cat:", - "replacement": "\ud83d\ude3a" - }, - { - "shortcode": ":smiling_imp:", - "replacement": "\ud83d\ude08" - }, - { - "shortcode": ":smirk:", - "replacement": "\ud83d\ude0f" - }, - { - "shortcode": ":smirk_cat:", - "replacement": "\ud83d\ude3c" - }, - { - "shortcode": ":smoking:", - "replacement": "\ud83d\udeac" - }, - { - "shortcode": ":snail:", - "replacement": "\ud83d\udc0c" - }, - { - "shortcode": ":snake:", - "replacement": "\ud83d\udc0d" - }, - { - "shortcode": ":sneezing_face:", - "replacement": "\ud83e\udd27" - }, - { - "shortcode": ":snowboarder:", - "replacement": "\ud83c\udfc2" - }, - { - "shortcode": ":snowflake:", - "replacement": "\ud7c9\udf44" - }, - { - "shortcode": ":snowman:", - "replacement": "\ud7c9\udec4" - }, - { - "shortcode": ":snowman_with_snow:", - "replacement": "\ud7c9\ude03" - }, - { - "shortcode": ":sob:", - "replacement": "\ud83d\ude2d" - }, - { - "shortcode": ":soccer:", - "replacement": "\ud7c9\udebd" - }, - { - "shortcode": ":solomon_islands:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":somalia:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":soon:", - "replacement": "\ud83d\udd1c" - }, - { - "shortcode": ":sos:", - "replacement": "\ud83c\udd98" - }, - { - "shortcode": ":sound:", - "replacement": "\ud83d\udd09" - }, - { - "shortcode": ":south_africa:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":south_georgia_south_sandwich_islands:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":south_sudan:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":space_invader:", - "replacement": "\ud83d\udc7e" - }, - { - "shortcode": ":spades:", - "replacement": "\ud7c9\ude60" - }, - { - "shortcode": ":spaghetti:", - "replacement": "\ud83c\udf5d" - }, - { - "shortcode": ":sparkle:", - "replacement": "\ud7c9\udf47" - }, - { - "shortcode": ":sparkler:", - "replacement": "\ud83c\udf87" - }, - { - "shortcode": ":sparkles:", - "replacement": "\ud7c9\udf28" - }, - { - "shortcode": ":sparkling_heart:", - "replacement": "\ud83d\udc96" - }, - { - "shortcode": ":speak_no_evil:", - "replacement": "\ud83d\ude4a" - }, - { - "shortcode": ":speaker:", - "replacement": "\ud83d\udd08" - }, - { - "shortcode": ":speaking_head:", - "replacement": "\ud83d\udde3" - }, - { - "shortcode": ":speech_balloon:", - "replacement": "\ud83d\udcac" - }, - { - "shortcode": ":speedboat:", - "replacement": "\ud83d\udea4" - }, - { - "shortcode": ":spider:", - "replacement": "\ud83d\udd77" - }, - { - "shortcode": ":spider_web:", - "replacement": "\ud83d\udd78" - }, - { - "shortcode": ":spiral_calendar:", - "replacement": "\ud83d\uddd3" - }, - { - "shortcode": ":spiral_notepad:", - "replacement": "\ud83d\uddd2" - }, - { - "shortcode": ":spoon:", - "replacement": "\ud83e\udd44" - }, - { - "shortcode": ":squid:", - "replacement": "\ud83e\udd91" - }, - { - "shortcode": ":squirrel:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":sri_lanka:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":st_barthelemy:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":st_helena:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":st_kitts_nevis:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":st_lucia:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":st_pierre_miquelon:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":st_vincent_grenadines:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":stadium:", - "replacement": "\ud83c\udfdf" - }, - { - "shortcode": ":star:", - "replacement": "\ud7ca\udf50" - }, - { - "shortcode": ":star2:", - "replacement": "\ud83c\udf1f" - }, - { - "shortcode": ":star_and_crescent:", - "replacement": "\ud7c9\ude2a" - }, - { - "shortcode": ":star_of_david:", - "replacement": "\ud7c9\udf21" - }, - { - "shortcode": ":stars:", - "replacement": "\ud83c\udf20" - }, - { - "shortcode": ":station:", - "replacement": "\ud83d\ude89" - }, - { - "shortcode": ":statue_of_liberty:", - "replacement": "\ud83d\uddfd" - }, - { - "shortcode": ":steam_locomotive:", - "replacement": "\ud83d\ude82" - }, - { - "shortcode": ":stew:", - "replacement": "\ud83c\udf72" - }, - { - "shortcode": ":stop_button:", - "replacement": "\ud7c8\udff9" - }, - { - "shortcode": ":stop_sign:", - "replacement": "\ud83d\uded1" - }, - { - "shortcode": ":stopwatch:", - "replacement": "\ud7c8\udff1" - }, - { - "shortcode": ":straight_ruler:", - "replacement": "\ud83d\udccf" - }, - { - "shortcode": ":strawberry:", - "replacement": "\ud83c\udf53" - }, - { - "shortcode": ":stuck_out_tongue:", - "replacement": "\ud83d\ude1b" - }, - { - "shortcode": ":stuck_out_tongue_closed_eyes:", - "replacement": "\ud83d\ude1d" - }, - { - "shortcode": ":stuck_out_tongue_winking_eye:", - "replacement": "\ud83d\ude1c" - }, - { - "shortcode": ":studio_microphone:", - "replacement": "\ud83c\udf99" - }, - { - "shortcode": ":stuffed_flatbread:", - "replacement": "\ud83e\udd59" - }, - { - "shortcode": ":sudan:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":sun_behind_large_cloud:", - "replacement": "\ud83c\udf25" - }, - { - "shortcode": ":sun_behind_rain_cloud:", - "replacement": "\ud83c\udf26" - }, - { - "shortcode": ":sun_behind_small_cloud:", - "replacement": "\ud83c\udf24" - }, - { - "shortcode": ":sun_with_face:", - "replacement": "\ud83c\udf1e" - }, - { - "shortcode": ":sunflower:", - "replacement": "\ud83c\udf3b" - }, - { - "shortcode": ":sunglasses:", - "replacement": "\ud83d\ude0e" - }, - { - "shortcode": ":sunny:", - "replacement": "\ud7c9\ude00" - }, - { - "shortcode": ":sunrise:", - "replacement": "\ud83c\udf05" - }, - { - "shortcode": ":sunrise_over_mountains:", - "replacement": "\ud83c\udf04" - }, - { - "shortcode": ":surfer:", - "replacement": "\ud83c\udfc4" - }, - { - "shortcode": ":surfing_man:", - "replacement": "\ud83c\udfc4" - }, - { - "shortcode": ":surfing_woman:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":suriname:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":sushi:", - "replacement": "\ud83c\udf63" - }, - { - "shortcode": ":suspect:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":suspension_railway:", - "replacement": "\ud83d\ude9f" - }, - { - "shortcode": ":swaziland:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":sweat:", - "replacement": "\ud83d\ude13" - }, - { - "shortcode": ":sweat_drops:", - "replacement": "\ud83d\udca6" - }, - { - "shortcode": ":sweat_smile:", - "replacement": "\ud83d\ude05" - }, - { - "shortcode": ":sweden:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":sweet_potato:", - "replacement": "\ud83c\udf60" - }, - { - "shortcode": ":swimmer:", - "replacement": "\ud83c\udfca" - }, - { - "shortcode": ":swimming_man:", - "replacement": "\ud83c\udfca" - }, - { - "shortcode": ":swimming_woman:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":switzerland:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":symbols:", - "replacement": "\ud83d\udd23" - }, - { - "shortcode": ":synagogue:", - "replacement": "\ud83d\udd4d" - }, - { - "shortcode": ":syria:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":syringe:", - "replacement": "\ud83d\udc89" - }, - { - "shortcode": ":taco:", - "replacement": "\ud83c\udf2e" - }, - { - "shortcode": ":tada:", - "replacement": "\ud83c\udf89" - }, - { - "shortcode": ":taiwan:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":tajikistan:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":tanabata_tree:", - "replacement": "\ud83c\udf8b" - }, - { - "shortcode": ":tangerine:", - "replacement": "\ud83c\udf4a" - }, - { - "shortcode": ":tanzania:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":taurus:", - "replacement": "\ud7c9\ude49" - }, - { - "shortcode": ":taxi:", - "replacement": "\ud83d\ude95" - }, - { - "shortcode": ":tea:", - "replacement": "\ud83c\udf75" - }, - { - "shortcode": ":telephone:", - "replacement": "\ud7c9\ude0e" - }, - { - "shortcode": ":telephone_receiver:", - "replacement": "\ud83d\udcde" - }, - { - "shortcode": ":telescope:", - "replacement": "\ud83d\udd2d" - }, - { - "shortcode": ":tennis:", - "replacement": "\ud83c\udfbe" - }, - { - "shortcode": ":tent:", - "replacement": "\ud7c9\udefa" - }, - { - "shortcode": ":thailand:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":thermometer:", - "replacement": "\ud83c\udf21" - }, - { - "shortcode": ":thinking:", - "replacement": "\ud83e\udd14" - }, - { - "shortcode": ":thought_balloon:", - "replacement": "\ud83d\udcad" - }, - { - "shortcode": ":three:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":thumbsdown:", - "replacement": "\ud83d\udc4e" - }, - { - "shortcode": ":thumbsup:", - "replacement": "\ud83d\udc4d" - }, - { - "shortcode": ":ticket:", - "replacement": "\ud83c\udfab" - }, - { - "shortcode": ":tickets:", - "replacement": "\ud83c\udf9f" - }, - { - "shortcode": ":tiger:", - "replacement": "\ud83d\udc2f" - }, - { - "shortcode": ":tiger2:", - "replacement": "\ud83d\udc05" - }, - { - "shortcode": ":timer_clock:", - "replacement": "\ud7c8\udff2" - }, - { - "shortcode": ":timor_leste:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":tipping_hand_man:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":tipping_hand_woman:", - "replacement": "\ud83d\udc81" - }, - { - "shortcode": ":tired_face:", - "replacement": "\ud83d\ude2b" - }, - { - "shortcode": ":tm:", - "replacement": "\ud7c8\udd22" - }, - { - "shortcode": ":togo:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":toilet:", - "replacement": "\ud83d\udebd" - }, - { - "shortcode": ":tokelau:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":tokyo_tower:", - "replacement": "\ud83d\uddfc" - }, - { - "shortcode": ":tomato:", - "replacement": "\ud83c\udf45" - }, - { - "shortcode": ":tonga:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":tongue:", - "replacement": "\ud83d\udc45" - }, - { - "shortcode": ":top:", - "replacement": "\ud83d\udd1d" - }, - { - "shortcode": ":tophat:", - "replacement": "\ud83c\udfa9" - }, - { - "shortcode": ":tornado:", - "replacement": "\ud83c\udf2a" - }, - { - "shortcode": ":tr:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":trackball:", - "replacement": "\ud83d\uddb2" - }, - { - "shortcode": ":tractor:", - "replacement": "\ud83d\ude9c" - }, - { - "shortcode": ":traffic_light:", - "replacement": "\ud83d\udea5" - }, - { - "shortcode": ":train:", - "replacement": "\ud83d\ude8b" - }, - { - "shortcode": ":train2:", - "replacement": "\ud83d\ude86" - }, - { - "shortcode": ":tram:", - "replacement": "\ud83d\ude8a" - }, - { - "shortcode": ":triangular_flag_on_post:", - "replacement": "\ud83d\udea9" - }, - { - "shortcode": ":triangular_ruler:", - "replacement": "\ud83d\udcd0" - }, - { - "shortcode": ":trident:", - "replacement": "\ud83d\udd31" - }, - { - "shortcode": ":trinidad_tobago:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":triumph:", - "replacement": "\ud83d\ude24" - }, - { - "shortcode": ":trolleybus:", - "replacement": "\ud83d\ude8e" - }, - { - "shortcode": ":trollface:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":trophy:", - "replacement": "\ud83c\udfc6" - }, - { - "shortcode": ":tropical_drink:", - "replacement": "\ud83c\udf79" - }, - { - "shortcode": ":tropical_fish:", - "replacement": "\ud83d\udc20" - }, - { - "shortcode": ":truck:", - "replacement": "\ud83d\ude9a" - }, - { - "shortcode": ":trumpet:", - "replacement": "\ud83c\udfba" - }, - { - "shortcode": ":tshirt:", - "replacement": "\ud83d\udc55" - }, - { - "shortcode": ":tulip:", - "replacement": "\ud83c\udf37" - }, - { - "shortcode": ":tumbler_glass:", - "replacement": "\ud83e\udd43" - }, - { - "shortcode": ":tunisia:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":turkey:", - "replacement": "\ud83e\udd83" - }, - { - "shortcode": ":turkmenistan:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":turks_caicos_islands:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":turtle:", - "replacement": "\ud83d\udc22" - }, - { - "shortcode": ":tuvalu:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":tv:", - "replacement": "\ud83d\udcfa" - }, - { - "shortcode": ":twisted_rightwards_arrows:", - "replacement": "\ud83d\udd00" - }, - { - "shortcode": ":two:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":two_hearts:", - "replacement": "\ud83d\udc95" - }, - { - "shortcode": ":two_men_holding_hands:", - "replacement": "\ud83d\udc6c" - }, - { - "shortcode": ":two_women_holding_hands:", - "replacement": "\ud83d\udc6d" - }, - { - "shortcode": ":u5272:", - "replacement": "\ud83c\ude39" - }, - { - "shortcode": ":u5408:", - "replacement": "\ud83c\ude34" - }, - { - "shortcode": ":u55b6:", - "replacement": "\ud83c\ude3a" - }, - { - "shortcode": ":u6307:", - "replacement": "\ud83c\ude2f" - }, - { - "shortcode": ":u6708:", - "replacement": "\ud83c\ude37" - }, - { - "shortcode": ":u6709:", - "replacement": "\ud83c\ude36" - }, - { - "shortcode": ":u6e80:", - "replacement": "\ud83c\ude35" - }, - { - "shortcode": ":u7121:", - "replacement": "\ud83c\ude1a" - }, - { - "shortcode": ":u7533:", - "replacement": "\ud83c\ude38" - }, - { - "shortcode": ":u7981:", - "replacement": "\ud83c\ude32" - }, - { - "shortcode": ":u7a7a:", - "replacement": "\ud83c\ude33" - }, - { - "shortcode": ":uganda:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":uk:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":ukraine:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":umbrella:", - "replacement": "\ud7c9\ude14" - }, - { - "shortcode": ":unamused:", - "replacement": "\ud83d\ude12" - }, - { - "shortcode": ":underage:", - "replacement": "\ud83d\udd1e" - }, - { - "shortcode": ":unicorn:", - "replacement": "\ud83e\udd84" - }, - { - "shortcode": ":united_arab_emirates:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":unlock:", - "replacement": "\ud83d\udd13" - }, - { - "shortcode": ":up:", - "replacement": "\ud83c\udd99" - }, - { - "shortcode": ":upside_down_face:", - "replacement": "\ud83d\ude43" - }, - { - "shortcode": ":uruguay:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":us:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":us_virgin_islands:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":uzbekistan:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":v:", - "replacement": "\ud7c9\udf0c" - }, - { - "shortcode": ":vanuatu:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":vatican_city:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":venezuela:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":vertical_traffic_light:", - "replacement": "\ud83d\udea6" - }, - { - "shortcode": ":vhs:", - "replacement": "\ud83d\udcfc" - }, - { - "shortcode": ":vibration_mode:", - "replacement": "\ud83d\udcf3" - }, - { - "shortcode": ":video_camera:", - "replacement": "\ud83d\udcf9" - }, - { - "shortcode": ":video_game:", - "replacement": "\ud83c\udfae" - }, - { - "shortcode": ":vietnam:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":violin:", - "replacement": "\ud83c\udfbb" - }, - { - "shortcode": ":virgo:", - "replacement": "\ud7c9\ude4d" - }, - { - "shortcode": ":volcano:", - "replacement": "\ud83c\udf0b" - }, - { - "shortcode": ":volleyball:", - "replacement": "\ud83c\udfd0" - }, - { - "shortcode": ":vs:", - "replacement": "\ud83c\udd9a" - }, - { - "shortcode": ":vulcan_salute:", - "replacement": "\ud83d\udd96" - }, - { - "shortcode": ":walking:", - "replacement": "\ud83d\udeb6" - }, - { - "shortcode": ":walking_man:", - "replacement": "\ud83d\udeb6" - }, - { - "shortcode": ":walking_woman:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":wallis_futuna:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":waning_crescent_moon:", - "replacement": "\ud83c\udf18" - }, - { - "shortcode": ":waning_gibbous_moon:", - "replacement": "\ud83c\udf16" - }, - { - "shortcode": ":warning:", - "replacement": "\ud7c9\udea0" - }, - { - "shortcode": ":wastebasket:", - "replacement": "\ud83d\uddd1" - }, - { - "shortcode": ":watch:", - "replacement": "\ud7c8\udf1a" - }, - { - "shortcode": ":water_buffalo:", - "replacement": "\ud83d\udc03" - }, - { - "shortcode": ":watermelon:", - "replacement": "\ud83c\udf49" - }, - { - "shortcode": ":wave:", - "replacement": "\ud83d\udc4b" - }, - { - "shortcode": ":wavy_dash:", - "replacement": "\ud7cc\udc30" - }, - { - "shortcode": ":waxing_crescent_moon:", - "replacement": "\ud83c\udf12" - }, - { - "shortcode": ":waxing_gibbous_moon:", - "replacement": "\ud83c\udf14" - }, - { - "shortcode": ":wc:", - "replacement": "\ud83d\udebe" - }, - { - "shortcode": ":weary:", - "replacement": "\ud83d\ude29" - }, - { - "shortcode": ":wedding:", - "replacement": "\ud83d\udc92" - }, - { - "shortcode": ":weight_lifting_man:", - "replacement": "\ud83c\udfcb" - }, - { - "shortcode": ":weight_lifting_woman:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":western_sahara:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":whale:", - "replacement": "\ud83d\udc33" - }, - { - "shortcode": ":whale2:", - "replacement": "\ud83d\udc0b" - }, - { - "shortcode": ":wheel_of_dharma:", - "replacement": "\ud7c9\ude38" - }, - { - "shortcode": ":wheelchair:", - "replacement": "\ud7c9\ude7f" - }, - { - "shortcode": ":white_check_mark:", - "replacement": "\ud7c9\udf05" - }, - { - "shortcode": ":white_circle:", - "replacement": "\ud7c9\udeaa" - }, - { - "shortcode": ":white_flag:", - "replacement": "\ud83c\udff3" - }, - { - "shortcode": ":white_flower:", - "replacement": "\ud83d\udcae" - }, - { - "shortcode": ":white_large_square:", - "replacement": "\ud7ca\udf1c" - }, - { - "shortcode": ":white_medium_small_square:", - "replacement": "\ud7c9\uddfd" - }, - { - "shortcode": ":white_medium_square:", - "replacement": "\ud7c9\uddfb" - }, - { - "shortcode": ":white_small_square:", - "replacement": "\ud7c9\uddab" - }, - { - "shortcode": ":white_square_button:", - "replacement": "\ud83d\udd33" - }, - { - "shortcode": ":wilted_flower:", - "replacement": "\ud83e\udd40" - }, - { - "shortcode": ":wind_chime:", - "replacement": "\ud83c\udf90" - }, - { - "shortcode": ":wind_face:", - "replacement": "\ud83c\udf2c" - }, - { - "shortcode": ":wine_glass:", - "replacement": "\ud83c\udf77" - }, - { - "shortcode": ":wink:", - "replacement": "\ud83d\ude09" - }, - { - "shortcode": ":wolf:", - "replacement": "\ud83d\udc3a" - }, - { - "shortcode": ":woman:", - "replacement": "\ud83d\udc69" - }, - { - "shortcode": ":woman_artist:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":woman_astronaut:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":woman_cartwheeling:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":woman_cook:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":woman_facepalming:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":woman_factory_worker:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":woman_farmer:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":woman_firefighter:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":woman_health_worker:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":woman_judge:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":woman_juggling:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":woman_mechanic:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":woman_office_worker:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":woman_pilot:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":woman_playing_handball:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":woman_playing_water_polo:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":woman_scientist:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":woman_shrugging:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":woman_singer:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":woman_student:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":woman_teacher:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":woman_technologist:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":woman_with_turban:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":womans_clothes:", - "replacement": "\ud83d\udc5a" - }, - { - "shortcode": ":womans_hat:", - "replacement": "\ud83d\udc52" - }, - { - "shortcode": ":women_wrestling:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":womens:", - "replacement": "\ud83d\udeba" - }, - { - "shortcode": ":world_map:", - "replacement": "\ud83d\uddfa" - }, - { - "shortcode": ":worried:", - "replacement": "\ud83d\ude1f" - }, - { - "shortcode": ":wrench:", - "replacement": "\ud83d\udd27" - }, - { - "shortcode": ":writing_hand:", - "replacement": "\ud7c9\udf0d" - }, - { - "shortcode": ":x:", - "replacement": "\ud7c9\udf4c" - }, - { - "shortcode": ":yellow_heart:", - "replacement": "\ud83d\udc9b" - }, - { - "shortcode": ":yemen:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":yen:", - "replacement": "\ud83d\udcb4" - }, - { - "shortcode": ":yin_yang:", - "replacement": "\ud7c9\ude2f" - }, - { - "shortcode": ":yum:", - "replacement": "\ud83d\ude0b" - }, - { - "shortcode": ":zambia:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":zap:", - "replacement": "\ud7c9\udea1" - }, - { - "shortcode": ":zero:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":zimbabwe:", - "replacement": "\ud800\udc00" - }, - { - "shortcode": ":zipper_mouth_face:", - "replacement": "\ud83e\udd10" - }, - { - "shortcode": ":zzz:", - "replacement": "\ud83d\udca4" - } -] diff --git a/app/src/main/assets/networks.json b/app/src/main/assets/networks.json deleted file mode 100644 index 43fb35140fa7c6c4790daf99a63035504318ab62..0000000000000000000000000000000000000000 --- a/app/src/main/assets/networks.json +++ /dev/null @@ -1,742 +0,0 @@ -[ - { - "name": "Aniverse", - "default": false, - "defaultChannels": [], - "servers": [ - { - "host": "irc.aniverse.com", - "port": 6661, - "secure": false - } - ] - }, - { - "name": "DALnet", - "default": false, - "defaultChannels": [], - "servers": [ - { - "host": "irc.dal.net", - "port": 6660, - "secure": false - }, - { - "host": "mesra.kl.my.dal.net", - "port": 6665, - "secure": false - }, - { - "host": "mesra.kl.my.dal.net", - "port": 7000, - "secure": false - }, - { - "host": "hotspeed.sg.as.dal.net", - "port": 6665, - "secure": false - }, - { - "host": "hotspeed.sg.as.dal.net", - "port": 7000, - "secure": false - }, - { - "host": "powertech.no.eu.dal.net", - "port": 6665, - "secure": false - }, - { - "host": "powertech.no.eu.dal.net", - "port": 7000, - "secure": false - }, - { - "host": "rumble.fl.us.dal.net", - "port": 6665, - "secure": false - }, - { - "host": "rumble.fl.us.dal.net", - "port": 7000, - "secure": false - }, - { - "host": "broadway.ny.us.dal.net", - "port": 6665, - "secure": false - }, - { - "host": "broadway.ny.us.dal.net", - "port": 7000, - "secure": false - } - ] - }, - { - "name": "EFnet", - "default": false, - "defaultChannels": [], - "servers": [ - { - "host": "irc.efnet.info", - "port": 6667, - "secure": false - }, - { - "host": "irc.efnet.org", - "port": 6667, - "secure": false - }, - { - "host": "irc.inter.net.il", - "port": 6667, - "secure": false - }, - { - "host": "irc.igs.ca", - "port": 6665, - "secure": false - }, - { - "host": "irc.inet.tele.dk", - "port": 6661, - "secure": false - }, - { - "host": "efnet.cs.hut.fi", - "port": 6667, - "secure": false - }, - { - "host": "irc.pte.hu", - "port": 6665, - "secure": false - }, - { - "host": "irc.pte.hu", - "port": 7000, - "secure": false - }, - { - "host": "irc.pte.hu", - "port": 9000, - "secure": false - }, - { - "host": "efnet.xs4all.nl", - "port": 6661, - "secure": false - }, - { - "host": "irc.efnet.nl", - "port": 6660, - "secure": false - }, - { - "host": "irc.homelien.no", - "port": 6666, - "secure": false - }, - { - "host": "irc.homelien.no", - "port": 6667, - "secure": false - }, - { - "host": "irc.homelien.no", - "port": 7000, - "secure": false - }, - { - "host": "irc.daxnet.no", - "port": 6666, - "secure": false - }, - { - "host": "irc.daxnet.no", - "port": 7000, - "secure": false - }, - { - "host": "irc.efnet.pl", - "port": 6667, - "secure": false - }, - { - "host": "irc.du.se", - "port": 6666, - "secure": false - }, - { - "host": "irc.du.se", - "port": 7000, - "secure": false - }, - { - "host": "efnet.demon.co.uk", - "port": 6665, - "secure": false - }, - { - "host": "irc.blackened.com", - "port": 6665, - "secure": false - }, - { - "host": "irc.easynews.com", - "port": 6660, - "secure": false - }, - { - "host": "irc.easynews.com", - "port": 6665, - "secure": false - }, - { - "host": "irc.easynews.com", - "port": 7000, - "secure": false - }, - { - "host": "irc.blessed.net", - "port": 6665, - "secure": false - }, - { - "host": "irc.he.net", - "port": 6665, - "secure": false - }, - { - "host": "irc.he.net", - "port": 7000, - "secure": false - }, - { - "host": "irc.prison.net", - "port": 6666, - "secure": false - }, - { - "host": "irc.wh.verio.net", - "port": 6665, - "secure": false - }, - { - "host": "irc.colosolutions.net", - "port": 6665, - "secure": false - }, - { - "host": "irc.colosolutions.net", - "port": 7000, - "secure": false - }, - { - "host": "irc.mindspring.com", - "port": 6660, - "secure": false - }, - { - "host": "irc.mindspring.com", - "port": 7000, - "secure": false - }, - { - "host": "irc.servercentral.net", - "port": 6660, - "secure": false - }, - { - "host": "irc.servercentral.net", - "port": 7000, - "secure": false - }, - { - "host": "irc.umich.edu", - "port": 6664, - "secure": false - }, - { - "host": "irc.umn.edu", - "port": 6665, - "secure": false - }, - { - "host": "irc.choopa.net", - "port": 6666, - "secure": false - }, - { - "host": "irc.choopa.net", - "port": 7000, - "secure": false - }, - { - "host": "irc.nac.net", - "port": 6665, - "secure": false - }, - { - "host": "irc.nac.net", - "port": 7000, - "secure": false - } - ] - }, - { - "name": "EntertheGame", - "default": false, - "defaultChannels": [], - "servers": [ - { - "host": "irc.enterthegame.com", - "port": 6667, - "secure": false - } - ] - }, - { - "name": "Freenode", - "default": true, - "defaultChannels": [ - "#quassel" - ], - "servers": [ - { - "host": "chat.freenode.net", - "port": 6697, - "secure": true - }, - { - "host": "chat.freenode.net", - "port": 6667, - "secure": false - } - ] - }, - { - "name": "GalaxyNet", - "default": false, - "defaultChannels": [], - "servers": [ - { - "host": "irc.galaxynet.org", - "port": 6662, - "secure": false - }, - { - "host": "irc.galaxynet.org", - "port": 7000, - "secure": false - }, - { - "host": "boston.ma.us.galaxynet.org", - "port": 6661, - "secure": false - } - ] - }, - { - "name": "GameSurge", - "default": false, - "defaultChannels": [], - "servers": [ - { - "host": "irc.gamesurge.net", - "port": 6667, - "secure": false - }, - { - "host": "irc.eu.gamesurge.net", - "port": 6667, - "secure": false - } - ] - }, - { - "name": "GamesNET", - "default": false, - "defaultChannels": [], - "servers": [ - { - "host": "irc.gamesnet.net", - "port": 6667, - "secure": false - } - ] - }, - { - "name": "IRCnet", - "default": false, - "defaultChannels": [], - "servers": [ - { - "host": "irc.ircnet.com", - "port": 6667, - "secure": false - }, - { - "host": "open.ircnet.net", - "port": 6666, - "secure": false - }, - { - "host": "irc.us.ircnet.net", - "port": 6665, - "secure": false - }, - { - "host": "ircnet.netvision.net.il", - "port": 6666, - "secure": false - }, - { - "host": "irc.tokyo.wide.ad.jp", - "port": 6666, - "secure": false - }, - { - "host": "irc.freebsd.org.tw", - "port": 6666, - "secure": false - }, - { - "host": "linz.irc.at", - "port": 6666, - "secure": false - }, - { - "host": "vienna.irc.at", - "port": 6666, - "secure": false - }, - { - "host": "ircnet.realroot.be", - "port": 6666, - "secure": false - }, - { - "host": "irc.datacomm.ch", - "port": 6664, - "secure": false - }, - { - "host": "irc.felk.cvut.cz", - "port": 6667, - "secure": false - }, - { - "host": "random.ircd.de", - "port": 6666, - "secure": false - }, - { - "host": "irc.dotsrc.org", - "port": 6666, - "secure": false - }, - { - "host": "irc.ircnet.ee", - "port": 6666, - "secure": false - }, - { - "host": "irc.cs.hut.fi", - "port": 6667, - "secure": false - }, - { - "host": "ircnet.club-internet.fr", - "port": 6666, - "secure": false - }, - { - "host": "atw.irc.hu", - "port": 6667, - "secure": false - }, - { - "host": "irc.simnet.is", - "port": 6660, - "secure": false - }, - { - "host": "irc.eutelia.it", - "port": 6664, - "secure": false - }, - { - "host": "irc.eutelia.it", - "port": 7000, - "secure": false - }, - { - "host": "irc.tin.it", - "port": 6665, - "secure": false - }, - { - "host": "irc.apollo.lv", - "port": 6666, - "secure": false - }, - { - "host": "irc.apollo.lv", - "port": 7000, - "secure": false - }, - { - "host": "irc.uunet.nl", - "port": 6660, - "secure": false - }, - { - "host": "irc.xs4all.nl", - "port": 6660, - "secure": false - }, - { - "host": "irc.snt.utwente.nl", - "port": 6660, - "secure": false - }, - { - "host": "irc.ifi.uio.no", - "port": 6667, - "secure": false - }, - { - "host": "irc.pvv.ntnu.no", - "port": 6667, - "secure": false - }, - { - "host": "lublin.irc.pl", - "port": 6666, - "secure": false - }, - { - "host": "warszawa.irc.pl", - "port": 6666, - "secure": false - }, - { - "host": "irc.ludd.luth.se", - "port": 6661, - "secure": false - }, - { - "host": "irc.swipnet.se", - "port": 6660, - "secure": false - }, - { - "host": "irc.swipnet.se", - "port": 8000, - "secure": false - }, - { - "host": "irc.arnes.si", - "port": 6666, - "secure": false - }, - { - "host": "irc.link.si", - "port": 6666, - "secure": false - }, - { - "host": "irc.nextra.sk", - "port": 6666, - "secure": false - }, - { - "host": "ircnet.demon.co.uk", - "port": 6665, - "secure": false - }, - { - "host": "ircnet.eversible.com", - "port": 6665, - "secure": false - }, - { - "host": "ircnet.choopa.net", - "port": 6665, - "secure": false - } - ] - }, - { - "name": "Mozilla", - "default": false, - "defaultChannels": [], - "servers": [ - { - "host": "irc.mozilla.org", - "port": 6697, - "secure": true - }, - { - "host": "irc.mozilla.org", - "port": 6667, - "secure": false - } - ] - }, - { - "name": "OFTC", - "default": false, - "defaultChannels": [], - "servers": [ - { - "host": "irc.oftc.net", - "port": 6697, - "secure": true - }, - { - "host": "irc.oftc.net", - "port": 6667, - "secure": false - } - ] - }, - { - "name": "QuakeNet", - "default": false, - "defaultChannels": [], - "servers": [ - { - "host": "irc.quakenet.org", - "port": 6667, - "secure": false - }, - { - "host": "de.quakenet.org", - "port": 6667, - "secure": false - }, - { - "host": "se.quakenet.org", - "port": 6667, - "secure": false - }, - { - "host": "uk.quakenet.org", - "port": 6667, - "secure": false - }, - { - "host": "us.quakenet.org", - "port": 6667, - "secure": false - } - ] - }, - { - "name": "Undernet", - "default": false, - "defaultChannels": [], - "servers": [ - { - "host": "eu.undernet.org", - "port": 6667, - "secure": false - }, - { - "host": "us.undernet.org", - "port": 6667, - "secure": false - }, - { - "host": "elsene.be.eu.undernet.org", - "port": 6667, - "secure": false - }, - { - "host": "elsene.be.eu.undernet.org", - "port": 7000, - "secure": false - }, - { - "host": "helsinki.fi.eu.Undernet.org", - "port": 6666, - "secure": false - }, - { - "host": "zagreb.hr.eu.undernet.org", - "port": 6666, - "secure": false - }, - { - "host": "zagreb.hr.eu.undernet.org", - "port": 9999, - "secure": false - }, - { - "host": "ede.nl.eu.undernet.org", - "port": 6660, - "secure": false - }, - { - "host": "oslo.no.eu.undernet.org", - "port": 6666, - "secure": false - }, - { - "host": "london.uk.eu.undernet.org", - "port": 6660, - "secure": false - }, - { - "host": "london.uk.eu.undernet.org", - "port": 7000, - "secure": false - }, - { - "host": "mesa.az.us.undernet.org", - "port": 6660, - "secure": false - }, - { - "host": "mesa.az.us.undernet.org", - "port": 6665, - "secure": false - }, - { - "host": "mesa.az.us.undernet.org", - "port": 7000, - "secure": false - }, - { - "host": "newyork.ny.us.undernet.org", - "port": 6660, - "secure": false - }, - { - "host": "newyork.ny.us.undernet.org", - "port": 7000, - "secure": false - } - ] - }, - { - "name": "euIRCnet", - "default": false, - "defaultChannels": [], - "servers": [ - { - "host": "irc.euirc.net", - "port": 6697, - "secure": true - }, - { - "host": "irc.euirc.net", - "port": 6665, - "secure": false - } - ] - } -] diff --git a/app/src/main/java/de/kuschku/quasseldroid/Keys.kt b/app/src/main/java/de/kuschku/quasseldroid/Keys.kt deleted file mode 100644 index 067cf61021b310405422bbeb5f12db5d1776bd14..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/Keys.kt +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid - -object Keys { - object Status { - const val NAME = "status" - - const val selectedAccount = "selectedAccount" - const val reconnect = "reconnect" - } -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/MainActivity.kt b/app/src/main/java/de/kuschku/quasseldroid/MainActivity.kt new file mode 100644 index 0000000000000000000000000000000000000000..a7b09a45ed9b18fe59e22a871793bb9c57ce0b28 --- /dev/null +++ b/app/src/main/java/de/kuschku/quasseldroid/MainActivity.kt @@ -0,0 +1,38 @@ +package de.kuschku.quasseldroid + +import android.os.Bundle +import androidx.appcompat.app.AppCompatActivity +import androidx.compose.material.MaterialTheme +import androidx.compose.material.Surface +import androidx.compose.material.Text +import androidx.compose.runtime.Composable +import androidx.compose.ui.platform.setContent +import androidx.compose.ui.tooling.preview.Preview +import de.kuschku.quasseldroid.ui.theme.QuasseldroidTheme + +class MainActivity : AppCompatActivity() { + override fun onCreate(savedInstanceState: Bundle?) { + super.onCreate(savedInstanceState) + setContent { + QuasseldroidTheme { + // A surface container using the 'background' color from the theme + Surface(color = MaterialTheme.colors.background) { + Greeting("Android") + } + } + } + } +} + +@Composable +fun Greeting(name: String) { + Text(text = "Hello $name!") +} + +@Preview(showBackground = true) +@Composable +fun DefaultPreview() { + QuasseldroidTheme { + Greeting("Android") + } +} \ No newline at end of file diff --git a/app/src/main/java/de/kuschku/quasseldroid/Quasseldroid.kt b/app/src/main/java/de/kuschku/quasseldroid/Quasseldroid.kt deleted file mode 100644 index 79b88d15d7804b7ce2ee7ca1a3192f74acc24cdd..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/Quasseldroid.kt +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid - -import android.content.Context -import dagger.android.support.DaggerApplication -import de.kuschku.quasseldroid.app.AppDelegate -import de.kuschku.quasseldroid.app.QuasseldroidReleaseDelegate -import de.kuschku.quasseldroid.dagger.DaggerAppComponent -import de.kuschku.quasseldroid.util.ui.LocaleHelper - -open class Quasseldroid : DaggerApplication() { - override fun applicationInjector() = DaggerAppComponent.builder().create(this) - open val delegate: AppDelegate = QuasseldroidReleaseDelegate(this) - - override fun onCreate() { - super.onCreate() - delegate.onPreInit() - delegate.onInit() - applicationInjector().inject(this) - delegate.onPostInit() - } - - override fun attachBaseContext(base: Context) { - super.attachBaseContext(LocaleHelper.setLocale(base)) - delegate.onAttachBaseContext() - } -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/QuasseldroidGlideModule.kt b/app/src/main/java/de/kuschku/quasseldroid/QuasseldroidGlideModule.kt deleted file mode 100644 index 3e5ef854b9c3d6bbb971d521b715e25cc1c1a0aa..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/QuasseldroidGlideModule.kt +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid - -import android.content.Context -import android.util.Log -import com.bumptech.glide.Glide -import com.bumptech.glide.GlideBuilder -import com.bumptech.glide.Registry -import com.bumptech.glide.annotation.GlideModule -import com.bumptech.glide.load.model.ModelLoader -import com.bumptech.glide.load.model.ModelLoaderFactory -import com.bumptech.glide.load.model.MultiModelLoaderFactory -import com.bumptech.glide.module.AppGlideModule -import com.google.gson.GsonBuilder -import de.kuschku.quasseldroid.util.avatars.MatrixApi -import de.kuschku.quasseldroid.util.avatars.MatrixModelLoader -import de.kuschku.quasseldroid.viewmodel.data.Avatar -import retrofit2.Retrofit -import retrofit2.converter.gson.GsonConverterFactory -import java.io.InputStream - -@GlideModule -class QuasseldroidGlideModule : AppGlideModule() { - override fun applyOptions(context: Context, builder: GlideBuilder) { - if (!BuildConfig.DEBUG) builder.setLogLevel(Log.ERROR) - } - - override fun registerComponents(context: Context, glide: Glide, registry: Registry) { - val matrixApi = Retrofit.Builder() - .baseUrl("https://matrix.org/") - .addConverterFactory(GsonConverterFactory.create(GsonBuilder().setLenient().create())) - .build() - .create(MatrixApi::class.java) - - registry.append(Avatar.MatrixAvatar::class.java, - InputStream::class.java, - object : ModelLoaderFactory<Avatar.MatrixAvatar, InputStream> { - override fun build( - multiFactory: MultiModelLoaderFactory): ModelLoader<Avatar.MatrixAvatar, InputStream> { - return MatrixModelLoader(matrixApi) - } - - override fun teardown() = Unit - }) - } -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/app/AppDelegate.kt b/app/src/main/java/de/kuschku/quasseldroid/app/AppDelegate.kt deleted file mode 100644 index d0f388010485471f1790fc14cf8694563f92bb8e..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/app/AppDelegate.kt +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.app - -interface AppDelegate { - fun onAttachBaseContext() - fun onPreInit() - fun onInit() - fun onPostInit() -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/app/QuasseldroidBaseDelegate.kt b/app/src/main/java/de/kuschku/quasseldroid/app/QuasseldroidBaseDelegate.kt deleted file mode 100644 index 72d158d93d2d73a71cbfe5223215a6956c4d101f..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/app/QuasseldroidBaseDelegate.kt +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.app - -import androidx.appcompat.app.AppCompatDelegate -import androidx.multidex.MultiDex -import de.kuschku.quasseldroid.BuildConfig -import de.kuschku.quasseldroid.Quasseldroid -import de.kuschku.quasseldroid.util.backport.AndroidThreeTenBackport -import de.kuschku.quasseldroid.util.compatibility.AndroidCompatibilityUtils -import de.kuschku.quasseldroid.util.compatibility.AndroidLoggingHandler -import de.kuschku.quasseldroid.util.compatibility.AndroidStreamChannelFactory - -open class QuasseldroidBaseDelegate(private val app: Quasseldroid) : AppDelegate { - override fun onPreInit() = Unit - - override fun onInit() { - // Init compatibility utils - AndroidCompatibilityUtils.inject() - AndroidLoggingHandler.inject() - AndroidStreamChannelFactory.inject() - - AppCompatDelegate.setCompatVectorFromResourcesEnabled(true) - - AndroidThreeTenBackport.init(app) - } - - override fun onPostInit() = Unit - - override fun onAttachBaseContext() { - if (BuildConfig.DEBUG) { - MultiDex.install(app) - } - } -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/app/QuasseldroidReleaseDelegate.kt b/app/src/main/java/de/kuschku/quasseldroid/app/QuasseldroidReleaseDelegate.kt deleted file mode 100644 index 0d274270af0479b2e6b1cbfaeb5d5a710fd40cdf..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/app/QuasseldroidReleaseDelegate.kt +++ /dev/null @@ -1,171 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.app - -import android.annotation.SuppressLint -import android.os.Build -import android.os.StrictMode -import de.kuschku.malheur.CrashHandler -import de.kuschku.quasseldroid.BuildConfig -import de.kuschku.quasseldroid.Quasseldroid -import de.kuschku.quasseldroid.R -import de.kuschku.quasseldroid.persistence.dao.create -import de.kuschku.quasseldroid.persistence.db.AccountDatabase -import de.kuschku.quasseldroid.persistence.db.LegacyAccountDatabase -import de.kuschku.quasseldroid.persistence.models.Account -import de.kuschku.quasseldroid.persistence.util.AccountId -import de.kuschku.quasseldroid.settings.AppearanceSettings -import de.kuschku.quasseldroid.settings.SettingsMigration -import de.kuschku.quasseldroid.settings.SettingsMigrationManager -import de.kuschku.quasseldroid.util.helper.letIf - -class QuasseldroidReleaseDelegate(private val app: Quasseldroid) : QuasseldroidBaseDelegate(app) { - override fun onPreInit() { - CrashHandler.init<BuildConfig>(application = app) - } - - @SuppressLint("NewApi") - override fun onPostInit() { - // Migrate preferences - SettingsMigrationManager( - listOf( - SettingsMigration.migrationOf(0, 1) { prefs, edit -> - // Migrating database - val database = LegacyAccountDatabase.Creator.init(app) - val accounts = database.accounts().all() - database.close() - - val accountDatabase = AccountDatabase.Creator.init(app) - accountDatabase.accounts().create(*accounts.map { - Account.of( - id = AccountId(it.id), - host = it.host, - port = it.port, - user = it.user, - requireSsl = false, - pass = it.pass, - name = it.name, - lastUsed = 0, - acceptedMissingFeatures = false, - defaultFiltered = 0 - ) - }.toTypedArray()) - Thread(Runnable { - app.deleteDatabase("data") - }).start() - - // Migrating actual settings - if (prefs.contains("selectedtheme")) { - prefs.getString("selectedtheme", "").let { theme -> - when (theme) { - "light" -> AppearanceSettings.Theme.MATERIAL_LIGHT - "dark" -> AppearanceSettings.Theme.MATERIAL_DARK - else -> null - }?.let { - edit.putString(app.getString(R.string.preference_theme_key), - it.name) - } - } - edit.remove("selectedtheme") - } - - if (prefs.contains("timestamp")) { - prefs.getString("timestamp", "").let { - val timestamp = it ?: "" - edit.putBoolean(app.getString(R.string.preference_show_seconds_key), - timestamp.contains("ss")) - edit.putBoolean(app.getString(R.string.preference_show_seconds_key), - !timestamp.contains("hh") && !timestamp.contains("a")) - } - edit.remove("timestamp") - } - - if (prefs.contains("fontsizeChannelList")) { - prefs.getString("fontsizeChannelList", "")?.toIntOrNull()?.let { fontSize -> - edit.putInt(app.getString(R.string.preference_textsize_key), - fontSize) - } - edit.remove("fontsizeChannelList") - } - - if (prefs.contains("allowcoloredtext")) { - prefs.getBoolean("allowcoloredtext", false).let { - edit.putBoolean(app.getString(R.string.preference_colorize_mirc_key), - it) - } - edit.remove("allowcoloredtext") - } - - if (prefs.contains("monospace")) { - prefs.getBoolean("monospace", false).let { - edit.putBoolean(app.getString(R.string.preference_monospace_key), - it) - } - edit.remove("monospace") - } - - if (prefs.contains("detailed_actions")) { - prefs.getBoolean("detailed_actions", false).let { - edit.putBoolean(app.getString(R.string.preference_hostmask_actions_key), - it) - } - edit.remove("detailed_actions") - } - - if (prefs.contains("showlag")) { - prefs.getBoolean("showlag", false).let { - edit.putBoolean(app.getString(R.string.preference_show_lag_key), - it) - } - edit.remove("showlag") - } - } - ) - ).migrate(app) - - if (BuildConfig.DEBUG) { - StrictMode.setThreadPolicy( - StrictMode.ThreadPolicy.Builder() - .detectNetwork() - .detectCustomSlowCalls() - .letIf(Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { - it.detectResourceMismatches() - }.letIf(Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { - it.detectUnbufferedIo() - } - .penaltyLog() - .build() - ) - StrictMode.setVmPolicy( - StrictMode.VmPolicy.Builder() - .detectLeakedSqlLiteObjects() - .detectActivityLeaks() - .detectLeakedClosableObjects() - .detectLeakedRegistrationObjects() - .detectFileUriExposure() - .letIf(Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { - it.detectContentUriWithoutPermission() - } - .penaltyLog() - .build() - ) - } - } -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/dagger/ActivityBaseModule.kt b/app/src/main/java/de/kuschku/quasseldroid/dagger/ActivityBaseModule.kt deleted file mode 100644 index 9371cd0d41aac33664ed457f23a1b4d078f25acf..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/dagger/ActivityBaseModule.kt +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.dagger - -import android.content.Context -import androidx.fragment.app.FragmentActivity -import androidx.lifecycle.ViewModelProvider -import androidx.lifecycle.ViewModelProviders -import dagger.Module -import dagger.Provides -import de.kuschku.quasseldroid.ui.setup.accounts.selection.AccountViewModel -import de.kuschku.quasseldroid.viewmodel.* - -@Module -object ActivityBaseModule { - @ActivityScope - @Provides - @JvmStatic - fun bindContext(activity: FragmentActivity): Context = activity - - @ActivityScope - @Provides - @JvmStatic - fun provideViewModelProvider(activity: FragmentActivity) = ViewModelProviders.of(activity) - - @ActivityScope - @Provides - @JvmStatic - fun provideQuasselViewModel(viewModelProvider: ViewModelProvider) = - viewModelProvider[QuasselViewModel::class.java] - - @ActivityScope - @Provides - @JvmStatic - fun provideChatViewModel(viewModelProvider: ViewModelProvider) = - viewModelProvider[ChatViewModel::class.java] - - @ActivityScope - @Provides - @JvmStatic - fun provideEditorViewModel(viewModelProvider: ViewModelProvider) = - viewModelProvider[EditorViewModel::class.java] - - @ActivityScope - @Provides - @JvmStatic - fun provideAccountViewModel(viewModelProvider: ViewModelProvider) = - viewModelProvider[AccountViewModel::class.java] - - @ActivityScope - @Provides - @JvmStatic - fun provideQueryCreateViewModel(viewModelProvider: ViewModelProvider) = - viewModelProvider[QueryCreateViewModel::class.java] - - @ActivityScope - @Provides - @JvmStatic - fun provideArchiveViewModel(viewModelProvider: ViewModelProvider) = - viewModelProvider[ArchiveViewModel::class.java] -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/dagger/ActivityModule.kt b/app/src/main/java/de/kuschku/quasseldroid/dagger/ActivityModule.kt deleted file mode 100644 index 841c00314dc2336b7a870958285e3358b796f3ec..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/dagger/ActivityModule.kt +++ /dev/null @@ -1,273 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.dagger - -import dagger.Module -import dagger.android.ContributesAndroidInjector -import de.kuschku.quasseldroid.service.QuasselService -import de.kuschku.quasseldroid.service.QuasselServiceModule -import de.kuschku.quasseldroid.ui.chat.ChatActivity -import de.kuschku.quasseldroid.ui.chat.ChatActivityModule -import de.kuschku.quasseldroid.ui.chat.ChatFragmentProvider -import de.kuschku.quasseldroid.ui.chat.add.create.ChannelCreateActivity -import de.kuschku.quasseldroid.ui.chat.add.create.ChannelCreateFragmentProvider -import de.kuschku.quasseldroid.ui.chat.add.join.ChannelJoinActivity -import de.kuschku.quasseldroid.ui.chat.add.join.ChannelJoinFragmentProvider -import de.kuschku.quasseldroid.ui.chat.add.query.QueryCreateActivity -import de.kuschku.quasseldroid.ui.chat.add.query.QueryCreateFragmentProvider -import de.kuschku.quasseldroid.ui.chat.archive.ArchiveActivity -import de.kuschku.quasseldroid.ui.chat.archive.ArchiveFragmentProvider -import de.kuschku.quasseldroid.ui.chat.topic.TopicActivity -import de.kuschku.quasseldroid.ui.chat.topic.TopicFragmentProvider -import de.kuschku.quasseldroid.ui.clientsettings.about.AboutActivity -import de.kuschku.quasseldroid.ui.clientsettings.about.AboutFragmentProvider -import de.kuschku.quasseldroid.ui.clientsettings.client.ClientSettingsActivity -import de.kuschku.quasseldroid.ui.clientsettings.client.ClientSettingsFragmentProvider -import de.kuschku.quasseldroid.ui.clientsettings.crash.CrashActivity -import de.kuschku.quasseldroid.ui.clientsettings.crash.CrashFragmentProvider -import de.kuschku.quasseldroid.ui.clientsettings.license.LicenseActivity -import de.kuschku.quasseldroid.ui.clientsettings.license.LicenseFragmentProvider -import de.kuschku.quasseldroid.ui.clientsettings.whitelist.WhitelistActivity -import de.kuschku.quasseldroid.ui.clientsettings.whitelist.WhitelistFragmentProvider -import de.kuschku.quasseldroid.ui.coresettings.CoreSettingsActivity -import de.kuschku.quasseldroid.ui.coresettings.CoreSettingsFragmentProvider -import de.kuschku.quasseldroid.ui.coresettings.aliasitem.AliasItemActivity -import de.kuschku.quasseldroid.ui.coresettings.aliasitem.AliasItemFragmentProvider -import de.kuschku.quasseldroid.ui.coresettings.aliaslist.AliasListActivity -import de.kuschku.quasseldroid.ui.coresettings.aliaslist.AliasListFragmentProvider -import de.kuschku.quasseldroid.ui.coresettings.chatlist.ChatlistCreateActivity -import de.kuschku.quasseldroid.ui.coresettings.chatlist.ChatlistCreateFragmentProvider -import de.kuschku.quasseldroid.ui.coresettings.chatlist.ChatlistEditActivity -import de.kuschku.quasseldroid.ui.coresettings.chatlist.ChatlistEditFragmentProvider -import de.kuschku.quasseldroid.ui.coresettings.highlightlist.HighlightListActivity -import de.kuschku.quasseldroid.ui.coresettings.highlightlist.HighlightListFragmentProvider -import de.kuschku.quasseldroid.ui.coresettings.highlightrule.HighlightRuleActivity -import de.kuschku.quasseldroid.ui.coresettings.highlightrule.HighlightRuleFragmentProvider -import de.kuschku.quasseldroid.ui.coresettings.identity.IdentityCreateActivity -import de.kuschku.quasseldroid.ui.coresettings.identity.IdentityCreateFragmentProvider -import de.kuschku.quasseldroid.ui.coresettings.identity.IdentityEditActivity -import de.kuschku.quasseldroid.ui.coresettings.identity.IdentityEditFragmentProvider -import de.kuschku.quasseldroid.ui.coresettings.ignoreitem.IgnoreItemActivity -import de.kuschku.quasseldroid.ui.coresettings.ignoreitem.IgnoreItemFragmentProvider -import de.kuschku.quasseldroid.ui.coresettings.ignorelist.IgnoreListActivity -import de.kuschku.quasseldroid.ui.coresettings.ignorelist.IgnoreListFragmentProvider -import de.kuschku.quasseldroid.ui.coresettings.network.NetworkCreateActivity -import de.kuschku.quasseldroid.ui.coresettings.network.NetworkCreateFragmentProvider -import de.kuschku.quasseldroid.ui.coresettings.network.NetworkEditActivity -import de.kuschku.quasseldroid.ui.coresettings.network.NetworkEditFragmentProvider -import de.kuschku.quasseldroid.ui.coresettings.networkconfig.NetworkConfigActivity -import de.kuschku.quasseldroid.ui.coresettings.networkconfig.NetworkConfigFragmentProvider -import de.kuschku.quasseldroid.ui.coresettings.networkserver.NetworkServerActivity -import de.kuschku.quasseldroid.ui.coresettings.networkserver.NetworkServerFragmentProvider -import de.kuschku.quasseldroid.ui.coresettings.passwordchange.PasswordChangeActivity -import de.kuschku.quasseldroid.ui.coresettings.passwordchange.PasswordChangeFragmentProvider -import de.kuschku.quasseldroid.ui.info.certificate.CertificateInfoActivity -import de.kuschku.quasseldroid.ui.info.certificate.CertificateInfoFragmentProvider -import de.kuschku.quasseldroid.ui.info.channel.ChannelInfoActivity -import de.kuschku.quasseldroid.ui.info.channel.ChannelInfoFragmentProvider -import de.kuschku.quasseldroid.ui.info.channellist.ChannelListActivity -import de.kuschku.quasseldroid.ui.info.channellist.ChannelListFragmentProvider -import de.kuschku.quasseldroid.ui.info.core.CoreInfoActivity -import de.kuschku.quasseldroid.ui.info.core.CoreInfoFragmentProvider -import de.kuschku.quasseldroid.ui.info.user.UserInfoActivity -import de.kuschku.quasseldroid.ui.info.user.UserInfoFragmentProvider -import de.kuschku.quasseldroid.ui.setup.accounts.edit.AccountEditActivity -import de.kuschku.quasseldroid.ui.setup.accounts.edit.AccountEditFragmentProvider -import de.kuschku.quasseldroid.ui.setup.accounts.selection.AccountSelectionActivity -import de.kuschku.quasseldroid.ui.setup.accounts.selection.AccountSelectionFragmentProvider -import de.kuschku.quasseldroid.ui.setup.accounts.setup.AccountSetupActivity -import de.kuschku.quasseldroid.ui.setup.accounts.setup.AccountSetupFragmentProvider -import de.kuschku.quasseldroid.ui.setup.core.CoreSetupActivity -import de.kuschku.quasseldroid.ui.setup.core.CoreSetupFragmentProvider -import de.kuschku.quasseldroid.ui.setup.network.NetworkSetupActivity -import de.kuschku.quasseldroid.ui.setup.network.NetworkSetupFragmentProvider -import de.kuschku.quasseldroid.ui.setup.user.UserSetupActivity -import de.kuschku.quasseldroid.ui.setup.user.UserSetupFragmentProvider - -@Module -abstract class ActivityModule { - @ActivityScope - @ContributesAndroidInjector(modules = [ChatActivityModule::class, ChatFragmentProvider::class, SettingsModule::class, DatabaseModule::class, ActivityBaseModule::class]) - abstract fun bindChatActivity(): ChatActivity - - @ActivityScope - @ContributesAndroidInjector(modules = [ArchiveFragmentProvider::class, SettingsModule::class, DatabaseModule::class, ActivityBaseModule::class]) - abstract fun bindArchiveActivity(): ArchiveActivity - - // Info - - @ActivityScope - @ContributesAndroidInjector(modules = [UserInfoFragmentProvider::class, SettingsModule::class, DatabaseModule::class, ActivityBaseModule::class]) - abstract fun bindUserInfoActivity(): UserInfoActivity - - @ActivityScope - @ContributesAndroidInjector(modules = [ChannelInfoFragmentProvider::class, SettingsModule::class, DatabaseModule::class, ActivityBaseModule::class]) - abstract fun bindChannelInfoActivity(): ChannelInfoActivity - - @ActivityScope - @ContributesAndroidInjector(modules = [CoreInfoFragmentProvider::class, SettingsModule::class, DatabaseModule::class, ActivityBaseModule::class]) - abstract fun bindCoreInfoActivity(): CoreInfoActivity - - @ActivityScope - @ContributesAndroidInjector(modules = [TopicFragmentProvider::class, SettingsModule::class, DatabaseModule::class, ActivityBaseModule::class]) - abstract fun bindTopicActivity(): TopicActivity - - @ActivityScope - @ContributesAndroidInjector(modules = [ChannelListFragmentProvider::class, SettingsModule::class, DatabaseModule::class, ActivityBaseModule::class]) - abstract fun bindChannelListActivity(): ChannelListActivity - - @ActivityScope - @ContributesAndroidInjector(modules = [CertificateInfoFragmentProvider::class, SettingsModule::class, DatabaseModule::class, ActivityBaseModule::class]) - abstract fun bindCertificateInfoActivity(): CertificateInfoActivity - - // Add - - @ActivityScope - @ContributesAndroidInjector(modules = [ChannelCreateFragmentProvider::class, SettingsModule::class, DatabaseModule::class, ActivityBaseModule::class]) - abstract fun bindChannelCreateActivity(): ChannelCreateActivity - - @ActivityScope - @ContributesAndroidInjector(modules = [ChannelJoinFragmentProvider::class, SettingsModule::class, DatabaseModule::class, ActivityBaseModule::class]) - abstract fun bindChannelJoinActivity(): ChannelJoinActivity - - @ActivityScope - @ContributesAndroidInjector(modules = [QueryCreateFragmentProvider::class, SettingsModule::class, DatabaseModule::class, ActivityBaseModule::class]) - abstract fun bindQueryCreateActivity(): QueryCreateActivity - - // Client Settings - - @ActivityScope - @ContributesAndroidInjector(modules = [ClientSettingsFragmentProvider::class, SettingsModule::class, DatabaseModule::class, ActivityBaseModule::class]) - abstract fun bindClientSettingsActivity(): ClientSettingsActivity - - @ActivityScope - @ContributesAndroidInjector(modules = [WhitelistFragmentProvider::class, SettingsModule::class, DatabaseModule::class, ActivityBaseModule::class]) - abstract fun bindWhitelistActivity(): WhitelistActivity - - @ActivityScope - @ContributesAndroidInjector(modules = [CrashFragmentProvider::class, SettingsModule::class, DatabaseModule::class, ActivityBaseModule::class]) - abstract fun bindCrashActivity(): CrashActivity - - @ActivityScope - @ContributesAndroidInjector(modules = [AboutFragmentProvider::class, SettingsModule::class, DatabaseModule::class, ActivityBaseModule::class]) - abstract fun bindAboutActivity(): AboutActivity - - @ActivityScope - @ContributesAndroidInjector(modules = [LicenseFragmentProvider::class, SettingsModule::class, DatabaseModule::class, ActivityBaseModule::class]) - abstract fun bindLicenseActivity(): LicenseActivity - - // Core Settings - - @ActivityScope - @ContributesAndroidInjector(modules = [CoreSettingsFragmentProvider::class, SettingsModule::class, DatabaseModule::class, ActivityBaseModule::class]) - abstract fun bindCoreSettingsActivity(): CoreSettingsActivity - - @ActivityScope - @ContributesAndroidInjector(modules = [NetworkCreateFragmentProvider::class, SettingsModule::class, DatabaseModule::class, ActivityBaseModule::class]) - abstract fun bindNetworkCreateActivity(): NetworkCreateActivity - - @ActivityScope - @ContributesAndroidInjector(modules = [NetworkEditFragmentProvider::class, SettingsModule::class, DatabaseModule::class, ActivityBaseModule::class]) - abstract fun bindNetworkEditActivity(): NetworkEditActivity - - @ActivityScope - @ContributesAndroidInjector(modules = [NetworkServerFragmentProvider::class, SettingsModule::class, DatabaseModule::class, ActivityBaseModule::class]) - abstract fun bindNetworkServerActivity(): NetworkServerActivity - - @ActivityScope - @ContributesAndroidInjector(modules = [IdentityCreateFragmentProvider::class, SettingsModule::class, DatabaseModule::class, ActivityBaseModule::class]) - abstract fun bindIdentityCreateActivity(): IdentityCreateActivity - - @ActivityScope - @ContributesAndroidInjector(modules = [IdentityEditFragmentProvider::class, SettingsModule::class, DatabaseModule::class, ActivityBaseModule::class]) - abstract fun bindIdentityEditActivity(): IdentityEditActivity - - @ActivityScope - @ContributesAndroidInjector(modules = [ChatlistCreateFragmentProvider::class, SettingsModule::class, DatabaseModule::class, ActivityBaseModule::class]) - abstract fun bindChatListCreateActivity(): ChatlistCreateActivity - - @ActivityScope - @ContributesAndroidInjector(modules = [ChatlistEditFragmentProvider::class, SettingsModule::class, DatabaseModule::class, ActivityBaseModule::class]) - abstract fun bindChatListEditActivity(): ChatlistEditActivity - - @ActivityScope - @ContributesAndroidInjector(modules = [IgnoreListFragmentProvider::class, SettingsModule::class, DatabaseModule::class, ActivityBaseModule::class]) - abstract fun bindIgnoreListActivity(): IgnoreListActivity - - @ActivityScope - @ContributesAndroidInjector(modules = [IgnoreItemFragmentProvider::class, SettingsModule::class, DatabaseModule::class, ActivityBaseModule::class]) - abstract fun bindIgnoreItemActivity(): IgnoreItemActivity - - @ActivityScope - @ContributesAndroidInjector(modules = [HighlightListFragmentProvider::class, SettingsModule::class, DatabaseModule::class, ActivityBaseModule::class]) - abstract fun bindHighlightListActivity(): HighlightListActivity - - @ActivityScope - @ContributesAndroidInjector(modules = [HighlightRuleFragmentProvider::class, SettingsModule::class, DatabaseModule::class, ActivityBaseModule::class]) - abstract fun bindHighlightRuleActivity(): HighlightRuleActivity - - @ActivityScope - @ContributesAndroidInjector(modules = [AliasListFragmentProvider::class, SettingsModule::class, DatabaseModule::class, ActivityBaseModule::class]) - abstract fun bindAliasListActivity(): AliasListActivity - - @ActivityScope - @ContributesAndroidInjector(modules = [AliasItemFragmentProvider::class, SettingsModule::class, DatabaseModule::class, ActivityBaseModule::class]) - abstract fun bindAliasItemActivity(): AliasItemActivity - - @ActivityScope - @ContributesAndroidInjector(modules = [NetworkConfigFragmentProvider::class, SettingsModule::class, DatabaseModule::class, ActivityBaseModule::class]) - abstract fun bindNetworkConfigActivity(): NetworkConfigActivity - - @ActivityScope - @ContributesAndroidInjector(modules = [PasswordChangeFragmentProvider::class, SettingsModule::class, DatabaseModule::class, ActivityBaseModule::class]) - abstract fun bindPasswordChangeActivity(): PasswordChangeActivity - - // Setup - - @ActivityScope - @ContributesAndroidInjector(modules = [AccountSetupFragmentProvider::class, SettingsModule::class, DatabaseModule::class, ActivityBaseModule::class]) - abstract fun bindAccountSetupActivity(): AccountSetupActivity - - @ActivityScope - @ContributesAndroidInjector(modules = [AccountSelectionFragmentProvider::class, SettingsModule::class, DatabaseModule::class, ActivityBaseModule::class]) - abstract fun bindAccountSelectionActivity(): AccountSelectionActivity - - @ActivityScope - @ContributesAndroidInjector(modules = [AccountEditFragmentProvider::class, SettingsModule::class, DatabaseModule::class, ActivityBaseModule::class]) - abstract fun bindAccountEditActivity(): AccountEditActivity - - @ActivityScope - @ContributesAndroidInjector(modules = [UserSetupFragmentProvider::class, SettingsModule::class, DatabaseModule::class, ActivityBaseModule::class]) - abstract fun bindUserSetupActivity(): UserSetupActivity - - @ActivityScope - @ContributesAndroidInjector(modules = [NetworkSetupFragmentProvider::class, SettingsModule::class, DatabaseModule::class, ActivityBaseModule::class]) - abstract fun bindNetworkSetupActivity(): NetworkSetupActivity - - @ActivityScope - @ContributesAndroidInjector(modules = [CoreSetupFragmentProvider::class, SettingsModule::class, DatabaseModule::class, ActivityBaseModule::class]) - abstract fun bindCoreSetupActivity(): CoreSetupActivity - - // Service - - @ActivityScope - @ContributesAndroidInjector(modules = [QuasselServiceModule::class, SettingsModule::class, DatabaseModule::class]) - abstract fun bindQuasselService(): QuasselService -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/dagger/ActivityScope.kt b/app/src/main/java/de/kuschku/quasseldroid/dagger/ActivityScope.kt deleted file mode 100644 index 9187f33b2c550569a05f360c65f3d885ec9c276d..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/dagger/ActivityScope.kt +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.dagger - -import javax.inject.Scope - -@Scope -@Retention(AnnotationRetention.RUNTIME) -annotation class ActivityScope diff --git a/app/src/main/java/de/kuschku/quasseldroid/dagger/AppComponent.kt b/app/src/main/java/de/kuschku/quasseldroid/dagger/AppComponent.kt deleted file mode 100644 index e070a7bd6d48e29629f5ea98fce03be6c10ca16e..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/dagger/AppComponent.kt +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.dagger - -import dagger.Component -import dagger.android.AndroidInjector -import dagger.android.support.AndroidSupportInjectionModule -import de.kuschku.quasseldroid.Quasseldroid -import javax.inject.Singleton - -@Singleton -@Component( - modules = [ - AndroidSupportInjectionModule::class, - AppModule::class, - ActivityModule::class - ] -) -interface AppComponent : AndroidInjector<Quasseldroid> { - @Component.Builder - abstract class Builder : AndroidInjector.Builder<Quasseldroid>() -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/dagger/AppModule.kt b/app/src/main/java/de/kuschku/quasseldroid/dagger/AppModule.kt deleted file mode 100644 index 379c68200d85ca1ecf9eed598c2b4d4ecdda36a4..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/dagger/AppModule.kt +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.dagger - -import com.google.gson.GsonBuilder -import dagger.Module -import dagger.Provides -import de.kuschku.quasseldroid.util.avatars.MatrixApi -import retrofit2.Retrofit -import retrofit2.converter.gson.GsonConverterFactory - -@Module -object AppModule { - @Provides - @JvmStatic - fun provideGson() = GsonBuilder().setPrettyPrinting().create() - - @Provides - @JvmStatic - fun provideMatrixApi() = Retrofit.Builder() - .baseUrl("https://matrix.org/") - .addConverterFactory(GsonConverterFactory.create(GsonBuilder().setLenient().create())) - .build() - .create(MatrixApi::class.java) -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/dagger/DatabaseModule.kt b/app/src/main/java/de/kuschku/quasseldroid/dagger/DatabaseModule.kt deleted file mode 100644 index 9a45a63d5d96ad5205c573f43b45da22669fcf00..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/dagger/DatabaseModule.kt +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.dagger - -import android.content.Context -import dagger.Module -import dagger.Provides -import de.kuschku.quasseldroid.persistence.db.AccountDatabase -import de.kuschku.quasseldroid.persistence.db.QuasselDatabase - -@Module -class DatabaseModule { - @Provides - fun provideQuasselDatabase(context: Context): QuasselDatabase { - return QuasselDatabase.Creator.init(context) - } - - @Provides - fun provideAccountsDatabase(context: Context): AccountDatabase { - return AccountDatabase.Creator.init(context) - } -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/dagger/SettingsModule.kt b/app/src/main/java/de/kuschku/quasseldroid/dagger/SettingsModule.kt deleted file mode 100644 index eb59d52c457ddda9e7dfd48a55b469d0cb11f285..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/dagger/SettingsModule.kt +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.dagger - -import android.content.Context -import dagger.Module -import dagger.Provides -import de.kuschku.quasseldroid.settings.Settings - -@Module -class SettingsModule { - @Provides - fun provideAppearanceSettings(context: Context) = Settings.appearance(context) - - @Provides - fun provideRedirectionSettings(context: Context) = Settings.redirection(context) - - @Provides - fun provideMessageSettings(context: Context) = Settings.message(context) - - @Provides - fun provideNotificationSettings(context: Context) = Settings.notification(context) - - @Provides - fun provideAutoCompleteSettings(context: Context) = Settings.autoComplete(context) - - @Provides - fun provideBacklogSettings(context: Context) = Settings.backlog(context) - - @Provides - fun provideConnectionSettings(context: Context) = Settings.connection(context) -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/defaults/DefaultNetwork.kt b/app/src/main/java/de/kuschku/quasseldroid/defaults/DefaultNetwork.kt deleted file mode 100644 index fcf364f79bd22622c4c01f409f027965246e53e7..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/defaults/DefaultNetwork.kt +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.defaults - -import java.io.Serializable - -data class DefaultNetwork( - val name: String, - val default: Boolean = false, - val defaultChannels: List<String> = emptyList(), - val servers: List<DefaultNetworkServer> -) : Serializable diff --git a/app/src/main/java/de/kuschku/quasseldroid/defaults/DefaultNetworkServer.kt b/app/src/main/java/de/kuschku/quasseldroid/defaults/DefaultNetworkServer.kt deleted file mode 100644 index cca659e8f81c704e72f230fab7f7d83dec939be4..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/defaults/DefaultNetworkServer.kt +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.defaults - -import java.io.Serializable - -data class DefaultNetworkServer( - val host: String, - val port: UInt, - val secure: Boolean -) : Serializable diff --git a/app/src/main/java/de/kuschku/quasseldroid/defaults/DefaultNetworks.kt b/app/src/main/java/de/kuschku/quasseldroid/defaults/DefaultNetworks.kt deleted file mode 100644 index c9f4fdc86ac09cd9af79654168cf4f1a8036e79f..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/defaults/DefaultNetworks.kt +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.defaults - -import android.content.Context -import com.google.gson.Gson -import com.google.gson.reflect.TypeToken -import java.io.IOException -import javax.inject.Inject - -class DefaultNetworks @Inject constructor(context: Context, gson: Gson) { - val networks: List<DefaultNetwork> by lazy { - try { - context.assets.open("networks.json").use { - gson.fromJson<List<DefaultNetwork>>( - it.bufferedReader(Charsets.UTF_8), - object : TypeToken<List<DefaultNetwork>>() {}.type - ) - } - } catch (e: IOException) { - throw IllegalStateException("networks.json missing from assets.", e) - } - } -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/defaults/Defaults.kt b/app/src/main/java/de/kuschku/quasseldroid/defaults/Defaults.kt deleted file mode 100644 index 42407e32caec4e051dffe8df207608cd3f50e7b6..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/defaults/Defaults.kt +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.defaults - -import android.content.Context -import de.kuschku.libquassel.protocol.Buffer_Activity -import de.kuschku.libquassel.protocol.Buffer_Type -import de.kuschku.libquassel.protocol.NetworkId -import de.kuschku.libquassel.quassel.syncables.BufferViewConfig -import de.kuschku.libquassel.quassel.syncables.Identity -import de.kuschku.libquassel.quassel.syncables.Network -import de.kuschku.libquassel.session.SignalProxy -import de.kuschku.quasseldroid.R -import java.util.* - -object Defaults { - fun bufferViewConfigInitial(context: Context, proxy: SignalProxy = SignalProxy.NULL) = - bufferViewConfig(context, proxy).apply { - setBufferViewName(context.getString(R.string.default_bufferviewconfig_name)) - } - - fun bufferViewConfig(context: Context, proxy: SignalProxy = SignalProxy.NULL) = - BufferViewConfig(-1, proxy).apply { - setAllowedBufferTypes(Buffer_Type.of( - Buffer_Type.StatusBuffer, Buffer_Type.ChannelBuffer, Buffer_Type.QueryBuffer - )) - setHideInactiveBuffers(false) - setHideInactiveNetworks(false) - setAddNewBuffersAutomatically(true) - setSortAlphabetically(true) - setShowSearch(true) - setDisableDecoration(false) - setMinimumActivity(Buffer_Activity.NoActivity.toInt()) - } - - fun identity(context: Context, proxy: SignalProxy = SignalProxy.NULL) = - Identity(proxy).apply { - setIdentityName("") - setRealName(context.getString(R.string.default_identity_realname)) - setNicks(listOf(context.getString(R.string.default_identity_nick, Random().nextInt(16)))) - setAwayNick("") - setAwayNickEnabled(false) - setAwayReason(context.getString(R.string.default_identity_awayreason)) - setAwayReasonEnabled(true) - setAutoAwayEnabled(false) - setAutoAwayTime(10) - setAutoAwayReason(context.getString(R.string.default_identity_autoawayreason)) - setAutoAwayReasonEnabled(false) - setDetachAwayEnabled(false) - setDetachAwayReason(context.getString(R.string.default_identity_detachawayreason)) - setDetachAwayReasonEnabled(false) - setIdent(context.getString(R.string.default_identity_ident)) - setKickReason(context.getString(R.string.default_identity_kickreason)) - setPartReason(context.getString(R.string.default_identity_partreason)) - setQuitReason(context.getString(R.string.default_identity_quitreason)) - } - - fun network(context: Context, proxy: SignalProxy = SignalProxy.NULL) = - Network(NetworkId(-1), proxy).apply { - setNetworkName("") - } -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/service/AndroidHeartBeatRunner.kt b/app/src/main/java/de/kuschku/quasseldroid/service/AndroidHeartBeatRunner.kt deleted file mode 100644 index d4e0422f34dbd0dba00a1c7d34905b9638c874d2..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/service/AndroidHeartBeatRunner.kt +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.service - -import android.os.Handler -import de.kuschku.libquassel.protocol.message.SignalProxyMessage -import de.kuschku.libquassel.session.HeartBeatRunner -import de.kuschku.libquassel.util.compatibility.LoggingHandler.Companion.log -import de.kuschku.libquassel.util.compatibility.LoggingHandler.LogLevel.INFO -import org.threeten.bp.Duration -import org.threeten.bp.Instant - -class AndroidHeartBeatRunner : HeartBeatRunner { - private val handler = Handler() - private var running = true - private var lastHeartBeatReply: Instant = Instant.now() - private var lastHeartBeatSend: Instant = Instant.now() - - private var closeCallback: (() -> Unit)? = null - private var heartbeatDispatchCallback: ((SignalProxyMessage.HeartBeat) -> Unit)? = null - - override fun setCloseCallback(callback: (() -> Unit)?) { - this.closeCallback = callback - } - - override fun setHeartbeatDispatchCallback(callback: ((SignalProxyMessage.HeartBeat) -> Unit)?) { - this.heartbeatDispatchCallback = callback - } - - override fun start() { - if (running) { - val duration = Duration.between(lastHeartBeatReply, lastHeartBeatSend).toMillis() - if (duration > TIMEOUT) { - log(INFO, "Heartbeat", "Ping Timeout: Last Response ${duration}ms ago") - closeCallback?.invoke() - } else { - log(INFO, "Heartbeat", "Sending Heartbeat") - val now = Instant.now() - lastHeartBeatSend = now - heartbeatDispatchCallback?.invoke(SignalProxyMessage.HeartBeat(now)) - } - handler.postDelayed(::start, DELAY) - } - } - - override fun end() { - running = false - setCloseCallback(null) - setHeartbeatDispatchCallback(null) - } - - override fun setLastHeartBeatReply(time: Instant) { - this.lastHeartBeatReply = time - } - - companion object { - const val TIMEOUT = 90_000L - const val DELAY = 30_000L - } -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/service/AsyncBackend.kt b/app/src/main/java/de/kuschku/quasseldroid/service/AsyncBackend.kt deleted file mode 100644 index f3df93f564210c8cb554295fb809f99b813d8a21..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/service/AsyncBackend.kt +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.service - -import de.kuschku.libquassel.protocol.BufferId -import de.kuschku.libquassel.util.compatibility.HandlerService -import de.kuschku.quasseldroid.Backend - -class AsyncBackend( - private val handler: HandlerService, - private val backend: Backend -) : Backend { - private var disconnectCallback: (() -> Unit)? = null - - fun setDisconnectCallback(callback: (() -> Unit)?) { - this.disconnectCallback = callback - } - - override fun updateUserDataAndLogin(user: String, pass: String) { - handler.backend { - backend.updateUserDataAndLogin(user, pass) - } - } - - override fun autoConnect( - ignoreConnectionState: Boolean, - ignoreSetting: Boolean, - ignoreErrors: Boolean, - connectionInfo: Backend.ConnectionInfo? - ) { - handler.backend { - backend.autoConnect( - ignoreConnectionState, - ignoreSetting, - ignoreErrors, - connectionInfo - ) - } - } - - override fun disconnect(forever: Boolean) { - handler.backend { - backend.disconnect(forever) - if (forever) { - disconnectCallback - } - } - } - - override fun sessionManager() = backend.sessionManager() - - override fun requestConnectNewNetwork() { - backend.requestConnectNewNetwork() - } - - override fun setCurrentBuffer(id: BufferId) = backend.setCurrentBuffer(id) -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/service/BacklogRequester.kt b/app/src/main/java/de/kuschku/quasseldroid/service/BacklogRequester.kt deleted file mode 100644 index ae197b527ad4b704ea0106590bbc3257b8f67cbd..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/service/BacklogRequester.kt +++ /dev/null @@ -1,171 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.service - -import de.kuschku.libquassel.protocol.BufferId -import de.kuschku.libquassel.protocol.Message -import de.kuschku.libquassel.protocol.MsgId -import de.kuschku.libquassel.session.ISession -import de.kuschku.libquassel.util.Optional -import de.kuschku.libquassel.util.compatibility.LoggingHandler.Companion.log -import de.kuschku.libquassel.util.compatibility.LoggingHandler.LogLevel.DEBUG -import de.kuschku.libquassel.util.helper.value -import de.kuschku.quasseldroid.persistence.dao.findById -import de.kuschku.quasseldroid.persistence.dao.findFirstByBufferId -import de.kuschku.quasseldroid.persistence.dao.findLastByBufferId -import de.kuschku.quasseldroid.persistence.dao.get -import de.kuschku.quasseldroid.persistence.db.AccountDatabase -import de.kuschku.quasseldroid.persistence.db.QuasselDatabase -import de.kuschku.quasseldroid.persistence.util.AccountId -import de.kuschku.quasseldroid.persistence.util.QuasselBacklogStorage -import io.reactivex.Observable - -class BacklogRequester( - private val session: Observable<Optional<ISession>>, - private val database: QuasselDatabase, - private val accountDatabase: AccountDatabase -) { - fun loadMoreBefore(accountId: AccountId, buffer: BufferId, amount: Int, pageSize: Int, - lastMessageId: MsgId? = null, - untilAllVisible: Boolean = false, - finishCallback: () -> Unit) { - log(DEBUG, - "BacklogRequester", - "requestedBefore(bufferId: $buffer, amount: $amount, pageSize: $pageSize, lastMessageId: $lastMessageId, untilAllVisible: $untilAllVisible)") - var missing = amount - session.value?.orNull()?.let { session: ISession -> - session.backlogManager.let { - val filtered = database.filtered().get( - accountId, - buffer, - accountDatabase.accounts().findById(accountId)?.defaultFiltered ?: 0 - ) - val msgId = lastMessageId - ?: database.message().findFirstByBufferId(buffer)?.messageId - ?: MsgId(-1) - log(DEBUG, - "BacklogRequester", - "requestBefore(bufferId: $buffer, first: -1, last: $msgId, limit: $amount)") - it.requestBacklog( - bufferId = buffer, - last = msgId, - limit = amount - ) { - val min = it.asSequence().map(Message::messageId).min() - val max = it.asSequence().map(Message::messageId).max() - log(DEBUG, - "BacklogRequester", - "receivedBefore(bufferId: $buffer, [$min-$max])") - if (min == max) { - // Do not change stored messages if we only got back one message - false - } else if (it.isNotEmpty()) { - missing -= it.count { - (it.type.value and filtered.toUInt().inv()) != 0u && - !QuasselBacklogStorage.isIgnored(session, it) - } - val hasLoadedAll = missing == 0 - val hasLoadedAny = missing < amount - if (untilAllVisible && !hasLoadedAll || !untilAllVisible && !hasLoadedAny) { - val messageId = it.map(Message::messageId).min() - loadMoreBefore(accountId, - buffer, - missing, - pageSize, - messageId, - untilAllVisible, - finishCallback) - true - } else { - finishCallback() - true - } - } else { - finishCallback() - true - } - } - } - } - } - fun loadMoreAfter(accountId: AccountId, buffer: BufferId, amount: Int, pageSize: Int, - lastMessageId: MsgId? = null, - untilAllVisible: Boolean = false, - finishCallback: () -> Unit) { - log(DEBUG, - "BacklogRequester", - "loadMoreAfter(bufferId: $buffer, amount: $amount, pageSize: $pageSize, lastMessageId: $lastMessageId, untilAllVisible: $untilAllVisible)") - var missing = amount - session.value?.orNull()?.let { session: ISession -> - session.backlogManager.let { - val filtered = database.filtered().get( - accountId, - buffer, - accountDatabase.accounts().findById(accountId)?.defaultFiltered ?: 0 - ) - val msgId = lastMessageId - ?: database.message().findLastByBufferId(buffer)?.messageId - ?: MsgId(0) - log(DEBUG, - "BacklogRequester", - "requestAfter(bufferId: $buffer, first: $msgId, last: -1, limit: $amount)") - it.requestBacklogForward( - bufferId = buffer, - first = msgId, - limit = amount - ) { - val min = it.asSequence().map(Message::messageId).min() - val max = it.asSequence().map(Message::messageId).max() - log(DEBUG, - "BacklogRequester", - "receivedAfter(bufferId: $buffer, [$min-$max])") - if (min == max) { - // Do not change stored messages if we only got back one message - false - } else if (it.isNotEmpty()) { - missing -= it.count { - (it.type.value and filtered.toUInt().inv()) != 0u && - !QuasselBacklogStorage.isIgnored(session, it) - } - val hasLoadedAll = missing == 0 - val hasLoadedAny = missing < amount - if (untilAllVisible && !hasLoadedAll || !untilAllVisible && !hasLoadedAny) { - val messageId = it.map(Message::messageId).max() - loadMoreAfter(accountId, - buffer, - missing, - pageSize, - messageId, - untilAllVisible, - finishCallback) - true - } else { - finishCallback() - true - } - } else { - finishCallback() - true - } - } - } - } - } -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/service/QuasselBinder.kt b/app/src/main/java/de/kuschku/quasseldroid/service/QuasselBinder.kt deleted file mode 100644 index a42987cfca895b2b9496bf940a070491407bbe11..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/service/QuasselBinder.kt +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.service - -import android.os.Binder -import de.kuschku.quasseldroid.Backend - -class QuasselBinder(val backend: Backend) : Binder() diff --git a/app/src/main/java/de/kuschku/quasseldroid/service/QuasselNotificationBackend.kt b/app/src/main/java/de/kuschku/quasseldroid/service/QuasselNotificationBackend.kt deleted file mode 100644 index efd1e427a2d9edbedef7983444542b626f10e284..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/service/QuasselNotificationBackend.kt +++ /dev/null @@ -1,385 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.service - -import android.content.Context -import android.graphics.Typeface -import android.graphics.drawable.Drawable -import android.text.SpannableStringBuilder -import androidx.annotation.ColorInt -import de.kuschku.libquassel.protocol.* -import de.kuschku.libquassel.quassel.BufferInfo -import de.kuschku.libquassel.quassel.ExtendedFeature -import de.kuschku.libquassel.quassel.syncables.IgnoreListManager -import de.kuschku.libquassel.session.ISession -import de.kuschku.libquassel.session.NotificationManager -import de.kuschku.libquassel.util.flag.hasFlag -import de.kuschku.libquassel.util.helper.clampOf -import de.kuschku.libquassel.util.helper.or -import de.kuschku.libquassel.util.irc.HostmaskHelper -import de.kuschku.libquassel.util.irc.SenderColorUtil -import de.kuschku.quasseldroid.GlideApp -import de.kuschku.quasseldroid.GlideRequest -import de.kuschku.quasseldroid.R -import de.kuschku.quasseldroid.persistence.dao.all -import de.kuschku.quasseldroid.persistence.dao.buffers -import de.kuschku.quasseldroid.persistence.dao.markRead -import de.kuschku.quasseldroid.persistence.db.QuasselDatabase -import de.kuschku.quasseldroid.persistence.models.NotificationData -import de.kuschku.quasseldroid.settings.AppearanceSettings -import de.kuschku.quasseldroid.settings.MessageSettings -import de.kuschku.quasseldroid.settings.NotificationSettings -import de.kuschku.quasseldroid.settings.Settings -import de.kuschku.quasseldroid.util.NotificationBuffer -import de.kuschku.quasseldroid.util.NotificationMessage -import de.kuschku.quasseldroid.util.avatars.AvatarHelper -import de.kuschku.quasseldroid.util.helper.getColorCompat -import de.kuschku.quasseldroid.util.helper.letIf -import de.kuschku.quasseldroid.util.helper.loadWithFallbacks -import de.kuschku.quasseldroid.util.helper.styledAttributes -import de.kuschku.quasseldroid.util.irc.format.ContentFormatter -import de.kuschku.quasseldroid.util.ui.drawable.TextDrawable -import de.kuschku.quasseldroid.viewmodel.helper.EditorViewModelHelper.Companion.IGNORED_CHARS -import org.threeten.bp.Instant -import java.util.concurrent.Executors -import java.util.concurrent.TimeUnit -import javax.inject.Inject - -class QuasselNotificationBackend @Inject constructor( - private val context: Context, - private val database: QuasselDatabase, - private val contentFormatter: ContentFormatter, - private val notificationHandler: QuasseldroidNotificationManager -) : NotificationManager { - private var notificationSettings: NotificationSettings - private var appearanceSettings: AppearanceSettings - private var messageSettings: MessageSettings - private val executor = Executors.newSingleThreadScheduledExecutor() - - @ColorInt - private var selfColor: Int - private var senderColors: IntArray - - @ColorInt - private var colorBackground: Int - - private var initTime: Instant = Instant.EPOCH - - init { - notificationSettings = Settings.notification(context) - appearanceSettings = Settings.appearance(context) - messageSettings = Settings.message(context) - - context.setTheme(appearanceSettings.theme.style) - senderColors = context.theme.styledAttributes( - R.attr.senderColor0, R.attr.senderColor1, R.attr.senderColor2, R.attr.senderColor3, - R.attr.senderColor4, R.attr.senderColor5, R.attr.senderColor6, R.attr.senderColor7, - R.attr.senderColor8, R.attr.senderColor9, R.attr.senderColorA, R.attr.senderColorB, - R.attr.senderColorC, R.attr.senderColorD, R.attr.senderColorE, R.attr.senderColorF - ) { - IntArray(16) { - getColor(it, 0) - } - } - selfColor = context.getColorCompat(R.color.material_dark_background) - colorBackground = context.theme.styledAttributes(R.attr.colorBackground) { - getColor(0, 0) - } - } - - override fun init(session: ISession) { - initTime = Instant.now() - if (session.features.negotiated.hasFeature(ExtendedFeature.BacklogFilterType)) { - val buffers = session.bufferSyncer.bufferInfos() - for (buffer in buffers) { - val lastSeenId = session.bufferSyncer.lastSeenMsg(buffer.bufferId) - database.notifications().markRead(buffer.bufferId, lastSeenId) - - val level = buffer.type.let { - when { - it hasFlag Buffer_Type.QueryBuffer -> notificationSettings.query - it hasFlag Buffer_Type.ChannelBuffer -> notificationSettings.channel - else -> notificationSettings.other - } - } - - when (level) { - NotificationSettings.Level.ALL -> { - val activity = session.bufferSyncer.activity(buffer.bufferId) - if (activity.hasFlag(Message_Type.Plain) || - activity.hasFlag(Message_Type.Action) || - activity.hasFlag(Message_Type.Notice)) - session.backlogManager.requestBacklogFiltered( - buffer.bufferId, lastSeenId, MsgId(-1), 20, 0, - Message_Type.of(Message_Type.Plain, - Message_Type.Action, - Message_Type.Notice).toInt(), - 0 - ) { - processMessages(session, true, *it.toTypedArray()) - false - } - } - NotificationSettings.Level.HIGHLIGHT -> { - val highlightCount = session.bufferSyncer.highlightCount(buffer.bufferId) - if (highlightCount != 0) { - session.backlogManager.requestBacklogFiltered( - buffer.bufferId, lastSeenId, MsgId(-1), 20, 0, - Message_Type.of(Message_Type.Plain, - Message_Type.Action, - Message_Type.Notice).toInt(), - Message_Flag.of(Message_Flag.Highlight).toInt() - ) { - processMessages(session, true, *it.toTypedArray()) - false - } - } - } - NotificationSettings.Level.NONE -> { - // We don’t want notifications for this type of channel, so we won’t get any. - } - } - } - - // Cleanup - val removedBuffers = database.notifications().buffers().minus(buffers.map(BufferInfo::bufferId)) - for (removedBuffer in removedBuffers) { - database.notifications().markRead(removedBuffer, MsgId.MAX_VALUE) - } - - // Update notifications to have actions - showConnectedNotifications() - } - } - - fun updateSettings() { - notificationHandler.updateTranslation() - - notificationSettings = Settings.notification(context) - appearanceSettings = Settings.appearance(context) - messageSettings = Settings.message(context) - - context.setTheme(appearanceSettings.theme.style) - senderColors = context.theme.styledAttributes( - R.attr.senderColor0, R.attr.senderColor1, R.attr.senderColor2, R.attr.senderColor3, - R.attr.senderColor4, R.attr.senderColor5, R.attr.senderColor6, R.attr.senderColor7, - R.attr.senderColor8, R.attr.senderColor9, R.attr.senderColorA, R.attr.senderColorB, - R.attr.senderColorC, R.attr.senderColorD, R.attr.senderColorE, R.attr.senderColorF - ) { - IntArray(16) { - getColor(it, 0) - } - } - selfColor = context.getColorCompat(R.color.material_dark_background) - colorBackground = context.theme.styledAttributes(R.attr.colorBackground) { - getColor(0, 0) - } - } - - @Synchronized - override fun processMessages(session: ISession, show: Boolean, vararg messages: Message) { - val now = Instant.now() - val results = messages.filter { - val level = it.bufferInfo.type.let { - when { - it hasFlag Buffer_Type.QueryBuffer -> notificationSettings.query - it hasFlag Buffer_Type.ChannelBuffer -> notificationSettings.channel - else -> notificationSettings.other - } - } - - when (level) { - NotificationSettings.Level.ALL -> true - NotificationSettings.Level.HIGHLIGHT -> it.flag.hasFlag(Message_Flag.Highlight) - NotificationSettings.Level.NONE -> false - } - }.filter { - val bufferName = it.bufferInfo.bufferName ?: "" - val networkId = it.bufferInfo.networkId - val networkName = session.network(networkId)?.networkName() ?: "" - - session.ignoreListManager.match( - it.content, it.sender, it.type, networkName, bufferName - ) == IgnoreListManager.StrictnessType.UnmatchedStrictness - }.filter { - it.type.hasFlag(Message_Type.Plain) || - it.type.hasFlag(Message_Type.Notice) || - it.type.hasFlag(Message_Type.Action) - }.filter { - !it.flag.hasFlag(Message_Flag.Self) - }.filter { - it.messageId > session.bufferSyncer.lastSeenMsg(it.bufferInfo.bufferId) - }.map { - val network = session.network(it.bufferInfo.networkId) - val me = network?.me() - NotificationData.of( - messageId = it.messageId, - creationTime = now, - time = it.time, - type = it.type, - flag = it.flag, - bufferId = it.bufferInfo.bufferId, - bufferName = it.bufferInfo.bufferName ?: "", - bufferType = it.bufferInfo.type, - networkId = it.bufferInfo.networkId, - networkName = network?.networkName() ?: "", - sender = it.sender, - senderPrefixes = it.senderPrefixes, - realName = it.realName, - avatarUrl = it.avatarUrl, - content = it.content, - ownNick = me?.nick() ?: "", - ownIdent = me?.user() ?: "", - ownRealName = me?.realName() ?: "", - ownAvatarUrl = "", - hidden = false - ) - } - database.notifications().save(*results.toTypedArray()) - if (show) { - executor.schedule( - { - results.map(NotificationData::bufferId).distinct().forEach { buffer -> - this.showNotification(buffer) - } - }, - clampOf(session.lag.or(0) * 3 + 100, 16, 3_000), - TimeUnit.MILLISECONDS - ) - } - } - - fun showConnectedNotifications() { - database.notifications().buffers().forEach { buffer -> - this.showNotification(buffer, true) - } - } - - fun showDisconnectedNotifications() { - database.notifications().buffers().forEach { buffer -> - this.showNotification(buffer, false) - } - } - - @Synchronized - private fun showNotification(buffer: BufferId, isConnected: Boolean = true) { - val data = database.notifications().all(buffer) - data.lastOrNull()?.let { - // Only send a loud notification if it has any new messages - val max = data.maxBy { it.creationTime } - val isLoud = max?.creationTime?.isAfter(initTime) == true - - val buffer = NotificationBuffer( - id = it.bufferId, - name = it.bufferName, - type = it.bufferType, - networkName = it.networkName - ) - - val size = context.resources.getDimensionPixelSize(R.dimen.notification_avatar_width) - val radius = context.resources.getDimensionPixelSize(R.dimen.avatar_radius) - val unknownSenderLabel = context.getString(R.string.label_unknown_sender) - - fun obtainAvatar(nickName: String, ident: String, realName: String, avatarUrl: String, - self: Boolean): Drawable { - val senderColorIndex = SenderColorUtil.senderColor(nickName) - val rawInitial = nickName.trimStart(*IGNORED_CHARS) - .firstOrNull() ?: nickName.firstOrNull() - val initial = rawInitial?.toUpperCase().toString() - val senderColor = when (messageSettings.colorizeNicknames) { - MessageSettings.SenderColorMode.ALL -> senderColors[senderColorIndex] - MessageSettings.SenderColorMode.ALL_BUT_MINE -> - if (self) selfColor - else senderColors[senderColorIndex] - MessageSettings.SenderColorMode.NONE -> selfColor - } - - val avatarList = AvatarHelper.avatar(messageSettings, ident, realName, avatarUrl, size) - val avatarResult = try { - GlideApp.with(context).loadWithFallbacks(avatarList) - ?.letIf(!messageSettings.squareAvatars, GlideRequest<Drawable>::optionalCircleCrop) - ?.placeholder(TextDrawable.builder().beginConfig() - .textColor((colorBackground and 0xFFFFFF) or (0x8A shl 24)).useFont( - Typeface.DEFAULT_BOLD).endConfig().let { - if (messageSettings.squareAvatars) it.buildRoundRect(initial, senderColor, radius) - else it.buildRound(initial, senderColor) - }) - ?.submit(size, size) - ?.get() - } catch (_: Throwable) { - null - } - return avatarResult ?: TextDrawable.builder().beginConfig() - .textColor((colorBackground and 0xFFFFFF) or (0x8A shl 24)).useFont(Typeface.DEFAULT_BOLD).endConfig().let { - if (messageSettings.squareAvatars) it.buildRoundRect(initial, senderColor, radius) - else it.buildRound(initial, senderColor) - } - } - - val selfInfo = SelfInfo( - nick = if (it.ownNick.isNotEmpty()) it.ownNick else unknownSenderLabel, - avatar = obtainAvatar( - it.ownNick, - it.ownIdent, - it.ownRealName, - it.ownAvatarUrl, - true - ) - ) - - val notificationData = data.map { - val nick = SpannableStringBuilder().apply { - append(contentFormatter.formatPrefix(it.senderPrefixes)) - append(contentFormatter.formatNick( - it.sender, - senderColors = senderColors, - selfColor = selfColor - )) - } - val (content, _) = contentFormatter.formatContent(it.content, false, false, it.networkId) - - NotificationMessage( - messageId = it.messageId, - fullSender = it.sender, - sender = if (nick.isNotEmpty()) nick else unknownSenderLabel, - content = content, - time = it.time, - avatar = obtainAvatar( - HostmaskHelper.nick(it.sender), - HostmaskHelper.user(it.sender), - it.realName, - it.avatarUrl, - it.flag.hasFlag(Message_Flag.Self) - ) - ) - } - val notification = notificationHandler.notificationMessage( - notificationSettings, buffer, selfInfo, notificationData, isLoud, isConnected - ) - notificationHandler.notify(notification) - } ?: notificationHandler.remove(buffer.id) - } - - @Synchronized - override fun clear(buffer: BufferId, lastRead: MsgId) { - database.notifications().markRead(buffer, lastRead) - showNotification(buffer) - } -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/service/QuasselService.kt b/app/src/main/java/de/kuschku/quasseldroid/service/QuasselService.kt deleted file mode 100644 index 0f76857082273545144eb187aa28fc0da8082421..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/service/QuasselService.kt +++ /dev/null @@ -1,574 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.service - -import android.content.ComponentName -import android.content.Context -import android.content.Intent -import android.content.SharedPreferences -import android.text.SpannableString -import androidx.core.app.RemoteInput -import androidx.lifecycle.Observer -import com.github.pwittchen.reactivenetwork.library.rx2.ReactiveNetwork -import de.kuschku.libquassel.connection.ConnectionState -import de.kuschku.libquassel.connection.SocketAddress -import de.kuschku.libquassel.protocol.* -import de.kuschku.libquassel.quassel.BufferInfo -import de.kuschku.libquassel.quassel.QuasselFeatures -import de.kuschku.libquassel.quassel.syncables.interfaces.IAliasManager -import de.kuschku.libquassel.session.ISession -import de.kuschku.libquassel.session.Session -import de.kuschku.libquassel.session.SessionManager -import de.kuschku.libquassel.session.manager.ConnectionInfo -import de.kuschku.libquassel.util.compatibility.LoggingHandler.Companion.log -import de.kuschku.libquassel.util.compatibility.LoggingHandler.LogLevel.INFO -import de.kuschku.libquassel.util.helper.clampOf -import de.kuschku.libquassel.util.helper.value -import de.kuschku.malheur.CrashHandler -import de.kuschku.quasseldroid.Backend -import de.kuschku.quasseldroid.BuildConfig -import de.kuschku.quasseldroid.Keys -import de.kuschku.quasseldroid.R -import de.kuschku.quasseldroid.defaults.Defaults -import de.kuschku.quasseldroid.persistence.dao.* -import de.kuschku.quasseldroid.persistence.db.AccountDatabase -import de.kuschku.quasseldroid.persistence.db.QuasselDatabase -import de.kuschku.quasseldroid.persistence.util.AccountId -import de.kuschku.quasseldroid.persistence.util.QuasselBacklogStorage -import de.kuschku.quasseldroid.settings.ConnectionSettings -import de.kuschku.quasseldroid.settings.NotificationSettings -import de.kuschku.quasseldroid.settings.Settings -import de.kuschku.quasseldroid.ssl.QuasselHostnameVerifier -import de.kuschku.quasseldroid.ssl.QuasselTrustManager -import de.kuschku.quasseldroid.ssl.custom.QuasselCertificateManager -import de.kuschku.quasseldroid.ssl.custom.QuasselHostnameManager -import de.kuschku.quasseldroid.util.backport.DaggerLifecycleService -import de.kuschku.quasseldroid.util.compatibility.AndroidHandlerService -import de.kuschku.quasseldroid.util.helper.* -import de.kuschku.quasseldroid.util.irc.format.IrcFormatSerializer -import de.kuschku.quasseldroid.util.ui.LocaleHelper -import io.reactivex.subjects.BehaviorSubject -import org.threeten.bp.Instant -import javax.inject.Inject -import javax.net.ssl.HostnameVerifier -import javax.net.ssl.X509TrustManager - -class QuasselService : DaggerLifecycleService(), - SharedPreferences.OnSharedPreferenceChangeListener { - @Inject - lateinit var connectionSettings: ConnectionSettings - - @Inject - lateinit var notificationSettings: NotificationSettings - - private lateinit var translatedLocale: Context - - override fun onSharedPreferenceChanged(sharedPreferences: SharedPreferences?, key: String?) { - update() - translatedLocale = LocaleHelper.setLocale(this) - notificationBackend.updateSettings() - } - - private fun update() { - this.notificationSettings = Settings.notification(this) - val connectionSettings = Settings.connection(this) - - if (this.connectionSettings.showNotification != connectionSettings.showNotification) { - updateNotificationStatus(this.progress) - } - this.connectionSettings = connectionSettings - - val (accountId, reconnect) = this.sharedPreferences(Keys.Status.NAME, Context.MODE_PRIVATE) { - Pair( - AccountId(getLong(Keys.Status.selectedAccount, -1)), - getBoolean(Keys.Status.reconnect, false) - ) - } - if (this.accountId != accountId || this.reconnect != reconnect) { - this.accountId = accountId - this.reconnect = reconnect - - handlerService.backend { - val account = if (accountId.isValidId() && reconnect) { - accountDatabase.accounts().findById(accountId) - } else { - null - } - - if (account == null) { - backendImplementation.disconnect(true) - stopSelf() - } else { - backendImplementation.autoConnect( - connectionInfo = Backend.ConnectionInfo( - SocketAddress(account.host, account.port), - account.user, - account.pass, - account.requireSsl, - true - ) - ) - } - } - } else if (!accountId.isValidId() || !reconnect) { - handlerService.backend { - backendImplementation.disconnect(true) - stopSelf() - } - } - } - - private var accountId: AccountId = AccountId(-1) - set(value) { - field = value - liveAccountId.onNext(value) - } - private var liveAccountId = BehaviorSubject.createDefault(AccountId(-1L)) - private var reconnect: Boolean = false - - @Inject - lateinit var notificationManager: QuasseldroidNotificationManager - - @Inject - lateinit var notificationBackend: QuasselNotificationBackend - - @Inject - lateinit var ircFormatSerializer: IrcFormatSerializer - - private var notificationHandle: QuasseldroidNotificationManager.Handle? = null - private var progress = Triple(ConnectionState.DISCONNECTED, 0, 0) - - private fun updateNotificationStatus(rawProgress: Triple<ConnectionState, Int, Int>) { - if (connectionSettings.showNotification) { - val notificationHandle = notificationManager.notificationBackground() - this.notificationHandle = notificationHandle - updateNotification(notificationHandle, rawProgress) - startForeground(notificationHandle.id, notificationHandle.builder.build()) - } else { - this.notificationHandle = null - stopForeground(true) - } - } - - override fun onStartCommand(intent: Intent?, flags: Int, startId: Int): Int { - val result = super.onStartCommand(intent, flags, startId) - handleIntent(intent) - return result - } - - private fun handleIntent(intent: Intent?) { - if (intent == null) return - - if (intent.getBooleanExtra("disconnect", false)) { - sharedPreferences(Keys.Status.NAME, Context.MODE_PRIVATE) { - editApply { - putBoolean(Keys.Status.reconnect, false) - } - } - } - - val bufferId = BufferId(intent.getIntExtra("bufferId", -1)) - - val inputResults = RemoteInput.getResultsFromIntent(intent)?.getCharSequence("reply_content") - if (inputResults != null && bufferId.isValidId()) { - if (inputResults.isNotBlank()) { - val lines = inputResults.lineSequence().map { - it.toString() to ircFormatSerializer.toEscapeCodes(SpannableString(it)) - } - - sessionManager.connectedSession.value?.let { session -> - session.bufferSyncer.bufferInfo(bufferId)?.also { bufferInfo -> - val output = mutableListOf<IAliasManager.Command>() - for ((_, formatted) in lines) { - session.aliasManager.processInput(bufferInfo, formatted, output) - } - for (command in output) { - session.rpcHandler.sendInput(command.buffer, command.message) - } - } - handlerService.backend { - notificationBackend.showConnectedNotifications() - } - } - } - } else { - val clearMessageId = MsgId(intent.getLongExtra("mark_read_message", -1)) - if (bufferId.isValidId() && clearMessageId.isValidId()) { - sessionManager.connectedSession.value?.bufferSyncer?.requestSetLastSeenMsg(bufferId, - clearMessageId) - sessionManager.connectedSession.value?.bufferSyncer?.requestMarkBufferAsRead(bufferId) - } - - val hideMessageId = MsgId(intent.getLongExtra("hide_message", -1)) - if (bufferId.isValidId() && hideMessageId.isValidId()) { - if (notificationSettings.markReadOnSwipe) { - sessionManager.connectedSession.value?.bufferSyncer?.requestSetLastSeenMsg(bufferId, - hideMessageId) - sessionManager.connectedSession.value?.bufferSyncer?.requestMarkBufferAsRead(bufferId) - } else { - handlerService.backend { - database.notifications().markHidden(bufferId, hideMessageId) - } - } - } - } - } - - private fun updateNotification(handle: QuasseldroidNotificationManager.Handle, - rawProgress: Triple<ConnectionState, Int, Int>) { - val (state, progress, max) = rawProgress - when (state) { - ConnectionState.DISCONNECTED -> { - handle.builder.setContentTitle(getString(R.string.label_status_disconnected)) - handle.builder.setProgress(0, 0, true) - } - ConnectionState.CONNECTING -> { - handle.builder.setContentTitle(getString(R.string.label_status_connecting)) - handle.builder.setProgress(max, progress, true) - } - ConnectionState.HANDSHAKE -> { - handle.builder.setContentTitle(getString(R.string.label_status_handshake)) - handle.builder.setProgress(max, progress, true) - } - ConnectionState.INIT -> { - handle.builder.setContentTitle(getString(R.string.label_status_init)) - // Show indeterminate when no progress has been made yet - handle.builder.setProgress(max, progress, progress == 0 || max == 0) - } - ConnectionState.CONNECTED -> { - handle.builder.setContentTitle(getString(R.string.label_status_connected)) - handle.builder.setProgress(0, 0, false) - } - ConnectionState.CLOSED -> { - handle.builder.setContentTitle(getString(R.string.label_status_closed)) - handle.builder.setProgress(0, 0, false) - } - } - } - - private lateinit var sessionManager: SessionManager - - private lateinit var clientData: ClientData - - private lateinit var trustManager: X509TrustManager - - private lateinit var hostnameVerifier: HostnameVerifier - - private lateinit var certificateManager: QuasselCertificateManager - - class BackendImplementation : Backend { - var service: QuasselService? = null - - override fun updateUserDataAndLogin(user: String, pass: String) { - service?.apply { - accountDatabase.accounts().findById(accountId)?.let { old -> - accountDatabase.accounts().save(old.copy(user = user, pass = pass)) - sessionManager.login(user, pass) - } - } - } - - override fun sessionManager() = service?.sessionManager - - override fun autoConnect( - ignoreConnectionState: Boolean, - ignoreSetting: Boolean, - ignoreErrors: Boolean, - connectionInfo: Backend.ConnectionInfo? - ) { - service?.apply { - if (connectionInfo != null) { - sessionManager.autoConnect( - ignoreConnectionState, - ignoreSetting, - ignoreErrors, - ConnectionInfo( - clientData = clientData, - trustManager = trustManager, - hostnameVerifier = hostnameVerifier, - address = connectionInfo.address, - userData = Pair(connectionInfo.username, - connectionInfo.password), - requireSsl = connectionInfo.requireSsl, - shouldReconnect = connectionInfo.shouldReconnect - ) - ) - } else { - sessionManager.autoConnect(ignoreConnectionState, ignoreSetting, ignoreErrors) - } - } - } - - override fun disconnect(forever: Boolean) { - service?.apply { - sessionManager.disconnect(forever) - } - } - - override fun requestConnectNewNetwork() { - service?.apply { - sessionManager.connectedSession.flatMap(ISession::liveNetworkAdded).firstElement().flatMap { id -> - sessionManager.connectedSession.flatMap(ISession::liveNetworks) - .map { it[id] } - .flatMap { network -> - network.liveInitialized - .filter { it } - .map { network } - }.firstElement() - }.toLiveData().observe(this, Observer { - it?.requestConnect() - }) - } - } - - override fun setCurrentBuffer(id: BufferId) { - service?.currentBuffer?.onNext(id) - } - } - - private val backendImplementation = BackendImplementation() - - private val handlerService = AndroidHandlerService() - - private val asyncBackend = AsyncBackend(handlerService, backendImplementation) - - @Inject - lateinit var database: QuasselDatabase - - @Inject - lateinit var accountDatabase: AccountDatabase - - lateinit var currentBuffer: BehaviorSubject<BufferId> - - private fun disconnectFromCore() { - getSharedPreferences(Keys.Status.NAME, Context.MODE_PRIVATE).editCommit { - putBoolean(Keys.Status.reconnect, false) - } - } - - override fun onCreate() { - super.onCreate() - - backendImplementation.service = this - asyncBackend.setDisconnectCallback(::stopSelf) - - translatedLocale = LocaleHelper.setLocale(this) - - certificateManager = QuasselCertificateManager(database.validityWhitelist()) - hostnameVerifier = QuasselHostnameVerifier(QuasselHostnameManager(database.hostnameWhitelist())) - trustManager = QuasselTrustManager(certificateManager) - - val backlogStorage = QuasselBacklogStorage(database) - currentBuffer = backlogStorage.currentBuffer - sessionManager = SessionManager( - ISession.NULL, - backlogStorage, - notificationBackend, - handlerService, - ::AndroidHeartBeatRunner, - CrashHandler::handle - ) - - sessionManager.setDisconnectFromCore(::disconnectFromCore) - sessionManager.setInitCallback(::initCallback) - - clientData = ClientData( - identifier = "${resources.getString(R.string.app_name)} ${BuildConfig.FANCY_VERSION_NAME}", - buildDate = Instant.ofEpochSecond(BuildConfig.GIT_COMMIT_DATE), - clientFeatures = QuasselFeatures.all(), - protocolFeatures = Protocol_Features.of( - Protocol_Feature.Compression, - Protocol_Feature.TLS - ), - supportedProtocols = listOf(Protocol.Datastream) - ) - - sessionManager.connectionProgress.toLiveData().observe(this, Observer { - if (this.progress.first != it?.first && it?.first == ConnectionState.CONNECTED) { - handlerService.backend { - database.message().clearMessages() - } - } - val rawProgress = it ?: Triple(ConnectionState.DISCONNECTED, 0, 0) - this.progress = rawProgress - val handle = this.notificationHandle - if (handle != null) { - updateNotification(handle, rawProgress) - notificationManager.notify(handle) - } - }) - - ReactiveNetwork - .observeNetworkConnectivity(applicationContext) - .toLiveData() - .observe(this, Observer { connectivity -> - if (!connectionSettings.ignoreNetworkChanges) { - log(INFO, "QuasselService", "Connectivity changed: $connectivity") - handlerService.backend { - log(INFO, "QuasselService", "Reconnect triggered: Network changed") - sessionManager.autoConnect( - ignoreConnectionState = true, - ignoreSetting = true - ) - } - } - }) - - sessionManager.state - .distinctUntilChanged() - .toLiveData() - .observe( - this, Observer { - handlerService.backend { - if (it == ConnectionState.HANDSHAKE) { - backoff = BACKOFF_MIN - } - - if (it == ConnectionState.CLOSED) { - scheduleReconnect() - notificationBackend.showDisconnectedNotifications() - } - } - }) - - sharedPreferences(Keys.Status.NAME, Context.MODE_PRIVATE) { - registerOnSharedPreferenceChangeListener(this@QuasselService) - } - sharedPreferences { - registerOnSharedPreferenceChangeListener(this@QuasselService) - } - - notificationManager.init() - - update() - updateNotificationStatus(this.progress) - } - - private var backoff = BACKOFF_MIN - private var scheduled = false - private fun scheduleReconnect() { - if (!scheduled && sessionManager.canAutoReconnect(ignoreSetting = true)) { - log(INFO, "QuasselService", "Reconnect: Scheduling backoff in ${backoff / 1_000} seconds") - scheduled = true - handlerService.backendDelayed(backoff) { - log(INFO, "QuasselService", "Reconnect: Scheduled backoff happened") - scheduled = false - - backoff = clampOf(backoff * 2, BACKOFF_MIN, BACKOFF_MAX) - sessionManager.autoConnect(ignoreSetting = true) - } - } - } - - override fun onDestroy() { - sharedPreferences(Keys.Status.NAME, Context.MODE_PRIVATE) { - unregisterOnSharedPreferenceChangeListener(this@QuasselService) - } - sharedPreferences { - unregisterOnSharedPreferenceChangeListener(this@QuasselService) - } - - sessionManager.dispose() - asyncBackend.setDisconnectCallback(null) - backendImplementation.service = null - - notificationHandle?.let { notificationManager.remove(it) } - super.onDestroy() - } - - override fun onBind(intent: Intent?): QuasselBinder { - super.onBind(intent) - return QuasselBinder(asyncBackend) - } - - private fun initCallback(session: Session) { - if (session.bufferViewManager.bufferViewConfigs().isEmpty()) { - session.bufferViewManager.requestCreateBufferView( - Defaults.bufferViewConfigInitial(translatedLocale).apply { - for (info in session.bufferSyncer.bufferInfos()) { - handleBuffer(info, session.bufferSyncer) - } - }.toVariantMap() - ) - } - - // Cleanup deleted buffers from cache - - val buffers = session.bufferSyncer.bufferInfos().map(BufferInfo::bufferId) - - val deletedBuffersMessage = database.message().buffers().toSet() - buffers - log(INFO, "QuasselService", "Buffers deleted from message storage: $deletedBuffersMessage") - for (deletedBuffer in deletedBuffersMessage) { - database.message().clearMessages(deletedBuffer.id) - } - - val deletedBuffersFiltered = database.filtered().buffers(accountId).toSet() - buffers - log(INFO, "QuasselService", "Buffers deleted from filtered storage: $deletedBuffersFiltered") - for (deletedBuffer in deletedBuffersFiltered) { - database.filtered().clear(accountId, deletedBuffer) - } - - val deletedBuffersNotifications = database.notifications().buffers().toSet() - buffers - log(INFO, - "QuasselService", - "Buffers deleted from notification storage: $deletedBuffersNotifications") - for (deletedBuffer in deletedBuffersNotifications) { - database.notifications().markReadNormal(deletedBuffer) - } - } - - companion object { - // default backoff is 5 seconds - const val BACKOFF_MIN = 5_000L - // max is 30 minutes - const val BACKOFF_MAX = 1_800_000L - - fun launch( - context: Context, - disconnect: Boolean? = null, - markRead: BufferId? = null, - markReadMessage: MsgId? = null, - hideMessage: MsgId? = null - ): ComponentName? = context.startService( - intent(context, disconnect, markRead, markReadMessage, hideMessage) - ) - - fun intent( - context: Context, - disconnect: Boolean? = null, - bufferId: BufferId? = null, - markReadMessage: MsgId? = null, - hideMessage: MsgId? = null - ) = Intent(context, QuasselService::class.java).apply { - if (disconnect != null) { - putExtra("disconnect", disconnect) - } - if (bufferId != null) { - putExtra("bufferId", bufferId.id) - } - if (markReadMessage != null) { - putExtra("mark_read_message", markReadMessage.id) - } - if (hideMessage != null) { - putExtra("hide_message", hideMessage.id) - } - } - } -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/service/QuasselServiceModule.kt b/app/src/main/java/de/kuschku/quasseldroid/service/QuasselServiceModule.kt deleted file mode 100644 index bdb1a9e68811abcc1a1fb76d6343400ed1417867..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/service/QuasselServiceModule.kt +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.service - -import android.content.Context -import dagger.Binds -import dagger.Module -import de.kuschku.quasseldroid.ui.chat.messages.MessageRenderer -import de.kuschku.quasseldroid.ui.chat.messages.QuasselMessageRenderer - -@Module -abstract class QuasselServiceModule { - @Binds - abstract fun bindContext(service: QuasselService): Context - - @Binds - abstract fun bindMessageRenderer(messageRenderer: QuasselMessageRenderer): MessageRenderer -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/service/QuasseldroidNotificationManager.kt b/app/src/main/java/de/kuschku/quasseldroid/service/QuasseldroidNotificationManager.kt deleted file mode 100644 index e123819c41d91fe451f56bce1e91591e85bdd75b..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/service/QuasseldroidNotificationManager.kt +++ /dev/null @@ -1,295 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.service - -import android.annotation.TargetApi -import android.app.Notification -import android.app.NotificationChannel -import android.app.NotificationManager -import android.app.PendingIntent -import android.content.Context -import android.content.Intent -import android.graphics.Bitmap -import android.graphics.Canvas -import android.graphics.drawable.Drawable -import android.net.Uri -import android.os.Build -import androidx.core.app.NotificationCompat -import androidx.core.app.NotificationManagerCompat -import androidx.core.app.Person -import androidx.core.app.RemoteInput -import androidx.core.graphics.drawable.IconCompat -import de.kuschku.libquassel.protocol.Buffer_Type -import de.kuschku.libquassel.util.flag.hasFlag -import de.kuschku.quasseldroid.R -import de.kuschku.quasseldroid.settings.NotificationSettings -import de.kuschku.quasseldroid.ui.chat.ChatActivity -import de.kuschku.quasseldroid.util.NotificationBuffer -import de.kuschku.quasseldroid.util.NotificationMessage -import de.kuschku.quasseldroid.util.helper.getColorCompat -import de.kuschku.quasseldroid.util.helper.letIf -import de.kuschku.quasseldroid.util.ui.LocaleHelper -import javax.inject.Inject - -class QuasseldroidNotificationManager @Inject constructor(private val context: Context) { - private val notificationManagerCompat = NotificationManagerCompat.from(context) - private var translatedLocale: Context = LocaleHelper.setLocale(context) - - fun updateTranslation() { - translatedLocale = LocaleHelper.setLocale(context) - } - - fun init() { - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) - prepareChannels() - } - - @TargetApi(Build.VERSION_CODES.O) - private fun prepareChannels() { - val notificationManager = context.getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager - notificationManager.createNotificationChannels( - listOf( - NotificationChannel( - translatedLocale.getString(R.string.notification_channel_background), - translatedLocale.getString(R.string.notification_channel_connection_title), - NotificationManager.IMPORTANCE_LOW - ), - NotificationChannel( - translatedLocale.getString(R.string.notification_channel_highlight), - translatedLocale.getString(R.string.notification_channel_highlight_title), - NotificationManager.IMPORTANCE_HIGH - ).apply { - enableLights(true) - enableVibration(true) - lightColor = context.getColorCompat(R.color.colorPrimary) - lockscreenVisibility = Notification.VISIBILITY_PRIVATE - }, - NotificationChannel( - translatedLocale.getString(R.string.notification_channel_old_highlight), - translatedLocale.getString(R.string.notification_channel_old_highlight_title), - NotificationManager.IMPORTANCE_DEFAULT - ).apply { - setSound(null, null) - enableLights(true) - enableVibration(false) - lightColor = context.getColorCompat(R.color.colorPrimary) - lockscreenVisibility = Notification.VISIBILITY_PRIVATE - } - ) - ) - } - - private fun bitmapFromDrawable(drawable: Drawable): Bitmap { - val bitmap = Bitmap.createBitmap( - context.resources.getDimensionPixelSize(R.dimen.notification_avatar_width), - context.resources.getDimensionPixelSize(R.dimen.notification_avatar_height), - Bitmap.Config.ARGB_8888 - ) - - val canvas = Canvas(bitmap) - drawable.setBounds(0, 0, canvas.width, canvas.height) - drawable.draw(canvas) - return bitmap - } - - fun notificationMessage(notificationSettings: NotificationSettings, buffer: NotificationBuffer, - selfInfo: SelfInfo, notifications: List<NotificationMessage>, - isLoud: Boolean, isConnected: Boolean): Handle { - val pendingIntentOpen = PendingIntent.getActivity( - context.applicationContext, - System.currentTimeMillis().toInt(), - ChatActivity.intent(context.applicationContext, bufferId = buffer.id).apply { - flags = Intent.FLAG_ACTIVITY_CLEAR_TOP - }, - 0 - ) - - val remoteInput = RemoteInput.Builder("reply_content") - .setLabel(translatedLocale.getString(R.string.label_reply)) - .build() - - val replyPendingIntent = PendingIntent.getService( - context.applicationContext, - System.currentTimeMillis().toInt(), - QuasselService.intent( - context, - bufferId = buffer.id - ), - 0 - ) - - val markReadPendingIntent = PendingIntent.getService( - context.applicationContext, - System.currentTimeMillis().toInt(), - QuasselService.intent( - context, - bufferId = buffer.id, - markReadMessage = notifications.last().messageId - ), - 0 - ) - - val deletePendingIntent = PendingIntent.getService( - context.applicationContext, - System.currentTimeMillis().toInt(), - QuasselService.intent( - context, - bufferId = buffer.id, - hideMessage = notifications.last().messageId - ), - 0 - ) - - val notification = NotificationCompat.Builder( - context.applicationContext, - translatedLocale.getString( - if (isLoud) R.string.notification_channel_highlight - else R.string.notification_channel_old_highlight - ) - ) - .setContentIntent(pendingIntentOpen) - .setDeleteIntent(deletePendingIntent) - .setSmallIcon(R.mipmap.ic_logo) - .setColor(context.getColorCompat(R.color.colorPrimary)) - .setLights(context.getColorCompat(R.color.colorPrimary), 200, 200) - .setGroup("notification-${buffer.networkName}") - .apply { - if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O) { - var defaults = 0 - if (isLoud) { - if (!notificationSettings.sound.isEmpty()) { - setSound(Uri.parse(notificationSettings.sound)) - } - if (notificationSettings.vibrate) { - defaults = defaults or NotificationCompat.DEFAULT_VIBRATE - } - } - if (notificationSettings.light) { - defaults = defaults or NotificationCompat.DEFAULT_LIGHTS - } - setDefaults(defaults) - } - } - .setCategory(NotificationCompat.CATEGORY_MESSAGE) - .setPriority(NotificationCompat.PRIORITY_HIGH) - .setStyle( - NotificationCompat.MessagingStyle( - Person.Builder() - .setKey("") - .setName(selfInfo.nick) - .setIcon(IconCompat.createWithBitmap(bitmapFromDrawable(selfInfo.avatar))) - .build() - ) - .setGroupConversation(!buffer.type.hasFlag(Buffer_Type.QueryBuffer)) - .setConversationTitle( - if (notificationSettings.networkNameInNotificationTitle) "${buffer.name} — ${buffer.networkName}" - else buffer.name - ) - .also { - for (notification in notifications) { - it.addMessage( - notification.content, - notification.time.toEpochMilli(), - Person.Builder() - .setKey(notification.fullSender) - .setName(notification.sender) - .setIcon(IconCompat.createWithBitmap(bitmapFromDrawable(notification.avatar))) - .build() - ) - } - } - ) - .letIf(isConnected) { - it.addAction(0, translatedLocale.getString(R.string.label_mark_read), markReadPendingIntent) - .letIf(Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) { - it.addAction( - NotificationCompat.Action.Builder( - 0, - translatedLocale.getString(R.string.label_reply), - replyPendingIntent - ).addRemoteInput(remoteInput) - .setAllowGeneratedReplies(true) - .build() - ) - } - } - .setWhen(notifications.last().time.toEpochMilli()) - .apply { - if (buffer.type.hasFlag(Buffer_Type.QueryBuffer)) { - notifications.lastOrNull()?.avatar?.let { - setLargeIcon(bitmapFromDrawable(it)) - } - } - } - return Handle(buffer.id.id, notification) - } - - fun notificationBackground(): Handle { - val pendingIntentOpen = PendingIntent.getActivity( - context.applicationContext, - System.currentTimeMillis().toInt(), - ChatActivity.intent(context.applicationContext).apply { - flags = Intent.FLAG_ACTIVITY_CLEAR_TOP - }, - 0 - ) - - val pendingIntentDisconnect = PendingIntent.getService( - context, - System.currentTimeMillis().toInt(), - QuasselService.intent(context.applicationContext, disconnect = true), - 0 - ) - - val notification = NotificationCompat.Builder( - context.applicationContext, - translatedLocale.getString(R.string.notification_channel_background) - ) - .setContentIntent(pendingIntentOpen) - .addAction(0, translatedLocale.getString(R.string.label_open), pendingIntentOpen) - .addAction(0, translatedLocale.getString(R.string.label_disconnect), pendingIntentDisconnect) - .setSmallIcon(R.mipmap.ic_logo) - .setColor(context.getColorCompat(R.color.colorPrimary)) - .setPriority(NotificationCompat.PRIORITY_MIN) - .setGroup("system-background") - return Handle(BACKGROUND_NOTIFICATION_ID, notification) - } - - fun notify(handle: Handle) { - notificationManagerCompat.notify(handle.id, handle.builder.build()) - } - - fun remove(handle: Handle) { - notificationManagerCompat.cancel(handle.id) - } - - fun remove(id: Int) { - notificationManagerCompat.cancel(id) - } - - companion object { - const val BACKGROUND_NOTIFICATION_ID = Int.MAX_VALUE - } - - data class Handle( - val id: Int, - val builder: NotificationCompat.Builder - ) -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/service/SelfInfo.kt b/app/src/main/java/de/kuschku/quasseldroid/service/SelfInfo.kt deleted file mode 100644 index ea047ff0ef2d7bd54cf39e40f491a6911ea5b43d..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/service/SelfInfo.kt +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.service - -import android.graphics.drawable.Drawable - -data class SelfInfo( - val nick: String, - val avatar: Drawable -) diff --git a/app/src/main/java/de/kuschku/quasseldroid/settings/AppearanceSettings.kt b/app/src/main/java/de/kuschku/quasseldroid/settings/AppearanceSettings.kt deleted file mode 100644 index ddf6aea96b109aaaad88169e6941f02db5c4fdb3..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/settings/AppearanceSettings.kt +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.settings - -import androidx.annotation.StyleRes -import de.kuschku.quasseldroid.R - -data class AppearanceSettings( - val inputEnter: InputEnterMode = InputEnterMode.NEWLINE, - val showLag: Boolean = true, - val theme: Theme = Theme.MATERIAL_LIGHT, - val language: String = "", - val keepScreenOn: Boolean = false -) { - enum class InputEnterMode { - EMOJI, - SEND, - NEWLINE; - - companion object { - private val map = values().associateBy { it.name } - fun of(name: String) = map[name] - } - } - - enum class Theme(@StyleRes val style: Int) { - MATERIAL_DAYNIGHT(R.style.Theme_ChatTheme_Material_DayNight), - MATERIAL_LIGHT(R.style.Theme_ChatTheme_Material_Light), - MATERIAL_DARK(R.style.Theme_ChatTheme_Material_Dark), - QUASSEL_DAYNIGHT(R.style.Theme_ChatTheme_Quassel_DayNight), - QUASSEL_LIGHT(R.style.Theme_ChatTheme_Quassel_Light), - QUASSEL_DARK(R.style.Theme_ChatTheme_Quassel_Dark), - AMOLED(R.style.Theme_ChatTheme_Amoled), - SOLARIZED_DAYNIGHT(R.style.Theme_ChatTheme_Solarized_DayNight), - SOLARIZED_LIGHT(R.style.Theme_ChatTheme_Solarized_Light), - SOLARIZED_DARK(R.style.Theme_ChatTheme_Solarized_Dark), - GRUVBOX_DAYNIGHT(R.style.Theme_ChatTheme_Gruvbox_DayNight), - GRUVBOX_LIGHT(R.style.Theme_ChatTheme_Gruvbox_Light), - GRUVBOX_DARK(R.style.Theme_ChatTheme_Gruvbox_Dark), - DRACULA(R.style.Theme_ChatTheme_Dracula); - - companion object { - private val map = values().associateBy { it.name } - fun of(name: String) = map[name] - } - } - - companion object { - val DEFAULT = AppearanceSettings() - } -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/settings/AutoCompleteSettings.kt b/app/src/main/java/de/kuschku/quasseldroid/settings/AutoCompleteSettings.kt deleted file mode 100644 index da2a2b4b6cb640b6c2bdbd0c69f0d97c3da15bf3..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/settings/AutoCompleteSettings.kt +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.settings - -data class AutoCompleteSettings( - val senderDoubleClick: Boolean = true, - val button: Boolean = false, - val doubleTap: Boolean = true, - val auto: Boolean = false, - val prefix: Boolean = true, - val nicks: Boolean = true, - val buffers: Boolean = true, - val aliases: Boolean = true, - val emoji: Boolean = true -) { - companion object { - val DEFAULT = AutoCompleteSettings() - } -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/settings/BacklogSettings.kt b/app/src/main/java/de/kuschku/quasseldroid/settings/BacklogSettings.kt deleted file mode 100644 index 0761b221e276d70bde852a8a74428a4f17f036fa..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/settings/BacklogSettings.kt +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.settings - -data class BacklogSettings( - val pageSize: Int = 150, - val initialAmount: Int = 20 -) { - companion object { - val DEFAULT = BacklogSettings() - } -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/settings/ConnectionSettings.kt b/app/src/main/java/de/kuschku/quasseldroid/settings/ConnectionSettings.kt deleted file mode 100644 index 3bd79b751538765534477f6ffc7e34853235ac3f..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/settings/ConnectionSettings.kt +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.settings - -data class ConnectionSettings( - val showNotification: Boolean = true, - val ignoreNetworkChanges: Boolean = false -) { - companion object { - val DEFAULT = ConnectionSettings() - } -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/settings/MessageSettings.kt b/app/src/main/java/de/kuschku/quasseldroid/settings/MessageSettings.kt deleted file mode 100644 index db2872d2397aa2c16e9e6d04bbb1d5b727be8edd..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/settings/MessageSettings.kt +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.settings - -data class MessageSettings( - val showPrefix: ShowPrefixMode = ShowPrefixMode.HIGHEST, - val colorizeNicknames: SenderColorMode = SenderColorMode.ALL_BUT_MINE, - val colorizeMirc: Boolean = true, - val useMonospace: Boolean = false, - val textSize: Int = 14, - val showSeconds: Boolean = false, - val use24hClock: Boolean = true, - val showHostmaskActions: Boolean = false, - val nicksOnNewLine: Boolean = false, - val timeAtEnd: Boolean = false, - val showRealNames: Boolean = false, - val showAvatars: Boolean = true, - val squareAvatars: Boolean = true, - val showIRCCloudAvatars: Boolean = false, - val showGravatarAvatars: Boolean = false, - val showMatrixAvatars: Boolean = false, - val largerEmoji: Boolean = false, - val highlightOwnMessages: Boolean = false, - val replaceEmoji: Boolean = true -) { - - enum class SenderColorMode { - ALL, - ALL_BUT_MINE, - NONE; - - companion object { - private val map = values().associateBy { it.name } - fun of(name: String) = map[name] - } - } - - enum class ShowPrefixMode { - ALL, - HIGHEST, - NONE; - - companion object { - private val map = values().associateBy { it.name } - fun of(name: String) = map[name] - } - } - - companion object { - val DEFAULT = MessageSettings() - } -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/settings/NotificationSettings.kt b/app/src/main/java/de/kuschku/quasseldroid/settings/NotificationSettings.kt deleted file mode 100644 index eb8356fbc25de9be092c3ec898550d4157ef56bf..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/settings/NotificationSettings.kt +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.settings - -data class NotificationSettings( - val query: Level = Level.ALL, - val channel: Level = Level.HIGHLIGHT, - val other: Level = Level.NONE, - val sound: String = "content://settings/system/notification_sound", - val vibrate: Boolean = true, - val light: Boolean = true, - val markReadOnSwipe: Boolean = false, - val networkNameInNotificationTitle: Boolean = false, - val showAllActivitiesInToolbar: Boolean = false -) { - enum class Level { - ALL, - HIGHLIGHT, - NONE; - - companion object { - private val map = values().associateBy { it.name } - fun of(name: String) = map[name] - } - } - - companion object { - val DEFAULT = NotificationSettings() - } -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/settings/RedirectionSettings.kt b/app/src/main/java/de/kuschku/quasseldroid/settings/RedirectionSettings.kt deleted file mode 100644 index 1bf1db722a86f5578e8a5b3de4b2a261869df9f1..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/settings/RedirectionSettings.kt +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.settings - -data class RedirectionSettings( - val userNotices: Boolean = true, - val serverNotices: Boolean = true, - val errors: Boolean = false -) { - companion object { - val DEFAULT = RedirectionSettings() - } -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/settings/Settings.kt b/app/src/main/java/de/kuschku/quasseldroid/settings/Settings.kt deleted file mode 100644 index 20cb304301d60754ab217c836db18e586124cc50..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/settings/Settings.kt +++ /dev/null @@ -1,273 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.settings - -import android.content.Context -import de.kuschku.quasseldroid.R -import de.kuschku.quasseldroid.settings.AppearanceSettings.InputEnterMode -import de.kuschku.quasseldroid.settings.AppearanceSettings.Theme -import de.kuschku.quasseldroid.util.helper.sharedPreferences - -object Settings { - fun appearance(context: Context) = context.sharedPreferences { - AppearanceSettings( - theme = Theme.of( - getString( - context.getString(R.string.preference_theme_key), - "" - ) ?: "" - ) ?: AppearanceSettings.DEFAULT.theme, - inputEnter = InputEnterMode.of( - getString( - context.getString(R.string.preference_input_enter_key), - "" - ) ?: "" - ) ?: AppearanceSettings.DEFAULT.inputEnter, - showLag = getBoolean( - context.getString(R.string.preference_show_lag_key), - AppearanceSettings.DEFAULT.showLag - ), - keepScreenOn = getBoolean( - context.getString(R.string.preference_keep_screen_on_key), - AppearanceSettings.DEFAULT.keepScreenOn - ), - language = getString( - context.getString(R.string.preference_language_key), - AppearanceSettings.DEFAULT.language - ) ?: "" - ) - } - - fun redirection(context: Context) = context.sharedPreferences { - RedirectionSettings( - userNotices = getBoolean( - context.getString(R.string.preference_redirection_user_notices_key), - RedirectionSettings.DEFAULT.userNotices - ), - serverNotices = getBoolean( - context.getString(R.string.preference_redirection_server_notices_key), - RedirectionSettings.DEFAULT.serverNotices - ), - errors = getBoolean( - context.getString(R.string.preference_redirection_errors_key), - RedirectionSettings.DEFAULT.errors - ) - ) - } - - fun message(context: Context) = context.sharedPreferences { - MessageSettings( - useMonospace = getBoolean( - context.getString(R.string.preference_monospace_key), - MessageSettings.DEFAULT.useMonospace - ), - textSize = getInt( - context.getString(R.string.preference_textsize_key), - MessageSettings.DEFAULT.textSize - ), - showSeconds = getBoolean( - context.getString(R.string.preference_show_seconds_key), - MessageSettings.DEFAULT.showSeconds - ), - use24hClock = getBoolean( - context.getString(R.string.preference_use_24h_clock_key), - MessageSettings.DEFAULT.use24hClock - ), - showPrefix = MessageSettings.ShowPrefixMode.of( - getString( - context.getString(R.string.preference_show_prefix_key), - "" - ) ?: "" - ) ?: MessageSettings.DEFAULT.showPrefix, - colorizeNicknames = MessageSettings.SenderColorMode.of( - getString( - context.getString(R.string.preference_colorize_nicknames_key), - "" - ) ?: "" - ) ?: MessageSettings.DEFAULT.colorizeNicknames, - colorizeMirc = getBoolean( - context.getString(R.string.preference_colorize_mirc_key), - MessageSettings.DEFAULT.colorizeMirc - ), - showHostmaskActions = getBoolean( - context.getString(R.string.preference_hostmask_actions_key), - MessageSettings.DEFAULT.showHostmaskActions - ), - nicksOnNewLine = getBoolean( - context.getString(R.string.preference_nicks_on_new_line_key), - MessageSettings.DEFAULT.nicksOnNewLine - ), - timeAtEnd = getBoolean( - context.getString(R.string.preference_time_at_end_key), - MessageSettings.DEFAULT.timeAtEnd - ), - showRealNames = getBoolean( - context.getString(R.string.preference_show_realnames_key), - MessageSettings.DEFAULT.showRealNames - ), - showAvatars = getBoolean( - context.getString(R.string.preference_show_avatars_key), - MessageSettings.DEFAULT.showAvatars - ), - squareAvatars = getBoolean( - context.getString(R.string.preference_square_avatars_key), - MessageSettings.DEFAULT.squareAvatars - ), - showIRCCloudAvatars = getBoolean( - context.getString(R.string.preference_show_irccloud_avatars_key), - MessageSettings.DEFAULT.showIRCCloudAvatars - ), - showGravatarAvatars = getBoolean( - context.getString(R.string.preference_show_gravatar_avatars_key), - MessageSettings.DEFAULT.showGravatarAvatars - ), - showMatrixAvatars = getBoolean( - context.getString(R.string.preference_show_matrix_avatars_key), - MessageSettings.DEFAULT.showMatrixAvatars - ), - largerEmoji = getBoolean( - context.getString(R.string.preference_larger_emoji_key), - MessageSettings.DEFAULT.largerEmoji - ), - highlightOwnMessages = getBoolean( - context.getString(R.string.preference_highlight_own_messages_key), - MessageSettings.DEFAULT.highlightOwnMessages - ), - replaceEmoji = getBoolean( - context.getString(R.string.preference_replace_emoji_key), - MessageSettings.DEFAULT.replaceEmoji - ) - ) - } - - fun notification(context: Context) = context.sharedPreferences { - NotificationSettings( - query = NotificationSettings.Level.of( - getString( - context.getString(R.string.preference_notification_query_key), - "" - ) ?: "" - ) ?: NotificationSettings.DEFAULT.query, - channel = NotificationSettings.Level.of( - getString( - context.getString(R.string.preference_notification_channel_key), - "" - ) ?: "" - ) ?: NotificationSettings.DEFAULT.channel, - other = NotificationSettings.Level.of( - getString( - context.getString(R.string.preference_notification_other_key), - "" - ) ?: "" - ) ?: NotificationSettings.DEFAULT.other, - sound = getString( - context.getString(R.string.preference_notification_sound_key), - NotificationSettings.DEFAULT.sound - ) ?: "", - vibrate = getBoolean( - context.getString(R.string.preference_notification_vibration_key), - NotificationSettings.DEFAULT.vibrate - ), - light = getBoolean( - context.getString(R.string.preference_notification_light_key), - NotificationSettings.DEFAULT.light - ), - markReadOnSwipe = getBoolean( - context.getString(R.string.preference_notification_mark_read_on_swipe_key), - NotificationSettings.DEFAULT.markReadOnSwipe - ), - networkNameInNotificationTitle = getBoolean( - context.getString(R.string.preference_notification_network_name_in_notification_title_key), - NotificationSettings.DEFAULT.networkNameInNotificationTitle - ), - showAllActivitiesInToolbar = getBoolean( - context.getString(R.string.preference_notification_show_all_activities_in_toolbar_key), - NotificationSettings.DEFAULT.showAllActivitiesInToolbar - ) - ) - } - - fun autoComplete(context: Context) = context.sharedPreferences { - AutoCompleteSettings( - senderDoubleClick = getBoolean( - context.getString(R.string.preference_autocomplete_sender_doubleclick_key), - AutoCompleteSettings.DEFAULT.senderDoubleClick - ), - button = getBoolean( - context.getString(R.string.preference_autocomplete_button_key), - AutoCompleteSettings.DEFAULT.button - ), - doubleTap = getBoolean( - context.getString(R.string.preference_autocomplete_doubletap_key), - AutoCompleteSettings.DEFAULT.doubleTap - ), - auto = getBoolean( - context.getString(R.string.preference_autocomplete_auto_key), - AutoCompleteSettings.DEFAULT.auto - ), - prefix = getBoolean( - context.getString(R.string.preference_autocomplete_prefix_key), - AutoCompleteSettings.DEFAULT.prefix - ), - nicks = getBoolean( - context.getString(R.string.preference_autocomplete_nicks_key), - AutoCompleteSettings.DEFAULT.nicks - ), - buffers = getBoolean( - context.getString(R.string.preference_autocomplete_buffers_key), - AutoCompleteSettings.DEFAULT.buffers - ), - aliases = getBoolean( - context.getString(R.string.preference_autocomplete_aliases_key), - AutoCompleteSettings.DEFAULT.aliases - ), - emoji = getBoolean( - context.getString(R.string.preference_autocomplete_emoji_key), - AutoCompleteSettings.DEFAULT.emoji - ) - ) - } - - fun backlog(context: Context) = context.sharedPreferences { - BacklogSettings( - initialAmount = getString( - context.getString(R.string.preference_initial_amount_key), - BacklogSettings.DEFAULT.initialAmount.toString() - )?.toIntOrNull() ?: BacklogSettings.DEFAULT.initialAmount, - pageSize = getString( - context.getString(R.string.preference_page_size_key), - BacklogSettings.DEFAULT.pageSize.toString() - )?.toIntOrNull() ?: BacklogSettings.DEFAULT.pageSize - ) - } - - fun connection(context: Context) = context.sharedPreferences { - ConnectionSettings( - showNotification = getBoolean( - context.getString(R.string.preference_show_notification_key), - ConnectionSettings.DEFAULT.showNotification - ), - ignoreNetworkChanges = getBoolean( - context.getString(R.string.preference_ignore_network_changes_key), - ConnectionSettings.DEFAULT.ignoreNetworkChanges - ) - ) - } -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/settings/SettingsMigration.kt b/app/src/main/java/de/kuschku/quasseldroid/settings/SettingsMigration.kt deleted file mode 100644 index 848c756ee83278725dff3c2f096f491df3548962..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/settings/SettingsMigration.kt +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.settings - -import android.content.SharedPreferences - -interface SettingsMigration { - val from: Int - val to: Int - - fun migrate(preferences: SharedPreferences, editor: SharedPreferences.Editor) - - companion object { - fun migrationOf(from: Int, to: Int, - migrationFunction: (SharedPreferences, SharedPreferences.Editor) -> Unit): SettingsMigration { - return object : SettingsMigration { - override val from = from - override val to = to - override fun migrate(preferences: SharedPreferences, editor: SharedPreferences.Editor) = - migrationFunction(preferences, editor) - } - } - } -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/settings/SettingsMigrationManager.kt b/app/src/main/java/de/kuschku/quasseldroid/settings/SettingsMigrationManager.kt deleted file mode 100644 index 591e0d819ea93deff8d846729aa973435eda9310..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/settings/SettingsMigrationManager.kt +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.settings - -import android.annotation.SuppressLint -import android.content.Context -import androidx.preference.PreferenceManager -import androidx.preference.PreferenceManager.KEY_HAS_SET_DEFAULT_VALUES -import de.kuschku.quasseldroid.R.xml.preferences - -class SettingsMigrationManager( - migrations: List<SettingsMigration> -) { - private val migrationMap = migrations.associateBy(SettingsMigration::from) - private val currentVersion = migrations.map(SettingsMigration::to).max() - - // This runs during initial start and has to run synchronously - @SuppressLint("ApplySharedPref") - fun migrate(context: Context) { - val defaultValueSp = context.getSharedPreferences(KEY_HAS_SET_DEFAULT_VALUES, - Context.MODE_PRIVATE) - - if (defaultValueSp.getBoolean(KEY_HAS_SET_DEFAULT_VALUES, false)) { - val preferences = PreferenceManager.getDefaultSharedPreferences(context) - var version = preferences.getInt(SETTINGS_VERSION, 0) - while (version != currentVersion) { - val migration = migrationMap[version] - ?: throw IllegalArgumentException("Migration not available") - val editor = preferences.edit() - migration.migrate(preferences, editor) - version = migration.to - editor.putInt(SETTINGS_VERSION, version) - editor.commit() - } - } - PreferenceManager.setDefaultValues(context, preferences, false) - } - - companion object { - private const val SETTINGS_VERSION = "settings_version" - } -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/ssl/QuasselHostnameVerifier.kt b/app/src/main/java/de/kuschku/quasseldroid/ssl/QuasselHostnameVerifier.kt deleted file mode 100644 index 85b30d7a42ca9fc6f0bb78c6ca1d226ac7e460aa..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/ssl/QuasselHostnameVerifier.kt +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.ssl - -import de.kuschku.quasseldroid.ssl.custom.QuasselHostnameManager -import javax.net.ssl.HostnameVerifier -import javax.net.ssl.HttpsURLConnection -import javax.net.ssl.SSLSession - -class QuasselHostnameVerifier( - private val hostnameManager: QuasselHostnameManager, - private val hostnameVerifier: HostnameVerifier = HttpsURLConnection.getDefaultHostnameVerifier() -) : HostnameVerifier { - override fun verify(hostname: String?, session: SSLSession?): Boolean { - return hostnameManager.verify(hostname, session) || hostnameVerifier.verify(hostname, session) - } -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/ssl/QuasselTrustManager.kt b/app/src/main/java/de/kuschku/quasseldroid/ssl/QuasselTrustManager.kt deleted file mode 100644 index 732a24ca37783043f4336e10b33a172db8942211..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/ssl/QuasselTrustManager.kt +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.ssl - -import de.kuschku.libquassel.connection.QuasselSecurityException -import de.kuschku.quasseldroid.ssl.custom.QuasselCertificateManager -import java.security.GeneralSecurityException -import java.security.KeyStore -import java.security.cert.X509Certificate -import javax.net.ssl.KeyManagerFactory -import javax.net.ssl.TrustManagerFactory -import javax.net.ssl.X509TrustManager - -class QuasselTrustManager private constructor( - private val certificateManager: QuasselCertificateManager, - private val trustManager: X509TrustManager? -) : X509TrustManager { - constructor( - certificateManager: QuasselCertificateManager, - factory: TrustManagerFactory = TrustManagerFactory.getInstance(KeyManagerFactory.getDefaultAlgorithm()).apply { - init(null as KeyStore?) - } - ) : this( - certificateManager, - factory.trustManagers.mapNotNull { - it as? X509TrustManager - }.firstOrNull() - ) - - override fun checkClientTrusted(chain: Array<out X509Certificate>?, authType: String?) { - try { - trustManager?.checkClientTrusted(chain, authType) - ?: throw GeneralSecurityException("No TrustManager available") - } catch (e: GeneralSecurityException) { - throw QuasselSecurityException.Certificate(chain, e) - } - } - - override fun checkServerTrusted(chain: Array<out X509Certificate>?, authType: String?) { - try { - if (!certificateManager.isServerTrusted(chain)) { - trustManager?.checkServerTrusted(chain, authType) - ?: throw GeneralSecurityException("No TrustManager available") - } - } catch (e: GeneralSecurityException) { - throw QuasselSecurityException.Certificate(chain, e) - } - } - - override fun getAcceptedIssuers(): Array<X509Certificate> = - trustManager?.acceptedIssuers ?: emptyArray() -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/ssl/custom/QuasselCertificateManager.kt b/app/src/main/java/de/kuschku/quasseldroid/ssl/custom/QuasselCertificateManager.kt deleted file mode 100644 index 268caa98c1c57033bbd3fe138e17a17543d21c6e..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/ssl/custom/QuasselCertificateManager.kt +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.ssl.custom - -import de.kuschku.quasseldroid.persistence.dao.SslValidityWhitelistDao -import de.kuschku.quasseldroid.util.helper.isValid -import de.kuschku.quasseldroid.util.helper.sha1Fingerprint -import java.security.cert.X509Certificate - -class QuasselCertificateManager( - private val validityWhitelist: SslValidityWhitelistDao -) { - fun isServerTrusted(chain: Array<out X509Certificate>?): Boolean { - // Verify input conditions - // If no certificate exists, this can’t be valid - val leafCertificate = chain?.firstOrNull() ?: return false - return isServerTrusted(leafCertificate) - } - - private fun isServerTrusted(leafCertificate: X509Certificate): Boolean { - // Verify if a whitelist entry exists - return validityWhitelist.find(leafCertificate.sha1Fingerprint)?.let { - it.ignoreDate || leafCertificate.isValid - } ?: false - } -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/ssl/custom/QuasselHostnameManager.kt b/app/src/main/java/de/kuschku/quasseldroid/ssl/custom/QuasselHostnameManager.kt deleted file mode 100644 index e0b5f2d3f884ba17475ba0f6228bcdb357f9f029..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/ssl/custom/QuasselHostnameManager.kt +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.ssl.custom - -import de.kuschku.libquassel.ssl.toJavaCertificate -import de.kuschku.quasseldroid.persistence.dao.SslHostnameWhitelistDao -import de.kuschku.quasseldroid.util.helper.sha1Fingerprint -import javax.net.ssl.HostnameVerifier -import javax.net.ssl.SSLSession - -class QuasselHostnameManager( - private val hostnameWhitelist: SslHostnameWhitelistDao -) : HostnameVerifier { - override fun verify(hostname: String?, session: SSLSession?): Boolean { - val chain = session?.peerCertificateChain?.toJavaCertificate() - val leafCertificate = chain?.firstOrNull() ?: return false - val whitelistEntry = hostnameWhitelist.find(leafCertificate.sha1Fingerprint, hostname ?: "") - return whitelistEntry != null - } -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/ui/chat/ChatActivity.kt b/app/src/main/java/de/kuschku/quasseldroid/ui/chat/ChatActivity.kt deleted file mode 100644 index 2e117103f7d65ab43db060b2f2505e00e07956bf..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/ui/chat/ChatActivity.kt +++ /dev/null @@ -1,1205 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.ui.chat - -import android.annotation.SuppressLint -import android.app.Activity -import android.content.Context -import android.content.Intent -import android.content.SharedPreferences -import android.os.Build -import android.os.Bundle -import android.system.ErrnoException -import android.text.Html -import android.view.ActionMode -import android.view.Menu -import android.view.MenuItem -import android.view.View -import android.widget.EditText -import android.widget.Toast -import androidx.appcompat.app.ActionBarDrawerToggle -import androidx.core.view.GravityCompat -import androidx.drawerlayout.widget.DrawerLayout -import androidx.lifecycle.Observer -import androidx.recyclerview.widget.DefaultItemAnimator -import androidx.recyclerview.widget.LinearLayoutManager -import com.afollestad.materialdialogs.MaterialDialog -import com.google.android.material.bottomsheet.BottomSheetBehavior -import de.kuschku.libquassel.connection.ConnectionState -import de.kuschku.libquassel.connection.ProtocolVersionException -import de.kuschku.libquassel.connection.QuasselSecurityException -import de.kuschku.libquassel.protocol.* -import de.kuschku.libquassel.protocol.coresetup.CoreSetupData -import de.kuschku.libquassel.protocol.message.HandshakeMessage -import de.kuschku.libquassel.quassel.syncables.interfaces.INetwork.PortDefaults.PORT_PLAINTEXT -import de.kuschku.libquassel.quassel.syncables.interfaces.INetwork.PortDefaults.PORT_SSL -import de.kuschku.libquassel.session.Error -import de.kuschku.libquassel.session.ISession -import de.kuschku.libquassel.util.Optional -import de.kuschku.libquassel.util.compatibility.LoggingHandler.Companion.log -import de.kuschku.libquassel.util.compatibility.LoggingHandler.LogLevel.INFO -import de.kuschku.libquassel.util.flag.and -import de.kuschku.libquassel.util.flag.hasFlag -import de.kuschku.libquassel.util.flag.or -import de.kuschku.libquassel.util.helper.* -import de.kuschku.quasseldroid.Keys -import de.kuschku.quasseldroid.R -import de.kuschku.quasseldroid.databinding.ActivityMainBinding -import de.kuschku.quasseldroid.defaults.DefaultNetworkServer -import de.kuschku.quasseldroid.persistence.dao.* -import de.kuschku.quasseldroid.persistence.db.AccountDatabase -import de.kuschku.quasseldroid.persistence.db.QuasselDatabase -import de.kuschku.quasseldroid.persistence.models.Filtered -import de.kuschku.quasseldroid.persistence.models.SslHostnameWhitelistEntry -import de.kuschku.quasseldroid.persistence.models.SslValidityWhitelistEntry -import de.kuschku.quasseldroid.persistence.util.AccountId -import de.kuschku.quasseldroid.settings.AutoCompleteSettings -import de.kuschku.quasseldroid.settings.MessageSettings -import de.kuschku.quasseldroid.settings.NotificationSettings -import de.kuschku.quasseldroid.settings.Settings -import de.kuschku.quasseldroid.ui.chat.input.AutoCompleteAdapter -import de.kuschku.quasseldroid.ui.chat.input.ChatlineFragment -import de.kuschku.quasseldroid.ui.clientsettings.about.AboutActivity -import de.kuschku.quasseldroid.ui.clientsettings.client.ClientSettingsActivity -import de.kuschku.quasseldroid.ui.coresettings.CoreSettingsActivity -import de.kuschku.quasseldroid.ui.setup.accounts.selection.AccountSelectionActivity -import de.kuschku.quasseldroid.ui.setup.core.CoreSetupActivity -import de.kuschku.quasseldroid.ui.setup.network.LinkNetwork -import de.kuschku.quasseldroid.ui.setup.network.NetworkSetupActivity -import de.kuschku.quasseldroid.ui.setup.user.UserSetupActivity -import de.kuschku.quasseldroid.util.backport.OsConstants -import de.kuschku.quasseldroid.util.helper.* -import de.kuschku.quasseldroid.util.irc.format.IrcFormatDeserializer -import de.kuschku.quasseldroid.util.missingfeatures.MissingFeaturesDialog -import de.kuschku.quasseldroid.util.missingfeatures.RequiredFeatures -import de.kuschku.quasseldroid.util.service.ServiceBoundActivity -import de.kuschku.quasseldroid.util.ui.DragInterceptBottomSheetBehavior -import de.kuschku.quasseldroid.util.ui.drawable.DrawerToggleActivityDrawable -import de.kuschku.quasseldroid.util.ui.drawable.NickCountDrawable -import de.kuschku.quasseldroid.util.ui.view.WarningBarView -import de.kuschku.quasseldroid.viewmodel.ChatViewModel -import de.kuschku.quasseldroid.viewmodel.data.BufferData -import de.kuschku.quasseldroid.viewmodel.helper.ChatViewModelHelper -import io.reactivex.BackpressureStrategy -import org.threeten.bp.Instant -import org.threeten.bp.ZoneId -import org.threeten.bp.format.DateTimeFormatter -import org.threeten.bp.format.FormatStyle -import java.net.ConnectException -import java.net.UnknownHostException -import java.security.cert.CertificateExpiredException -import java.security.cert.CertificateNotYetValidException -import javax.inject.Inject - -@SuppressLint("ResourceType") -class ChatActivity : ServiceBoundActivity(), SharedPreferences.OnSharedPreferenceChangeListener { - lateinit var binding: ActivityMainBinding - - @Inject - lateinit var modelHelper: ChatViewModelHelper - - @Inject - lateinit var chatViewModel: ChatViewModel - - @Inject - lateinit var database: QuasselDatabase - - @Inject - lateinit var autoCompleteSettings: AutoCompleteSettings - - @Inject - lateinit var accountDatabase: AccountDatabase - - @Inject - lateinit var messageSettings: MessageSettings - - @Inject - lateinit var notificationSettings: NotificationSettings - - @Inject - lateinit var ircFormatDeserializer: IrcFormatDeserializer - - @Inject - lateinit var autoCompleteAdapter: AutoCompleteAdapter - - lateinit var editorBottomSheet: DragInterceptBottomSheetBehavior<View> - - private val dateTimeFormatter = DateTimeFormatter.ofLocalizedDateTime(FormatStyle.MEDIUM) - - private lateinit var drawerToggle: ActionBarDrawerToggle - - private var chatlineFragment: ChatlineFragment? = null - - private var connectedAccount = AccountId(-1L) - - private var restoredDrawerState = false - - fun processIntent(intent: Intent) { - when { - intent.type == "text/plain" -> { - val text = intent.getCharSequenceExtra(Intent.EXTRA_TEXT) - if (text != null) { - chatlineFragment?.replaceText(text) - binding.drawerLayout.closeDrawers() - } - } - intent.hasExtra(KEY_BUFFER_ID) -> { - chatViewModel.bufferId.onNext(BufferId(intent.getIntExtra(KEY_BUFFER_ID, -1))) - chatViewModel.bufferOpened.onNext(Unit) - if (intent.hasExtra(KEY_ACCOUNT_ID)) { - val accountId = AccountId(intent.getLongExtra(KEY_ACCOUNT_ID, -1L)) - if (accountId != this.accountId) { - resetAccount() - connectToAccount(accountId) - startedSelection = false - connectedAccount = AccountId(-1L) - checkConnection() - recreate() - } - } - } - intent.hasExtra(KEY_AUTOCOMPLETE_TEXT) -> { - chatlineFragment?.editorHelper?.appendText( - intent.getStringExtra(KEY_AUTOCOMPLETE_TEXT), - intent.getStringExtra(KEY_AUTOCOMPLETE_SUFFIX) - ) - binding.drawerLayout.closeDrawers() - } - intent.hasExtra(KEY_NETWORK_ID) && intent.hasExtra(KEY_CHANNEL) -> { - val networkId = NetworkId(intent.getIntExtra(KEY_NETWORK_ID, -1)) - val channel = intent.getStringExtra(KEY_CHANNEL) - - val forceJoin = intent.getBooleanExtra(KEY_FORCE_JOIN, false) - - modelHelper.connectedSession.filter(Optional<ISession>::isPresent).firstElement().subscribe { - it.orNull()?.also { session -> - val info = session.bufferSyncer.find( - bufferName = channel, - networkId = networkId, - type = Buffer_Type.of(Buffer_Type.ChannelBuffer) - ) - - if (info != null && !forceJoin) { - ChatActivity.launch(this, bufferId = info.bufferId) - } else { - modelHelper.chat.chatToJoin.onNext(Optional.of( - Pair(networkId, channel) - )) - - session.bufferSyncer.find( - networkId = networkId, - type = Buffer_Type.of(Buffer_Type.StatusBuffer) - )?.let { statusInfo -> - session.rpcHandler.sendInput( - statusInfo, "/join $channel" - ) - } - } - } - } - } - intent.hasExtra(KEY_NETWORK_ID) && intent.hasExtra(KEY_NICK_NAME) -> { - val networkId = NetworkId(intent.getIntExtra(KEY_NETWORK_ID, -1)) - val channel = intent.getStringExtra(KEY_NICK_NAME) - - val forceJoin = intent.getBooleanExtra(KEY_FORCE_JOIN, false) - - modelHelper.connectedSession.filter(Optional<ISession>::isPresent).firstElement().subscribe { - it.orNull()?.also { session -> - val info = session.bufferSyncer.find( - bufferName = channel, - networkId = networkId, - type = Buffer_Type.of(Buffer_Type.QueryBuffer) - ) - - if (info != null && !forceJoin) { - ChatActivity.launch(this, bufferId = info.bufferId) - } else { - modelHelper.allBuffers.map { - listOfNotNull(it.find { - it.networkId == networkId && - it.bufferName == channel && - it.type.hasFlag(Buffer_Type.QueryBuffer) - }) - }.filter { - it.isNotEmpty() - }.firstElement().toLiveData().observeForever { - it?.firstOrNull()?.let { info -> - ChatActivity.launch(this, bufferId = info.bufferId) - } - } - - session.bufferSyncer.find( - networkId = networkId, - type = Buffer_Type.of(Buffer_Type.StatusBuffer) - )?.let { statusInfo -> - session.rpcHandler.sendInput( - statusInfo, "/query $channel" - ) - } - } - } - } - } - intent.scheme == "irc" || - intent.scheme == "ircs" -> { - val uri = intent.data - if (uri != null) { - val channelString = (uri.path.let { it ?: "" }.trimStart('/')) + - (uri.fragment?.let { "#$it" }.let { it ?: "" }) - NetworkSetupActivity.launch( - this, - network = LinkNetwork( - name = "", - server = DefaultNetworkServer( - host = uri.host ?: "", - port = uri.port.nullIf { it < 0 }?.toUInt() - ?: if (uri.scheme == "irc") PORT_PLAINTEXT.port - else PORT_SSL.port, - secure = uri.scheme == "ircs" - ) - ), - channels = channelString.split(",").toTypedArray() - ) - } - } - } - } - - override fun onCreate(savedInstanceState: Bundle?) { - super.onCreate(savedInstanceState) - binding = ActivityMainBinding.inflate(layoutInflater) - setContentView(binding.root) - - chatlineFragment = supportFragmentManager.findFragmentById(R.id.fragment_chatline) as? ChatlineFragment - - setSupportActionBar(binding.layoutMain.layoutToolbar.toolbar) - - chatViewModel.bufferOpened.toLiveData().observe(this, Observer { - actionMode?.finish() - if (binding.drawerLayout.isDrawerOpen(GravityCompat.START)) { - binding.drawerLayout.closeDrawer(GravityCompat.START, true) - } - }) - - // Don’t show a drawer toggle if in tablet landscape mode - if (resources.getBoolean(R.bool.buffer_drawer_exists)) { - supportActionBar?.setDisplayHomeAsUpEnabled(true) - drawerToggle = ActionBarDrawerToggle( - this, - binding.drawerLayout, - R.string.label_open, - R.string.label_close - ) - drawerToggle.syncState() - } - - binding.drawerLayout.addDrawerListener(object : DrawerLayout.DrawerListener { - override fun onDrawerStateChanged(newState: Int) = Unit - override fun onDrawerSlide(drawerView: View, slideOffset: Float) { - actionMode?.finish() - } - - override fun onDrawerClosed(drawerView: View) { - actionMode?.finish() - } - - override fun onDrawerOpened(drawerView: View) { - actionMode?.finish() - } - }) - - val filtered = combineLatest( - database.filtered().listenRx(accountId).toObservable().map { - it.associateBy(Filtered::bufferId, Filtered::filtered) - }, - accountDatabase.accounts().listenDefaultFiltered(accountId, 0).toObservable() - ) - - val maxBufferActivity = modelHelper.processBufferList(modelHelper.bufferViewConfig, - filtered).map { (config, bufferList) -> - val minimumActivity: Buffer_Activity = config?.minimumActivity()?.enabledValues()?.max() - ?: Buffer_Activity.NoActivity - - val maxActivity: Buffer_Activity = bufferList.mapNotNull { - it.bufferActivity.enabledValues().max() - }.max() ?: Buffer_Activity.NoActivity - - val hasNotifications = bufferList.any { props -> - when { - props.info.type hasFlag Buffer_Type.QueryBuffer -> - props.bufferActivity hasFlag Buffer_Activity.NewMessage - props.info.type hasFlag Buffer_Type.ChannelBuffer -> - props.highlights > 0 - else -> false - } - } - - Pair( - if (maxActivity < minimumActivity) Buffer_Activity.NoActivity - else maxActivity, - hasNotifications - ) - } - - supportActionBar?.apply { - val toggleDefault = DrawerToggleActivityDrawable(themedContext, 0) - val toggleOtherActivity = DrawerToggleActivityDrawable(themedContext, - R.attr.colorTintActivity) - val toggleNewMessage = DrawerToggleActivityDrawable(themedContext, R.attr.colorTintMessage) - val toggleHighlight = DrawerToggleActivityDrawable(themedContext, R.attr.colorTintHighlight) - val toggleNotification = DrawerToggleActivityDrawable(themedContext, - R.attr.colorTintNotification) - maxBufferActivity.toLiveData() - .observe(this@ChatActivity, Observer { (activity, hasNotifications) -> - setHomeAsUpIndicator( - when { - notificationSettings.showAllActivitiesInToolbar && - activity == Buffer_Activity.Highlight -> - toggleHighlight - notificationSettings.showAllActivitiesInToolbar && - activity == Buffer_Activity.NewMessage -> - toggleNewMessage - notificationSettings.showAllActivitiesInToolbar && - activity == Buffer_Activity.OtherActivity -> - toggleOtherActivity - hasNotifications -> - toggleNotification - else -> - toggleDefault - } - ) - }) - } - - if (autoCompleteSettings.prefix || autoCompleteSettings.auto) { - val autoCompleteBottomSheet = BottomSheetBehavior.from(binding.layoutMain.autocompleteList) - chatlineFragment?.let { - autoCompleteAdapter.setOnClickListener(it.chatline::autoComplete) - binding.layoutMain.autocompleteList.layoutManager = LinearLayoutManager(it.activity) - binding.layoutMain.autocompleteList.itemAnimator = DefaultItemAnimator() - binding.layoutMain.autocompleteList.adapter = autoCompleteAdapter - it.autoCompleteHelper.addDataListener { - autoCompleteBottomSheet.state = - if (it.isEmpty()) BottomSheetBehavior.STATE_HIDDEN - else BottomSheetBehavior.STATE_COLLAPSED - autoCompleteAdapter.submitList(it) - } - } - } - // If we connect to a new network without statusbuffer, the bufferid may be -networkId. - // In that case, once we’re connected (and a status bufferId exists), we want to switch to it. - combineLatest(modelHelper.allBuffers, chatViewModel.bufferId).map { (buffers, current) -> - if (current.isValidId()) Optional.empty() - else Optional.ofNullable(buffers.firstOrNull { - it.networkId == NetworkId(-current.id) && it.type.hasFlag(Buffer_Type.StatusBuffer) - }) - }.toLiveData().observe(this, Observer { info -> - info?.orNull()?.let { - ChatActivity.launch(this, bufferId = it.bufferId) - } - }) - - // User-actionable errors that require immediate action, and should show up as dialog - modelHelper.errors.toLiveData(BackpressureStrategy.BUFFER).observe(this, Observer { error -> - error?.let { - when (it) { - is Error.HandshakeError -> it.message.let { - when (it) { - is HandshakeMessage.ClientInitAck -> - if (it.coreConfigured == false) - CoreSetupActivity.launch( - this, - accountDatabase.accounts().findById(accountId), - CoreSetupData.of(it) - ) - is HandshakeMessage.ClientInitReject -> - MaterialDialog.Builder(this) - .title(R.string.label_error_init) - .content(Html.fromHtml(it.errorString)) - .negativeText(R.string.label_disconnect) - .onNegative { _, _ -> - disconnect() - } - .titleColorAttr(R.attr.colorTextPrimary) - .backgroundColorAttr(R.attr.colorBackgroundCard) - .contentColorAttr(R.attr.colorTextPrimary) - .build() - .show() - is HandshakeMessage.CoreSetupReject -> - MaterialDialog.Builder(this) - .title(R.string.label_error_setup) - .content(Html.fromHtml(it.errorString)) - .negativeText(R.string.label_disconnect) - .onNegative { _, _ -> - disconnect() - } - .titleColorAttr(R.attr.colorTextPrimary) - .backgroundColorAttr(R.attr.colorBackgroundCard) - .contentColorAttr(R.attr.colorTextPrimary) - .build() - .show() - is HandshakeMessage.ClientLoginReject -> - MaterialDialog.Builder(this) - .title(R.string.label_error_login) - .content(Html.fromHtml(it.errorString)) - .negativeText(R.string.label_disconnect) - .positiveText(R.string.label_update_user_password) - .onNegative { _, _ -> - disconnect() - } - .onPositive { _, _ -> - runInBackground { - val account = accountDatabase.accounts().findById(accountId) - - runOnUiThread { - val dialog = MaterialDialog.Builder(this) - .title(R.string.label_error_login) - .customView(R.layout.setup_account_user, false) - .negativeText(R.string.label_disconnect) - .positiveText(R.string.label_save) - .onNegative { _, _ -> - disconnect() - } - .onPositive { dialog, _ -> - dialog.customView?.run { - val userField = findViewById<EditText>(R.id.user) - val passField = findViewById<EditText>(R.id.pass) - - val user = userField.text.toString() - val pass = passField.text.toString() - - backend.safeValue.orNull()?.updateUserDataAndLogin(user, pass) - } - } - .titleColorAttr(R.attr.colorTextPrimary) - .backgroundColorAttr(R.attr.colorBackgroundCard) - .contentColorAttr(R.attr.colorTextPrimary) - .build() - dialog.customView?.run { - val userField = findViewById<EditText>(R.id.user) - - account?.let { - userField.setText(it.user) - } - } - dialog.show() - } - } - } - .titleColorAttr(R.attr.colorTextPrimary) - .backgroundColorAttr(R.attr.colorBackgroundCard) - .contentColorAttr(R.attr.colorTextPrimary) - .build() - .show() - } - } - is Error.SslError -> { - it.exception.let { - if (it == QuasselSecurityException.NoSsl) { - // Ssl is required but not available - MaterialDialog.Builder(this) - .title(R.string.label_error_ssl) - .content(R.string.label_error_ssl_required_unavailable) - .neutralText(R.string.label_close) - .titleColorAttr(R.attr.colorTextPrimary) - .backgroundColorAttr(R.attr.colorBackgroundCard) - .contentColorAttr(R.attr.colorTextPrimary) - .build() - .show() - } else { - val leafCertificate = it.certificateChain?.firstOrNull() - if (leafCertificate == null || it is QuasselSecurityException.NoCertificate) { - // No certificate exists in the chain - MaterialDialog.Builder(this) - .title(R.string.label_error_certificate) - .content(R.string.label_error_certificate_no_certificate) - .neutralText(R.string.label_close) - .titleColorAttr(R.attr.colorTextPrimary) - .backgroundColorAttr(R.attr.colorBackgroundCard) - .contentColorAttr(R.attr.colorTextPrimary) - .build() - .show() - } else { - when { - // Certificate has expired - it is QuasselSecurityException.Certificate && - (it.cause is CertificateNotYetValidException || - it.cause is CertificateExpiredException) -> { - MaterialDialog.Builder(this) - .title(R.string.label_error_certificate) - .content( - Html.fromHtml( - getString( - R.string.label_error_certificate_invalid, - leafCertificate.sha1Fingerprint, - dateTimeFormatter.format(Instant.ofEpochMilli(leafCertificate.notBefore.time) - .atZone(ZoneId.systemDefault())), - dateTimeFormatter.format(Instant.ofEpochMilli(leafCertificate.notAfter.time) - .atZone(ZoneId.systemDefault())) - ) - ) - ) - .negativeText(R.string.label_disconnect) - .positiveText(R.string.label_whitelist) - .onNegative { _, _ -> - disconnect() - } - .onPositive { _, _ -> - runInBackground { - database.validityWhitelist().save( - SslValidityWhitelistEntry( - fingerprint = leafCertificate.sha1Fingerprint, - ignoreDate = true - ) - ) - - runOnUiThread { - log(INFO, "ChatActivity", "Reconnect triggered: User action") - backend.safeValue.orNull()?.autoConnect(ignoreErrors = true) - } - } - } - .titleColorAttr(R.attr.colorTextPrimary) - .backgroundColorAttr(R.attr.colorBackgroundCard) - .contentColorAttr(R.attr.colorTextPrimary) - .build() - .show() - } - // Certificate is in any other way invalid - it is QuasselSecurityException.Certificate -> { - MaterialDialog.Builder(this) - .title(R.string.label_error_certificate) - .content( - Html.fromHtml( - getString( - R.string.label_error_certificate_untrusted, - leafCertificate.sha1Fingerprint - ) - ) - ) - .negativeText(R.string.label_disconnect) - .positiveText(R.string.label_whitelist) - .onNegative { _, _ -> - disconnect() - } - .onPositive { _, _ -> - runInBackground { - database.validityWhitelist().save( - SslValidityWhitelistEntry( - fingerprint = leafCertificate.sha1Fingerprint, - ignoreDate = !leafCertificate.isValid - ) - ) - accountDatabase.accounts().findById(accountId)?.let { - database.hostnameWhitelist().save( - SslHostnameWhitelistEntry( - fingerprint = leafCertificate.sha1Fingerprint, - hostname = it.host - ) - ) - } - - runOnUiThread { - log(INFO, "ChatActivity", "Reconnect triggered: User action") - backend.safeValue.orNull()?.autoConnect(ignoreErrors = true) - } - } - } - .titleColorAttr(R.attr.colorTextPrimary) - .backgroundColorAttr(R.attr.colorBackgroundCard) - .contentColorAttr(R.attr.colorTextPrimary) - .build() - .show() - } - // Certificate not valid for this hostname - it is QuasselSecurityException.WrongHostname -> { - MaterialDialog.Builder(this) - .title(R.string.label_error_certificate) - .content( - Html.fromHtml( - getString( - R.string.label_error_certificate_no_match, - leafCertificate.sha1Fingerprint, - it.address.host - ) - ) - ) - .negativeText(R.string.label_disconnect) - .positiveText(R.string.label_whitelist) - .onNegative { _, _ -> - disconnect() - } - .onPositive { _, _ -> - runInBackground { - database.hostnameWhitelist().save( - SslHostnameWhitelistEntry( - fingerprint = leafCertificate.sha1Fingerprint, - hostname = it.address.host - ) - ) - - runOnUiThread { - log(INFO, "ChatActivity", "Reconnect triggered: User action") - backend.safeValue.orNull()?.autoConnect(ignoreErrors = true) - } - } - } - .titleColorAttr(R.attr.colorTextPrimary) - .backgroundColorAttr(R.attr.colorBackgroundCard) - .contentColorAttr(R.attr.colorTextPrimary) - .build() - .show() - } - } - } - } - } - } - is Error.ConnectionError -> { - it.throwable.let { - val cause = it.cause - when { - it is UnknownHostException -> { - val host = it.message?.replace("Host is unresolved: ", "") - - Toast.makeText(this, - getString(R.string.label_error_unknown_host, host), - Toast.LENGTH_LONG).show() - } - it is ProtocolVersionException -> { - val protocolVersion: Int = it.protocol.version.toInt() - Toast.makeText(this, - getString(R.string.label_error_invalid_protocol_version, - protocolVersion), - Toast.LENGTH_LONG).show() - } - it is ConnectException && - cause is libcore.io.ErrnoException -> { - val errorCode = OsConstants.errnoName(cause.errno) - val errorName = OsConstants.strerror(cause.errno) - - Toast.makeText(this, - getString(R.string.label_error_connection, errorName, errorCode), - Toast.LENGTH_LONG).show() - } - it is ConnectException && - Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP && - cause is ErrnoException -> { - val errorCode = OsConstants.errnoName(cause.errno) - val errorName = OsConstants.strerror(cause.errno) - - Toast.makeText(this, - getString(R.string.label_error_connection, errorName, errorCode), - Toast.LENGTH_LONG).show() - } - else -> { - Toast.makeText(this, - getString(R.string.label_error_connection_closed), - Toast.LENGTH_LONG).show() - } - } - } - } - } - } - }) - - // After initial connect, open the drawer - modelHelper.connectionProgress - .filter { (it, _, _) -> it == ConnectionState.CONNECTED } - .firstElement() - .toLiveData() - .observe(this, Observer { - if (connectedAccount != accountId) { - if (resources.getBoolean(R.bool.buffer_drawer_exists) && - chatViewModel.bufferId.safeValue == BufferId.MAX_VALUE && - !restoredDrawerState) { - binding.drawerLayout.openDrawer(GravityCompat.START) - } - connectedAccount = accountId - modelHelper.connectedSession.value?.orNull()?.let { session -> - if (session.identities.isEmpty()) { - UserSetupActivity.launch(this) - } - val missingFeatures = RequiredFeatures.features.filter { - it.feature !in session.features.core.enabledFeatures - } - if (missingFeatures.isNotEmpty()) { - runInBackground { - val accounts = accountDatabase.accounts() - val account = accounts.findById(accountId) - if (account?.acceptedMissingFeatures == false) { - val dialog = MissingFeaturesDialog.Builder(this) - .missingFeatures(missingFeatures) - .positiveListener(MaterialDialog.SingleButtonCallback { _, _ -> - runInBackground { - accounts.save(account.copy(acceptedMissingFeatures = true)) - } - }) - runOnUiThread { - dialog.show() - } - } - } - } - } - } - }) - - binding.layoutMain.connectionStatus.setOnClickListener { - modelHelper.sessionManager.value?.orNull()?.apply { - log(INFO, "ChatActivity", "Reconnect triggered: User action") - backend.safeValue.orNull()?.autoConnect(ignoreErrors = true, ignoreSetting = true) - } - } - - // Show Connection Progress Bar - modelHelper.connectionProgress.toLiveData().observe(this, Observer { - val (state, progress, max) = it ?: Triple(ConnectionState.DISCONNECTED, 0, 0) - when (state) { - ConnectionState.DISCONNECTED, - ConnectionState.CLOSED -> { - binding.layoutMain.layoutToolbar.progressBar.visibility = View.INVISIBLE - - binding.layoutMain.connectionStatus.setMode(WarningBarView.MODE_ICON) - binding.layoutMain.connectionStatus.setText(getString(R.string.label_status_disconnected)) - } - ConnectionState.CONNECTING -> { - binding.layoutMain.layoutToolbar.progressBar.visibility = View.VISIBLE - binding.layoutMain.layoutToolbar.progressBar.isIndeterminate = true - - binding.layoutMain.connectionStatus.setMode(WarningBarView.MODE_PROGRESS) - binding.layoutMain.connectionStatus.setText(getString(R.string.label_status_connecting)) - } - ConnectionState.HANDSHAKE -> { - binding.layoutMain.layoutToolbar.progressBar.visibility = View.VISIBLE - binding.layoutMain.layoutToolbar.progressBar.isIndeterminate = true - - binding.layoutMain.connectionStatus.setMode(WarningBarView.MODE_PROGRESS) - binding.layoutMain.connectionStatus.setText(getString(R.string.label_status_handshake)) - } - ConnectionState.INIT -> { - binding.layoutMain.layoutToolbar.progressBar.visibility = View.VISIBLE - // Show indeterminate when no progress has been made yet - binding.layoutMain.layoutToolbar.progressBar.isIndeterminate = progress == 0 || max == 0 - binding.layoutMain.layoutToolbar.progressBar.progress = progress - binding.layoutMain.layoutToolbar.progressBar.max = max - - binding.layoutMain.connectionStatus.setMode(WarningBarView.MODE_PROGRESS) - binding.layoutMain.connectionStatus.setText(getString(R.string.label_status_init)) - } - ConnectionState.CONNECTED -> { - binding.layoutMain.layoutToolbar.progressBar.visibility = View.INVISIBLE - - binding.layoutMain.connectionStatus.setMode(WarningBarView.MODE_NONE) - } - } - }) - - // Only show nick list when we’re in a channel bufferId - modelHelper.bufferDataThrottled.toLiveData().observe(this, Observer { - bufferData = it - if (bufferData?.info?.type?.hasFlag(Buffer_Type.ChannelBuffer) == true) { - binding.drawerLayout.setDrawerLockMode(DrawerLayout.LOCK_MODE_UNLOCKED, GravityCompat.END) - } else { - binding.drawerLayout.setDrawerLockMode(DrawerLayout.LOCK_MODE_LOCKED_CLOSED, GravityCompat.END) - } - - invalidateOptionsMenu() - }) - - editorBottomSheet = DragInterceptBottomSheetBehavior.from(binding.root.findViewById(R.id.fragment_chatline)) - editorBottomSheet.state = BottomSheetBehavior.STATE_COLLAPSED - chatlineFragment?.panelSlideListener?.let(editorBottomSheet::setBottomSheetCallback) - - chatlineFragment?.historyBottomSheet?.bottomSheetCallback = object : - BottomSheetBehavior.BottomSheetCallback() { - override fun onSlide(bottomSheet: View, slideOffset: Float) { - val opacity = (1.0f - slideOffset) / 2.0f - chatlineFragment?.editorContainer?.alpha = opacity - } - - override fun onStateChanged(bottomSheet: View, newState: Int) { - editorBottomSheet.allowDragging = newState == BottomSheetBehavior.STATE_HIDDEN - } - } - - combineLatest(modelHelper.allBuffers, - modelHelper.chat.chatToJoin).map { (buffers, chatToJoinOptional) -> - val chatToJoin = chatToJoinOptional.orNull() - if (chatToJoin == null) { - emptyList() - } else { - val (networkId, channel) = chatToJoin - - listOfNotNull(buffers.find { - it.networkId == networkId && - it.bufferName == channel && - it.type.hasFlag(Buffer_Type.ChannelBuffer) - }) - } - }.filter { - it.isNotEmpty() - }.firstElement().toLiveData().observeForever { - it?.firstOrNull()?.let { info -> - launch(this, bufferId = info.bufferId) - } - } - } - - override fun onNewIntent(intent: Intent?) { - super.onNewIntent(intent) - setIntent(intent) - } - - private var bufferData: BufferData? = null - var actionMode: ActionMode? = null - private var statusBarColor: Int? = null - - override fun onActionModeStarted(mode: ActionMode?) { - when (mode?.tag) { - "BUFFER", - "MESSAGES" -> mode.menu?.retint(binding.layoutMain.layoutToolbar.toolbar.context) - } - actionMode = mode - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { - statusBarColor = window.statusBarColor - window.statusBarColor = theme.styledAttributes(R.attr.colorPrimaryDark) { - getColor(0, 0) - } - } - super.onActionModeStarted(mode) - } - - override fun onActionModeFinished(mode: ActionMode?) { - actionMode = null - super.onActionModeFinished(mode) - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { - statusBarColor?.let { - window.statusBarColor = it - statusBarColor = null - } - } - } - - override fun onStart() { - if (Settings.autoComplete(this) != autoCompleteSettings) { - recreate() - } - if (Settings.message(this) != messageSettings) { - recreate() - } - if (Settings.notification(this) != notificationSettings) { - recreate() - } - super.onStart() - } - - override fun onResume() { - super.onResume() - intent?.let(this@ChatActivity::processIntent) - } - - override fun onSaveInstanceState(outState: Bundle) { - super.onSaveInstanceState(outState) - chatViewModel.onSaveInstanceState(outState) - - outState.putLong(KEY_CONNECTED_ACCOUNT, connectedAccount.id) - outState.putBoolean(KEY_OPEN_DRAWER_START, binding.drawerLayout.isDrawerOpen(GravityCompat.START)) - outState.putBoolean(KEY_OPEN_DRAWER_END, binding.drawerLayout.isDrawerOpen(GravityCompat.END)) - } - - override fun onRestoreInstanceState(savedInstanceState: Bundle?) { - super.onRestoreInstanceState(savedInstanceState) - if (savedInstanceState != null) { - chatViewModel.onRestoreInstanceState(savedInstanceState) - } - - connectedAccount = AccountId(savedInstanceState?.getLong(KEY_CONNECTED_ACCOUNT, -1L) ?: -1L) - - if (savedInstanceState?.getBoolean(KEY_OPEN_DRAWER_START) == true && - resources.getBoolean(R.bool.buffer_drawer_exists)) { - binding.drawerLayout.openDrawer(GravityCompat.START) - } - if (savedInstanceState?.getBoolean(KEY_OPEN_DRAWER_END) == true) { - binding.drawerLayout.openDrawer(GravityCompat.END) - } - if (savedInstanceState?.getBoolean(KEY_OPEN_DRAWER_START) != null || - savedInstanceState?.getBoolean(KEY_OPEN_DRAWER_END) != null) { - restoredDrawerState = true - } - } - - override fun onCreateOptionsMenu(menu: Menu?): Boolean { - val nickCountDrawableSize = resources.getDimensionPixelSize(R.dimen.size_nick_count) - val nickCountDrawableColor = binding.layoutMain.layoutToolbar.toolbar.context.theme.styledAttributes(R.attr.colorControlNormal) { - getColor(0, 0) - } - - menuInflater.inflate(R.menu.activity_main, menu) - menu?.findItem(R.id.action_nicklist)?.isVisible = bufferData?.info?.type?.hasFlag(Buffer_Type.ChannelBuffer) - ?: false - menu?.findItem(R.id.action_filter_messages)?.isVisible = - (bufferData?.info?.type?.hasFlag(Buffer_Type.ChannelBuffer) ?: false || - bufferData?.info?.type?.hasFlag(Buffer_Type.QueryBuffer) ?: false) - menu?.retint(binding.layoutMain.layoutToolbar.toolbar.context) - menu?.findItem(R.id.action_nicklist)?.icon = NickCountDrawable( - bufferData?.userCount ?: 0, - nickCountDrawableSize, - nickCountDrawableColor) - return super.onCreateOptionsMenu(menu) - } - - override fun onOptionsItemSelected(item: MenuItem?) = when (item?.itemId) { - android.R.id.home -> { - drawerToggle.onOptionsItemSelected(item) - } - R.id.action_nicklist -> { - if (binding.drawerLayout.isDrawerVisible(GravityCompat.END)) { - binding.drawerLayout.closeDrawer(GravityCompat.END) - } else { - binding.drawerLayout.openDrawer(GravityCompat.END) - } - true - } - R.id.action_filter_messages -> { - runInBackground { - chatViewModel.bufferId { buffer -> - val filteredRaw = database.filtered().get( - accountId, - buffer, - accountDatabase.accounts().findById(accountId)?.defaultFiltered ?: 0 - ) - val filtered = Message_Type.of(filteredRaw) - val flags = uintArrayOf( - Message.MessageType.Join.bit or Message.MessageType.NetsplitJoin.bit, - Message.MessageType.Part.bit, - Message.MessageType.Quit.bit or Message.MessageType.NetsplitQuit.bit, - Message.MessageType.Nick.bit, - Message.MessageType.Mode.bit, - Message.MessageType.Topic.bit - ) - val selectedIndices = flags.withIndex().mapNotNull { (index, flag) -> - if ((filtered and flag).isNotEmpty()) index - else null - }.toTypedArray() - - MaterialDialog.Builder(this) - .title(R.string.label_filter_messages) - .items(R.array.message_filter_types) - .itemsIds(flags.toIntArray()) - .itemsCallbackMultiChoice(selectedIndices) { _, _, _ -> false } - .positiveText(R.string.label_select) - .negativeText(R.string.label_use_default) - .onNegative { _, _ -> - runInBackground { - database.filtered().clear(accountId, buffer) - } - } - .neutralText(R.string.label_set_default) - .onNeutral { dialog, _ -> - val selected = dialog.selectedIndices ?: emptyArray() - runInBackground { - val newlyFiltered = selected - .asSequence() - .map { flags[it] } - .fold(Message_Type.of()) { acc, i -> acc or i } - - accountDatabase.accounts().setFiltered(accountId, newlyFiltered.value.toInt()) - database.filtered().setFiltered(accountId, buffer, newlyFiltered.value.toInt()) - } - } - .onPositive { dialog, _ -> - val selected = dialog.selectedIndices ?: emptyArray() - runInBackground { - val newlyFiltered = selected - .asSequence() - .map { flags[it] } - .fold(Message_Type.of()) { acc, i -> acc or i } - - database.filtered().replace( - Filtered.of(accountId, buffer, newlyFiltered.value.toInt()) - ) - } - } - .negativeColorAttr(R.attr.colorTextPrimary) - .neutralColorAttr(R.attr.colorTextPrimary) - .backgroundColorAttr(R.attr.colorBackgroundCard) - .contentColorAttr(R.attr.colorTextPrimary) - .titleColorAttr(R.attr.colorTextPrimary) - .build() - .show() - } - } - true - } - R.id.action_core_settings -> { - CoreSettingsActivity.launch(this) - true - } - R.id.action_client_settings -> { - ClientSettingsActivity.launch(this) - true - } - R.id.action_about -> { - AboutActivity.launch(this) - true - } - R.id.action_disconnect -> { - disconnect() - true - } - else -> super.onOptionsItemSelected(item) - } - - override fun onBackPressed() { - if (chatlineFragment?.historyBottomSheet?.state == BottomSheetBehavior.STATE_EXPANDED) { - chatlineFragment?.historyBottomSheet?.state = BottomSheetBehavior.STATE_HIDDEN - return - } - - if (editorBottomSheet.state == BottomSheetBehavior.STATE_EXPANDED) { - editorBottomSheet.state = BottomSheetBehavior.STATE_COLLAPSED - return - } - - super.onBackPressed() - } - - private fun disconnect() { - getSharedPreferences(Keys.Status.NAME, Context.MODE_PRIVATE).editCommit { - putBoolean(Keys.Status.reconnect, false) - } - } - - private var startedSelection = false - - override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) { - super.onActivityResult(requestCode, resultCode, data) - - if (requestCode == REQUEST_SELECT_ACCOUNT) { - startedSelection = false - connectedAccount = AccountId(-1L) - - if (resultCode == Activity.RESULT_CANCELED) { - finish() - } - } - } - - private fun resetAccount() { - startedSelection = true - connectedAccount = AccountId(-1L) - restoredDrawerState = false - ChatActivity.launch(this, bufferId = BufferId.MAX_VALUE) - chatViewModel.resetAccount() - } - - override fun onSelectAccount() { - if (!startedSelection) { - resetAccount() - startActivityForResult(AccountSelectionActivity.intent(this), REQUEST_SELECT_ACCOUNT) - } - } - - companion object { - // Intent keys - private const val KEY_AUTOCOMPLETE_TEXT = "autocomplete_text" - private const val KEY_AUTOCOMPLETE_SUFFIX = "autocomplete_suffix" - private const val KEY_BUFFER_ID = "buffer_id" - private const val KEY_ACCOUNT_ID = "account_id" - private const val KEY_NETWORK_ID = "network_id" - private const val KEY_CHANNEL = "channel" - private const val KEY_NICK_NAME = "nick_name" - private const val KEY_FORCE_JOIN = "force_join" - - // Instance state keys - private const val KEY_OPEN_BUFFER = "open_buffer" - private const val KEY_OPEN_BUFFERVIEWCONFIG = "open_bufferviewconfig" - private const val KEY_CONNECTED_ACCOUNT = "connected_account" - private const val KEY_OPEN_DRAWER_START = "open_drawer_start" - private const val KEY_OPEN_DRAWER_END = "open_drawer_end" - - fun launch( - context: Context, - sharedText: CharSequence? = null, - autoCompleteText: CharSequence? = null, - autoCompleteSuffix: String? = null, - channel: String? = null, - nickName: String? = null, - networkId: NetworkId? = null, - bufferId: BufferId? = null, - accountId: Long? = null, - forceJoin: Boolean? = null - ) = context.startActivity( - intent(context, - sharedText, - autoCompleteText, - autoCompleteSuffix, - channel, - nickName, - networkId, - bufferId, - accountId, - forceJoin) - ) - - fun intent( - context: Context, - sharedText: CharSequence? = null, - autoCompleteText: CharSequence? = null, - autoCompleteSuffix: String? = null, - channel: String? = null, - nickName: String? = null, - networkId: NetworkId? = null, - bufferId: BufferId? = null, - accountId: Long? = null, - forceJoin: Boolean? = null - ) = Intent(context, ChatActivity::class.java).apply { - if (sharedText != null) { - type = "text/plain" - putExtra(Intent.EXTRA_TEXT, sharedText) - } - if (autoCompleteText != null) { - putExtra(KEY_AUTOCOMPLETE_TEXT, autoCompleteText) - if (autoCompleteSuffix != null) { - putExtra(KEY_AUTOCOMPLETE_SUFFIX, autoCompleteSuffix) - } - } - if (bufferId != null) { - putExtra(KEY_BUFFER_ID, bufferId.id) - if (accountId != null) { - putExtra(KEY_ACCOUNT_ID, accountId) - } - } - if (networkId != null && channel != null) { - putExtra(KEY_NETWORK_ID, networkId.id) - putExtra(KEY_CHANNEL, channel) - } else if (networkId != null && nickName != null) { - putExtra(KEY_NETWORK_ID, networkId.id) - putExtra(KEY_NICK_NAME, nickName) - if (forceJoin != null) { - putExtra(KEY_NICK_NAME, nickName) - } - } - } - } -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/ui/chat/ChatActivityModule.kt b/app/src/main/java/de/kuschku/quasseldroid/ui/chat/ChatActivityModule.kt deleted file mode 100644 index a29bd4342177c341b34ce71672c22ffcaa68db5a..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/ui/chat/ChatActivityModule.kt +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.ui.chat - -import dagger.Binds -import dagger.Module -import de.kuschku.quasseldroid.ui.chat.messages.MessageRenderer -import de.kuschku.quasseldroid.ui.chat.messages.QuasselMessageRenderer - -@Module -abstract class ChatActivityModule { - @Binds - abstract fun bindMessageRenderer(messageRenderer: QuasselMessageRenderer): MessageRenderer -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/ui/chat/ChatFragmentProvider.kt b/app/src/main/java/de/kuschku/quasseldroid/ui/chat/ChatFragmentProvider.kt deleted file mode 100644 index a38d77d20096c53d6678165cc64f3f75e1daa5bd..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/ui/chat/ChatFragmentProvider.kt +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.ui.chat - -import androidx.fragment.app.FragmentActivity -import dagger.Binds -import dagger.Module -import dagger.android.ContributesAndroidInjector -import de.kuschku.quasseldroid.ui.chat.buffers.BufferViewConfigFragment -import de.kuschku.quasseldroid.ui.chat.input.ChatlineFragment -import de.kuschku.quasseldroid.ui.chat.messages.MessageListFragment -import de.kuschku.quasseldroid.ui.chat.nicks.NickListFragment - -@Module -abstract class ChatFragmentProvider { - @Binds - abstract fun bindFragmentActivity(activity: ChatActivity): FragmentActivity - - @ContributesAndroidInjector - abstract fun bindBufferViewConfigFragment(): BufferViewConfigFragment - - @ContributesAndroidInjector - abstract fun bindMessageListFragment(): MessageListFragment - - @ContributesAndroidInjector - abstract fun bindNickListFragment(): NickListFragment - - @ContributesAndroidInjector - abstract fun bindToolbarFragment(): ToolbarFragment - - @ContributesAndroidInjector - abstract fun bindChatlineFragment(): ChatlineFragment -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/ui/chat/ToolbarFragment.kt b/app/src/main/java/de/kuschku/quasseldroid/ui/chat/ToolbarFragment.kt deleted file mode 100644 index ef3e778f023a6fb984a2586ca48b3f2d8bd1973c..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/ui/chat/ToolbarFragment.kt +++ /dev/null @@ -1,192 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.ui.chat - -import android.os.Bundle -import android.view.LayoutInflater -import android.view.View -import android.view.ViewGroup -import android.widget.TextView -import androidx.appcompat.widget.AppCompatImageView -import androidx.lifecycle.Observer -import butterknife.BindView -import butterknife.ButterKnife -import de.kuschku.libquassel.protocol.Buffer_Type -import de.kuschku.libquassel.quassel.BufferInfo -import de.kuschku.libquassel.util.flag.hasFlag -import de.kuschku.libquassel.util.helper.combineLatest -import de.kuschku.libquassel.util.helper.value -import de.kuschku.quasseldroid.GlideApp -import de.kuschku.quasseldroid.R -import de.kuschku.quasseldroid.settings.AppearanceSettings -import de.kuschku.quasseldroid.settings.MessageSettings -import de.kuschku.quasseldroid.ui.info.channel.ChannelInfoActivity -import de.kuschku.quasseldroid.ui.info.user.UserInfoActivity -import de.kuschku.quasseldroid.util.ColorContext -import de.kuschku.quasseldroid.util.avatars.AvatarHelper -import de.kuschku.quasseldroid.util.helper.loadAvatars -import de.kuschku.quasseldroid.util.helper.setTooltip -import de.kuschku.quasseldroid.util.helper.toLiveData -import de.kuschku.quasseldroid.util.helper.visibleIf -import de.kuschku.quasseldroid.util.irc.format.IrcFormatDeserializer -import de.kuschku.quasseldroid.util.service.ServiceBoundFragment -import de.kuschku.quasseldroid.util.ui.SpanFormatter -import de.kuschku.quasseldroid.viewmodel.helper.EditorViewModelHelper -import javax.inject.Inject - -class ToolbarFragment : ServiceBoundFragment() { - @BindView(R.id.toolbar_title) - lateinit var toolbarTitle: TextView - - @BindView(R.id.toolbar_subtitle) - lateinit var toolbarSubtitle: TextView - - @BindView(R.id.toolbar_icon) - lateinit var icon: AppCompatImageView - - @BindView(R.id.toolbar_action_area) - lateinit var actionArea: View - - @Inject - lateinit var modelHelper: EditorViewModelHelper - - @Inject - lateinit var ircFormatDeserializer: IrcFormatDeserializer - - @Inject - lateinit var appearanceSettings: AppearanceSettings - - @Inject - lateinit var messageSettings: MessageSettings - - var title: CharSequence? - get() = toolbarTitle.text - set(value) { - if (value != null) - toolbarTitle.text = value - else - toolbarTitle.setText(R.string.app_name) - } - - var subtitle: CharSequence? - get() = toolbarTitle.text - set(value) { - toolbarSubtitle.text = value ?: "" - toolbarSubtitle.visibleIf(value?.isNotEmpty() == true) - } - - override fun onCreateView( - inflater: LayoutInflater, - container: ViewGroup?, - savedInstanceState: Bundle? - ): View? { - val view = inflater.inflate(R.layout.chat_toolbar, container, false) - ButterKnife.bind(this, view) - - fun colorizeDescription(description: String?) = ircFormatDeserializer.formatString( - description, messageSettings.colorizeMirc - ) - - val avatarSize = resources.getDimensionPixelSize(R.dimen.avatar_size_buffer) - - val colorContext = ColorContext(requireContext(), messageSettings) - - combineLatest(modelHelper.bufferDataThrottled, modelHelper.lag).map { - val avatarInfo = it.first?.ircUser?.let { user -> - val avatarUrls = AvatarHelper.avatar(messageSettings, user, avatarSize) - - val nickName = user.nick() - val useSelfColor = when (messageSettings.colorizeNicknames) { - MessageSettings.SenderColorMode.ALL -> false - MessageSettings.SenderColorMode.ALL_BUT_MINE -> - user.network().isMyNick(nickName) - MessageSettings.SenderColorMode.NONE -> true - } - - val fallbackDrawable = colorContext.buildTextDrawable(user.nick(), useSelfColor) - - Pair(avatarUrls, fallbackDrawable) - } - - Triple(it.first, it.second, avatarInfo) - }.toLiveData() - .observe(viewLifecycleOwner, Observer { - if (it != null) { - val (data, lag, avatarInfo) = it - - if (avatarInfo != null) { - val (avatarUrls, fallbackDrawable) = avatarInfo - icon.loadAvatars(avatarUrls, fallbackDrawable, crop = !messageSettings.squareAvatars) - icon.visibility = View.VISIBLE - } else { - GlideApp.with(icon).clear(icon) - icon.visibility = View.GONE - } - - if (data?.info?.type?.hasFlag(Buffer_Type.StatusBuffer) == true) { - this.title = data.network?.networkName() - } else { - this.title = data?.info?.bufferName - } - - if (lag == 0L || !appearanceSettings.showLag) { - this.subtitle = colorizeDescription(data?.description) - } else { - val description = colorizeDescription(data?.description) - if (description.isBlank()) { - this.subtitle = "Lag: ${lag}ms" - } else { - this.subtitle = SpanFormatter.format( - "Lag: %dms | %s", - lag, - colorizeDescription(data?.description) - ) - } - } - } - }) - - actionArea.setOnClickListener { - val bufferData = modelHelper.bufferData.value - bufferData?.info?.let { info -> - when (info.type.toInt()) { - BufferInfo.Type.QueryBuffer.toInt() -> { - UserInfoActivity.launch( - requireContext(), - bufferId = info.bufferId, - openBuffer = true - ) - } - BufferInfo.Type.ChannelBuffer.toInt() -> { - ChannelInfoActivity.launch( - requireContext(), - bufferId = info.bufferId, - openBuffer = true - ) - } - else -> null - } - } - } - actionArea.setTooltip() - - return view - } -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/ui/chat/add/NetworkAdapter.kt b/app/src/main/java/de/kuschku/quasseldroid/ui/chat/add/NetworkAdapter.kt deleted file mode 100644 index 27ecf649507e7cfb654a07a7316086797f35cbfb..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/ui/chat/add/NetworkAdapter.kt +++ /dev/null @@ -1,81 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.ui.chat.add - -import android.view.LayoutInflater -import android.view.ViewGroup -import androidx.appcompat.widget.ThemedSpinnerAdapter -import androidx.recyclerview.widget.RecyclerView -import de.kuschku.libquassel.protocol.NetworkId -import de.kuschku.quasseldroid.databinding.WidgetSpinnerItemMaterialBinding -import de.kuschku.quasseldroid.util.ui.ContextThemeWrapper -import de.kuschku.quasseldroid.util.ui.RecyclerSpinnerAdapter - -class NetworkAdapter : RecyclerSpinnerAdapter<NetworkAdapter.NetworkViewHolder>(), - ThemedSpinnerAdapter { - var data = listOf<NetworkItem>() - - fun submitList(list: List<NetworkItem>) { - if (data != list) { - data = list - notifyDataSetChanged() - } - } - - override fun isEmpty() = data.isEmpty() - - override fun onBindViewHolder(holder: NetworkViewHolder, position: Int) = - holder.bind( - getItem(position) - ?: throw IndexOutOfBoundsException("Index: $position, Size: ${data.size}") - ) - - override fun onCreateViewHolder(parent: ViewGroup, dropDown: Boolean) - : NetworkViewHolder { - val inflater = LayoutInflater.from( - if (dropDown) - ContextThemeWrapper(parent.context, dropDownViewTheme) - else - parent.context - ) - return NetworkViewHolder(WidgetSpinnerItemMaterialBinding.inflate(inflater, parent, false)) - } - - fun indexOf(id: NetworkId): Int? { - for ((key, item) in data.withIndex()) { - if (item.id == id) { - return key - } - } - return null - } - - override fun getItem(position: Int): NetworkItem? = data.getOrNull(position) - override fun getItemId(position: Int) = getItem(position)?.id?.id?.toLong() ?: 0L - override fun hasStableIds() = true - override fun getCount() = data.size - class NetworkViewHolder( - private val binding: WidgetSpinnerItemMaterialBinding - ) : RecyclerView.ViewHolder(binding.root) { - fun bind(network: NetworkItem) { - binding.text1.text = network.name - } - } -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/ui/chat/add/NetworkItem.kt b/app/src/main/java/de/kuschku/quasseldroid/ui/chat/add/NetworkItem.kt deleted file mode 100644 index a276c401bb6ba281d5c00ac98ca82903414ce44e..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/ui/chat/add/NetworkItem.kt +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.ui.chat.add - -import de.kuschku.libquassel.protocol.NetworkId - -data class NetworkItem( - val id: NetworkId, - val name: String -) diff --git a/app/src/main/java/de/kuschku/quasseldroid/ui/chat/add/create/ChannelCreateActivity.kt b/app/src/main/java/de/kuschku/quasseldroid/ui/chat/add/create/ChannelCreateActivity.kt deleted file mode 100644 index aa1e94cd153bcd392b416cf357b56f267a68e11d..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/ui/chat/add/create/ChannelCreateActivity.kt +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.ui.chat.add.create - -import android.content.Context -import android.content.Intent -import de.kuschku.libquassel.protocol.NetworkId -import de.kuschku.quasseldroid.util.ui.settings.ServiceBoundSettingsActivity - -class ChannelCreateActivity : ServiceBoundSettingsActivity(ChannelCreateFragment()) { - companion object { - fun launch( - context: Context, - networkId: NetworkId? = null - ) = context.startActivity(intent(context, networkId)) - - fun intent( - context: Context, - networkId: NetworkId? = null - ) = Intent(context, ChannelCreateActivity::class.java).apply { - if (networkId != null) { - putExtra("network_id", networkId.id) - } - } - } -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/ui/chat/add/create/ChannelCreateFragment.kt b/app/src/main/java/de/kuschku/quasseldroid/ui/chat/add/create/ChannelCreateFragment.kt deleted file mode 100644 index edb24889b403207cc2e308adff3437f9868bec80..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/ui/chat/add/create/ChannelCreateFragment.kt +++ /dev/null @@ -1,222 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.ui.chat.add.create - -import android.os.Bundle -import android.view.LayoutInflater -import android.view.View -import android.view.ViewGroup -import android.widget.AdapterView -import android.widget.Button -import android.widget.EditText -import androidx.appcompat.widget.AppCompatSpinner -import androidx.appcompat.widget.SwitchCompat -import androidx.lifecycle.Observer -import butterknife.BindView -import butterknife.ButterKnife -import de.kuschku.libquassel.protocol.Buffer_Type -import de.kuschku.libquassel.protocol.NetworkId -import de.kuschku.libquassel.quassel.syncables.IrcChannel -import de.kuschku.libquassel.quassel.syncables.Network -import de.kuschku.libquassel.util.helper.combineLatest -import de.kuschku.libquassel.util.helper.nullIf -import de.kuschku.libquassel.util.helper.safeSwitchMap -import de.kuschku.libquassel.util.helper.value -import de.kuschku.quasseldroid.R -import de.kuschku.quasseldroid.ui.chat.ChatActivity -import de.kuschku.quasseldroid.ui.chat.add.NetworkAdapter -import de.kuschku.quasseldroid.ui.chat.add.NetworkItem -import de.kuschku.quasseldroid.util.helper.setDependent -import de.kuschku.quasseldroid.util.helper.toLiveData -import de.kuschku.quasseldroid.util.ui.settings.fragment.ServiceBoundSettingsFragment -import de.kuschku.quasseldroid.viewmodel.helper.QuasselViewModelHelper -import io.reactivex.Observable -import javax.inject.Inject - -class ChannelCreateFragment : ServiceBoundSettingsFragment() { - @BindView(R.id.network) - lateinit var network: AppCompatSpinner - - @BindView(R.id.name) - lateinit var name: EditText - - @BindView(R.id.hidden) - lateinit var hidden: SwitchCompat - - @BindView(R.id.invite_only) - lateinit var inviteOnly: SwitchCompat - - @BindView(R.id.password_protected) - lateinit var passwordProtected: SwitchCompat - - @BindView(R.id.password_group) - lateinit var passwordGroup: ViewGroup - - @BindView(R.id.password) - lateinit var password: EditText - - @BindView(R.id.save) - lateinit var save: Button - - @Inject - lateinit var modelHelper: QuasselViewModelHelper - - private var hasSelectedNetwork = false - private var networkId = NetworkId(0) - - override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, - savedInstanceState: Bundle?): View? { - val view = inflater.inflate(R.layout.add_create, container, false) - ButterKnife.bind(this, view) - - networkId = NetworkId( - savedInstanceState?.getInt("network_id", 0) - ?: arguments?.getInt("network_id", 0) - ?: 0 - ) - - val networkAdapter = NetworkAdapter() - network.adapter = networkAdapter - - network.onItemSelectedListener = object : AdapterView.OnItemSelectedListener { - override fun onNothingSelected(parent: AdapterView<*>?) { - networkId = NetworkId(0) - } - - override fun onItemSelected(parent: AdapterView<*>?, view: View?, position: Int, id: Long) { - networkId = networkAdapter.getItem(position)?.id - ?: NetworkId(0) - hasSelectedNetwork = true - } - } - - var hasSetNetwork = false - modelHelper.networks.safeSwitchMap { - combineLatest(it.values.map(Network::liveNetworkInfo)).map { - it.map { - NetworkItem(it.networkId, it.networkName) - }.sortedWith(compareBy(String.CASE_INSENSITIVE_ORDER, NetworkItem::name)) - } - }.toLiveData().observe(viewLifecycleOwner, Observer { - if (it != null) { - networkAdapter.submitList(it) - if (!hasSetNetwork && networkId.isValidId() && it.isNotEmpty()) { - network.post { - val index = networkAdapter.indexOf(networkId) - if (index != null) { - network.setSelection(index) - hasSelectedNetwork = true - } - } - hasSetNetwork = true - } - } - }) - - passwordProtected.setDependent(passwordGroup) - - save.setOnClickListener { - save.setText(R.string.label_saving) - save.isEnabled = false - - val selectedNetworkId = NetworkId(network.selectedItemId.toInt()) - val channelName = name.text.toString().trim() - - val isInviteOnly = inviteOnly.isChecked - val isHidden = hidden.isChecked - val isPasswordProtected = passwordProtected.isChecked - val channelPassword = password.text.toString().trim() - - modelHelper.bufferSyncer.value?.orNull()?.let { bufferSyncer -> - val existingBuffer = bufferSyncer.find( - networkId = selectedNetworkId, - type = Buffer_Type.of(Buffer_Type.ChannelBuffer), - bufferName = channelName - ) - val existingChannel = modelHelper.networks.value?.get(selectedNetworkId)?.ircChannel( - channelName) - .nullIf { it == IrcChannel.NULL } - if (existingBuffer != null) { - if (existingChannel == null) { - bufferSyncer.find( - networkId = selectedNetworkId, - type = Buffer_Type.of(Buffer_Type.StatusBuffer) - )?.let { statusBuffer -> - modelHelper.connectedSession.value?.orNull()?.rpcHandler?.apply { - sendInput(statusBuffer, "/join $channelName") - } - } - } - - activity?.let { - it.finish() - ChatActivity.launch(it, - bufferId = existingBuffer.bufferId - ) - } - } else { - bufferSyncer.find( - networkId = selectedNetworkId, - type = Buffer_Type.of(Buffer_Type.StatusBuffer) - )?.let { statusBuffer -> - modelHelper.connectedSession.value?.orNull()?.rpcHandler?.apply { - sendInput(statusBuffer, "/join $channelName") - modelHelper.networks.safeSwitchMap { - it[selectedNetworkId]?.liveIrcChannel(channelName) - ?: Observable.empty() - }.subscribe { - if (it.ircUsers().size <= 1) { - if (isInviteOnly) { - sendInput(statusBuffer, "/mode $channelName +i") - } - - if (isHidden) { - sendInput(statusBuffer, "/mode $channelName +s") - } - - if (isPasswordProtected) { - sendInput(statusBuffer, "/mode $channelName +k $channelPassword") - } - } - - activity?.let { - it.finish() - ChatActivity.launch(it, - networkId = selectedNetworkId, - channel = channelName - ) - } - } - } - } - } - } - } - - return view - } - - override fun onSaveInstanceState(outState: Bundle) { - super.onSaveInstanceState(outState) - if (networkId.isValidId() && hasSelectedNetwork) { - outState.putInt("network_id", networkId.id) - } - } -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/ui/chat/add/create/ChannelCreateFragmentProvider.kt b/app/src/main/java/de/kuschku/quasseldroid/ui/chat/add/create/ChannelCreateFragmentProvider.kt deleted file mode 100644 index be6c9a8f3bb402feab611db1eea42b65fcebae25..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/ui/chat/add/create/ChannelCreateFragmentProvider.kt +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.ui.chat.add.create - -import androidx.fragment.app.FragmentActivity -import dagger.Binds -import dagger.Module -import dagger.android.ContributesAndroidInjector - -@Module -abstract class ChannelCreateFragmentProvider { - @Binds - abstract fun bindFragmentActivity(activity: ChannelCreateActivity): FragmentActivity - - @ContributesAndroidInjector - abstract fun bindChannelCreateFragment(): ChannelCreateFragment -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/ui/chat/add/join/ChannelJoinActivity.kt b/app/src/main/java/de/kuschku/quasseldroid/ui/chat/add/join/ChannelJoinActivity.kt deleted file mode 100644 index 7f9e4947fcbcb0fc46019dfb49db1bce4dd96aa2..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/ui/chat/add/join/ChannelJoinActivity.kt +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.ui.chat.add.join - -import android.content.Context -import android.content.Intent -import de.kuschku.libquassel.protocol.NetworkId -import de.kuschku.quasseldroid.util.ui.settings.ServiceBoundSettingsActivity - -class ChannelJoinActivity : ServiceBoundSettingsActivity(ChannelJoinFragment()) { - companion object { - fun launch( - context: Context, - networkId: NetworkId? = null - ) = context.startActivity(intent(context, networkId)) - - fun intent( - context: Context, - networkId: NetworkId? = null - ) = Intent(context, ChannelJoinActivity::class.java).apply { - if (networkId != null) { - putExtra("network_id", networkId.id) - } - } - } -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/ui/chat/add/join/ChannelJoinFragment.kt b/app/src/main/java/de/kuschku/quasseldroid/ui/chat/add/join/ChannelJoinFragment.kt deleted file mode 100644 index f5b5e3c5cff1e0aed2191b9533c593fc13a08ee1..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/ui/chat/add/join/ChannelJoinFragment.kt +++ /dev/null @@ -1,138 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.ui.chat.add.join - -import android.os.Bundle -import android.view.LayoutInflater -import android.view.View -import android.view.ViewGroup -import android.widget.AdapterView -import android.widget.Button -import android.widget.EditText -import androidx.appcompat.widget.AppCompatSpinner -import androidx.lifecycle.Observer -import butterknife.BindView -import butterknife.ButterKnife -import de.kuschku.libquassel.protocol.NetworkId -import de.kuschku.libquassel.quassel.syncables.Network -import de.kuschku.libquassel.util.helper.combineLatest -import de.kuschku.libquassel.util.helper.safeSwitchMap -import de.kuschku.quasseldroid.R -import de.kuschku.quasseldroid.ui.chat.ChatActivity -import de.kuschku.quasseldroid.ui.chat.add.NetworkAdapter -import de.kuschku.quasseldroid.ui.chat.add.NetworkItem -import de.kuschku.quasseldroid.util.helper.toLiveData -import de.kuschku.quasseldroid.util.service.ServiceBoundFragment -import de.kuschku.quasseldroid.viewmodel.helper.QuasselViewModelHelper -import javax.inject.Inject - -class ChannelJoinFragment : ServiceBoundFragment() { - @BindView(R.id.network) - lateinit var network: AppCompatSpinner - - @BindView(R.id.name) - lateinit var name: EditText - - @BindView(R.id.join) - lateinit var join: Button - - @Inject - lateinit var modelHelper: QuasselViewModelHelper - - private var hasSelectedNetwork = false - private var networkId = NetworkId(0) - - override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, - savedInstanceState: Bundle?): View? { - val view = inflater.inflate(R.layout.add_join, container, false) - ButterKnife.bind(this, view) - - networkId = NetworkId( - savedInstanceState?.getInt("network_id", 0) - ?: arguments?.getInt("network_id", 0) - ?: 0 - ) - - val networkAdapter = NetworkAdapter() - network.adapter = networkAdapter - - network.onItemSelectedListener = object : AdapterView.OnItemSelectedListener { - override fun onNothingSelected(parent: AdapterView<*>?) { - networkId = NetworkId(0) - } - - override fun onItemSelected(parent: AdapterView<*>?, view: View?, position: Int, id: Long) { - networkId = networkAdapter.getItem(position)?.id - ?: NetworkId(0) - hasSelectedNetwork = true - } - } - - var hasSetNetwork = false - modelHelper.networks.safeSwitchMap { - combineLatest(it.values.map(Network::liveNetworkInfo)).map { - it.map { - NetworkItem(it.networkId, it.networkName) - }.sortedWith(compareBy(String.CASE_INSENSITIVE_ORDER, NetworkItem::name)) - } - }.toLiveData().observe(viewLifecycleOwner, Observer { - if (it != null) { - networkAdapter.submitList(it) - if (!hasSetNetwork && networkId.isValidId() && it.isNotEmpty()) { - network.post { - val index = networkAdapter.indexOf(networkId) - if (index != null) { - network.setSelection(index) - hasSelectedNetwork = true - } - } - hasSetNetwork = true - } - } - }) - - join.setOnClickListener { - join.setText(R.string.label_saving) - join.isEnabled = false - - val selectedNetworkId = NetworkId(network.selectedItemId.toInt()) - val channelName = name.text.toString().trim() - - activity?.let { - it.finish() - ChatActivity.launch( - it, - networkId = selectedNetworkId, - channel = channelName, - forceJoin = true - ) - } - } - - return view - } - - override fun onSaveInstanceState(outState: Bundle) { - super.onSaveInstanceState(outState) - if (networkId.isValidId() && hasSelectedNetwork) { - outState.putInt("network_id", networkId.id) - } - } -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/ui/chat/add/join/ChannelJoinFragmentProvider.kt b/app/src/main/java/de/kuschku/quasseldroid/ui/chat/add/join/ChannelJoinFragmentProvider.kt deleted file mode 100644 index e031f56cb1e1b30435a90d613e0af77ccbca8151..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/ui/chat/add/join/ChannelJoinFragmentProvider.kt +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.ui.chat.add.join - -import androidx.fragment.app.FragmentActivity -import dagger.Binds -import dagger.Module -import dagger.android.ContributesAndroidInjector - -@Module -abstract class ChannelJoinFragmentProvider { - @Binds - abstract fun bindFragmentActivity(activity: ChannelJoinActivity): FragmentActivity - - @ContributesAndroidInjector - abstract fun bindChannelJoinFragment(): ChannelJoinFragment -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/ui/chat/add/query/QueryCreateActivity.kt b/app/src/main/java/de/kuschku/quasseldroid/ui/chat/add/query/QueryCreateActivity.kt deleted file mode 100644 index 5fb6a3f84462524cf5fc69d2e8e3cd8a4f0dabe1..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/ui/chat/add/query/QueryCreateActivity.kt +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.ui.chat.add.query - -import android.content.Context -import android.content.Intent -import de.kuschku.libquassel.protocol.NetworkId -import de.kuschku.quasseldroid.util.ui.settings.ServiceBoundSettingsActivity - -class QueryCreateActivity : ServiceBoundSettingsActivity(QueryCreateFragment()) { - companion object { - fun launch( - context: Context, - networkId: NetworkId? = null - ) = context.startActivity(intent(context, networkId)) - - fun intent( - context: Context, - networkId: NetworkId? = null - ) = Intent(context, QueryCreateActivity::class.java).apply { - if (networkId != null) { - putExtra("network_id", networkId.id) - } - } - } -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/ui/chat/add/query/QueryCreateFragment.kt b/app/src/main/java/de/kuschku/quasseldroid/ui/chat/add/query/QueryCreateFragment.kt deleted file mode 100644 index a8669906104e028931b2a5611a82643b78204acc..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/ui/chat/add/query/QueryCreateFragment.kt +++ /dev/null @@ -1,324 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.ui.chat.add.query - -import android.os.Bundle -import android.text.Editable -import android.text.TextWatcher -import android.view.LayoutInflater -import android.view.View -import android.view.ViewGroup -import android.widget.AdapterView -import android.widget.Button -import android.widget.EditText -import androidx.appcompat.widget.AppCompatSpinner -import androidx.lifecycle.Observer -import androidx.recyclerview.widget.DefaultItemAnimator -import androidx.recyclerview.widget.LinearLayoutManager -import androidx.recyclerview.widget.RecyclerView -import butterknife.BindView -import butterknife.ButterKnife -import com.bumptech.glide.Glide -import com.bumptech.glide.ListPreloader -import com.bumptech.glide.integration.recyclerview.RecyclerViewPreloader -import com.bumptech.glide.util.FixedPreloadSizeProvider -import de.kuschku.libquassel.protocol.NetworkId -import de.kuschku.libquassel.quassel.syncables.IrcUser -import de.kuschku.libquassel.quassel.syncables.Network -import de.kuschku.libquassel.util.Optional -import de.kuschku.libquassel.util.helper.combineLatest -import de.kuschku.libquassel.util.helper.mapOrElse -import de.kuschku.libquassel.util.helper.mapSwitchMap -import de.kuschku.libquassel.util.helper.safeSwitchMap -import de.kuschku.libquassel.util.irc.IrcCaseMappers -import de.kuschku.libquassel.util.irc.SenderColorUtil -import de.kuschku.quasseldroid.GlideApp -import de.kuschku.quasseldroid.R -import de.kuschku.quasseldroid.settings.MessageSettings -import de.kuschku.quasseldroid.ui.chat.ChatActivity -import de.kuschku.quasseldroid.ui.chat.add.NetworkAdapter -import de.kuschku.quasseldroid.ui.chat.add.NetworkItem -import de.kuschku.quasseldroid.ui.chat.nicks.NickListAdapter -import de.kuschku.quasseldroid.util.ColorContext -import de.kuschku.quasseldroid.util.avatars.AvatarHelper -import de.kuschku.quasseldroid.util.helper.loadWithFallbacks -import de.kuschku.quasseldroid.util.helper.styledAttributes -import de.kuschku.quasseldroid.util.helper.toLiveData -import de.kuschku.quasseldroid.util.irc.format.ContentFormatter -import de.kuschku.quasseldroid.util.irc.format.IrcFormatDeserializer -import de.kuschku.quasseldroid.util.service.ServiceBoundFragment -import de.kuschku.quasseldroid.viewmodel.data.Avatar -import de.kuschku.quasseldroid.viewmodel.data.IrcUserItem -import de.kuschku.quasseldroid.viewmodel.data.MatchMode -import de.kuschku.quasseldroid.viewmodel.helper.EditorViewModelHelper -import de.kuschku.quasseldroid.viewmodel.helper.QueryCreateViewModelHelper -import io.reactivex.Observable -import java.util.concurrent.TimeUnit -import javax.inject.Inject - -class QueryCreateFragment : ServiceBoundFragment() { - @BindView(R.id.network) - lateinit var network: AppCompatSpinner - - @BindView(R.id.name) - lateinit var name: EditText - - @BindView(R.id.query) - lateinit var query: Button - - @BindView(R.id.list) - lateinit var list: RecyclerView - - @Inject - lateinit var ircFormatDeserializer: IrcFormatDeserializer - - @Inject - lateinit var messageSettings: MessageSettings - - @Inject - lateinit var modelHelper: QueryCreateViewModelHelper - - @Inject - lateinit var contentFormatter: ContentFormatter - - private var hasSelectedNetwork = false - private var networkId = NetworkId(0) - - override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, - savedInstanceState: Bundle?): View? { - val view = inflater.inflate(R.layout.add_query, container, false) - ButterKnife.bind(this, view) - - networkId = NetworkId( - savedInstanceState?.getInt("network_id", 0) - ?: arguments?.getInt("network_id", 0) - ?: 0 - ) - - val networkAdapter = NetworkAdapter() - network.adapter = networkAdapter - - network.onItemSelectedListener = object : AdapterView.OnItemSelectedListener { - override fun onNothingSelected(parent: AdapterView<*>?) { - networkId = NetworkId(0) - modelHelper.queryCreate.networkId.onNext(networkId) - } - - override fun onItemSelected(parent: AdapterView<*>?, view: View?, position: Int, id: Long) { - networkId = networkAdapter.getItem(position)?.id - ?: NetworkId(0) - hasSelectedNetwork = true - modelHelper.queryCreate.networkId.onNext(networkId) - } - } - - var hasSetNetwork = false - modelHelper.networks.safeSwitchMap { - combineLatest(it.values.map(Network::liveNetworkInfo)).map { - it.map { - NetworkItem(it.networkId, it.networkName) - }.sortedWith(compareBy(String.CASE_INSENSITIVE_ORDER, NetworkItem::name)) - } - }.toLiveData().observe(viewLifecycleOwner, Observer { - if (it != null) { - networkAdapter.submitList(it) - if (!hasSetNetwork && networkId.isValidId() && it.isNotEmpty()) { - network.post { - val index = networkAdapter.indexOf(networkId) - if (index != null) { - network.setSelection(index) - hasSelectedNetwork = true - } - } - hasSetNetwork = true - } - } - }) - - name.addTextChangedListener(object : TextWatcher { - override fun afterTextChanged(s: Editable?) { - modelHelper.queryCreate.nickName.onNext(s?.toString() ?: "") - } - - override fun beforeTextChanged(s: CharSequence?, start: Int, count: Int, after: Int) = Unit - override fun onTextChanged(s: CharSequence?, start: Int, before: Int, count: Int) = Unit - }) - - val nickListAdapter = NickListAdapter(messageSettings, clickListener) - list.adapter = nickListAdapter - list.layoutManager = object : LinearLayoutManager(context) { - override fun supportsPredictiveItemAnimations() = false - } - list.itemAnimator = DefaultItemAnimator() - - val senderColors = requireContext().theme.styledAttributes( - R.attr.senderColor0, R.attr.senderColor1, R.attr.senderColor2, R.attr.senderColor3, - R.attr.senderColor4, R.attr.senderColor5, R.attr.senderColor6, R.attr.senderColor7, - R.attr.senderColor8, R.attr.senderColor9, R.attr.senderColorA, R.attr.senderColorB, - R.attr.senderColorC, R.attr.senderColorD, R.attr.senderColorE, R.attr.senderColorF - ) { - IntArray(length()) { - getColor(it, 0) - } - } - - val selfColor = requireContext().theme.styledAttributes(R.attr.colorForegroundSecondary) { - getColor(0, 0) - } - - val colorContext = ColorContext(requireContext(), messageSettings) - - val avatarSize = resources.getDimensionPixelSize(R.dimen.avatar_size) - - val sizeProvider = FixedPreloadSizeProvider<List<Avatar>>(avatarSize, avatarSize) - - val preloadModelProvider = object : ListPreloader.PreloadModelProvider<List<Avatar>> { - override fun getPreloadItems(position: Int) = listOfNotNull( - nickListAdapter[position]?.let { AvatarHelper.avatar(messageSettings, it) } - ) - - override fun getPreloadRequestBuilder(item: List<Avatar>) = - GlideApp.with(this@QueryCreateFragment).loadWithFallbacks(item)?.override(avatarSize) - } - - val preloader = RecyclerViewPreloader(Glide.with(this), preloadModelProvider, sizeProvider, 10) - - list.addOnScrollListener(preloader) - - val nickData = combineLatest(modelHelper.networks, modelHelper.queryCreate.networkId) - .map { (networks, networkId) -> - Optional.ofNullable(networks[networkId]) - }.mapSwitchMap { - it.liveIrcUsers() - }.mapOrElse(emptyList()).safeSwitchMap { - combineLatest<IrcUserItem>( - it.mapNotNull<IrcUser, Observable<IrcUserItem>> { - it.updates().map { user -> - IrcUserItem( - user.network().networkId(), - user.nick(), - "", - 0, - user.realName(), - user.hostMask(), - user.isAway(), - user.network().isMyNick(user.nick()), - user.network().support("CASEMAPPING") - ) - } - } - ) - } - - val searchedSortedNickData = combineLatest(modelHelper.queryCreate.nickName, nickData) - .map { (search, users) -> - users.filter { - it.nick.contains(search, ignoreCase = true) - }.map { - val matchMode = when { - it.nick.equals(search, ignoreCase = true) -> MatchMode.EXACT - it.nick.startsWith(search, ignoreCase = true) -> MatchMode.START - else -> MatchMode.CONTAINS - } - - Pair(matchMode, it) - }.sortedBy { (_, user) -> - IrcCaseMappers.unicode.toLowerCaseNullable(user.nick) - }.sortedBy { (matchMode, _) -> - matchMode.priority - }.map { (_, user) -> - user - } - } - - val nickDataThrottled = searchedSortedNickData - .distinctUntilChanged() - .throttleLast(100, TimeUnit.MILLISECONDS) - - nickDataThrottled.map { - it.asSequence().map { - val nickName = it.nick - val senderColorIndex = SenderColorUtil.senderColor(nickName) - val rawInitial = nickName.trimStart(*EditorViewModelHelper.IGNORED_CHARS) - .firstOrNull() ?: nickName.firstOrNull() - val initial = rawInitial?.toUpperCase().toString() - val useSelfColor = when (messageSettings.colorizeNicknames) { - MessageSettings.SenderColorMode.ALL -> false - MessageSettings.SenderColorMode.ALL_BUT_MINE -> it.self - MessageSettings.SenderColorMode.NONE -> true - } - val senderColor = if (useSelfColor) selfColor else senderColors[senderColorIndex] - it.copy( - displayNick = contentFormatter.formatNick(it.nick), - fallbackDrawable = colorContext.buildTextDrawable(initial, senderColor), - initial = initial, - modes = when (messageSettings.showPrefix) { - MessageSettings.ShowPrefixMode.ALL -> - it.modes - else -> - it.modes.substring(0, Math.min(it.modes.length, 1)) - }, - realname = ircFormatDeserializer.formatString( - it.realname.toString(), messageSettings.colorizeMirc - ), - avatarUrls = AvatarHelper.avatar(messageSettings, it, avatarSize) - ) - }.sortedBy { - IrcCaseMappers[it.networkCasemapping].toLowerCase(it.nick.trimStart(*EditorViewModelHelper.IGNORED_CHARS)) - .trimStart(*EditorViewModelHelper.IGNORED_CHARS) - }.sortedBy { - it.lowestMode - }.toList() - }.toLiveData().observe(viewLifecycleOwner, Observer { - nickListAdapter.submitList(it) - }) - - query.setOnClickListener { - val selectedNetworkId = NetworkId(network.selectedItemId.toInt()) - val nickName = name.text.toString().trim() - - clickListener(selectedNetworkId, nickName) - } - - return view - } - - private val clickListener: ((NetworkId, String) -> Unit) = { selectedNetworkId, nickName -> - query.setText(R.string.label_saving) - query.isEnabled = false - - activity?.let { - it.finish() - ChatActivity.launch( - it, - networkId = selectedNetworkId, - nickName = nickName, - forceJoin = true - ) - } - } - - override fun onSaveInstanceState(outState: Bundle) { - super.onSaveInstanceState(outState) - if (networkId.isValidId() && hasSelectedNetwork) { - outState.putInt("network_id", networkId.id) - } - } -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/ui/chat/add/query/QueryCreateFragmentProvider.kt b/app/src/main/java/de/kuschku/quasseldroid/ui/chat/add/query/QueryCreateFragmentProvider.kt deleted file mode 100644 index 3f8158210772f69f0b70e65178415ab2a6dcf187..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/ui/chat/add/query/QueryCreateFragmentProvider.kt +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.ui.chat.add.query - -import androidx.fragment.app.FragmentActivity -import dagger.Binds -import dagger.Module -import dagger.android.ContributesAndroidInjector - -@Module -abstract class QueryCreateFragmentProvider { - @Binds - abstract fun bindFragmentActivity(activity: QueryCreateActivity): FragmentActivity - - @ContributesAndroidInjector - abstract fun bindQueryCreateFragment(): QueryCreateFragment -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/ui/chat/archive/ArchiveActivity.kt b/app/src/main/java/de/kuschku/quasseldroid/ui/chat/archive/ArchiveActivity.kt deleted file mode 100644 index 84290205dc20f31d83c5db9ddee40fdf26c70988..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/ui/chat/archive/ArchiveActivity.kt +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.ui.chat.archive - -import android.content.Context -import android.content.Intent -import de.kuschku.quasseldroid.util.ui.settings.ServiceBoundSettingsActivity - -class ArchiveActivity : ServiceBoundSettingsActivity(ArchiveFragment()) { - companion object { - fun launch( - context: Context, - chatlistId: Int? = null - ) = context.startActivity(intent(context, chatlistId)) - - fun intent( - context: Context, - chatlistId: Int? = null - ) = Intent(context, ArchiveActivity::class.java).apply { - if (chatlistId != null) { - putExtra("chatlist_id", chatlistId) - } - } - } -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/ui/chat/archive/ArchiveFragment.kt b/app/src/main/java/de/kuschku/quasseldroid/ui/chat/archive/ArchiveFragment.kt deleted file mode 100644 index 2178edf34702d20f866e1531f8e3b0cb1a2ba45d..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/ui/chat/archive/ArchiveFragment.kt +++ /dev/null @@ -1,208 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.ui.chat.archive - -import android.os.Bundle -import android.view.* -import androidx.appcompat.app.AppCompatActivity -import androidx.lifecycle.Observer -import androidx.recyclerview.widget.DefaultItemAnimator -import androidx.recyclerview.widget.LinearLayoutManager -import androidx.recyclerview.widget.RecyclerView -import butterknife.BindView -import butterknife.ButterKnife -import de.kuschku.libquassel.protocol.BufferId -import de.kuschku.libquassel.util.helper.combineLatest -import de.kuschku.libquassel.util.helper.safeValue -import de.kuschku.libquassel.util.helper.value -import de.kuschku.quasseldroid.R -import de.kuschku.quasseldroid.persistence.dao.listenDefaultFiltered -import de.kuschku.quasseldroid.persistence.dao.listenRx -import de.kuschku.quasseldroid.persistence.db.AccountDatabase -import de.kuschku.quasseldroid.persistence.db.QuasselDatabase -import de.kuschku.quasseldroid.persistence.models.Filtered -import de.kuschku.quasseldroid.settings.MessageSettings -import de.kuschku.quasseldroid.ui.chat.ChatActivity -import de.kuschku.quasseldroid.util.helper.toLiveData -import de.kuschku.quasseldroid.util.service.ServiceBoundFragment -import de.kuschku.quasseldroid.util.ui.presenter.BufferContextPresenter -import de.kuschku.quasseldroid.util.ui.presenter.BufferPresenter -import de.kuschku.quasseldroid.viewmodel.data.BufferHiddenState -import de.kuschku.quasseldroid.viewmodel.helper.ArchiveViewModelHelper -import javax.inject.Inject - -class ArchiveFragment : ServiceBoundFragment() { - @BindView(R.id.list) - lateinit var list: RecyclerView - - @Inject - lateinit var modelHelper: ArchiveViewModelHelper - - @Inject - lateinit var database: QuasselDatabase - - @Inject - lateinit var accountDatabase: AccountDatabase - - @Inject - lateinit var bufferPresenter: BufferPresenter - - @Inject - lateinit var messageSettings: MessageSettings - - private lateinit var listAdapter: ArchiveListAdapter - - private var actionMode: ActionMode? = null - - private val actionModeCallback = object : ActionMode.Callback { - override fun onActionItemClicked(mode: ActionMode, item: MenuItem): Boolean { - val selected = modelHelper.archive.selectedBufferId.safeValue - val session = modelHelper.connectedSession.value?.orNull() - val bufferSyncer = session?.bufferSyncer - val info = bufferSyncer?.bufferInfo(selected) - val network = session?.networks?.get(info?.networkId) - val bufferViewConfig = modelHelper.bufferViewConfig.value?.orNull() - - return if (info != null) { - BufferContextPresenter.handleAction( - requireContext(), - mode, - item, - info, - session, - bufferSyncer, - bufferViewConfig, - network - ) - } else { - false - } - } - - override fun onCreateActionMode(mode: ActionMode?, menu: Menu?): Boolean { - actionMode = mode - mode?.menuInflater?.inflate(R.menu.context_buffer, menu) - return true - } - - override fun onPrepareActionMode(mode: ActionMode?, menu: Menu?): Boolean { - mode?.tag = "ARCHIVE" - return true - } - - override fun onDestroyActionMode(mode: ActionMode?) { - actionMode = null - listAdapter.unselectAll() - } - } - - override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, - savedInstanceState: Bundle?): View? { - val view = inflater.inflate(R.layout.chat_archive, container, false) - ButterKnife.bind(this, view) - - val chatlistId = arguments?.getInt("chatlist_id", -1) ?: -1 - modelHelper.archive.bufferViewConfigId.onNext(chatlistId) - - listAdapter = ArchiveListAdapter( - messageSettings, - modelHelper.archive.selectedBufferId, - modelHelper.archive.temporarilyExpandedNetworks - ) - listAdapter.setOnClickListener(::clickListener) - listAdapter.setOnLongClickListener(::longClickListener) - list.adapter = listAdapter - list.layoutManager = LinearLayoutManager(list.context) - list.itemAnimator = DefaultItemAnimator() - - val filtered = combineLatest( - database.filtered().listenRx(accountId).toObservable().map { - it.associateBy(Filtered::bufferId, Filtered::filtered) - }, - accountDatabase.accounts().listenDefaultFiltered(accountId, 0).toObservable() - ) - - combineLatest( - modelHelper.processArchiveBufferList(BufferHiddenState.HIDDEN_TEMPORARY, false, filtered), - modelHelper.processArchiveBufferList(BufferHiddenState.HIDDEN_PERMANENT, false, filtered) - ).map { (temporary, permanently) -> - listOf(ArchiveListItem.Header( - title = getString(R.string.label_temporarily_archived), - content = getString(R.string.label_temporarily_archived_long) - )) + temporary.map { - ArchiveListItem.Buffer(it.copy( - props = bufferPresenter.render(it.props) - )) - }.ifEmpty { - listOf(ArchiveListItem.Placeholder( - content = getString(R.string.label_temporarily_archived_empty) - )) - } + listOf(ArchiveListItem.Header( - title = getString(R.string.label_permanently_archived), - content = getString(R.string.label_permanently_archived_long) - )) + permanently.map { - ArchiveListItem.Buffer(it.copy( - props = bufferPresenter.render(it.props) - )) - }.ifEmpty { - listOf(ArchiveListItem.Placeholder( - content = getString(R.string.label_permanently_archived_empty) - )) - } - }.toLiveData().observe(viewLifecycleOwner, Observer { processedList -> - listAdapter.submitList(processedList) - }) - - modelHelper.selectedBuffer.toLiveData().observe(viewLifecycleOwner, Observer { buffer -> - actionMode?.let { - BufferContextPresenter.present(it, buffer) - } - }) - - return view - } - - private fun toggleSelection(buffer: BufferId): Boolean { - val next = - if (modelHelper.archive.selectedBufferId.safeValue == buffer) BufferId.MAX_VALUE - else buffer - modelHelper.archive.selectedBufferId.onNext(next) - return next != BufferId.MAX_VALUE - } - - private fun clickListener(bufferId: BufferId) { - if (actionMode != null) { - longClickListener(bufferId) - } else { - context?.let { - ChatActivity.launch(it, bufferId = bufferId) - } - } - } - - private fun longClickListener(it: BufferId) { - if (actionMode == null) { - (activity as? AppCompatActivity)?.startActionMode(actionModeCallback) - } - if (!toggleSelection(it)) { - actionMode?.finish() - } - } -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/ui/chat/archive/ArchiveFragmentProvider.kt b/app/src/main/java/de/kuschku/quasseldroid/ui/chat/archive/ArchiveFragmentProvider.kt deleted file mode 100644 index 0f00b82442cad8b1ffc34f791e0547d875116c51..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/ui/chat/archive/ArchiveFragmentProvider.kt +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.ui.chat.archive - -import androidx.fragment.app.FragmentActivity -import dagger.Binds -import dagger.Module -import dagger.android.ContributesAndroidInjector - -@Module -abstract class ArchiveFragmentProvider { - @Binds - abstract fun bindFragmentActivity(activity: ArchiveActivity): FragmentActivity - - @ContributesAndroidInjector - abstract fun bindArchiveFragment(): ArchiveFragment -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/ui/chat/archive/ArchiveListAdapter.kt b/app/src/main/java/de/kuschku/quasseldroid/ui/chat/archive/ArchiveListAdapter.kt deleted file mode 100644 index 4402eb0fe5acefb4a80ebd41860476b451c20390..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/ui/chat/archive/ArchiveListAdapter.kt +++ /dev/null @@ -1,528 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.ui.chat.archive - -import android.annotation.SuppressLint -import android.graphics.drawable.Drawable -import android.view.LayoutInflater -import android.view.MotionEvent -import android.view.View -import android.view.ViewGroup -import androidx.recyclerview.widget.DiffUtil -import androidx.recyclerview.widget.RecyclerView -import de.kuschku.libquassel.protocol.* -import de.kuschku.libquassel.quassel.BufferInfo -import de.kuschku.libquassel.util.flag.hasFlag -import de.kuschku.libquassel.util.helper.safeValue -import de.kuschku.quasseldroid.R -import de.kuschku.quasseldroid.databinding.WidgetArchivePlaceholderBinding -import de.kuschku.quasseldroid.databinding.WidgetBufferBinding -import de.kuschku.quasseldroid.databinding.WidgetHeaderBinding -import de.kuschku.quasseldroid.databinding.WidgetNetworkBinding -import de.kuschku.quasseldroid.settings.MessageSettings -import de.kuschku.quasseldroid.util.helper.* -import de.kuschku.quasseldroid.util.lists.ListAdapter -import de.kuschku.quasseldroid.util.ui.fastscroll.views.FastScrollRecyclerView -import de.kuschku.quasseldroid.viewmodel.data.BufferListItem -import de.kuschku.quasseldroid.viewmodel.data.BufferStatus -import io.reactivex.subjects.BehaviorSubject - -@SuppressLint("ClickableViewAccessibility", "ResourceType") -class ArchiveListAdapter( - private val messageSettings: MessageSettings, - private val selectedBuffer: BehaviorSubject<BufferId>, - private val expandedNetworks: BehaviorSubject<Map<NetworkId, Boolean>> -) : ListAdapter<ArchiveListItem, ArchiveListAdapter.ArchiveViewHolder>( - object : DiffUtil.ItemCallback<ArchiveListItem>() { - override fun areItemsTheSame(oldItem: ArchiveListItem, newItem: ArchiveListItem) = when { - oldItem is ArchiveListItem.Buffer && - newItem is ArchiveListItem.Buffer -> - oldItem.item.props.info.bufferId == newItem.item.props.info.bufferId - oldItem is ArchiveListItem.Header && - newItem is ArchiveListItem.Header -> - oldItem == newItem - oldItem is ArchiveListItem.Placeholder && - newItem is ArchiveListItem.Placeholder -> - oldItem == newItem - else -> - false - } - - override fun areContentsTheSame(oldItem: ArchiveListItem, newItem: ArchiveListItem) = - oldItem == newItem - } -), FastScrollRecyclerView.SectionedAdapter { - override fun getSectionName(position: Int) = when (val item = getItem(position)) { - is ArchiveListItem.Header -> - item.title - is ArchiveListItem.Placeholder -> - "" - is ArchiveListItem.Buffer -> - item.item.props.network.networkName - } - - private var clickListener: ((BufferId) -> Unit)? = null - fun setOnClickListener(listener: ((BufferId) -> Unit)?) { - this.clickListener = listener - } - - private var longClickListener: ((BufferId) -> Unit)? = null - fun setOnLongClickListener(listener: ((BufferId) -> Unit)?) { - this.longClickListener = listener - } - - private var dragListener: ((ArchiveViewHolder) -> Unit)? = null - fun setOnDragListener(listener: ((ArchiveViewHolder) -> Unit)?) { - dragListener = listener - } - - private var updateFinishedListener: ((List<ArchiveListItem>) -> Unit)? = null - fun setOnUpdateFinishedListener(listener: ((List<ArchiveListItem>) -> Unit)?) { - this.updateFinishedListener = listener - } - - override fun onUpdateFinished(list: List<ArchiveListItem>) { - this.updateFinishedListener?.invoke(list) - } - - fun expandListener(networkId: NetworkId, expand: Boolean) { - expandedNetworks.onNext(expandedNetworks.safeValue + Pair(networkId, expand)) - } - - fun unselectAll() { - selectedBuffer.onNext(BufferId.MAX_VALUE) - } - - override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ArchiveViewHolder { - val viewType = ViewType(viewType.toUInt()) - return when (viewType.type) { - ArchiveListItem.Type.HEADER -> ArchiveViewHolder.HeaderViewHolder( - WidgetHeaderBinding.inflate(LayoutInflater.from(parent.context), parent, false) - ) - ArchiveListItem.Type.PLACEHOLDER -> ArchiveViewHolder.PlaceholderViewHolder( - WidgetArchivePlaceholderBinding.inflate(LayoutInflater.from(parent.context), parent, false) - ) - ArchiveListItem.Type.BUFFER -> when (viewType.bufferType?.enabledValues()?.firstOrNull()) { - BufferInfo.Type.ChannelBuffer -> ArchiveViewHolder.BufferViewHolder.ChannelBuffer( - WidgetBufferBinding.inflate(LayoutInflater.from(parent.context), parent, false), - clickListener = clickListener, - longClickListener = longClickListener, - dragListener = dragListener - ) - BufferInfo.Type.QueryBuffer -> ArchiveViewHolder.BufferViewHolder.QueryBuffer( - WidgetBufferBinding.inflate(LayoutInflater.from(parent.context), parent, false), - clickListener = clickListener, - longClickListener = longClickListener, - dragListener = dragListener - ) - BufferInfo.Type.GroupBuffer -> ArchiveViewHolder.BufferViewHolder.GroupBuffer( - WidgetBufferBinding.inflate(LayoutInflater.from(parent.context), parent, false), - clickListener = clickListener, - longClickListener = longClickListener, - dragListener = dragListener - ) - BufferInfo.Type.StatusBuffer -> ArchiveViewHolder.BufferViewHolder.StatusBuffer( - WidgetNetworkBinding.inflate(LayoutInflater.from(parent.context), parent, false), - clickListener = clickListener, - longClickListener = longClickListener, - expansionListener = ::expandListener - ) - else -> - throw IllegalArgumentException("No such viewType: $viewType") - } - } - } - - override fun onBindViewHolder(holder: ArchiveViewHolder, position: Int) { - when (val item = getItem(position)) { - is ArchiveListItem.Header -> - (holder as? ArchiveViewHolder.HeaderViewHolder)?.bind(item) - is ArchiveListItem.Placeholder -> - (holder as? ArchiveViewHolder.PlaceholderViewHolder)?.bind(item) - is ArchiveListItem.Buffer -> - (holder as? ArchiveViewHolder.BufferViewHolder)?.bind(item.item, messageSettings) - } - } - - data class ViewType( - val type: ArchiveListItem.Type, - val bufferStatus: BufferStatus?, - val bufferType: Buffer_Types? - ) { - constructor(item: ArchiveListItem) : this( - type = item.type, - bufferStatus = (item as? ArchiveListItem.Buffer)?.item?.props?.bufferStatus, - bufferType = (item as? ArchiveListItem.Buffer)?.item?.props?.info?.type - ) - - constructor(viewType: UInt) : this( - type = ArchiveListItem.Type.of(viewType.shr(24).and(0xFFu).toUByte()) - ?: throw IllegalArgumentException("Unknown View Type"), - bufferStatus = BufferStatus.of(viewType.shr(16).and(0xFFu).toUByte()), - bufferType = Buffer_Type.of(viewType.and(0xFFFFu).toUShort()) - ) - - fun compute(): UInt { - val typeValue = type.value - val bufferStatusValue = bufferStatus?.value ?: 0xFFu - val bufferTypeValue = bufferType?.value ?: 0xFFu - return typeValue.toUInt().shl(24) + - bufferStatusValue.toUInt().shl(16) + - bufferTypeValue - } - } - - override fun getItemViewType(position: Int) = ViewType(getItem(position)).compute().toInt() - - sealed class ArchiveViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) { - class HeaderViewHolder( - private val binding: WidgetHeaderBinding - ) : ArchiveViewHolder(binding.root) { - fun bind(item: ArchiveListItem.Header) { - binding.title.text = item.title - binding.content.text = item.content - } - } - - class PlaceholderViewHolder( - private val binding: WidgetArchivePlaceholderBinding - ) : ArchiveViewHolder(binding.root) { - fun bind(item: ArchiveListItem.Placeholder) { - binding.content.text = item.content - } - } - - sealed class BufferViewHolder(itemView: View) : ArchiveViewHolder(itemView) { - abstract fun bind(item: BufferListItem, messageSettings: MessageSettings) - - class StatusBuffer( - private val binding: WidgetNetworkBinding, - private val clickListener: ((BufferId) -> Unit)? = null, - private val longClickListener: ((BufferId) -> Unit)? = null, - private val expansionListener: ((NetworkId, Boolean) -> Unit)? = null - ) : BufferViewHolder(binding.root) { - var bufferId: BufferId? = null - var networkId: NetworkId? = null - - private var none: Int = 0 - private var activity: Int = 0 - private var message: Int = 0 - private var highlight: Int = 0 - - private var expanded: Boolean = false - - init { - itemView.setOnClickListener { - val buffer = bufferId - if (buffer != null) - clickListener?.invoke(buffer) - } - - itemView.setOnLongClickListener { - val buffer = bufferId - if (buffer != null) { - longClickListener?.invoke(buffer) - true - } else { - false - } - } - - binding.status.setOnClickListener { - val network = networkId - if (network != null) - expansionListener?.invoke(network, !expanded) - } - - itemView.context.theme.styledAttributes( - R.attr.colorTextSecondary, R.attr.colorTintActivity, R.attr.colorTintMessage, - R.attr.colorTintHighlight - ) { - none = getColor(0, 0) - activity = getColor(1, 0) - message = getColor(2, 0) - highlight = getColor(3, 0) - } - } - - override fun bind(item: BufferListItem, messageSettings: MessageSettings) { - binding.name.text = item.props.name - bufferId = item.props.info.bufferId - networkId = item.props.info.networkId - - binding.name.setTextColor( - when { - item.props.bufferActivity.hasFlag(Buffer_Activity.Highlight) -> highlight - item.props.bufferActivity.hasFlag(Buffer_Activity.NewMessage) -> message - item.props.bufferActivity.hasFlag(Buffer_Activity.OtherActivity) -> activity - else -> none - } - ) - - this.expanded = item.state.networkExpanded - - itemView.isSelected = item.state.selected - - if (item.state.networkExpanded) { - binding.status.setImageResource(R.drawable.ic_chevron_up) - } else { - binding.status.setImageResource(R.drawable.ic_chevron_down) - } - } - } - - class GroupBuffer( - private val binding: WidgetBufferBinding, - private val clickListener: ((BufferId) -> Unit)? = null, - private val longClickListener: ((BufferId) -> Unit)? = null, - private val dragListener: ((BufferViewHolder) -> Unit)? = null - ) : BufferViewHolder(binding.root) { - var bufferId: BufferId? = null - - private val online: Drawable? - private val offline: Drawable? - - private var none: Int = 0 - private var activity: Int = 0 - private var message: Int = 0 - private var highlight: Int = 0 - - init { - itemView.setOnClickListener { - val buffer = bufferId - if (buffer != null) - clickListener?.invoke(buffer) - } - - itemView.setOnLongClickListener { - val buffer = bufferId - if (buffer != null) { - longClickListener?.invoke(buffer) - true - } else { - false - } - } - - binding.handle.setOnTouchListener { _, event -> - if (event.action == MotionEvent.ACTION_DOWN) { - dragListener?.invoke(this) - } - false - } - - online = itemView.context.getVectorDrawableCompat(R.drawable.ic_status)?.mutate() - offline = itemView.context.getVectorDrawableCompat(R.drawable.ic_status_offline)?.mutate() - - itemView.context.theme.styledAttributes( - R.attr.colorAccent, R.attr.colorAway, - R.attr.colorTextPrimary, R.attr.colorTintActivity, R.attr.colorTintMessage, - R.attr.colorTintHighlight - ) { - online?.tint(getColor(0, 0)) - offline?.tint(getColor(1, 0)) - - none = getColor(2, 0) - activity = getColor(3, 0) - message = getColor(4, 0) - highlight = getColor(5, 0) - } - } - - override fun bind(item: BufferListItem, messageSettings: MessageSettings) { - bufferId = item.props.info.bufferId - - binding.name.text = item.props.name - binding.description.text = item.props.description - - binding.name.setTextColor( - when { - item.props.bufferActivity.hasFlag(Buffer_Activity.Highlight) -> highlight - item.props.bufferActivity.hasFlag(Buffer_Activity.NewMessage) -> message - item.props.bufferActivity.hasFlag(Buffer_Activity.OtherActivity) -> activity - else -> none - } - ) - - itemView.isSelected = item.state.selected - - binding.handle.visibleIf(item.state.showHandle) - - binding.description.visibleIf(item.props.description.isNotBlank()) - - binding.status.setImageDrawable( - when (item.props.bufferStatus) { - BufferStatus.ONLINE -> online - else -> offline - } - ) - } - } - - class ChannelBuffer( - private val binding: WidgetBufferBinding, - private val clickListener: ((BufferId) -> Unit)? = null, - private val longClickListener: ((BufferId) -> Unit)? = null, - private val dragListener: ((BufferViewHolder) -> Unit)? = null - ) : BufferViewHolder(binding.root) { - var bufferId: BufferId? = null - - private var none: Int = 0 - private var activity: Int = 0 - private var message: Int = 0 - private var highlight: Int = 0 - - init { - itemView.setOnClickListener { - val buffer = bufferId - if (buffer != null) - clickListener?.invoke(buffer) - } - - itemView.setOnLongClickListener { - val buffer = bufferId - if (buffer != null) { - longClickListener?.invoke(buffer) - true - } else { - false - } - } - - binding.handle.setOnTouchListener { _, event -> - if (event.action == MotionEvent.ACTION_DOWN) { - dragListener?.invoke(this) - } - false - } - - itemView.context.theme.styledAttributes( - R.attr.colorTextPrimary, R.attr.colorTintActivity, R.attr.colorTintMessage, - R.attr.colorTintHighlight - ) { - none = getColor(0, 0) - activity = getColor(1, 0) - message = getColor(2, 0) - highlight = getColor(3, 0) - } - } - - override fun bind(item: BufferListItem, messageSettings: MessageSettings) { - bufferId = item.props.info.bufferId - - binding.name.text = item.props.name - binding.description.text = item.props.description - - binding.name.setTextColor( - when { - item.props.bufferActivity.hasFlag(Buffer_Activity.Highlight) -> highlight - item.props.bufferActivity.hasFlag(Buffer_Activity.NewMessage) -> message - item.props.bufferActivity.hasFlag(Buffer_Activity.OtherActivity) -> activity - else -> none - } - ) - - itemView.isSelected = item.state.selected - - binding.handle.visibleIf(item.state.showHandle) - - binding.description.visibleIf(item.props.description.isNotBlank()) - - binding.status.setImageDrawable(item.props.fallbackDrawable) - } - } - - class QueryBuffer( - private val binding: WidgetBufferBinding, - private val clickListener: ((BufferId) -> Unit)? = null, - private val longClickListener: ((BufferId) -> Unit)? = null, - private val dragListener: ((BufferViewHolder) -> Unit)? = null - ) : BufferViewHolder(binding.root) { - var bufferId: BufferId? = null - - private var none: Int = 0 - private var activity: Int = 0 - private var message: Int = 0 - private var highlight: Int = 0 - - init { - itemView.setOnClickListener { - val buffer = bufferId - if (buffer != null) - clickListener?.invoke(buffer) - } - - itemView.setOnLongClickListener { - val buffer = bufferId - if (buffer != null) { - longClickListener?.invoke(buffer) - true - } else { - false - } - } - - binding.handle.setOnTouchListener { _, event -> - if (event.action == MotionEvent.ACTION_DOWN) { - dragListener?.invoke(this) - } - false - } - - itemView.context.theme.styledAttributes( - R.attr.colorTextPrimary, R.attr.colorTintActivity, R.attr.colorTintMessage, - R.attr.colorTintHighlight - ) { - none = getColor(0, 0) - activity = getColor(1, 0) - message = getColor(2, 0) - highlight = getColor(3, 0) - } - } - - override fun bind(item: BufferListItem, messageSettings: MessageSettings) { - bufferId = item.props.info.bufferId - - binding.name.text = item.props.name - binding.description.text = item.props.description - - binding.name.setTextColor( - when { - item.props.bufferActivity.hasFlag(Buffer_Activity.Highlight) -> highlight - item.props.bufferActivity.hasFlag(Buffer_Activity.NewMessage) -> message - item.props.bufferActivity.hasFlag(Buffer_Activity.OtherActivity) -> activity - else -> none - } - ) - - itemView.isSelected = item.state.selected - - binding.handle.visibleIf(item.state.showHandle) - - binding.description.visibleIf(item.props.description.isNotBlank()) - - binding.status.loadAvatars(item.props.avatarUrls, - item.props.fallbackDrawable, - crop = !messageSettings.squareAvatars) - } - } - } - } -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/ui/chat/archive/ArchiveListItem.kt b/app/src/main/java/de/kuschku/quasseldroid/ui/chat/archive/ArchiveListItem.kt deleted file mode 100644 index c5db6b5f24873abf288576e88eedf6ba51c4d2cb..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/ui/chat/archive/ArchiveListItem.kt +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.ui.chat.archive - -import de.kuschku.quasseldroid.viewmodel.data.BufferListItem - -sealed class ArchiveListItem(val type: Type) { - data class Header( - val title: String, - val content: String - ) : ArchiveListItem(Type.HEADER) - - data class Placeholder( - val content: String - ) : ArchiveListItem(Type.PLACEHOLDER) - - data class Buffer( - val item: BufferListItem - ) : ArchiveListItem(Type.BUFFER) - - override fun equals(other: Any?): Boolean { - if (this === other) return true - if (other !is ArchiveListItem) return false - return true - } - - override fun hashCode(): Int { - return javaClass.hashCode() - } - - enum class Type(val value: UByte) { - HEADER(0u), - PLACEHOLDER(1u), - BUFFER(2u); - - companion object { - private val map = values().associateBy { it.value } - fun of(value: UByte) = map[value] - } - } -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/ui/chat/buffers/BufferListAdapter.kt b/app/src/main/java/de/kuschku/quasseldroid/ui/chat/buffers/BufferListAdapter.kt deleted file mode 100644 index c068ffe271262cf61190d8738a9ba972b90fa7e3..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/ui/chat/buffers/BufferListAdapter.kt +++ /dev/null @@ -1,556 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.ui.chat.buffers - -import android.annotation.SuppressLint -import android.graphics.drawable.Drawable -import android.view.LayoutInflater -import android.view.MotionEvent -import android.view.View -import android.view.ViewGroup -import androidx.recyclerview.widget.DiffUtil -import androidx.recyclerview.widget.RecyclerView -import de.kuschku.libquassel.protocol.* -import de.kuschku.libquassel.quassel.BufferInfo -import de.kuschku.libquassel.util.flag.hasFlag -import de.kuschku.libquassel.util.helper.safeValue -import de.kuschku.quasseldroid.R -import de.kuschku.quasseldroid.databinding.WidgetBufferAwayBinding -import de.kuschku.quasseldroid.databinding.WidgetBufferBinding -import de.kuschku.quasseldroid.databinding.WidgetNetworkBinding -import de.kuschku.quasseldroid.settings.MessageSettings -import de.kuschku.quasseldroid.util.helper.* -import de.kuschku.quasseldroid.util.lists.ListAdapter -import de.kuschku.quasseldroid.util.ui.fastscroll.views.FastScrollRecyclerView -import de.kuschku.quasseldroid.viewmodel.data.BufferListItem -import de.kuschku.quasseldroid.viewmodel.data.BufferStatus -import io.reactivex.subjects.BehaviorSubject - -@SuppressLint("ClickableViewAccessibility", "ResourceType") -class BufferListAdapter( - private val messageSettings: MessageSettings, - private val selectedBuffer: BehaviorSubject<BufferId>, - private val expandedNetworks: BehaviorSubject<Map<NetworkId, Boolean>> -) : ListAdapter<BufferListItem, BufferListAdapter.BufferViewHolder>( - object : DiffUtil.ItemCallback<BufferListItem>() { - override fun areItemsTheSame(oldItem: BufferListItem, newItem: BufferListItem) = - oldItem.props.info.bufferId == newItem.props.info.bufferId - - override fun areContentsTheSame(oldItem: BufferListItem, newItem: BufferListItem) = - oldItem == newItem - } -), FastScrollRecyclerView.SectionedAdapter { - override fun getSectionName(position: Int) = getItem(position).props.network.networkName - - private var clickListener: ((BufferId) -> Unit)? = null - fun setOnClickListener(listener: ((BufferId) -> Unit)?) { - this.clickListener = listener - } - - private var longClickListener: ((BufferId) -> Unit)? = null - fun setOnLongClickListener(listener: ((BufferId) -> Unit)?) { - this.longClickListener = listener - } - - private var dragListener: ((BufferViewHolder) -> Unit)? = null - fun setOnDragListener(listener: ((BufferViewHolder) -> Unit)?) { - dragListener = listener - } - - private var updateFinishedListener: ((List<BufferListItem>) -> Unit)? = null - fun setOnUpdateFinishedListener(listener: ((List<BufferListItem>) -> Unit)?) { - this.updateFinishedListener = listener - } - - override fun onUpdateFinished(list: List<BufferListItem>) { - this.updateFinishedListener?.invoke(list) - } - - fun expandListener(networkId: NetworkId, expand: Boolean) { - expandedNetworks.onNext(expandedNetworks.safeValue + Pair(networkId, expand)) - } - - fun unselectAll() { - selectedBuffer.onNext(BufferId.MAX_VALUE) - } - - override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): BufferViewHolder { - val viewType = ViewType(viewType.toUInt()) - return when (viewType.bufferType?.enabledValues()?.firstOrNull()) { - BufferInfo.Type.ChannelBuffer -> BufferViewHolder.ChannelBuffer( - WidgetBufferBinding.inflate(LayoutInflater.from(parent.context), parent, false), - clickListener = clickListener, - longClickListener = longClickListener, - dragListener = dragListener - ) - BufferInfo.Type.QueryBuffer -> if (viewType.bufferStatus == BufferStatus.AWAY) { - BufferViewHolder.QueryAwayBuffer( - WidgetBufferAwayBinding.inflate( - LayoutInflater.from(parent.context), parent, false - ), - clickListener = clickListener, - longClickListener = longClickListener, - dragListener = dragListener - ) - } else { - BufferViewHolder.QueryBuffer( - WidgetBufferBinding.inflate( - LayoutInflater.from(parent.context), parent, false - ), - clickListener = clickListener, - longClickListener = longClickListener, - dragListener = dragListener - ) - } - BufferInfo.Type.GroupBuffer -> BufferViewHolder.GroupBuffer( - WidgetBufferBinding.inflate(LayoutInflater.from(parent.context), parent, false), - clickListener = clickListener, - longClickListener = longClickListener, - dragListener = dragListener - ) - BufferInfo.Type.StatusBuffer -> BufferViewHolder.StatusBuffer( - WidgetNetworkBinding.inflate(LayoutInflater.from(parent.context), parent, false), - clickListener = clickListener, - longClickListener = longClickListener, - expansionListener = ::expandListener - ) - else -> - throw IllegalArgumentException("No such viewType: $viewType") - } - } - - override fun onBindViewHolder(holder: BufferViewHolder, position: Int) = - holder.bind(getItem(position), messageSettings) - - data class ViewType( - val bufferStatus: BufferStatus?, - val bufferType: Buffer_Types? - ) { - constructor(item: BufferListItem) : this( - bufferStatus = item.props.bufferStatus, - bufferType = item.props.info.type - ) - - constructor(viewType: UInt) : this( - bufferStatus = BufferStatus.of(viewType.shr(16).and(0xFFu).toUByte()), - bufferType = Buffer_Type.of(viewType.and(0xFFFFu).toUShort()) - ) - - fun compute(): UInt { - val bufferStatusValue = bufferStatus?.value ?: 0xFFu - val bufferTypeValue = bufferType?.value ?: 0xFFu - return bufferStatusValue.toUInt().shl(16) + - bufferTypeValue - } - } - - override fun getItemViewType(position: Int) = ViewType(getItem(position)).compute().toInt() - - abstract class BufferViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) { - abstract fun bind(item: BufferListItem, messageSettings: MessageSettings) - - class StatusBuffer( - private val binding: WidgetNetworkBinding, - private val clickListener: ((BufferId) -> Unit)? = null, - private val longClickListener: ((BufferId) -> Unit)? = null, - private val expansionListener: ((NetworkId, Boolean) -> Unit)? = null - ) : BufferViewHolder(binding.root) { - var bufferId: BufferId? = null - var networkId: NetworkId? = null - - private var none: Int = 0 - private var activity: Int = 0 - private var message: Int = 0 - private var highlight: Int = 0 - - private var expanded: Boolean = false - - init { - itemView.setOnClickListener { - val buffer = bufferId - if (buffer != null) - clickListener?.invoke(buffer) - } - - itemView.setOnLongClickListener { - val buffer = bufferId - if (buffer != null) { - longClickListener?.invoke(buffer) - true - } else { - false - } - } - - binding.status.setOnClickListener { - val network = networkId - if (network != null) - expansionListener?.invoke(network, !expanded) - } - - itemView.context.theme.styledAttributes( - R.attr.colorTextSecondary, R.attr.colorTintActivity, R.attr.colorTintMessage, - R.attr.colorTintHighlight - ) { - none = getColor(0, 0) - activity = getColor(1, 0) - message = getColor(2, 0) - highlight = getColor(3, 0) - } - } - - override fun bind(item: BufferListItem, messageSettings: MessageSettings) { - binding.name.text = item.props.name - bufferId = item.props.info.bufferId - networkId = item.props.info.networkId - - binding.name.setTextColor( - when { - item.props.bufferActivity.hasFlag(Buffer_Activity.Highlight) -> highlight - item.props.bufferActivity.hasFlag(Buffer_Activity.NewMessage) -> message - item.props.bufferActivity.hasFlag(Buffer_Activity.OtherActivity) -> activity - else -> none - } - ) - - this.expanded = item.state.networkExpanded - - itemView.isSelected = item.state.selected - - if (item.state.networkExpanded) { - binding.status.setImageResource(R.drawable.ic_chevron_up) - } else { - binding.status.setImageResource(R.drawable.ic_chevron_down) - } - } - } - - class GroupBuffer( - private val binding: WidgetBufferBinding, - private val clickListener: ((BufferId) -> Unit)? = null, - private val longClickListener: ((BufferId) -> Unit)? = null, - private val dragListener: ((BufferViewHolder) -> Unit)? = null - ) : BufferViewHolder(binding.root) { - var bufferId: BufferId? = null - - private val online: Drawable? - private val offline: Drawable? - - private var none: Int = 0 - private var activity: Int = 0 - private var message: Int = 0 - private var highlight: Int = 0 - - init { - itemView.setOnClickListener { - val buffer = bufferId - if (buffer != null) - clickListener?.invoke(buffer) - } - - itemView.setOnLongClickListener { - val buffer = bufferId - if (buffer != null) { - longClickListener?.invoke(buffer) - true - } else { - false - } - } - - binding.handle.setOnTouchListener { _, event -> - if (event.action == MotionEvent.ACTION_DOWN) { - dragListener?.invoke(this) - } - false - } - - online = itemView.context.getVectorDrawableCompat(R.drawable.ic_status)?.mutate() - offline = itemView.context.getVectorDrawableCompat(R.drawable.ic_status_offline)?.mutate() - - itemView.context.theme.styledAttributes( - R.attr.colorAccent, R.attr.colorAway, - R.attr.colorTextPrimary, R.attr.colorTintActivity, R.attr.colorTintMessage, - R.attr.colorTintHighlight - ) { - online?.tint(getColor(0, 0)) - offline?.tint(getColor(1, 0)) - - none = getColor(2, 0) - activity = getColor(3, 0) - message = getColor(4, 0) - highlight = getColor(5, 0) - } - } - - override fun bind(item: BufferListItem, messageSettings: MessageSettings) { - bufferId = item.props.info.bufferId - - binding.name.text = item.props.name - binding.description.text = item.props.description - - binding.name.setTextColor( - when { - item.props.bufferActivity.hasFlag(Buffer_Activity.Highlight) -> highlight - item.props.bufferActivity.hasFlag(Buffer_Activity.NewMessage) -> message - item.props.bufferActivity.hasFlag(Buffer_Activity.OtherActivity) -> activity - else -> none - } - ) - - itemView.isSelected = item.state.selected - - binding.handle.visibleIf(item.state.showHandle) - - binding.description.visibleIf(item.props.description.isNotBlank()) - - binding.status.setImageDrawable( - when (item.props.bufferStatus) { - BufferStatus.ONLINE -> online - else -> offline - } - ) - } - } - - class ChannelBuffer( - private val binding: WidgetBufferBinding, - private val clickListener: ((BufferId) -> Unit)? = null, - private val longClickListener: ((BufferId) -> Unit)? = null, - private val dragListener: ((BufferViewHolder) -> Unit)? = null - ) : BufferViewHolder(binding.root) { - var bufferId: BufferId? = null - - private var none: Int = 0 - private var activity: Int = 0 - private var message: Int = 0 - private var highlight: Int = 0 - - init { - itemView.setOnClickListener { - val buffer = bufferId - if (buffer != null) - clickListener?.invoke(buffer) - } - - itemView.setOnLongClickListener { - val buffer = bufferId - if (buffer != null) { - longClickListener?.invoke(buffer) - true - } else { - false - } - } - - binding.handle.setOnTouchListener { _, event -> - if (event.action == MotionEvent.ACTION_DOWN) { - dragListener?.invoke(this) - } - false - } - - itemView.context.theme.styledAttributes( - R.attr.colorTextPrimary, R.attr.colorTintActivity, R.attr.colorTintMessage, - R.attr.colorTintHighlight - ) { - none = getColor(0, 0) - activity = getColor(1, 0) - message = getColor(2, 0) - highlight = getColor(3, 0) - } - } - - override fun bind(item: BufferListItem, messageSettings: MessageSettings) { - bufferId = item.props.info.bufferId - - binding.name.text = item.props.name - binding.description.text = item.props.description - - binding.name.setTextColor( - when { - item.props.bufferActivity.hasFlag(Buffer_Activity.Highlight) -> highlight - item.props.bufferActivity.hasFlag(Buffer_Activity.NewMessage) -> message - item.props.bufferActivity.hasFlag(Buffer_Activity.OtherActivity) -> activity - else -> none - } - ) - - itemView.isSelected = item.state.selected - - binding.handle.visibleIf(item.state.showHandle) - - binding.description.visibleIf(item.props.description.isNotBlank()) - - binding.status.setImageDrawable(item.props.fallbackDrawable) - } - } - - class QueryBuffer( - private val binding: WidgetBufferBinding, - private val clickListener: ((BufferId) -> Unit)? = null, - private val longClickListener: ((BufferId) -> Unit)? = null, - private val dragListener: ((BufferViewHolder) -> Unit)? = null - ) : BufferViewHolder(binding.root) { - var bufferId: BufferId? = null - - private var none: Int = 0 - private var activity: Int = 0 - private var message: Int = 0 - private var highlight: Int = 0 - - init { - itemView.setOnClickListener { - val buffer = bufferId - if (buffer != null) - clickListener?.invoke(buffer) - } - - itemView.setOnLongClickListener { - val buffer = bufferId - if (buffer != null) { - longClickListener?.invoke(buffer) - true - } else { - false - } - } - - binding.handle.setOnTouchListener { _, event -> - if (event.action == MotionEvent.ACTION_DOWN) { - dragListener?.invoke(this) - } - false - } - - itemView.context.theme.styledAttributes( - R.attr.colorTextPrimary, R.attr.colorTintActivity, R.attr.colorTintMessage, - R.attr.colorTintHighlight - ) { - none = getColor(0, 0) - activity = getColor(1, 0) - message = getColor(2, 0) - highlight = getColor(3, 0) - } - } - - override fun bind(item: BufferListItem, messageSettings: MessageSettings) { - bufferId = item.props.info.bufferId - - binding.name.text = item.props.info.bufferName - binding.description.text = item.props.description - - binding.name.setTextColor( - when { - item.props.bufferActivity.hasFlag(Buffer_Activity.Highlight) -> highlight - item.props.bufferActivity.hasFlag(Buffer_Activity.NewMessage) -> message - item.props.bufferActivity.hasFlag(Buffer_Activity.OtherActivity) -> activity - else -> none - } - ) - - itemView.isSelected = item.state.selected - - binding.handle.visibleIf(item.state.showHandle) - - binding.description.visibleIf(item.props.description.isNotBlank()) - - binding.status.loadAvatars(item.props.avatarUrls, - item.props.fallbackDrawable, - crop = !messageSettings.squareAvatars) - } - } - - class QueryAwayBuffer( - private val binding: WidgetBufferAwayBinding, - private val clickListener: ((BufferId) -> Unit)? = null, - private val longClickListener: ((BufferId) -> Unit)? = null, - private val dragListener: ((BufferViewHolder) -> Unit)? = null - ) : BufferViewHolder(binding.root) { - var bufferId: BufferId? = null - - private var none: Int = 0 - private var activity: Int = 0 - private var message: Int = 0 - private var highlight: Int = 0 - - init { - itemView.setOnClickListener { - val buffer = bufferId - if (buffer != null) - clickListener?.invoke(buffer) - } - - itemView.setOnLongClickListener { - val buffer = bufferId - if (buffer != null) { - longClickListener?.invoke(buffer) - true - } else { - false - } - } - - binding.handle.setOnTouchListener { _, event -> - if (event.action == MotionEvent.ACTION_DOWN) { - dragListener?.invoke(this) - } - false - } - - itemView.context.theme.styledAttributes( - R.attr.colorTextPrimary, R.attr.colorTintActivity, R.attr.colorTintMessage, - R.attr.colorTintHighlight - ) { - none = getColor(0, 0) - activity = getColor(1, 0) - message = getColor(2, 0) - highlight = getColor(3, 0) - } - } - - override fun bind(item: BufferListItem, messageSettings: MessageSettings) { - bufferId = item.props.info.bufferId - - binding.name.text = item.props.info.bufferName - binding.description.text = item.props.description - - binding.name.setTextColor( - when { - item.props.bufferActivity.hasFlag(Buffer_Activity.Highlight) -> highlight - item.props.bufferActivity.hasFlag(Buffer_Activity.NewMessage) -> message - item.props.bufferActivity.hasFlag(Buffer_Activity.OtherActivity) -> activity - else -> none - } - ) - - itemView.isSelected = item.state.selected - - binding.handle.visibleIf(item.state.showHandle) - - binding.description.visibleIf(item.props.description.isNotBlank()) - - binding.status.loadAvatars(item.props.avatarUrls, - item.props.fallbackDrawable, - crop = !messageSettings.squareAvatars) - } - } - } -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/ui/chat/buffers/BufferViewConfigAdapter.kt b/app/src/main/java/de/kuschku/quasseldroid/ui/chat/buffers/BufferViewConfigAdapter.kt deleted file mode 100644 index f42664d5e4458ad53e4cbbd72014f491f1ba3d3a..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/ui/chat/buffers/BufferViewConfigAdapter.kt +++ /dev/null @@ -1,85 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.ui.chat.buffers - -import android.view.LayoutInflater -import android.view.ViewGroup -import androidx.appcompat.view.ContextThemeWrapper -import androidx.appcompat.widget.ThemedSpinnerAdapter -import androidx.recyclerview.widget.RecyclerView -import de.kuschku.libquassel.quassel.syncables.BufferViewConfig -import de.kuschku.quasseldroid.databinding.WidgetSpinnerItemToolbarBinding -import de.kuschku.quasseldroid.util.ui.RecyclerSpinnerAdapter - -class BufferViewConfigAdapter : - RecyclerSpinnerAdapter<BufferViewConfigAdapter.BufferViewConfigViewHolder>(), - ThemedSpinnerAdapter { - var data = emptyList<BufferViewConfig>() - - - private var updateFinishedListener: ((List<BufferViewConfig>) -> Unit)? = null - - fun setOnUpdateFinishedListener(listener: ((List<BufferViewConfig>) -> Unit)?) { - this.updateFinishedListener = listener - } - - fun submitList(list: List<BufferViewConfig>) { - data = list - notifyDataSetChanged() - updateFinishedListener?.invoke(list) - } - - fun indexOf(id: Int) = data.indexOfFirst { it.bufferViewId() == id } - - override fun isEmpty() = data.isEmpty() - - override fun onBindViewHolder(holder: BufferViewConfigViewHolder, position: Int) = - holder.bind(getItem(position)) - - override fun onCreateViewHolder(parent: ViewGroup, dropDown: Boolean) - : BufferViewConfigViewHolder { - val inflater = LayoutInflater.from( - if (dropDown) ContextThemeWrapper(parent.context, dropDownViewTheme) - else parent.context - ) - return BufferViewConfigViewHolder( - WidgetSpinnerItemToolbarBinding.inflate(inflater, parent, false) - ) - } - - override fun getItem(position: Int): BufferViewConfig? = when (position) { - in (0 until data.size) -> data[position] - else -> null - } - - override fun getItemId(position: Int) = getItem(position)?.bufferViewId()?.toLong() ?: -1L - - override fun hasStableIds() = true - - override fun getCount() = data.size - - class BufferViewConfigViewHolder( - private val binding: WidgetSpinnerItemToolbarBinding - ) : RecyclerView.ViewHolder(binding.root) { - fun bind(bufferViewConfig: BufferViewConfig?) { - binding.text1.text = bufferViewConfig?.bufferViewName() ?: "" - } - } -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/ui/chat/buffers/BufferViewConfigFragment.kt b/app/src/main/java/de/kuschku/quasseldroid/ui/chat/buffers/BufferViewConfigFragment.kt deleted file mode 100644 index 258134408c947a2fc6a73f2235663b2e79bc8f48..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/ui/chat/buffers/BufferViewConfigFragment.kt +++ /dev/null @@ -1,447 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.ui.chat.buffers - -import android.os.Bundle -import android.os.Parcelable -import android.text.Editable -import android.text.TextWatcher -import android.view.* -import android.widget.AdapterView -import android.widget.EditText -import androidx.annotation.ColorInt -import androidx.appcompat.widget.AppCompatImageButton -import androidx.appcompat.widget.AppCompatSpinner -import androidx.appcompat.widget.Toolbar -import androidx.lifecycle.Observer -import androidx.recyclerview.widget.DefaultItemAnimator -import androidx.recyclerview.widget.LinearLayoutManager -import androidx.recyclerview.widget.RecyclerView -import butterknife.BindView -import butterknife.ButterKnife -import com.leinardi.android.speeddial.SpeedDialActionItem -import com.leinardi.android.speeddial.SpeedDialView -import de.kuschku.libquassel.protocol.BufferId -import de.kuschku.libquassel.protocol.NetworkId -import de.kuschku.libquassel.quassel.ExtendedFeature -import de.kuschku.libquassel.quassel.syncables.BufferViewConfig -import de.kuschku.libquassel.util.helper.* -import de.kuschku.quasseldroid.BuildConfig -import de.kuschku.quasseldroid.R -import de.kuschku.quasseldroid.persistence.dao.listenDefaultFiltered -import de.kuschku.quasseldroid.persistence.dao.listenRx -import de.kuschku.quasseldroid.persistence.db.AccountDatabase -import de.kuschku.quasseldroid.persistence.db.QuasselDatabase -import de.kuschku.quasseldroid.persistence.models.Filtered -import de.kuschku.quasseldroid.settings.AppearanceSettings -import de.kuschku.quasseldroid.settings.MessageSettings -import de.kuschku.quasseldroid.ui.chat.ChatActivity -import de.kuschku.quasseldroid.ui.chat.add.create.ChannelCreateActivity -import de.kuschku.quasseldroid.ui.chat.add.join.ChannelJoinActivity -import de.kuschku.quasseldroid.ui.chat.add.query.QueryCreateActivity -import de.kuschku.quasseldroid.ui.chat.archive.ArchiveActivity -import de.kuschku.quasseldroid.util.ColorContext -import de.kuschku.quasseldroid.util.helper.setTooltip -import de.kuschku.quasseldroid.util.helper.styledAttributes -import de.kuschku.quasseldroid.util.helper.toLiveData -import de.kuschku.quasseldroid.util.helper.visibleIf -import de.kuschku.quasseldroid.util.irc.format.IrcFormatDeserializer -import de.kuschku.quasseldroid.util.service.ServiceBoundFragment -import de.kuschku.quasseldroid.util.ui.presenter.BufferContextPresenter -import de.kuschku.quasseldroid.util.ui.presenter.BufferPresenter -import de.kuschku.quasseldroid.util.ui.view.WarningBarView -import de.kuschku.quasseldroid.viewmodel.helper.ChatViewModelHelper -import javax.inject.Inject - -class BufferViewConfigFragment : ServiceBoundFragment() { - @BindView(R.id.chatListToolbar) - lateinit var chatListToolbar: Toolbar - - @BindView(R.id.chatListSpinner) - lateinit var chatListSpinner: AppCompatSpinner - - @BindView(R.id.chatList) - lateinit var chatList: RecyclerView - - @BindView(R.id.feature_context_bufferactivitysync) - lateinit var featureContextBufferActivitySync: WarningBarView - - @BindView(R.id.buffer_search) - lateinit var bufferSearch: EditText - - @BindView(R.id.buffer_search_clear) - lateinit var bufferSearchClear: AppCompatImageButton - - @BindView(R.id.buffer_search_container) - lateinit var bufferSearchContainer: ViewGroup - - @BindView(R.id.fab_chatlist) - lateinit var fab: SpeedDialView - - @Inject - lateinit var appearanceSettings: AppearanceSettings - - @Inject - lateinit var messageSettings: MessageSettings - - @Inject - lateinit var database: QuasselDatabase - - @Inject - lateinit var accountDatabase: AccountDatabase - - @Inject - lateinit var ircFormatDeserializer: IrcFormatDeserializer - - @Inject - lateinit var modelHelper: ChatViewModelHelper - - @Inject - lateinit var colorContext: ColorContext - - @Inject - lateinit var bufferPresenter: BufferPresenter - - private var actionMode: ActionMode? = null - - private val actionModeCallback = object : ActionMode.Callback { - override fun onActionItemClicked(mode: ActionMode, item: MenuItem): Boolean { - val selected = modelHelper.chat.selectedBufferId.safeValue ?: BufferId(-1) - val session = modelHelper.connectedSession.value?.orNull() - val bufferSyncer = session?.bufferSyncer - val info = bufferSyncer?.bufferInfo(selected) - val networkId = - if (!selected.isValidId()) NetworkId(-selected.id) - else info?.networkId - val network = session?.networks?.get(networkId) - val bufferViewConfig = modelHelper.bufferViewConfig.value?.orNull() - - return if (info != null) { - BufferContextPresenter.handleAction( - requireContext(), - mode, - item, - info, - session, - bufferSyncer, - bufferViewConfig, - network - ) - } else { - false - } - } - - override fun onCreateActionMode(mode: ActionMode?, menu: Menu?): Boolean { - actionMode = mode - mode?.menuInflater?.inflate(R.menu.context_buffer, menu) - return true - } - - override fun onPrepareActionMode(mode: ActionMode?, menu: Menu?): Boolean { - mode?.tag = "BUFFERS" - return true - } - - override fun onDestroyActionMode(mode: ActionMode?) { - actionMode = null - listAdapter.unselectAll() - } - } - - private lateinit var listAdapter: BufferListAdapter - - override fun onCreateView( - inflater: LayoutInflater, container: ViewGroup?, - savedInstanceState: Bundle? - ): View? { - val view = inflater.inflate(R.layout.chat_chatlist, container, false) - ButterKnife.bind(this, view) - - val adapter = BufferViewConfigAdapter() - modelHelper.bufferViewConfigs.safeSwitchMap { - combineLatest(it.map(BufferViewConfig::liveUpdates)) - }.toLiveData().observe(viewLifecycleOwner, Observer { - if (it != null) { - adapter.submitList(it) - } - }) - - var hasSetBufferViewConfigId = false - adapter.setOnUpdateFinishedListener { - if (!hasSetBufferViewConfigId) { - chatListSpinner.setSelection(adapter.indexOf(modelHelper.chat.bufferViewConfigId.or(-1)).nullIf { it == -1 } - ?: 0) - modelHelper.chat.bufferViewConfigId.onNext(chatListSpinner.selectedItemId.toInt()) - hasSetBufferViewConfigId = true - } - } - chatListSpinner.onItemSelectedListener = object : AdapterView.OnItemSelectedListener { - override fun onNothingSelected(adapter: AdapterView<*>?) { - if (hasSetBufferViewConfigId) - modelHelper.chat.bufferViewConfigId.onNext(-1) - } - - override fun onItemSelected(adapter: AdapterView<*>?, element: View?, position: Int, - id: Long) { - if (hasSetBufferViewConfigId) - modelHelper.chat.bufferViewConfigId.onNext(id.toInt()) - } - } - chatListSpinner.adapter = adapter - - listAdapter = BufferListAdapter( - messageSettings, - modelHelper.chat.selectedBufferId, - modelHelper.chat.expandedNetworks - ) - - var chatListState: Parcelable? = savedInstanceState?.getParcelable(KEY_STATE_LIST) - var hasRestoredChatListState = false - listAdapter.setOnUpdateFinishedListener { - if (it.isNotEmpty()) { - chatList.layoutManager?.let { - if (chatListState != null) { - it.onRestoreInstanceState(chatListState) - hasRestoredChatListState = true - } - } - } - } - - modelHelper.negotiatedFeatures.toLiveData().observe(viewLifecycleOwner, - Observer { (connected, features) -> - featureContextBufferActivitySync.setMode( - if (!connected || features.hasFeature( - ExtendedFeature.BufferActivitySync)) WarningBarView.MODE_NONE - else WarningBarView.MODE_ICON - ) - }) - - val filtered = combineLatest( - database.filtered().listenRx(accountId).toObservable().map { - it.associateBy(Filtered::bufferId, Filtered::filtered) - }, - accountDatabase.accounts().listenDefaultFiltered(accountId, 0).toObservable() - ) - - modelHelper.processChatBufferList(filtered).map { buffers -> - bufferPresenter.render(buffers) - }.toLiveData().observe(viewLifecycleOwner, Observer { processedList -> - if (hasRestoredChatListState) { - chatListState = chatList.layoutManager?.onSaveInstanceState() - hasRestoredChatListState = false - } - listAdapter.submitList(processedList) - }) - - listAdapter.setOnClickListener(this@BufferViewConfigFragment::clickListener) - listAdapter.setOnLongClickListener(this@BufferViewConfigFragment::longClickListener) - chatList.adapter = listAdapter - - modelHelper.selectedBuffer.toLiveData().observe(viewLifecycleOwner, Observer { buffer -> - actionMode?.let { - BufferContextPresenter.present(it, buffer) - } - }) - - chatListToolbar.inflateMenu(R.menu.context_bufferlist) - chatListToolbar.menu.findItem(R.id.action_search).isChecked = modelHelper.chat.bufferSearchTemporarilyVisible.or( - false) - chatListToolbar.setOnMenuItemClickListener { item -> - when (item.itemId) { - R.id.action_archived_chats -> { - context?.let { - modelHelper.chat.bufferViewConfigId.safeValue?.let { chatlistId -> - ArchiveActivity.launch( - it, - chatlistId = chatlistId - ) - } - } - true - } - R.id.action_search -> { - item.isChecked = !item.isChecked - modelHelper.chat.bufferSearchTemporarilyVisible.onNext(item.isChecked) - true - } - else -> false - } - } - chatList.layoutManager = LinearLayoutManager(context) - chatList.itemAnimator = DefaultItemAnimator() - chatList.setItemViewCacheSize(10) - - modelHelper.chat.stateReset.toLiveData().observe(viewLifecycleOwner, Observer { - listAdapter.submitList(emptyList()) - hasSetBufferViewConfigId = false - }) - - val bufferSearchPermanentlyVisible = modelHelper.bufferViewConfig - .mapMap(BufferViewConfig::showSearch) - .mapOrElse(false) - - combineLatest(modelHelper.chat.bufferSearchTemporarilyVisible.distinctUntilChanged(), - bufferSearchPermanentlyVisible) - .toLiveData().observe(viewLifecycleOwner, Observer { (temporarily, permanently) -> - val visible = temporarily || permanently - - val menuItem = chatListToolbar.menu.findItem(R.id.action_search) - menuItem.isVisible = !permanently - if (permanently) menuItem.isChecked = false - else menuItem.isChecked = temporarily - - bufferSearchContainer.visibleIf(visible) - if (!visible) bufferSearch.setText("") - }) - - bufferSearch.addTextChangedListener(object : TextWatcher { - override fun afterTextChanged(s: Editable) { - modelHelper.chat.bufferSearch.onNext(s.toString()) - } - - override fun beforeTextChanged(s: CharSequence, start: Int, count: Int, after: Int) = Unit - - override fun onTextChanged(s: CharSequence, start: Int, before: Int, count: Int) = Unit - }) - - bufferSearchClear.setTooltip() - - bufferSearchClear.setOnClickListener { - bufferSearch.setText("") - } - - @ColorInt var colorLabel = 0 - @ColorInt var colorLabelBackground = 0 - - @ColorInt var fabBackground0 = 0 - @ColorInt var fabBackground1 = 0 - @ColorInt var fabBackground2 = 0 - view.context.theme.styledAttributes( - R.attr.colorTextPrimary, R.attr.colorBackgroundCard, - R.attr.senderColorE, R.attr.senderColorD, R.attr.senderColorC - ) { - colorLabel = getColor(0, 0) - colorLabelBackground = getColor(1, 0) - - fabBackground0 = getColor(2, 0) - fabBackground1 = getColor(3, 0) - fabBackground2 = getColor(4, 0) - } - - fab.addActionItem( - SpeedDialActionItem.Builder(R.id.fab_create, R.drawable.ic_add) - .setFabBackgroundColor(fabBackground0) - .setFabImageTintColor(0xffffffffu.toInt()) - .setLabel(R.string.label_create_channel) - .setLabelBackgroundColor(colorLabelBackground) - .setLabelColor(colorLabel) - .create() - ) - - fab.addActionItem( - SpeedDialActionItem.Builder(R.id.fab_join, R.drawable.ic_channel) - .setFabBackgroundColor(fabBackground1) - .setFabImageTintColor(0xffffffffu.toInt()) - .setLabel(R.string.label_join_long) - .setLabelBackgroundColor(colorLabelBackground) - .setLabelColor(colorLabel) - .create() - ) - - fab.addActionItem( - SpeedDialActionItem.Builder(R.id.fab_query, R.drawable.ic_account) - .setFabBackgroundColor(fabBackground2) - .setFabImageTintColor(0xffffffffu.toInt()) - .setLabel(R.string.label_query_medium) - .setLabelBackgroundColor(colorLabelBackground) - .setLabelColor(colorLabel) - .create() - ) - - fab.setOnActionSelectedListener { - val networkId = modelHelper.bufferData.value?.network?.networkId() - when (it.id) { - R.id.fab_query -> { - context?.let { - QueryCreateActivity.launch(it, networkId = networkId) - } - fab.close(false) - true - } - R.id.fab_join -> { - context?.let { - ChannelJoinActivity.launch(it, networkId = networkId) - } - fab.close(false) - true - } - R.id.fab_create -> { - context?.let { - ChannelCreateActivity.launch(it, networkId = networkId) - } - fab.close(false) - true - } - else -> false - } - } - - fab.visibleIf(BuildConfig.DEBUG) - - return view - } - - override fun onSaveInstanceState(outState: Bundle) { - super.onSaveInstanceState(outState) - outState.putParcelable(KEY_STATE_LIST, chatList.layoutManager?.onSaveInstanceState()) - } - - private fun toggleSelection(buffer: BufferId): Boolean { - val next = if (modelHelper.chat.selectedBufferId.safeValue == buffer) BufferId.MAX_VALUE else buffer - modelHelper.chat.selectedBufferId.onNext(next) - return next != BufferId.MAX_VALUE - } - - private fun clickListener(bufferId: BufferId) { - if (actionMode != null) { - longClickListener(bufferId) - } else { - context?.let { - modelHelper.chat.bufferSearchTemporarilyVisible.onNext(false) - ChatActivity.launch(it, bufferId = bufferId) - } - } - } - - private fun longClickListener(it: BufferId) { - if (actionMode == null) { - chatListToolbar.startActionMode(actionModeCallback) - } - if (!toggleSelection(it)) { - actionMode?.finish() - } - } - - companion object { - private const val KEY_STATE_LIST = "STATE_LIST" - } -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/ui/chat/input/AutoCompleteAdapter.kt b/app/src/main/java/de/kuschku/quasseldroid/ui/chat/input/AutoCompleteAdapter.kt deleted file mode 100644 index 4d2f75428e98833f0b33f241d998a7b03d3c5e46..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/ui/chat/input/AutoCompleteAdapter.kt +++ /dev/null @@ -1,237 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.ui.chat.input - -import android.view.LayoutInflater -import android.view.View -import android.view.ViewGroup -import androidx.recyclerview.widget.DiffUtil -import androidx.recyclerview.widget.ListAdapter -import androidx.recyclerview.widget.RecyclerView -import de.kuschku.quasseldroid.databinding.* -import de.kuschku.quasseldroid.settings.MessageSettings -import de.kuschku.quasseldroid.util.helper.loadAvatars -import de.kuschku.quasseldroid.util.helper.visibleIf -import de.kuschku.quasseldroid.util.ui.SpanFormatter -import de.kuschku.quasseldroid.viewmodel.data.AutoCompleteItem -import javax.inject.Inject - -class AutoCompleteAdapter @Inject constructor( - private val messageSettings: MessageSettings -) : ListAdapter<AutoCompleteItem, AutoCompleteAdapter.AutoCompleteViewHolder>( - object : DiffUtil.ItemCallback<AutoCompleteItem>() { - override fun areItemsTheSame(oldItem: AutoCompleteItem, newItem: AutoCompleteItem) = - oldItem.name == newItem.name - - override fun areContentsTheSame(oldItem: AutoCompleteItem, newItem: AutoCompleteItem) = - oldItem == newItem - }) { - private var clickListener: ((String, String) -> Unit)? = null - - fun setOnClickListener(listener: ((String, String) -> Unit)?) { - this.clickListener = listener - } - - override fun onCreateViewHolder(parent: ViewGroup, viewType: Int) = when (viewType) { - VIEWTYPE_CHANNEL -> AutoCompleteViewHolder.ChannelViewHolder( - WidgetBufferBinding.inflate(LayoutInflater.from(parent.context), parent, false), - clickListener = clickListener - ) - VIEWTYPE_NICK_ACTIVE, VIEWTYPE_NICK_AWAY -> AutoCompleteViewHolder.NickViewHolder( - WidgetNickBinding.inflate(LayoutInflater.from(parent.context), parent, false), - clickListener = clickListener - ) - VIEWTYPE_NICK_AWAY -> AutoCompleteViewHolder.NickAwayViewHolder( - WidgetNickAwayBinding.inflate(LayoutInflater.from(parent.context), parent, false), - clickListener = clickListener - ) - VIEWTYPE_ALIAS -> AutoCompleteViewHolder.AliasViewHolder( - WidgetAliasBinding.inflate(LayoutInflater.from(parent.context), parent, false), - clickListener = clickListener - ) - VIEWTYPE_EMOJI -> AutoCompleteViewHolder.EmojiViewHolder( - WidgetEmojiBinding.inflate(LayoutInflater.from(parent.context), parent, false), - clickListener = clickListener - ) - else -> throw IllegalArgumentException( - "Invoked with wrong item type" - ) - } - - override fun onBindViewHolder(holder: AutoCompleteViewHolder, position: Int) = - holder.bind(getItem(position), messageSettings) - - override fun getItemViewType(position: Int) = getItem(position).let { - when { - it is AutoCompleteItem.ChannelItem -> VIEWTYPE_CHANNEL - it is AutoCompleteItem.AliasItem -> VIEWTYPE_ALIAS - it is AutoCompleteItem.EmojiItem -> VIEWTYPE_EMOJI - it is AutoCompleteItem.UserItem && it.away -> VIEWTYPE_NICK_AWAY - else -> VIEWTYPE_NICK_ACTIVE - } - } - - sealed class AutoCompleteViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) { - fun bind(data: AutoCompleteItem, messageSettings: MessageSettings) = when { - data is AutoCompleteItem.UserItem && this is NickViewHolder -> - this.bindImpl(data, messageSettings) - data is AutoCompleteItem.ChannelItem && this is ChannelViewHolder -> - this.bindImpl(data, messageSettings) - data is AutoCompleteItem.AliasItem && this is AliasViewHolder -> - this.bindImpl(data, messageSettings) - data is AutoCompleteItem.EmojiItem && this is EmojiViewHolder -> - this.bindImpl(data, messageSettings) - else -> - throw IllegalArgumentException("Invoked with wrong item type") - } - - class NickViewHolder( - private val binding: WidgetNickBinding, - private val clickListener: ((String, String) -> Unit)? = null - ) : AutoCompleteViewHolder(binding.root) { - var value: AutoCompleteItem? = null - - init { - itemView.setOnClickListener { - val value = value - if (value != null) - clickListener?.invoke(value.name, value.suffix) - } - } - - fun bindImpl(data: AutoCompleteItem.UserItem, messageSettings: MessageSettings) { - value = data - - binding.nick.text = SpanFormatter.format("%s%s", data.modes, data.displayNick ?: data.nick) - binding.realname.text = data.realname - - binding.avatar.visibleIf(messageSettings.showAvatars) - binding.avatar.loadAvatars(data.avatarUrls, - data.fallbackDrawable, - crop = !messageSettings.squareAvatars) - } - } - - class NickAwayViewHolder( - private val binding: WidgetNickAwayBinding, - private val clickListener: ((String, String) -> Unit)? = null - ) : AutoCompleteViewHolder(binding.root) { - var value: AutoCompleteItem? = null - - init { - itemView.setOnClickListener { - val value = value - if (value != null) - clickListener?.invoke(value.name, value.suffix) - } - } - - fun bindImpl(data: AutoCompleteItem.UserItem, messageSettings: MessageSettings) { - value = data - - binding.nick.text = SpanFormatter.format("%s%s", data.modes, data.displayNick ?: data.nick) - binding.realname.text = data.realname - - binding.avatar.visibleIf(messageSettings.showAvatars) - binding.avatar.loadAvatars(data.avatarUrls, - data.fallbackDrawable, - crop = !messageSettings.squareAvatars) - } - } - - class ChannelViewHolder( - private val binding: WidgetBufferBinding, - private val clickListener: ((String, String) -> Unit)? = null - ) : AutoCompleteViewHolder(binding.root) { - var value: AutoCompleteItem? = null - - init { - itemView.setOnClickListener { - val value = value - if (value != null) - clickListener?.invoke(value.name, value.suffix) - } - } - - fun bindImpl(data: AutoCompleteItem.ChannelItem, messageSettings: MessageSettings) { - value = data - - binding.name.text = data.info.bufferName - binding.description.text = data.description - - binding.description.visibleIf(data.description.isNotBlank()) - - binding.status.setImageDrawable(data.icon) - } - } - - class AliasViewHolder( - private val binding: WidgetAliasBinding, - private val clickListener: ((String, String) -> Unit)? = null - ) : AutoCompleteViewHolder(binding.root) { - var value: AutoCompleteItem? = null - - init { - itemView.setOnClickListener { - val value = value - if (value != null) - clickListener?.invoke(value.name, value.suffix) - } - } - - fun bindImpl(data: AutoCompleteItem.AliasItem, messageSettings: MessageSettings) { - value = data - - binding.alias.text = data.alias - binding.expansion.text = data.expansion - } - } - - class EmojiViewHolder( - private val binding: WidgetEmojiBinding, - private val clickListener: ((String, String) -> Unit)? = null - ) : AutoCompleteViewHolder(binding.root) { - var value: AutoCompleteItem? = null - - init { - itemView.setOnClickListener { - val value = value - if (value != null) - clickListener?.invoke(value.name, value.suffix) - } - } - - fun bindImpl(data: AutoCompleteItem.EmojiItem, messageSettings: MessageSettings) { - value = data - - binding.emoji.text = data.replacement - binding.shortCode.text = data.shortCodes.joinToString(", ") - } - } - } - - companion object { - const val VIEWTYPE_CHANNEL = 0 - const val VIEWTYPE_NICK_ACTIVE = 1 - const val VIEWTYPE_NICK_AWAY = 2 - const val VIEWTYPE_ALIAS = 3 - const val VIEWTYPE_EMOJI = 4 - } -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/ui/chat/input/AutoCompleteHelper.kt b/app/src/main/java/de/kuschku/quasseldroid/ui/chat/input/AutoCompleteHelper.kt deleted file mode 100644 index 1b54b776273de3f952dcb2b4f2570c347c06bdd6..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/ui/chat/input/AutoCompleteHelper.kt +++ /dev/null @@ -1,320 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.ui.chat.input - -import androidx.fragment.app.FragmentActivity -import androidx.lifecycle.Observer -import de.kuschku.libquassel.protocol.BufferId -import de.kuschku.libquassel.protocol.Buffer_Type -import de.kuschku.libquassel.quassel.syncables.IrcChannel -import de.kuschku.libquassel.quassel.syncables.IrcUser -import de.kuschku.libquassel.quassel.syncables.Network -import de.kuschku.libquassel.session.ISession -import de.kuschku.libquassel.util.Optional -import de.kuschku.libquassel.util.flag.hasFlag -import de.kuschku.libquassel.util.helper.nullIf -import de.kuschku.libquassel.util.helper.safeSwitchMap -import de.kuschku.libquassel.util.helper.value -import de.kuschku.libquassel.util.irc.SenderColorUtil -import de.kuschku.quasseldroid.R -import de.kuschku.quasseldroid.settings.AutoCompleteSettings -import de.kuschku.quasseldroid.settings.MessageSettings -import de.kuschku.quasseldroid.util.ColorContext -import de.kuschku.quasseldroid.util.avatars.AvatarHelper -import de.kuschku.quasseldroid.util.emoji.EmojiData -import de.kuschku.quasseldroid.util.helper.styledAttributes -import de.kuschku.quasseldroid.util.helper.toLiveData -import de.kuschku.quasseldroid.util.irc.format.ContentFormatter -import de.kuschku.quasseldroid.util.irc.format.IrcFormatDeserializer -import de.kuschku.quasseldroid.viewmodel.data.AutoCompleteItem -import de.kuschku.quasseldroid.viewmodel.data.BufferStatus -import de.kuschku.quasseldroid.viewmodel.helper.EditorViewModelHelper -import de.kuschku.quasseldroid.viewmodel.helper.EditorViewModelHelper.Companion.IGNORED_CHARS - -class AutoCompleteHelper( - activity: FragmentActivity, - private val autoCompleteSettings: AutoCompleteSettings, - private val messageSettings: MessageSettings, - private val ircFormatDeserializer: IrcFormatDeserializer, - private val contentFormatter: ContentFormatter, - private val helper: EditorViewModelHelper -) { - private var autocompleteListener: ((AutoCompletionState) -> Unit)? = null - private var dataListeners: List<((List<AutoCompleteItem>) -> Unit)> = emptyList() - - var autoCompletionState: AutoCompletionState? = null - - private val senderColors = activity.theme.styledAttributes( - R.attr.senderColor0, R.attr.senderColor1, R.attr.senderColor2, R.attr.senderColor3, - R.attr.senderColor4, R.attr.senderColor5, R.attr.senderColor6, R.attr.senderColor7, - R.attr.senderColor8, R.attr.senderColor9, R.attr.senderColorA, R.attr.senderColorB, - R.attr.senderColorC, R.attr.senderColorD, R.attr.senderColorE, R.attr.senderColorF - ) { - IntArray(length()) { getColor(it, 0) } - } - - private val selfColor = activity.theme.styledAttributes(R.attr.colorForegroundSecondary) { - getColor(0, 0) - } - - private val colorAccent = activity.theme.styledAttributes(R.attr.colorAccent) { - getColor(0, 0) - } - - private val colorAway = activity.theme.styledAttributes(R.attr.colorAway) { - getColor(0, 0) - } - - private val colorContext = ColorContext(activity, messageSettings) - - init { - helper.autoCompleteData.toLiveData().observe(activity, Observer { - val query = it?.first ?: "" - val shouldShowResults = - (autoCompleteSettings.auto && query.length >= 3) || - (autoCompleteSettings.prefix && autoCompleteSettings.nicks && query.startsWith('@')) || - (autoCompleteSettings.prefix && autoCompleteSettings.buffers && query.startsWith('#')) || - (autoCompleteSettings.prefix && autoCompleteSettings.aliases && query.startsWith('/')) || - (autoCompleteSettings.prefix && autoCompleteSettings.emoji && query.startsWith(':')) - val list = if (shouldShowResults) it?.second.orEmpty() else emptyList() - val data = list.filter { - it is AutoCompleteItem.AliasItem && autoCompleteSettings.aliases || - it is AutoCompleteItem.UserItem && autoCompleteSettings.nicks || - it is AutoCompleteItem.ChannelItem && autoCompleteSettings.buffers || - it is AutoCompleteItem.EmojiItem && autoCompleteSettings.emoji - }.map { - when (it) { - is AutoCompleteItem.UserItem -> { - val nickName = it.nick - val senderColorIndex = SenderColorUtil.senderColor(nickName) - val rawInitial = nickName.trimStart(*IGNORED_CHARS).firstOrNull() - ?: nickName.firstOrNull() - val initial = rawInitial?.toUpperCase().toString() - val useSelfColor = when (messageSettings.colorizeNicknames) { - MessageSettings.SenderColorMode.ALL -> false - MessageSettings.SenderColorMode.ALL_BUT_MINE -> it.self - MessageSettings.SenderColorMode.NONE -> true - } - val senderColor = if (useSelfColor) selfColor else senderColors[senderColorIndex] - it.copy( - displayNick = contentFormatter.formatNick(it.nick), - fallbackDrawable = colorContext.buildTextDrawable(initial, senderColor), - modes = when (messageSettings.showPrefix) { - MessageSettings.ShowPrefixMode.ALL -> - it.modes - else -> - it.modes.substring(0, Math.min(it.modes.length, 1)) - }, - realname = ircFormatDeserializer.formatString( - it.realname.toString(), messageSettings.colorizeMirc - ), - avatarUrls = AvatarHelper.avatar(messageSettings, it) - ) - } - is AutoCompleteItem.ChannelItem -> { - val color = if (it.bufferStatus == BufferStatus.ONLINE) colorAccent - else colorAway - - it.copy( - icon = colorContext.buildTextDrawable("#", color) - ) - } - else -> it - } - } - dataListeners.forEach { - it(data) - } - }) - } - - fun setAutocompleteListener(listener: ((AutoCompletionState) -> Unit)?) { - this.autocompleteListener = listener - } - - fun addDataListener(listener: ((List<AutoCompleteItem>) -> Unit)) { - this.dataListeners += listener - } - - private fun fullAutoComplete(sessionOptional: Optional<ISession>, id: BufferId, - lastWord: Pair<String, IntRange>): List<AutoCompleteItem> { - val session = sessionOptional.orNull() - val bufferSyncer = session?.bufferSyncer - val bufferInfo = bufferSyncer?.bufferInfo(id) - return if (bufferSyncer != null) { - val networks = session.networks - val infos = bufferSyncer.bufferInfos() - val aliases = session.aliasManager.aliasList() - val network = networks[bufferInfo?.networkId] ?: Network.NULL - val ircChannel = if (bufferInfo?.type?.hasFlag(Buffer_Type.ChannelBuffer) == true) { - network.ircChannel(bufferInfo.bufferName) ?: IrcChannel.NULL - } else IrcChannel.NULL - val users = ircChannel.ircUsers() - fun filterStart(name: String): Boolean { - return name.trimStart(*IGNORED_CHARS) - .startsWith( - lastWord.first.trimStart(*IGNORED_CHARS), - ignoreCase = true - ) - } - - fun filter(name: String): Boolean { - return name.trim(*IGNORED_CHARS) - .contains( - lastWord.first.trim(*IGNORED_CHARS), - ignoreCase = true - ) - } - - fun getAliases() = aliases.filter { - filterStart(it.name ?: "") - }.map { - AutoCompleteItem.AliasItem( - "/${it.name}", - it.expansion - ) - } - - fun getBuffers() = infos.filter { - filterStart(it.bufferName ?: "") - }.filter { - it.type.toInt() == Buffer_Type.ChannelBuffer.toInt() - }.mapNotNull { info -> - networks[info.networkId]?.let { info to it } - }.map { (info, network) -> - val channel = network.ircChannel( - info.bufferName - ).nullIf { it == IrcChannel.NULL } - - AutoCompleteItem.ChannelItem( - info = info, - network = network.networkInfo(), - bufferStatus = when (channel) { - null -> BufferStatus.OFFLINE - else -> BufferStatus.ONLINE - }, - description = channel?.topic() ?: "" - ) - } - - fun getUsers(): Set<IrcUser> = when { - bufferInfo?.type?.hasFlag(Buffer_Type.ChannelBuffer) == true -> - users - bufferInfo?.type?.hasFlag(Buffer_Type.QueryBuffer) == true -> - network.ircUser(bufferInfo.bufferName).nullIf { it == IrcUser.NULL }?.let { - setOf(it) - } ?: emptySet() - else -> - emptySet() - } - - fun getNicks() = getUsers().filter { - filterStart(it.nick()) - }.map { user -> - val userModes = ircChannel.userModes(user) - val prefixModes = network.prefixModes() - - val lowestMode = userModes.mapNotNull(prefixModes::indexOf).min() - ?: prefixModes.size - - AutoCompleteItem.UserItem( - user.nick(), - user.hostMask(), - network.modesToPrefixes(userModes), - lowestMode, - user.realName(), - user.isAway(), - user.network().isMyNick(user.nick()), - network.support("CASEMAPPING") - ) - } - - fun getEmojis() = EmojiData.processedEmojiMap.filter { - it.shortCodes.any { - it.contains(lastWord.first.trim(':')) - } - } - - when (lastWord.first.firstOrNull()) { - '/' -> getAliases() - '@' -> getNicks() - '#' -> getBuffers() - ':' -> getEmojis() - else -> getNicks() - }.sorted() - } else { - emptyList() - } - } - - fun autoComplete(reverse: Boolean = false) { - helper.editor.lastWord.safeSwitchMap { it }.value?.let { originalWord -> - val previous = autoCompletionState - if (!originalWord.second.isEmpty()) { - val autoCompletedWords = helper.rawAutoCompleteData.value?.let { (sessionOptional, id, lastWord) -> - fullAutoComplete(sessionOptional, id, lastWord) - }?.filter { - it is AutoCompleteItem.AliasItem && autoCompleteSettings.aliases || - it is AutoCompleteItem.UserItem && autoCompleteSettings.nicks || - it is AutoCompleteItem.ChannelItem && autoCompleteSettings.buffers || - it is AutoCompleteItem.EmojiItem && autoCompleteSettings.emoji - }.orEmpty() - - if (previous != null && originalWord.first == previous.originalWord && originalWord.second.start == previous.range.start) { - val previousIndex = autoCompletedWords.indexOf(previous.completion) - val autoCompletedWord = if (previousIndex != -1) { - val change = if (reverse) -1 else +1 - val newIndex = (previousIndex + change + autoCompletedWords.size) % autoCompletedWords.size - - autoCompletedWords[newIndex] - } else { - autoCompletedWords.firstOrNull() - } - if (autoCompletedWord != null) { - val newState = AutoCompletionState( - previous.originalWord, - originalWord.second, - previous.completion, - autoCompletedWord - ) - autoCompletionState = newState - autocompleteListener?.invoke(newState) - } else { - autoCompletionState = null - } - } else { - val autoCompletedWord = autoCompletedWords.firstOrNull() - if (autoCompletedWord != null) { - val newState = AutoCompletionState( - originalWord.first, - originalWord.second, - null, - autoCompletedWord - ) - autoCompletionState = newState - autocompleteListener?.invoke(newState) - } else { - autoCompletionState = null - } - } - } - } - } -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/ui/chat/input/AutoCompletionState.kt b/app/src/main/java/de/kuschku/quasseldroid/ui/chat/input/AutoCompletionState.kt deleted file mode 100644 index 9e0abcf32e085db391640d6e550be431a991a0fc..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/ui/chat/input/AutoCompletionState.kt +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.ui.chat.input - -import de.kuschku.quasseldroid.viewmodel.data.AutoCompleteItem - -data class AutoCompletionState( - val originalWord: String, - val range: IntRange, - val lastCompletion: AutoCompleteItem? = null, - val completion: AutoCompleteItem -) diff --git a/app/src/main/java/de/kuschku/quasseldroid/ui/chat/input/ChatlineFragment.kt b/app/src/main/java/de/kuschku/quasseldroid/ui/chat/input/ChatlineFragment.kt deleted file mode 100644 index 26fb83a0b3b4cda7b3208671d5d7fd83389f3816..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/ui/chat/input/ChatlineFragment.kt +++ /dev/null @@ -1,265 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.ui.chat.input - -import android.os.Bundle -import android.text.SpannableString -import android.text.Spanned -import android.view.LayoutInflater -import android.view.View -import android.view.ViewGroup -import androidx.appcompat.widget.AppCompatImageButton -import androidx.lifecycle.Observer -import androidx.recyclerview.widget.DefaultItemAnimator -import androidx.recyclerview.widget.LinearLayoutManager -import androidx.recyclerview.widget.RecyclerView -import butterknife.BindView -import butterknife.ButterKnife -import com.google.android.material.bottomsheet.BottomSheetBehavior -import de.kuschku.libquassel.quassel.syncables.interfaces.IAliasManager -import de.kuschku.libquassel.util.Optional -import de.kuschku.libquassel.util.helper.invoke -import de.kuschku.quasseldroid.R -import de.kuschku.quasseldroid.settings.AppearanceSettings -import de.kuschku.quasseldroid.settings.AutoCompleteSettings -import de.kuschku.quasseldroid.settings.MessageSettings -import de.kuschku.quasseldroid.util.emoji.EmojiData -import de.kuschku.quasseldroid.util.helper.* -import de.kuschku.quasseldroid.util.irc.format.ContentFormatter -import de.kuschku.quasseldroid.util.irc.format.IrcFormatDeserializer -import de.kuschku.quasseldroid.util.irc.format.IrcFormatSerializer -import de.kuschku.quasseldroid.util.service.ServiceBoundFragment -import de.kuschku.quasseldroid.viewmodel.helper.EditorViewModelHelper -import javax.inject.Inject - -class ChatlineFragment : ServiceBoundFragment() { - @BindView(R.id.chatline) - lateinit var chatline: RichEditText - - @BindView(R.id.formatting_toolbar) - lateinit var toolbar: RichToolbar - - @BindView(R.id.send) - lateinit var send: AppCompatImageButton - - @BindView(R.id.tab_complete) - lateinit var tabComplete: AppCompatImageButton - - @BindView(R.id.msg_history) - lateinit var messageHistory: RecyclerView - - @BindView(R.id.autocomplete_list) - lateinit var autoCompleteList: RecyclerView - - @BindView(R.id.close) - lateinit var close: AppCompatImageButton - - @BindView(R.id.card_panel) - lateinit var cardPanel: View - - @BindView(R.id.editor_container) - lateinit var editorContainer: View - - @Inject - lateinit var autoCompleteSettings: AutoCompleteSettings - - @Inject - lateinit var messageSettings: MessageSettings - - @Inject - lateinit var appearanceSettings: AppearanceSettings - - @Inject - lateinit var ircFormatDeserializer: IrcFormatDeserializer - - @Inject - lateinit var contentFormatter: ContentFormatter - - @Inject - lateinit var ircFormatSerializer: IrcFormatSerializer - - @Inject - lateinit var autoCompleteAdapter: AutoCompleteAdapter - - lateinit var editorHelper: EditorHelper - - lateinit var autoCompleteHelper: AutoCompleteHelper - - lateinit var historyBottomSheet: BottomSheetBehavior<View> - - @Inject - lateinit var modelHelper: EditorViewModelHelper - - val panelSlideListener = object : BottomSheetBehavior.BottomSheetCallback() { - override fun onSlide(bottomSheet: View, slideOffset: Float) = Unit - - override fun onStateChanged(bottomSheet: View, newState: Int) { - editorHelper.setMultiLine(newState != BottomSheetBehavior.STATE_COLLAPSED) - } - } - - override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, - savedInstanceState: Bundle?): View? { - val view = inflater.inflate(R.layout.chat_chatline, container, false) - ButterKnife.bind(this, view) - - autoCompleteHelper = AutoCompleteHelper( - requireActivity(), - autoCompleteSettings, - messageSettings, - ircFormatDeserializer, - contentFormatter, - modelHelper - ) - - editorHelper = EditorHelper( - requireActivity(), - chatline, - toolbar, - autoCompleteHelper, - autoCompleteSettings, - appearanceSettings - ) - - modelHelper.editor.lastWord.onNext(editorHelper.lastWord) - - val autoCompleteBottomSheet = BottomSheetBehavior.from(autoCompleteList) - if (autoCompleteSettings.prefix || autoCompleteSettings.auto) { - autoCompleteAdapter.setOnClickListener(chatline::autoComplete) - autoCompleteList.layoutManager = LinearLayoutManager(context) - autoCompleteList.itemAnimator = DefaultItemAnimator() - autoCompleteList.adapter = autoCompleteAdapter - autoCompleteHelper.addDataListener { - autoCompleteBottomSheet.state = - if (it.isEmpty()) BottomSheetBehavior.STATE_HIDDEN - else BottomSheetBehavior.STATE_COLLAPSED - autoCompleteAdapter.submitList(it) - } - } - - historyBottomSheet = BottomSheetBehavior.from(cardPanel) - historyBottomSheet.state = BottomSheetBehavior.STATE_HIDDEN - messageHistory.itemAnimator = DefaultItemAnimator() - messageHistory.layoutManager = LinearLayoutManager(requireContext()) - val messageHistoryAdapter = MessageHistoryAdapter() - messageHistoryAdapter.setOnItemClickListener { text -> - editorHelper.replaceText(text) - historyBottomSheet.state = BottomSheetBehavior.STATE_HIDDEN - } - close.setTooltip() - close.setOnClickListener { - historyBottomSheet.state = BottomSheetBehavior.STATE_HIDDEN - } - messageHistory.adapter = messageHistoryAdapter - modelHelper.chat.recentlySentMessages.toLiveData() - .observe(viewLifecycleOwner, Observer(messageHistoryAdapter::submitList)) - messageHistoryAdapter.setOnUpdateFinishedListener { - messageHistory.scrollToPosition(0) - } - - fun send() { - val safeText = - if (messageSettings.replaceEmoji) EmojiData.replaceShortCodes(chatline.safeText) - else chatline.safeText - - if (safeText.isNotEmpty()) { - val lines = safeText.lineSequence().map { - SpannableString(it).apply { - for (span in getSpans(0, length, Any::class.java)) { - if (getSpanFlags(span) and Spanned.SPAN_COMPOSING != 0) { - removeSpan(span) - } - } - } to ircFormatSerializer.toEscapeCodes(SpannableString(it)) - } - - for ((stripped, _) in lines) { - modelHelper.chat.addRecentlySentMessage(stripped) - } - modelHelper.connectedSession { sessionOptional -> - val session = sessionOptional.orNull() - modelHelper.chat.bufferId { bufferId -> - session?.bufferSyncer?.bufferInfo(bufferId)?.also { bufferInfo -> - val output = mutableListOf<IAliasManager.Command>() - for ((_, formatted) in lines) { - session.aliasManager.processInput(bufferInfo, formatted, output) - } - for (command in output) { - if (command.message.startsWith("/join", ignoreCase = true)) { - val channel = command.message - .substringAfter(' ') - .substringBefore(' ') - .split(",") - .last() - - modelHelper.chat.chatToJoin.onNext(Optional.of( - Pair(command.buffer.networkId, channel) - )) - } - } - for (command in output) { - session.rpcHandler.sendInput(command.buffer, command.message) - } - } - } - } - } - modelHelper.chat.recentMessagesIndexReset() - chatline.setText("") - } - - editorHelper.setOnEnterListener(::send) - editorHelper.setOnDownListener { - chatline.setText(modelHelper.chat.recentMessagesIndexDown(chatline.safeText)) - } - editorHelper.setOnUpListener { - chatline.setText(modelHelper.chat.recentMessagesIndexUp()) - } - send.setOnClickListener { send() } - send.setTooltip() - - tabComplete.setTooltip() - tabComplete.visibleIf(autoCompleteSettings.button) - tabComplete.setOnClickListener { - autoCompleteHelper.autoComplete() - } - - toolbar.inflateMenu(R.menu.editor) - toolbar.menu.retint(requireActivity()) - toolbar.setOnMenuItemClickListener { - when (it.itemId) { - R.id.action_input_history -> { - historyBottomSheet.state = BottomSheetBehavior.STATE_EXPANDED - true - } - else -> false - } - } - - return view - } - - fun replaceText(text: CharSequence) { - if (chatline.safeText.isNotEmpty()) { - chatline.safeText.lineSequence().forEach(modelHelper.chat::addRecentlySentMessage) - } - editorHelper.replaceText(text) - } -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/ui/chat/input/EditorHelper.kt b/app/src/main/java/de/kuschku/quasseldroid/ui/chat/input/EditorHelper.kt deleted file mode 100644 index 042a490026cbc23fb5be7531a1deb378a720ffb5..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/ui/chat/input/EditorHelper.kt +++ /dev/null @@ -1,249 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.ui.chat.input - -import android.text.Editable -import android.text.TextWatcher -import android.view.KeyEvent -import android.view.inputmethod.EditorInfo -import androidx.annotation.ColorInt -import androidx.annotation.StringRes -import androidx.fragment.app.FragmentActivity -import de.kuschku.quasseldroid.R -import de.kuschku.quasseldroid.settings.AppearanceSettings -import de.kuschku.quasseldroid.settings.AutoCompleteSettings -import de.kuschku.quasseldroid.util.helper.getColorCompat -import de.kuschku.quasseldroid.util.helper.lastWordIndices -import de.kuschku.quasseldroid.util.helper.styledAttributes -import de.kuschku.quasseldroid.util.ui.ColorChooserDialog -import io.reactivex.subjects.BehaviorSubject - -class EditorHelper( - private val activity: FragmentActivity, - private val editText: RichEditText, - private val toolbar: RichToolbar, - private val autoCompleteHelper: AutoCompleteHelper, - autoCompleteSettings: AutoCompleteSettings, - appearanceSettings: AppearanceSettings -) { - private var enterListener: (() -> Unit)? = null - private var upListener: (() -> Unit)? = null - private var downListener: (() -> Unit)? = null - - private val mircColors = listOf( - R.color.mircColor00, R.color.mircColor01, R.color.mircColor02, R.color.mircColor03, - R.color.mircColor04, R.color.mircColor05, R.color.mircColor06, R.color.mircColor07, - R.color.mircColor08, R.color.mircColor09, R.color.mircColor10, R.color.mircColor11, - R.color.mircColor12, R.color.mircColor13, R.color.mircColor14, R.color.mircColor15 - ).map(activity::getColorCompat).toIntArray() - - private val defaultForegroundColor = editText.context.theme.styledAttributes(R.attr.colorForeground) { - getColor(0, 0) - } - - private val defaultBackgroundColor = editText.context.theme.styledAttributes(R.attr.colorBackground) { - getColor(0, 0) - } - - val lastWord: BehaviorSubject<Pair<String, IntRange>> = - BehaviorSubject.createDefault(Pair("", IntRange.EMPTY)) - private val textWatcher = object : TextWatcher { - override fun afterTextChanged(s: Editable?) { - val previous = autoCompleteHelper.autoCompletionState - val next = if (previous != null && s != null) { - val suffix = if (previous.range.start == 0) previous.completion.suffix else " " - val sequence = if (s.length < previous.range.start) "" - else s.substring(previous.range.start) - if (sequence == previous.completion.name + suffix) { - previous.originalWord to (previous.range.start until s.length) - } else { - autoCompleteHelper.autoCompletionState = null - s.lastWordIndices(editText.selectionStart, onlyBeforeCursor = true)?.let { indices -> - s.substring(indices) to indices - } - } - } else { - s?.lastWordIndices(editText.selectionStart, onlyBeforeCursor = true)?.let { indices -> - s.substring(indices) to indices - } - } - - lastWord.onNext(next ?: Pair("", IntRange.EMPTY)) - } - - override fun beforeTextChanged(s: CharSequence?, start: Int, count: Int, after: Int) = Unit - override fun onTextChanged(s: CharSequence?, start: Int, before: Int, count: Int) = Unit - } - - init { - toolbar.setFormattingListener(object : RichToolbar.FormattingListener { - override fun onBold() = editText.toggleBold() - override fun onItalic() = editText.toggleItalic() - override fun onUnderline() = editText.toggleUnderline() - override fun onStrikethrough() = editText.toggleStrikethrough() - override fun onMonospace() = editText.toggleMonospace() - override fun onForeground() = showColorChooser(R.string.label_foreground, - editText.foregroundColor(), - defaultForegroundColor) { - editText.toggleForeground(color = it) - } - - override fun onBackground() = showColorChooser(R.string.label_background, - editText.backgroundColor(), - defaultBackgroundColor) { - editText.toggleBackground(color = it) - } - - override fun onClear() = editText.clearFormatting() - }) - autoCompleteHelper.setAutocompleteListener(editText::autoComplete) - editText.setFormattingListener { bold, italic, underline, strikethrough, monospace, foreground, background -> - toolbar.update( - bold, - italic, - underline, - strikethrough, - monospace, - foreground ?: defaultForegroundColor, - background ?: defaultBackgroundColor - ) - } - editText.addTextChangedListener(textWatcher) - editText.setOnKeyListener { _, keyCode, event: KeyEvent -> - if (event.action == KeyEvent.ACTION_DOWN) { - if (event.isCtrlPressed && !event.isAltPressed) when (keyCode) { - KeyEvent.KEYCODE_B -> { - editText.toggleBold() - true - } - KeyEvent.KEYCODE_I -> { - editText.toggleItalic() - true - } - KeyEvent.KEYCODE_U -> { - editText.toggleUnderline() - true - } - else -> false - } else when (keyCode) { - KeyEvent.KEYCODE_ENTER, - KeyEvent.KEYCODE_NUMPAD_ENTER -> if (event.isShiftPressed) { - false - } else { - enterListener?.invoke() - true - } - KeyEvent.KEYCODE_DPAD_DOWN -> { - downListener?.invoke() - true - } - KeyEvent.KEYCODE_DPAD_UP -> { - upListener?.invoke() - true - } - KeyEvent.KEYCODE_TAB -> { - if (!event.isAltPressed && !event.isCtrlPressed) { - autoCompleteHelper.autoComplete(event.isShiftPressed) - true - } else { - false - } - } - else -> false - } - } else if (keyCode == KeyEvent.KEYCODE_ENTER || keyCode == KeyEvent.KEYCODE_NUMPAD_ENTER) { - !event.isShiftPressed - } else { - false - } - } - - if (autoCompleteSettings.doubleTap) { - editText.setDoubleClickListener { - autoCompleteHelper.autoComplete() - } - } - - editText.imeOptions = when (appearanceSettings.inputEnter) { - AppearanceSettings.InputEnterMode.EMOJI -> listOf( - EditorInfo.IME_ACTION_NONE, - EditorInfo.IME_FLAG_NO_EXTRACT_UI - ) - AppearanceSettings.InputEnterMode.SEND -> listOf( - EditorInfo.IME_ACTION_SEND, - EditorInfo.IME_FLAG_NO_EXTRACT_UI - ) - AppearanceSettings.InputEnterMode.NEWLINE -> listOf( - EditorInfo.IME_ACTION_UNSPECIFIED, - EditorInfo.IME_FLAG_NO_EXTRACT_UI - ) - }.fold(0, Int::or) - } - - fun setOnEnterListener(listener: (() -> Unit)?) { - this.enterListener = listener - } - - fun setOnUpListener(listener: (() -> Unit)?) { - this.upListener = listener - } - - fun setOnDownListener(listener: (() -> Unit)?) { - this.downListener = listener - } - - fun setMultiLine(enabled: Boolean) = editText.setMultiLine(enabled) - - fun replaceText(text: CharSequence?) = editText.replaceText(text) - - fun appendText(text: CharSequence?, suffix: String?) = editText.appendText(text, suffix) - - private fun showColorChooser( - @StringRes title: Int, - @ColorInt preselect: Int?, - @ColorInt default: Int, - f: (Int?) -> Unit - ) { - var selectedColor: Int? = preselect - ColorChooserDialog.Builder(editText.context, title) - .customColors(mircColors, null) - .doneButton(R.string.label_select) - .cancelButton(R.string.label_reset) - .backButton(R.string.label_back) - .customButton(R.string.label_colors_custom) - .presetsButton(R.string.label_colors_mirc) - .preselect(preselect ?: default) - .dynamicButtonColor(false) - .allowUserColorInputAlpha(false) - .callback(object : ColorChooserDialog.ColorCallback { - override fun onColorReset(dialog: ColorChooserDialog) { - selectedColor = null - } - - override fun onColorSelection(dialog: ColorChooserDialog, color: Int) { - selectedColor = color - } - - override fun onColorChooserDismissed(dialog: ColorChooserDialog) { - f(selectedColor) - } - }).show(activity) - } -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/ui/chat/input/MessageHistoryAdapter.kt b/app/src/main/java/de/kuschku/quasseldroid/ui/chat/input/MessageHistoryAdapter.kt deleted file mode 100644 index 1a5e35449993c638020c6a556aab1fd13cd38ef3..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/ui/chat/input/MessageHistoryAdapter.kt +++ /dev/null @@ -1,81 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.ui.chat.input - -import android.text.TextUtils -import android.view.LayoutInflater -import android.view.ViewGroup -import androidx.recyclerview.widget.DiffUtil -import androidx.recyclerview.widget.RecyclerView -import de.kuschku.quasseldroid.databinding.WidgetHistoryMessageBinding -import de.kuschku.quasseldroid.util.lists.ListAdapter - -class MessageHistoryAdapter : ListAdapter<CharSequence, MessageHistoryAdapter.MessageViewHolder>( - object : DiffUtil.ItemCallback<CharSequence>() { - override fun areItemsTheSame(oldItem: CharSequence, newItem: CharSequence) = - oldItem === newItem - - override fun areContentsTheSame(oldItem: CharSequence, newItem: CharSequence) = - TextUtils.equals(oldItem, newItem) - }) { - private var clickListener: ((CharSequence) -> Unit)? = null - private var updateFinishedListener: (() -> Unit)? = null - - fun setOnItemClickListener(listener: ((CharSequence) -> Unit)?) { - this.clickListener = listener - } - - fun setOnUpdateFinishedListener(listener: (() -> Unit)?) { - this.updateFinishedListener = listener - } - - override fun onCreateViewHolder(parent: ViewGroup, viewType: Int) = - MessageViewHolder( - WidgetHistoryMessageBinding.inflate(LayoutInflater.from(parent.context), parent, false), - clickListener = clickListener - ) - - override fun onUpdateFinished(list: List<CharSequence>) { - updateFinishedListener?.invoke() - } - - override fun onBindViewHolder(holder: MessageViewHolder, position: Int) = - holder.bind(getItem(position)) - - class MessageViewHolder( - private val binding: WidgetHistoryMessageBinding, - private val clickListener: ((CharSequence) -> Unit)? = null - ) : RecyclerView.ViewHolder(binding.root) { - var value: CharSequence? = null - - init { - itemView.setOnClickListener { - val value = value - if (value != null) - clickListener?.invoke(value) - } - } - - fun bind(data: CharSequence) { - value = data - binding.content.text = data - } - } -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/ui/chat/input/RichEditText.kt b/app/src/main/java/de/kuschku/quasseldroid/ui/chat/input/RichEditText.kt deleted file mode 100644 index ce86e0d2be75231d0639ef15d8d93f6ff2b1f22a..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/ui/chat/input/RichEditText.kt +++ /dev/null @@ -1,363 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.ui.chat.input - -import android.content.Context -import android.graphics.Typeface -import android.text.Editable -import android.text.InputType -import android.text.SpannableStringBuilder -import android.text.Spanned -import android.text.style.* -import android.util.AttributeSet -import androidx.annotation.ColorInt -import de.kuschku.quasseldroid.R -import de.kuschku.quasseldroid.util.helper.* -import de.kuschku.quasseldroid.util.irc.format.spans.* -import de.kuschku.quasseldroid.util.ui.DoubleClickHelper -import de.kuschku.quasseldroid.util.ui.EditTextSelectionChange - -class RichEditText : EditTextSelectionChange { - val safeText: Editable - get() = this.text ?: SpannableStringBuilder("").also { - this.text = it - } - - val mircColors = listOf( - R.color.mircColor00, R.color.mircColor01, R.color.mircColor02, R.color.mircColor03, - R.color.mircColor04, R.color.mircColor05, R.color.mircColor06, R.color.mircColor07, - R.color.mircColor08, R.color.mircColor09, R.color.mircColor10, R.color.mircColor11, - R.color.mircColor12, R.color.mircColor13, R.color.mircColor14, R.color.mircColor15, - R.color.mircColor16, R.color.mircColor17, R.color.mircColor18, R.color.mircColor19, - R.color.mircColor20, R.color.mircColor21, R.color.mircColor22, R.color.mircColor23, - R.color.mircColor24, R.color.mircColor25, R.color.mircColor26, R.color.mircColor27, - R.color.mircColor28, R.color.mircColor29, R.color.mircColor30, R.color.mircColor31, - R.color.mircColor32, R.color.mircColor33, R.color.mircColor34, R.color.mircColor35, - R.color.mircColor36, R.color.mircColor37, R.color.mircColor38, R.color.mircColor39, - R.color.mircColor40, R.color.mircColor41, R.color.mircColor42, R.color.mircColor43, - R.color.mircColor44, R.color.mircColor45, R.color.mircColor46, R.color.mircColor47, - R.color.mircColor48, R.color.mircColor49, R.color.mircColor50, R.color.mircColor51, - R.color.mircColor52, R.color.mircColor53, R.color.mircColor54, R.color.mircColor55, - R.color.mircColor56, R.color.mircColor57, R.color.mircColor58, R.color.mircColor59, - R.color.mircColor60, R.color.mircColor61, R.color.mircColor62, R.color.mircColor63, - R.color.mircColor64, R.color.mircColor65, R.color.mircColor66, R.color.mircColor67, - R.color.mircColor68, R.color.mircColor69, R.color.mircColor70, R.color.mircColor71, - R.color.mircColor72, R.color.mircColor73, R.color.mircColor74, R.color.mircColor75, - R.color.mircColor76, R.color.mircColor77, R.color.mircColor78, R.color.mircColor79, - R.color.mircColor80, R.color.mircColor81, R.color.mircColor82, R.color.mircColor83, - R.color.mircColor84, R.color.mircColor85, R.color.mircColor86, R.color.mircColor87, - R.color.mircColor88, R.color.mircColor89, R.color.mircColor90, R.color.mircColor91, - R.color.mircColor92, R.color.mircColor93, R.color.mircColor94, R.color.mircColor95, - R.color.mircColor96, R.color.mircColor97, R.color.mircColor98 - ).map(context::getColorCompat).toIntArray() - private val mircColorMap = mircColors.withIndex().map { (key, value) -> key to value }.toMap() - - private var formattingListener: ((Boolean, Boolean, Boolean, Boolean, Boolean, Int?, Int?) -> Unit)? = null - - private val doubleClickHelper = DoubleClickHelper(this) - - constructor(context: Context?) : super(context) - constructor(context: Context?, attrs: AttributeSet?) : super(context, attrs) - constructor(context: Context?, attrs: AttributeSet?, defStyleAttr: Int) : - super(context, attrs, defStyleAttr) - - init { - setSelectionChangeListener(this::selectedFormattingChanged) - setOnTouchListener(doubleClickHelper) - } - - fun setFormattingListener( - listener: ((Boolean, Boolean, Boolean, Boolean, Boolean, Int?, Int?) -> Unit)?) { - this.formattingListener = listener - } - - fun setDoubleClickListener(listener: (() -> Unit)?) { - this.doubleClickHelper.doubleClickListener = listener - } - - fun isBold(range: IntRange = selection) = this.safeText.hasSpans<StyleSpan>(range) { - it.style == Typeface.BOLD || it.style == Typeface.BOLD_ITALIC - } - - fun toggleBold(range: IntRange = selection, createNew: Boolean = true) { - val bold = isBold(range) - this.safeText.removeSpans<StyleSpan, IrcBoldSpan>(range) { span -> - when { - span is IrcBoldSpan -> span - span.style == Typeface.BOLD -> IrcBoldSpan() - else -> null - } - } - - if (!bold && createNew) { - this.safeText.setSpan( - IrcBoldSpan(), range.start, range.endInclusive + 1, Spanned.SPAN_INCLUSIVE_INCLUSIVE - ) - } - selectedFormattingChanged() - } - - fun isItalic(range: IntRange = selection) = this.safeText.hasSpans<StyleSpan>(range) { - it.style == Typeface.ITALIC || it.style == Typeface.BOLD_ITALIC - } - - fun toggleItalic(range: IntRange = selection, createNew: Boolean = true) { - val italic = isItalic(range) - - this.safeText.removeSpans<StyleSpan, IrcItalicSpan>(range) { span -> - when { - span is IrcItalicSpan -> span - span.style == Typeface.ITALIC -> IrcItalicSpan() - else -> null - } - } - - if (!italic && createNew) { - this.safeText.setSpan( - IrcItalicSpan(), range.start, range.endInclusive + 1, Spanned.SPAN_INCLUSIVE_INCLUSIVE - ) - } - selectedFormattingChanged() - } - - fun isUnderline(range: IntRange = selection) = this.safeText.hasSpans<UnderlineSpan>(range) - - fun toggleUnderline(range: IntRange = selection, createNew: Boolean = true) { - val underline = isUnderline(range) - - this.safeText.removeSpans<UnderlineSpan, IrcUnderlineSpan>(range) { span -> - when (span) { - is IrcUnderlineSpan -> span - else -> IrcUnderlineSpan() - } - } - - if (!underline && createNew) { - this.safeText.setSpan( - IrcUnderlineSpan(), range.start, range.endInclusive + 1, Spanned.SPAN_INCLUSIVE_INCLUSIVE - ) - } - selectedFormattingChanged() - } - - fun isStrikethrough( - range: IntRange = selection) = this.safeText.hasSpans<StrikethroughSpan>(range) - - fun toggleStrikethrough(range: IntRange = selection, createNew: Boolean = true) { - val strikethrough = isStrikethrough(range) - - this.safeText.removeSpans<StrikethroughSpan, IrcStrikethroughSpan>(range) { span -> - when (span) { - is IrcStrikethroughSpan -> span - else -> IrcStrikethroughSpan() - } - } - - if (!strikethrough && createNew) { - this.safeText.setSpan( - IrcStrikethroughSpan(), range.start, range.endInclusive + 1, - Spanned.SPAN_INCLUSIVE_INCLUSIVE - ) - } - selectedFormattingChanged() - } - - fun isMonospace(range: IntRange = selection) = this.safeText.hasSpans<TypefaceSpan>(range) { - it.family == "monospace" - } - - fun toggleMonospace(range: IntRange = selection, createNew: Boolean = true) { - val monospace = isMonospace(range) - - this.safeText.removeSpans<TypefaceSpan, IrcMonospaceSpan>(range) { span -> - when { - span is IrcMonospaceSpan -> span - span.family == "monospace" -> IrcMonospaceSpan() - else -> null - } - } - - if (!monospace && createNew) { - this.safeText.setSpan( - IrcMonospaceSpan(), range.start, range.endInclusive + 1, Spanned.SPAN_INCLUSIVE_INCLUSIVE - ) - } - selectedFormattingChanged() - } - - fun foregroundColors( - range: IntRange = selection) = this.safeText.spans<ForegroundColorSpan>(range) - - fun foregroundColor(range: IntRange = selection) = - foregroundColors(range).singleOrNull()?.foregroundColor - - fun toggleForeground(range: IntRange = selection, @ColorInt color: Int? = null, - mircColor: Int? = null) { - this.safeText.removeSpans<ForegroundColorSpan, IrcForegroundColorSpan<*>>(range) { span -> - val mirc = mircColorMap[span.foregroundColor] - when { - span is IrcForegroundColorSpan<*> -> span - mirc != null -> IrcForegroundColorSpan.MIRC(mirc, span.foregroundColor) - else -> IrcForegroundColorSpan.HEX(span.foregroundColor) - } - } - - if (color != null) { - if (mircColor != null) { - this.safeText.setSpan( - IrcForegroundColorSpan.MIRC(mircColor, color), - range.start, - range.last + 1, - Spanned.SPAN_INCLUSIVE_INCLUSIVE - ) - } else { - this.safeText.setSpan( - IrcForegroundColorSpan.HEX(color), - range.start, - range.last + 1, - Spanned.SPAN_INCLUSIVE_INCLUSIVE - ) - } - } - selectedFormattingChanged() - } - - fun backgroundColors( - range: IntRange = selection) = this.safeText.spans<BackgroundColorSpan>(range) - - fun backgroundColor(range: IntRange = selection) = - backgroundColors(range).singleOrNull()?.backgroundColor - - fun toggleBackground(range: IntRange = selection, @ColorInt color: Int? = null, - mircColor: Int? = null) { - this.safeText.removeSpans<BackgroundColorSpan, IrcBackgroundColorSpan<*>>(range) { span -> - val mirc = mircColorMap[span.backgroundColor] - when { - span is IrcBackgroundColorSpan<*> -> span - mirc != null -> IrcBackgroundColorSpan.MIRC(mirc, span.backgroundColor) - else -> IrcBackgroundColorSpan.HEX(span.backgroundColor) - } - } - - if (color != null) { - if (mircColor != null) { - this.safeText.setSpan( - IrcBackgroundColorSpan.MIRC(mircColor, color), - range.start, - range.last + 1, - Spanned.SPAN_INCLUSIVE_INCLUSIVE - ) - } else { - this.safeText.setSpan( - IrcBackgroundColorSpan.HEX(color), - range.start, - range.last + 1, - Spanned.SPAN_INCLUSIVE_INCLUSIVE - ) - } - } - selectedFormattingChanged() - } - - fun clearFormatting(range: IntRange = selection) { - toggleBold(range, false) - toggleItalic(range, false) - toggleUnderline(range, false) - toggleStrikethrough(range, false) - toggleMonospace(range, false) - toggleForeground(range, null, null) - toggleBackground(range, null, null) - } - - fun setMultiLine(enabled: Boolean) { - val selectionStart = selectionStart - val selectionEnd = selectionEnd - - inputType = - if (enabled) inputType or InputType.TYPE_TEXT_FLAG_MULTI_LINE - else inputType and InputType.TYPE_TEXT_FLAG_MULTI_LINE.inv() - - setSelection(selectionStart, selectionEnd) - } - - fun autoComplete(text: CharSequence, suffix: String) { - val range = this.safeText.lastWordIndices(this.selection.start, true) - val replacement = if (range?.start == 0) { - "$text$suffix" - } else { - "$text " - } - - if (range != null) { - this.safeText.replace(range.start, range.endInclusive + 1, replacement) - this.setSelection(range.start + replacement.length) - } else { - this.safeText.append(replacement) - this.setSelection(this.safeText.length) - } - } - - fun autoComplete(item: AutoCompletionState) { - val suffix = if (item.range.start == 0) item.completion.suffix else " " - val replacement = "${item.completion.name}$suffix" - val previousReplacement = item.lastCompletion?.let { "${item.lastCompletion.name}$suffix" } - - if (previousReplacement != null && - this.safeText.length >= item.range.start + previousReplacement.length && - this.safeText.substring( - item.range.start, item.range.start + previousReplacement.length - ) == previousReplacement) { - this.safeText.replace( - item.range.start, item.range.start + previousReplacement.length, replacement - ) - this.setSelection(item.range.start + replacement.length) - } else { - this.safeText.replace(item.range.start, item.range.endInclusive + 1, replacement) - this.setSelection(item.range.start + replacement.length) - } - } - - fun replaceText(text: CharSequence?) { - this.setText(text) - this.setSelection(this.safeText.length) - } - - fun appendText(text: CharSequence?, suffix: String?) { - val shouldAddSuffix = this.safeText.isEmpty() - if (this.safeText.isNotEmpty() && !this.safeText.endsWith(" ")) - this.safeText.append(" ") - this.safeText.append(text) - if (shouldAddSuffix) - this.safeText.append(suffix) - this.setSelection(this.safeText.length) - } - - private fun selectedFormattingChanged(range: IntRange = selection) { - formattingListener?.invoke( - isBold(range), - isItalic(range), - isUnderline(range), - isStrikethrough(range), - isMonospace(range), - foregroundColor(range), - backgroundColor(range) - ) - } -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/ui/chat/input/RichToolbar.kt b/app/src/main/java/de/kuschku/quasseldroid/ui/chat/input/RichToolbar.kt deleted file mode 100644 index 3ead176e833814de86de3383fb2c7375f46150a8..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/ui/chat/input/RichToolbar.kt +++ /dev/null @@ -1,127 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.ui.chat.input - -import android.content.Context -import android.util.AttributeSet -import android.view.LayoutInflater -import android.view.View -import androidx.annotation.ColorInt -import androidx.appcompat.widget.Toolbar -import butterknife.BindView -import butterknife.ButterKnife -import de.kuschku.quasseldroid.R -import de.kuschku.quasseldroid.util.helper.setTooltip - -class RichToolbar : Toolbar { - @BindView(R.id.action_format_bold) - lateinit var boldButton: View - - @BindView(R.id.action_format_italic) - lateinit var italicButton: View - - @BindView(R.id.action_format_underline) - lateinit var underlineButton: View - - @BindView(R.id.action_format_strikethrough) - lateinit var strikethroughButton: View - - @BindView(R.id.action_format_monospace) - lateinit var monospaceButton: View - - @BindView(R.id.action_format_foreground) - lateinit var foregroundButton: View - - @BindView(R.id.action_format_foreground_preview) - lateinit var foregroundButtonPreview: View - - @BindView(R.id.action_format_background) - lateinit var backgroundButton: View - - @BindView(R.id.action_format_background_preview) - lateinit var backgroundButtonPreview: View - - @BindView(R.id.action_format_clear) - lateinit var clearButton: View - - private var listener: FormattingListener? = null - - constructor(context: Context?) : super(context) - constructor(context: Context?, attrs: AttributeSet?) : super(context, attrs) - constructor(context: Context?, attrs: AttributeSet?, defStyleAttr: Int) : - super(context, attrs, defStyleAttr) - - init { - LayoutInflater.from(context).inflate(R.layout.widget_formatting, this, true) - ButterKnife.bind(this) - - boldButton.setTooltip() - italicButton.setTooltip() - underlineButton.setTooltip() - strikethroughButton.setTooltip() - monospaceButton.setTooltip() - foregroundButton.setTooltip() - backgroundButton.setTooltip() - clearButton.setTooltip() - - boldButton.setOnClickListener { listener?.onBold() } - italicButton.setOnClickListener { listener?.onItalic() } - underlineButton.setOnClickListener { listener?.onUnderline() } - strikethroughButton.setOnClickListener { listener?.onStrikethrough() } - monospaceButton.setOnClickListener { listener?.onMonospace() } - foregroundButton.setOnClickListener { listener?.onForeground() } - backgroundButton.setOnClickListener { listener?.onBackground() } - clearButton.setOnClickListener { listener?.onClear() } - } - - fun setFormattingListener(listener: FormattingListener?) { - this.listener = listener - } - - fun update( - bold: Boolean = false, - italic: Boolean = false, - underline: Boolean = false, - strikethrough: Boolean = false, - monospace: Boolean = false, - @ColorInt foreground: Int, - @ColorInt background: Int - ) { - boldButton.isSelected = bold - italicButton.isSelected = italic - underlineButton.isSelected = underline - strikethroughButton.isSelected = strikethrough - monospaceButton.isSelected = monospace - - foregroundButtonPreview.setBackgroundColor(foreground) - backgroundButtonPreview.setBackgroundColor(background) - } - - interface FormattingListener { - fun onBold() = Unit - fun onItalic() = Unit - fun onUnderline() = Unit - fun onStrikethrough() = Unit - fun onMonospace() = Unit - fun onForeground() = Unit - fun onBackground() = Unit - fun onClear() = Unit - } -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/ui/chat/messages/DisplayMessage.kt b/app/src/main/java/de/kuschku/quasseldroid/ui/chat/messages/DisplayMessage.kt deleted file mode 100644 index 9b3802a957590cce1e2aaf85caa7f3a6bfcca865..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/ui/chat/messages/DisplayMessage.kt +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.ui.chat.messages - -import de.kuschku.libquassel.protocol.Message_Flag -import de.kuschku.libquassel.protocol.MsgId -import de.kuschku.libquassel.util.flag.hasFlag -import de.kuschku.quasseldroid.persistence.models.MessageData - -data class DisplayMessage( - val content: MessageData, - val hasDayChange: Boolean, - val isFollowUp: Boolean, - val isSelected: Boolean, - val isExpanded: Boolean, - val isMarkerLine: Boolean, - val isEmoji: Boolean -) { - data class Tag( - val id: MsgId, - val isSelf: Boolean, - val hasDayChange: Boolean, - val isFollowUp: Boolean, - val isSelected: Boolean, - val isExpanded: Boolean, - val isMarkerLine: Boolean, - val isEmoji: Boolean - ) - - val tag = Tag( - content.messageId, - content.flag.hasFlag(Message_Flag.Self), - hasDayChange, - isFollowUp, - isSelected, - isExpanded, - isMarkerLine, - isEmoji - ) -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/ui/chat/messages/MarkerLineItemDecoration.kt b/app/src/main/java/de/kuschku/quasseldroid/ui/chat/messages/MarkerLineItemDecoration.kt deleted file mode 100644 index e5239391beb2ba66477926b200a745b993343506..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/ui/chat/messages/MarkerLineItemDecoration.kt +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.ui.chat.messages - -import android.content.Context -import android.graphics.Canvas -import android.graphics.Paint -import android.graphics.Rect -import android.view.View -import androidx.annotation.AttrRes -import androidx.annotation.DimenRes -import androidx.recyclerview.widget.RecyclerView -import de.kuschku.quasseldroid.R -import de.kuschku.quasseldroid.util.helper.styledAttributes - -class MarkerLineItemDecoration( - private val adapter: MessageAdapter, - context: Context, - @DimenRes height: Int, - @AttrRes markerlineColor: Int -) : RecyclerView.ItemDecoration() { - private val bounds = Rect() - private val height = context.resources.getDimensionPixelSize(height) - private val color = context.theme.styledAttributes(markerlineColor) { - Paint().apply { - color = getColor(0, 0) - } - } - - override fun onDrawOver(c: Canvas, parent: RecyclerView, state: RecyclerView.State) { - c.save() - val left: Int - val right: Int - if (parent.clipToPadding) { - left = parent.paddingLeft - right = parent.width - parent.paddingRight - c.clipRect(left, parent.paddingTop, right, parent.height - parent.paddingBottom) - } else { - left = 0 - right = parent.width - } - - val childCount = parent.childCount - for (i in 0 until childCount) { - val child = parent.getChildAt(i) - if (child.getTag(R.id.tag_markerline) == true) { - parent.getDecoratedBoundsWithMargins(child, bounds) - val bottom = bounds.bottom + Math.round(child.translationY) - val top = bottom - height - c.drawRect(left.toFloat(), top.toFloat(), right.toFloat(), bottom.toFloat(), color) - } - } - c.restore() - } - - override fun getItemOffsets(outRect: Rect, view: View, parent: RecyclerView, - state: RecyclerView.State) { - adapter[parent.getChildAdapterPosition(view)]?.let { - if (it.isMarkerLine) { - view.setTag(R.id.tag_markerline, true) - } else { - view.setTag(R.id.tag_markerline, false) - } - } - } -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/ui/chat/messages/MessageAdapter.kt b/app/src/main/java/de/kuschku/quasseldroid/ui/chat/messages/MessageAdapter.kt deleted file mode 100644 index 2c3110071ecf5ad060217633f0cf252c06f6441a..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/ui/chat/messages/MessageAdapter.kt +++ /dev/null @@ -1,259 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.ui.chat.messages - -import android.annotation.SuppressLint -import android.util.LruCache -import android.view.LayoutInflater -import android.view.View -import android.view.ViewGroup -import android.widget.ImageView -import android.widget.TextView -import androidx.paging.PagedListAdapter -import androidx.recyclerview.widget.DiffUtil -import androidx.recyclerview.widget.RecyclerView -import de.kuschku.libquassel.protocol.Message_Flag -import de.kuschku.libquassel.protocol.Message_Type -import de.kuschku.libquassel.util.flag.hasFlag -import de.kuschku.quasseldroid.R -import de.kuschku.quasseldroid.persistence.models.MessageData -import de.kuschku.quasseldroid.settings.MessageSettings -import de.kuschku.quasseldroid.util.helper.getOrPut -import de.kuschku.quasseldroid.util.helper.loadAvatars -import de.kuschku.quasseldroid.util.helper.visibleIf -import de.kuschku.quasseldroid.util.ui.BetterLinkMovementMethod -import de.kuschku.quasseldroid.util.ui.DoubleClickHelper -import de.kuschku.quasseldroid.viewmodel.data.FormattedMessage -import javax.inject.Inject - -class MessageAdapter @Inject constructor( - private val messageRenderer: MessageRenderer -) : PagedListAdapter<DisplayMessage, MessageAdapter.QuasselMessageViewHolder>( - object : DiffUtil.ItemCallback<DisplayMessage>() { - override fun areItemsTheSame(oldItem: DisplayMessage, newItem: DisplayMessage) = - oldItem.content.messageId == newItem.content.messageId - - override fun areContentsTheSame(oldItem: DisplayMessage, newItem: DisplayMessage) = - oldItem == newItem - }) { - private val movementMethod = BetterLinkMovementMethod.newInstance() - private var clickListener: ((FormattedMessage) -> Unit)? = null - private var longClickListener: ((FormattedMessage) -> Unit)? = null - private var doubleClickListener: ((MessageData) -> Unit)? = null - private var senderIconClickListener: ((MessageData) -> Unit)? = null - private var expansionListener: ((MessageData) -> Unit)? = null - private var urlLongClickListener: ((TextView, String) -> Boolean)? = null - - fun setOnClickListener(listener: ((FormattedMessage) -> Unit)?) { - this.clickListener = listener - } - - fun setOnLongClickListener(listener: ((FormattedMessage) -> Unit)?) { - this.longClickListener = listener - } - - fun setOnDoubleClickListener(listener: ((MessageData) -> Unit)?) { - this.doubleClickListener = listener - } - - fun setOnSenderIconClickListener(listener: ((MessageData) -> Unit)?) { - this.senderIconClickListener = listener - } - - fun setOnExpansionListener(listener: ((MessageData) -> Unit)?) { - this.expansionListener = listener - } - - fun setOnUrlLongClickListener(listener: ((TextView, String) -> Boolean)?) { - this.urlLongClickListener = listener - } - - init { - movementMethod.setOnLinkLongClickListener { textView, url -> - urlLongClickListener?.invoke(textView, url) ?: false - } - } - - private val messageCache = LruCache<DisplayMessage.Tag, FormattedMessage>(512) - - fun clearCache() { - messageCache.evictAll() - } - - override fun onBindViewHolder(holder: QuasselMessageViewHolder, position: Int) { - getItem(position)?.let { - messageRenderer.bind( - holder, - messageCache.getOrPut(it.tag) { - messageRenderer.render(holder.itemView.context, it) - }, - it.content - ) - } - } - - override fun getItemViewType(position: Int) = getItem(position)?.let { - it.content.type.value.toInt() or - (if (it.content.flag.hasFlag(Message_Flag.Highlight)) MASK_HIGHLIGHT else 0x00) or - (if (it.isFollowUp) MASK_FOLLOWUP else 0x00) or - (if (it.isEmoji) MASK_EMOJI else 0x00) or - (if (it.content.flag.hasFlag(Message_Flag.Self)) MASK_SELF else 0x00) - } ?: 0 - - override fun getItemId(position: Int): Long { - return getItem(position)?.content?.messageId?.id ?: 0L - } - - private fun messageType(viewType: Int): Message_Type? = - Message_Type.of(viewType and MASK_TYPE).enabledValues().firstOrNull() - - private fun hasHiglight(viewType: Int) = viewType and MASK_HIGHLIGHT != 0 - - private fun isFollowUp(viewType: Int) = viewType and MASK_FOLLOWUP != 0 - - private fun isEmoji(viewType: Int) = viewType and MASK_EMOJI != 0 - - private fun isSelf(viewType: Int) = viewType and MASK_SELF != 0 - - companion object { - private const val SHIFT_HIGHLIGHT = 32 - 1 - private const val SHIFT_FOLLOWUP = SHIFT_HIGHLIGHT - 1 - private const val SHIFT_EMOJI = SHIFT_FOLLOWUP - 1 - private const val SHIFT_SELF = SHIFT_EMOJI - 1 - const val MASK_HIGHLIGHT = 0x01 shl SHIFT_HIGHLIGHT - const val MASK_FOLLOWUP = 0x01 shl SHIFT_FOLLOWUP - const val MASK_EMOJI = 0x01 shl SHIFT_EMOJI - const val MASK_SELF = 0x01 shl SHIFT_SELF - const val MASK_TYPE = 0xFFFFFF - } - - override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): QuasselMessageViewHolder { - val messageType = messageType(viewType) - val hasHighlight = hasHiglight(viewType) - val isFollowUp = isFollowUp(viewType) - val isEmoji = isEmoji(viewType) - val isSelf = isSelf(viewType) - val viewHolder = QuasselMessageViewHolder( - LayoutInflater.from(parent.context).inflate( - messageRenderer.layout(messageType, hasHighlight, isFollowUp, isEmoji, isSelf), - parent, - false - ), - clickListener, - longClickListener, - doubleClickListener, - senderIconClickListener, - expansionListener, - movementMethod - ) - messageRenderer.init(viewHolder, messageType, hasHighlight, isFollowUp, isEmoji, isSelf) - return viewHolder - } - - operator fun get(position: Int) = if (position in 0 until itemCount) { - getItem(position) - } else { - null - } - - @SuppressLint("ClickableViewAccessibility") - class QuasselMessageViewHolder( - itemView: View, - clickListener: ((FormattedMessage) -> Unit)? = null, - longClickListener: ((FormattedMessage) -> Unit)? = null, - doubleClickListener: ((MessageData) -> Unit)? = null, - senderIconClickListener: ((MessageData) -> Unit)? = null, - expansionListener: ((MessageData) -> Unit)? = null, - movementMethod: BetterLinkMovementMethod - ) : RecyclerView.ViewHolder(itemView) { - val daychangeContainer: View? = itemView.findViewById(R.id.daychange_container) - val daychange: TextView? = itemView.findViewById(R.id.daychange) - val messageContainer: View? = itemView.findViewById(R.id.message_container) - val timeLeft: TextView? = itemView.findViewById(R.id.time_left) - val timeRight: TextView? = itemView.findViewById(R.id.time_right) - val avatar: ImageView? = itemView.findViewById(R.id.avatar) - val name: TextView? = itemView.findViewById(R.id.name) - val realname: TextView? = itemView.findViewById(R.id.realname) - val content: TextView? = itemView.findViewById(R.id.content) - val combined: TextView? = itemView.findViewById(R.id.combined) - - private var message: FormattedMessage? = null - private var original: MessageData? = null - - private val localClickListener = View.OnClickListener { - message?.let { - clickListener?.invoke(it) - } - } - - private val localLongClickListener = View.OnLongClickListener { - message?.let { - longClickListener?.invoke(it) - } - true - } - - private val localDoubleClickListener: () -> Unit = { - original?.let { - doubleClickListener?.invoke(it) - } - } - - private val localSenderIconClickListener = View.OnClickListener { - original?.let { - senderIconClickListener?.invoke(it) - } - } - - init { - content?.movementMethod = movementMethod - combined?.movementMethod = movementMethod - - messageContainer?.setOnClickListener(localClickListener) - messageContainer?.setOnLongClickListener(localLongClickListener) - messageContainer?.setOnTouchListener(DoubleClickHelper(itemView).apply { - this.doubleClickListener = localDoubleClickListener - }) - avatar?.setOnClickListener(localSenderIconClickListener) - } - - fun bind(message: FormattedMessage, original: MessageData, - hasDayChange: Boolean, messageSettings: MessageSettings) { - this.message = message - this.original = original - - timeLeft?.text = message.time - timeRight?.text = message.time - name?.text = message.name - realname?.text = message.realName - content?.text = message.content - combined?.text = message.combined - - this.messageContainer?.isSelected = message.isSelected - - if (hasDayChange) daychange?.text = message.dayChange - daychangeContainer?.visibleIf(hasDayChange) - - avatar?.loadAvatars(message.avatarUrls, - message.fallbackDrawable, - crop = !messageSettings.squareAvatars) - } - } -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/ui/chat/messages/MessageListFragment.kt b/app/src/main/java/de/kuschku/quasseldroid/ui/chat/messages/MessageListFragment.kt deleted file mode 100644 index b9edc9f20278f415ba9e82804c0850cd9727c2e7..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/ui/chat/messages/MessageListFragment.kt +++ /dev/null @@ -1,704 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.ui.chat.messages - -import android.content.ClipData -import android.content.ClipboardManager -import android.content.Context -import android.content.Intent -import android.os.Bundle -import android.text.SpannableStringBuilder -import android.util.TypedValue -import android.view.* -import androidx.lifecycle.Observer -import androidx.paging.LivePagedListBuilder -import androidx.paging.PagedList -import androidx.recyclerview.widget.LinearLayoutManager -import androidx.recyclerview.widget.RecyclerView -import androidx.swiperefreshlayout.widget.SwipeRefreshLayout -import butterknife.BindView -import butterknife.ButterKnife -import com.bumptech.glide.Glide -import com.bumptech.glide.ListPreloader -import com.bumptech.glide.integration.recyclerview.RecyclerViewPreloader -import com.bumptech.glide.util.FixedPreloadSizeProvider -import com.google.android.material.floatingactionbutton.FloatingActionButton -import de.kuschku.libquassel.connection.ConnectionState -import de.kuschku.libquassel.protocol.* -import de.kuschku.libquassel.quassel.BufferInfo -import de.kuschku.libquassel.quassel.ExtendedFeature -import de.kuschku.libquassel.quassel.syncables.BufferSyncer -import de.kuschku.libquassel.session.SessionManager -import de.kuschku.libquassel.util.compatibility.LoggingHandler.Companion.log -import de.kuschku.libquassel.util.compatibility.LoggingHandler.LogLevel.DEBUG -import de.kuschku.libquassel.util.flag.hasFlag -import de.kuschku.libquassel.util.helper.* -import de.kuschku.libquassel.util.irc.HostmaskHelper -import de.kuschku.quasseldroid.GlideApp -import de.kuschku.quasseldroid.R -import de.kuschku.quasseldroid.persistence.dao.* -import de.kuschku.quasseldroid.persistence.db.AccountDatabase -import de.kuschku.quasseldroid.persistence.db.QuasselDatabase -import de.kuschku.quasseldroid.persistence.models.MessageData -import de.kuschku.quasseldroid.service.BacklogRequester -import de.kuschku.quasseldroid.settings.* -import de.kuschku.quasseldroid.ui.chat.ChatActivity -import de.kuschku.quasseldroid.ui.info.user.UserInfoActivity -import de.kuschku.quasseldroid.util.Patterns -import de.kuschku.quasseldroid.util.avatars.AvatarHelper -import de.kuschku.quasseldroid.util.helper.* -import de.kuschku.quasseldroid.util.service.ServiceBoundFragment -import de.kuschku.quasseldroid.util.ui.LinkLongClickMenuHelper -import de.kuschku.quasseldroid.util.ui.SpanFormatter -import de.kuschku.quasseldroid.viewmodel.ChatViewModel -import de.kuschku.quasseldroid.viewmodel.data.Avatar -import de.kuschku.quasseldroid.viewmodel.helper.ChatViewModelHelper -import org.threeten.bp.ZoneId -import org.threeten.bp.ZonedDateTime -import org.threeten.bp.temporal.ChronoUnit -import javax.inject.Inject -import kotlin.math.roundToInt - -class MessageListFragment : ServiceBoundFragment() { - @BindView(R.id.messages) - lateinit var messageList: RecyclerView - - @BindView(R.id.scrollUp) - lateinit var scrollUp: FloatingActionButton - - @BindView(R.id.scrollDown) - lateinit var scrollDown: FloatingActionButton - - @BindView(R.id.swipeRefreshLayout) - lateinit var swipeRefreshLayout: SwipeRefreshLayout - - @Inject - lateinit var appearanceSettings: AppearanceSettings - - @Inject - lateinit var autoCompleteSettings: AutoCompleteSettings - - @Inject - lateinit var backlogSettings: BacklogSettings - - @Inject - lateinit var messageSettings: MessageSettings - - @Inject - lateinit var redirectionSettings: RedirectionSettings - - @Inject - lateinit var database: QuasselDatabase - - @Inject - lateinit var accountDatabase: AccountDatabase - - @Inject - lateinit var adapter: MessageAdapter - - @Inject - lateinit var chatViewModel: ChatViewModel - - @Inject - lateinit var modelHelper: ChatViewModelHelper - - private lateinit var linearLayoutManager: LinearLayoutManager - - private lateinit var backlogRequester: BacklogRequester - - private var lastBuffer: BufferId? = null - private var previousMessageId: MsgId? = null - private var previousLoadKey: MsgId_Type? = null - private var reverse: Boolean = false - - private var actionMode: ActionMode? = null - - private val actionModeCallback = object : ActionMode.Callback { - override fun onActionItemClicked(mode: ActionMode?, item: MenuItem?) = when (item?.itemId) { - R.id.action_user_info -> { - modelHelper.chat.selectedMessages.safeValue?.values?.firstOrNull()?.let { msg -> - modelHelper.connectedSession.value?.orNull()?.bufferSyncer?.let { bufferSyncer -> - modelHelper.bufferData.value?.info?.let(BufferInfo::networkId)?.let { networkId -> - UserInfoActivity.launch( - requireContext(), - openBuffer = false, - bufferId = bufferSyncer.find( - bufferName = HostmaskHelper.nick(msg.original.sender), - networkId = networkId, - type = Buffer_Type.of(Buffer_Type.QueryBuffer) - )?.let(BufferInfo::bufferId), - nick = HostmaskHelper.nick(msg.original.sender), - networkId = networkId - ) - } - } - - true - } ?: false - } - R.id.action_copy -> { - val builder = SpannableStringBuilder() - modelHelper.chat.selectedMessages.safeValue?.values.orEmpty().asSequence().sortedBy { - it.original.messageId - }.map { - if (it.name != null && it.content != null) { - SpanFormatter.format(getString(R.string.message_format_copy_complex), - it.time, - it.name, - it.content) - } else { - SpanFormatter.format(getString(R.string.message_format_copy), it.time, it.combined) - } - }.forEach { - builder.append(it) - builder.append("\n") - } - - val data = if (builder.endsWith('\n')) - builder.subSequence(0, builder.length - 1) - else - builder - - val clipboard = requireContext().getSystemService(Context.CLIPBOARD_SERVICE) as ClipboardManager - clipboard.setPrimaryClip(ClipData.newPlainText(null, data)) - actionMode?.finish() - true - } - R.id.action_share -> { - val builder = SpannableStringBuilder() - modelHelper.chat.selectedMessages.safeValue?.values.orEmpty().asSequence().sortedBy { - it.original.messageId - }.map { - if (it.name != null && it.content != null) { - SpanFormatter.format(getString(R.string.message_format_copy_complex), - it.time, - it.name, - it.content) - } else { - SpanFormatter.format(getString(R.string.message_format_copy), it.time, it.combined) - } - }.forEach { - builder.append(it) - builder.append("\n") - } - - val data = if (builder.endsWith('\n')) - builder.subSequence(0, builder.length - 1) - else - builder - - val intent = Intent(Intent.ACTION_SEND) - intent.type = "text/plain" - intent.putExtra(Intent.EXTRA_TEXT, data) - requireContext().startActivity( - Intent.createChooser( - intent, - requireContext().getString(R.string.label_share) - ) - ) - actionMode?.finish() - true - } - else -> false - } - - override fun onCreateActionMode(mode: ActionMode?, menu: Menu?): Boolean { - actionMode = mode - mode?.menuInflater?.inflate(R.menu.context_messages, menu) - return true - } - - override fun onPrepareActionMode(mode: ActionMode?, menu: Menu?): Boolean { - mode?.tag = "MESSAGES" - return true - } - - override fun onDestroyActionMode(mode: ActionMode?) { - actionMode = null - modelHelper.chat.selectedMessages.onNext(emptyMap()) - } - } - - private val boundaryCallback = object : PagedList.BoundaryCallback<DisplayMessage>() { - override fun onItemAtFrontLoaded(itemAtFront: DisplayMessage) { - if (modelHelper.coreFeatures.value?.second?.hasFeature(ExtendedFeature.LoadBacklogForwards) == true) { - val id = itemAtFront.tag.id - log(DEBUG, "MessageListFragment", "onItemAtFrontLoaded: $id") - loadMore(reverse = true, lastMessageId = id) - } - } - override fun onItemAtEndLoaded(itemAtEnd: DisplayMessage) { - val id = itemAtEnd.tag.id - log(DEBUG, "MessageListFragment", "onItemAtEndLoaded: $id") - loadMore(reverse = false, lastMessageId = id) - } - } - - override fun onCreateView( - inflater: LayoutInflater, container: ViewGroup?, - savedInstanceState: Bundle? - ): View? { - val view = inflater.inflate(R.layout.chat_messages, container, false) - ButterKnife.bind(this, view) - - linearLayoutManager = LinearLayoutManager(context) - linearLayoutManager.reverseLayout = true - - backlogRequester = BacklogRequester(modelHelper.connectedSession, database, accountDatabase) - - adapter.setOnClickListener { msg -> - if (actionMode != null) { - when (modelHelper.chat.selectedMessagesToggle(msg.original.messageId, msg)) { - 0 -> actionMode?.finish() - 1 -> actionMode?.menu?.findItem(R.id.action_user_info)?.isVisible = true - else -> actionMode?.menu?.findItem(R.id.action_user_info)?.isVisible = false - } - } else if (msg.hasSpoilers) { - val value = modelHelper.chat.expandedMessages.safeValue - modelHelper.chat.expandedMessages.onNext( - if (value.contains(msg.original.messageId)) value - msg.original.messageId - else value + msg.original.messageId - ) - } - } - adapter.setOnLongClickListener { msg -> - if (actionMode == null) { - activity?.startActionMode(actionModeCallback) - } - when (modelHelper.chat.selectedMessagesToggle(msg.original.messageId, msg)) { - 0 -> actionMode?.finish() - 1 -> actionMode?.menu?.findItem(R.id.action_user_info)?.isVisible = true - else -> actionMode?.menu?.findItem(R.id.action_user_info)?.isVisible = false - } - } - if (autoCompleteSettings.senderDoubleClick) - adapter.setOnDoubleClickListener { msg -> - ChatActivity.launch( - requireContext(), - autoCompleteText = HostmaskHelper.nick(msg.sender), - autoCompleteSuffix = ": " - ) - } - adapter.setOnSenderIconClickListener { msg -> - modelHelper.connectedSession.value?.orNull()?.bufferSyncer?.let { bufferSyncer -> - modelHelper.bufferData.value?.info?.let(BufferInfo::networkId)?.let { networkId -> - UserInfoActivity.launch( - requireContext(), - openBuffer = false, - bufferId = bufferSyncer.find( - bufferName = HostmaskHelper.nick(msg.sender), - networkId = networkId, - type = Buffer_Type.of(Buffer_Type.QueryBuffer) - )?.let(BufferInfo::bufferId), - nick = HostmaskHelper.nick(msg.sender), - networkId = networkId - ) - } - } - } - adapter.setOnUrlLongClickListener(LinkLongClickMenuHelper()) - - messageList.adapter = adapter - messageList.layoutManager = linearLayoutManager - messageList.itemAnimator = null - - val senderColors = requireContext().theme.styledAttributes( - R.attr.senderColor0, R.attr.senderColor1, R.attr.senderColor2, R.attr.senderColor3, - R.attr.senderColor4, R.attr.senderColor5, R.attr.senderColor6, R.attr.senderColor7, - R.attr.senderColor8, R.attr.senderColor9, R.attr.senderColorA, R.attr.senderColorB, - R.attr.senderColorC, R.attr.senderColorD, R.attr.senderColorE, R.attr.senderColorF - ) { - IntArray(length()) { - getColor(it, 0) - } - } - - swipeRefreshLayout.setColorSchemeColors(*senderColors) - swipeRefreshLayout.setOnRefreshListener { - loadMore() - } - - var isScrolling = false - messageList.addOnScrollListener(object : RecyclerView.OnScrollListener() { - override fun onScrolled(recyclerView: RecyclerView, dx: Int, dy: Int) { - val canScrollDown = recyclerView.canScrollVertically(1) - val isScrollingDown = dy > 0 - - scrollDown.toggle(canScrollDown && isScrollingDown) - - val canScrollUp = recyclerView.canScrollVertically(-1) - val isScrollingUp = dy < 0 - val canJumpTo = modelHelper.coreFeatures.value?.second?.hasFeature(ExtendedFeature.LoadBacklogForwards) == true - - scrollUp.toggle(canJumpTo && canScrollUp && isScrollingUp) - } - - override fun onScrollStateChanged(recyclerView: RecyclerView, newState: Int) { - isScrolling = when (newState) { - RecyclerView.SCROLL_STATE_SETTLING, RecyclerView.SCROLL_STATE_IDLE -> false - RecyclerView.SCROLL_STATE_DRAGGING -> true - else -> isScrolling - } - } - }) - - fun processMessages(list: List<MessageData>, selected: Set<MsgId>, - expanded: Set<MsgId>, markerLine: MsgId?): List<DisplayMessage> { - var previous: MessageData? = null - var previousDate: ZonedDateTime? = null - return list.mapReverse { - val date = it.time.atZone(ZoneId.systemDefault()).truncatedTo(ChronoUnit.DAYS) - val isSameDay = previousDate?.isEqual(date) ?: false - val isFollowUp = previous?.sender == it.sender && previous?.type == it.type && isSameDay - previous = it - previousDate = date - DisplayMessage( - content = it, - hasDayChange = !isSameDay, - isFollowUp = isFollowUp, - isSelected = selected.contains(it.messageId), - isExpanded = expanded.contains(it.messageId), - isMarkerLine = markerLine == it.messageId, - // Do not run the emoji regex if not necessary, this saves quite a bit of performance - isEmoji = it.type.hasFlag(Message_Type.Plain) && - it.content.isNotBlank() && - messageSettings.largerEmoji && Patterns.EMOJI.matches(it.content) - ) - } - } - - val data = combineLatest(modelHelper.bufferSyncer, - modelHelper.chat.bufferId, - modelHelper.chat.selectedMessages, - modelHelper.chat.expandedMessages, - modelHelper.markerLine) - .toLiveData().switchMapNotNull { (bufferSyncer, buffer, selected, expanded, markerLine) -> - val network = bufferSyncer.orNull()?.bufferInfo(buffer)?.networkId ?: NetworkId(0) - val serverBuffer = bufferSyncer.orNull()?.find( - networkId = network, - type = Buffer_Type.of(Buffer_Type.StatusBuffer) - )?.bufferId ?: BufferId(0) - - accountDatabase.accounts().listen(accountId).safeSwitchMap { - database.filtered().listen(accountId, - buffer, - it.defaultFiltered).switchMapNotNull { filtered -> - LivePagedListBuilder( - database.message().findByBufferIdPaged(network, - serverBuffer, - buffer, - filtered, - redirectionSettings.userNotices, - redirectionSettings.serverNotices, - redirectionSettings.errors).mapByPage { - processMessages(it, selected.keys, expanded, markerLine.orNull()) - }, - PagedList.Config.Builder() - .setPageSize(backlogSettings.pageSize) - .setPrefetchDistance(backlogSettings.pageSize) - .setInitialLoadSizeHint(backlogSettings.pageSize) - .setEnablePlaceholders(true) - .build() - ).setBoundaryCallback(boundaryCallback) - .setInitialLoadKey(previousLoadKey?.toInt()) - .build() - } - } - } - - val lastMessageId = modelHelper.chat.bufferId.toLiveData().switchMapNotNull { - database.message().lastMsgId(it) - } - - modelHelper.chat.bufferId.toLiveData().observe(viewLifecycleOwner, Observer { bufferId -> - swipeRefreshLayout.isEnabled = (bufferId != null || bufferId?.isValidId() == true) - }) - - combineLatest(modelHelper.bufferSyncer, - modelHelper.sessionManager.mapSwitchMap(SessionManager::state).distinctUntilChanged()) - .toLiveData().observe(viewLifecycleOwner, Observer { (bufferSyncer, state) -> - if (state?.orNull() == ConnectionState.CONNECTED) { - runInBackgroundDelayed(16) { - modelHelper.chat.bufferId { bufferId -> - val currentNetwork = bufferSyncer.orNull()?.bufferInfo(bufferId)?.networkId - ?: NetworkId(0) - val currentServerBuffer = bufferSyncer.orNull()?.find( - networkId = currentNetwork, - type = Buffer_Type.of(Buffer_Type.StatusBuffer) - )?.bufferId ?: BufferId(0) - - val filtered = database.filtered().get(accountId, - bufferId, - accountDatabase.accounts().findById(accountId)?.defaultFiltered - ?: 0) - // Try loading messages when switching to isEmpty bufferId - val hasVisibleMessages = database.message().hasVisibleMessages(currentNetwork, - currentServerBuffer, - bufferId, - filtered, - redirectionSettings.userNotices, - redirectionSettings.serverNotices, - redirectionSettings.errors) - if (!hasVisibleMessages) { - if (bufferId.isValidId() && bufferId != BufferId.MAX_VALUE) { - loadMore(initial = true) - } - } - } - } - } - }) - - modelHelper.connectedSession.toLiveData().zip(lastMessageId).observe( - viewLifecycleOwner, Observer { - runInBackground { - val session = it?.first?.orNull() - val message = it?.second - val bufferSyncer = session?.bufferSyncer - if (message != null && bufferSyncer != null && previousMessageId != message.messageId) { - markAsRead(bufferSyncer, message.bufferId, message.messageId) - previousMessageId = message.messageId - } - } - }) - - var hasLoaded = false - fun checkScroll() { - if (hasLoaded) { - if (!reverse && linearLayoutManager.findFirstVisibleItemPosition() < 2 && !isScrolling) { - messageList.scrollToPosition(0) - } - } else { - savedInstanceState?.apply { - (messageList.layoutManager as RecyclerView.LayoutManager).onRestoreInstanceState( - getParcelable(KEY_STATE_LIST)) - } - hasLoaded = true - } - } - - adapter.registerAdapterDataObserver(object : RecyclerView.AdapterDataObserver() { - override fun onChanged() = checkScroll() - override fun onItemRangeInserted(positionStart: Int, itemCount: Int) = checkScroll() - }) - - scrollDown.hide(object : FloatingActionButton.OnVisibilityChangedListener() { - override fun onHidden(fab: FloatingActionButton) { - (fab as View).visibility = View.VISIBLE - } - }) - scrollDown.setOnClickListener { - jumpTo(false) - } - scrollUp.setOnClickListener { - if (modelHelper.coreFeatures.value?.second?.hasFeature(ExtendedFeature.LoadBacklogForwards) == true) { - jumpTo(true) - } - } - - val avatarSize = TypedValue.applyDimension( - TypedValue.COMPLEX_UNIT_SP, - messageSettings.textSize * 2.5f, - requireContext().resources.displayMetrics - ).roundToInt() - - val sizeProvider = FixedPreloadSizeProvider<List<Avatar>>(avatarSize, avatarSize) - - val preloadModelProvider = object : ListPreloader.PreloadModelProvider<List<Avatar>> { - override fun getPreloadItems(position: Int) = listOfNotNull( - adapter[position]?.content?.let { AvatarHelper.avatar(messageSettings, it, avatarSize) } - ) - - override fun getPreloadRequestBuilder(item: List<Avatar>) = - GlideApp.with(this@MessageListFragment).loadWithFallbacks(item)?.override(avatarSize) - } - - val preloader = RecyclerViewPreloader(Glide.with(this), preloadModelProvider, sizeProvider, 10) - - messageList.addOnScrollListener(preloader) - messageList.addItemDecoration(MarkerLineItemDecoration( - adapter, requireContext(), R.dimen.markerline_height, R.attr.colorMarkerLine - )) - - savedInstanceState?.run { - (messageList.layoutManager as RecyclerView.LayoutManager).onRestoreInstanceState(getParcelable( - KEY_STATE_LIST)) - previousLoadKey = getLong(KEY_STATE_PAGING).nullIf { it == -1L } - lastBuffer = BufferId(getInt(KEY_STATE_BUFFER)).nullIf { !it.isValidId() } - } - - data.observe(viewLifecycleOwner, Observer { list -> - previousLoadKey = (list?.lastKey as? Int)?.toLong() - val firstVisibleItemPosition = linearLayoutManager.findFirstVisibleItemPosition() - val firstVisibleMessageId = adapter[firstVisibleItemPosition]?.content?.messageId - runInBackground { - activity?.runOnUiThread { - list?.let(adapter::submitList) - } - - val buffer = modelHelper.chat.bufferId.safeValue - ?: BufferId(-1) - val network = modelHelper.bufferSyncer.value?.orNull()?.bufferInfo(buffer)?.networkId - ?: NetworkId(0) - val serverBuffer = modelHelper.bufferSyncer.value?.orNull()?.find( - networkId = network, - type = Buffer_Type.of(Buffer_Type.StatusBuffer) - )?.bufferId ?: BufferId(0) - if (buffer != lastBuffer) { - reverse = false - adapter.clearCache() - modelHelper.connectedSession.value?.orNull()?.bufferSyncer?.let { bufferSyncer -> - onBufferChange(lastBuffer, - network, - buffer, - serverBuffer, - firstVisibleMessageId, - bufferSyncer) - } - modelHelper.backend.value?.orNull()?.setCurrentBuffer(buffer) - lastBuffer = buffer - } - } - }) - - return view - } - - private fun jumpTo(start: Boolean) { - reverse = start - runInBackground { - modelHelper.chat.bufferId { bufferId -> - //if (database.message().find(msg.id) == null) { - database.message().clearMessages(bufferId.id) - //} - if (start) { - loadMore(initial = true, reverse = true, lastMessageId = MsgId(0L)) - } else { - loadMore(initial = true, reverse = false, lastMessageId = MsgId(-1L)) - } - } - } - } - - override fun onSaveInstanceState(outState: Bundle) { - super.onSaveInstanceState(outState) - outState.putParcelable(KEY_STATE_LIST, messageList.layoutManager?.onSaveInstanceState()) - outState.putLong(KEY_STATE_PAGING, previousLoadKey ?: -1L) - outState.putInt(KEY_STATE_BUFFER, lastBuffer?.id ?: -1) - } - - private fun markAsRead(bufferSyncer: BufferSyncer, buffer: BufferId, lastMessageId: MsgId?) { - bufferSyncer.requestMarkBufferAsRead(buffer) - if (lastMessageId != null) - bufferSyncer.requestSetLastSeenMsg(buffer, lastMessageId) - } - - private fun onBufferChange( - previous: BufferId?, - currentNetwork: NetworkId, - current: BufferId, - currentServerBuffer: BufferId, - lastMessageId: MsgId?, - bufferSyncer: BufferSyncer - ) { - if (previous != null && lastMessageId != null) { - bufferSyncer.requestSetMarkerLine(previous, lastMessageId) - } - // Try loading messages when switching to isEmpty bufferId - val filtered = database.filtered().get(accountId, - current, - accountDatabase.accounts().findById(accountId)?.defaultFiltered - ?: 0) - val hasVisibleMessages = database.message().hasVisibleMessages(currentNetwork, - currentServerBuffer, - current, - filtered, - redirectionSettings.userNotices, - redirectionSettings.serverNotices, - redirectionSettings.errors) - if (!hasVisibleMessages) { - if (current.isValidId() && current != BufferId.MAX_VALUE) { - loadMore(initial = true) - } - } - activity?.runOnUiThread { messageList.scrollToPosition(0) } - } - - override fun onPause() { - val previous = lastBuffer - val firstVisibleItemPosition = linearLayoutManager.findFirstVisibleItemPosition() - val messageId = adapter[firstVisibleItemPosition]?.content?.messageId - val bufferSyncer = modelHelper.connectedSession.value?.orNull()?.bufferSyncer - if (previous != null && messageId != null) { - bufferSyncer?.requestSetMarkerLine(previous, messageId) - } - super.onPause() - } - - private fun loadMore(initial: Boolean = false, lastMessageId: MsgId? = null, reverse: Boolean = this.reverse) { - // This can be called *after* we’re already detached from the activity - activity?.runOnUiThread { - modelHelper.chat.bufferId { bufferId -> - if (bufferId.isValidId() && bufferId != BufferId.MAX_VALUE) { - if (initial) swipeRefreshLayout.isRefreshing = true - runInBackground { - if (reverse && modelHelper.coreFeatures.value?.second?.hasFeature(ExtendedFeature.LoadBacklogForwards) == true) { - backlogRequester.loadMoreAfter( - accountId = accountId, - buffer = bufferId, - amount = if (initial) backlogSettings.initialAmount else backlogSettings.pageSize, - pageSize = backlogSettings.pageSize, - lastMessageId = lastMessageId - ?: database.message().findLastByBufferId(bufferId)?.messageId - ?: MsgId(0), - untilAllVisible = initial - ) { - activity?.runOnUiThread { - swipeRefreshLayout.isRefreshing = false - } - } - } else { - backlogRequester.loadMoreBefore( - accountId = accountId, - buffer = bufferId, - amount = if (initial) backlogSettings.initialAmount else backlogSettings.pageSize, - pageSize = backlogSettings.pageSize, - lastMessageId = lastMessageId - ?: database.message().findFirstByBufferId(bufferId)?.messageId - ?: MsgId(-1), - untilAllVisible = initial - ) { - activity?.runOnUiThread { - swipeRefreshLayout.isRefreshing = false - } - } - } - } - } - } - } - } - - companion object { - private const val KEY_STATE_LIST = "KEY_STATE_LIST" - private const val KEY_STATE_PAGING = "KEY_STATE_PAGING" - private const val KEY_STATE_BUFFER = "KEY_STATE_BUFFER" - } -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/ui/chat/messages/MessageRenderer.kt b/app/src/main/java/de/kuschku/quasseldroid/ui/chat/messages/MessageRenderer.kt deleted file mode 100644 index 135a866e03c74b83167c0a2d5cd70a70b8b73f94..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/ui/chat/messages/MessageRenderer.kt +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.ui.chat.messages - -import android.content.Context -import androidx.annotation.LayoutRes -import de.kuschku.libquassel.protocol.Message_Type -import de.kuschku.quasseldroid.persistence.models.MessageData -import de.kuschku.quasseldroid.viewmodel.data.FormattedMessage - -interface MessageRenderer { - @LayoutRes - fun layout(type: Message_Type?, - hasHighlight: Boolean, - isFollowUp: Boolean, - isEmoji: Boolean, - isSelf: Boolean): Int - - fun bind(holder: MessageAdapter.QuasselMessageViewHolder, message: FormattedMessage, - original: MessageData) - - fun render(context: Context, message: DisplayMessage): FormattedMessage - - fun init(viewHolder: MessageAdapter.QuasselMessageViewHolder, - messageType: Message_Type?, - hasHighlight: Boolean, - isFollowUp: Boolean, - isEmoji: Boolean, - isSelf: Boolean) = Unit -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/ui/chat/messages/QuasselMessageRenderer.kt b/app/src/main/java/de/kuschku/quasseldroid/ui/chat/messages/QuasselMessageRenderer.kt deleted file mode 100644 index d81999035b6ae1c63fbcf0028c98a25a70bb179e..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/ui/chat/messages/QuasselMessageRenderer.kt +++ /dev/null @@ -1,769 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.ui.chat.messages - -import android.content.Context -import android.graphics.Typeface -import android.graphics.drawable.ColorDrawable -import android.graphics.drawable.LayerDrawable -import android.text.SpannableStringBuilder -import android.util.TypedValue -import android.view.Gravity -import android.view.View -import android.widget.FrameLayout -import android.widget.LinearLayout -import de.kuschku.libquassel.protocol.Message.MessageType.* -import de.kuschku.libquassel.protocol.Message_Flag -import de.kuschku.libquassel.protocol.Message_Type -import de.kuschku.libquassel.util.flag.hasFlag -import de.kuschku.libquassel.util.irc.HostmaskHelper -import de.kuschku.libquassel.util.irc.SenderColorUtil -import de.kuschku.quasseldroid.R -import de.kuschku.quasseldroid.persistence.models.MessageData -import de.kuschku.quasseldroid.settings.MessageSettings -import de.kuschku.quasseldroid.util.ColorContext -import de.kuschku.quasseldroid.util.avatars.AvatarHelper -import de.kuschku.quasseldroid.util.helper.styledAttributes -import de.kuschku.quasseldroid.util.helper.visibleIf -import de.kuschku.quasseldroid.util.irc.format.ContentFormatter -import de.kuschku.quasseldroid.util.irc.format.IrcFormatDeserializer -import de.kuschku.quasseldroid.util.ui.SpanFormatter -import de.kuschku.quasseldroid.viewmodel.data.FormattedMessage -import de.kuschku.quasseldroid.viewmodel.helper.EditorViewModelHelper.Companion.IGNORED_CHARS -import org.threeten.bp.ZoneId -import org.threeten.bp.format.DateTimeFormatter -import org.threeten.bp.format.FormatStyle -import org.threeten.bp.temporal.ChronoUnit -import javax.inject.Inject -import kotlin.math.roundToInt - -class QuasselMessageRenderer @Inject constructor( - context: Context, - private val messageSettings: MessageSettings, - private val contentFormatter: ContentFormatter, - private val ircFormatDeserializer: IrcFormatDeserializer -) : MessageRenderer { - private val timeFormatter = DateTimeFormatter.ofPattern( - timePattern(messageSettings.showSeconds, messageSettings.use24hClock) - ) - - private val dateFormatter = DateTimeFormatter.ofLocalizedDate(FormatStyle.MEDIUM) - - private val monospaceItalic = Typeface.create(Typeface.MONOSPACE, Typeface.ITALIC) - - private fun timePattern(showSeconds: Boolean, use24hClock: Boolean) = when { - !use24hClock and showSeconds -> "hh:mm:ss a" - !use24hClock and !showSeconds -> "hh:mm a" - - use24hClock and showSeconds -> "HH:mm:ss" - else -> "HH:mm" - } - - private val senderColors: IntArray = context.theme.styledAttributes( - R.attr.senderColor0, R.attr.senderColor1, R.attr.senderColor2, R.attr.senderColor3, - R.attr.senderColor4, R.attr.senderColor5, R.attr.senderColor6, R.attr.senderColor7, - R.attr.senderColor8, R.attr.senderColor9, R.attr.senderColorA, R.attr.senderColorB, - R.attr.senderColorC, R.attr.senderColorD, R.attr.senderColorE, R.attr.senderColorF - ) { - IntArray(16) { - getColor(it, 0) - } - } - - private val monochromeHighlights = context.theme.styledAttributes( - R.attr.colorForegroundHighlightMonochrome - ) { - getBoolean(0, false) - } - - private val selfColor: Int = context.theme.styledAttributes(R.attr.colorForegroundSecondary) { - getColor(0, 0) - } - - private val colorContext = ColorContext(context, messageSettings) - - private val zoneId = ZoneId.systemDefault() - - override fun layout(type: Message_Type?, - hasHighlight: Boolean, - isFollowUp: Boolean, - isEmoji: Boolean, - isSelf: Boolean) = when (type) { - Notice -> R.layout.widget_chatmessage_notice - Server -> R.layout.widget_chatmessage_server - Error -> R.layout.widget_chatmessage_error - Action -> R.layout.widget_chatmessage_action - Plain -> R.layout.widget_chatmessage_plain - Nick, Mode, Join, Part, Quit, Kick, Kill, Info, Topic, NetsplitJoin, NetsplitQuit, - Invite -> R.layout.widget_chatmessage_info - DayChange -> R.layout.widget_chatmessage_daychange - else -> R.layout.widget_chatmessage_placeholder - } - - override fun init(viewHolder: MessageAdapter.QuasselMessageViewHolder, - messageType: Message_Type?, - hasHighlight: Boolean, - isFollowUp: Boolean, - isEmoji: Boolean, - isSelf: Boolean) { - if (hasHighlight) { - viewHolder.itemView.context.theme.styledAttributes( - R.attr.colorForegroundHighlight, R.attr.colorForegroundHighlightSecondary, - R.attr.colorBackgroundHighlight, R.attr.backgroundMenuItem - ) { - viewHolder.timeLeft?.setTextColor(getColor(1, 0)) - viewHolder.timeRight?.setTextColor(getColor(1, 0)) - viewHolder.name?.setTextColor(getColor(1, 0)) - viewHolder.realname?.setTextColor(getColor(1, 0)) - viewHolder.combined?.setTextColor(getColor(0, 0)) - viewHolder.content?.setTextColor(getColor(0, 0)) - viewHolder.messageContainer?.background = LayerDrawable( - arrayOf( - ColorDrawable(getColor(2, 0)), - getDrawable(3) - ) - ) - } - } - - - if (isSelf && messageSettings.highlightOwnMessages) { - viewHolder.itemView.context.theme.styledAttributes( - R.attr.colorBackgroundSecondary, - R.attr.backgroundMenuItem - ) { - viewHolder.messageContainer?.background = LayerDrawable( - arrayOf( - ColorDrawable(getColor(0, 0)), - getDrawable(1) - ) - ) - } - } - - val avatarContainer = viewHolder.itemView.findViewById<View>(R.id.avatar_container) - val avatarPlaceholder = viewHolder.itemView.findViewById<View>(R.id.avatar_placeholder) - - if (messageSettings.useMonospace) { - viewHolder.content?.typeface = if (viewHolder.content?.typeface?.isItalic == true) monospaceItalic else Typeface.MONOSPACE - viewHolder.combined?.typeface = if (viewHolder.combined?.typeface?.isItalic == true) monospaceItalic else Typeface.MONOSPACE - } - - viewHolder.avatar?.visibleIf(!isFollowUp) - avatarContainer?.visibleIf(messageSettings.showAvatars && messageSettings.nicksOnNewLine) - avatarPlaceholder?.visibleIf(messageSettings.showAvatars && messageSettings.nicksOnNewLine) - val separateLine = viewHolder.content != null && viewHolder.name != null && messageSettings.nicksOnNewLine - viewHolder.name?.visibleIf(separateLine && !isFollowUp) - viewHolder.realname?.visibleIf(separateLine && !isFollowUp && messageSettings.showRealNames && messageSettings.nicksOnNewLine) - viewHolder.content?.visibleIf(separateLine) - viewHolder.combined?.visibleIf(!separateLine) - - viewHolder.timeLeft?.visibleIf(!messageSettings.timeAtEnd) - viewHolder.timeRight?.visibleIf(messageSettings.timeAtEnd) - - val textSize = messageSettings.textSize.toFloat() - viewHolder.timeLeft?.setTextSize(TypedValue.COMPLEX_UNIT_SP, textSize) - viewHolder.timeRight?.setTextSize(TypedValue.COMPLEX_UNIT_SP, textSize * 0.9f) - viewHolder.name?.setTextSize(TypedValue.COMPLEX_UNIT_SP, textSize) - viewHolder.realname?.setTextSize(TypedValue.COMPLEX_UNIT_SP, textSize) - val contentSize = if (messageSettings.nicksOnNewLine && messageSettings.largerEmoji && isEmoji) textSize * 2f else textSize - viewHolder.content?.setTextSize(TypedValue.COMPLEX_UNIT_SP, contentSize) - viewHolder.combined?.setTextSize(TypedValue.COMPLEX_UNIT_SP, contentSize) - val avatarContainerSize = TypedValue.applyDimension( - TypedValue.COMPLEX_UNIT_SP, - textSize * 2.5f, - viewHolder.itemView.context.resources.displayMetrics - ).roundToInt() - val avatarSize = TypedValue.applyDimension( - TypedValue.COMPLEX_UNIT_SP, - if (messageType == Plain) textSize * 2.5f - else textSize * 1.5f, - viewHolder.itemView.context.resources.displayMetrics - ).roundToInt() - viewHolder.avatar?.layoutParams = FrameLayout.LayoutParams(avatarSize, avatarSize).apply { - gravity = Gravity.END - } - avatarContainer?.layoutParams = - LinearLayout.LayoutParams(avatarContainerSize, LinearLayout.LayoutParams.WRAP_CONTENT).apply { - val margin = viewHolder.itemView.context.resources.getDimensionPixelSize(R.dimen.message_horizontal) - setMargins(0, 0, margin, 0) - marginEnd = margin - } - avatarPlaceholder?.layoutParams = - LinearLayout.LayoutParams(avatarContainerSize, LinearLayout.LayoutParams.MATCH_PARENT).apply { - val margin = viewHolder.itemView.context.resources.getDimensionPixelSize(R.dimen.message_horizontal) - setMargins(0, 0, margin, 0) - marginEnd = margin - } - - viewHolder.messageContainer?.apply { - val horizontal = context.resources.getDimensionPixelSize(R.dimen.message_horizontal) - val vertical = context.resources.getDimensionPixelSize(R.dimen.message_vertical) - - setPadding(horizontal, vertical, horizontal, vertical) - } - } - - override fun bind(holder: MessageAdapter.QuasselMessageViewHolder, message: FormattedMessage, - original: MessageData) = - holder.bind(message, - original, - hasDayChange = message.hasDayChange, - messageSettings = messageSettings) - - override fun render(context: Context, message: DisplayMessage): FormattedMessage { - val avatarSize = TypedValue.applyDimension( - TypedValue.COMPLEX_UNIT_SP, - messageSettings.textSize * 2.5f, - context.resources.displayMetrics - ).roundToInt() - - val self = message.content.flag.hasFlag(Message_Flag.Self) - val highlight = message.content.flag.hasFlag(Message_Flag.Highlight) - val monochromeForeground = highlight && monochromeHighlights - return when (message.content.type.enabledValues().firstOrNull()) { - Message_Type.Plain -> { - val realName = ircFormatDeserializer.formatString(message.content.realName, - !monochromeForeground) - val nick = SpannableStringBuilder().apply { - append(contentFormatter.formatPrefix(message.content.senderPrefixes)) - append(contentFormatter.formatNick( - message.content.sender, - self, - monochromeForeground, - false - )) - } - val (content, hasSpoilers) = contentFormatter.formatContent(message.content.content, - monochromeForeground, - message.isExpanded, - message.content.networkId) - val nickName = HostmaskHelper.nick(message.content.sender) - val senderColorIndex = SenderColorUtil.senderColor(nickName) - val rawInitial = nickName.trimStart(*IGNORED_CHARS) - .firstOrNull() ?: nickName.firstOrNull() - val initial = rawInitial?.toUpperCase().toString() - val useSelfColor = when (messageSettings.colorizeNicknames) { - MessageSettings.SenderColorMode.ALL -> false - MessageSettings.SenderColorMode.ALL_BUT_MINE -> - message.content.flag.hasFlag(Message_Flag.Self) - MessageSettings.SenderColorMode.NONE -> true - } - val senderColor = if (useSelfColor) selfColor else senderColors[senderColorIndex] - - FormattedMessage( - original = message.content, - time = timeFormatter.format(message.content.time.atZone(zoneId)), - dayChange = formatDayChange(message), - name = nick, - content = content, - combined = SpannableStringBuilder().apply { - append(nick) - append(": ") - append(content) - }, - realName = realName, - avatarUrls = AvatarHelper.avatar(messageSettings, message.content, avatarSize), - fallbackDrawable = colorContext.buildTextDrawable(initial, senderColor), - hasDayChange = message.hasDayChange, - isMarkerLine = message.isMarkerLine, - isExpanded = message.isExpanded, - isSelected = message.isSelected, - hasSpoilers = hasSpoilers - ) - } - Message_Type.Action -> { - val nickName = HostmaskHelper.nick(message.content.sender) - val senderColorIndex = SenderColorUtil.senderColor(nickName) - val rawInitial = nickName.trimStart(*IGNORED_CHARS) - .firstOrNull() ?: nickName.firstOrNull() - val initial = rawInitial?.toUpperCase().toString() - val useSelfColor = when (messageSettings.colorizeNicknames) { - MessageSettings.SenderColorMode.ALL -> false - MessageSettings.SenderColorMode.ALL_BUT_MINE -> - message.content.flag.hasFlag(Message_Flag.Self) - MessageSettings.SenderColorMode.NONE -> true - } - val senderColor = if (useSelfColor) selfColor else senderColors[senderColorIndex] - - val (content, hasSpoilers) = contentFormatter.formatContent(message.content.content, - monochromeForeground, - message.isExpanded, - message.content.networkId) - - FormattedMessage( - original = message.content, - time = timeFormatter.format(message.content.time.atZone(zoneId)), - dayChange = formatDayChange(message), - combined = SpanFormatter.format( - context.getString(R.string.message_format_action), - contentFormatter.formatPrefix(message.content.senderPrefixes), - contentFormatter.formatNick(message.content.sender, self, monochromeForeground, false), - content - ), - avatarUrls = AvatarHelper.avatar(messageSettings, message.content, avatarSize), - fallbackDrawable = colorContext.buildTextDrawable(initial, senderColor), - hasDayChange = message.hasDayChange, - isMarkerLine = message.isMarkerLine, - isExpanded = message.isExpanded, - isSelected = message.isSelected, - hasSpoilers = hasSpoilers - ) - } - Message_Type.Notice -> { - val (content, hasSpoilers) = contentFormatter.formatContent(message.content.content, - monochromeForeground, - message.isExpanded, - message.content.networkId) - FormattedMessage( - original = message.content, - time = timeFormatter.format(message.content.time.atZone(zoneId)), - dayChange = formatDayChange(message), - combined = SpanFormatter.format( - context.getString(R.string.message_format_notice), - contentFormatter.formatPrefix(message.content.senderPrefixes), - contentFormatter.formatNick(message.content.sender, self, monochromeForeground, false), - content - ), - hasDayChange = message.hasDayChange, - isMarkerLine = message.isMarkerLine, - isExpanded = message.isExpanded, - isSelected = message.isSelected, - hasSpoilers = hasSpoilers - ) - } - Message_Type.Nick -> { - val nickSelf = message.content.sender == message.content.content || self - FormattedMessage( - original = message.content, - time = timeFormatter.format(message.content.time.atZone(zoneId)), - dayChange = formatDayChange(message), - combined = if (nickSelf) { - SpanFormatter.format( - context.getString(R.string.message_format_nick_self), - contentFormatter.formatPrefix(message.content.senderPrefixes), - contentFormatter.formatNick( - message.content.sender, - nickSelf, - monochromeForeground, - false - ) - ) - } else { - SpanFormatter.format( - context.getString(R.string.message_format_nick), - contentFormatter.formatPrefix(message.content.senderPrefixes), - contentFormatter.formatNick( - message.content.sender, - nickSelf, - monochromeForeground, - false - ), - contentFormatter.formatPrefix(message.content.senderPrefixes), - contentFormatter.formatNick( - message.content.content, - nickSelf, - monochromeForeground, - false - ) - ) - }, - hasDayChange = message.hasDayChange, - isMarkerLine = message.isMarkerLine, - isExpanded = message.isExpanded, - isSelected = message.isSelected, - hasSpoilers = false - ) - } - Message_Type.Mode -> FormattedMessage( - original = message.content, - time = timeFormatter.format(message.content.time.atZone(zoneId)), - dayChange = formatDayChange(message), - combined = SpanFormatter.format( - context.getString(R.string.message_format_mode), - message.content.content, - contentFormatter.formatPrefix(message.content.senderPrefixes), - contentFormatter.formatNick(message.content.sender, self, monochromeForeground, false) - ), - hasDayChange = message.hasDayChange, - isMarkerLine = message.isMarkerLine, - isExpanded = message.isExpanded, - isSelected = message.isSelected, - hasSpoilers = false - ) - Message_Type.Join -> FormattedMessage( - original = message.content, - time = timeFormatter.format(message.content.time.atZone(zoneId)), - dayChange = formatDayChange(message), - combined = SpanFormatter.format( - context.getString(R.string.message_format_join), - contentFormatter.formatPrefix(message.content.senderPrefixes), - contentFormatter.formatNick( - message.content.sender, - self, - monochromeForeground, - messageSettings.showHostmaskActions - ), - message.content.content - ), - hasDayChange = message.hasDayChange, - isMarkerLine = message.isMarkerLine, - isExpanded = message.isExpanded, - isSelected = message.isSelected, - hasSpoilers = false - ) - Message_Type.Part -> { - val (content, hasSpoilers) = if (message.content.content.isBlank()) { - Pair( - SpanFormatter.format( - context.getString(R.string.message_format_part_1), - contentFormatter.formatPrefix(message.content.senderPrefixes), - contentFormatter.formatNick( - message.content.sender, - self, - monochromeForeground, - messageSettings.showHostmaskActions - ) - ), - false - ) - } else { - val (content, hasSpoilers) = contentFormatter.formatContent(message.content.content, - monochromeForeground, - message.isExpanded, - message.content.networkId) - Pair( - SpanFormatter.format( - context.getString(R.string.message_format_part_2), - contentFormatter.formatPrefix(message.content.senderPrefixes), - contentFormatter.formatNick( - message.content.sender, - self, - monochromeForeground, - messageSettings.showHostmaskActions - ), - content - ), - hasSpoilers - ) - } - - FormattedMessage( - original = message.content, - time = timeFormatter.format(message.content.time.atZone(zoneId)), - dayChange = formatDayChange(message), - combined = content, - hasDayChange = message.hasDayChange, - isMarkerLine = message.isMarkerLine, - isExpanded = message.isExpanded, - isSelected = message.isSelected, - hasSpoilers = hasSpoilers - ) - } - Message_Type.Quit -> { - val (content, hasSpoilers) = if (message.content.content.isBlank()) { - Pair( - SpanFormatter.format( - context.getString(R.string.message_format_quit_1), - contentFormatter.formatPrefix(message.content.senderPrefixes), - contentFormatter.formatNick( - message.content.sender, - self, - monochromeForeground, - messageSettings.showHostmaskActions - ) - ), - false - ) - } else { - val (content, hasSpoilers) = contentFormatter.formatContent(message.content.content, - monochromeForeground, - message.isExpanded, - message.content.networkId) - Pair( - SpanFormatter.format( - context.getString(R.string.message_format_quit_2), - contentFormatter.formatPrefix(message.content.senderPrefixes), - contentFormatter.formatNick( - message.content.sender, - self, - monochromeForeground, - messageSettings.showHostmaskActions - ), - content - ), - hasSpoilers - ) - } - - FormattedMessage( - original = message.content, - time = timeFormatter.format(message.content.time.atZone(zoneId)), - dayChange = formatDayChange(message), - combined = content, - hasDayChange = message.hasDayChange, - isMarkerLine = message.isMarkerLine, - isExpanded = message.isExpanded, - isSelected = message.isSelected, - hasSpoilers = hasSpoilers - ) - } - Message_Type.Kick -> { - val (user, reason) = message.content.content.split(' ', limit = 2) + listOf("", "") - val (content, hasSpoilers) = if (reason.isBlank()) { - Pair( - SpanFormatter.format( - context.getString(R.string.message_format_kick_1), - contentFormatter.formatNick(user, false, monochromeForeground, false), - contentFormatter.formatPrefix(message.content.senderPrefixes), - contentFormatter.formatNick(message.content.sender, - self, - monochromeForeground, - false) - ), - false - ) - } else { - val (content, hasSpoilers) = contentFormatter.formatContent(reason, - monochromeForeground, - message.isExpanded, - message.content.networkId) - Pair( - SpanFormatter.format( - context.getString(R.string.message_format_kick_2), - contentFormatter.formatNick(user, false, monochromeForeground, false), - contentFormatter.formatPrefix(message.content.senderPrefixes), - contentFormatter.formatNick(message.content.sender, - self, - monochromeForeground, - false), - content - ), - hasSpoilers - ) - } - - FormattedMessage( - original = message.content, - time = timeFormatter.format(message.content.time.atZone(zoneId)), - dayChange = formatDayChange(message), - combined = content, - hasDayChange = message.hasDayChange, - isMarkerLine = message.isMarkerLine, - isExpanded = message.isExpanded, - isSelected = message.isSelected, - hasSpoilers = hasSpoilers - ) - } - Message_Type.Kill -> { - val (user, reason) = message.content.content.split(' ', limit = 2) + listOf("", "") - val (content, hasSpoilers) = if (reason.isBlank()) { - Pair( - SpanFormatter.format( - context.getString(R.string.message_format_kill_1), - contentFormatter.formatNick(user, false, monochromeForeground, false), - contentFormatter.formatPrefix(message.content.senderPrefixes), - contentFormatter.formatNick(message.content.sender, - self, - monochromeForeground, - false) - ), - false - ) - } else { - val (content, hasSpoilers) = contentFormatter.formatContent(reason, - monochromeForeground, - message.isExpanded, - message.content.networkId) - Pair( - SpanFormatter.format( - context.getString(R.string.message_format_kill_2), - contentFormatter.formatNick(user, false, monochromeForeground, false), - contentFormatter.formatPrefix(message.content.senderPrefixes), - contentFormatter.formatNick(message.content.sender, - self, - monochromeForeground, - false), - content - ), - hasSpoilers - ) - } - - FormattedMessage( - original = message.content, - time = timeFormatter.format(message.content.time.atZone(zoneId)), - dayChange = formatDayChange(message), - combined = content, - hasDayChange = message.hasDayChange, - isMarkerLine = message.isMarkerLine, - isExpanded = message.isExpanded, - isSelected = message.isSelected, - hasSpoilers = hasSpoilers - ) - } - Message_Type.NetsplitJoin -> { - val split = message.content.content.split("#:#") - val (server1, server2) = split.last().split(' ') - val usersAffected = split.size - 1 - val users = split.subList(0, split.size - 1).map { - contentFormatter.formatNick(it, false, monochromeForeground, false) - } - - FormattedMessage( - original = message.content, - time = timeFormatter.format(message.content.time.atZone(zoneId)), - dayChange = formatDayChange(message), - combined = context.resources.getQuantityString( - R.plurals.message_netsplit_join, - usersAffected, - server1, - server2, - usersAffected, - users.joinToString(", ") - ), - hasDayChange = message.hasDayChange, - isMarkerLine = message.isMarkerLine, - isExpanded = message.isExpanded, - isSelected = message.isSelected, - hasSpoilers = false - ) - } - Message_Type.NetsplitQuit -> { - val split = message.content.content.split("#:#") - val (server1, server2) = split.last().split(' ') - val usersAffected = split.size - 1 - val users = split.subList(0, split.size - 1).map { - contentFormatter.formatNick(it, false, monochromeForeground, false) - } - - FormattedMessage( - original = message.content, - time = timeFormatter.format(message.content.time.atZone(zoneId)), - dayChange = formatDayChange(message), - combined = context.resources.getQuantityString( - R.plurals.message_netsplit_quit, - usersAffected, - server1, - server2, - usersAffected, - users.joinToString(", ") - ), - hasDayChange = message.hasDayChange, - isMarkerLine = message.isMarkerLine, - isExpanded = message.isExpanded, - isSelected = message.isSelected, - hasSpoilers = false - ) - } - Message_Type.Server, - Message_Type.Info, - Message_Type.Error -> { - val (content, hasSpoilers) = contentFormatter.formatContent(message.content.content, - monochromeForeground, - message.isExpanded, - message.content.networkId) - FormattedMessage( - original = message.content, - time = timeFormatter.format(message.content.time.atZone(zoneId)), - dayChange = formatDayChange(message), - combined = content, - hasDayChange = message.hasDayChange, - isMarkerLine = message.isMarkerLine, - isExpanded = message.isExpanded, - isSelected = message.isSelected, - hasSpoilers = hasSpoilers - ) - } - Message_Type.Topic -> { - val (content, hasSpoilers) = contentFormatter.formatContent(message.content.content, - monochromeForeground, - message.isExpanded, - message.content.networkId) - FormattedMessage( - original = message.content, - time = timeFormatter.format(message.content.time.atZone(zoneId)), - dayChange = formatDayChange(message), - combined = content, - hasDayChange = message.hasDayChange, - isMarkerLine = message.isMarkerLine, - isExpanded = message.isExpanded, - isSelected = message.isSelected, - hasSpoilers = hasSpoilers - ) - } - Message_Type.DayChange -> FormattedMessage( - original = message.content, - time = "", - dayChange = formatDayChange(message), - combined = dateFormatter.format(message.content.time.atZone(zoneId)), - hasDayChange = message.hasDayChange, - isMarkerLine = false, - isExpanded = false, - isSelected = false, - hasSpoilers = false - ) - Message_Type.Invite -> { - val (content, hasSpoilers) = contentFormatter.formatContent(message.content.content, - monochromeForeground, - message.isExpanded, - message.content.networkId) - FormattedMessage( - original = message.content, - time = timeFormatter.format(message.content.time.atZone(zoneId)), - dayChange = formatDayChange(message), - combined = content, - hasDayChange = message.hasDayChange, - isMarkerLine = message.isMarkerLine, - isExpanded = message.isExpanded, - isSelected = message.isSelected, - hasSpoilers = hasSpoilers - ) - } - else -> FormattedMessage( - original = message.content, - time = timeFormatter.format(message.content.time.atZone(zoneId)), - dayChange = formatDayChange(message), - combined = SpanFormatter.format( - "[%d] %s%s: %s", - message.content.type.toInt(), - contentFormatter.formatPrefix(message.content.senderPrefixes), - contentFormatter.formatNick( - message.content.sender, - self, - monochromeForeground, - messageSettings.showHostmaskActions - ), - message.content.content - ), - hasDayChange = message.hasDayChange, - isMarkerLine = message.isMarkerLine, - isExpanded = message.isExpanded, - isSelected = message.isSelected, - hasSpoilers = false - ) - } - } - - private fun formatDayChange( - message: DisplayMessage) = - if (message.hasDayChange) dateFormatter.format(message.content.time.atZone(zoneId).truncatedTo( - ChronoUnit.DAYS)) else null -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/ui/chat/nicks/NickListAdapter.kt b/app/src/main/java/de/kuschku/quasseldroid/ui/chat/nicks/NickListAdapter.kt deleted file mode 100644 index 199a10486e6cb8465d1480aea013b411f384f63b..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/ui/chat/nicks/NickListAdapter.kt +++ /dev/null @@ -1,140 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.ui.chat.nicks - -import android.view.LayoutInflater -import android.view.View -import android.view.ViewGroup -import androidx.recyclerview.widget.DiffUtil -import androidx.recyclerview.widget.ListAdapter -import androidx.recyclerview.widget.RecyclerView -import de.kuschku.libquassel.protocol.NetworkId -import de.kuschku.libquassel.util.helper.nullIf -import de.kuschku.quasseldroid.databinding.WidgetNickAwayBinding -import de.kuschku.quasseldroid.databinding.WidgetNickBinding -import de.kuschku.quasseldroid.settings.MessageSettings -import de.kuschku.quasseldroid.util.helper.letIf -import de.kuschku.quasseldroid.util.helper.loadAvatars -import de.kuschku.quasseldroid.util.helper.visibleIf -import de.kuschku.quasseldroid.util.ui.SpanFormatter -import de.kuschku.quasseldroid.util.ui.fastscroll.views.FastScrollRecyclerView -import de.kuschku.quasseldroid.viewmodel.data.IrcUserItem - -class NickListAdapter( - private val messageSettings: MessageSettings, - private val clickListener: ((NetworkId, String) -> Unit)? = null -) : ListAdapter<IrcUserItem, NickListAdapter.NickViewHolder>( - object : DiffUtil.ItemCallback<IrcUserItem>() { - override fun areItemsTheSame(oldItem: IrcUserItem, newItem: IrcUserItem) = - oldItem.nick == newItem.nick - - override fun areContentsTheSame(oldItem: IrcUserItem, newItem: IrcUserItem) = - oldItem == newItem - }), FastScrollRecyclerView.SectionedAdapter { - override fun getSectionName(position: Int) = getItem(position).let { - it.modes.letIf(it.modes.isNotEmpty()) { it.substring(0, 1) } + - (it.initial.nullIf(String?::isNullOrBlank) ?: "123") - } - - override fun onCreateViewHolder(parent: ViewGroup, viewType: Int) = when (viewType) { - VIEWTYPE_AWAY -> NickViewHolder.Away( - WidgetNickAwayBinding.inflate(LayoutInflater.from(parent.context), parent, false), - clickListener = clickListener - ) - else -> NickViewHolder.Active( - WidgetNickBinding.inflate(LayoutInflater.from(parent.context), parent, false), - clickListener = clickListener - ) - } - - operator fun get(position: Int): IrcUserItem? = super.getItem(position) - - override fun onBindViewHolder(holder: NickViewHolder, position: Int) = - holder.bind(getItem(position), messageSettings) - - override fun getItemViewType(position: Int) = if (getItem(position).away) { - VIEWTYPE_AWAY - } else { - VIEWTYPE_ACTIVE - } - - sealed class NickViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) { - abstract fun bind(data: IrcUserItem, messageSettings: MessageSettings) - - class Active( - private val binding: WidgetNickBinding, - private val clickListener: ((NetworkId, String) -> Unit)? = null - ) : NickViewHolder(binding.root) { - var user: IrcUserItem? = null - - init { - itemView.setOnClickListener { - val nick = user - if (nick != null) - clickListener?.invoke(nick.networkId, nick.nick) - } - } - - override fun bind(data: IrcUserItem, messageSettings: MessageSettings) { - user = data - - binding.nick.text = SpanFormatter.format("%s%s", data.modes, data.displayNick ?: data.nick) - binding.realname.text = data.realname - - binding.avatar.visibleIf(messageSettings.showAvatars) - binding.avatar.loadAvatars(data.avatarUrls, - data.fallbackDrawable, - crop = !messageSettings.squareAvatars) - } - } - - class Away( - private val binding: WidgetNickAwayBinding, - private val clickListener: ((NetworkId, String) -> Unit)? = null - ) : NickViewHolder(binding.root) { - var user: IrcUserItem? = null - - init { - itemView.setOnClickListener { - val nick = user - if (nick != null) - clickListener?.invoke(nick.networkId, nick.nick) - } - } - - override fun bind(data: IrcUserItem, messageSettings: MessageSettings) { - user = data - - binding.nick.text = SpanFormatter.format("%s%s", data.modes, data.displayNick ?: data.nick) - binding.realname.text = data.realname - - binding.avatar.visibleIf(messageSettings.showAvatars) - binding.avatar.loadAvatars(data.avatarUrls, - data.fallbackDrawable, - crop = !messageSettings.squareAvatars) - } - } - } - - companion object { - const val VIEWTYPE_ACTIVE = 0 - const val VIEWTYPE_AWAY = 1 - } -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/ui/chat/nicks/NickListFragment.kt b/app/src/main/java/de/kuschku/quasseldroid/ui/chat/nicks/NickListFragment.kt deleted file mode 100644 index af05005d987f96b2cc4b468bdb8296222ac435c9..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/ui/chat/nicks/NickListFragment.kt +++ /dev/null @@ -1,198 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.ui.chat.nicks - -import android.os.Bundle -import android.view.LayoutInflater -import android.view.View -import android.view.ViewGroup -import androidx.lifecycle.Observer -import androidx.recyclerview.widget.DefaultItemAnimator -import androidx.recyclerview.widget.LinearLayoutManager -import androidx.recyclerview.widget.RecyclerView -import butterknife.BindView -import butterknife.ButterKnife -import com.bumptech.glide.Glide -import com.bumptech.glide.ListPreloader -import com.bumptech.glide.integration.recyclerview.RecyclerViewPreloader -import com.bumptech.glide.util.FixedPreloadSizeProvider -import de.kuschku.libquassel.protocol.Buffer_Type -import de.kuschku.libquassel.protocol.NetworkId -import de.kuschku.libquassel.quassel.BufferInfo -import de.kuschku.libquassel.util.helper.value -import de.kuschku.libquassel.util.irc.IrcCaseMappers -import de.kuschku.libquassel.util.irc.SenderColorUtil -import de.kuschku.quasseldroid.GlideApp -import de.kuschku.quasseldroid.R -import de.kuschku.quasseldroid.settings.AppearanceSettings -import de.kuschku.quasseldroid.settings.MessageSettings -import de.kuschku.quasseldroid.ui.info.user.UserInfoActivity -import de.kuschku.quasseldroid.util.ColorContext -import de.kuschku.quasseldroid.util.avatars.AvatarHelper -import de.kuschku.quasseldroid.util.helper.loadWithFallbacks -import de.kuschku.quasseldroid.util.helper.styledAttributes -import de.kuschku.quasseldroid.util.helper.toLiveData -import de.kuschku.quasseldroid.util.irc.format.ContentFormatter -import de.kuschku.quasseldroid.util.irc.format.IrcFormatDeserializer -import de.kuschku.quasseldroid.util.service.ServiceBoundFragment -import de.kuschku.quasseldroid.viewmodel.data.Avatar -import de.kuschku.quasseldroid.viewmodel.helper.ChatViewModelHelper -import de.kuschku.quasseldroid.viewmodel.helper.EditorViewModelHelper.Companion.IGNORED_CHARS -import javax.inject.Inject - -class NickListFragment : ServiceBoundFragment() { - @BindView(R.id.nickList) - lateinit var nickList: RecyclerView - - @Inject - lateinit var appearanceSettings: AppearanceSettings - - @Inject - lateinit var messageSettings: MessageSettings - - @Inject - lateinit var ircFormatDeserializer: IrcFormatDeserializer - - @Inject - lateinit var contentFormatter: ContentFormatter - - @Inject - lateinit var modelHelper: ChatViewModelHelper - - override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, - savedInstanceState: Bundle?): View? { - val view = inflater.inflate(R.layout.chat_nicklist, container, false) - ButterKnife.bind(this, view) - - val nickListAdapter = NickListAdapter(messageSettings, clickListener) - nickList.adapter = nickListAdapter - nickList.layoutManager = object : LinearLayoutManager(context) { - override fun supportsPredictiveItemAnimations() = false - } - nickList.itemAnimator = DefaultItemAnimator() - - val senderColors = requireContext().theme.styledAttributes( - R.attr.senderColor0, R.attr.senderColor1, R.attr.senderColor2, R.attr.senderColor3, - R.attr.senderColor4, R.attr.senderColor5, R.attr.senderColor6, R.attr.senderColor7, - R.attr.senderColor8, R.attr.senderColor9, R.attr.senderColorA, R.attr.senderColorB, - R.attr.senderColorC, R.attr.senderColorD, R.attr.senderColorE, R.attr.senderColorF - ) { - IntArray(length()) { - getColor(it, 0) - } - } - - val selfColor = requireContext().theme.styledAttributes(R.attr.colorForegroundSecondary) { - getColor(0, 0) - } - - val colorContext = ColorContext(requireContext(), messageSettings) - - val avatarSize = resources.getDimensionPixelSize(R.dimen.avatar_size) - modelHelper.nickDataThrottled.toLiveData().observe(viewLifecycleOwner, Observer { - runInBackground { - it?.asSequence()?.map { - val nickName = it.nick - val senderColorIndex = SenderColorUtil.senderColor(nickName) - val rawInitial = nickName.trimStart(*IGNORED_CHARS) - .firstOrNull() ?: nickName.firstOrNull() - val initial = rawInitial?.toUpperCase().toString() - val useSelfColor = when (messageSettings.colorizeNicknames) { - MessageSettings.SenderColorMode.ALL -> false - MessageSettings.SenderColorMode.ALL_BUT_MINE -> it.self - MessageSettings.SenderColorMode.NONE -> true - } - val senderColor = if (useSelfColor) selfColor else senderColors[senderColorIndex] - - it.copy( - displayNick = contentFormatter.formatNick(it.nick), - fallbackDrawable = colorContext.buildTextDrawable(initial, senderColor), - initial = initial, - modes = when (messageSettings.showPrefix) { - MessageSettings.ShowPrefixMode.ALL -> - it.modes - else -> - it.modes.substring(0, Math.min(it.modes.length, 1)) - }, - realname = ircFormatDeserializer.formatString( - it.realname.toString(), messageSettings.colorizeMirc - ), - avatarUrls = AvatarHelper.avatar(messageSettings, it, avatarSize) - ) - }?.sortedBy { - IrcCaseMappers[it.networkCasemapping].toLowerCase(it.nick.trimStart(*IGNORED_CHARS)) - .trimStart(*IGNORED_CHARS) - }?.sortedBy { - it.lowestMode - }?.toList()?.let { - activity?.runOnUiThread { - nickListAdapter.submitList(it) - } - } - } - }) - savedInstanceState?.run { - (nickList.layoutManager as RecyclerView.LayoutManager) - .onRestoreInstanceState(getParcelable(KEY_STATE_LIST)) - } - - val sizeProvider = FixedPreloadSizeProvider<List<Avatar>>(avatarSize, avatarSize) - - val preloadModelProvider = object : ListPreloader.PreloadModelProvider<List<Avatar>> { - override fun getPreloadItems(position: Int) = listOfNotNull( - nickListAdapter[position]?.let { AvatarHelper.avatar(messageSettings, it) } - ) - - override fun getPreloadRequestBuilder(item: List<Avatar>) = - GlideApp.with(this@NickListFragment).loadWithFallbacks(item)?.override(avatarSize) - } - - val preloader = RecyclerViewPreloader(Glide.with(this), preloadModelProvider, sizeProvider, 10) - - nickList.addOnScrollListener(preloader) - - return view - } - - override fun onSaveInstanceState(outState: Bundle) { - super.onSaveInstanceState(outState) - outState.putParcelable(KEY_STATE_LIST, nickList.layoutManager?.onSaveInstanceState()) - } - - private val clickListener: ((NetworkId, String) -> Unit) = { networkId, nick -> - modelHelper.connectedSession.value?.orNull()?.bufferSyncer?.let { bufferSyncer -> - UserInfoActivity.launch( - requireContext(), - openBuffer = false, - bufferId = bufferSyncer.find( - bufferName = nick, - networkId = networkId, - type = Buffer_Type.of(Buffer_Type.QueryBuffer) - )?.let(BufferInfo::bufferId), - nick = nick, - networkId = networkId - ) - } - } - - companion object { - private const val KEY_STATE_LIST = "KEY_STATE_LIST" - } -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/ui/chat/topic/TopicActivity.kt b/app/src/main/java/de/kuschku/quasseldroid/ui/chat/topic/TopicActivity.kt deleted file mode 100644 index f0fd1a0782ca8f5e3ff90d2c56e18dcc97576028..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/ui/chat/topic/TopicActivity.kt +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.ui.chat.topic - -import android.content.Context -import android.content.Intent -import de.kuschku.quasseldroid.util.ui.settings.ServiceBoundSettingsActivity - -class TopicActivity : ServiceBoundSettingsActivity(TopicFragment()) { - companion object { - fun launch( - context: Context, - buffer: Int - ) = context.startActivity(intent( - context, - buffer)) - - fun intent( - context: Context, - buffer: Int - ) = Intent(context, TopicActivity::class.java).apply { - putExtra("bufferId", buffer) - } - } -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/ui/chat/topic/TopicFragment.kt b/app/src/main/java/de/kuschku/quasseldroid/ui/chat/topic/TopicFragment.kt deleted file mode 100644 index 0aece28be6c180599f3a01955ac2fe853cf78d8f..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/ui/chat/topic/TopicFragment.kt +++ /dev/null @@ -1,148 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.ui.chat.topic - -import android.os.Bundle -import android.view.LayoutInflater -import android.view.View -import android.view.ViewGroup -import androidx.lifecycle.Observer -import androidx.recyclerview.widget.DefaultItemAnimator -import androidx.recyclerview.widget.LinearLayoutManager -import androidx.recyclerview.widget.RecyclerView -import butterknife.BindView -import butterknife.ButterKnife -import com.google.android.material.bottomsheet.BottomSheetBehavior -import de.kuschku.libquassel.protocol.BufferId -import de.kuschku.libquassel.util.helper.invoke -import de.kuschku.quasseldroid.R -import de.kuschku.quasseldroid.settings.AppearanceSettings -import de.kuschku.quasseldroid.settings.AutoCompleteSettings -import de.kuschku.quasseldroid.settings.MessageSettings -import de.kuschku.quasseldroid.ui.chat.input.* -import de.kuschku.quasseldroid.util.helper.toLiveData -import de.kuschku.quasseldroid.util.irc.format.ContentFormatter -import de.kuschku.quasseldroid.util.irc.format.IrcFormatDeserializer -import de.kuschku.quasseldroid.util.irc.format.IrcFormatSerializer -import de.kuschku.quasseldroid.util.ui.settings.fragment.Savable -import de.kuschku.quasseldroid.util.ui.settings.fragment.ServiceBoundSettingsFragment -import de.kuschku.quasseldroid.viewmodel.helper.EditorViewModelHelper -import javax.inject.Inject - -class TopicFragment : ServiceBoundSettingsFragment(), Savable { - @BindView(R.id.chatline) - lateinit var chatline: RichEditText - - @BindView(R.id.formatting_toolbar) - lateinit var toolbar: RichToolbar - - @BindView(R.id.autocomplete_list) - lateinit var autoCompleteList: RecyclerView - - @Inject - lateinit var autoCompleteSettings: AutoCompleteSettings - - @Inject - lateinit var messageSettings: MessageSettings - - @Inject - lateinit var appearanceSettings: AppearanceSettings - - @Inject - lateinit var formatDeserializer: IrcFormatDeserializer - - @Inject - lateinit var contentFormatter: ContentFormatter - - @Inject - lateinit var formatSerializer: IrcFormatSerializer - - @Inject - lateinit var autoCompleteAdapter: AutoCompleteAdapter - - @Inject - lateinit var modelHelper: EditorViewModelHelper - - private lateinit var editorHelper: EditorHelper - - override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, - savedInstanceState: Bundle?): View? { - val view = inflater.inflate(R.layout.info_topic, container, false) - ButterKnife.bind(this, view) - - val autoCompleteHelper = AutoCompleteHelper( - requireActivity(), - autoCompleteSettings, - messageSettings, - formatDeserializer, - contentFormatter, - modelHelper - ) - - editorHelper = EditorHelper( - requireActivity(), - chatline, - toolbar, - autoCompleteHelper, - autoCompleteSettings, - appearanceSettings - ) - - modelHelper.editor.lastWord.onNext(editorHelper.lastWord) - - if (autoCompleteSettings.prefix || autoCompleteSettings.auto) { - val autoCompleteBottomSheet = BottomSheetBehavior.from(autoCompleteList) - autoCompleteAdapter.setOnClickListener(chatline::autoComplete) - autoCompleteList.layoutManager = LinearLayoutManager(activity) - autoCompleteList.itemAnimator = DefaultItemAnimator() - autoCompleteList.adapter = autoCompleteAdapter - autoCompleteHelper.addDataListener { - autoCompleteBottomSheet.state = - if (it.isEmpty()) BottomSheetBehavior.STATE_HIDDEN - else BottomSheetBehavior.STATE_COLLAPSED - autoCompleteAdapter.submitList(it) - } - } - - val bufferId = BufferId(arguments?.getInt("bufferId", -1) ?: -1) - modelHelper.chat.bufferId.onNext(bufferId) - modelHelper.bufferData.filter { - it.info != null - }.firstElement().toLiveData().observe(viewLifecycleOwner, Observer { - chatline.setText(formatDeserializer.formatString(it?.description, true)) - }) - - return view - } - - override fun onSave(): Boolean { - modelHelper.connectedSession { sessionOptional -> - val session = sessionOptional.orNull() - modelHelper.chat.bufferId { bufferId -> - session?.bufferSyncer?.bufferInfo(bufferId)?.also { bufferInfo -> - val topic = formatSerializer.toEscapeCodes(chatline.safeText) - session.rpcHandler.sendInput(bufferInfo, "/topic $topic") - return true - } - } - } - return false - } -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/ui/chat/topic/TopicFragmentProvider.kt b/app/src/main/java/de/kuschku/quasseldroid/ui/chat/topic/TopicFragmentProvider.kt deleted file mode 100644 index 94132e346ae1c45e126e434b3b51c5928629fca5..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/ui/chat/topic/TopicFragmentProvider.kt +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.ui.chat.topic - -import androidx.fragment.app.FragmentActivity -import dagger.Binds -import dagger.Module -import dagger.android.ContributesAndroidInjector - -@Module -abstract class TopicFragmentProvider { - @Binds - abstract fun bindFragmentActivity(activity: TopicActivity): FragmentActivity - - @ContributesAndroidInjector - abstract fun bindTopicFragment(): TopicFragment -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/ui/clientsettings/about/AboutActivity.kt b/app/src/main/java/de/kuschku/quasseldroid/ui/clientsettings/about/AboutActivity.kt deleted file mode 100644 index 53145b4a06b91a39b3a13f1f730ea6a39de6eddc..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/ui/clientsettings/about/AboutActivity.kt +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.ui.clientsettings.about - -import android.content.Context -import android.content.Intent -import de.kuschku.quasseldroid.util.ui.settings.SettingsActivity - -class AboutActivity : SettingsActivity(AboutFragment()) { - companion object { - fun launch(context: Context) = context.startActivity(intent(context)) - fun intent(context: Context) = Intent(context, AboutActivity::class.java) - } -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/ui/clientsettings/about/AboutFragment.kt b/app/src/main/java/de/kuschku/quasseldroid/ui/clientsettings/about/AboutFragment.kt deleted file mode 100644 index 574b03fb86764e4be3b5d182d783eda1924b21e1..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/ui/clientsettings/about/AboutFragment.kt +++ /dev/null @@ -1,401 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.ui.clientsettings.about - -import android.content.ClipData -import android.content.ClipboardManager -import android.content.Context -import android.content.Intent -import android.net.Uri -import android.os.Bundle -import android.view.LayoutInflater -import android.view.View -import android.view.ViewGroup -import android.widget.Button -import android.widget.TextView -import android.widget.Toast -import androidx.core.view.ViewCompat -import androidx.recyclerview.widget.DividerItemDecoration -import androidx.recyclerview.widget.LinearLayoutManager -import androidx.recyclerview.widget.RecyclerView -import butterknife.BindView -import butterknife.ButterKnife -import dagger.android.support.DaggerFragment -import de.kuschku.quasseldroid.BuildConfig -import de.kuschku.quasseldroid.R - -class AboutFragment : DaggerFragment() { - - @BindView(R.id.version_container) - lateinit var versionContainer: View - - @BindView(R.id.version) - lateinit var version: TextView - - @BindView(R.id.action_website) - lateinit var website: Button - - @BindView(R.id.action_source) - lateinit var source: Button - - @BindView(R.id.action_donate) - lateinit var donate: Button - - @BindView(R.id.action_privacy_policy) - lateinit var privacyPolicy: Button - - @BindView(R.id.authors) - lateinit var authors: RecyclerView - - @BindView(R.id.acknowledgements) - lateinit var acknowledgements: RecyclerView - - @BindView(R.id.translators) - lateinit var translators: RecyclerView - - @BindView(R.id.libraries) - lateinit var libraries: RecyclerView - - override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, - savedInstanceState: Bundle?): View? { - val view = inflater.inflate(R.layout.preferences_about, container, false) - ButterKnife.bind(this, view) - - version.text = BuildConfig.VERSION_NAME - - versionContainer.setOnClickListener { - val clipboard = requireContext().getSystemService(Context.CLIPBOARD_SERVICE) as ClipboardManager - clipboard.setPrimaryClip(ClipData.newPlainText(null, BuildConfig.VERSION_NAME)) - Toast.makeText(requireContext(), R.string.info_copied_version, Toast.LENGTH_LONG).show() - } - - website.setOnClickListener { - context?.startActivity(Intent(Intent.ACTION_VIEW).apply { - data = Uri.parse("https://quasseldroid.info/") - }) - } - - source.setOnClickListener { - context?.startActivity(Intent(Intent.ACTION_VIEW).apply { - data = Uri.parse("https://git.kuschku.de/justJanne/QuasselDroid-ng") - }) - } - - donate.setOnClickListener { - context?.startActivity(Intent(Intent.ACTION_VIEW).apply { - data = Uri.parse("https://www.patreon.com/justjanne") - }) - } - - privacyPolicy.setOnClickListener { - context?.startActivity(Intent(Intent.ACTION_VIEW).apply { - data = Uri.parse("http://quasseldroid.info/privacy-policy/") - }) - } - - val apache2 = License( - shortName = "Apache-2.0", - fullName = "Apache License", - text = R.raw.license_apache_2 - ) - - libraries.layoutManager = LinearLayoutManager(context) - libraries.itemAnimator = null - libraries.adapter = LibraryAdapter(listOf( - Library( - name = "AndroidX", - license = apache2, - url = "https://developer.android.com/jetpack/androidx/" - ), - Library( - name = "atinject", - license = apache2, - url = "https://code.google.com/archive/p/atinject/" - ), - Library( - name = "Apache Commons Codec", - version = "1.13", - license = apache2, - url = "https://commons.apache.org/proper/commons-codec/" - ), - Library( - name = "AutoService", - version = "1.0-rc6", - license = apache2, - url = "https://github.com/google/auto/tree/master/service" - ), - Library( - name = "Better Link Movement Method", - version = "2.1.0", - license = apache2, - url = "https://github.com/Saketme/Better-Link-Movement-Method" - ), - Library( - name = "Butter Knife", - version = "10.1.0", - license = apache2, - url = "http://jakewharton.github.io/butterknife/" - ), - Library( - name = "Dagger 2", - version = "2.24", - license = apache2, - url = "https://google.github.io/dagger/" - ), - Library( - name = "Dracula", - license = License( - shortName = "MIT", - fullName = "The MIT License (MIT)", - text = R.raw.license_dracula - ), - url = "https://draculatheme.com/" - ), - Library( - name = "FloatingActionButtonSpeedDial", - version = "3.0.0", - license = apache2, - url = "https://github.com/leinardi/FloatingActionButtonSpeedDial" - ), - Library( - name = "Glide", - version = "4.9.0", - license = apache2, - url = "https://bumptech.github.io/glide/" - ), - Library( - name = "Gson", - version = "2.8.5", - license = apache2, - url = "https://github.com/google/gson" - ), - Library( - name = "Gruvbox", - license = License( - shortName = "MIT", - fullName = "The MIT License (MIT)", - text = R.raw.license_gruvbox - ), - url = "https://github.com/morhetz/gruvbox" - ), - Library( - name = "KotlinPoet", - version = "1.3.0", - license = apache2, - url = "https://github.com/square/kotlinpoet" - ), - Library( - name = "JetBrains Java Annotations", - version = "17.0.0", - license = apache2, - url = "https://github.com/JetBrains/java-annotations" - ), - Library( - name = "Kotlin Standard Library", - version = "1.3.72", - license = apache2, - url = "https://kotlinlang.org/" - ), - Library( - name = "LeakCanary", - version = "1.6.3", - license = apache2, - url = "https://github.com/square/leakcanary" - ), - Library( - name = "Material Components", - version = "1.1.0-alpha10", - license = apache2, - url = "https://github.com/material-components/material-components-android" - ), - Library( - name = "Material Design Icons: Community", - license = License( - shortName = "SIL Open Font License v1.1", - fullName = "SIL OPEN FONT LICENSE", - text = R.raw.license_materialdesignicons - ), - url = "https://github.com/Templarian/MaterialDesign" - ), - Library( - name = "Material Design Icons: Google", - version = "3.0.1", - license = apache2, - url = "https://github.com/google/material-design-icons" - ), - Library( - name = "Material Dialogs", - version = "0.9.6.0", - license = License( - shortName = "MIT", - fullName = "The MIT License (MIT)", - text = R.raw.license_materialdialogs - ), - url = "https://github.com/afollestad/material-dialogs" - ), - Library( - name = "MaterialProgressBar", - version = "1.6.1", - license = apache2, - url = "https://github.com/DreaminginCodeZH/MaterialProgressBar" - ), - Library( - name = "Quassel", - version = "0.13.1", - license = License( - shortName = "GPLv3", - fullName = "GNU GENERAL PUBLIC LICENSE", - text = R.raw.license_gpl_v3 - ), - url = "https://quassel-irc.org/" - ), - Library( - name = "Reactive Streams", - version = "1.0.2", - license = License( - shortName = "CC0", - fullName = "Creative Commons CC0 1.0 Universal", - text = R.raw.license_cc_0 - ), - url = "http://www.reactive-streams.org/" - ), - Library( - name = "ReactiveNetwork", - version = "3.0.6", - license = apache2, - url = "https://github.com/pwittchen/ReactiveNetwork" - ), - Library( - name = "RecyclerView-FastScroll", - version = "2.0.", - license = apache2, - url = "https://github.com/timusus/RecyclerView-FastScroll" - ), - Library( - name = "Retrofit", - version = "2.6.1", - license = apache2, - url = "https://square.github.io/retrofit/" - ), - Library( - name = "RxJava", - version = "2.2.12", - license = apache2, - url = "https://github.com/ReactiveX/RxJava" - ), - Library( - name = "Solarized", - license = License( - shortName = "MIT", - fullName = "The MIT License (MIT)", - text = R.raw.license_solarized - ), - url = "http://ethanschoonover.com/solarized" - ), - Library( - name = "ThreeTen backport project", - version = "1.4.10", - license = License( - shortName = "BSD 3-clause", - text = R.raw.license_threetenbp - ), - url = "http://www.threeten.org/threetenbp/" - ) - )) - libraries.addItemDecoration(DividerItemDecoration(context, LinearLayoutManager.VERTICAL)) - ViewCompat.setNestedScrollingEnabled(libraries, false) - - authors.layoutManager = LinearLayoutManager(context) - authors.itemAnimator = null - authors.adapter = ContributorAdapter(listOf( - Contributor( - name = "Janne Mareike Koschinski", - nickName = "justJanne", - description = getString(R.string.contributor_description_justjanne) - ) - )) - authors.addItemDecoration(DividerItemDecoration(context, LinearLayoutManager.VERTICAL)) - ViewCompat.setNestedScrollingEnabled(authors, false) - - acknowledgements.layoutManager = LinearLayoutManager(context) - acknowledgements.itemAnimator = null - acknowledgements.adapter = ContributorAdapter(listOf( - Contributor( - name = "Frederik M. J. Vestre", - nickName = "freqmod", - description = getString(R.string.contributor_description_freqmod) - ), - Contributor( - name = "Martin “Java Sucks” Sandsmark", - nickName = "sandsmark", - description = getString(R.string.contributor_description_sandsmark) - ), - Contributor( - name = "Magnus Fjell", - nickName = "magnuf", - description = getString(R.string.contributor_description_magnuf) - ), - Contributor( - name = "Ken Børge Viktil", - nickName = "Kenji", - description = getString(R.string.contributor_description_kenji) - ) - )) - acknowledgements.addItemDecoration(DividerItemDecoration(context, LinearLayoutManager.VERTICAL)) - ViewCompat.setNestedScrollingEnabled(acknowledgements, false) - - translators.layoutManager = LinearLayoutManager(context) - translators.itemAnimator = null - translators.adapter = TranslatorAdapter(listOf( - Translator( - name = "Janne Mareike Koschinski", - language = R.string.preference_language_entry_de - ), - Translator( - name = "xi <xi@nuxi.ca>", - language = R.string.preference_language_entry_fr_ca - ), - Translator( - name = "Francesco Roberto", - language = R.string.preference_language_entry_it - ), - Translator( - name = "TDa_", - language = R.string.preference_language_entry_lt - ), - Translator( - name = "Robbe Van der Gucht", - language = R.string.preference_language_entry_nl - ), - Translator( - name = "Exterminador", - language = R.string.preference_language_entry_pt - ), - Translator( - name = "Luka Ilić", - language = R.string.preference_language_entry_sr - ) - )) - translators.addItemDecoration(DividerItemDecoration(context, LinearLayoutManager.VERTICAL)) - ViewCompat.setNestedScrollingEnabled(translators, false) - - return view - } -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/ui/clientsettings/about/AboutFragmentProvider.kt b/app/src/main/java/de/kuschku/quasseldroid/ui/clientsettings/about/AboutFragmentProvider.kt deleted file mode 100644 index ad082744144673b380601da73e7821b9d57ea520..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/ui/clientsettings/about/AboutFragmentProvider.kt +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.ui.clientsettings.about - -import androidx.fragment.app.FragmentActivity -import dagger.Binds -import dagger.Module -import dagger.android.ContributesAndroidInjector - -@Module -abstract class AboutFragmentProvider { - @Binds - abstract fun bindFragmentActivity(activity: AboutActivity): FragmentActivity - - @ContributesAndroidInjector - abstract fun bindAboutFragment(): AboutFragment -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/ui/clientsettings/about/Contributor.kt b/app/src/main/java/de/kuschku/quasseldroid/ui/clientsettings/about/Contributor.kt deleted file mode 100644 index f23ba51161f685ba4bdf2c019c9258f69bb03500..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/ui/clientsettings/about/Contributor.kt +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.ui.clientsettings.about - -data class Contributor( - val name: String, - val nickName: String, - val description: String -) diff --git a/app/src/main/java/de/kuschku/quasseldroid/ui/clientsettings/about/ContributorAdapter.kt b/app/src/main/java/de/kuschku/quasseldroid/ui/clientsettings/about/ContributorAdapter.kt deleted file mode 100644 index 18a2a987a90c5a74aec4ec4b0e068830e5108600..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/ui/clientsettings/about/ContributorAdapter.kt +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.ui.clientsettings.about - -import android.view.LayoutInflater -import android.view.ViewGroup -import androidx.recyclerview.widget.RecyclerView -import de.kuschku.quasseldroid.databinding.WidgetContributorBinding - -class ContributorAdapter(private val contributors: List<Contributor>) : - RecyclerView.Adapter<ContributorAdapter.ContributorViewHolder>() { - override fun onCreateViewHolder(parent: ViewGroup, viewType: Int) = ContributorViewHolder( - WidgetContributorBinding.inflate(LayoutInflater.from(parent.context), parent, false) - ) - - override fun getItemCount() = contributors.size - - override fun onBindViewHolder(holder: ContributorViewHolder, position: Int) { - holder.bind(contributors[position]) - } - - class ContributorViewHolder( - private val binding: WidgetContributorBinding - ) : RecyclerView.ViewHolder(binding.root) { - fun bind(item: Contributor) { - binding.name.text = item.name - binding.nickname.text = item.nickName - binding.description.text = item.description - } - } -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/ui/clientsettings/about/Library.kt b/app/src/main/java/de/kuschku/quasseldroid/ui/clientsettings/about/Library.kt deleted file mode 100644 index e082f42055fb37466e48b1aac8bc8a9ded476bfb..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/ui/clientsettings/about/Library.kt +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.ui.clientsettings.about - -data class Library( - val name: String, - val version: String? = null, - val license: License, - val url: String? = null -) diff --git a/app/src/main/java/de/kuschku/quasseldroid/ui/clientsettings/about/LibraryAdapter.kt b/app/src/main/java/de/kuschku/quasseldroid/ui/clientsettings/about/LibraryAdapter.kt deleted file mode 100644 index 580a3346092216c3a0abb4735a74b2388ded48ab..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/ui/clientsettings/about/LibraryAdapter.kt +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.ui.clientsettings.about - -import android.view.LayoutInflater -import android.view.ViewGroup -import androidx.recyclerview.widget.RecyclerView -import de.kuschku.quasseldroid.databinding.WidgetLibraryBinding -import de.kuschku.quasseldroid.ui.clientsettings.license.LicenseActivity -import de.kuschku.quasseldroid.util.helper.visibleIf - -class LibraryAdapter(private val libraries: List<Library>) : - RecyclerView.Adapter<LibraryAdapter.LibraryViewHolder>() { - override fun onCreateViewHolder(parent: ViewGroup, viewType: Int) = LibraryViewHolder( - WidgetLibraryBinding.inflate(LayoutInflater.from(parent.context), parent, false) - ) - - override fun getItemCount() = libraries.size - - override fun onBindViewHolder(holder: LibraryViewHolder, position: Int) { - holder.bind(libraries[position]) - } - - class LibraryViewHolder( - private val binding: WidgetLibraryBinding - ) : RecyclerView.ViewHolder(binding.root) { - private var item: Library? = null - - init { - itemView.setOnClickListener { - this.item?.run { - LicenseActivity.launch(itemView.context, - license_name = license.fullName, - license_text = license.text) - } - } - } - - fun bind(item: Library) { - this.item = item - binding.name.text = item.name - binding.version.text = item.version - binding.version.visibleIf(!item.version.isNullOrBlank()) - binding.license.text = item.license.shortName - } - } -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/ui/clientsettings/about/License.kt b/app/src/main/java/de/kuschku/quasseldroid/ui/clientsettings/about/License.kt deleted file mode 100644 index 273b65e4ed9f238699820540dde54e52fac714ff..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/ui/clientsettings/about/License.kt +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.ui.clientsettings.about - -import androidx.annotation.RawRes - -data class License( - val shortName: String, - val fullName: String = shortName, - @RawRes val text: Int -) diff --git a/app/src/main/java/de/kuschku/quasseldroid/ui/clientsettings/about/Translator.kt b/app/src/main/java/de/kuschku/quasseldroid/ui/clientsettings/about/Translator.kt deleted file mode 100644 index 1a34b5001788c5e60210f8497d9a0106f73b1a68..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/ui/clientsettings/about/Translator.kt +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.ui.clientsettings.about - -import androidx.annotation.StringRes - -data class Translator( - val name: String, - @StringRes val language: Int -) diff --git a/app/src/main/java/de/kuschku/quasseldroid/ui/clientsettings/about/TranslatorAdapter.kt b/app/src/main/java/de/kuschku/quasseldroid/ui/clientsettings/about/TranslatorAdapter.kt deleted file mode 100644 index eed99ce24ff7aab979063bf71b4b3bde39be1955..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/ui/clientsettings/about/TranslatorAdapter.kt +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.ui.clientsettings.about - -import android.view.LayoutInflater -import android.view.ViewGroup -import androidx.recyclerview.widget.RecyclerView -import de.kuschku.quasseldroid.databinding.WidgetTranslatorBinding - -class TranslatorAdapter(private val translators: List<Translator>) : - RecyclerView.Adapter<TranslatorAdapter.TranslatorViewHolder>() { - override fun onCreateViewHolder(parent: ViewGroup, viewType: Int) = TranslatorViewHolder( - WidgetTranslatorBinding.inflate( - LayoutInflater.from(parent.context), parent, false - ) - ) - - override fun getItemCount() = translators.size - - override fun onBindViewHolder(holder: TranslatorViewHolder, position: Int) { - holder.bind(translators[position]) - } - - class TranslatorViewHolder( - private val binding: WidgetTranslatorBinding - ) : RecyclerView.ViewHolder(binding.root) { - fun bind(item: Translator) { - binding.name.text = item.name - binding.language.text = itemView.resources.getString(item.language) - } - } -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/ui/clientsettings/client/ClientSettingsActivity.kt b/app/src/main/java/de/kuschku/quasseldroid/ui/clientsettings/client/ClientSettingsActivity.kt deleted file mode 100644 index 2997cde643f6af06d7615245dd2e86141df898e5..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/ui/clientsettings/client/ClientSettingsActivity.kt +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.ui.clientsettings.client - -import android.content.Context -import android.content.Intent -import androidx.preference.ListPreference -import androidx.preference.Preference -import androidx.preference.PreferenceFragmentCompat -import de.kuschku.quasseldroid.util.ui.settings.ListPreferenceDialogFragmentCompat -import de.kuschku.quasseldroid.util.ui.settings.SettingsActivity - -class ClientSettingsActivity : SettingsActivity(ClientSettingsFragment()), - PreferenceFragmentCompat.OnPreferenceDisplayDialogCallback { - override fun onPreferenceDisplayDialog(caller: PreferenceFragmentCompat, pref: Preference?) = - when (pref) { - is ListPreference -> { - val f = ListPreferenceDialogFragmentCompat.newInstance(pref.getKey()) - f.setTargetFragment(actualFragment, 0) - f.show(supportFragmentManager, DIALOG_FRAGMENT_TAG) - true - } - else -> false - } - - companion object { - private const val DIALOG_FRAGMENT_TAG = "android.support.v7.preference.PreferenceFragment.DIALOG" - - fun launch(context: Context) = context.startActivity(intent(context)) - fun intent(context: Context) = Intent(context, ClientSettingsActivity::class.java) - } -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/ui/clientsettings/client/ClientSettingsFragment.kt b/app/src/main/java/de/kuschku/quasseldroid/ui/clientsettings/client/ClientSettingsFragment.kt deleted file mode 100644 index 78c7147c5346151c50ae6658b63cdba3f2466faa..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/ui/clientsettings/client/ClientSettingsFragment.kt +++ /dev/null @@ -1,139 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.ui.clientsettings.client - -import android.content.SharedPreferences -import android.os.Build -import android.os.Bundle -import android.os.Handler -import android.os.HandlerThread -import android.view.Menu -import android.view.MenuInflater -import android.view.MenuItem -import androidx.preference.ListPreference -import androidx.preference.Preference -import androidx.preference.PreferenceGroup -import de.kuschku.quasseldroid.R -import de.kuschku.quasseldroid.persistence.db.QuasselDatabase -import de.kuschku.quasseldroid.settings.AppearanceSettings -import de.kuschku.quasseldroid.settings.Settings -import de.kuschku.quasseldroid.ui.clientsettings.about.AboutActivity -import de.kuschku.quasseldroid.ui.clientsettings.crash.CrashActivity -import de.kuschku.quasseldroid.ui.clientsettings.whitelist.WhitelistActivity -import de.kuschku.quasseldroid.util.ui.settings.DaggerPreferenceFragmentCompat -import javax.inject.Inject - -class ClientSettingsFragment : DaggerPreferenceFragmentCompat(), - SharedPreferences.OnSharedPreferenceChangeListener { - - @Inject - lateinit var appearanceSettings: AppearanceSettings - - private lateinit var handlerThread: HandlerThread - private lateinit var handler: Handler - - override fun onCreate(savedInstanceState: Bundle?) { - super.onCreate(savedInstanceState) - setHasOptionsMenu(true) - - handlerThread = HandlerThread("ClientSettings") - handlerThread.start() - handler = Handler(handlerThread.looper) - } - - override fun onDestroy() { - super.onDestroy() - handlerThread.quit() - } - - override fun onCreatePreferences(savedInstanceState: Bundle?, rootKey: String?) { - setPreferencesFromResource(R.xml.preferences, rootKey) - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { - findPreference<Preference>(getString(R.string.preference_notification_sound_key))?.isVisible = false - findPreference<Preference>(getString(R.string.preference_notification_vibration_key))?.isVisible = false - findPreference<Preference>(getString(R.string.preference_notification_light_key))?.isVisible = false - } else { - findPreference<Preference>(getString(R.string.preference_notification_configure_key))?.isVisible = false - } - findPreference<Preference>(getString(R.string.preference_clear_cache_key))?.setOnPreferenceClickListener { - activity?.let { - handler.post { - QuasselDatabase.Creator.init(it).message().clearMessages() - } - } - true - } - } - - override fun onStart() { - super.onStart() - preferenceScreen.sharedPreferences.registerOnSharedPreferenceChangeListener(this) - initSummary(preferenceScreen) - } - - override fun onStop() { - preferenceScreen.sharedPreferences.unregisterOnSharedPreferenceChangeListener(this) - super.onStop() - } - - override fun onSharedPreferenceChanged(sharedPreferences: SharedPreferences?, key: String) { - updateSummary(findPreference(key) as? ListPreference) - val appearanceSettings = Settings.appearance(context!!) - if (this.appearanceSettings.theme != appearanceSettings.theme || - this.appearanceSettings.language != appearanceSettings.language) { - activity?.recreate() - } - } - - private fun updateSummary(preference: ListPreference?) { - if (preference != null) { - preference.summary = preference.entry - } - } - - private fun initSummary(preference: Preference) { - if (preference is PreferenceGroup) { - (0 until preference.preferenceCount).asSequence().map(preference::getPreference).forEach(::initSummary) - } else if (preference is ListPreference) { - updateSummary(preference) - } - } - - override fun onCreateOptionsMenu(menu: Menu, inflater: MenuInflater) { - inflater.inflate(R.menu.activity_settings, menu) - super.onCreateOptionsMenu(menu, inflater) - } - - override fun onOptionsItemSelected(item: MenuItem) = when (item.itemId) { - R.id.action_certificates -> { - WhitelistActivity.launch(requireContext()) - true - } - R.id.action_crashes -> { - CrashActivity.launch(requireContext()) - true - } - R.id.action_about -> { - AboutActivity.launch(requireContext()) - true - } - else -> super.onOptionsItemSelected(item) - } -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/ui/clientsettings/client/ClientSettingsFragmentProvider.kt b/app/src/main/java/de/kuschku/quasseldroid/ui/clientsettings/client/ClientSettingsFragmentProvider.kt deleted file mode 100644 index 41e06ae35d75f1d25e6e2d7f240a4eac53853c43..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/ui/clientsettings/client/ClientSettingsFragmentProvider.kt +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.ui.clientsettings.client - -import androidx.fragment.app.FragmentActivity -import dagger.Binds -import dagger.Module -import dagger.android.ContributesAndroidInjector - -@Module -abstract class ClientSettingsFragmentProvider { - @Binds - abstract fun bindFragmentActivity(activity: ClientSettingsActivity): FragmentActivity - - @ContributesAndroidInjector - abstract fun bindClientSettingsFragment(): ClientSettingsFragment -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/ui/clientsettings/crash/CrashActivity.kt b/app/src/main/java/de/kuschku/quasseldroid/ui/clientsettings/crash/CrashActivity.kt deleted file mode 100644 index aec4928779945c4aaf6d5b60e88fafe1cac8bcce..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/ui/clientsettings/crash/CrashActivity.kt +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.ui.clientsettings.crash - -import android.content.Context -import android.content.Intent -import de.kuschku.quasseldroid.util.ui.settings.SettingsActivity - -class CrashActivity : SettingsActivity(CrashFragment()) { - companion object { - fun launch(context: Context) = context.startActivity(intent(context)) - fun intent(context: Context) = Intent(context, CrashActivity::class.java) - } -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/ui/clientsettings/crash/CrashAdapter.kt b/app/src/main/java/de/kuschku/quasseldroid/ui/clientsettings/crash/CrashAdapter.kt deleted file mode 100644 index f53335c5ac4fedde064ce77831bae2bed08d95d3..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/ui/clientsettings/crash/CrashAdapter.kt +++ /dev/null @@ -1,100 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.ui.clientsettings.crash - -import android.content.Intent -import android.net.Uri -import android.view.LayoutInflater -import android.view.ViewGroup -import androidx.recyclerview.widget.DiffUtil -import androidx.recyclerview.widget.RecyclerView -import de.kuschku.malheur.data.Report -import de.kuschku.quasseldroid.R -import de.kuschku.quasseldroid.databinding.WidgetCrashBinding -import de.kuschku.quasseldroid.util.lists.ListAdapter -import org.threeten.bp.Instant -import org.threeten.bp.ZoneId -import org.threeten.bp.format.DateTimeFormatter - -class CrashAdapter : ListAdapter<Pair<Report?, Uri>, CrashAdapter.CrashViewHolder>( - object : DiffUtil.ItemCallback<Pair<Report?, Uri>>() { - override fun areItemsTheSame(oldItem: Pair<Report?, Uri>, newItem: Pair<Report?, Uri>) = - oldItem.second == newItem.second - - override fun areContentsTheSame(oldItem: Pair<Report?, Uri>, newItem: Pair<Report?, Uri>) = - oldItem == newItem - } -) { - private var onUpdateListener: ((List<Pair<Report?, Uri>>) -> Unit)? = null - fun setOnUpdateListener(listener: ((List<Pair<Report?, Uri>>) -> Unit)?) { - onUpdateListener = listener - } - - override fun onUpdateFinished(list: List<Pair<Report?, Uri>>) { - onUpdateListener?.invoke(list) - } - - override fun onCreateViewHolder(parent: ViewGroup, viewType: Int) = CrashViewHolder( - WidgetCrashBinding.inflate(LayoutInflater.from(parent.context), parent, false) - ) - - override fun onBindViewHolder(holder: CrashViewHolder, position: Int) { - val (report, uri) = getItem(position) - holder.bind(report, uri) - } - - class CrashViewHolder( - private val binding: WidgetCrashBinding - ) : RecyclerView.ViewHolder(binding.root) { - - private var item: Report? = null - private var uri: Uri? = null - - private val dateTimeFormatter = DateTimeFormatter.ofPattern("uuuu-MM-dd HH:mm:ss") - - init { - itemView.setOnClickListener { - uri?.let { - itemView.context.startActivity( - Intent.createChooser( - Intent(Intent.ACTION_SEND).apply { - type = "application/json" - putExtra(Intent.EXTRA_STREAM, uri) - flags = Intent.FLAG_GRANT_READ_URI_PERMISSION - }, - itemView.context.getString(R.string.label_share_crashreport) - ) - ) - } - } - } - - fun bind(item: Report?, uri: Uri) { - this.item = item - this.uri = uri - - binding.crashTime.text = item?.environment?.crashTime?.let { - dateTimeFormatter.format(Instant.ofEpochMilli(it).atZone(ZoneId.systemDefault())) - } ?: "null" - binding.versionName.text = item?.application?.versionName ?: "null" - binding.error.text = item?.crash?.exception?.lines()?.firstOrNull() ?: "null" - } - } -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/ui/clientsettings/crash/CrashFragment.kt b/app/src/main/java/de/kuschku/quasseldroid/ui/clientsettings/crash/CrashFragment.kt deleted file mode 100644 index 2e3f47d5e340ba5e40896404aa6a8a22d3484443..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/ui/clientsettings/crash/CrashFragment.kt +++ /dev/null @@ -1,150 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.ui.clientsettings.crash - -import android.net.Uri -import android.os.Bundle -import android.os.Handler -import android.os.HandlerThread -import android.view.* -import android.widget.TextView -import androidx.core.content.FileProvider -import androidx.core.view.ViewCompat -import androidx.recyclerview.widget.DividerItemDecoration -import androidx.recyclerview.widget.LinearLayoutManager -import androidx.recyclerview.widget.RecyclerView -import butterknife.BindView -import butterknife.ButterKnife -import com.google.gson.Gson -import com.google.gson.JsonSyntaxException -import dagger.android.support.DaggerFragment -import de.kuschku.malheur.CrashHandler -import de.kuschku.malheur.data.Report -import de.kuschku.quasseldroid.BuildConfig -import de.kuschku.quasseldroid.R -import de.kuschku.quasseldroid.util.helper.fromJson -import de.kuschku.quasseldroid.util.helper.visibleIf -import java.io.File -import javax.inject.Inject - -class CrashFragment : DaggerFragment() { - @BindView(R.id.list) - lateinit var list: RecyclerView - - @BindView(R.id.crashes_empty) - lateinit var crashesEmpty: TextView - - private lateinit var handlerThread: HandlerThread - private lateinit var handler: Handler - - @Inject - lateinit var gson: Gson - - private var crashDir: File? = null - private var adapter: CrashAdapter? = null - - override fun onCreate(savedInstanceState: Bundle?) { - super.onCreate(savedInstanceState) - handlerThread = HandlerThread("Crash") - handlerThread.start() - handler = Handler(handlerThread.looper) - } - - override fun onDestroy() { - super.onDestroy() - handlerThread.quit() - } - - private fun reload() { - val crashDir = this.crashDir - val gson = this.gson - val context = this.context - - if (crashDir != null && context != null) { - crashDir.mkdirs() - val list: List<Pair<Report?, Uri>> = crashDir.listFiles() - .orEmpty() - .map { - Pair<Report?, Uri>( - try { - gson.fromJson<Report>(it.readText()) - } catch (e: JsonSyntaxException) { - null - }, - FileProvider.getUriForFile(context, "${BuildConfig.APPLICATION_ID}.fileprovider", it) - ) - } - .sortedByDescending { it.first?.environment?.crashTime } - - activity?.runOnUiThread { - this.adapter?.submitList(list) - } - } - } - - override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, - savedInstanceState: Bundle?): View? { - val view = inflater.inflate(R.layout.preferences_crash, container, false) - ButterKnife.bind(this, view) - - setHasOptionsMenu(true) - - this.adapter = CrashAdapter() - this.crashDir = File(requireContext().cacheDir, "crashes") - - list.layoutManager = LinearLayoutManager(context) - list.adapter = adapter - list.addItemDecoration(DividerItemDecoration(context, LinearLayoutManager.VERTICAL)) - ViewCompat.setNestedScrollingEnabled(list, false) - - adapter?.setOnUpdateListener { - crashesEmpty.visibleIf(it.isEmpty()) - } - - handler.post(this::reload) - return view - } - - override fun onCreateOptionsMenu(menu: Menu, inflater: MenuInflater) { - inflater.inflate(R.menu.activity_crashes, menu) - menu.findItem(R.id.action_generate_crash_report).isVisible = BuildConfig.DEBUG - super.onCreateOptionsMenu(menu, inflater) - } - - override fun onOptionsItemSelected(item: MenuItem) = when (item.itemId) { - R.id.action_generate_crash_report -> { - handler.post { - CrashHandler.handleSync(Exception("User requested generation of report")) - reload() - } - } - R.id.action_delete_all -> { - handler.post { - crashDir?.mkdirs() - crashDir?.listFiles()?.forEach { - it.delete() - } - reload() - } - true - } - else -> super.onOptionsItemSelected(item) - } -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/ui/clientsettings/crash/CrashFragmentProvider.kt b/app/src/main/java/de/kuschku/quasseldroid/ui/clientsettings/crash/CrashFragmentProvider.kt deleted file mode 100644 index f20f6f46094594e2e98178557691097a01522213..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/ui/clientsettings/crash/CrashFragmentProvider.kt +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.ui.clientsettings.crash - -import androidx.fragment.app.FragmentActivity -import dagger.Binds -import dagger.Module -import dagger.android.ContributesAndroidInjector - -@Module -abstract class CrashFragmentProvider { - @Binds - abstract fun bindFragmentActivity(activity: CrashActivity): FragmentActivity - - @ContributesAndroidInjector - abstract fun bindClientSettingsFragment(): CrashFragment -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/ui/clientsettings/license/LicenseActivity.kt b/app/src/main/java/de/kuschku/quasseldroid/ui/clientsettings/license/LicenseActivity.kt deleted file mode 100644 index 4e25c57d65e0c3041eaf14c4bbefa0d5a7c23a66..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/ui/clientsettings/license/LicenseActivity.kt +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.ui.clientsettings.license - -import android.content.Context -import android.content.Intent -import androidx.annotation.RawRes -import de.kuschku.quasseldroid.util.ui.settings.SettingsActivity - -class LicenseActivity : SettingsActivity(LicenseFragment()) { - companion object { - fun launch( - context: Context, - license_name: String, - @RawRes license_text: Int - ) = context.startActivity(intent(context, license_name, license_text)) - - fun intent( - context: Context, - license_name: String, - @RawRes license_text: Int - ) = Intent(context, LicenseActivity::class.java).apply { - putExtra("license_name", license_name) - putExtra("license_text", license_text) - } - } -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/ui/clientsettings/license/LicenseFragment.kt b/app/src/main/java/de/kuschku/quasseldroid/ui/clientsettings/license/LicenseFragment.kt deleted file mode 100644 index ffe751dfe7b33ae91449de88c1fa8048d4edf7d9..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/ui/clientsettings/license/LicenseFragment.kt +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.ui.clientsettings.license - -import android.os.Bundle -import android.text.Html -import android.view.LayoutInflater -import android.view.View -import android.view.ViewGroup -import android.widget.TextView -import butterknife.BindView -import butterknife.ButterKnife -import dagger.android.support.DaggerFragment -import de.kuschku.quasseldroid.R - -class LicenseFragment : DaggerFragment() { - @BindView(R.id.text) - lateinit var text: TextView - - override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, - savedInstanceState: Bundle?): View? { - val view = inflater.inflate(R.layout.preferences_license, container, false) - ButterKnife.bind(this, view) - - val textResource = arguments?.getInt("license_text", 0) ?: 0 - if (textResource != 0) { - text.text = Html.fromHtml(resources.openRawResource(textResource).bufferedReader(Charsets.UTF_8).readText()) - } - - return view - } -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/ui/clientsettings/license/LicenseFragmentProvider.kt b/app/src/main/java/de/kuschku/quasseldroid/ui/clientsettings/license/LicenseFragmentProvider.kt deleted file mode 100644 index 07cf71735eedf60da246be8d9b7d64cf60de0e1a..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/ui/clientsettings/license/LicenseFragmentProvider.kt +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.ui.clientsettings.license - -import androidx.fragment.app.FragmentActivity -import dagger.Binds -import dagger.Module -import dagger.android.ContributesAndroidInjector - -@Module -abstract class LicenseFragmentProvider { - @Binds - abstract fun bindFragmentActivity(activity: LicenseActivity): FragmentActivity - - @ContributesAndroidInjector - abstract fun bindLicenseFragment(): LicenseFragment -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/ui/clientsettings/whitelist/Whitelist.kt b/app/src/main/java/de/kuschku/quasseldroid/ui/clientsettings/whitelist/Whitelist.kt deleted file mode 100644 index 6b313f428f5f0a54e5494e22736b4173542cb111..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/ui/clientsettings/whitelist/Whitelist.kt +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.ui.clientsettings.whitelist - -import de.kuschku.quasseldroid.persistence.models.SslHostnameWhitelistEntry -import de.kuschku.quasseldroid.persistence.models.SslValidityWhitelistEntry - -data class Whitelist( - val certificates: List<SslValidityWhitelistEntry>, - val hostnames: List<SslHostnameWhitelistEntry> -) diff --git a/app/src/main/java/de/kuschku/quasseldroid/ui/clientsettings/whitelist/WhitelistActivity.kt b/app/src/main/java/de/kuschku/quasseldroid/ui/clientsettings/whitelist/WhitelistActivity.kt deleted file mode 100644 index d8d871c6e063ec7aebc6e4a42f48619fd3c3a2c1..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/ui/clientsettings/whitelist/WhitelistActivity.kt +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.ui.clientsettings.whitelist - -import android.content.Context -import android.content.Intent -import de.kuschku.quasseldroid.util.ui.settings.SettingsActivity - -class WhitelistActivity : SettingsActivity(WhitelistFragment()) { - companion object { - fun launch(context: Context) = context.startActivity(intent(context)) - fun intent(context: Context) = Intent(context, WhitelistActivity::class.java) - } -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/ui/clientsettings/whitelist/WhitelistCertificateAdapter.kt b/app/src/main/java/de/kuschku/quasseldroid/ui/clientsettings/whitelist/WhitelistCertificateAdapter.kt deleted file mode 100644 index b9c33fc215d7e40a21dbff7adea9054693abda9f..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/ui/clientsettings/whitelist/WhitelistCertificateAdapter.kt +++ /dev/null @@ -1,112 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.ui.clientsettings.whitelist - -import android.view.LayoutInflater -import android.view.ViewGroup -import androidx.recyclerview.widget.RecyclerView -import de.kuschku.quasseldroid.databinding.PreferencesWhitelistCertificateItemBinding -import de.kuschku.quasseldroid.persistence.models.SslValidityWhitelistEntry -import de.kuschku.quasseldroid.util.helper.setTooltip -import de.kuschku.quasseldroid.util.helper.visibleIf - -class WhitelistCertificateAdapter : - RecyclerView.Adapter<WhitelistCertificateAdapter.WhitelistItemViewHolder>() { - private var clickListener: ((SslValidityWhitelistEntry) -> Unit)? = null - private var updateListener: ((List<SslValidityWhitelistEntry>) -> Unit)? = null - - fun setOnClickListener(listener: ((SslValidityWhitelistEntry) -> Unit)?) { - clickListener = listener - } - - fun setOnUpdateListener(listener: ((List<SslValidityWhitelistEntry>) -> Unit)?) { - updateListener = listener - } - - private val data = mutableListOf<SslValidityWhitelistEntry>() - var list: List<SslValidityWhitelistEntry> - get() = data - set(value) { - val length = data.size - data.clear() - notifyItemRangeRemoved(0, length) - data.addAll(value) - notifyItemRangeInserted(0, list.size) - updateListener?.invoke(list) - } - - fun add(item: SslValidityWhitelistEntry) { - val index = data.size - data.add(item) - notifyItemInserted(index) - updateListener?.invoke(list) - } - - fun replace(index: Int, item: SslValidityWhitelistEntry) { - data[index] = item - notifyItemChanged(index) - updateListener?.invoke(list) - } - - fun indexOf(item: SslValidityWhitelistEntry) = data.indexOf(item) - - fun remove(index: Int) { - data.removeAt(index) - notifyItemRemoved(index) - updateListener?.invoke(list) - } - - fun remove(item: SslValidityWhitelistEntry) = remove(indexOf(item)) - - override fun getItemCount() = data.size - - override fun onCreateViewHolder(parent: ViewGroup, viewType: Int) = WhitelistItemViewHolder( - PreferencesWhitelistCertificateItemBinding.inflate( - LayoutInflater.from(parent.context), parent, false - ), - ::remove - ) - - override fun onBindViewHolder(holder: WhitelistItemViewHolder, position: Int) { - holder.bind(data[position]) - } - - class WhitelistItemViewHolder( - private val binding: PreferencesWhitelistCertificateItemBinding, - clickListener: ((SslValidityWhitelistEntry) -> Unit)? - ) : RecyclerView.ViewHolder(binding.root) { - private var item: SslValidityWhitelistEntry? = null - - init { - binding.actionDelete.setOnClickListener { - item?.let { - clickListener?.invoke(it) - } - } - binding.actionDelete.setTooltip() - } - - fun bind(item: SslValidityWhitelistEntry) { - this.item = item - binding.fingerprint.text = item.fingerprint - binding.ignoreDate.visibleIf(item.ignoreDate) - } - } -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/ui/clientsettings/whitelist/WhitelistFragment.kt b/app/src/main/java/de/kuschku/quasseldroid/ui/clientsettings/whitelist/WhitelistFragment.kt deleted file mode 100644 index fa37fe40dd8ed69acac7ec12e8927133b04858a9..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/ui/clientsettings/whitelist/WhitelistFragment.kt +++ /dev/null @@ -1,142 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.ui.clientsettings.whitelist - -import android.os.Bundle -import android.os.Handler -import android.os.HandlerThread -import android.view.LayoutInflater -import android.view.View -import android.view.ViewGroup -import android.widget.TextView -import androidx.core.view.ViewCompat -import androidx.recyclerview.widget.DividerItemDecoration -import androidx.recyclerview.widget.LinearLayoutManager -import androidx.recyclerview.widget.RecyclerView -import butterknife.BindView -import butterknife.ButterKnife -import de.kuschku.quasseldroid.R -import de.kuschku.quasseldroid.persistence.db.QuasselDatabase -import de.kuschku.quasseldroid.util.helper.visibleIf -import de.kuschku.quasseldroid.util.ui.settings.fragment.Changeable -import de.kuschku.quasseldroid.util.ui.settings.fragment.Savable -import de.kuschku.quasseldroid.util.ui.settings.fragment.SettingsFragment -import javax.inject.Inject - -class WhitelistFragment : SettingsFragment(), Changeable, - Savable { - @BindView(R.id.certificate_whitelist) - lateinit var certificateList: RecyclerView - - @BindView(R.id.certificate_whitelist_empty) - lateinit var certificateListEmpty: TextView - - @BindView(R.id.hostname_whitelist) - lateinit var hostnameList: RecyclerView - - @BindView(R.id.hostname_whitelist_empty) - lateinit var hostnameListEmpty: TextView - - @Inject - lateinit var database: QuasselDatabase - - private var whitelist: Whitelist? = null - - private lateinit var handlerThread: HandlerThread - private lateinit var handler: Handler - - private var certificateAdapter = WhitelistCertificateAdapter() - private var hostnameAdapter = WhitelistHostnameAdapter() - - override fun onCreate(savedInstanceState: Bundle?) { - super.onCreate(savedInstanceState) - handlerThread = HandlerThread("Whitelist") - handlerThread.start() - handler = Handler(handlerThread.looper) - } - - override fun onDestroy() { - super.onDestroy() - handlerThread.quit() - } - - override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, - savedInstanceState: Bundle?): View? { - val view = inflater.inflate(R.layout.preferences_whitelist, container, false) - ButterKnife.bind(this, view) - - setHasOptionsMenu(true) - - certificateList.layoutManager = LinearLayoutManager(context) - certificateList.adapter = certificateAdapter - certificateList.addItemDecoration(DividerItemDecoration(context, LinearLayoutManager.VERTICAL)) - ViewCompat.setNestedScrollingEnabled(certificateList, false) - - hostnameList.layoutManager = LinearLayoutManager(context) - hostnameList.adapter = hostnameAdapter - hostnameList.addItemDecoration(DividerItemDecoration(context, LinearLayoutManager.VERTICAL)) - ViewCompat.setNestedScrollingEnabled(hostnameList, false) - - certificateAdapter.setOnUpdateListener { - activity?.runOnUiThread { - certificateListEmpty.visibleIf(it.isNullOrEmpty()) - } - } - - hostnameAdapter.setOnUpdateListener { - activity?.runOnUiThread { - hostnameListEmpty.visibleIf(it.isNullOrEmpty()) - } - } - - handler.post { - whitelist = Whitelist(database.validityWhitelist().all(), database.hostnameWhitelist().all()) - whitelist?.let { - activity?.runOnUiThread { - certificateAdapter.list = it.certificates - hostnameAdapter.list = it.hostnames - } - } - } - return view - } - - fun applyChanges() = Whitelist( - certificateAdapter.list, - hostnameAdapter.list - ) - - override fun onSave() = whitelist?.let { - val data = applyChanges() - handler.post { - database.runInTransaction { - for (item in it.certificates - data.certificates) { - database.validityWhitelist().delete(item.fingerprint) - } - for (item in it.hostnames - data.hostnames) { - database.hostnameWhitelist().delete(item.fingerprint, item.hostname) - } - } - } - true - } ?: false - - override fun hasChanged() = whitelist != applyChanges() -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/ui/clientsettings/whitelist/WhitelistFragmentProvider.kt b/app/src/main/java/de/kuschku/quasseldroid/ui/clientsettings/whitelist/WhitelistFragmentProvider.kt deleted file mode 100644 index 0dd6a2efe363142676b5a1f73e9d280694b87d48..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/ui/clientsettings/whitelist/WhitelistFragmentProvider.kt +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.ui.clientsettings.whitelist - -import androidx.fragment.app.FragmentActivity -import dagger.Binds -import dagger.Module -import dagger.android.ContributesAndroidInjector - -@Module -abstract class WhitelistFragmentProvider { - @Binds - abstract fun bindFragmentActivity(activity: WhitelistActivity): FragmentActivity - - @ContributesAndroidInjector - abstract fun bindWhitelistFragment(): WhitelistFragment -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/ui/clientsettings/whitelist/WhitelistHostnameAdapter.kt b/app/src/main/java/de/kuschku/quasseldroid/ui/clientsettings/whitelist/WhitelistHostnameAdapter.kt deleted file mode 100644 index c257748ecb336f0b7b468e371e25c2aec1019f49..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/ui/clientsettings/whitelist/WhitelistHostnameAdapter.kt +++ /dev/null @@ -1,106 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.ui.clientsettings.whitelist - -import android.view.LayoutInflater -import android.view.ViewGroup -import androidx.recyclerview.widget.RecyclerView -import de.kuschku.quasseldroid.databinding.PreferencesWhitelistHostnameItemBinding -import de.kuschku.quasseldroid.persistence.models.SslHostnameWhitelistEntry -import de.kuschku.quasseldroid.util.helper.setTooltip - -class WhitelistHostnameAdapter : - RecyclerView.Adapter<WhitelistHostnameAdapter.WhitelistItemViewHolder>() { - private var updateListener: ((List<SslHostnameWhitelistEntry>) -> Unit)? = null - - fun setOnUpdateListener(listener: ((List<SslHostnameWhitelistEntry>) -> Unit)?) { - updateListener = listener - } - - private val data = mutableListOf<SslHostnameWhitelistEntry>() - var list: List<SslHostnameWhitelistEntry> - get() = data - set(value) { - val length = data.size - data.clear() - notifyItemRangeRemoved(0, length) - data.addAll(value) - notifyItemRangeInserted(0, list.size) - updateListener?.invoke(list) - } - - fun add(item: SslHostnameWhitelistEntry) { - val index = data.size - data.add(item) - notifyItemInserted(index) - updateListener?.invoke(list) - } - - fun replace(index: Int, item: SslHostnameWhitelistEntry) { - data[index] = item - notifyItemChanged(index) - updateListener?.invoke(list) - } - - fun indexOf(item: SslHostnameWhitelistEntry) = data.indexOf(item) - - fun remove(index: Int) { - data.removeAt(index) - notifyItemRemoved(index) - updateListener?.invoke(list) - } - - fun remove(item: SslHostnameWhitelistEntry) = remove(indexOf(item)) - - override fun getItemCount() = data.size - - override fun onCreateViewHolder(parent: ViewGroup, viewType: Int) = WhitelistItemViewHolder( - PreferencesWhitelistHostnameItemBinding.inflate( - LayoutInflater.from(parent.context), parent, false - ), - ::remove - ) - - override fun onBindViewHolder(holder: WhitelistItemViewHolder, position: Int) { - holder.bind(data[position]) - } - - class WhitelistItemViewHolder( - private val binding: PreferencesWhitelistHostnameItemBinding, - clickListener: ((SslHostnameWhitelistEntry) -> Unit)? - ) : RecyclerView.ViewHolder(binding.root) { - private var item: SslHostnameWhitelistEntry? = null - - init { - binding.actionDelete.setOnClickListener { - item?.let { - clickListener?.invoke(it) - } - } - binding.actionDelete.setTooltip() - } - - fun bind(item: SslHostnameWhitelistEntry) { - this.item = item - binding.hostname.text = item.hostname - binding.fingerprint.text = item.fingerprint - } - } -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/ui/coresettings/CoreSettingsActivity.kt b/app/src/main/java/de/kuschku/quasseldroid/ui/coresettings/CoreSettingsActivity.kt deleted file mode 100644 index 64f311cf6336badeffd9df55dfc8eba94c1dc1c9..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/ui/coresettings/CoreSettingsActivity.kt +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.ui.coresettings - -import android.content.Context -import android.content.Intent -import de.kuschku.quasseldroid.util.ui.settings.ServiceBoundSettingsActivity - -class CoreSettingsActivity : ServiceBoundSettingsActivity(CoreSettingsFragment()) { - companion object { - fun launch(context: Context) = context.startActivity(intent(context)) - fun intent(context: Context) = Intent(context, CoreSettingsActivity::class.java) - } -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/ui/coresettings/CoreSettingsFragment.kt b/app/src/main/java/de/kuschku/quasseldroid/ui/coresettings/CoreSettingsFragment.kt deleted file mode 100644 index 274ca3febdeaaf2ded2e8cf00a12c92c1bd3c0a6..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/ui/coresettings/CoreSettingsFragment.kt +++ /dev/null @@ -1,234 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.ui.coresettings - -import android.os.Bundle -import android.view.LayoutInflater -import android.view.View -import android.view.ViewGroup -import android.widget.Button -import androidx.core.view.ViewCompat -import androidx.lifecycle.Observer -import androidx.recyclerview.widget.DividerItemDecoration -import androidx.recyclerview.widget.LinearLayoutManager -import androidx.recyclerview.widget.RecyclerView -import butterknife.BindView -import butterknife.ButterKnife -import de.kuschku.libquassel.protocol.IdentityId -import de.kuschku.libquassel.protocol.NetworkId -import de.kuschku.libquassel.quassel.syncables.BufferViewConfig -import de.kuschku.libquassel.quassel.syncables.Identity -import de.kuschku.libquassel.quassel.syncables.Network -import de.kuschku.libquassel.util.helper.combineLatest -import de.kuschku.libquassel.util.helper.safeSwitchMap -import de.kuschku.quasseldroid.R -import de.kuschku.quasseldroid.ui.coresettings.aliaslist.AliasListActivity -import de.kuschku.quasseldroid.ui.coresettings.chatlist.ChatlistCreateActivity -import de.kuschku.quasseldroid.ui.coresettings.chatlist.ChatlistEditActivity -import de.kuschku.quasseldroid.ui.coresettings.highlightlist.HighlightListActivity -import de.kuschku.quasseldroid.ui.coresettings.identity.IdentityCreateActivity -import de.kuschku.quasseldroid.ui.coresettings.identity.IdentityEditActivity -import de.kuschku.quasseldroid.ui.coresettings.ignorelist.IgnoreListActivity -import de.kuschku.quasseldroid.ui.coresettings.network.NetworkCreateActivity -import de.kuschku.quasseldroid.ui.coresettings.network.NetworkEditActivity -import de.kuschku.quasseldroid.ui.coresettings.networkconfig.NetworkConfigActivity -import de.kuschku.quasseldroid.ui.coresettings.passwordchange.PasswordChangeActivity -import de.kuschku.quasseldroid.ui.info.core.CoreInfoActivity -import de.kuschku.quasseldroid.util.helper.toLiveData -import de.kuschku.quasseldroid.util.helper.visibleIf -import de.kuschku.quasseldroid.util.missingfeatures.MissingFeature -import de.kuschku.quasseldroid.util.missingfeatures.MissingFeaturesDialog -import de.kuschku.quasseldroid.util.missingfeatures.RequiredFeatures -import de.kuschku.quasseldroid.util.service.ServiceBoundFragment -import de.kuschku.quasseldroid.util.ui.view.BannerView -import de.kuschku.quasseldroid.viewmodel.helper.EditorViewModelHelper -import io.reactivex.Observable -import javax.inject.Inject - -class CoreSettingsFragment : ServiceBoundFragment() { - @BindView(R.id.feature_context_missing) - lateinit var featureContextMissing: BannerView - - @BindView(R.id.coreinfo) - lateinit var coreinfo: View - - @BindView(R.id.passwordchange) - lateinit var passwordchange: View - - @BindView(R.id.networks) - lateinit var networks: RecyclerView - - @BindView(R.id.new_network) - lateinit var newNetwork: Button - - @BindView(R.id.identities) - lateinit var identities: RecyclerView - - @BindView(R.id.new_identity) - lateinit var newIdentity: Button - - @BindView(R.id.chatlists) - lateinit var chatlists: RecyclerView - - @BindView(R.id.new_chatlist) - lateinit var newChatlist: Button - - @BindView(R.id.ignorelist) - lateinit var ignorelist: View - - @BindView(R.id.highlightlist) - lateinit var highlightlist: View - - @BindView(R.id.aliaslist) - lateinit var aliaslist: View - - @BindView(R.id.networkconfig) - lateinit var networkconfig: View - - @Inject - lateinit var modelHelper: EditorViewModelHelper - - override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, - savedInstanceState: Bundle?): View? { - val view = inflater.inflate(R.layout.settings_list, container, false) - ButterKnife.bind(this, view) - - val networkAdapter = SettingsItemAdapter<NetworkId> { - NetworkEditActivity.launch(requireContext(), network = it) - } - - val identityAdapter = SettingsItemAdapter<IdentityId> { - IdentityEditActivity.launch(requireContext(), identity = it) - } - - val chatListAdapter = SettingsItemAdapter<Int> { - ChatlistEditActivity.launch(requireContext(), chatlist = it) - } - - val itemDecoration = DividerItemDecoration(requireContext(), DividerItemDecoration.VERTICAL) - - coreinfo.setOnClickListener { - CoreInfoActivity.launch(requireContext()) - } - - passwordchange.setOnClickListener { - PasswordChangeActivity.launch(requireContext()) - } - - networks.adapter = networkAdapter - networks.layoutManager = LinearLayoutManager(context) - networks.addItemDecoration(itemDecoration) - ViewCompat.setNestedScrollingEnabled(networks, false) - - modelHelper.networks.safeSwitchMap { - if (it.isEmpty()) { - Observable.just(emptyList()) - } else { - combineLatest(it.values.map(Network::liveNetworkInfo)).map { - it.map { - SettingsItem(it.networkId, it.networkName) - }.sortedWith(compareBy(String.CASE_INSENSITIVE_ORDER, SettingsItem<NetworkId>::name)) - } - } - }.toLiveData().observe(viewLifecycleOwner, Observer { - networkAdapter.submitList(it.orEmpty()) - }) - - identities.adapter = identityAdapter - identities.layoutManager = LinearLayoutManager(context) - identities.addItemDecoration(itemDecoration) - ViewCompat.setNestedScrollingEnabled(identities, false) - - modelHelper.identities.safeSwitchMap { - if (it.isEmpty()) { - Observable.just(emptyList()) - } else { - combineLatest(it.values.map(Identity::liveUpdates)).map { - it.map { - SettingsItem(it.id(), it.identityName() ?: "") - }.sortedBy(SettingsItem<IdentityId>::name) - } - } - }.toLiveData().observe(viewLifecycleOwner, Observer { - identityAdapter.submitList(it.orEmpty()) - }) - - chatlists.adapter = chatListAdapter - chatlists.layoutManager = LinearLayoutManager(context) - chatlists.addItemDecoration(itemDecoration) - ViewCompat.setNestedScrollingEnabled(chatlists, false) - - modelHelper.bufferViewConfigMap.safeSwitchMap { - combineLatest(it.values.map(BufferViewConfig::liveUpdates)).map { - it.map { - SettingsItem(it.bufferViewId(), it.bufferViewName()) - }.sortedBy(SettingsItem<Int>::name) - } - }.toLiveData().observe(viewLifecycleOwner, Observer { - chatListAdapter.submitList(it.orEmpty()) - }) - - var missingFeatureList: List<MissingFeature> = emptyList() - modelHelper.negotiatedFeatures.toLiveData().observe(viewLifecycleOwner, - Observer { (connected, features) -> - missingFeatureList = RequiredFeatures.features.filter { - it.feature !in features.enabledFeatures - } - featureContextMissing.visibleIf(connected && missingFeatureList.isNotEmpty()) - }) - - featureContextMissing.setOnClickListener { - MissingFeaturesDialog.Builder(requireActivity()) - .missingFeatures(missingFeatureList) - .readOnly(true) - .show() - } - - networkconfig.setOnClickListener { - NetworkConfigActivity.launch(requireContext()) - } - - ignorelist.setOnClickListener { - IgnoreListActivity.launch(requireContext()) - } - - highlightlist.setOnClickListener { - HighlightListActivity.launch(requireContext()) - } - - aliaslist.setOnClickListener { - AliasListActivity.launch(requireContext()) - } - - newNetwork.setOnClickListener { - NetworkCreateActivity.launch(requireContext()) - } - - newIdentity.setOnClickListener { - IdentityCreateActivity.launch(requireContext()) - } - - newChatlist.setOnClickListener { - ChatlistCreateActivity.launch(requireContext()) - } - - return view - } -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/ui/coresettings/CoreSettingsFragmentProvider.kt b/app/src/main/java/de/kuschku/quasseldroid/ui/coresettings/CoreSettingsFragmentProvider.kt deleted file mode 100644 index dd0be146c028052fde352cbff63f8cd9bc01f0c9..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/ui/coresettings/CoreSettingsFragmentProvider.kt +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.ui.coresettings - -import androidx.fragment.app.FragmentActivity -import dagger.Binds -import dagger.Module -import dagger.android.ContributesAndroidInjector - -@Module -abstract class CoreSettingsFragmentProvider { - @Binds - abstract fun bindFragmentActivity(activity: CoreSettingsActivity): FragmentActivity - - @ContributesAndroidInjector - abstract fun bindCoreSettingsFragment(): CoreSettingsFragment -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/ui/coresettings/SettingsItem.kt b/app/src/main/java/de/kuschku/quasseldroid/ui/coresettings/SettingsItem.kt deleted file mode 100644 index 8fe4f127f82a0ea64c5ee8b9ee01abf7ae74a69b..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/ui/coresettings/SettingsItem.kt +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.ui.coresettings - -data class SettingsItem<T>( - val id: T, - val name: String -) diff --git a/app/src/main/java/de/kuschku/quasseldroid/ui/coresettings/SettingsItemAdapter.kt b/app/src/main/java/de/kuschku/quasseldroid/ui/coresettings/SettingsItemAdapter.kt deleted file mode 100644 index c23439f3e5a8ba1b3f31980689317cbf7d96baf3..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/ui/coresettings/SettingsItemAdapter.kt +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.ui.coresettings - -import android.view.LayoutInflater -import android.view.ViewGroup -import androidx.recyclerview.widget.DiffUtil -import androidx.recyclerview.widget.ListAdapter -import androidx.recyclerview.widget.RecyclerView -import de.kuschku.quasseldroid.databinding.SettingsItemBinding - -class SettingsItemAdapter<T>(private val clickListener: (T) -> Unit) : - ListAdapter<SettingsItem<T>, SettingsItemAdapter.SettingsItemViewHolder<T>>( - object : DiffUtil.ItemCallback<SettingsItem<T>>() { - override fun areItemsTheSame(oldItem: SettingsItem<T>, newItem: SettingsItem<T>) = - oldItem.id == newItem.id - - override fun areContentsTheSame(oldItem: SettingsItem<T>, newItem: SettingsItem<T>) = - oldItem == newItem - } - ) { - override fun onCreateViewHolder(parent: ViewGroup, viewType: Int) = SettingsItemViewHolder( - SettingsItemBinding.inflate(LayoutInflater.from(parent.context), parent, false), - clickListener - ) - - override fun onBindViewHolder(holder: SettingsItemViewHolder<T>, position: Int) { - holder.bind(getItem(position)) - } - - class SettingsItemViewHolder<T>( - private val binding: SettingsItemBinding, - clickListener: (T) -> Unit - ) : RecyclerView.ViewHolder(binding.root) { - var id: T? = null - - init { - itemView.setOnClickListener { - id?.let(clickListener::invoke) - } - } - - fun bind(item: SettingsItem<T>) { - this.id = item.id - binding.title.text = item.name - } - } -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/ui/coresettings/aliasitem/AliasItemActivity.kt b/app/src/main/java/de/kuschku/quasseldroid/ui/coresettings/aliasitem/AliasItemActivity.kt deleted file mode 100644 index 5d20c8037a0b14b62e930657b762f21838ca5235..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/ui/coresettings/aliasitem/AliasItemActivity.kt +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.ui.coresettings.aliasitem - -import android.content.Context -import android.content.Intent -import de.kuschku.libquassel.quassel.syncables.interfaces.IAliasManager -import de.kuschku.quasseldroid.util.ui.settings.ServiceBoundSettingsActivity - -class AliasItemActivity : ServiceBoundSettingsActivity(AliasItemFragment()) { - companion object { - fun launch( - context: Context, - item: IAliasManager.Alias? = null - ) = context.startActivity(intent(context, item)) - - fun intent( - context: Context, - item: IAliasManager.Alias? = null - ) = Intent(context, AliasItemActivity::class.java).apply { - if (item != null) { - putExtra("item", item) - } - } - } -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/ui/coresettings/aliasitem/AliasItemFragment.kt b/app/src/main/java/de/kuschku/quasseldroid/ui/coresettings/aliasitem/AliasItemFragment.kt deleted file mode 100644 index 6ce93b82e66bd5517abba91af1b4eefd974841d8..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/ui/coresettings/aliasitem/AliasItemFragment.kt +++ /dev/null @@ -1,160 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.ui.coresettings.aliasitem - -import android.app.Activity -import android.content.Intent -import android.os.Bundle -import android.view.LayoutInflater -import android.view.View -import android.view.ViewGroup -import android.widget.EditText -import androidx.recyclerview.widget.DefaultItemAnimator -import androidx.recyclerview.widget.LinearLayoutManager -import androidx.recyclerview.widget.RecyclerView -import butterknife.BindView -import butterknife.ButterKnife -import com.google.android.material.bottomsheet.BottomSheetBehavior -import de.kuschku.libquassel.quassel.syncables.interfaces.IAliasManager -import de.kuschku.quasseldroid.R -import de.kuschku.quasseldroid.settings.AppearanceSettings -import de.kuschku.quasseldroid.settings.AutoCompleteSettings -import de.kuschku.quasseldroid.settings.MessageSettings -import de.kuschku.quasseldroid.ui.chat.input.* -import de.kuschku.quasseldroid.util.irc.format.ContentFormatter -import de.kuschku.quasseldroid.util.irc.format.IrcFormatDeserializer -import de.kuschku.quasseldroid.util.irc.format.IrcFormatSerializer -import de.kuschku.quasseldroid.util.ui.settings.fragment.Changeable -import de.kuschku.quasseldroid.util.ui.settings.fragment.Savable -import de.kuschku.quasseldroid.util.ui.settings.fragment.ServiceBoundSettingsFragment -import de.kuschku.quasseldroid.viewmodel.helper.EditorViewModelHelper -import javax.inject.Inject - -class AliasItemFragment : ServiceBoundSettingsFragment(), Savable, Changeable { - @BindView(R.id.name) - lateinit var name: EditText - - @BindView(R.id.expansion) - lateinit var expansion: RichEditText - - @BindView(R.id.formatting_toolbar) - lateinit var toolbar: RichToolbar - - @BindView(R.id.autocomplete_list) - lateinit var autoCompleteList: RecyclerView - - @Inject - lateinit var autoCompleteSettings: AutoCompleteSettings - - @Inject - lateinit var messageSettings: MessageSettings - - @Inject - lateinit var appearanceSettings: AppearanceSettings - - @Inject - lateinit var formatDeserializer: IrcFormatDeserializer - - @Inject - lateinit var contentFormatter: ContentFormatter - - @Inject - lateinit var formatSerializer: IrcFormatSerializer - - @Inject - lateinit var autoCompleteAdapter: AutoCompleteAdapter - - @Inject - lateinit var modelHelper: EditorViewModelHelper - - private lateinit var editorHelper: EditorHelper - - private var rule: IAliasManager.Alias? = null - - override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, - savedInstanceState: Bundle?): View? { - - val view = inflater.inflate(R.layout.settings_aliasitem, container, false) - ButterKnife.bind(this, view) - - (arguments?.getSerializable("item") as? IAliasManager.Alias)?.let { - rule = it - } - - val autoCompleteHelper = AutoCompleteHelper( - requireActivity(), - autoCompleteSettings, - messageSettings, - formatDeserializer, - contentFormatter, - modelHelper - ) - - editorHelper = EditorHelper( - requireActivity(), - expansion, - toolbar, - autoCompleteHelper, - autoCompleteSettings, - appearanceSettings - ) - - modelHelper.editor.lastWord.onNext(editorHelper.lastWord) - - if (autoCompleteSettings.prefix || autoCompleteSettings.auto) { - val autoCompleteBottomSheet = BottomSheetBehavior.from(autoCompleteList) - autoCompleteAdapter.setOnClickListener(expansion::autoComplete) - autoCompleteList.layoutManager = LinearLayoutManager(activity) - autoCompleteList.itemAnimator = DefaultItemAnimator() - autoCompleteList.adapter = autoCompleteAdapter - autoCompleteHelper.addDataListener { - autoCompleteBottomSheet.state = - if (it.isEmpty()) BottomSheetBehavior.STATE_HIDDEN - else BottomSheetBehavior.STATE_COLLAPSED - autoCompleteAdapter.submitList(it) - } - } - - rule?.let { data -> - name.setText(data.name ?: "") - expansion.setText(formatDeserializer.formatString(data.expansion, true)) - } - - return view - } - - private fun applyChanges() = IAliasManager.Alias( - name = name.text.toString(), - expansion = formatSerializer.toEscapeCodes(expansion.safeText) - ) - - override fun onSave() = rule.let { data -> - requireActivity().setResult( - Activity.RESULT_OK, - Intent().also { - it.putExtra("old", data) - it.putExtra("new", applyChanges()) - } - ) - true - } - - override fun hasChanged() = rule != applyChanges() -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/ui/coresettings/aliasitem/AliasItemFragmentProvider.kt b/app/src/main/java/de/kuschku/quasseldroid/ui/coresettings/aliasitem/AliasItemFragmentProvider.kt deleted file mode 100644 index 012df443fe0eca00899c216e4cd120c476cf2ab3..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/ui/coresettings/aliasitem/AliasItemFragmentProvider.kt +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.ui.coresettings.aliasitem - -import androidx.fragment.app.FragmentActivity -import dagger.Binds -import dagger.Module -import dagger.android.ContributesAndroidInjector - -@Module -abstract class AliasItemFragmentProvider { - @Binds - abstract fun bindFragmentActivity(activity: AliasItemActivity): FragmentActivity - - @ContributesAndroidInjector - abstract fun bindAliasItemFragment(): AliasItemFragment -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/ui/coresettings/aliaslist/AliasListActivity.kt b/app/src/main/java/de/kuschku/quasseldroid/ui/coresettings/aliaslist/AliasListActivity.kt deleted file mode 100644 index 1b665675fff3a134979bc5cf44b8fe9a2585258e..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/ui/coresettings/aliaslist/AliasListActivity.kt +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.ui.coresettings.aliaslist - -import android.content.Context -import android.content.Intent -import de.kuschku.quasseldroid.util.ui.settings.ServiceBoundSettingsActivity - -class AliasListActivity : ServiceBoundSettingsActivity(AliasListFragment()) { - companion object { - fun launch(context: Context) = context.startActivity(intent(context)) - fun intent(context: Context) = Intent(context, AliasListActivity::class.java) - } -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/ui/coresettings/aliaslist/AliasListAdapter.kt b/app/src/main/java/de/kuschku/quasseldroid/ui/coresettings/aliaslist/AliasListAdapter.kt deleted file mode 100644 index 4c885fbaae00fc8d51465701f3735f35d84cdf31..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/ui/coresettings/aliaslist/AliasListAdapter.kt +++ /dev/null @@ -1,123 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.ui.coresettings.aliaslist - -import android.annotation.SuppressLint -import android.view.LayoutInflater -import android.view.MotionEvent -import android.view.ViewGroup -import androidx.recyclerview.widget.RecyclerView -import de.kuschku.libquassel.quassel.syncables.interfaces.IAliasManager -import de.kuschku.quasseldroid.databinding.SettingsAliaslistItemBinding -import de.kuschku.quasseldroid.util.irc.format.IrcFormatDeserializer -import java.util.* -import javax.inject.Inject - -class AliasListAdapter @Inject constructor( - private val formatDeserializer: IrcFormatDeserializer -) : RecyclerView.Adapter<AliasListAdapter.AliasItemViewHolder>() { - private var clickListener: ((IAliasManager.Alias) -> Unit)? = null - private var dragListener: ((AliasItemViewHolder) -> Unit)? = null - - fun setOnClickListener(listener: ((IAliasManager.Alias) -> Unit)?) { - clickListener = listener - } - - fun setOnDragListener(listener: ((AliasItemViewHolder) -> Unit)?) { - dragListener = listener - } - - private val data = mutableListOf<IAliasManager.Alias>() - var list: List<IAliasManager.Alias> - get() = data - set(value) { - val length = data.size - data.clear() - notifyItemRangeRemoved(0, length) - data.addAll(value) - notifyItemRangeInserted(0, list.size) - } - - fun add(item: IAliasManager.Alias) { - val index = data.size - data.add(item) - notifyItemInserted(index) - } - - fun replace(index: Int, item: IAliasManager.Alias) { - data[index] = item - notifyItemChanged(index) - } - - fun indexOf(name: String?) = data.map(IAliasManager.Alias::name).indexOf(name) - - fun remove(index: Int) { - data.removeAt(index) - notifyItemRemoved(index) - } - - fun move(from: Int, to: Int) { - Collections.swap(data, from, to) - notifyItemMoved(from, to) - } - - override fun getItemCount() = data.size - - override fun onCreateViewHolder(parent: ViewGroup, viewType: Int) = AliasItemViewHolder( - SettingsAliaslistItemBinding.inflate(LayoutInflater.from(parent.context), parent, false), - formatDeserializer, - clickListener, - dragListener - ) - - override fun onBindViewHolder(holder: AliasItemViewHolder, position: Int) { - holder.bind(data[position]) - } - - @SuppressLint("ClickableViewAccessibility") - class AliasItemViewHolder( - private val binding: SettingsAliaslistItemBinding, - private val formatDeserializer: IrcFormatDeserializer, - clickListener: ((IAliasManager.Alias) -> Unit)?, - dragListener: ((AliasItemViewHolder) -> Unit)? - ) : RecyclerView.ViewHolder(binding.root) { - private var item: IAliasManager.Alias? = null - - init { - itemView.setOnClickListener { - item?.let { - clickListener?.invoke(it) - } - } - binding.handle.setOnTouchListener { _, event -> - if (event.action == MotionEvent.ACTION_DOWN) { - dragListener?.invoke(this) - } - false - } - } - - fun bind(item: IAliasManager.Alias) { - this.item = item - binding.name.text = item.name - binding.expansion.text = formatDeserializer.formatString(item.expansion, true) - } - } -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/ui/coresettings/aliaslist/AliasListFragment.kt b/app/src/main/java/de/kuschku/quasseldroid/ui/coresettings/aliaslist/AliasListFragment.kt deleted file mode 100644 index 650e7fe2640468cad3c78aee0c7095655795a381..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/ui/coresettings/aliaslist/AliasListFragment.kt +++ /dev/null @@ -1,147 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.ui.coresettings.aliaslist - -import android.app.Activity -import android.content.Intent -import android.os.Bundle -import android.view.LayoutInflater -import android.view.View -import android.view.ViewGroup -import androidx.lifecycle.Observer -import androidx.recyclerview.widget.* -import butterknife.BindView -import butterknife.ButterKnife -import com.google.android.material.floatingactionbutton.FloatingActionButton -import de.kuschku.libquassel.quassel.syncables.AliasManager -import de.kuschku.libquassel.quassel.syncables.interfaces.IAliasManager -import de.kuschku.libquassel.util.Optional -import de.kuschku.quasseldroid.R -import de.kuschku.quasseldroid.ui.coresettings.aliasitem.AliasItemActivity -import de.kuschku.quasseldroid.util.helper.toLiveData -import de.kuschku.quasseldroid.util.ui.settings.fragment.Changeable -import de.kuschku.quasseldroid.util.ui.settings.fragment.Savable -import de.kuschku.quasseldroid.util.ui.settings.fragment.ServiceBoundSettingsFragment -import de.kuschku.quasseldroid.viewmodel.helper.QuasselViewModelHelper -import javax.inject.Inject - -class AliasListFragment : ServiceBoundSettingsFragment(), Savable, Changeable { - @BindView(R.id.list) - lateinit var list: RecyclerView - - @BindView(R.id.add) - lateinit var add: FloatingActionButton - - @Inject - lateinit var adapter: AliasListAdapter - - @Inject - lateinit var modelHelper: QuasselViewModelHelper - - private var aliasManager: Pair<AliasManager, AliasManager>? = null - - private lateinit var helper: ItemTouchHelper - - override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, - savedInstanceState: Bundle?): View? { - val view = inflater.inflate(R.layout.settings_ignorelist, container, false) - ButterKnife.bind(this, view) - - adapter.setOnClickListener(::itemClick) - adapter.setOnDragListener(::startDrag) - - list.adapter = adapter - list.layoutManager = LinearLayoutManager(requireContext()) - list.itemAnimator = DefaultItemAnimator() - list.addItemDecoration(DividerItemDecoration(requireContext(), DividerItemDecoration.VERTICAL)) - - val callback = DragSortItemTouchHelperCallback(adapter) - helper = ItemTouchHelper(callback) - helper.attachToRecyclerView(list) - - add.setOnClickListener { - startActivityForResult(AliasItemActivity.intent(requireContext()), REQUEST_CREATE_ITEM) - } - - modelHelper.aliasManager - .filter(Optional<AliasManager>::isPresent) - .map(Optional<AliasManager>::get) - .toLiveData().observe(viewLifecycleOwner, Observer { - if (it != null) { - if (this.aliasManager == null) { - this.aliasManager = Pair(it, it.copy()) - this.aliasManager?.let { (_, data) -> - adapter.list = data.aliasList() - } - } - } - }) - - return view - } - - private fun itemClick(item: IAliasManager.Alias) { - startActivityForResult(AliasItemActivity.intent(requireContext(), item), REQUEST_UPDATE_ITEM) - } - - private fun startDrag(holder: AliasListAdapter.AliasItemViewHolder) = helper.startDrag(holder) - - override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) { - if (resultCode == Activity.RESULT_OK && data != null) { - when (requestCode) { - REQUEST_UPDATE_ITEM -> { - val oldRule = data.getSerializableExtra("old") as? IAliasManager.Alias - val newRule = data.getSerializableExtra("new") as? IAliasManager.Alias - - if (oldRule != null && newRule != null) { - adapter.replace(adapter.indexOf(oldRule.name), newRule) - } - } - REQUEST_CREATE_ITEM -> { - val newRule = data.getSerializableExtra("new") as? IAliasManager.Alias - - if (newRule != null) { - adapter.add(newRule) - } - } - } - } - } - - override fun onSave() = aliasManager?.let { (it, data) -> - applyChanges(data) - it.requestUpdate(data.toVariantMap()) - true - } ?: false - - override fun hasChanged() = aliasManager?.let { (it, data) -> - applyChanges(data) - !data.isEqual(it) - } ?: false - - private fun applyChanges(data: AliasManager) { - data.setAliasList(adapter.list) - } - - companion object { - private const val REQUEST_UPDATE_ITEM = 1 - private const val REQUEST_CREATE_ITEM = 2 - } -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/ui/coresettings/aliaslist/AliasListFragmentProvider.kt b/app/src/main/java/de/kuschku/quasseldroid/ui/coresettings/aliaslist/AliasListFragmentProvider.kt deleted file mode 100644 index ae9d501b6da4d4bd1387f50cc7d08addee6801da..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/ui/coresettings/aliaslist/AliasListFragmentProvider.kt +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.ui.coresettings.aliaslist - -import androidx.fragment.app.FragmentActivity -import dagger.Binds -import dagger.Module -import dagger.android.ContributesAndroidInjector - -@Module -abstract class AliasListFragmentProvider { - @Binds - abstract fun bindFragmentActivity(activity: AliasListActivity): FragmentActivity - - @ContributesAndroidInjector - abstract fun bindAliasListFragment(): AliasListFragment -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/ui/coresettings/aliaslist/DragSortItemTouchHelperCallback.kt b/app/src/main/java/de/kuschku/quasseldroid/ui/coresettings/aliaslist/DragSortItemTouchHelperCallback.kt deleted file mode 100644 index eafcf0cbddd69bbc0d318cd861756f37aa9bec58..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/ui/coresettings/aliaslist/DragSortItemTouchHelperCallback.kt +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.ui.coresettings.aliaslist - -import androidx.recyclerview.widget.ItemTouchHelper -import androidx.recyclerview.widget.RecyclerView - -class DragSortItemTouchHelperCallback(private val adapter: AliasListAdapter) : - ItemTouchHelper.Callback() { - override fun isLongPressDragEnabled() = true - - override fun isItemViewSwipeEnabled() = true - - override fun getMovementFlags(recyclerView: RecyclerView, - viewHolder: RecyclerView.ViewHolder): Int { - val dragFlags = ItemTouchHelper.UP or ItemTouchHelper.DOWN - val swipeFlags = ItemTouchHelper.START or ItemTouchHelper.END - return makeMovementFlags(dragFlags, swipeFlags) - } - - override fun onMove(recyclerView: RecyclerView, viewHolder: RecyclerView.ViewHolder, - target: RecyclerView.ViewHolder): Boolean { - adapter.move(viewHolder.adapterPosition, target.adapterPosition) - return true - } - - override fun onSwiped(viewHolder: RecyclerView.ViewHolder, direction: Int) { - adapter.remove(viewHolder.adapterPosition) - } -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/ui/coresettings/chatlist/ChatListBaseFragment.kt b/app/src/main/java/de/kuschku/quasseldroid/ui/coresettings/chatlist/ChatListBaseFragment.kt deleted file mode 100644 index 5d3c46ea7bc2609a614358f55964a7fdc3160085..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/ui/coresettings/chatlist/ChatListBaseFragment.kt +++ /dev/null @@ -1,243 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.ui.coresettings.chatlist - -import android.os.Bundle -import android.view.LayoutInflater -import android.view.View -import android.view.ViewGroup -import android.widget.AdapterView -import android.widget.EditText -import android.widget.Spinner -import androidx.appcompat.widget.SwitchCompat -import androidx.lifecycle.Observer -import butterknife.BindView -import butterknife.ButterKnife -import de.kuschku.libquassel.protocol.Buffer_Activity -import de.kuschku.libquassel.protocol.Buffer_Type -import de.kuschku.libquassel.protocol.NetworkId -import de.kuschku.libquassel.quassel.syncables.BufferViewConfig -import de.kuschku.libquassel.quassel.syncables.Network -import de.kuschku.libquassel.quassel.syncables.interfaces.INetwork -import de.kuschku.libquassel.session.ISession -import de.kuschku.libquassel.util.Optional -import de.kuschku.libquassel.util.flag.hasFlag -import de.kuschku.libquassel.util.flag.minus -import de.kuschku.libquassel.util.flag.plus -import de.kuschku.libquassel.util.helper.combineLatest -import de.kuschku.libquassel.util.helper.safeSwitchMap -import de.kuschku.quasseldroid.R -import de.kuschku.quasseldroid.defaults.Defaults -import de.kuschku.quasseldroid.util.helper.toLiveData -import de.kuschku.quasseldroid.util.ui.settings.fragment.Changeable -import de.kuschku.quasseldroid.util.ui.settings.fragment.Savable -import de.kuschku.quasseldroid.util.ui.settings.fragment.ServiceBoundSettingsFragment -import de.kuschku.quasseldroid.viewmodel.helper.EditorViewModelHelper -import javax.inject.Inject - -abstract class ChatListBaseFragment(private val initDefault: Boolean) : - ServiceBoundSettingsFragment(), Savable, Changeable { - @BindView(R.id.buffer_view_name) - lateinit var bufferViewName: EditText - - @BindView(R.id.show_search) - lateinit var showSearch: SwitchCompat - - @BindView(R.id.sort_alphabetically) - lateinit var sortAlphabetically: SwitchCompat - - @BindView(R.id.add_new_buffers_automatically) - lateinit var addNewBuffersAutomatically: SwitchCompat - - @BindView(R.id.network_id) - lateinit var networkId: Spinner - - @BindView(R.id.show_status_buffer) - lateinit var showStatusBuffer: SwitchCompat - - @BindView(R.id.show_channels) - lateinit var showChannels: SwitchCompat - - @BindView(R.id.show_queries) - lateinit var showQueries: SwitchCompat - - @BindView(R.id.minimum_activity) - lateinit var minimumActivity: Spinner - - @BindView(R.id.hide_inactive_buffers) - lateinit var hideInactiveBuffers: SwitchCompat - - @BindView(R.id.hide_inactive_networks) - lateinit var hideInactiveNetworks: SwitchCompat - - @Inject - lateinit var modelHelper: EditorViewModelHelper - - protected var chatlist: Pair<BufferViewConfig?, BufferViewConfig>? = null - - override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, - savedInstanceState: Bundle?): View? { - val view = inflater.inflate(R.layout.settings_chatlist, container, false) - ButterKnife.bind(this, view) - - val chatlistId = arguments?.getInt("chatlist", -1) ?: -1 - - val minimumActivityAdapter = MinimumActivityAdapter(listOf( - MinimumActivityItem( - activity = Buffer_Activity.NoActivity, - name = R.string.settings_chatlist_minimum_activity_no_activity - ), - MinimumActivityItem( - activity = Buffer_Activity.OtherActivity, - name = R.string.settings_chatlist_minimum_activity_other_activity - ), - MinimumActivityItem( - activity = Buffer_Activity.NewMessage, - name = R.string.settings_chatlist_minimum_activity_new_message - ), - MinimumActivityItem( - activity = Buffer_Activity.Highlight, - name = R.string.settings_chatlist_minimum_activity_highlight - ) - )) - minimumActivity.adapter = minimumActivityAdapter - - val networkAdapter = NetworkAdapter(R.string.settings_chatlist_network_all) - networkId.adapter = networkAdapter - - modelHelper.networks.safeSwitchMap { - combineLatest(it.values.map(Network::liveNetworkInfo)).map { - it.sortedWith(compareBy(String.CASE_INSENSITIVE_ORDER, INetwork.NetworkInfo::networkName)) - } - }.toLiveData().observe(viewLifecycleOwner, Observer { - if (it != null) { - val selectOriginal = networkId.selectedItemId == Spinner.INVALID_ROW_ID - networkAdapter.submitList(listOf(null) + it) - if (selectOriginal) { - this.chatlist?.let { (_, data) -> - networkAdapter.indexOf(data.networkId())?.let(networkId::setSelection) - } - } - } - }) - - if (initDefault) { - modelHelper.connectedSession - .filter(Optional<ISession>::isPresent) - .map(Optional<ISession>::get) - .firstElement() - .toLiveData().observe(viewLifecycleOwner, Observer { - it?.let { - update(Defaults.bufferViewConfig(requireContext(), it.proxy), - minimumActivityAdapter, - networkAdapter) - } - }) - } else { - modelHelper.bufferViewConfigMap.map { Optional.ofNullable(it[chatlistId]) } - .filter(Optional<BufferViewConfig>::isPresent) - .map(Optional<BufferViewConfig>::get) - .firstElement() - .toLiveData().observe(viewLifecycleOwner, Observer { - it?.let { - update(it, minimumActivityAdapter, networkAdapter) - } - }) - } - - networkId.onItemSelectedListener = object : AdapterView.OnItemSelectedListener { - override fun onNothingSelected(parent: AdapterView<*>?) { - showStatusBuffer.isChecked = true - showStatusBuffer.isEnabled = false - } - - override fun onItemSelected(parent: AdapterView<*>?, view: View?, position: Int, id: Long) { - if (NetworkId(id.toInt()).isValidId()) { - showStatusBuffer.isEnabled = true - } else { - showStatusBuffer.isChecked = true - showStatusBuffer.isEnabled = false - } - } - } - - return view - } - - private fun update(it: BufferViewConfig, - minimumActivityAdapter: MinimumActivityAdapter, - networkAdapter: NetworkAdapter) { - if (this.chatlist == null) { - this.chatlist = Pair(it, it.copy()) - this.chatlist?.let { (_, data) -> - bufferViewName.setText(data.bufferViewName()) - showSearch.isChecked = data.showSearch() - sortAlphabetically.isChecked = data.sortAlphabetically() - addNewBuffersAutomatically.isChecked = data.addNewBuffersAutomatically() - showStatusBuffer.isChecked = data.allowedBufferTypes().hasFlag(Buffer_Type.StatusBuffer) - - minimumActivity.setSelection( - minimumActivityAdapter.indexOf(data.minimumActivity()) ?: 0 - ) - - networkAdapter.indexOf(data.networkId())?.let(networkId::setSelection) - - hideInactiveBuffers.isChecked = data.hideInactiveBuffers() - hideInactiveNetworks.isChecked = data.hideInactiveNetworks() - - showQueries.isChecked = data.allowedBufferTypes().hasFlag(Buffer_Type.QueryBuffer) - showChannels.isChecked = data.allowedBufferTypes().hasFlag(Buffer_Type.ChannelBuffer) - } - } - } - - override fun hasChanged() = chatlist?.let { (it, data) -> - applyChanges(data, it) - it == null || !data.isEqual(it) - } ?: true - - protected fun applyChanges(data: BufferViewConfig, old: BufferViewConfig?) { - data.setBufferViewName(bufferViewName.text.toString()) - data.setShowSearch(showSearch.isChecked) - data.setSortAlphabetically(sortAlphabetically.isChecked) - data.setAddNewBuffersAutomatically(addNewBuffersAutomatically.isChecked) - - data.setHideInactiveBuffers(hideInactiveBuffers.isChecked) - data.setHideInactiveNetworks(hideInactiveNetworks.isChecked) - - var allowedBufferTypes = data.allowedBufferTypes() - if (showQueries.isChecked) allowedBufferTypes += Buffer_Type.QueryBuffer - else allowedBufferTypes -= Buffer_Type.QueryBuffer - if (showChannels.isChecked) allowedBufferTypes += Buffer_Type.ChannelBuffer - else allowedBufferTypes -= Buffer_Type.ChannelBuffer - if (showStatusBuffer.isChecked) allowedBufferTypes += Buffer_Type.StatusBuffer - else allowedBufferTypes -= Buffer_Type.StatusBuffer - data.setAllowedBufferTypes(allowedBufferTypes) - - data.setNetworkId(NetworkId(networkId.selectedItemId.toInt())) - data.setMinimumActivity(minimumActivity.selectedItemId.toInt()) - - if (old != null) { - data.initSetBufferList(old.initBufferList()) - data.initSetTemporarilyRemovedBuffers(old.initTemporarilyRemovedBuffers()) - data.initSetRemovedBuffers(old.initRemovedBuffers()) - } - } -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/ui/coresettings/chatlist/ChatListCreateFragment.kt b/app/src/main/java/de/kuschku/quasseldroid/ui/coresettings/chatlist/ChatListCreateFragment.kt deleted file mode 100644 index 08483aa149279ee9f79cc9844cc2438f28e7d730..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/ui/coresettings/chatlist/ChatListCreateFragment.kt +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.ui.coresettings.chatlist - -import de.kuschku.libquassel.util.helper.value - -class ChatListCreateFragment : ChatListBaseFragment(true) { - override fun onSave() = chatlist?.let { (_, data) -> - applyChanges(data, null) - modelHelper.bufferViewManager.value?.orNull()?.requestCreateBufferView(data.toVariantMap()) - true - } ?: false -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/ui/coresettings/chatlist/ChatListEditFragment.kt b/app/src/main/java/de/kuschku/quasseldroid/ui/coresettings/chatlist/ChatListEditFragment.kt deleted file mode 100644 index dca5dbaf35a29ed14e1cdcbaf210ea332034e3b8..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/ui/coresettings/chatlist/ChatListEditFragment.kt +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.ui.coresettings.chatlist - -import de.kuschku.libquassel.util.helper.value -import de.kuschku.quasseldroid.util.ui.settings.fragment.Deletable - -class ChatListEditFragment : ChatListBaseFragment(false), Deletable { - override fun onSave() = chatlist?.let { (it, data) -> - applyChanges(data, it) - it?.requestUpdate(data.toVariantMap()) - true - } ?: false - - override fun onDelete() { - chatlist?.let { (it, _) -> - it?.let { - modelHelper.bufferViewManager.value?.orNull()?.requestDeleteBufferView(it.bufferViewId()) - } - } - } -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/ui/coresettings/chatlist/ChatlistCreateActivity.kt b/app/src/main/java/de/kuschku/quasseldroid/ui/coresettings/chatlist/ChatlistCreateActivity.kt deleted file mode 100644 index 351c7cb4e8b41ad7b7abfaf1a9e10c518a974e38..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/ui/coresettings/chatlist/ChatlistCreateActivity.kt +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.ui.coresettings.chatlist - -import android.content.Context -import android.content.Intent -import de.kuschku.quasseldroid.util.ui.settings.ServiceBoundSettingsActivity - -class ChatlistCreateActivity : ServiceBoundSettingsActivity(ChatListCreateFragment()) { - companion object { - fun launch(context: Context) = context.startActivity(intent(context)) - fun intent(context: Context) = Intent(context, ChatlistCreateActivity::class.java) - } -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/ui/coresettings/chatlist/ChatlistCreateFragmentProvider.kt b/app/src/main/java/de/kuschku/quasseldroid/ui/coresettings/chatlist/ChatlistCreateFragmentProvider.kt deleted file mode 100644 index 7fbe2bbb3720b8a3c0bb2098d4e159434ca4166a..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/ui/coresettings/chatlist/ChatlistCreateFragmentProvider.kt +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.ui.coresettings.chatlist - -import androidx.fragment.app.FragmentActivity -import dagger.Binds -import dagger.Module -import dagger.android.ContributesAndroidInjector - -@Module -abstract class ChatlistCreateFragmentProvider { - @Binds - abstract fun bindFragmentActivity(activity: ChatlistCreateActivity): FragmentActivity - - @ContributesAndroidInjector - abstract fun bindChatListCreateFragment(): ChatListCreateFragment -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/ui/coresettings/chatlist/ChatlistEditActivity.kt b/app/src/main/java/de/kuschku/quasseldroid/ui/coresettings/chatlist/ChatlistEditActivity.kt deleted file mode 100644 index e4c5372834ea204ef082a72b009971cdfa313d5c..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/ui/coresettings/chatlist/ChatlistEditActivity.kt +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.ui.coresettings.chatlist - -import android.content.Context -import android.content.Intent -import de.kuschku.quasseldroid.util.ui.settings.ServiceBoundSettingsActivity - -class ChatlistEditActivity : ServiceBoundSettingsActivity(ChatListEditFragment()) { - companion object { - fun launch( - context: Context, - chatlist: Int - ) = context.startActivity(intent(context, chatlist)) - - fun intent( - context: Context, - chatlist: Int - ) = Intent(context, ChatlistEditActivity::class.java).apply { - putExtra("chatlist", chatlist) - } - } -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/ui/coresettings/chatlist/ChatlistEditFragmentProvider.kt b/app/src/main/java/de/kuschku/quasseldroid/ui/coresettings/chatlist/ChatlistEditFragmentProvider.kt deleted file mode 100644 index ac0db70e4c786f83190efaab6c0f4c16c614c0bf..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/ui/coresettings/chatlist/ChatlistEditFragmentProvider.kt +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.ui.coresettings.chatlist - -import androidx.fragment.app.FragmentActivity -import dagger.Binds -import dagger.Module -import dagger.android.ContributesAndroidInjector - -@Module -abstract class ChatlistEditFragmentProvider { - @Binds - abstract fun bindFragmentActivity(activity: ChatlistEditActivity): FragmentActivity - - @ContributesAndroidInjector - abstract fun bindChatListEditFragment(): ChatListEditFragment -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/ui/coresettings/chatlist/MinimumActivityAdapter.kt b/app/src/main/java/de/kuschku/quasseldroid/ui/coresettings/chatlist/MinimumActivityAdapter.kt deleted file mode 100644 index 303f053e520c4d2bdbfbef0551014414cf766a1b..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/ui/coresettings/chatlist/MinimumActivityAdapter.kt +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.ui.coresettings.chatlist - -import android.view.LayoutInflater -import android.view.ViewGroup -import androidx.appcompat.widget.ThemedSpinnerAdapter -import androidx.recyclerview.widget.RecyclerView -import de.kuschku.libquassel.protocol.Buffer_Activities -import de.kuschku.quasseldroid.databinding.WidgetSpinnerItemMaterialBinding -import de.kuschku.quasseldroid.util.ui.ContextThemeWrapper -import de.kuschku.quasseldroid.util.ui.RecyclerSpinnerAdapter - -class MinimumActivityAdapter(val data: List<MinimumActivityItem>) : - RecyclerSpinnerAdapter<MinimumActivityAdapter.MinimumActivityViewHolder>(), - ThemedSpinnerAdapter { - - override fun isEmpty() = data.isEmpty() - - override fun onBindViewHolder(holder: MinimumActivityViewHolder, position: Int) = - holder.bind(getItem(position)) - - override fun onCreateViewHolder(parent: ViewGroup, dropDown: Boolean) - : MinimumActivityViewHolder { - val inflater = LayoutInflater.from( - if (dropDown) - ContextThemeWrapper(parent.context, dropDownViewTheme) - else - parent.context - ) - return MinimumActivityViewHolder( - WidgetSpinnerItemMaterialBinding.inflate(inflater, parent, false) - ) - } - - override fun getItem(position: Int) = data[position] - - override fun getItemId(position: Int) = getItem(position).activity.toInt().toLong() - - override fun hasStableIds() = true - - override fun getCount() = data.size - - fun indexOf(activity: Buffer_Activities): Int? { - for ((key, item) in data.withIndex()) { - if (item.activity.toInt() == activity.toInt()) { - return key - } - } - return null - } - - class MinimumActivityViewHolder( - private val binding: WidgetSpinnerItemMaterialBinding - ) : RecyclerView.ViewHolder(binding.root) { - fun bind(activity: MinimumActivityItem?) { - activity?.let { - binding.text1.setText(it.name) - } - } - } -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/ui/coresettings/chatlist/MinimumActivityItem.kt b/app/src/main/java/de/kuschku/quasseldroid/ui/coresettings/chatlist/MinimumActivityItem.kt deleted file mode 100644 index cac752abbc59cb4db1b8e8eb787fd392439c6e4f..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/ui/coresettings/chatlist/MinimumActivityItem.kt +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.ui.coresettings.chatlist - -import androidx.annotation.StringRes -import de.kuschku.libquassel.protocol.Buffer_Activity - -data class MinimumActivityItem(val activity: Buffer_Activity, @StringRes val name: Int) diff --git a/app/src/main/java/de/kuschku/quasseldroid/ui/coresettings/chatlist/NetworkAdapter.kt b/app/src/main/java/de/kuschku/quasseldroid/ui/coresettings/chatlist/NetworkAdapter.kt deleted file mode 100644 index c937b7b8ab64e69d096a1ee82bfefee4e926279d..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/ui/coresettings/chatlist/NetworkAdapter.kt +++ /dev/null @@ -1,81 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.ui.coresettings.chatlist - -import android.view.LayoutInflater -import android.view.ViewGroup -import androidx.annotation.StringRes -import androidx.appcompat.widget.ThemedSpinnerAdapter -import androidx.recyclerview.widget.RecyclerView -import de.kuschku.libquassel.protocol.NetworkId -import de.kuschku.libquassel.quassel.syncables.interfaces.INetwork -import de.kuschku.quasseldroid.databinding.WidgetSpinnerItemMaterialBinding -import de.kuschku.quasseldroid.util.ui.ContextThemeWrapper -import de.kuschku.quasseldroid.util.ui.RecyclerSpinnerAdapter - -class NetworkAdapter(@StringRes private val fallbackName: Int) : - RecyclerSpinnerAdapter<NetworkAdapter.NetworkViewHolder>(), - ThemedSpinnerAdapter { - var data = listOf<INetwork.NetworkInfo?>(null) - - fun submitList(list: List<INetwork.NetworkInfo?>) { - data = list - notifyDataSetChanged() - } - - override fun isEmpty() = data.isEmpty() - - override fun onBindViewHolder(holder: NetworkViewHolder, position: Int) = - holder.bind(getItem(position)) - - override fun onCreateViewHolder(parent: ViewGroup, dropDown: Boolean) - : NetworkViewHolder { - val inflater = LayoutInflater.from( - if (dropDown) - ContextThemeWrapper(parent.context, dropDownViewTheme) - else - parent.context - ) - return NetworkViewHolder(fallbackName, - WidgetSpinnerItemMaterialBinding.inflate(inflater, parent, false)) - } - - fun indexOf(id: NetworkId): Int? { - for ((key, item) in data.withIndex()) { - if (item?.networkId ?: 0 == id) { - return key - } - } - return null - } - - override fun getItem(position: Int): INetwork.NetworkInfo? = data[position] - override fun getItemId(position: Int) = getItem(position)?.networkId?.id?.toLong() ?: 0 - override fun hasStableIds() = true - override fun getCount() = data.size - class NetworkViewHolder( - @StringRes private val fallbackName: Int, - private val binding: WidgetSpinnerItemMaterialBinding - ) : RecyclerView.ViewHolder(binding.root) { - fun bind(network: INetwork.NetworkInfo?) { - binding.text1.text = network?.networkName ?: itemView.context.getString(fallbackName) - } - } -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/ui/coresettings/highlightlist/DragSortItemTouchHelperCallback.kt b/app/src/main/java/de/kuschku/quasseldroid/ui/coresettings/highlightlist/DragSortItemTouchHelperCallback.kt deleted file mode 100644 index 4ce534a48e8873ca846064ca8463cd8b99f4b694..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/ui/coresettings/highlightlist/DragSortItemTouchHelperCallback.kt +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.ui.coresettings.highlightlist - -import androidx.recyclerview.widget.ItemTouchHelper -import androidx.recyclerview.widget.RecyclerView - -class DragSortItemTouchHelperCallback(private val adapter: HighlightRuleAdapter) : - ItemTouchHelper.Callback() { - override fun isLongPressDragEnabled() = true - - override fun isItemViewSwipeEnabled() = true - - override fun getMovementFlags(recyclerView: RecyclerView, - viewHolder: RecyclerView.ViewHolder): Int { - val dragFlags = ItemTouchHelper.UP or ItemTouchHelper.DOWN - val swipeFlags = ItemTouchHelper.START or ItemTouchHelper.END - return makeMovementFlags(dragFlags, swipeFlags) - } - - override fun onMove(recyclerView: RecyclerView, viewHolder: RecyclerView.ViewHolder, - target: RecyclerView.ViewHolder): Boolean { - adapter.move(viewHolder.adapterPosition, target.adapterPosition) - return true - } - - override fun onSwiped(viewHolder: RecyclerView.ViewHolder, direction: Int) { - adapter.remove(viewHolder.adapterPosition) - } -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/ui/coresettings/highlightlist/HighlightListActivity.kt b/app/src/main/java/de/kuschku/quasseldroid/ui/coresettings/highlightlist/HighlightListActivity.kt deleted file mode 100644 index 181b4c30f57595626fb71dda6ed7ab86f3dc54cc..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/ui/coresettings/highlightlist/HighlightListActivity.kt +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.ui.coresettings.highlightlist - -import android.content.Context -import android.content.Intent -import de.kuschku.quasseldroid.util.ui.settings.ServiceBoundSettingsActivity - -class HighlightListActivity : ServiceBoundSettingsActivity(HighlightListFragment()) { - companion object { - fun launch(context: Context) = context.startActivity(intent(context)) - fun intent(context: Context) = Intent(context, HighlightListActivity::class.java) - } -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/ui/coresettings/highlightlist/HighlightListFragment.kt b/app/src/main/java/de/kuschku/quasseldroid/ui/coresettings/highlightlist/HighlightListFragment.kt deleted file mode 100644 index 4458a826f930bb4d86c0514424aa8c39ce740184..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/ui/coresettings/highlightlist/HighlightListFragment.kt +++ /dev/null @@ -1,258 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.ui.coresettings.highlightlist - -import android.app.Activity -import android.content.Intent -import android.os.Bundle -import android.view.LayoutInflater -import android.view.View -import android.view.ViewGroup -import android.widget.Button -import android.widget.Spinner -import androidx.appcompat.widget.SwitchCompat -import androidx.lifecycle.Observer -import androidx.recyclerview.widget.DefaultItemAnimator -import androidx.recyclerview.widget.ItemTouchHelper -import androidx.recyclerview.widget.LinearLayoutManager -import androidx.recyclerview.widget.RecyclerView -import butterknife.BindView -import butterknife.ButterKnife -import de.kuschku.libquassel.quassel.ExtendedFeature -import de.kuschku.libquassel.quassel.syncables.HighlightRuleManager -import de.kuschku.libquassel.quassel.syncables.interfaces.IHighlightRuleManager -import de.kuschku.libquassel.util.Optional -import de.kuschku.quasseldroid.R -import de.kuschku.quasseldroid.ui.coresettings.highlightrule.HighlightRuleActivity -import de.kuschku.quasseldroid.util.helper.toLiveData -import de.kuschku.quasseldroid.util.ui.settings.fragment.Changeable -import de.kuschku.quasseldroid.util.ui.settings.fragment.Savable -import de.kuschku.quasseldroid.util.ui.settings.fragment.ServiceBoundSettingsFragment -import de.kuschku.quasseldroid.util.ui.view.WarningBarView -import de.kuschku.quasseldroid.viewmodel.helper.EditorViewModelHelper -import javax.inject.Inject - -class HighlightListFragment : ServiceBoundSettingsFragment(), Savable, Changeable { - @BindView(R.id.feature_context_coresidehighlights) - lateinit var featureContextCoreSideHighlights: WarningBarView - - @BindView(R.id.highlight_nick_type) - lateinit var highlightNickType: Spinner - - @BindView(R.id.is_case_sensitive) - lateinit var isCaseSensitive: SwitchCompat - - @BindView(R.id.highlight_rules) - lateinit var rules: RecyclerView - - @BindView(R.id.new_highlight_rule) - lateinit var newHighlightRule: Button - - @BindView(R.id.highlight_ignore_rules) - lateinit var ignoreRules: RecyclerView - - @BindView(R.id.new_highlight_ignore_rule) - lateinit var newHighlightIgnoreRule: Button - - @Inject - lateinit var modelHelper: EditorViewModelHelper - - private var ruleManager: Pair<HighlightRuleManager, HighlightRuleManager>? = null - - private lateinit var rulesHelper: ItemTouchHelper - - private lateinit var ignoreRulesHelper: ItemTouchHelper - - private val rulesAdapter = HighlightRuleAdapter(::ruleClick, ::startRuleDrag) - - private val ignoreRulesAdapter = HighlightRuleAdapter(::ignoreRuleClick, ::startIgnoreRuleDrag) - - override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, - savedInstanceState: Bundle?): View? { - val view = inflater.inflate(R.layout.settings_highlightlist, container, false) - ButterKnife.bind(this, view) - - rules.adapter = rulesAdapter - rules.layoutManager = LinearLayoutManager(requireContext()) - rules.itemAnimator = DefaultItemAnimator() - - rulesHelper = ItemTouchHelper(DragSortItemTouchHelperCallback(rulesAdapter)) - rulesHelper.attachToRecyclerView(rules) - - ignoreRules.adapter = ignoreRulesAdapter - ignoreRules.layoutManager = LinearLayoutManager(requireContext()) - ignoreRules.itemAnimator = DefaultItemAnimator() - - ignoreRulesHelper = ItemTouchHelper(DragSortItemTouchHelperCallback(ignoreRulesAdapter)) - ignoreRulesHelper.attachToRecyclerView(ignoreRules) - - newHighlightRule.setOnClickListener { - startActivityForResult( - HighlightRuleActivity.intent(requireContext(), ignore = false), - REQUEST_CREATE_RULE - ) - } - - newHighlightIgnoreRule.setOnClickListener { - startActivityForResult( - HighlightRuleActivity.intent(requireContext(), ignore = true), - REQUEST_CREATE_IGNORE_RULE - ) - } - - val highlightNickTypeAdapter = HighlightNickTypeAdapter(listOf( - HighlightNickTypeItem( - value = IHighlightRuleManager.HighlightNickType.AllNicks, - name = R.string.settings_highlightlist_highlight_nick_all_nicks - ), - HighlightNickTypeItem( - value = IHighlightRuleManager.HighlightNickType.CurrentNick, - name = R.string.settings_highlightlist_highlight_nick_current_nick - ), - HighlightNickTypeItem( - value = IHighlightRuleManager.HighlightNickType.NoNick, - name = R.string.settings_highlightlist_highlight_nick_none - ) - )) - highlightNickType.adapter = highlightNickTypeAdapter - - modelHelper.highlightRuleManager - .filter(Optional<HighlightRuleManager>::isPresent) - .map(Optional<HighlightRuleManager>::get) - .toLiveData().observe(viewLifecycleOwner, Observer { - if (it != null) { - if (this.ruleManager == null) { - this.ruleManager = Pair(it, it.copy()) - this.ruleManager?.let { (_, data) -> - rulesAdapter.list = data.highlightRuleList().filter { !it.isInverse } - ignoreRulesAdapter.list = data.highlightRuleList().filter { it.isInverse } - highlightNickType.setSelection(highlightNickTypeAdapter.indexOf(data.highlightNick()) - ?: 0) - isCaseSensitive.isChecked = data.nicksCaseSensitive() - } - } - } - }) - - modelHelper.negotiatedFeatures.toLiveData().observe(viewLifecycleOwner, - Observer { (connected, features) -> - featureContextCoreSideHighlights.setMode( - if (!connected || features.hasFeature( - ExtendedFeature.CoreSideHighlights)) WarningBarView.MODE_NONE - else WarningBarView.MODE_ICON - ) - }) - - return view - } - - private fun ruleClick(rule: HighlightRuleManager.HighlightRule) { - startActivityForResult( - HighlightRuleActivity.intent(requireContext(), rule), - REQUEST_UPDATE_RULE - ) - } - - private fun startRuleDrag(holder: HighlightRuleAdapter.HighlightRuleViewHolder) = - rulesHelper.startDrag(holder) - - private fun ignoreRuleClick(rule: HighlightRuleManager.HighlightRule) { - startActivityForResult( - HighlightRuleActivity.intent(requireContext(), rule), - REQUEST_UPDATE_IGNORE_RULE - ) - } - - private fun startIgnoreRuleDrag(holder: HighlightRuleAdapter.HighlightRuleViewHolder) = - ignoreRulesHelper.startDrag(holder) - - private fun nextId(): Int { - val maxRuleId = rulesAdapter.list.maxBy { it.id }?.id - val maxIgnoreRuleId = ignoreRulesAdapter.list.maxBy { it.id }?.id - - return when { - maxRuleId != null && maxIgnoreRuleId != null -> maxOf(maxRuleId, maxIgnoreRuleId) + 1 - maxIgnoreRuleId != null -> maxIgnoreRuleId + 1 - maxRuleId != null -> maxRuleId + 1 - else -> 0 - } - } - - override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) { - if (resultCode == Activity.RESULT_OK && data != null) { - when (requestCode) { - REQUEST_UPDATE_RULE -> { - val oldRule = data.getSerializableExtra("old") as? HighlightRuleManager.HighlightRule - val newRule = data.getSerializableExtra("new") as? HighlightRuleManager.HighlightRule - - if (oldRule != null && newRule != null) { - rulesAdapter.replace(rulesAdapter.indexOf(oldRule.name), newRule) - } - } - REQUEST_CREATE_RULE -> { - val newRule = data.getSerializableExtra("new") as? HighlightRuleManager.HighlightRule - - if (newRule != null) { - rulesAdapter.add(newRule.copy(id = nextId())) - } - } - REQUEST_UPDATE_IGNORE_RULE -> { - val oldRule = data.getSerializableExtra("old") as? HighlightRuleManager.HighlightRule - val newRule = data.getSerializableExtra("new") as? HighlightRuleManager.HighlightRule - - if (oldRule != null && newRule != null) { - ignoreRulesAdapter.replace(ignoreRulesAdapter.indexOf(oldRule.name), newRule) - } - } - REQUEST_CREATE_IGNORE_RULE -> { - val newRule = data.getSerializableExtra("new") as? HighlightRuleManager.HighlightRule - - if (newRule != null) { - ignoreRulesAdapter.add(newRule.copy(id = nextId())) - } - } - } - } - } - - override fun onSave() = ruleManager?.let { (it, data) -> - applyChanges(data) - it.requestUpdate(data.toVariantMap()) - true - } ?: false - - override fun hasChanged() = ruleManager?.let { (it, data) -> - applyChanges(data) - !data.isEqual(it) - } == true - - private fun applyChanges(data: HighlightRuleManager) { - data.setHighlightNick(highlightNickType.selectedItemId.toInt()) - data.setNicksCaseSensitive(isCaseSensitive.isChecked) - data.setHighlightRuleList(rulesAdapter.list + ignoreRulesAdapter.list) - } - - companion object { - private const val REQUEST_UPDATE_RULE = 1 - private const val REQUEST_CREATE_RULE = 2 - private const val REQUEST_UPDATE_IGNORE_RULE = 3 - private const val REQUEST_CREATE_IGNORE_RULE = 4 - } -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/ui/coresettings/highlightlist/HighlightListFragmentProvider.kt b/app/src/main/java/de/kuschku/quasseldroid/ui/coresettings/highlightlist/HighlightListFragmentProvider.kt deleted file mode 100644 index d7804d7c639048f6fcf6bbbd8a92d2bac16c40a9..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/ui/coresettings/highlightlist/HighlightListFragmentProvider.kt +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.ui.coresettings.highlightlist - -import androidx.fragment.app.FragmentActivity -import dagger.Binds -import dagger.Module -import dagger.android.ContributesAndroidInjector - -@Module -abstract class HighlightListFragmentProvider { - @Binds - abstract fun bindFragmentActivity(activity: HighlightListActivity): FragmentActivity - - @ContributesAndroidInjector - abstract fun bindHighlightListFragment(): HighlightListFragment -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/ui/coresettings/highlightlist/HighlightNickTypeAdapter.kt b/app/src/main/java/de/kuschku/quasseldroid/ui/coresettings/highlightlist/HighlightNickTypeAdapter.kt deleted file mode 100644 index 6fcba82d71ad181b84c865125064f372fddf0d5b..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/ui/coresettings/highlightlist/HighlightNickTypeAdapter.kt +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.ui.coresettings.highlightlist - -import android.view.LayoutInflater -import android.view.ViewGroup -import androidx.appcompat.widget.ThemedSpinnerAdapter -import androidx.recyclerview.widget.RecyclerView -import de.kuschku.libquassel.quassel.syncables.interfaces.IHighlightRuleManager -import de.kuschku.quasseldroid.databinding.WidgetSpinnerItemMaterialBinding -import de.kuschku.quasseldroid.util.ui.ContextThemeWrapper -import de.kuschku.quasseldroid.util.ui.RecyclerSpinnerAdapter - -class HighlightNickTypeAdapter(val data: List<HighlightNickTypeItem>) : - RecyclerSpinnerAdapter<HighlightNickTypeAdapter.HighlightNickTypeViewHolder>(), - ThemedSpinnerAdapter { - - override fun isEmpty() = data.isEmpty() - - override fun onBindViewHolder(holder: HighlightNickTypeViewHolder, position: Int) = - holder.bind(getItem(position)) - - override fun onCreateViewHolder(parent: ViewGroup, dropDown: Boolean) - : HighlightNickTypeViewHolder { - val inflater = LayoutInflater.from( - if (dropDown) - ContextThemeWrapper(parent.context, dropDownViewTheme) - else - parent.context - ) - return HighlightNickTypeViewHolder( - WidgetSpinnerItemMaterialBinding.inflate(inflater, parent, false) - ) - } - - override fun getItem(position: Int) = data[position] - - override fun getItemId(position: Int) = getItem(position).value.value.toLong() - - override fun hasStableIds() = true - - override fun getCount() = data.size - - fun indexOf(value: IHighlightRuleManager.HighlightNickType): Int? { - for ((key, item) in data.withIndex()) { - if (item.value.value == value.value) { - return key - } - } - return null - } - - class HighlightNickTypeViewHolder( - private val binding: WidgetSpinnerItemMaterialBinding - ) : RecyclerView.ViewHolder(binding.root) { - fun bind(activity: HighlightNickTypeItem?) { - activity?.let { - binding.text1.setText(it.name) - } - } - } -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/ui/coresettings/highlightlist/HighlightNickTypeItem.kt b/app/src/main/java/de/kuschku/quasseldroid/ui/coresettings/highlightlist/HighlightNickTypeItem.kt deleted file mode 100644 index 554f56f0b776dbd64be830d1ea77da49dc2190b4..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/ui/coresettings/highlightlist/HighlightNickTypeItem.kt +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.ui.coresettings.highlightlist - -import androidx.annotation.StringRes -import de.kuschku.libquassel.quassel.syncables.interfaces.IHighlightRuleManager - -data class HighlightNickTypeItem( - val value: IHighlightRuleManager.HighlightNickType, - @StringRes val name: Int -) diff --git a/app/src/main/java/de/kuschku/quasseldroid/ui/coresettings/highlightlist/HighlightRuleAdapter.kt b/app/src/main/java/de/kuschku/quasseldroid/ui/coresettings/highlightlist/HighlightRuleAdapter.kt deleted file mode 100644 index 4ccadb7d9c7c9500c5f279581d2dab9770ee22bb..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/ui/coresettings/highlightlist/HighlightRuleAdapter.kt +++ /dev/null @@ -1,129 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.ui.coresettings.highlightlist - -import android.annotation.SuppressLint -import android.view.LayoutInflater -import android.view.MotionEvent -import android.view.ViewGroup -import androidx.recyclerview.widget.RecyclerView -import de.kuschku.libquassel.quassel.syncables.HighlightRuleManager -import de.kuschku.quasseldroid.databinding.SettingsHighlightlistRuleBinding -import de.kuschku.quasseldroid.util.helper.visibleIf -import java.util.* - -@SuppressLint("ClickableViewAccessibility") -class HighlightRuleAdapter( - private val clickListener: (HighlightRuleManager.HighlightRule) -> Unit, - private val dragListener: (HighlightRuleViewHolder) -> Unit -) : RecyclerView.Adapter<HighlightRuleAdapter.HighlightRuleViewHolder>() { - private val data = mutableListOf<HighlightRuleManager.HighlightRule>() - var list: List<HighlightRuleManager.HighlightRule> - get() = data - set(value) { - val length = data.size - data.clear() - notifyItemRangeRemoved(0, length) - data.addAll(value) - notifyItemRangeInserted(0, list.size) - } - - fun add(item: HighlightRuleManager.HighlightRule) { - val index = data.size - data.add(item) - notifyItemInserted(index) - } - - fun replace(index: Int, item: HighlightRuleManager.HighlightRule) { - data[index] = item - notifyItemChanged(index) - } - - fun indexOf(rule: String) = data.map(HighlightRuleManager.HighlightRule::name).indexOf(rule) - - fun remove(index: Int) { - data.removeAt(index) - notifyItemRemoved(index) - } - - fun move(from: Int, to: Int) { - Collections.swap(data, from, to) - notifyItemMoved(from, to) - } - - fun toggle(item: HighlightRuleManager.HighlightRule, isEnabled: Boolean) { - val index = indexOf(item.name) - data[index] = data[index].copy(isEnabled = isEnabled) - } - - override fun getItemCount() = data.size - - override fun onCreateViewHolder(parent: ViewGroup, viewType: Int) = HighlightRuleViewHolder( - SettingsHighlightlistRuleBinding.inflate(LayoutInflater.from(parent.context), parent, false), - clickListener, - ::toggle, - dragListener - ) - - override fun onBindViewHolder(holder: HighlightRuleViewHolder, position: Int) { - holder.bind(data[position]) - } - - class HighlightRuleViewHolder( - private val binding: SettingsHighlightlistRuleBinding, - clickListener: (HighlightRuleManager.HighlightRule) -> Unit, - toggleListener: (HighlightRuleManager.HighlightRule, Boolean) -> Unit, - dragListener: (HighlightRuleViewHolder) -> Unit - ) : RecyclerView.ViewHolder(binding.root) { - private var item: HighlightRuleManager.HighlightRule? = null - - init { - itemView.setOnClickListener { - item?.let { - clickListener(it) - } - } - binding.toggle.setOnCheckedChangeListener { _, isChecked -> - item?.let { - toggleListener.invoke(it, isChecked) - } - } - binding.handle.setOnTouchListener { _, event -> - if (event.action == MotionEvent.ACTION_DOWN) { - dragListener.invoke(this) - } - false - } - } - - fun bind(item: HighlightRuleManager.HighlightRule) { - this.item = item - binding.name.text = item.name - binding.nameRow.visibleIf(item.name.isNotBlank()) - binding.sender.text = item.sender - binding.senderRow.visibleIf(item.sender.isNotBlank()) - binding.channel.text = item.channel - binding.channelRow.visibleIf(item.channel.isNotBlank()) - binding.matchAll.visibleIf(item.name.isBlank() && item.sender.isBlank() && item.channel.isBlank()) - - binding.toggle.isChecked = item.isEnabled - } - } -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/ui/coresettings/highlightrule/HighlightRuleActivity.kt b/app/src/main/java/de/kuschku/quasseldroid/ui/coresettings/highlightrule/HighlightRuleActivity.kt deleted file mode 100644 index 8ea74d48767f0f3ec95c0fb4db25b738342a8ce7..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/ui/coresettings/highlightrule/HighlightRuleActivity.kt +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.ui.coresettings.highlightrule - -import android.content.Context -import android.content.Intent -import de.kuschku.libquassel.quassel.syncables.HighlightRuleManager -import de.kuschku.quasseldroid.util.ui.settings.ServiceBoundSettingsActivity - -class HighlightRuleActivity : ServiceBoundSettingsActivity(HighlightRuleFragment()) { - companion object { - fun launch( - context: Context, - rule: HighlightRuleManager.HighlightRule? = null, - ignore: Boolean = false - ) = context.startActivity(intent(context, rule, ignore)) - - fun intent( - context: Context, - rule: HighlightRuleManager.HighlightRule? = null, - ignore: Boolean = false - ) = Intent(context, HighlightRuleActivity::class.java).apply { - if (rule != null) { - putExtra("item", rule) - } - putExtra("inverse", ignore) - } - } -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/ui/coresettings/highlightrule/HighlightRuleFragment.kt b/app/src/main/java/de/kuschku/quasseldroid/ui/coresettings/highlightrule/HighlightRuleFragment.kt deleted file mode 100644 index 3b974fe3fdf98ae4327d9455dd0c220e3f63da91..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/ui/coresettings/highlightrule/HighlightRuleFragment.kt +++ /dev/null @@ -1,108 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.ui.coresettings.highlightrule - -import android.app.Activity -import android.content.Intent -import android.os.Bundle -import android.view.LayoutInflater -import android.view.View -import android.view.ViewGroup -import android.widget.EditText -import androidx.appcompat.widget.SwitchCompat -import butterknife.BindView -import butterknife.ButterKnife -import de.kuschku.libquassel.quassel.syncables.HighlightRuleManager -import de.kuschku.quasseldroid.R -import de.kuschku.quasseldroid.util.ui.settings.fragment.Changeable -import de.kuschku.quasseldroid.util.ui.settings.fragment.Savable -import de.kuschku.quasseldroid.util.ui.settings.fragment.ServiceBoundSettingsFragment - -class HighlightRuleFragment : ServiceBoundSettingsFragment(), Savable, - Changeable { - @BindView(R.id.enabled) - lateinit var enabled: SwitchCompat - - @BindView(R.id.name) - lateinit var name: EditText - - @BindView(R.id.is_regex) - lateinit var isRegex: SwitchCompat - - @BindView(R.id.is_case_sensitive) - lateinit var isCaseSensitive: SwitchCompat - - @BindView(R.id.sender) - lateinit var sender: EditText - - @BindView(R.id.channel) - lateinit var channel: EditText - - private var rule: HighlightRuleManager.HighlightRule? = null - - private var isInverse: Boolean? = null - - override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, - savedInstanceState: Bundle?): View? { - - val view = inflater.inflate(R.layout.settings_highlightrule, container, false) - ButterKnife.bind(this, view) - - isInverse = arguments?.getBoolean("inverse") - (arguments?.getSerializable("item") as? HighlightRuleManager.HighlightRule)?.let { - rule = it - } - - rule?.let { data -> - enabled.isChecked = data.isEnabled - name.setText(data.name) - isRegex.isChecked = data.isRegEx - isCaseSensitive.isChecked = data.isCaseSensitive - sender.setText(data.sender) - channel.setText(data.channel) - } - - return view - } - - private fun applyChanges() = HighlightRuleManager.HighlightRule( - id = rule?.id ?: -1, - isInverse = rule?.isInverse ?: isInverse ?: false, - isEnabled = enabled.isChecked, - name = name.text.toString(), - isRegEx = isRegex.isChecked, - isCaseSensitive = isCaseSensitive.isChecked, - sender = sender.text.toString(), - channel = channel.text.toString() - ) - - override fun onSave() = rule.let { data -> - requireActivity().setResult( - Activity.RESULT_OK, - Intent().also { - it.putExtra("old", data) - it.putExtra("new", applyChanges()) - } - ) - true - } - - override fun hasChanged() = rule != applyChanges() -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/ui/coresettings/highlightrule/HighlightRuleFragmentProvider.kt b/app/src/main/java/de/kuschku/quasseldroid/ui/coresettings/highlightrule/HighlightRuleFragmentProvider.kt deleted file mode 100644 index a2659f0bef4404cd7b038ac4b3fdc5fa8eda7717..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/ui/coresettings/highlightrule/HighlightRuleFragmentProvider.kt +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.ui.coresettings.highlightrule - -import androidx.fragment.app.FragmentActivity -import dagger.Binds -import dagger.Module -import dagger.android.ContributesAndroidInjector - -@Module -abstract class HighlightRuleFragmentProvider { - @Binds - abstract fun bindFragmentActivity(activity: HighlightRuleActivity): FragmentActivity - - @ContributesAndroidInjector - abstract fun bindHighlightRuleFragment(): HighlightRuleFragment -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/ui/coresettings/identity/DragSortItemTouchHelperCallback.kt b/app/src/main/java/de/kuschku/quasseldroid/ui/coresettings/identity/DragSortItemTouchHelperCallback.kt deleted file mode 100644 index 33a59db613cd240b64111c399eeff916d2f5170b..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/ui/coresettings/identity/DragSortItemTouchHelperCallback.kt +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.ui.coresettings.identity - -import androidx.recyclerview.widget.ItemTouchHelper -import androidx.recyclerview.widget.RecyclerView - -class DragSortItemTouchHelperCallback(private val adapter: IdentityNicksAdapter) : - ItemTouchHelper.Callback() { - override fun isLongPressDragEnabled() = true - - override fun isItemViewSwipeEnabled() = true - - override fun getMovementFlags(recyclerView: RecyclerView, - viewHolder: RecyclerView.ViewHolder): Int { - val dragFlags = ItemTouchHelper.UP or ItemTouchHelper.DOWN - val swipeFlags = ItemTouchHelper.START or ItemTouchHelper.END - return makeMovementFlags(dragFlags, - swipeFlags) - } - - override fun onMove(recyclerView: RecyclerView, viewHolder: RecyclerView.ViewHolder, - target: RecyclerView.ViewHolder): Boolean { - adapter.moveNick(viewHolder.adapterPosition, target.adapterPosition) - return true - } - - override fun onSwiped(viewHolder: RecyclerView.ViewHolder, direction: Int) { - adapter.removeNick(viewHolder.adapterPosition) - } -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/ui/coresettings/identity/IdentityBaseFragment.kt b/app/src/main/java/de/kuschku/quasseldroid/ui/coresettings/identity/IdentityBaseFragment.kt deleted file mode 100644 index e9daf44c8aaf94bef7e23bb573a313f7a930dd58..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/ui/coresettings/identity/IdentityBaseFragment.kt +++ /dev/null @@ -1,209 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.ui.coresettings.identity - -import android.os.Bundle -import android.view.LayoutInflater -import android.view.View -import android.view.ViewGroup -import android.widget.Button -import android.widget.EditText -import androidx.appcompat.widget.SwitchCompat -import androidx.core.view.ViewCompat -import androidx.lifecycle.Observer -import androidx.recyclerview.widget.ItemTouchHelper -import androidx.recyclerview.widget.LinearLayoutManager -import androidx.recyclerview.widget.RecyclerView -import butterknife.BindView -import butterknife.ButterKnife -import com.afollestad.materialdialogs.MaterialDialog -import de.kuschku.libquassel.protocol.IdentityId -import de.kuschku.libquassel.quassel.syncables.Identity -import de.kuschku.libquassel.session.ISession -import de.kuschku.libquassel.util.Optional -import de.kuschku.quasseldroid.R -import de.kuschku.quasseldroid.defaults.Defaults -import de.kuschku.quasseldroid.util.helper.setDependent -import de.kuschku.quasseldroid.util.helper.toLiveData -import de.kuschku.quasseldroid.util.ui.settings.fragment.Changeable -import de.kuschku.quasseldroid.util.ui.settings.fragment.Savable -import de.kuschku.quasseldroid.util.ui.settings.fragment.ServiceBoundSettingsFragment -import de.kuschku.quasseldroid.viewmodel.helper.EditorViewModelHelper -import javax.inject.Inject - -abstract class IdentityBaseFragment(private val initDefault: Boolean) : - ServiceBoundSettingsFragment(), Savable, Changeable { - - @BindView(R.id.identity_name) - lateinit var identityName: EditText - - @BindView(R.id.real_name) - lateinit var realName: EditText - - @BindView(R.id.ident) - lateinit var ident: EditText - - @BindView(R.id.nicks) - lateinit var nicks: RecyclerView - - @BindView(R.id.new_nick) - lateinit var newNick: Button - - @BindView(R.id.kick_reason) - lateinit var kickReason: EditText - - @BindView(R.id.part_reason) - lateinit var partReason: EditText - - @BindView(R.id.quit_reason) - lateinit var quitReason: EditText - - @BindView(R.id.away_reason) - lateinit var awayReason: EditText - - @BindView(R.id.detach_away) - lateinit var detachAway: SwitchCompat - - @BindView(R.id.detach_away_group) - lateinit var detachAwayGroup: ViewGroup - - @BindView(R.id.detach_away_reason) - lateinit var detachAwayReason: EditText - - @Inject - lateinit var modelHelper: EditorViewModelHelper - - protected var identity: Pair<Identity?, Identity>? = null - - private lateinit var adapter: IdentityNicksAdapter - private lateinit var helper: ItemTouchHelper - - override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, - savedInstanceState: Bundle?): View? { - val view = inflater.inflate(R.layout.settings_identity, container, false) - ButterKnife.bind(this, view) - - val identityId = IdentityId(arguments?.getInt("identity", -1) ?: -1) - - adapter = IdentityNicksAdapter(::nickClick, ::startDrag) - nicks.layoutManager = LinearLayoutManager(requireContext()) - nicks.adapter = adapter - ViewCompat.setNestedScrollingEnabled(nicks, false) - - val callback = DragSortItemTouchHelperCallback(adapter) - helper = ItemTouchHelper(callback) - helper.attachToRecyclerView(nicks) - - newNick.setOnClickListener { - MaterialDialog.Builder(requireContext()) - .input(null, null, false) { _, _ -> } - .title(R.string.label_new_nick) - .negativeText(R.string.label_cancel) - .positiveText(R.string.label_save) - .onPositive { dialog, _ -> - dialog.inputEditText?.text?.toString()?.let { - if (it.isNotBlank()) { - adapter.addNick(it) - } - } - }.build().show() - } - - if (initDefault) { - modelHelper.connectedSession - .filter(Optional<ISession>::isPresent) - .map(Optional<ISession>::get) - .firstElement() - .toLiveData().observe(viewLifecycleOwner, Observer { - it?.let { - update(Defaults.identity(requireContext(), it.proxy)) - } - }) - } else { - modelHelper.identities.map { Optional.ofNullable(it[identityId]) } - .filter(Optional<Identity>::isPresent) - .map(Optional<Identity>::get) - .firstElement() - .toLiveData().observe(viewLifecycleOwner, Observer { - it?.let { - update(it) - } - }) - } - - detachAway.setDependent(detachAwayGroup) - - return view - } - - private fun update(it: Identity) { - if (this.identity == null) { - this.identity = Pair(it, it.copy()) - this.identity?.let { (_, data) -> - identityName.setText(data.identityName()) - realName.setText(data.realName()) - ident.setText(data.ident()) - kickReason.setText(data.kickReason()) - partReason.setText(data.partReason()) - quitReason.setText(data.quitReason()) - awayReason.setText(data.awayReason()) - detachAway.isChecked = data.detachAwayEnabled() - detachAwayReason.setText(data.detachAwayReason()) - adapter.nicks = data.nicks() - } - } - } - - private fun startDrag(holder: IdentityNicksAdapter.IdentityNickViewHolder) = - helper.startDrag(holder) - - private fun nickClick(index: Int, nick: String) { - MaterialDialog.Builder(requireContext()) - .input(null, nick, false) { _, _ -> } - .title(R.string.label_edit_nick) - .negativeText(R.string.label_cancel) - .positiveText(R.string.label_save) - .onPositive { dialog, _ -> - dialog.inputEditText?.text?.toString()?.let { - if (it.isNotBlank()) { - adapter.replaceNick(index, it) - } - } - }.build().show() - } - - override fun hasChanged() = identity?.let { (it, data) -> - applyChanges(data) - it == null || !data.isEqual(it) - } ?: true - - protected fun applyChanges(data: Identity) { - data.setIdentityName(identityName.text.toString()) - data.setRealName(realName.text.toString()) - data.setIdent(ident.text.toString()) - data.setKickReason(kickReason.text.toString()) - data.setPartReason(partReason.text.toString()) - data.setQuitReason(quitReason.text.toString()) - data.setAwayReason(awayReason.text.toString()) - data.setDetachAwayEnabled(detachAway.isChecked) - data.setDetachAwayReason(detachAwayReason.text.toString()) - data.setNicks(adapter.nicks) - } -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/ui/coresettings/identity/IdentityCreateActivity.kt b/app/src/main/java/de/kuschku/quasseldroid/ui/coresettings/identity/IdentityCreateActivity.kt deleted file mode 100644 index 2c4de119ee1772a71625149ddbf5c45015a2e462..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/ui/coresettings/identity/IdentityCreateActivity.kt +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.ui.coresettings.identity - -import android.content.Context -import android.content.Intent -import de.kuschku.quasseldroid.util.ui.settings.ServiceBoundSettingsActivity - -class IdentityCreateActivity : ServiceBoundSettingsActivity(IdentityCreateFragment()) { - companion object { - fun launch(context: Context) = context.startActivity(intent(context)) - fun intent(context: Context) = Intent(context, IdentityCreateActivity::class.java) - } -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/ui/coresettings/identity/IdentityCreateFragment.kt b/app/src/main/java/de/kuschku/quasseldroid/ui/coresettings/identity/IdentityCreateFragment.kt deleted file mode 100644 index 28cec020ef9c467148cf604c52b18611a434b0ff..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/ui/coresettings/identity/IdentityCreateFragment.kt +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.ui.coresettings.identity - -import de.kuschku.libquassel.util.helper.value - -class IdentityCreateFragment : IdentityBaseFragment(true) { - override fun onSave() = modelHelper.connectedSession.value?.orNull()?.let { session -> - identity?.let { (_, data) -> - applyChanges(data) - session.rpcHandler.createIdentity(data, mapOf()) - true - } ?: false - } ?: false -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/ui/coresettings/identity/IdentityCreateFragmentProvider.kt b/app/src/main/java/de/kuschku/quasseldroid/ui/coresettings/identity/IdentityCreateFragmentProvider.kt deleted file mode 100644 index 2f93ae0cd8b6c5225c9a9fd4d4180586b3a6dadc..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/ui/coresettings/identity/IdentityCreateFragmentProvider.kt +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.ui.coresettings.identity - -import androidx.fragment.app.FragmentActivity -import dagger.Binds -import dagger.Module -import dagger.android.ContributesAndroidInjector - -@Module -abstract class IdentityCreateFragmentProvider { - @Binds - abstract fun bindFragmentActivity(activity: IdentityCreateActivity): FragmentActivity - - @ContributesAndroidInjector - abstract fun bindIdentityCreateFragment(): IdentityCreateFragment -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/ui/coresettings/identity/IdentityEditActivity.kt b/app/src/main/java/de/kuschku/quasseldroid/ui/coresettings/identity/IdentityEditActivity.kt deleted file mode 100644 index 14f79dad8f456e1ce6f59b4b728d983dea756708..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/ui/coresettings/identity/IdentityEditActivity.kt +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.ui.coresettings.identity - -import android.content.Context -import android.content.Intent -import de.kuschku.libquassel.protocol.IdentityId -import de.kuschku.quasseldroid.util.ui.settings.ServiceBoundSettingsActivity - -class IdentityEditActivity : ServiceBoundSettingsActivity(IdentityEditFragment()) { - companion object { - fun launch( - context: Context, - identity: IdentityId - ) = context.startActivity(intent(context, identity)) - - fun intent( - context: Context, - identity: IdentityId - ) = Intent(context, IdentityEditActivity::class.java).apply { - putExtra("identity", identity.id) - } - } -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/ui/coresettings/identity/IdentityEditFragment.kt b/app/src/main/java/de/kuschku/quasseldroid/ui/coresettings/identity/IdentityEditFragment.kt deleted file mode 100644 index 022a7aa668db699c179203cb6fed29a80d3a4510..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/ui/coresettings/identity/IdentityEditFragment.kt +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.ui.coresettings.identity - -import de.kuschku.libquassel.util.helper.value -import de.kuschku.quasseldroid.util.ui.settings.fragment.Deletable - -class IdentityEditFragment : IdentityBaseFragment(false), Deletable { - override fun onSave() = identity?.let { (it, data) -> - applyChanges(data) - it?.requestUpdate(data.toVariantMap()) - true - } ?: false - - override fun onDelete() { - identity?.let { (it, _) -> - it?.let { - modelHelper.connectedSession.value?.orNull()?.rpcHandler?.removeIdentity(it.id()) - } - } - } -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/ui/coresettings/identity/IdentityEditFragmentProvider.kt b/app/src/main/java/de/kuschku/quasseldroid/ui/coresettings/identity/IdentityEditFragmentProvider.kt deleted file mode 100644 index 7c7a4f45562f0689f3ad8a69cdfd614cf9f1d520..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/ui/coresettings/identity/IdentityEditFragmentProvider.kt +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.ui.coresettings.identity - -import androidx.fragment.app.FragmentActivity -import dagger.Binds -import dagger.Module -import dagger.android.ContributesAndroidInjector - -@Module -abstract class IdentityEditFragmentProvider { - @Binds - abstract fun bindFragmentActivity(activity: IdentityEditActivity): FragmentActivity - - @ContributesAndroidInjector - abstract fun bindIdentityEditFragment(): IdentityEditFragment -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/ui/coresettings/identity/IdentityNicksAdapter.kt b/app/src/main/java/de/kuschku/quasseldroid/ui/coresettings/identity/IdentityNicksAdapter.kt deleted file mode 100644 index 4bffa58efc7fc8242673bf5bb365b84547fc928c..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/ui/coresettings/identity/IdentityNicksAdapter.kt +++ /dev/null @@ -1,106 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.ui.coresettings.identity - -import android.annotation.SuppressLint -import android.view.LayoutInflater -import android.view.MotionEvent -import android.view.ViewGroup -import androidx.recyclerview.widget.RecyclerView -import de.kuschku.quasseldroid.databinding.SettingsIdentityNickBinding -import java.util.* - -@SuppressLint("ClickableViewAccessibility") -class IdentityNicksAdapter( - private val clickListener: (Int, String) -> Unit, - private val dragListener: (IdentityNickViewHolder) -> Unit -) : - RecyclerView.Adapter<IdentityNicksAdapter.IdentityNickViewHolder>() { - private val data = mutableListOf<String>() - var nicks: List<String> - get() = data - set(value) { - val length = data.size - data.clear() - notifyItemRangeRemoved(0, length) - data.addAll(value) - notifyItemRangeInserted(0, nicks.size) - } - - fun addNick(nick: String) { - val index = data.size - data.add(nick) - notifyItemInserted(index) - } - - fun replaceNick(index: Int, nick: String) { - data[index] = nick - notifyItemChanged(index) - } - - fun removeNick(index: Int) { - data.removeAt(index) - notifyItemRemoved(index) - } - - fun moveNick(from: Int, to: Int) { - Collections.swap(data, from, to) - notifyItemMoved(from, to) - } - - override fun getItemCount() = data.size - - override fun onCreateViewHolder(parent: ViewGroup, viewType: Int) = IdentityNickViewHolder( - SettingsIdentityNickBinding.inflate(LayoutInflater.from(parent.context), parent, false), - clickListener, - dragListener - ) - - override fun onBindViewHolder(holder: IdentityNickViewHolder, position: Int) { - holder.bind(data[position]) - } - - class IdentityNickViewHolder( - private val binding: SettingsIdentityNickBinding, - private val clickListener: (Int, String) -> Unit, - dragListener: (IdentityNickViewHolder) -> Unit - ) : RecyclerView.ViewHolder(binding.root) { - private var item: String? = null - - init { - itemView.setOnClickListener { - item?.let { - clickListener(adapterPosition, it) - } - } - binding.handle.setOnTouchListener { _, event -> - if (event.action == MotionEvent.ACTION_DOWN) { - dragListener.invoke(this) - } - false - } - } - - fun bind(item: String) { - this.item = item - binding.nick.text = item - } - } -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/ui/coresettings/ignoreitem/IgnoreItemActivity.kt b/app/src/main/java/de/kuschku/quasseldroid/ui/coresettings/ignoreitem/IgnoreItemActivity.kt deleted file mode 100644 index 61d18ce707cd5f1d7eb9a25103b1d5a537b8fc94..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/ui/coresettings/ignoreitem/IgnoreItemActivity.kt +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.ui.coresettings.ignoreitem - -import android.content.Context -import android.content.Intent -import de.kuschku.libquassel.quassel.syncables.IgnoreListManager -import de.kuschku.quasseldroid.util.ui.settings.ServiceBoundSettingsActivity - -class IgnoreItemActivity : ServiceBoundSettingsActivity(IgnoreItemFragment()) { - companion object { - fun launch( - context: Context, - item: IgnoreListManager.IgnoreListItem? = null, - addRule: String? = null - ) = context.startActivity(intent(context, item)) - - fun intent( - context: Context, - item: IgnoreListManager.IgnoreListItem? = null, - addRule: String? = null - ) = Intent(context, IgnoreItemActivity::class.java).apply { - if (item != null) { - putExtra("item", item) - } - if (addRule != null) { - putExtra("add_rule", addRule) - } - } - } -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/ui/coresettings/ignoreitem/IgnoreItemFragment.kt b/app/src/main/java/de/kuschku/quasseldroid/ui/coresettings/ignoreitem/IgnoreItemFragment.kt deleted file mode 100644 index 2bb07c32bd045ac8e1bda895550f28d04f62a686..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/ui/coresettings/ignoreitem/IgnoreItemFragment.kt +++ /dev/null @@ -1,175 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.ui.coresettings.ignoreitem - -import android.app.Activity -import android.content.Intent -import android.os.Bundle -import android.view.LayoutInflater -import android.view.View -import android.view.ViewGroup -import android.widget.AdapterView -import android.widget.EditText -import android.widget.Spinner -import androidx.appcompat.widget.SwitchCompat -import butterknife.BindView -import butterknife.ButterKnife -import de.kuschku.libquassel.quassel.syncables.IgnoreListManager -import de.kuschku.quasseldroid.R -import de.kuschku.quasseldroid.util.ui.AnimationHelper -import de.kuschku.quasseldroid.util.ui.settings.fragment.Changeable -import de.kuschku.quasseldroid.util.ui.settings.fragment.Savable -import de.kuschku.quasseldroid.util.ui.settings.fragment.ServiceBoundSettingsFragment - -class IgnoreItemFragment : ServiceBoundSettingsFragment(), Savable, - Changeable { - @BindView(R.id.enabled) - lateinit var enabled: SwitchCompat - - @BindView(R.id.ignore_rule) - lateinit var ignoreRule: EditText - - @BindView(R.id.isregex) - lateinit var isRegEx: SwitchCompat - - @BindView(R.id.type) - lateinit var type: Spinner - - @BindView(R.id.strictness) - lateinit var strictness: Spinner - - @BindView(R.id.scope) - lateinit var scope: Spinner - - @BindView(R.id.scope_rule) - lateinit var scopeRule: EditText - - @BindView(R.id.scopegroup) - lateinit var scopegroup: ViewGroup - - private var item: IgnoreListManager.IgnoreListItem? = null - - override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, - savedInstanceState: Bundle?): View? { - val view = inflater.inflate(R.layout.settings_ignoreitem, container, false) - ButterKnife.bind(this, view) - - (arguments?.getSerializable("item") as? IgnoreListManager.IgnoreListItem)?.let { - item = it - } - - val typeAdapter = IgnoreTypeAdapter(listOf( - IgnoreTypeItem( - value = IgnoreListManager.IgnoreType.SenderIgnore, - name = R.string.settings_ignoreitem_type_sender - ), - IgnoreTypeItem( - value = IgnoreListManager.IgnoreType.MessageIgnore, - name = R.string.settings_ignoreitem_type_message - ), - IgnoreTypeItem( - value = IgnoreListManager.IgnoreType.CtcpIgnore, - name = R.string.settings_ignoreitem_type_ctcp - ) - )) - type.adapter = typeAdapter - - val strictnessAdapter = StrictnessTypeAdapter(listOf( - StrictnessTypeItem( - value = IgnoreListManager.StrictnessType.SoftStrictness, - name = R.string.settings_ignoreitem_strictness_soft - ), - StrictnessTypeItem( - value = IgnoreListManager.StrictnessType.HardStrictness, - name = R.string.settings_ignoreitem_strictness_hard - ) - )) - strictness.adapter = strictnessAdapter - - val scopeAdapter = ScopeTypeAdapter(listOf( - ScopeTypeItem( - value = IgnoreListManager.ScopeType.GlobalScope, - name = R.string.settings_ignoreitem_scope_global - ), - ScopeTypeItem( - value = IgnoreListManager.ScopeType.NetworkScope, - name = R.string.settings_ignoreitem_scope_network - ), - ScopeTypeItem( - value = IgnoreListManager.ScopeType.ChannelScope, - name = R.string.settings_ignoreitem_scope_channel - ) - )) - scope.adapter = scopeAdapter - - val addRule = arguments?.getString("add_rule") - val data = item - if (data != null) { - enabled.isChecked = data.isActive - ignoreRule.setText(data.ignoreRule) - isRegEx.isChecked = data.isRegEx - type.setSelection(typeAdapter.indexOf(data.type) ?: 0) - strictness.setSelection(strictnessAdapter.indexOf(data.strictness) ?: 0) - scope.setSelection(scopeAdapter.indexOf(data.scope) ?: 0) - scopeRule.setText(data.scopeRule) - } else if (addRule != null) { - ignoreRule.setText(addRule) - } - - scope.onItemSelectedListener = object : AdapterView.OnItemSelectedListener { - override fun onNothingSelected(parent: AdapterView<*>?) { - AnimationHelper.collapse(scopegroup) - } - - override fun onItemSelected(parent: AdapterView<*>?, view: View?, position: Int, id: Long) { - if (id.toInt() == IgnoreListManager.ScopeType.GlobalScope.value) { - AnimationHelper.collapse(scopegroup) - } else { - AnimationHelper.expand(scopegroup) - } - } - } - - return view - } - - private fun applyChanges() = IgnoreListManager.IgnoreListItem( - isActive = enabled.isChecked, - ignoreRule = ignoreRule.text.toString(), - isRegEx = isRegEx.isChecked, - type = type.selectedItemId.toInt(), - strictness = strictness.selectedItemId.toInt(), - scope = scope.selectedItemId.toInt(), - scopeRule = scopeRule.text.toString() - ) - - override fun onSave() = item.let { data -> - requireActivity().setResult( - Activity.RESULT_OK, - Intent().also { - it.putExtra("old", data) - it.putExtra("new", applyChanges()) - } - ) - true - } - - override fun hasChanged() = item != applyChanges() -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/ui/coresettings/ignoreitem/IgnoreItemFragmentProvider.kt b/app/src/main/java/de/kuschku/quasseldroid/ui/coresettings/ignoreitem/IgnoreItemFragmentProvider.kt deleted file mode 100644 index b9131763f048dbb4789351dfc8db305d95967614..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/ui/coresettings/ignoreitem/IgnoreItemFragmentProvider.kt +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.ui.coresettings.ignoreitem - -import androidx.fragment.app.FragmentActivity -import dagger.Binds -import dagger.Module -import dagger.android.ContributesAndroidInjector - -@Module -abstract class IgnoreItemFragmentProvider { - @Binds - abstract fun bindFragmentActivity(activity: IgnoreItemActivity): FragmentActivity - - @ContributesAndroidInjector - abstract fun bindIgnoreItemFragment(): IgnoreItemFragment -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/ui/coresettings/ignoreitem/IgnoreTypeAdapter.kt b/app/src/main/java/de/kuschku/quasseldroid/ui/coresettings/ignoreitem/IgnoreTypeAdapter.kt deleted file mode 100644 index 2edb86a3a48611be0275db652c0f7b1a29d8f0d4..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/ui/coresettings/ignoreitem/IgnoreTypeAdapter.kt +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.ui.coresettings.ignoreitem - -import android.view.LayoutInflater -import android.view.ViewGroup -import androidx.appcompat.widget.ThemedSpinnerAdapter -import androidx.recyclerview.widget.RecyclerView -import de.kuschku.libquassel.quassel.syncables.IgnoreListManager -import de.kuschku.quasseldroid.databinding.WidgetSpinnerItemMaterialBinding -import de.kuschku.quasseldroid.util.ui.ContextThemeWrapper -import de.kuschku.quasseldroid.util.ui.RecyclerSpinnerAdapter - -class IgnoreTypeAdapter(val data: List<IgnoreTypeItem>) : - RecyclerSpinnerAdapter<IgnoreTypeAdapter.IgnoreTypeViewHolder>(), - ThemedSpinnerAdapter { - - override fun isEmpty() = data.isEmpty() - - override fun onBindViewHolder(holder: IgnoreTypeViewHolder, position: Int) = - holder.bind(getItem(position)) - - override fun onCreateViewHolder(parent: ViewGroup, dropDown: Boolean) - : IgnoreTypeViewHolder { - val inflater = LayoutInflater.from( - if (dropDown) - ContextThemeWrapper(parent.context, dropDownViewTheme) - else - parent.context - ) - return IgnoreTypeViewHolder( - WidgetSpinnerItemMaterialBinding.inflate(inflater, parent, false) - ) - } - - override fun getItem(position: Int) = data[position] - - override fun getItemId(position: Int) = getItem(position).value.value.toLong() - - override fun hasStableIds() = true - - override fun getCount() = data.size - - fun indexOf(value: IgnoreListManager.IgnoreType): Int? { - for ((key, item) in data.withIndex()) { - if (item.value.value == value.value) { - return key - } - } - return null - } - - class IgnoreTypeViewHolder( - private val binding: WidgetSpinnerItemMaterialBinding - ) : RecyclerView.ViewHolder(binding.root) { - fun bind(activity: IgnoreTypeItem?) { - activity?.let { - binding.text1.setText(it.name) - } - } - } -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/ui/coresettings/ignoreitem/IgnoreTypeItem.kt b/app/src/main/java/de/kuschku/quasseldroid/ui/coresettings/ignoreitem/IgnoreTypeItem.kt deleted file mode 100644 index 5731e541256fd4e3df2cdbffa7774a6e8967b698..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/ui/coresettings/ignoreitem/IgnoreTypeItem.kt +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.ui.coresettings.ignoreitem - -import androidx.annotation.StringRes -import de.kuschku.libquassel.quassel.syncables.IgnoreListManager - -data class IgnoreTypeItem(val value: IgnoreListManager.IgnoreType, @StringRes val name: Int) diff --git a/app/src/main/java/de/kuschku/quasseldroid/ui/coresettings/ignoreitem/ScopeTypeAdapter.kt b/app/src/main/java/de/kuschku/quasseldroid/ui/coresettings/ignoreitem/ScopeTypeAdapter.kt deleted file mode 100644 index 1d0f4a1b8e7facfe94dfa113529ad41febf24613..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/ui/coresettings/ignoreitem/ScopeTypeAdapter.kt +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.ui.coresettings.ignoreitem - -import android.view.LayoutInflater -import android.view.ViewGroup -import androidx.appcompat.widget.ThemedSpinnerAdapter -import androidx.recyclerview.widget.RecyclerView -import de.kuschku.libquassel.quassel.syncables.IgnoreListManager -import de.kuschku.quasseldroid.databinding.WidgetSpinnerItemMaterialBinding -import de.kuschku.quasseldroid.util.ui.ContextThemeWrapper -import de.kuschku.quasseldroid.util.ui.RecyclerSpinnerAdapter - -class ScopeTypeAdapter(val data: List<ScopeTypeItem>) : - RecyclerSpinnerAdapter<ScopeTypeAdapter.ScopeTypeViewHolder>(), - ThemedSpinnerAdapter { - - override fun isEmpty() = data.isEmpty() - - override fun onBindViewHolder(holder: ScopeTypeViewHolder, position: Int) = - holder.bind(getItem(position)) - - override fun onCreateViewHolder(parent: ViewGroup, dropDown: Boolean) - : ScopeTypeViewHolder { - val inflater = LayoutInflater.from( - if (dropDown) - ContextThemeWrapper(parent.context, dropDownViewTheme) - else - parent.context - ) - return ScopeTypeViewHolder( - WidgetSpinnerItemMaterialBinding.inflate(inflater, parent, false) - ) - } - - override fun getItem(position: Int) = data[position] - - override fun getItemId(position: Int) = getItem(position).value.value.toLong() - - override fun hasStableIds() = true - - override fun getCount() = data.size - - fun indexOf(value: IgnoreListManager.ScopeType): Int? { - for ((key, item) in data.withIndex()) { - if (item.value.value == value.value) { - return key - } - } - return null - } - - class ScopeTypeViewHolder( - private val binding: WidgetSpinnerItemMaterialBinding - ) : RecyclerView.ViewHolder(binding.root) { - fun bind(activity: ScopeTypeItem?) { - activity?.let { - binding.text1.setText(it.name) - } - } - } -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/ui/coresettings/ignoreitem/ScopeTypeItem.kt b/app/src/main/java/de/kuschku/quasseldroid/ui/coresettings/ignoreitem/ScopeTypeItem.kt deleted file mode 100644 index 575f54121f45ba369f91656bde781449c71b0e0b..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/ui/coresettings/ignoreitem/ScopeTypeItem.kt +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.ui.coresettings.ignoreitem - -import androidx.annotation.StringRes -import de.kuschku.libquassel.quassel.syncables.IgnoreListManager - -data class ScopeTypeItem(val value: IgnoreListManager.ScopeType, @StringRes val name: Int) diff --git a/app/src/main/java/de/kuschku/quasseldroid/ui/coresettings/ignoreitem/StrictnessTypeAdapter.kt b/app/src/main/java/de/kuschku/quasseldroid/ui/coresettings/ignoreitem/StrictnessTypeAdapter.kt deleted file mode 100644 index 4963c098e408abd55d8569457d407d769de4a56f..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/ui/coresettings/ignoreitem/StrictnessTypeAdapter.kt +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.ui.coresettings.ignoreitem - -import android.view.LayoutInflater -import android.view.ViewGroup -import androidx.appcompat.widget.ThemedSpinnerAdapter -import androidx.recyclerview.widget.RecyclerView -import de.kuschku.libquassel.quassel.syncables.IgnoreListManager -import de.kuschku.quasseldroid.databinding.WidgetSpinnerItemMaterialBinding -import de.kuschku.quasseldroid.util.ui.ContextThemeWrapper -import de.kuschku.quasseldroid.util.ui.RecyclerSpinnerAdapter - -class StrictnessTypeAdapter(val data: List<StrictnessTypeItem>) : - RecyclerSpinnerAdapter<StrictnessTypeAdapter.StrictnessTypeViewHolder>(), - ThemedSpinnerAdapter { - - override fun isEmpty() = data.isEmpty() - - override fun onBindViewHolder(holder: StrictnessTypeViewHolder, position: Int) = - holder.bind(getItem(position)) - - override fun onCreateViewHolder(parent: ViewGroup, dropDown: Boolean) - : StrictnessTypeViewHolder { - val inflater = LayoutInflater.from( - if (dropDown) - ContextThemeWrapper(parent.context, dropDownViewTheme) - else - parent.context - ) - return StrictnessTypeViewHolder( - WidgetSpinnerItemMaterialBinding.inflate(inflater, parent, false) - ) - } - - override fun getItem(position: Int) = data[position] - - override fun getItemId(position: Int) = getItem(position).value.value.toLong() - - override fun hasStableIds() = true - - override fun getCount() = data.size - - fun indexOf(value: IgnoreListManager.StrictnessType): Int? { - for ((key, item) in data.withIndex()) { - if (item.value.value == value.value) { - return key - } - } - return null - } - - class StrictnessTypeViewHolder( - private val binding: WidgetSpinnerItemMaterialBinding - ) : RecyclerView.ViewHolder(binding.root) { - fun bind(activity: StrictnessTypeItem?) { - activity?.let { - binding.text1.setText(it.name) - } - } - } -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/ui/coresettings/ignoreitem/StrictnessTypeItem.kt b/app/src/main/java/de/kuschku/quasseldroid/ui/coresettings/ignoreitem/StrictnessTypeItem.kt deleted file mode 100644 index 63c08dbf9709b9bcb1f3a16bc49619469cf3827a..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/ui/coresettings/ignoreitem/StrictnessTypeItem.kt +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.ui.coresettings.ignoreitem - -import androidx.annotation.StringRes -import de.kuschku.libquassel.quassel.syncables.IgnoreListManager - -data class StrictnessTypeItem(val value: IgnoreListManager.StrictnessType, @StringRes val name: Int) diff --git a/app/src/main/java/de/kuschku/quasseldroid/ui/coresettings/ignorelist/DragSortItemTouchHelperCallback.kt b/app/src/main/java/de/kuschku/quasseldroid/ui/coresettings/ignorelist/DragSortItemTouchHelperCallback.kt deleted file mode 100644 index f8c55f4bcbc354661bb4b614f05d5d3f58183e0d..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/ui/coresettings/ignorelist/DragSortItemTouchHelperCallback.kt +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.ui.coresettings.ignorelist - -import androidx.recyclerview.widget.ItemTouchHelper -import androidx.recyclerview.widget.RecyclerView - -class DragSortItemTouchHelperCallback(private val adapter: IgnoreListAdapter) : - ItemTouchHelper.Callback() { - override fun isLongPressDragEnabled() = true - - override fun isItemViewSwipeEnabled() = true - - override fun getMovementFlags(recyclerView: RecyclerView, - viewHolder: RecyclerView.ViewHolder): Int { - val dragFlags = ItemTouchHelper.UP or ItemTouchHelper.DOWN - val swipeFlags = ItemTouchHelper.START or ItemTouchHelper.END - return makeMovementFlags(dragFlags, swipeFlags) - } - - override fun onMove(recyclerView: RecyclerView, viewHolder: RecyclerView.ViewHolder, - target: RecyclerView.ViewHolder): Boolean { - adapter.move(viewHolder.adapterPosition, target.adapterPosition) - return true - } - - override fun onSwiped(viewHolder: RecyclerView.ViewHolder, direction: Int) { - adapter.remove(viewHolder.adapterPosition) - } -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/ui/coresettings/ignorelist/IgnoreListActivity.kt b/app/src/main/java/de/kuschku/quasseldroid/ui/coresettings/ignorelist/IgnoreListActivity.kt deleted file mode 100644 index c25c82b4fd5df309396e4447d7be2ac5a1d7badc..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/ui/coresettings/ignorelist/IgnoreListActivity.kt +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.ui.coresettings.ignorelist - -import android.content.Context -import android.content.Intent -import de.kuschku.quasseldroid.util.ui.settings.ServiceBoundSettingsActivity - -class IgnoreListActivity : ServiceBoundSettingsActivity(IgnoreListFragment()) { - companion object { - fun launch( - context: Context, - addRule: String? = null - ) = context.startActivity(intent(context, addRule)) - - fun intent( - context: Context, - addRule: String? = null - ) = Intent(context, IgnoreListActivity::class.java).apply { - if (addRule != null) { - putExtra("add_rule", addRule) - } - } - } -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/ui/coresettings/ignorelist/IgnoreListAdapter.kt b/app/src/main/java/de/kuschku/quasseldroid/ui/coresettings/ignorelist/IgnoreListAdapter.kt deleted file mode 100644 index f6242d94c8a7b55f6b2bae5029e989544647f7fb..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/ui/coresettings/ignorelist/IgnoreListAdapter.kt +++ /dev/null @@ -1,124 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.ui.coresettings.ignorelist - -import android.annotation.SuppressLint -import android.view.LayoutInflater -import android.view.MotionEvent -import android.view.ViewGroup -import androidx.recyclerview.widget.RecyclerView -import de.kuschku.libquassel.quassel.syncables.IgnoreListManager -import de.kuschku.quasseldroid.databinding.SettingsIgnorelistItemBinding -import de.kuschku.quasseldroid.util.helper.visibleIf -import java.util.* - -@SuppressLint("ClickableViewAccessibility") -class IgnoreListAdapter( - private val clickListener: (IgnoreListManager.IgnoreListItem) -> Unit, - private val dragListener: (IgnoreItemViewHolder) -> Unit -) : RecyclerView.Adapter<IgnoreListAdapter.IgnoreItemViewHolder>() { - private val data = mutableListOf<IgnoreListManager.IgnoreListItem>() - var list: List<IgnoreListManager.IgnoreListItem> - get() = data - set(value) { - val length = data.size - data.clear() - notifyItemRangeRemoved(0, length) - data.addAll(value) - notifyItemRangeInserted(0, list.size) - } - - fun add(item: IgnoreListManager.IgnoreListItem) { - val index = data.size - data.add(item) - notifyItemInserted(index) - } - - fun replace(index: Int, item: IgnoreListManager.IgnoreListItem) { - data[index] = item - notifyItemChanged(index) - } - - fun indexOf(rule: String) = data.map(IgnoreListManager.IgnoreListItem::ignoreRule).indexOf(rule) - - fun remove(index: Int) { - data.removeAt(index) - notifyItemRemoved(index) - } - - fun move(from: Int, to: Int) { - Collections.swap(data, from, to) - notifyItemMoved(from, to) - } - - fun toggle(item: IgnoreListManager.IgnoreListItem, isActive: Boolean) { - val index = indexOf(item.ignoreRule) - data[index] = data[index].copy(isActive = isActive) - } - - override fun getItemCount() = data.size - - override fun onCreateViewHolder(parent: ViewGroup, viewType: Int) = IgnoreItemViewHolder( - SettingsIgnorelistItemBinding.inflate(LayoutInflater.from(parent.context), parent, false), - clickListener, - ::toggle, - dragListener - ) - - override fun onBindViewHolder(holder: IgnoreItemViewHolder, position: Int) { - holder.bind(data[position]) - } - - class IgnoreItemViewHolder( - private val binding: SettingsIgnorelistItemBinding, - clickListener: (IgnoreListManager.IgnoreListItem) -> Unit, - toggleListener: (IgnoreListManager.IgnoreListItem, Boolean) -> Unit, - dragListener: (IgnoreItemViewHolder) -> Unit - ) : RecyclerView.ViewHolder(binding.root) { - private var item: IgnoreListManager.IgnoreListItem? = null - - init { - itemView.setOnClickListener { - item?.let { - clickListener(it) - } - } - binding.toggle.setOnCheckedChangeListener { _, isChecked -> - item?.let { - toggleListener.invoke(it, isChecked) - } - } - binding.handle.setOnTouchListener { _, event -> - if (event.action == MotionEvent.ACTION_DOWN) { - dragListener.invoke(this) - } - false - } - } - - fun bind(item: IgnoreListManager.IgnoreListItem) { - this.item = item - binding.ignoreRule.text = item.ignoreRule - binding.scopeRule.text = item.scopeRule - binding.scopeRule.visibleIf(item.scopeRule.isNotBlank() && item.scope != IgnoreListManager.ScopeType.GlobalScope) - binding.toggle.isChecked = item.isActive - } - } -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/ui/coresettings/ignorelist/IgnoreListFragment.kt b/app/src/main/java/de/kuschku/quasseldroid/ui/coresettings/ignorelist/IgnoreListFragment.kt deleted file mode 100644 index bb4b03ba5579fe78c430a533e1be818360fbfa88..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/ui/coresettings/ignorelist/IgnoreListFragment.kt +++ /dev/null @@ -1,154 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.ui.coresettings.ignorelist - -import android.app.Activity -import android.content.Intent -import android.os.Bundle -import android.view.LayoutInflater -import android.view.View -import android.view.ViewGroup -import androidx.lifecycle.Observer -import androidx.recyclerview.widget.DefaultItemAnimator -import androidx.recyclerview.widget.ItemTouchHelper -import androidx.recyclerview.widget.LinearLayoutManager -import androidx.recyclerview.widget.RecyclerView -import butterknife.BindView -import butterknife.ButterKnife -import com.google.android.material.floatingactionbutton.FloatingActionButton -import de.kuschku.libquassel.quassel.syncables.IgnoreListManager -import de.kuschku.libquassel.util.Optional -import de.kuschku.quasseldroid.R -import de.kuschku.quasseldroid.ui.coresettings.ignoreitem.IgnoreItemActivity -import de.kuschku.quasseldroid.util.helper.setTooltip -import de.kuschku.quasseldroid.util.helper.toLiveData -import de.kuschku.quasseldroid.util.ui.settings.fragment.Changeable -import de.kuschku.quasseldroid.util.ui.settings.fragment.Savable -import de.kuschku.quasseldroid.util.ui.settings.fragment.ServiceBoundSettingsFragment -import de.kuschku.quasseldroid.viewmodel.helper.EditorViewModelHelper -import javax.inject.Inject - -class IgnoreListFragment : ServiceBoundSettingsFragment(), Savable, - Changeable { - @BindView(R.id.list) - lateinit var list: RecyclerView - - @BindView(R.id.add) - lateinit var add: FloatingActionButton - - @Inject - lateinit var modelHelper: EditorViewModelHelper - - private var ignoreListManager: Pair<IgnoreListManager, IgnoreListManager>? = null - - private lateinit var helper: ItemTouchHelper - - private val adapter = IgnoreListAdapter(::itemClick, ::startDrag) - - override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, - savedInstanceState: Bundle?): View? { - val view = inflater.inflate(R.layout.settings_ignorelist, container, false) - ButterKnife.bind(this, view) - - list.adapter = adapter - list.layoutManager = LinearLayoutManager(requireContext()) - list.itemAnimator = DefaultItemAnimator() - - val callback = DragSortItemTouchHelperCallback(adapter) - helper = ItemTouchHelper(callback) - helper.attachToRecyclerView(list) - - val addRule = arguments?.getString("add_rule") - - add.setOnClickListener { - startActivityForResult(IgnoreItemActivity.intent(requireContext()), REQUEST_CREATE_RULE) - } - add.setTooltip() - - if (addRule != null) { - startActivityForResult(IgnoreItemActivity.intent(requireContext(), addRule = addRule), - REQUEST_CREATE_RULE) - } - - modelHelper.ignoreListManager - .filter(Optional<IgnoreListManager>::isPresent) - .map(Optional<IgnoreListManager>::get) - .toLiveData().observe(viewLifecycleOwner, Observer { - if (it != null) { - if (this.ignoreListManager == null) { - this.ignoreListManager = Pair(it, it.copy()) - this.ignoreListManager?.let { (_, data) -> - adapter.list = data.ignoreList() - } - } - } - }) - - return view - } - - private fun itemClick(item: IgnoreListManager.IgnoreListItem) { - startActivityForResult(IgnoreItemActivity.intent(requireContext(), item), REQUEST_UPDATE_RULE) - } - - private fun startDrag(holder: IgnoreListAdapter.IgnoreItemViewHolder) = helper.startDrag(holder) - - override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) { - if (resultCode == Activity.RESULT_OK && data != null) { - when (requestCode) { - REQUEST_UPDATE_RULE -> { - val oldRule = data.getSerializableExtra("old") as? IgnoreListManager.IgnoreListItem - val newRule = data.getSerializableExtra("new") as? IgnoreListManager.IgnoreListItem - - if (oldRule != null && newRule != null) { - adapter.replace(adapter.indexOf(oldRule.ignoreRule), newRule) - } - } - REQUEST_CREATE_RULE -> { - val newRule = data.getSerializableExtra("new") as? IgnoreListManager.IgnoreListItem - - if (newRule != null) { - adapter.add(newRule) - } - } - } - } - } - - override fun onSave() = ignoreListManager?.let { (it, data) -> - applyChanges(data) - it.requestUpdate(data.toVariantMap()) - true - } ?: false - - override fun hasChanged() = ignoreListManager?.let { (it, data) -> - applyChanges(data) - !data.isEqual(it) - } ?: false - - private fun applyChanges(data: IgnoreListManager) { - data.setIgnoreList(adapter.list) - } - - companion object { - private const val REQUEST_UPDATE_RULE = 1 - private const val REQUEST_CREATE_RULE = 2 - } -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/ui/coresettings/ignorelist/IgnoreListFragmentProvider.kt b/app/src/main/java/de/kuschku/quasseldroid/ui/coresettings/ignorelist/IgnoreListFragmentProvider.kt deleted file mode 100644 index ecac100e60ea356673414e5e24f0eb52ac5df5fe..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/ui/coresettings/ignorelist/IgnoreListFragmentProvider.kt +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.ui.coresettings.ignorelist - -import androidx.fragment.app.FragmentActivity -import dagger.Binds -import dagger.Module -import dagger.android.ContributesAndroidInjector - -@Module -abstract class IgnoreListFragmentProvider { - @Binds - abstract fun bindFragmentActivity(activity: IgnoreListActivity): FragmentActivity - - @ContributesAndroidInjector - abstract fun bindIgnoreFragment(): IgnoreListFragment -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/ui/coresettings/network/DragSortItemTouchHelperCallback.kt b/app/src/main/java/de/kuschku/quasseldroid/ui/coresettings/network/DragSortItemTouchHelperCallback.kt deleted file mode 100644 index a5f144923e1665333b0df52321036f3d309478d5..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/ui/coresettings/network/DragSortItemTouchHelperCallback.kt +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.ui.coresettings.network - -import androidx.recyclerview.widget.ItemTouchHelper -import androidx.recyclerview.widget.RecyclerView - -class DragSortItemTouchHelperCallback(private val adapter: NetworkServerAdapter) : - ItemTouchHelper.Callback() { - override fun isLongPressDragEnabled() = true - - override fun isItemViewSwipeEnabled() = true - - override fun getMovementFlags(recyclerView: RecyclerView, - viewHolder: RecyclerView.ViewHolder): Int { - val dragFlags = ItemTouchHelper.UP or ItemTouchHelper.DOWN - val swipeFlags = ItemTouchHelper.START or ItemTouchHelper.END - return makeMovementFlags(dragFlags, swipeFlags) - } - - override fun onMove(recyclerView: RecyclerView, viewHolder: RecyclerView.ViewHolder, - target: RecyclerView.ViewHolder): Boolean { - adapter.move(viewHolder.adapterPosition, target.adapterPosition) - return true - } - - override fun onSwiped(viewHolder: RecyclerView.ViewHolder, direction: Int) { - adapter.remove(viewHolder.adapterPosition) - } -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/ui/coresettings/network/IdentityAdapter.kt b/app/src/main/java/de/kuschku/quasseldroid/ui/coresettings/network/IdentityAdapter.kt deleted file mode 100644 index 4624ecadcde9c4cf997259c1ab19f6edb3a891c6..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/ui/coresettings/network/IdentityAdapter.kt +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.ui.coresettings.network - -import android.view.LayoutInflater -import android.view.ViewGroup -import androidx.appcompat.widget.ThemedSpinnerAdapter -import androidx.recyclerview.widget.RecyclerView -import de.kuschku.libquassel.protocol.IdentityId -import de.kuschku.libquassel.quassel.syncables.Identity -import de.kuschku.quasseldroid.databinding.WidgetSpinnerItemMaterialBinding -import de.kuschku.quasseldroid.util.ui.ContextThemeWrapper -import de.kuschku.quasseldroid.util.ui.RecyclerSpinnerAdapter - -class IdentityAdapter : RecyclerSpinnerAdapter<IdentityAdapter.NetworkViewHolder>(), - ThemedSpinnerAdapter { - var data = emptyList<Identity>() - - fun submitList(list: List<Identity>) { - data = list - notifyDataSetChanged() - } - - override fun isEmpty() = data.isEmpty() - - override fun onBindViewHolder(holder: NetworkViewHolder, position: Int) = - holder.bind(getItem(position)) - - override fun onCreateViewHolder(parent: ViewGroup, dropDown: Boolean): NetworkViewHolder { - val inflater = LayoutInflater.from( - if (dropDown) ContextThemeWrapper(parent.context, dropDownViewTheme) else parent.context - ) - return NetworkViewHolder( - WidgetSpinnerItemMaterialBinding.inflate(inflater, parent, false) - ) - } - - fun indexOf(id: IdentityId): Int? { - for ((key, item) in data.withIndex()) { - if (item.id() == id) { - return key - } - } - return null - } - - override fun getItem(position: Int): Identity? = - if (position in 0 until data.size) data[position] else null - - override fun getItemId(position: Int) = getItem(position)?.id()?.id?.toLong() ?: -1 - - override fun hasStableIds() = true - - override fun getCount() = data.size - - class NetworkViewHolder( - private val binding: WidgetSpinnerItemMaterialBinding - ) : RecyclerView.ViewHolder(binding.root) { - fun bind(network: Identity?) { - binding.text1.text = network?.identityName() - } - } -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/ui/coresettings/network/NetworkBaseFragment.kt b/app/src/main/java/de/kuschku/quasseldroid/ui/coresettings/network/NetworkBaseFragment.kt deleted file mode 100644 index 2da6c9f3898ebd6626b6a06cc5e70913ed05eed7..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/ui/coresettings/network/NetworkBaseFragment.kt +++ /dev/null @@ -1,360 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.ui.coresettings.network - -import android.app.Activity -import android.content.Intent -import android.os.Bundle -import android.view.LayoutInflater -import android.view.View -import android.view.ViewGroup -import android.widget.Button -import android.widget.EditText -import android.widget.Spinner -import androidx.appcompat.widget.SwitchCompat -import androidx.core.view.ViewCompat -import androidx.lifecycle.Observer -import androidx.recyclerview.widget.ItemTouchHelper -import androidx.recyclerview.widget.LinearLayoutManager -import androidx.recyclerview.widget.RecyclerView -import butterknife.BindView -import butterknife.ButterKnife -import de.kuschku.libquassel.protocol.IdentityId -import de.kuschku.libquassel.protocol.NetworkId -import de.kuschku.libquassel.quassel.syncables.Identity -import de.kuschku.libquassel.quassel.syncables.Network -import de.kuschku.libquassel.quassel.syncables.interfaces.INetwork -import de.kuschku.libquassel.session.ISession -import de.kuschku.libquassel.util.Optional -import de.kuschku.libquassel.util.helper.combineLatest -import de.kuschku.libquassel.util.helper.nullIf -import de.kuschku.libquassel.util.helper.safeSwitchMap -import de.kuschku.libquassel.util.helper.value -import de.kuschku.quasseldroid.R -import de.kuschku.quasseldroid.defaults.Defaults -import de.kuschku.quasseldroid.ui.coresettings.networkserver.NetworkServerActivity -import de.kuschku.quasseldroid.util.helper.setDependent -import de.kuschku.quasseldroid.util.helper.toLiveData -import de.kuschku.quasseldroid.util.helper.visibleIf -import de.kuschku.quasseldroid.util.ui.settings.fragment.Changeable -import de.kuschku.quasseldroid.util.ui.settings.fragment.Savable -import de.kuschku.quasseldroid.util.ui.settings.fragment.ServiceBoundSettingsFragment -import de.kuschku.quasseldroid.util.ui.view.InlineSnackBar -import de.kuschku.quasseldroid.viewmodel.helper.EditorViewModelHelper -import javax.inject.Inject -import kotlin.math.roundToInt - -abstract class NetworkBaseFragment(private val initDefault: Boolean) : - ServiceBoundSettingsFragment(), Savable, Changeable { - @BindView(R.id.network_name) - lateinit var networkName: EditText - - @BindView(R.id.identity) - lateinit var identity: Spinner - - @BindView(R.id.servers) - lateinit var servers: RecyclerView - - @BindView(R.id.new_server) - lateinit var newServer: Button - - @BindView(R.id.sasl_enabled) - lateinit var saslEnabled: SwitchCompat - - @BindView(R.id.sasl_group) - lateinit var saslGroup: ViewGroup - - @BindView(R.id.sasl_account) - lateinit var saslAccount: EditText - - @BindView(R.id.sasl_password) - lateinit var saslPassword: EditText - - @BindView(R.id.autoidentify_enabled) - lateinit var autoidentifyEnabled: SwitchCompat - - @BindView(R.id.autoidentify_group) - lateinit var autoidentifyGroup: ViewGroup - - @BindView(R.id.autoidentify_warning) - lateinit var autoidentifyWarning: InlineSnackBar - - @BindView(R.id.autoidentify_service) - lateinit var autoidentifyService: EditText - - @BindView(R.id.autoidentify_password) - lateinit var autoidentifyPassword: EditText - - @BindView(R.id.autoreconnect_enabled) - lateinit var autoreconnectEnabled: SwitchCompat - - @BindView(R.id.autoreconnect_group) - lateinit var autoreconnectGroup: ViewGroup - - @BindView(R.id.autoreconnect_interval) - lateinit var autoreconnectInterval: EditText - - @BindView(R.id.autoreconnect_attempts) - lateinit var autoreconnectRetries: EditText - - @BindView(R.id.autoreconnect_unlimited) - lateinit var autoreconnectUnlimited: SwitchCompat - - @BindView(R.id.perform) - lateinit var perform: EditText - - @BindView(R.id.rejoin_channels) - lateinit var rejoinChannels: SwitchCompat - - @BindView(R.id.customratelimits_enabled) - lateinit var customratelimitsEnabled: SwitchCompat - - @BindView(R.id.customratelimits_group) - lateinit var customratelimitsGroup: ViewGroup - - @BindView(R.id.customratelimits_burstsize) - lateinit var customratelimitsBurstSize: EditText - - @BindView(R.id.customratelimits_unlimited) - lateinit var customratelimitsUnlimited: SwitchCompat - - @BindView(R.id.customratelimits_delay) - lateinit var customratelimitsDelay: EditText - - @Inject - lateinit var modelHelper: EditorViewModelHelper - - protected var network: Pair<Network?, Network>? = null - - private lateinit var adapter: NetworkServerAdapter - private lateinit var helper: ItemTouchHelper - - override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, - savedInstanceState: Bundle?): View? { - val view = inflater.inflate(R.layout.settings_network, container, false) - ButterKnife.bind(this, view) - - val networkId = NetworkId(arguments?.getInt("network", -1) ?: -1) - - adapter = NetworkServerAdapter(::serverClick, ::startDrag) - servers.layoutManager = LinearLayoutManager(requireContext()) - servers.adapter = adapter - ViewCompat.setNestedScrollingEnabled(servers, false) - - val callback = DragSortItemTouchHelperCallback(adapter) - helper = ItemTouchHelper(callback) - helper.attachToRecyclerView(servers) - - newServer.setOnClickListener { - startActivityForResult( - NetworkServerActivity.intent(requireContext()), - REQUEST_CREATE_SERVER - ) - } - - val identityAdapter = IdentityAdapter() - identity.adapter = identityAdapter - - modelHelper.identities.safeSwitchMap { - combineLatest(it.values.map(Identity::liveUpdates)).map { - it.sortedBy(Identity::identityName) - } - }.toLiveData().observe(viewLifecycleOwner, Observer { - if (it != null) { - val selectOriginal = identity.selectedItemId == Spinner.INVALID_ROW_ID - identityAdapter.submitList(it) - if (selectOriginal) { - this.network?.let { (_, data) -> - identityAdapter.indexOf(data.identity())?.let(identity::setSelection) - } - } - } - }) - - if (initDefault) { - modelHelper.connectedSession - .filter(Optional<ISession>::isPresent) - .map(Optional<ISession>::get) - .firstElement() - .toLiveData().observe(viewLifecycleOwner, Observer { - it?.let { - update(Defaults.network(requireContext(), it.proxy), identityAdapter) - } - }) - } else { - modelHelper.networks.map { Optional.ofNullable(it[networkId]) } - .filter(Optional<Network>::isPresent) - .map(Optional<Network>::get) - .firstElement() - .toLiveData() - .observe(viewLifecycleOwner, Observer { - it?.let { - update(it, identityAdapter) - } - }) - modelHelper.networks.map { Optional.ofNullable(it[networkId]) } - .filter(Optional<Network>::isPresent) - .map(Optional<Network>::get) - .safeSwitchMap(Network::liveCaps) - .toLiveData() - .observe(viewLifecycleOwner, Observer { - autoidentifyWarning.visibleIf(it.contains("sasl")) - }) - } - - - autoidentifyWarning.setOnClickListener { - val identity = modelHelper.identities.value?.get(IdentityId(identity.selectedItemId.toInt())) - if (identity != null) { - saslEnabled.isChecked = true - saslAccount.setText(identity.nicks().firstOrNull()) - saslPassword.setText(autoidentifyPassword.text.toString()) - autoidentifyEnabled.isChecked = false - } - } - - saslEnabled.setDependent(saslGroup) - autoidentifyEnabled.setDependent(autoidentifyGroup) - autoreconnectEnabled.setDependent(autoreconnectGroup) - autoreconnectUnlimited.setOnCheckedChangeListener { _, isChecked -> - autoreconnectRetries.isEnabled = !isChecked - } - customratelimitsEnabled.setDependent(customratelimitsGroup) - customratelimitsUnlimited.setOnCheckedChangeListener { _, isChecked -> - customratelimitsBurstSize.isEnabled = !isChecked - customratelimitsDelay.isEnabled = !isChecked - } - customratelimitsBurstSize.isEnabled = !customratelimitsUnlimited.isChecked - customratelimitsDelay.isEnabled = !customratelimitsUnlimited.isChecked - - return view - } - - private fun update(it: Network, identityAdapter: IdentityAdapter) { - if (this.network == null) { - this.network = Pair(it, it.copy()) - this.network?.let { (_, data) -> - networkName.setText(data.networkName()) - - identityAdapter.indexOf(data.identity())?.let(identity::setSelection) - - adapter.list = data.serverList() - - saslEnabled.isChecked = data.useSasl() - saslAccount.setText(data.saslAccount()) - saslPassword.setText(data.saslPassword()) - - autoidentifyEnabled.isChecked = data.useAutoIdentify() - autoidentifyService.setText(data.autoIdentifyService()) - autoidentifyPassword.setText(data.autoIdentifyPassword()) - - autoreconnectEnabled.isChecked = data.useAutoReconnect() - autoreconnectInterval.setText(data.autoReconnectInterval().toString()) - autoreconnectRetries.setText(data.autoReconnectRetries().toString()) - autoreconnectUnlimited.isChecked = data.unlimitedReconnectRetries() - - perform.setText(data.perform().joinToString("\n")) - rejoinChannels.isChecked = data.rejoinChannels() - - customratelimitsEnabled.isChecked = data.useCustomMessageRate() - customratelimitsBurstSize.setText(data.messageRateBurstSize().toString()) - customratelimitsUnlimited.isChecked = data.unlimitedMessageRate() - customratelimitsDelay.setText("${data.messageRateDelay().toInt() / 1000.0}") - } - } - } - - private fun serverClick(server: INetwork.Server) { - startActivityForResult( - NetworkServerActivity.intent(requireContext(), server = server), - REQUEST_UPDATE_SERVER - ) - } - - private fun startDrag(holder: RecyclerView.ViewHolder) { - helper.startDrag(holder) - } - - override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) { - if (resultCode == Activity.RESULT_OK && data != null) { - when (requestCode) { - REQUEST_UPDATE_SERVER -> { - val old = data.getSerializableExtra("old") as? INetwork.Server - val new = data.getSerializableExtra("new") as? INetwork.Server - if (old != null && new != null) { - adapter.replace(old, new) - } - } - REQUEST_CREATE_SERVER -> { - val new = data.getSerializableExtra("new") as? INetwork.Server - if (new != null) { - adapter.add(new) - } - } - } - } - } - - override fun hasChanged() = network?.let { (it, data) -> - applyChanges(data) - it == null || !data.isEqual(it) - } ?: true - - protected fun applyChanges(data: Network) { - data.setNetworkName(networkName.text.toString()) - - data.setIdentity(IdentityId(identity.selectedItemId.toInt())) - - data.setActualServerList(adapter.list) - - data.setUseSasl(saslEnabled.isChecked) - data.setSaslAccount(saslAccount.text.toString()) - data.setSaslPassword(saslPassword.text.toString()) - - data.setUseAutoIdentify(autoidentifyEnabled.isChecked) - data.setAutoIdentifyService(autoidentifyService.text.toString()) - data.setAutoIdentifyPassword(autoidentifyPassword.text.toString()) - - data.setUseAutoReconnect(autoreconnectEnabled.isChecked) - data.setAutoReconnectInterval(autoreconnectInterval.text.toString().toUIntOrNull() - ?: data.autoReconnectInterval()) - data.setAutoReconnectRetries(autoreconnectRetries.text.toString().toUShortOrNull() - ?: data.autoReconnectRetries()) - data.setUnlimitedReconnectRetries(autoreconnectUnlimited.isChecked) - - data.setPerform(perform.text.lines()) - data.setRejoinChannels(rejoinChannels.isChecked) - - data.setUseCustomMessageRate(customratelimitsEnabled.isChecked) - data.setMessageRateBurstSize(customratelimitsBurstSize.text.toString().toUIntOrNull() - ?: data.messageRateBurstSize()) - data.setUnlimitedMessageRate(customratelimitsUnlimited.isChecked) - data.setMessageRateDelay(customratelimitsDelay.toString().toFloatOrNull() - ?.let { (it * 1000).roundToInt() } - ?.nullIf { it < 0 } - ?.toUInt() - ?: data.messageRateDelay()) - } - - companion object { - private const val REQUEST_UPDATE_SERVER = 1 - private const val REQUEST_CREATE_SERVER = 2 - } -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/ui/coresettings/network/NetworkCreateActivity.kt b/app/src/main/java/de/kuschku/quasseldroid/ui/coresettings/network/NetworkCreateActivity.kt deleted file mode 100644 index 894ccda81ffd6ac03b87d8486f1a80ace0343b09..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/ui/coresettings/network/NetworkCreateActivity.kt +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.ui.coresettings.network - -import android.content.Context -import android.content.Intent -import de.kuschku.quasseldroid.util.ui.settings.ServiceBoundSettingsActivity - -class NetworkCreateActivity : ServiceBoundSettingsActivity(NetworkCreateFragment()) { - companion object { - fun launch(context: Context) = context.startActivity(intent(context)) - fun intent(context: Context) = Intent(context, NetworkCreateActivity::class.java) - } -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/ui/coresettings/network/NetworkCreateFragment.kt b/app/src/main/java/de/kuschku/quasseldroid/ui/coresettings/network/NetworkCreateFragment.kt deleted file mode 100644 index 69b848b9107ac8f690c21c967e79448dcce071ed..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/ui/coresettings/network/NetworkCreateFragment.kt +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.ui.coresettings.network - -import de.kuschku.libquassel.util.helper.value -import de.kuschku.quasseldroid.Backend - -class NetworkCreateFragment : NetworkBaseFragment(true) { - override fun onSave() = modelHelper.connectedSession.value?.orNull()?.let { session -> - network?.let { (_, data) -> - applyChanges(data) - modelHelper.backend.value?.ifPresent(Backend::requestConnectNewNetwork) - session.rpcHandler.createNetwork(data.networkInfo(), emptyList()) - true - } - } ?: false -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/ui/coresettings/network/NetworkCreateFragmentProvider.kt b/app/src/main/java/de/kuschku/quasseldroid/ui/coresettings/network/NetworkCreateFragmentProvider.kt deleted file mode 100644 index 9c84fc30cdbd2f37a545e9a672b56966f47da2f1..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/ui/coresettings/network/NetworkCreateFragmentProvider.kt +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.ui.coresettings.network - -import androidx.fragment.app.FragmentActivity -import dagger.Binds -import dagger.Module -import dagger.android.ContributesAndroidInjector - -@Module -abstract class NetworkCreateFragmentProvider { - @Binds - abstract fun bindFragmentActivity(activity: NetworkCreateActivity): FragmentActivity - - @ContributesAndroidInjector - abstract fun bindNetworkCreateFragment(): NetworkCreateFragment -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/ui/coresettings/network/NetworkEditActivity.kt b/app/src/main/java/de/kuschku/quasseldroid/ui/coresettings/network/NetworkEditActivity.kt deleted file mode 100644 index e42debc776e1344e27660e63e64082e86045b0f4..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/ui/coresettings/network/NetworkEditActivity.kt +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.ui.coresettings.network - -import android.content.Context -import android.content.Intent -import de.kuschku.libquassel.protocol.NetworkId -import de.kuschku.quasseldroid.util.ui.settings.ServiceBoundSettingsActivity - -class NetworkEditActivity : ServiceBoundSettingsActivity(NetworkEditFragment()) { - companion object { - fun launch( - context: Context, - network: NetworkId - ) = context.startActivity(intent(context, network)) - - fun intent( - context: Context, - network: NetworkId - ) = Intent(context, NetworkEditActivity::class.java).apply { - putExtra("network", network.id) - } - } -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/ui/coresettings/network/NetworkEditFragment.kt b/app/src/main/java/de/kuschku/quasseldroid/ui/coresettings/network/NetworkEditFragment.kt deleted file mode 100644 index 194e884e90ba6fb1db1192ffffc52e9e15931a43..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/ui/coresettings/network/NetworkEditFragment.kt +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.ui.coresettings.network - -import de.kuschku.libquassel.util.helper.value -import de.kuschku.quasseldroid.util.ui.settings.fragment.Deletable - -class NetworkEditFragment : NetworkBaseFragment(false), Deletable { - override fun onSave() = network?.let { (it, data) -> - applyChanges(data) - it?.requestSetNetworkInfo(data.networkInfo()) - true - } ?: false - - override fun onDelete() { - network?.let { (it, _) -> - it?.let { - modelHelper.connectedSession.value?.orNull()?.rpcHandler?.removeNetwork(it.networkId()) - } - } - } -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/ui/coresettings/network/NetworkEditFragmentProvider.kt b/app/src/main/java/de/kuschku/quasseldroid/ui/coresettings/network/NetworkEditFragmentProvider.kt deleted file mode 100644 index fc9218f1a2f9030689822adb741638aa2de97523..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/ui/coresettings/network/NetworkEditFragmentProvider.kt +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.ui.coresettings.network - -import androidx.fragment.app.FragmentActivity -import dagger.Binds -import dagger.Module -import dagger.android.ContributesAndroidInjector - -@Module -abstract class NetworkEditFragmentProvider { - @Binds - abstract fun bindFragmentActivity(activity: NetworkEditActivity): FragmentActivity - - @ContributesAndroidInjector - abstract fun bindNetworkEditFragment(): NetworkEditFragment -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/ui/coresettings/network/NetworkServerAdapter.kt b/app/src/main/java/de/kuschku/quasseldroid/ui/coresettings/network/NetworkServerAdapter.kt deleted file mode 100644 index a414edf219fbcb821b98b3f50f704aa77ef187c0..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/ui/coresettings/network/NetworkServerAdapter.kt +++ /dev/null @@ -1,146 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.ui.coresettings.network - -import android.annotation.SuppressLint -import android.graphics.drawable.Drawable -import android.view.LayoutInflater -import android.view.MotionEvent -import android.view.ViewGroup -import androidx.recyclerview.widget.RecyclerView -import de.kuschku.libquassel.quassel.syncables.interfaces.INetwork -import de.kuschku.quasseldroid.R -import de.kuschku.quasseldroid.databinding.SettingsNetworkServerBinding -import de.kuschku.quasseldroid.util.helper.getVectorDrawableCompat -import de.kuschku.quasseldroid.util.helper.styledAttributes -import de.kuschku.quasseldroid.util.helper.tint -import java.util.* - -@SuppressLint("ClickableViewAccessibility", "ResourceType") -class NetworkServerAdapter( - private val clickListener: (INetwork.Server) -> Unit, - private val dragListener: (NetworkServerViewHolder) -> Unit -) : RecyclerView.Adapter<NetworkServerAdapter.NetworkServerViewHolder>() { - private val data = mutableListOf<INetwork.Server>() - var list: List<INetwork.Server> - get() = data - set(value) { - val length = data.size - data.clear() - notifyItemRangeRemoved(0, length) - data.addAll(value) - notifyItemRangeInserted(0, list.size) - } - - fun add(item: INetwork.Server) { - val index = data.size - data.add(item) - notifyItemInserted(index) - } - - fun indexOf(item: INetwork.Server): Int? { - for ((index, it) in data.withIndex()) { - if (it == item) { - return index - } - } - return null - } - - fun replace(old: INetwork.Server, new: INetwork.Server) { - indexOf(old)?.let { - data[it] = new - notifyItemChanged(it) - } - } - - fun remove(index: Int) { - data.removeAt(index) - notifyItemRemoved(index) - } - - fun move(from: Int, to: Int) { - Collections.swap(data, from, to) - notifyItemMoved(from, to) - } - - override fun getItemCount() = data.size - - override fun onCreateViewHolder(parent: ViewGroup, viewType: Int) = NetworkServerViewHolder( - SettingsNetworkServerBinding.inflate(LayoutInflater.from(parent.context), parent, false), - clickListener, - dragListener - ) - - override fun onBindViewHolder(holder: NetworkServerViewHolder, position: Int) { - holder.bind(data[position]) - } - - class NetworkServerViewHolder( - private val binding: SettingsNetworkServerBinding, - clickListener: (INetwork.Server) -> Unit, - dragListener: (NetworkServerViewHolder) -> Unit - ) : RecyclerView.ViewHolder(binding.root) { - private var item: INetwork.Server? = null - - private val secure: Drawable? - private val partiallySecure: Drawable? - private val insecure: Drawable? - - init { - itemView.setOnClickListener { - item?.let { - clickListener(it) - } - } - binding.handle.setOnTouchListener { _, event -> - if (event.action == MotionEvent.ACTION_DOWN) { - dragListener.invoke(this) - } - false - } - secure = itemView.context.getVectorDrawableCompat(R.drawable.ic_lock)?.mutate() - partiallySecure = itemView.context.getVectorDrawableCompat(R.drawable.ic_lock)?.mutate() - insecure = itemView.context.getVectorDrawableCompat(R.drawable.ic_lock_open)?.mutate() - itemView.context.theme.styledAttributes( - R.attr.colorTintSecure, - R.attr.colorTintPartiallySecure, - R.attr.colorTintInsecure - ) { - secure?.tint(getColor(0, 0)) - partiallySecure?.tint(getColor(1, 0)) - insecure?.tint(getColor(2, 0)) - } - } - - fun bind(item: INetwork.Server) { - this.item = item - binding.host.text = item.host - binding.port.text = item.port.toString() - binding.sslEnabled.setImageDrawable( - when { - item.useSsl && item.sslVerify -> secure - item.useSsl -> partiallySecure - else -> insecure - } - ) - } - } -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/ui/coresettings/networkconfig/NetworkConfigActivity.kt b/app/src/main/java/de/kuschku/quasseldroid/ui/coresettings/networkconfig/NetworkConfigActivity.kt deleted file mode 100644 index 86a17ea78c9b3c2f85a41fff60820752ff0292e9..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/ui/coresettings/networkconfig/NetworkConfigActivity.kt +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.ui.coresettings.networkconfig - -import android.content.Context -import android.content.Intent -import de.kuschku.quasseldroid.util.ui.settings.ServiceBoundSettingsActivity - -class NetworkConfigActivity : ServiceBoundSettingsActivity(NetworkConfigFragment()) { - companion object { - fun launch(context: Context) = context.startActivity(intent(context)) - fun intent(context: Context) = Intent(context, NetworkConfigActivity::class.java) - } -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/ui/coresettings/networkconfig/NetworkConfigFragment.kt b/app/src/main/java/de/kuschku/quasseldroid/ui/coresettings/networkconfig/NetworkConfigFragment.kt deleted file mode 100644 index 28805a4ea706d2134a434a7fb831c2165f5e0371..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/ui/coresettings/networkconfig/NetworkConfigFragment.kt +++ /dev/null @@ -1,145 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.ui.coresettings.networkconfig - -import android.os.Bundle -import android.view.LayoutInflater -import android.view.View -import android.view.ViewGroup -import android.widget.EditText -import androidx.appcompat.widget.SwitchCompat -import androidx.lifecycle.Observer -import butterknife.BindView -import butterknife.ButterKnife -import de.kuschku.libquassel.quassel.syncables.NetworkConfig -import de.kuschku.libquassel.util.Optional -import de.kuschku.quasseldroid.R -import de.kuschku.quasseldroid.util.helper.setDependent -import de.kuschku.quasseldroid.util.helper.toLiveData -import de.kuschku.quasseldroid.util.ui.settings.fragment.Changeable -import de.kuschku.quasseldroid.util.ui.settings.fragment.Savable -import de.kuschku.quasseldroid.util.ui.settings.fragment.ServiceBoundSettingsFragment -import de.kuschku.quasseldroid.viewmodel.helper.EditorViewModelHelper -import javax.inject.Inject - -class NetworkConfigFragment : ServiceBoundSettingsFragment(), Savable, - Changeable { - @BindView(R.id.ping_timeout_enabled) - lateinit var pingTimeoutEnabled: SwitchCompat - - @BindView(R.id.ping_timeout_group) - lateinit var pingTimeoutGroup: ViewGroup - - @BindView(R.id.ping_interval) - lateinit var pingInterval: EditText - - @BindView(R.id.max_ping_count) - lateinit var maxPingCount: EditText - - @BindView(R.id.auto_who_enabled) - lateinit var autoWhoEnabled: SwitchCompat - - @BindView(R.id.auto_who_group) - lateinit var autoWhoGroup: ViewGroup - - @BindView(R.id.auto_who_interval) - lateinit var autoWhoInterval: EditText - - @BindView(R.id.auto_who_nick_limit) - lateinit var autoWhoNickLimit: EditText - - @BindView(R.id.auto_who_delay) - lateinit var autoWhoDelay: EditText - - @BindView(R.id.standard_ctcp) - lateinit var standardCtcp: SwitchCompat - - @Inject - lateinit var modelHelper: EditorViewModelHelper - - private var networkConfig: Pair<NetworkConfig, NetworkConfig>? = null - - override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, - savedInstanceState: Bundle?): View? { - val view = inflater.inflate(R.layout.settings_networkconfig, container, false) - ButterKnife.bind(this, view) - - modelHelper.networkConfig - .filter(Optional<NetworkConfig>::isPresent) - .map(Optional<NetworkConfig>::get) - .firstElement() - .toLiveData().observe(viewLifecycleOwner, Observer { - it?.let { - if (this.networkConfig == null) { - this.networkConfig = Pair(it, it.copy()) - this.networkConfig?.let { (_, data) -> - pingTimeoutEnabled.isChecked = data.pingTimeoutEnabled() - pingInterval.setText(data.pingInterval().toString()) - maxPingCount.setText(data.maxPingCount().toString()) - - autoWhoEnabled.isChecked = data.autoWhoEnabled() - autoWhoInterval.setText(data.autoWhoInterval().toString()) - autoWhoNickLimit.setText(data.autoWhoNickLimit().toString()) - autoWhoDelay.setText(data.autoWhoDelay().toString()) - - standardCtcp.isChecked = data.standardCtcp() - } - } - } - }) - - pingTimeoutEnabled.setDependent(pingTimeoutGroup) - autoWhoEnabled.setDependent(autoWhoGroup) - - return view - } - - override fun onSave() = networkConfig?.let { (it, data) -> - applyChanges(data) - - it.requestUpdate(data.toVariantMap()) - true - } ?: false - - override fun hasChanged() = networkConfig?.let { (it, data) -> - applyChanges(data) - - data.pingTimeoutEnabled() != it.pingTimeoutEnabled() || - data.pingInterval() != it.pingInterval() || - data.maxPingCount() != it.maxPingCount() || - data.autoWhoEnabled() != it.autoWhoEnabled() || - data.autoWhoInterval() != it.autoWhoInterval() || - data.autoWhoNickLimit() != it.autoWhoNickLimit() || - data.autoWhoDelay() != it.autoWhoDelay() || - data.standardCtcp() != it.standardCtcp() - } ?: false - - private fun applyChanges(data: NetworkConfig) { - data.setPingTimeoutEnabled(pingTimeoutEnabled.isChecked) - pingInterval.text.toString().toIntOrNull()?.let(data::setPingInterval) - maxPingCount.text.toString().toIntOrNull()?.let(data::setMaxPingCount) - - data.setAutoWhoEnabled(autoWhoEnabled.isChecked) - autoWhoInterval.text.toString().toIntOrNull()?.let(data::setAutoWhoInterval) - autoWhoNickLimit.text.toString().toIntOrNull()?.let(data::setAutoWhoNickLimit) - autoWhoDelay.text.toString().toIntOrNull()?.let(data::setAutoWhoDelay) - data.setStandardCtcp(standardCtcp.isChecked) - } -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/ui/coresettings/networkconfig/NetworkConfigFragmentProvider.kt b/app/src/main/java/de/kuschku/quasseldroid/ui/coresettings/networkconfig/NetworkConfigFragmentProvider.kt deleted file mode 100644 index 312d14e15598fdecf9d001394462060d86032719..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/ui/coresettings/networkconfig/NetworkConfigFragmentProvider.kt +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.ui.coresettings.networkconfig - -import androidx.fragment.app.FragmentActivity -import dagger.Binds -import dagger.Module -import dagger.android.ContributesAndroidInjector - -@Module -abstract class NetworkConfigFragmentProvider { - @Binds - abstract fun bindFragmentActivity(activity: NetworkConfigActivity): FragmentActivity - - @ContributesAndroidInjector - abstract fun bindNetworkConfigFragment(): NetworkConfigFragment -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/ui/coresettings/networkserver/NetworkServerActivity.kt b/app/src/main/java/de/kuschku/quasseldroid/ui/coresettings/networkserver/NetworkServerActivity.kt deleted file mode 100644 index 54856ce5e98e4cd5d5a2646955bc5f0e50a8d8de..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/ui/coresettings/networkserver/NetworkServerActivity.kt +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.ui.coresettings.networkserver - -import android.content.Context -import android.content.Intent -import de.kuschku.libquassel.quassel.syncables.interfaces.INetwork -import de.kuschku.quasseldroid.util.ui.settings.ServiceBoundSettingsActivity - -class NetworkServerActivity : ServiceBoundSettingsActivity(NetworkServerFragment()) { - companion object { - fun launch( - context: Context, - server: INetwork.Server? = null - ) = context.startActivity(intent(context, server)) - - fun intent( - context: Context, - server: INetwork.Server? = null - ) = Intent(context, NetworkServerActivity::class.java).apply { - if (server != null) { - putExtra("server", server) - } - } - } -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/ui/coresettings/networkserver/NetworkServerFragment.kt b/app/src/main/java/de/kuschku/quasseldroid/ui/coresettings/networkserver/NetworkServerFragment.kt deleted file mode 100644 index d038fe571a1c97016b80f40f92f2c5c78798b7ce..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/ui/coresettings/networkserver/NetworkServerFragment.kt +++ /dev/null @@ -1,162 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.ui.coresettings.networkserver - -import android.app.Activity -import android.content.Intent -import android.os.Bundle -import android.view.LayoutInflater -import android.view.View -import android.view.ViewGroup -import android.widget.EditText -import android.widget.Spinner -import androidx.appcompat.widget.SwitchCompat -import butterknife.BindView -import butterknife.ButterKnife -import de.kuschku.libquassel.quassel.syncables.interfaces.INetwork -import de.kuschku.libquassel.quassel.syncables.interfaces.INetwork.PortDefaults.PORT_PLAINTEXT -import de.kuschku.libquassel.quassel.syncables.interfaces.INetwork.PortDefaults.PORT_SSL -import de.kuschku.quasseldroid.R -import de.kuschku.quasseldroid.util.helper.setDependent -import de.kuschku.quasseldroid.util.ui.settings.fragment.Changeable -import de.kuschku.quasseldroid.util.ui.settings.fragment.Savable -import de.kuschku.quasseldroid.util.ui.settings.fragment.ServiceBoundSettingsFragment - -class NetworkServerFragment : ServiceBoundSettingsFragment(), Savable, - Changeable { - @BindView(R.id.host) - lateinit var host: EditText - - @BindView(R.id.port) - lateinit var port: EditText - - @BindView(R.id.ssl_enabled) - lateinit var sslEnabled: SwitchCompat - - @BindView(R.id.ssl_verify) - lateinit var sslVerify: SwitchCompat - - @BindView(R.id.password) - lateinit var password: EditText - - @BindView(R.id.proxy_enabled) - lateinit var proxyEnabled: SwitchCompat - - @BindView(R.id.proxy_group) - lateinit var proxyGroup: ViewGroup - - @BindView(R.id.proxy_type) - lateinit var proxyType: Spinner - - @BindView(R.id.proxy_host) - lateinit var proxyHost: EditText - - @BindView(R.id.proxy_port) - lateinit var proxyPort: EditText - - @BindView(R.id.proxy_user) - lateinit var proxyUser: EditText - - @BindView(R.id.proxy_pass) - lateinit var proxyPass: EditText - - private var item: INetwork.Server? = null - - override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, - savedInstanceState: Bundle?): View? { - val view = inflater.inflate(R.layout.settings_networkserver, container, false) - ButterKnife.bind(this, view) - - (arguments?.getSerializable("server") as? INetwork.Server)?.let { - item = it - } - - val typeAdapter = ProxyTypeAdapter(listOf( - ProxyTypeItem( - value = INetwork.ProxyType.Socks5Proxy, - name = R.string.settings_networkserver_proxy_type_socks5 - ), - ProxyTypeItem( - value = INetwork.ProxyType.HttpProxy, - name = R.string.settings_networkserver_proxy_type_http - ) - )) - proxyType.adapter = typeAdapter - - (item ?: INetwork.Server()).let { data -> - host.setText(data.host) - port.setText(data.port.toString()) - sslEnabled.isChecked = data.useSsl - sslVerify.isChecked = data.sslVerify - password.setText(data.password) - proxyEnabled.isChecked = data.useProxy - proxyType.setSelection(typeAdapter.indexOf(data.proxyType) ?: 0) - proxyHost.setText(data.proxyHost) - proxyPort.setText(data.proxyPort.toString()) - proxyUser.setText(data.proxyUser) - proxyPass.setText(data.proxyPass) - } - - proxyEnabled.setDependent(proxyGroup) - - sslEnabled.setOnCheckedChangeListener { _, isChecked -> - sslVerify.isEnabled = isChecked - val portValue = port.text.trim().toString() - if (isChecked && portValue == PORT_PLAINTEXT.port.toString()) { - port.setText(PORT_SSL.port.toString()) - } else if (!isChecked && portValue == PORT_SSL.port.toString()) { - port.setText(PORT_PLAINTEXT.port.toString()) - } - } - sslVerify.isEnabled = sslEnabled.isChecked - - return view - } - - private fun applyChanges(data: INetwork.Server?): INetwork.Server { - return INetwork.Server( - host = host.text.toString(), - port = port.text.toString().toUIntOrNull() - ?: data?.port - ?: PORT_PLAINTEXT.port, - useSsl = sslEnabled.isChecked, - sslVerify = sslVerify.isChecked, - password = password.text.toString(), - useProxy = proxyEnabled.isChecked, - proxyType = proxyType.selectedItemId.toInt(), - proxyHost = proxyHost.text.toString(), - proxyPort = proxyPort.text.toString().toUIntOrNull() - ?: data?.proxyPort ?: 0u, - proxyUser = proxyUser.text.toString(), - proxyPass = proxyPass.text.toString() - ) - } - - override fun onSave() = item.let { data -> - val intent = Intent() - intent.putExtra("old", data) - val new = applyChanges(data) - intent.putExtra("new", new) - requireActivity().setResult(Activity.RESULT_OK, intent) - true - } - - override fun hasChanged() = item != applyChanges(item) -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/ui/coresettings/networkserver/NetworkServerFragmentProvider.kt b/app/src/main/java/de/kuschku/quasseldroid/ui/coresettings/networkserver/NetworkServerFragmentProvider.kt deleted file mode 100644 index d7f234d07658e92078779ff05bd721992da79674..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/ui/coresettings/networkserver/NetworkServerFragmentProvider.kt +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.ui.coresettings.networkserver - -import androidx.fragment.app.FragmentActivity -import dagger.Binds -import dagger.Module -import dagger.android.ContributesAndroidInjector - -@Module -abstract class NetworkServerFragmentProvider { - @Binds - abstract fun bindFragmentActivity(activity: NetworkServerActivity): FragmentActivity - - @ContributesAndroidInjector - abstract fun bindNetworkServerFragment(): NetworkServerFragment -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/ui/coresettings/networkserver/ProxyTypeAdapter.kt b/app/src/main/java/de/kuschku/quasseldroid/ui/coresettings/networkserver/ProxyTypeAdapter.kt deleted file mode 100644 index 62a974ac8e6086cb0415466a86ea537498e2cfb9..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/ui/coresettings/networkserver/ProxyTypeAdapter.kt +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.ui.coresettings.networkserver - -import android.view.LayoutInflater -import android.view.ViewGroup -import androidx.appcompat.widget.ThemedSpinnerAdapter -import androidx.recyclerview.widget.RecyclerView -import de.kuschku.quasseldroid.databinding.WidgetSpinnerItemMaterialBinding -import de.kuschku.quasseldroid.util.ui.ContextThemeWrapper -import de.kuschku.quasseldroid.util.ui.RecyclerSpinnerAdapter - -class ProxyTypeAdapter(val data: List<ProxyTypeItem>) : - RecyclerSpinnerAdapter<ProxyTypeAdapter.ProxyTypeViewHolder>(), - ThemedSpinnerAdapter { - - override fun isEmpty() = data.isEmpty() - - override fun onBindViewHolder(holder: ProxyTypeViewHolder, position: Int) = - holder.bind(getItem(position)) - - override fun onCreateViewHolder(parent: ViewGroup, dropDown: Boolean) - : ProxyTypeViewHolder { - val inflater = LayoutInflater.from( - if (dropDown) ContextThemeWrapper(parent.context, dropDownViewTheme) - else parent.context - ) - return ProxyTypeViewHolder( - WidgetSpinnerItemMaterialBinding.inflate(inflater, parent, false) - ) - } - - override fun getItem(position: Int) = data[position] - - override fun getItemId(position: Int) = getItem(position).value.value.toLong() - - override fun hasStableIds() = true - - override fun getCount() = data.size - - fun indexOf(value: Int): Int? { - for ((key, item) in data.withIndex()) { - if (item.value.value == value) { - return key - } - } - return null - } - - class ProxyTypeViewHolder( - private val binding: WidgetSpinnerItemMaterialBinding - ) : RecyclerView.ViewHolder(binding.root) { - fun bind(activity: ProxyTypeItem?) { - activity?.let { - binding.text1.setText(it.name) - } - } - } -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/ui/coresettings/networkserver/ProxyTypeItem.kt b/app/src/main/java/de/kuschku/quasseldroid/ui/coresettings/networkserver/ProxyTypeItem.kt deleted file mode 100644 index e6770c695abcba034b178a1cce76159928cd2cfc..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/ui/coresettings/networkserver/ProxyTypeItem.kt +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.ui.coresettings.networkserver - -import androidx.annotation.StringRes -import de.kuschku.libquassel.quassel.syncables.interfaces.INetwork - -data class ProxyTypeItem(val value: INetwork.ProxyType, @StringRes val name: Int) diff --git a/app/src/main/java/de/kuschku/quasseldroid/ui/coresettings/passwordchange/PasswordChangeActivity.kt b/app/src/main/java/de/kuschku/quasseldroid/ui/coresettings/passwordchange/PasswordChangeActivity.kt deleted file mode 100644 index 9e94f6f9fb057f0f9da85ed2c0b969fa90f00898..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/ui/coresettings/passwordchange/PasswordChangeActivity.kt +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.ui.coresettings.passwordchange - -import android.content.Context -import android.content.Intent -import de.kuschku.quasseldroid.util.ui.settings.ServiceBoundSettingsActivity - -class PasswordChangeActivity : ServiceBoundSettingsActivity(PasswordChangeFragment()) { - companion object { - fun launch(context: Context) = context.startActivity(intent(context)) - - fun intent(context: Context) = Intent(context, PasswordChangeActivity::class.java) - } -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/ui/coresettings/passwordchange/PasswordChangeFragment.kt b/app/src/main/java/de/kuschku/quasseldroid/ui/coresettings/passwordchange/PasswordChangeFragment.kt deleted file mode 100644 index e7c39575b942391a42771037a987b0b27117c42c..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/ui/coresettings/passwordchange/PasswordChangeFragment.kt +++ /dev/null @@ -1,158 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.ui.coresettings.passwordchange - -import android.os.Bundle -import android.text.Editable -import android.view.LayoutInflater -import android.view.View -import android.view.ViewGroup -import android.widget.Button -import android.widget.EditText -import android.widget.TextView -import androidx.lifecycle.Observer -import butterknife.BindView -import butterknife.ButterKnife -import com.google.android.material.textfield.TextInputLayout -import de.kuschku.libquassel.quassel.syncables.RpcHandler -import de.kuschku.libquassel.session.ISession -import de.kuschku.libquassel.util.Optional -import de.kuschku.libquassel.util.helper.mapMapNullable -import de.kuschku.libquassel.util.helper.mapSwitchMap -import de.kuschku.libquassel.util.helper.value -import de.kuschku.quasseldroid.R -import de.kuschku.quasseldroid.persistence.dao.findById -import de.kuschku.quasseldroid.persistence.db.AccountDatabase -import de.kuschku.quasseldroid.persistence.models.Account -import de.kuschku.quasseldroid.util.TextValidator -import de.kuschku.quasseldroid.util.helper.toLiveData -import de.kuschku.quasseldroid.util.service.ServiceBoundFragment -import de.kuschku.quasseldroid.viewmodel.helper.EditorViewModelHelper -import me.zhanghai.android.materialprogressbar.MaterialProgressBar -import javax.inject.Inject - -class PasswordChangeFragment : ServiceBoundFragment() { - @BindView(R.id.user) - lateinit var user: EditText - - @BindView(R.id.password_old_wrapper) - lateinit var oldPasswordWrapper: TextInputLayout - - @BindView(R.id.password_old) - lateinit var oldPassword: EditText - - @BindView(R.id.password_new) - lateinit var newPassword: EditText - - @BindView(R.id.password_repeat_wrapper) - lateinit var repeatPasswordWrapper: TextInputLayout - - @BindView(R.id.password_repeat) - lateinit var repeatPassword: EditText - - @BindView(R.id.error) - lateinit var error: TextView - - @BindView(R.id.save) - lateinit var save: Button - - @BindView(R.id.progress) - lateinit var progress: MaterialProgressBar - - @Inject - lateinit var accountDatabase: AccountDatabase - - @Inject - lateinit var modelHelper: EditorViewModelHelper - - private var waiting: Account? = null - - override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, - savedInstanceState: Bundle?): View? { - val view = inflater.inflate(R.layout.settings_passwordchange, container, false) - ButterKnife.bind(this, view) - - val account = accountDatabase.accounts().findById(accountId) - - user.setText(account?.user) - - modelHelper.connectedSession - .mapMapNullable(ISession::rpcHandler) - .mapSwitchMap(RpcHandler::passwordChanged) - .filter(Optional<Boolean>::isPresent) - .map(Optional<Boolean>::get) - .toLiveData().observe(viewLifecycleOwner, Observer { - val waiting = this.waiting - if (waiting != null) { - if (it) { - save.setText(R.string.label_save) - save.isEnabled = true - save.isClickable = true - progress.visibility = View.GONE - error.visibility = View.GONE - runInBackground { - accountDatabase.accounts().save(waiting) - } - this.waiting = null - activity?.finish() - } else { - error.visibility = View.VISIBLE - } - } - }) - - oldPassword.addTextChangedListener(object : TextValidator( - activity, - oldPasswordWrapper::setError, - getString(R.string.label_password_error_wrong) - ) { - override fun validate(text: Editable) = text.toString() == account?.pass - }) - - repeatPassword.addTextChangedListener(object : TextValidator( - activity, - repeatPasswordWrapper::setError, - getString(R.string.label_password_error_nomatch) - ) { - override fun validate(text: Editable) = text.toString() == newPassword.text.toString() - }) - - save.setOnClickListener { - save.setText(R.string.label_saving) - save.isEnabled = false - save.isClickable = false - progress.visibility = View.VISIBLE - error.visibility = View.GONE - - val pass = newPassword.text.toString() - - waiting = account?.copy(pass = pass) - - modelHelper.connectedSession.value?.orNull()?.rpcHandler?.changePassword( - 0L, - user.text.toString(), - oldPassword.text.toString(), - pass - ) - } - - return view - } -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/ui/coresettings/passwordchange/PasswordChangeFragmentProvider.kt b/app/src/main/java/de/kuschku/quasseldroid/ui/coresettings/passwordchange/PasswordChangeFragmentProvider.kt deleted file mode 100644 index 4145d74de7e698d1c5d8e1b154dbbfec97ccecc1..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/ui/coresettings/passwordchange/PasswordChangeFragmentProvider.kt +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.ui.coresettings.passwordchange - -import androidx.fragment.app.FragmentActivity -import dagger.Binds -import dagger.Module -import dagger.android.ContributesAndroidInjector - -@Module -abstract class PasswordChangeFragmentProvider { - @Binds - abstract fun bindFragmentActivity(activity: PasswordChangeActivity): FragmentActivity - - @ContributesAndroidInjector - abstract fun bindPasswordChangeFragment(): PasswordChangeFragment -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/ui/info/certificate/CertificateInfoActivity.kt b/app/src/main/java/de/kuschku/quasseldroid/ui/info/certificate/CertificateInfoActivity.kt deleted file mode 100644 index 5168c5e1096fa0fa092287ae494b36dc4a7acc6a..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/ui/info/certificate/CertificateInfoActivity.kt +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.ui.info.certificate - -import android.content.Context -import android.content.Intent -import de.kuschku.quasseldroid.util.ui.settings.ServiceBoundSettingsActivity - -class CertificateInfoActivity : ServiceBoundSettingsActivity(CertificateInfoFragment()) { - companion object { - fun launch( - context: Context - ) = context.startActivity(intent(context)) - - fun intent( - context: Context - ) = Intent(context, CertificateInfoActivity::class.java).apply { - } - } -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/ui/info/certificate/CertificateInfoFragment.kt b/app/src/main/java/de/kuschku/quasseldroid/ui/info/certificate/CertificateInfoFragment.kt deleted file mode 100644 index 78670aaa9472b03673a0e41d91e9bace647986c7..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/ui/info/certificate/CertificateInfoFragment.kt +++ /dev/null @@ -1,156 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.ui.info.certificate - -import android.os.Bundle -import android.view.LayoutInflater -import android.view.View -import android.view.ViewGroup -import android.widget.TextView -import androidx.lifecycle.Observer -import butterknife.BindView -import butterknife.ButterKnife -import de.kuschku.libquassel.ssl.X509Helper -import de.kuschku.libquassel.ssl.commonName -import de.kuschku.libquassel.ssl.organization -import de.kuschku.libquassel.ssl.organizationalUnit -import de.kuschku.quasseldroid.R -import de.kuschku.quasseldroid.util.helper.sha1Fingerprint -import de.kuschku.quasseldroid.util.helper.sha256Fingerprint -import de.kuschku.quasseldroid.util.helper.toLiveData -import de.kuschku.quasseldroid.util.helper.visibleIf -import de.kuschku.quasseldroid.util.ui.settings.fragment.ServiceBoundSettingsFragment -import de.kuschku.quasseldroid.viewmodel.helper.EditorViewModelHelper -import org.threeten.bp.Instant -import org.threeten.bp.ZoneId -import org.threeten.bp.format.DateTimeFormatter -import org.threeten.bp.format.FormatStyle -import javax.inject.Inject - -class CertificateInfoFragment : ServiceBoundSettingsFragment() { - - @BindView(R.id.content) - lateinit var content: View - @BindView(R.id.error) - lateinit var error: View - - @BindView(R.id.subject_common_name_wrapper) - lateinit var subjectCommonNameWrapper: View - @BindView(R.id.subject_common_name) - lateinit var subjectCommonName: TextView - - @BindView(R.id.subject_hostnames_wrapper) - lateinit var subjectHostnamesWrapper: View - @BindView(R.id.subject_hostnames) - lateinit var subjectHostnames: TextView - - @BindView(R.id.subject_organization_wrapper) - lateinit var subjectOrganizationWrapper: View - @BindView(R.id.subject_organization) - lateinit var subjectOrganization: TextView - - @BindView(R.id.subject_organizational_unit_wrapper) - lateinit var subjectOrganizationalUnitWrapper: View - @BindView(R.id.subject_organizational_unit) - lateinit var subjectOrganizationalUnit: TextView - - @BindView(R.id.issuer_common_name_wrapper) - lateinit var issuerCommonNameWrapper: View - @BindView(R.id.issuer_common_name) - lateinit var issuerCommonName: TextView - - @BindView(R.id.issuer_organization_wrapper) - lateinit var issuerOrganizationWrapper: View - @BindView(R.id.issuer_organization) - lateinit var issuerOrganization: TextView - - @BindView(R.id.issuer_organizational_unit_wrapper) - lateinit var issuerOrganizationalUnitWrapper: View - @BindView(R.id.issuer_organizational_unit) - lateinit var issuerOrganizationalUnit: TextView - - @BindView(R.id.not_before) - lateinit var notBefore: TextView - @BindView(R.id.not_after) - lateinit var notAfter: TextView - - @BindView(R.id.fingerprint_sha256) - lateinit var fingerprintSha256: TextView - - @BindView(R.id.fingerprint_sha1) - lateinit var fingerprintSha1: TextView - - @Inject - lateinit var modelHelper: EditorViewModelHelper - - override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, - savedInstanceState: Bundle?): View? { - val view = inflater.inflate(R.layout.info_certificate, container, false) - ButterKnife.bind(this, view) - - val dateFormatter = DateTimeFormatter.ofLocalizedDate(FormatStyle.MEDIUM) - - modelHelper.peerCertificateChain.toLiveData().observe(viewLifecycleOwner, Observer { - val leafCertificate = it.firstOrNull() - if (leafCertificate != null) { - content.visibility = View.VISIBLE - error.visibility = View.GONE - - subjectCommonName.text = leafCertificate.subjectX500Principal.commonName - subjectCommonNameWrapper.visibleIf(!subjectCommonName.text.isNullOrBlank()) - - subjectHostnames.text = X509Helper.hostnames(leafCertificate).joinToString(", ") - subjectHostnamesWrapper.visibleIf(!subjectHostnames.text.isNullOrBlank()) - - subjectOrganization.text = leafCertificate.subjectX500Principal.organization - subjectOrganizationWrapper.visibleIf(!subjectOrganization.text.isNullOrBlank()) - - subjectOrganizationalUnit.text = leafCertificate.subjectX500Principal.organizationalUnit - subjectOrganizationalUnitWrapper.visibleIf(!subjectOrganizationalUnit.text.isNullOrBlank()) - - issuerCommonName.text = leafCertificate.issuerX500Principal.commonName - issuerCommonNameWrapper.visibleIf(!issuerCommonName.text.isNullOrBlank()) - - issuerOrganization.text = leafCertificate.issuerX500Principal.organization - issuerOrganizationWrapper.visibleIf(!issuerOrganization.text.isNullOrBlank()) - - issuerOrganizationalUnit.text = leafCertificate.issuerX500Principal.organizationalUnit - issuerOrganizationalUnitWrapper.visibleIf(!issuerOrganizationalUnit.text.isNullOrBlank()) - - notBefore.text = dateFormatter.format( - Instant.ofEpochMilli(leafCertificate.notBefore.time) - .atZone(ZoneId.systemDefault()) - ) - notAfter.text = dateFormatter.format( - Instant.ofEpochMilli(leafCertificate.notAfter.time) - .atZone(ZoneId.systemDefault()) - ) - - fingerprintSha256.text = leafCertificate.sha256Fingerprint - fingerprintSha1.text = leafCertificate.sha1Fingerprint - } else { - content.visibility = View.GONE - error.visibility = View.VISIBLE - } - }) - - return view - } -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/ui/info/certificate/CertificateInfoFragmentProvider.kt b/app/src/main/java/de/kuschku/quasseldroid/ui/info/certificate/CertificateInfoFragmentProvider.kt deleted file mode 100644 index 79610c535f405b157f7419b1ecd3119eefc53919..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/ui/info/certificate/CertificateInfoFragmentProvider.kt +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.ui.info.certificate - -import androidx.fragment.app.FragmentActivity -import dagger.Binds -import dagger.Module -import dagger.android.ContributesAndroidInjector - -@Module -abstract class CertificateInfoFragmentProvider { - @Binds - abstract fun bindFragmentActivity(activity: CertificateInfoActivity): FragmentActivity - - @ContributesAndroidInjector - abstract fun bindCertificateInfoFragment(): CertificateInfoFragment -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/ui/info/channel/ChannelInfoActivity.kt b/app/src/main/java/de/kuschku/quasseldroid/ui/info/channel/ChannelInfoActivity.kt deleted file mode 100644 index 813736d60eef2646cdb99e34cc0bdf9a62410d10..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/ui/info/channel/ChannelInfoActivity.kt +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.ui.info.channel - -import android.content.Context -import android.content.Intent -import de.kuschku.libquassel.protocol.BufferId -import de.kuschku.quasseldroid.util.ui.settings.ServiceBoundSettingsActivity - -class ChannelInfoActivity : ServiceBoundSettingsActivity(ChannelInfoFragment()) { - companion object { - fun launch( - context: Context, - openBuffer: Boolean, - bufferId: BufferId - ) = context.startActivity(intent(context, openBuffer, bufferId)) - - fun intent( - context: Context, - openBuffer: Boolean, - bufferId: BufferId - ) = Intent(context, ChannelInfoActivity::class.java).apply { - putExtra("bufferId", bufferId.id) - putExtra("openBuffer", openBuffer) - } - } -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/ui/info/channel/ChannelInfoFragment.kt b/app/src/main/java/de/kuschku/quasseldroid/ui/info/channel/ChannelInfoFragment.kt deleted file mode 100644 index 071de92ca854c43241da5c7d2270e2354ff38463..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/ui/info/channel/ChannelInfoFragment.kt +++ /dev/null @@ -1,221 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.ui.info.channel - -import android.os.Build -import android.os.Bundle -import android.view.LayoutInflater -import android.view.View -import android.view.ViewGroup -import android.widget.Button -import android.widget.TextView -import androidx.lifecycle.Observer -import butterknife.BindView -import butterknife.ButterKnife -import de.kuschku.libquassel.protocol.BufferId -import de.kuschku.libquassel.protocol.Buffer_Type -import de.kuschku.libquassel.protocol.NetworkId -import de.kuschku.libquassel.quassel.BufferInfo -import de.kuschku.libquassel.quassel.syncables.IrcChannel -import de.kuschku.libquassel.util.helper.combineLatest -import de.kuschku.libquassel.util.helper.safeSwitchMap -import de.kuschku.libquassel.util.helper.value -import de.kuschku.quasseldroid.R -import de.kuschku.quasseldroid.settings.MessageSettings -import de.kuschku.quasseldroid.ui.chat.topic.TopicActivity -import de.kuschku.quasseldroid.util.ShortcutCreationHelper -import de.kuschku.quasseldroid.util.helper.* -import de.kuschku.quasseldroid.util.irc.format.ContentFormatter -import de.kuschku.quasseldroid.util.service.ServiceBoundFragment -import de.kuschku.quasseldroid.util.ui.BetterLinkMovementMethod -import de.kuschku.quasseldroid.util.ui.LinkLongClickMenuHelper -import de.kuschku.quasseldroid.viewmodel.helper.EditorViewModelHelper -import javax.inject.Inject - -class ChannelInfoFragment : ServiceBoundFragment() { - - @BindView(R.id.name) - lateinit var name: TextView - - @BindView(R.id.topic) - lateinit var topic: TextView - - @BindView(R.id.action_edit_topic) - lateinit var actionEditTopic: Button - - @BindView(R.id.action_who) - lateinit var actionWho: Button - - @BindView(R.id.action_part) - lateinit var actionPart: Button - - @BindView(R.id.action_join) - lateinit var actionJoin: Button - - @BindView(R.id.action_shortcut) - lateinit var actionShortcut: Button - - @Inject - lateinit var contentFormatter: ContentFormatter - - @Inject - lateinit var messageSettings: MessageSettings - - @Inject - lateinit var modelHelper: EditorViewModelHelper - - override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, - savedInstanceState: Bundle?): View? { - val view = inflater.inflate(R.layout.info_channel, container, false) - ButterKnife.bind(this, view) - - val openBuffer = arguments?.getBoolean("openBuffer") - val bufferId = BufferId(arguments?.getInt("bufferId") ?: -1) - val networkId = NetworkId(arguments?.getInt("networkId") ?: -1) - - var currentBufferInfo: BufferInfo? - - combineLatest(modelHelper.connectedSession, - modelHelper.networks).map { (sessionOptional, networks) -> - if (openBuffer == true) { - val session = sessionOptional?.orNull() - val bufferSyncer = session?.bufferSyncer - val bufferInfo = bufferSyncer?.bufferInfo(bufferId) - bufferInfo?.let { info -> - networks[info.networkId]?.ircChannel(info.bufferName)?.let { - Pair(info, it) - } - } - } else { - networks[networkId]?.ircChannel(arguments?.getString("nick"))?.let { - Pair(null, it) - } - } ?: Pair(null, IrcChannel.NULL) - }.filter { - it.second != IrcChannel.NULL - }.safeSwitchMap { (info, channel) -> - channel.updates().map { - Pair(info, it) - } - }.toLiveData().observe(viewLifecycleOwner, Observer { (info, channel) -> - name.text = channel.name() - val (content, hasSpoilers) = contentFormatter.formatContent( - channel.topic(), - networkId = channel.network().networkId() - ) - topic.text = content - - currentBufferInfo = info - actionShortcut.visibleIf(info != null && Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) - - actionEditTopic.setOnClickListener { - TopicActivity.launch(requireContext(), buffer = arguments?.getInt("bufferId") ?: -1) - } - - actionPart.setOnClickListener { - modelHelper.connectedSession.value?.orNull()?.let { session -> - session.bufferSyncer.find( - networkId = channel.network().networkId(), - type = Buffer_Type.of(Buffer_Type.StatusBuffer) - )?.let { statusInfo -> - session.rpcHandler.sendInput(statusInfo, "/part ${channel.name()}") - requireActivity().finish() - } - } - } - - actionWho.setOnClickListener { - modelHelper.connectedSession.value?.orNull()?.let { session -> - session.bufferSyncer.find( - networkId = channel.network().networkId(), - type = Buffer_Type.of(Buffer_Type.StatusBuffer) - )?.let { statusInfo -> - session.rpcHandler.sendInput(statusInfo, "/who ${channel.name()}") - requireActivity().finish() - } - } - } - - actionShortcut.setOnClickListener { - this.context?.let { context -> - currentBufferInfo?.let { info -> - ShortcutCreationHelper.create( - context = context, - messageSettings = messageSettings, - accountId = accountId, - info = info - ) - } - } - } - }) - - val movementMethod = BetterLinkMovementMethod.newInstance() - movementMethod.setOnLinkLongClickListener(LinkLongClickMenuHelper()) - topic.movementMethod = movementMethod - - actionEditTopic.setTooltip() - actionEditTopic.setCompoundDrawablesWithIntrinsicBounds( - null, - requireContext().getVectorDrawableCompat(R.drawable.ic_pencil), - null, - null - ) - actionEditTopic.retint() - - actionWho.setTooltip() - actionWho.setCompoundDrawablesWithIntrinsicBounds( - null, - requireContext().getVectorDrawableCompat(R.drawable.ic_info), - null, - null - ) - actionWho.retint() - - actionJoin.setTooltip() - actionJoin.setCompoundDrawablesWithIntrinsicBounds( - null, - requireContext().getVectorDrawableCompat(R.drawable.ic_account_plus), - null, - null - ) - actionJoin.retint() - - actionPart.setTooltip() - actionPart.setCompoundDrawablesWithIntrinsicBounds( - null, - requireContext().getVectorDrawableCompat(R.drawable.ic_account_minus), - null, - null - ) - actionPart.retint() - - actionShortcut.setTooltip() - actionShortcut.setCompoundDrawablesWithIntrinsicBounds( - null, - requireContext().getVectorDrawableCompat(R.drawable.ic_link), - null, - null - ) - actionShortcut.retint() - - return view - } -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/ui/info/channel/ChannelInfoFragmentProvider.kt b/app/src/main/java/de/kuschku/quasseldroid/ui/info/channel/ChannelInfoFragmentProvider.kt deleted file mode 100644 index f87d5ca299c95d156d07c3a8f4144dc0f45cfa1a..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/ui/info/channel/ChannelInfoFragmentProvider.kt +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.ui.info.channel - -import androidx.fragment.app.FragmentActivity -import dagger.Binds -import dagger.Module -import dagger.android.ContributesAndroidInjector - -@Module -abstract class ChannelInfoFragmentProvider { - @Binds - abstract fun bindFragmentActivity(activity: ChannelInfoActivity): FragmentActivity - - @ContributesAndroidInjector - abstract fun bindChannelInfoFragment(): ChannelInfoFragment -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/ui/info/channellist/ChannelListActivity.kt b/app/src/main/java/de/kuschku/quasseldroid/ui/info/channellist/ChannelListActivity.kt deleted file mode 100644 index 8ee799d89149c9abba624bf8a8681e10e0b2a644..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/ui/info/channellist/ChannelListActivity.kt +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.ui.info.channellist - -import android.content.Context -import android.content.Intent -import de.kuschku.libquassel.protocol.NetworkId -import de.kuschku.quasseldroid.util.ui.settings.ServiceBoundSettingsActivity - -class ChannelListActivity : ServiceBoundSettingsActivity(ChannelListFragment()) { - companion object { - fun launch( - context: Context, - network: NetworkId - ) = context.startActivity(intent(context, network)) - - fun intent( - context: Context, - network: NetworkId - ) = Intent(context, ChannelListActivity::class.java).apply { - putExtra("network_id", network.id) - } - } -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/ui/info/channellist/ChannelListAdapter.kt b/app/src/main/java/de/kuschku/quasseldroid/ui/info/channellist/ChannelListAdapter.kt deleted file mode 100644 index c6bb63cd1db2b7410bb22f39e81c41e7c6a4c317..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/ui/info/channellist/ChannelListAdapter.kt +++ /dev/null @@ -1,106 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.ui.info.channellist - -import android.content.Context -import android.graphics.drawable.Drawable -import android.view.LayoutInflater -import android.view.ViewGroup -import androidx.recyclerview.widget.DiffUtil -import androidx.recyclerview.widget.ListAdapter -import androidx.recyclerview.widget.RecyclerView -import de.kuschku.libquassel.quassel.syncables.IrcListHelper -import de.kuschku.quasseldroid.R -import de.kuschku.quasseldroid.databinding.WidgetChannelSearchBinding -import de.kuschku.quasseldroid.ui.chat.ChatActivity -import de.kuschku.quasseldroid.util.ColorContext -import de.kuschku.quasseldroid.util.helper.styledAttributes -import de.kuschku.quasseldroid.util.irc.format.ContentFormatter -import javax.inject.Inject - -class ChannelListAdapter @Inject constructor( - private val contentFormatter: ContentFormatter, - context: Context, - colorContext: ColorContext -) : - ListAdapter<IrcListHelper.ChannelDescription, ChannelListAdapter.ChannelViewHolder>( - object : DiffUtil.ItemCallback<IrcListHelper.ChannelDescription>() { - override fun areItemsTheSame(oldItem: IrcListHelper.ChannelDescription, - newItem: IrcListHelper.ChannelDescription) = - oldItem.channelName == newItem.channelName - - override fun areContentsTheSame(oldItem: IrcListHelper.ChannelDescription, - newItem: IrcListHelper.ChannelDescription) = - oldItem == newItem - } - ) { - val colorAccent = context.theme.styledAttributes(R.attr.colorAccent) { - getColor(0, 0) - } - - private val fallbackDrawable = colorContext.buildTextDrawable("#", colorAccent) - - override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ChannelViewHolder { - return ChannelViewHolder( - WidgetChannelSearchBinding.inflate(LayoutInflater.from(parent.context), parent, false), - contentFormatter, - fallbackDrawable - ) - } - - override fun onBindViewHolder(holder: ChannelViewHolder, position: Int) { - holder.bind(getItem(position)) - } - - class ChannelViewHolder( - private val binding: WidgetChannelSearchBinding, - private val contentFormatter: ContentFormatter, - fallbackDrawable: Drawable - ) : RecyclerView.ViewHolder(binding.root) { - private var data: IrcListHelper.ChannelDescription? = null - - init { - binding.status.setImageDrawable(fallbackDrawable) - itemView.setOnClickListener { - data?.let { - ChatActivity.launch( - itemView.context, - networkId = it.netId, - channel = it.channelName - ) - } - } - } - - fun bind(data: IrcListHelper.ChannelDescription) { - binding.name.text = data.channelName - val (content, hasSpoilers) = contentFormatter.formatContent( - data.topic, - networkId = data.netId - ) - binding.topic.text = content - binding.users.text = itemView.context.resources.getQuantityString(R.plurals.label_user_count, - data.userCount.toInt(), - data.userCount.toInt()) - - this.data = data - } - } -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/ui/info/channellist/ChannelListFragment.kt b/app/src/main/java/de/kuschku/quasseldroid/ui/info/channellist/ChannelListFragment.kt deleted file mode 100644 index 01555f39577c6aed986eac6d2c3b3c1c6c8b031c..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/ui/info/channellist/ChannelListFragment.kt +++ /dev/null @@ -1,231 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.ui.info.channellist - -import android.os.Bundle -import android.view.* -import android.widget.EditText -import androidx.appcompat.app.AppCompatActivity -import androidx.appcompat.widget.AppCompatImageButton -import androidx.lifecycle.Observer -import androidx.recyclerview.widget.DefaultItemAnimator -import androidx.recyclerview.widget.LinearLayoutManager -import androidx.recyclerview.widget.RecyclerView -import butterknife.BindView -import butterknife.ButterKnife -import de.kuschku.libquassel.protocol.NetworkId -import de.kuschku.libquassel.protocol.QStringList -import de.kuschku.libquassel.quassel.syncables.IrcListHelper -import de.kuschku.libquassel.util.Optional -import de.kuschku.libquassel.util.helper.combineLatest -import de.kuschku.libquassel.util.helper.mapSwitchMap -import de.kuschku.libquassel.util.helper.value -import de.kuschku.quasseldroid.R -import de.kuschku.quasseldroid.util.helper.retint -import de.kuschku.quasseldroid.util.helper.toLiveData -import de.kuschku.quasseldroid.util.ui.settings.fragment.ServiceBoundSettingsFragment -import de.kuschku.quasseldroid.util.ui.view.MaterialContentLoadingProgressBar -import de.kuschku.quasseldroid.util.ui.view.WarningBarView -import de.kuschku.quasseldroid.viewmodel.helper.EditorViewModelHelper -import io.reactivex.BackpressureStrategy -import io.reactivex.subjects.BehaviorSubject -import javax.inject.Inject - -class ChannelListFragment : ServiceBoundSettingsFragment() { - @BindView(R.id.search_input) - lateinit var searchInput: EditText - - @BindView(R.id.search_button) - lateinit var searchButton: AppCompatImageButton - - @BindView(R.id.progress) - lateinit var progress: MaterialContentLoadingProgressBar - - @BindView(R.id.search_results) - lateinit var searchResults: RecyclerView - - @BindView(R.id.error) - lateinit var errorDisplay: WarningBarView - - @Inject - lateinit var adapter: ChannelListAdapter - - @Inject - lateinit var modelHelper: EditorViewModelHelper - - private var query: Query? = null - private var state: State = State() - - data class Query( - val networkId: NetworkId, - val filters: QStringList - ) - - data class State( - val loading: Boolean = false, - val error: String? = null - ) - - fun updateState(loading: Boolean = state.loading, error: String? = state.error) { - fun internalUpdateState(state: State) { - if (state.error != null) { - errorDisplay.setText(state.error) - errorDisplay.setMode(WarningBarView.MODE_ICON) - } else { - errorDisplay.setMode(WarningBarView.MODE_NONE) - } - - if (state.loading) { - progress.show() - } else { - progress.hide() - } - } - - val newState = State(loading, error) - if (newState != state) { - state = newState - internalUpdateState(newState) - } - } - - val results = BehaviorSubject.createDefault(emptyList<IrcListHelper.ChannelDescription>()) - val sort = BehaviorSubject.createDefault(Sort(Sort.Field.CHANNEL_NAME, Sort.Direction.ASC)) - - override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, - savedInstanceState: Bundle?): View? { - val view = inflater.inflate(R.layout.info_channellist, container, false) - ButterKnife.bind(this, view) - - val networkId = NetworkId(arguments?.getInt("network_id", -1) ?: -1) - - searchResults.adapter = adapter - searchResults.layoutManager = LinearLayoutManager(view.context) - searchResults.itemAnimator = DefaultItemAnimator() - - combineLatest(results, sort).toLiveData().observe(viewLifecycleOwner, - Observer { (results, sort) -> - adapter.submitList(results.let { - when (sort.field) { - Sort.Field.CHANNEL_NAME -> { - when (sort.direction) { - Sort.Direction.ASC -> - it.sortedBy(IrcListHelper.ChannelDescription::channelName) - Sort.Direction.DESC -> - it.sortedByDescending( - IrcListHelper.ChannelDescription::channelName) - } - } - Sort.Field.USER_COUNT -> { - when (sort.direction) { - Sort.Direction.ASC -> - it.sortedBy(IrcListHelper.ChannelDescription::userCount) - Sort.Direction.DESC -> - it.sortedByDescending( - IrcListHelper.ChannelDescription::userCount) - } - } - Sort.Field.TOPIC -> { - when (sort.direction) { - Sort.Direction.ASC -> - it.sortedBy(IrcListHelper.ChannelDescription::topic) - Sort.Direction.DESC -> - it.sortedByDescending( - IrcListHelper.ChannelDescription::topic) - } - } - } - }) - }) - - modelHelper.ircListHelper - .mapSwitchMap(IrcListHelper::observable) - .filter(Optional<IrcListHelper.Event>::isPresent) - .map(Optional<IrcListHelper.Event>::get) - .toLiveData(BackpressureStrategy.BUFFER).observe(viewLifecycleOwner, Observer { - when (it) { - is IrcListHelper.Event.ChannelList -> { - if (it.netId == query?.networkId) { - results.onNext(it.data) - } - } - is IrcListHelper.Event.Finished -> { - if (it.netId == query?.networkId) { - updateState(false, null) - } - } - is IrcListHelper.Event.Error -> { - updateState(false, it.error) - } - } - }) - - searchButton.setOnClickListener { - modelHelper.ircListHelper.value?.orNull()?.let { ircListHelper -> - val query = Query( - networkId, - listOf(searchInput.text.toString()) - ) - - ircListHelper.requestChannelList(networkId, query.filters) - updateState(true, null) - results.onNext(emptyList()) - this.query = query - } - } - return view - } - - override fun onCreateOptionsMenu(menu: Menu, inflater: MenuInflater) { - inflater.inflate(R.menu.activity_channellist, menu) - (activity as? AppCompatActivity)?.supportActionBar?.themedContext?.let { - menu.retint(it) - } - super.onCreateOptionsMenu(menu, inflater) - } - - override fun onOptionsItemSelected(item: MenuItem) = when (item.itemId) { - R.id.channel_name_asc -> { - sort.onNext(Sort(Sort.Field.CHANNEL_NAME, Sort.Direction.ASC)) - true - } - R.id.channel_name_desc -> { - sort.onNext(Sort(Sort.Field.CHANNEL_NAME, Sort.Direction.DESC)) - true - } - R.id.user_count_asc -> { - sort.onNext(Sort(Sort.Field.USER_COUNT, Sort.Direction.ASC)) - true - } - R.id.user_count_desc -> { - sort.onNext(Sort(Sort.Field.USER_COUNT, Sort.Direction.DESC)) - true - } - R.id.topic_asc -> { - sort.onNext(Sort(Sort.Field.TOPIC, Sort.Direction.ASC)) - true - } - R.id.topic_desc -> { - sort.onNext(Sort(Sort.Field.TOPIC, Sort.Direction.DESC)) - true - } - else -> super.onOptionsItemSelected(item) - } -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/ui/info/channellist/ChannelListFragmentProvider.kt b/app/src/main/java/de/kuschku/quasseldroid/ui/info/channellist/ChannelListFragmentProvider.kt deleted file mode 100644 index 6844f76b6217ba3d1d00f530d8a071a69eb76f54..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/ui/info/channellist/ChannelListFragmentProvider.kt +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.ui.info.channellist - -import androidx.fragment.app.FragmentActivity -import dagger.Binds -import dagger.Module -import dagger.android.ContributesAndroidInjector - -@Module -abstract class ChannelListFragmentProvider { - @Binds - abstract fun bindFragmentActivity(activity: ChannelListActivity): FragmentActivity - - @ContributesAndroidInjector - abstract fun bindChannelListFragment(): ChannelListFragment -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/ui/info/channellist/Sort.kt b/app/src/main/java/de/kuschku/quasseldroid/ui/info/channellist/Sort.kt deleted file mode 100644 index 422b8bb4a742e82d888e37a6999c0381d56681dd..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/ui/info/channellist/Sort.kt +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.ui.info.channellist - -data class Sort( - val field: Field, - val direction: Direction -) { - enum class Field { - CHANNEL_NAME, - USER_COUNT, - TOPIC - } - - enum class Direction { - ASC, - DESC - } -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/ui/info/core/ClientAdapter.kt b/app/src/main/java/de/kuschku/quasseldroid/ui/info/core/ClientAdapter.kt deleted file mode 100644 index a504286ac928dfdd9c3c932f0ac17979933e3ef3..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/ui/info/core/ClientAdapter.kt +++ /dev/null @@ -1,132 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.ui.info.core - -import android.graphics.drawable.Drawable -import android.text.Html -import android.view.LayoutInflater -import android.view.ViewGroup -import androidx.recyclerview.widget.DiffUtil -import androidx.recyclerview.widget.ListAdapter -import androidx.recyclerview.widget.RecyclerView -import de.kuschku.libquassel.quassel.ExtendedFeature -import de.kuschku.libquassel.quassel.syncables.CoreInfo -import de.kuschku.quasseldroid.R -import de.kuschku.quasseldroid.databinding.WidgetClientBinding -import de.kuschku.quasseldroid.util.helper.getVectorDrawableCompat -import de.kuschku.quasseldroid.util.helper.styledAttributes -import de.kuschku.quasseldroid.util.helper.tint -import de.kuschku.quasseldroid.util.helper.visibleIf -import de.kuschku.quasseldroid.util.ui.BetterLinkMovementMethod -import de.kuschku.quasseldroid.util.ui.LinkLongClickMenuHelper -import org.threeten.bp.Instant -import org.threeten.bp.ZoneId -import org.threeten.bp.format.DateTimeFormatter -import org.threeten.bp.format.FormatStyle - -class ClientAdapter : ListAdapter<CoreInfo.ConnectedClientData, ClientAdapter.ClientViewHolder>( - object : DiffUtil.ItemCallback<CoreInfo.ConnectedClientData>() { - override fun areItemsTheSame(oldItem: CoreInfo.ConnectedClientData, - newItem: CoreInfo.ConnectedClientData) = oldItem.id == newItem.id - - override fun areContentsTheSame(oldItem: CoreInfo.ConnectedClientData, - newItem: CoreInfo.ConnectedClientData) = oldItem == newItem - } -) { - private val movementMethod = BetterLinkMovementMethod.newInstance() - - init { - movementMethod.setOnLinkLongClickListener(LinkLongClickMenuHelper()) - } - - private var disconnectListener: ((Int) -> Unit)? = null - fun setDisconnectListener(listener: ((Int) -> Unit)?) { - this.disconnectListener = listener - } - - fun disconnect(id: Int) { - disconnectListener?.invoke(id) - } - - override fun onCreateViewHolder(parent: ViewGroup, viewType: Int) = ClientViewHolder( - WidgetClientBinding.inflate(LayoutInflater.from(parent.context), parent, false), - dateTimeFormatter, - dateFormatter, - ::disconnect, - movementMethod - ) - - private val dateTimeFormatter = DateTimeFormatter.ofLocalizedDateTime(FormatStyle.MEDIUM) - private val dateFormatter = DateTimeFormatter.ofLocalizedDate(FormatStyle.MEDIUM) - - override fun onBindViewHolder(holder: ClientViewHolder, position: Int) = - holder.bind(getItem(position)) - - class ClientViewHolder( - private val binding: WidgetClientBinding, - private val dateTimeFormatter: DateTimeFormatter, - private val dateFormatter: DateTimeFormatter, - private val disconnectListener: (Int) -> Unit, - movementMethod: BetterLinkMovementMethod - ) : RecyclerView.ViewHolder(binding.root) { - - private var id: Int? = null - - private val secure: Drawable? - private val insecure: Drawable? - - init { - binding.version.movementMethod = movementMethod - binding.disconnect.setOnClickListener { - id?.let(disconnectListener::invoke) - } - - secure = itemView.context.getVectorDrawableCompat(R.drawable.ic_lock)?.mutate() - insecure = itemView.context.getVectorDrawableCompat(R.drawable.ic_lock_open)?.mutate() - itemView.context.theme.styledAttributes( - R.attr.colorTintSecure, - R.attr.colorTintInsecure - ) { - secure?.tint(getColor(0, 0)) - insecure?.tint(getColor(1, 0)) - } - } - - fun bind(data: CoreInfo.ConnectedClientData) { - id = data.id - - binding.ip.text = data.remoteAddress - val versionTime = data.clientVersionDate.toLongOrNull() - val formattedVersionTime = if (versionTime != null) - dateFormatter.format(Instant.ofEpochSecond(versionTime).atZone(ZoneId.systemDefault())) - else - data.clientVersionDate - binding.version.text = Html.fromHtml(data.clientVersion + " ($formattedVersionTime)") - val connectedSinceFormatted = dateTimeFormatter.format(data.connectedSince.atZone(ZoneId.systemDefault())) - binding.uptime.text = itemView.context.getString(R.string.label_core_connected_since, - connectedSinceFormatted) - binding.location.text = data.location - binding.location.visibleIf(data.location.isNotBlank()) - - binding.secureIcon.setImageDrawable(if (data.secure) secure else insecure) - binding.disconnect.visibleIf(data.features.hasFeature(ExtendedFeature.RemoteDisconnect)) - } - } -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/ui/info/core/CoreInfoActivity.kt b/app/src/main/java/de/kuschku/quasseldroid/ui/info/core/CoreInfoActivity.kt deleted file mode 100644 index 82d4b4bd78d006b8dcc9001b215191a178b936a6..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/ui/info/core/CoreInfoActivity.kt +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.ui.info.core - -import android.content.Context -import android.content.Intent -import de.kuschku.quasseldroid.util.ui.settings.ServiceBoundSettingsActivity - -class CoreInfoActivity : ServiceBoundSettingsActivity(CoreInfoFragment()) { - companion object { - fun launch( - context: Context - ) = context.startActivity(intent(context)) - - fun intent( - context: Context - ) = Intent(context, CoreInfoActivity::class.java) - } -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/ui/info/core/CoreInfoFragment.kt b/app/src/main/java/de/kuschku/quasseldroid/ui/info/core/CoreInfoFragment.kt deleted file mode 100644 index 6999288621d0c0478b7719e26a7fc858f4c07e8e..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/ui/info/core/CoreInfoFragment.kt +++ /dev/null @@ -1,240 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.ui.info.core - -import android.os.Bundle -import android.text.Html -import android.view.LayoutInflater -import android.view.View -import android.view.ViewGroup -import android.widget.Button -import android.widget.ImageView -import android.widget.TextView -import androidx.lifecycle.Observer -import androidx.recyclerview.widget.LinearLayoutManager -import androidx.recyclerview.widget.RecyclerView -import butterknife.BindView -import butterknife.ButterKnife -import de.kuschku.libquassel.quassel.QuasselFeatures -import de.kuschku.libquassel.ssl.X509Helper -import de.kuschku.libquassel.ssl.commonName -import de.kuschku.libquassel.util.helper.combineLatest -import de.kuschku.libquassel.util.helper.value -import de.kuschku.quasseldroid.R -import de.kuschku.quasseldroid.ui.info.certificate.CertificateInfoActivity -import de.kuschku.quasseldroid.util.helper.* -import de.kuschku.quasseldroid.util.missingfeatures.MissingFeature -import de.kuschku.quasseldroid.util.missingfeatures.MissingFeaturesDialog -import de.kuschku.quasseldroid.util.missingfeatures.RequiredFeatures -import de.kuschku.quasseldroid.util.service.ServiceBoundFragment -import de.kuschku.quasseldroid.util.ui.BetterLinkMovementMethod -import de.kuschku.quasseldroid.util.ui.LinkLongClickMenuHelper -import de.kuschku.quasseldroid.viewmodel.helper.EditorViewModelHelper -import org.threeten.bp.Instant -import org.threeten.bp.ZoneId -import org.threeten.bp.format.DateTimeFormatter -import org.threeten.bp.format.FormatStyle -import javax.inject.Inject -import javax.net.ssl.SSLPeerUnverifiedException - -class CoreInfoFragment : ServiceBoundFragment() { - - @BindView(R.id.version) - lateinit var version: TextView - - @BindView(R.id.version_date) - lateinit var versionDate: TextView - - @BindView(R.id.missing_features) - lateinit var missingFeatures: Button - - @BindView(R.id.uptime_container) - lateinit var uptimeContainer: View - - @BindView(R.id.uptime) - lateinit var uptime: TextView - - @BindView(R.id.secure_certificate) - lateinit var secureCertificate: TextView - - @BindView(R.id.secure_certificate_icon) - lateinit var secureCertificateIcon: ImageView - - @BindView(R.id.secure_connection_protocol) - lateinit var secureConnectionProtocol: TextView - - @BindView(R.id.secure_connection_ciphersuite) - lateinit var secureConnectionCiphersuite: TextView - - @BindView(R.id.secure_details) - lateinit var secureDetails: Button - - @BindView(R.id.clients_title) - lateinit var clientsTitle: View - - @BindView(R.id.clients) - lateinit var clients: RecyclerView - - @Inject - lateinit var modelHelper: EditorViewModelHelper - - private val dateTimeFormatter = DateTimeFormatter.ofLocalizedDateTime(FormatStyle.MEDIUM) - private val dateFormatter = DateTimeFormatter.ofLocalizedDate(FormatStyle.MEDIUM) - - private val movementMethod = BetterLinkMovementMethod.newInstance() - - private val cipherSuiteRegex = Regex("TLS_(.*)_WITH_(.*)") - private val cipherSuiteRegex13 = Regex("TLS_()(.*)") - - init { - movementMethod.setOnLinkLongClickListener(LinkLongClickMenuHelper()) - } - - override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, - savedInstanceState: Bundle?): View? { - val view = inflater.inflate(R.layout.info_core, container, false) - ButterKnife.bind(this, view) - - var missingFeatureList: List<MissingFeature> = emptyList() - combineLatest(modelHelper.coreInfo, modelHelper.coreFeatures).toLiveData() - .observe(viewLifecycleOwner, Observer { - val data = it?.first?.orNull() - val connected = it?.second?.first - ?: false - val features = it?.second?.second - ?: QuasselFeatures.empty() - - version.text = data?.quasselVersion?.let(Html::fromHtml) - val versionTime = data?.quasselBuildDate?.toLongOrNull() - val formattedVersionTime = if (versionTime != null) - dateFormatter.format(Instant.ofEpochSecond(versionTime).atZone(ZoneId.systemDefault())) - else - data?.quasselBuildDate?.let(Html::fromHtml) - versionDate.text = formattedVersionTime - missingFeatureList = RequiredFeatures.features.filter { - it.feature !in features.enabledFeatures - } - missingFeatures.visibleIf(connected && missingFeatureList.isNotEmpty()) - - val startTime = data?.startTime?.atZone(ZoneId.systemDefault())?.let(dateTimeFormatter::format) - uptime.text = requireContext().getString(R.string.label_core_online_since, - startTime.toString()) - uptimeContainer.visibleIf(startTime != null) - }) - missingFeatures.setOnClickListener { - MissingFeaturesDialog.Builder(requireActivity()) - .missingFeatures(missingFeatureList) - .readOnly(true) - .show() - } - version.movementMethod = movementMethod - versionDate.movementMethod = movementMethod - - val secure = requireContext().getVectorDrawableCompat(R.drawable.ic_lock)?.mutate() - val partiallySecure = requireContext().getVectorDrawableCompat(R.drawable.ic_lock)?.mutate() - val insecure = requireContext().getVectorDrawableCompat(R.drawable.ic_lock_open)?.mutate() - requireContext().theme.styledAttributes( - R.attr.colorTintSecure, - R.attr.colorTintPartiallySecure, - R.attr.colorTintInsecure - ) { - secure?.tint(getColor(0, 0)) - partiallySecure?.tint(getColor(1, 0)) - insecure?.tint(getColor(2, 0)) - } - - secureDetails.setOnClickListener { - CertificateInfoActivity.launch(it.context) - } - - modelHelper.sslSession.toLiveData().observe(viewLifecycleOwner, Observer { - val peerCertificateChain = try { - it?.orNull()?.peerCertificateChain - } catch (ignored: SSLPeerUnverifiedException) { - null - } - val certificateChain = peerCertificateChain?.mapNotNull(X509Helper::convert).orEmpty() - val leafCertificate = certificateChain.firstOrNull() - if (leafCertificate != null) { - secureCertificate.text = requireContext().getString( - R.string.label_core_connection_verified_by, - leafCertificate.issuerX500Principal.commonName - ) - if (leafCertificate.isValid) { - secureCertificateIcon.setImageDrawable(secure) - } else { - secureCertificateIcon.setImageDrawable(partiallySecure) - } - secureDetails.visibility = View.VISIBLE - } else { - secureCertificate.text = context?.getString(R.string.label_core_connection_insecure) - secureCertificateIcon.setImageDrawable(insecure) - secureDetails.visibility = View.GONE - } - - val protocol = it.orNull()?.protocol - val cipherSuiteRegex = - if (it.orNull()?.protocol == "TLSv1.3") cipherSuiteRegex13 - else cipherSuiteRegex - - val (keyExchangeMechanism, cipherSuite) = it.orNull()?.cipherSuite?.let { cipherSuite -> - cipherSuiteRegex.matchEntire(cipherSuite)?.destructured - }?.let { (keyExchangeMechanism, cipherSuite) -> - Pair(keyExchangeMechanism, cipherSuite) - } ?: Pair(null, null) - - - if (cipherSuite != null && keyExchangeMechanism != null && protocol != null) { - // TLSv1.3 has no key exchange mechanism in the ciphersuite - if (keyExchangeMechanism.isEmpty()) { - secureConnectionCiphersuite.text = context?.getString(R.string.label_core_connection_ciphersuite_13, - cipherSuite) - } else { - secureConnectionCiphersuite.text = context?.getString(R.string.label_core_connection_ciphersuite, - cipherSuite, - keyExchangeMechanism) - } - secureConnectionProtocol.text = context?.getString(R.string.label_core_connection_protocol, - protocol) - secureConnectionProtocol.visibility = View.VISIBLE - secureConnectionCiphersuite.visibility = View.VISIBLE - } else { - secureConnectionProtocol.visibility = View.GONE - secureConnectionCiphersuite.visibility = View.GONE - } - }) - - clients.layoutManager = LinearLayoutManager(requireContext()) - val adapter = ClientAdapter() - adapter.setDisconnectListener { - val sessionOptional = modelHelper.connectedSession.value - val session = sessionOptional?.orNull() - val rpcHandler = session?.rpcHandler - rpcHandler?.requestKickClient(it) - } - clients.adapter = adapter - modelHelper.coreInfoClients.toLiveData().observe(viewLifecycleOwner, Observer { - clientsTitle.visibleIf(it?.isNotEmpty() == true) - adapter.submitList(it) - }) - - return view - } -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/ui/info/core/CoreInfoFragmentProvider.kt b/app/src/main/java/de/kuschku/quasseldroid/ui/info/core/CoreInfoFragmentProvider.kt deleted file mode 100644 index 441573d0264b31184a614918edaf7c8707e5c296..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/ui/info/core/CoreInfoFragmentProvider.kt +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.ui.info.core - -import androidx.fragment.app.FragmentActivity -import dagger.Binds -import dagger.Module -import dagger.android.ContributesAndroidInjector - -@Module -abstract class CoreInfoFragmentProvider { - @Binds - abstract fun bindFragmentActivity(activity: CoreInfoActivity): FragmentActivity - - @ContributesAndroidInjector - abstract fun bindCoreInfoFragment(): CoreInfoFragment -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/ui/info/user/ChannelAdapter.kt b/app/src/main/java/de/kuschku/quasseldroid/ui/info/user/ChannelAdapter.kt deleted file mode 100644 index 365450c1d74bb594f3636c4d11c05b6069af46e0..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/ui/info/user/ChannelAdapter.kt +++ /dev/null @@ -1,86 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.ui.info.user - -import android.view.LayoutInflater -import android.view.ViewGroup -import androidx.recyclerview.widget.DiffUtil -import androidx.recyclerview.widget.RecyclerView -import de.kuschku.libquassel.protocol.NetworkId -import de.kuschku.libquassel.quassel.BufferInfo -import de.kuschku.quasseldroid.databinding.WidgetBufferBinding -import de.kuschku.quasseldroid.ui.chat.ChatActivity -import de.kuschku.quasseldroid.util.helper.visibleIf -import de.kuschku.quasseldroid.util.lists.ListAdapter -import de.kuschku.quasseldroid.viewmodel.data.BufferProps - -class ChannelAdapter : ListAdapter<BufferProps, ChannelAdapter.ChannelViewHolder>( - object : DiffUtil.ItemCallback<BufferProps>() { - override fun areItemsTheSame(oldItem: BufferProps, newItem: BufferProps) = - oldItem.info.bufferId == newItem.info.bufferId - - override fun areContentsTheSame(oldItem: BufferProps, newItem: BufferProps) = - oldItem == newItem - } -) { - private var clickListener: ((NetworkId, String) -> Unit)? = null - fun setOnClickListener(listener: ((NetworkId, String) -> Unit)?) { - this.clickListener = listener - } - - override fun onCreateViewHolder(parent: ViewGroup, viewType: Int) = ChannelViewHolder( - WidgetBufferBinding.inflate(LayoutInflater.from(parent.context), parent, false), - clickListener = clickListener - ) - - override fun onBindViewHolder(holder: ChannelViewHolder, position: Int) = - holder.bind(getItem(position)) - - class ChannelViewHolder( - private val binding: WidgetBufferBinding, - private val clickListener: ((NetworkId, String) -> Unit)? = null - ) : RecyclerView.ViewHolder(binding.root) { - var info: BufferInfo? = null - - init { - itemView.setOnClickListener { - info?.let { - ChatActivity.launch( - itemView.context, - networkId = it.networkId, - channel = it.bufferName - ) - } - } - } - - fun bind(props: BufferProps) { - info = props.info - - binding.name.text = props.info.bufferName - binding.description.text = props.description - - binding.description.visibleIf(props.description.isNotBlank()) - - binding.status.setImageDrawable(props.fallbackDrawable) - } - } -} - diff --git a/app/src/main/java/de/kuschku/quasseldroid/ui/info/user/IrcUserInfo.kt b/app/src/main/java/de/kuschku/quasseldroid/ui/info/user/IrcUserInfo.kt deleted file mode 100644 index 11c089b78837c2c3ad04f1de4c1193f9dcf7c3d8..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/ui/info/user/IrcUserInfo.kt +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.ui.info.user - -import de.kuschku.libquassel.protocol.NetworkId -import de.kuschku.libquassel.quassel.BufferInfo -import de.kuschku.libquassel.quassel.syncables.IgnoreListManager -import de.kuschku.libquassel.quassel.syncables.IrcUser -import de.kuschku.libquassel.quassel.syncables.Network -import de.kuschku.quasseldroid.viewmodel.data.BufferProps - -data class IrcUserInfo( - val networkId: NetworkId, - val nick: String, - val user: String? = null, - val host: String? = null, - val account: String? = null, - val server: String? = null, - val realName: String? = null, - val isAway: Boolean? = false, - val awayMessage: String? = null, - val network: Network? = null, - val knownToCore: Boolean = false, - val info: BufferInfo? = null, - val ircUser: IrcUser? = null, - val channels: List<BufferProps> = emptyList(), - val ignoreListItems: List<IgnoreListManager.IgnoreListItem> = emptyList() -) diff --git a/app/src/main/java/de/kuschku/quasseldroid/ui/info/user/UserInfoActivity.kt b/app/src/main/java/de/kuschku/quasseldroid/ui/info/user/UserInfoActivity.kt deleted file mode 100644 index 16b0ac145674716da9e6f098f7cad2b49e086b56..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/ui/info/user/UserInfoActivity.kt +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.ui.info.user - -import android.content.Context -import android.content.Intent -import de.kuschku.libquassel.protocol.BufferId -import de.kuschku.libquassel.protocol.NetworkId -import de.kuschku.quasseldroid.util.ui.settings.ServiceBoundSettingsActivity - -class UserInfoActivity : ServiceBoundSettingsActivity(UserInfoFragment()) { - companion object { - fun launch( - context: Context, - openBuffer: Boolean, - bufferId: BufferId? = null, - nick: String? = null, - networkId: NetworkId? = null - ) = context.startActivity(intent(context, openBuffer, bufferId, nick, networkId)) - - fun intent( - context: Context, - openBuffer: Boolean, - bufferId: BufferId? = null, - nick: String? = null, - networkId: NetworkId? = null - ) = Intent(context, UserInfoActivity::class.java).apply { - putExtra("openBuffer", openBuffer) - if (bufferId != null) { - putExtra("bufferId", bufferId.id) - } - if (nick != null) { - putExtra("nick", nick) - } - if (networkId != null) { - putExtra("networkId", networkId.id) - } - } - } -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/ui/info/user/UserInfoFragment.kt b/app/src/main/java/de/kuschku/quasseldroid/ui/info/user/UserInfoFragment.kt deleted file mode 100644 index 766524dd5e936760147a86f97f4032fd0602593f..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/ui/info/user/UserInfoFragment.kt +++ /dev/null @@ -1,535 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.ui.info.user - -import android.content.Intent -import android.net.Uri -import android.os.Build -import android.os.Bundle -import android.text.SpannableString -import android.view.LayoutInflater -import android.view.View -import android.view.ViewGroup -import android.widget.Button -import android.widget.ImageView -import android.widget.TextView -import androidx.appcompat.widget.PopupMenu -import androidx.lifecycle.Observer -import androidx.recyclerview.widget.DefaultItemAnimator -import androidx.recyclerview.widget.LinearLayoutManager -import androidx.recyclerview.widget.RecyclerView -import butterknife.BindView -import butterknife.ButterKnife -import de.kuschku.libquassel.protocol.BufferId -import de.kuschku.libquassel.protocol.Buffer_Type -import de.kuschku.libquassel.protocol.Message_Type -import de.kuschku.libquassel.protocol.NetworkId -import de.kuschku.libquassel.quassel.BufferInfo -import de.kuschku.libquassel.quassel.syncables.BufferSyncer -import de.kuschku.libquassel.quassel.syncables.IgnoreListManager -import de.kuschku.libquassel.quassel.syncables.IrcChannel -import de.kuschku.libquassel.quassel.syncables.IrcUser -import de.kuschku.libquassel.util.Optional -import de.kuschku.libquassel.util.helper.* -import de.kuschku.libquassel.util.irc.HostmaskHelper -import de.kuschku.libquassel.util.irc.IrcCaseMappers -import de.kuschku.quasseldroid.R -import de.kuschku.quasseldroid.settings.MessageSettings -import de.kuschku.quasseldroid.ui.chat.ChatActivity -import de.kuschku.quasseldroid.ui.coresettings.ignorelist.IgnoreListActivity -import de.kuschku.quasseldroid.util.ColorContext -import de.kuschku.quasseldroid.util.ShortcutCreationHelper -import de.kuschku.quasseldroid.util.avatars.AvatarHelper -import de.kuschku.quasseldroid.util.avatars.MatrixApi -import de.kuschku.quasseldroid.util.avatars.MatrixAvatarInfo -import de.kuschku.quasseldroid.util.helper.* -import de.kuschku.quasseldroid.util.irc.format.ContentFormatter -import de.kuschku.quasseldroid.util.irc.format.IrcFormatDeserializer -import de.kuschku.quasseldroid.util.irc.format.spans.IrcItalicSpan -import de.kuschku.quasseldroid.util.service.ServiceBoundFragment -import de.kuschku.quasseldroid.util.ui.BetterLinkMovementMethod -import de.kuschku.quasseldroid.util.ui.LinkLongClickMenuHelper -import de.kuschku.quasseldroid.viewmodel.data.Avatar -import de.kuschku.quasseldroid.viewmodel.data.BufferProps -import de.kuschku.quasseldroid.viewmodel.data.BufferStatus -import de.kuschku.quasseldroid.viewmodel.helper.EditorViewModelHelper -import io.reactivex.Observable -import javax.inject.Inject - -class UserInfoFragment : ServiceBoundFragment() { - @BindView(R.id.avatar) - lateinit var avatar: ImageView - - @BindView(R.id.nick) - lateinit var nick: TextView - - @BindView(R.id.real_name) - lateinit var realName: TextView - - @BindView(R.id.action_query) - lateinit var actionQuery: Button - - @BindView(R.id.action_ignore) - lateinit var actionIgnore: Button - - @BindView(R.id.action_whois) - lateinit var actionWhois: Button - - @BindView(R.id.action_mention) - lateinit var actionMention: Button - - @BindView(R.id.action_shortcut) - lateinit var actionShortcut: Button - - @BindView(R.id.away_container) - lateinit var awayContainer: ViewGroup - - @BindView(R.id.away_message) - lateinit var awayMessage: TextView - - @BindView(R.id.account_container) - lateinit var accountContainer: ViewGroup - - @BindView(R.id.account) - lateinit var account: TextView - - @BindView(R.id.ident_container) - lateinit var identContainer: ViewGroup - - @BindView(R.id.ident) - lateinit var ident: TextView - - @BindView(R.id.host_container) - lateinit var hostContainer: ViewGroup - - @BindView(R.id.host) - lateinit var host: TextView - - @BindView(R.id.server_container) - lateinit var serverContainer: ViewGroup - - @BindView(R.id.server) - lateinit var server: TextView - - @BindView(R.id.common_channels) - lateinit var commonChannels: RecyclerView - - @Inject - lateinit var contentFormatter: ContentFormatter - - @Inject - lateinit var ircFormatDeserializer: IrcFormatDeserializer - - @Inject - lateinit var messageSettings: MessageSettings - - @Inject - lateinit var matrixApi: MatrixApi - - @Inject - lateinit var modelHelper: EditorViewModelHelper - - private var actualUrl: String? = null - - override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, - savedInstanceState: Bundle?): View? { - val view = inflater.inflate(R.layout.info_user, container, false) - ButterKnife.bind(this, view) - - val openBuffer = arguments?.getBoolean("openBuffer") - - val bufferId = BufferId(arguments?.getInt("bufferId") ?: -1) - val networkId = NetworkId(arguments?.getInt("networkId") ?: -1) - val nickName = arguments?.getString("nick") - - var currentBufferInfo: BufferInfo? = null - var currentIrcUser: IrcUser? - - fun updateShortcutVisibility() { - actionShortcut.visibleIf(currentBufferInfo != null) - } - - val commonChannelsAdapter = ChannelAdapter() - commonChannels.layoutManager = LinearLayoutManager(context) - commonChannels.itemAnimator = DefaultItemAnimator() - commonChannels.adapter = commonChannelsAdapter - - val colorContext = ColorContext(requireContext(), messageSettings) - - val colorAccent = requireContext().theme.styledAttributes(R.attr.colorAccent) { - getColor(0, 0) - } - - val colorAway = requireContext().theme.styledAttributes(R.attr.colorAway) { - getColor(0, 0) - } - - combineLatest(modelHelper.connectedSession, - modelHelper.networks).safeSwitchMap { (sessionOptional, networks) -> - fun processUser(user: IrcUser, bufferSyncer: BufferSyncer? = null, info: BufferInfo? = null, - ignoreItems: List<IgnoreListManager.IgnoreListItem>? = null): Observable<Optional<IrcUserInfo>> { - actionShortcut.post(::updateShortcutVisibility) - return when { - user == IrcUser.NULL && info != null -> Observable.just(Optional.of(IrcUserInfo( - networkId = info.networkId, - nick = info.bufferName ?: "", - knownToCore = true, - info = info - ))) - user == IrcUser.NULL -> Observable.just(Optional.empty()) - else -> { - fun buildUserInfo(channels: List<BufferProps>) = IrcUserInfo( - networkId = user.network().networkId(), - nick = user.nick(), - user = user.user(), - host = user.host(), - account = user.account(), - server = user.server(), - realName = user.realName(), - isAway = user.isAway(), - awayMessage = user.awayMessage(), - network = user.network(), - knownToCore = true, - info = info, - ircUser = user, - channels = channels.sortedBy { - IrcCaseMappers.unicode.toLowerCaseNullable(it.info.bufferName) - }, - ignoreListItems = ignoreItems.orEmpty() - ) - - if (user.channels().isEmpty()) { - Observable.just(Optional.of( - buildUserInfo(emptyList()) - )) - } else { - combineLatest(user.channels().map { channelName -> - user.network().liveIrcChannel( - channelName - ).safeSwitchMap { channel -> - channel.updates().map { - Optional.ofNullable( - bufferSyncer?.find( - bufferName = channelName, - networkId = user.network().networkId() - )?.let { info -> - val bufferStatus = - if (it == IrcChannel.NULL) BufferStatus.OFFLINE - else BufferStatus.ONLINE - val color = - if (bufferStatus == BufferStatus.ONLINE) colorAccent - else colorAway - val fallbackDrawable = colorContext.buildTextDrawable("#", color) - - BufferProps( - info = info, - network = user.network().networkInfo(), - description = it.topic(), - activity = Message_Type.of(), - bufferStatus = bufferStatus, - networkConnectionState = user.network().connectionState(), - fallbackDrawable = fallbackDrawable - ) - } - ) - } - } - }).map { - it.mapNotNull(Optional<BufferProps>::orNull) - }.map { - Optional.of(buildUserInfo(it)) - } - } - } - } - } - - val session = sessionOptional?.orNull() - if (openBuffer == true) { - val bufferSyncer = session?.bufferSyncer - val bufferInfo = bufferSyncer?.bufferInfo(bufferId) - bufferInfo?.let { - networks[it.networkId]?.liveIrcUser(it.bufferName)?.safeSwitchMap(IrcUser::updates)?.safeSwitchMap { - processUser(it, bufferSyncer, bufferInfo) - } - } - } else { - val ignoreListManager = session?.ignoreListManager - - networks[networkId] - ?.liveIrcUser(nickName) - ?.safeSwitchMap(IrcUser::updates) - ?.safeSwitchMap { user -> - ignoreListManager?.liveMatchingRules(user.hostMask())?.map { - Pair(user, it) - } ?: Observable.just(Pair(user, emptyList())) - }?.safeSwitchMap { (user, ignoreItems) -> - processUser(user, - sessionOptional?.orNull()?.bufferSyncer, - ignoreItems = ignoreItems) - } - } ?: Observable.just(IrcUser.NULL).safeSwitchMap { user -> processUser(user, null, null) } - }.toLiveData().observe(viewLifecycleOwner, Observer { - val user = it.orNull() - if (user != null) { - currentBufferInfo = user.info - currentIrcUser = user.ircUser - actionShortcut.visibleIf(currentBufferInfo != null && Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) - - avatar.post { - avatar.visibility = View.GONE - actualUrl = null - avatar.loadAvatars( - AvatarHelper.avatar(messageSettings, user, maxOf(avatar.width, avatar.height)), - crop = false - ) { model -> - avatar.visibility = View.VISIBLE - when (model) { - is String -> { - actualUrl = model - } - is Avatar.MatrixAvatar -> { - runInBackground { - matrixApi.avatarUrl(model.userId).execute().body()?.let { - it.avatarUrl?.let { - val avatarInfo = MatrixAvatarInfo(it, model.size) - val url = Uri.parse(avatarInfo.avatarUrl) - - val imageUrl = matrixApi.avatarImage(server = url.host ?: "", - id = url.pathSegments.first()).request().url() - actualUrl = imageUrl.toString() - } - } - } - } - } - } - } - nick.text = ircFormatDeserializer.formatString(user.nick, messageSettings.colorizeMirc) - val (content, _) = contentFormatter.formatContent( - user.realName ?: "", - networkId = user.networkId - ) - realName.text = content - realName.visibleIf(!user.realName.isNullOrBlank() && user.realName != user.nick) - - awayMessage.text = user.awayMessage.nullIf { it.isNullOrBlank() } ?: SpannableString( - getString( - R.string.label_no_away_message)).apply { - setSpan(IrcItalicSpan(), 0, length, 0) - } - awayContainer.visibleIf(user.isAway == true) - - account.text = user.account - accountContainer.visibleIf(!user.account.isNullOrBlank()) - - val (userIdent, _) = contentFormatter.formatContent( - user.user ?: "", - networkId = user.networkId - ) - ident.text = userIdent - identContainer.visibleIf(userIdent.isNotBlank()) - - val (userHost, _) = contentFormatter.formatContent( - user.host ?: "", - networkId = user.networkId - ) - host.text = userHost - hostContainer.visibleIf(userHost.isNotBlank()) - - server.text = user.server - serverContainer.visibleIf(!user.server.isNullOrBlank()) - - actionWhois.visibleIf(user.knownToCore) - - actionQuery.setOnClickListener { view -> - modelHelper.connectedSession.value?.orNull()?.let { session -> - val info = session.bufferSyncer.find( - bufferName = user.nick, - networkId = user.networkId, - type = Buffer_Type.of(Buffer_Type.QueryBuffer) - ) - - if (info != null) { - ChatActivity.launch(view.context, bufferId = info.bufferId) - } else { - modelHelper.allBuffers.map { - listOfNotNull(it.find { - it.networkId == user.networkId && it.bufferName == user.nick - }) - }.filter { - it.isNotEmpty() - }.firstElement().toLiveData().observe(viewLifecycleOwner, Observer { - it?.firstOrNull()?.let { info -> - ChatActivity.launch(view.context, bufferId = info.bufferId) - } - }) - - session.bufferSyncer.find( - networkId = user.networkId, - type = Buffer_Type.of(Buffer_Type.StatusBuffer) - )?.let { statusInfo -> - session.rpcHandler.sendInput(statusInfo, "/query ${user.nick}") - } - } - } - } - - var ignoreMenu: PopupMenu? = null - actionIgnore.setOnClickListener { view -> - PopupMenu(actionIgnore.context, actionIgnore).also { menu -> - ignoreMenu?.dismiss() - menu.menuInflater.inflate(R.menu.context_ignore, menu.menu) - for (ignoreItem in user.ignoreListItems) { - menu.menu.add(ignoreItem.ignoreRule).apply { - isCheckable = true - isChecked = ignoreItem.isActive - } - } - menu.setOnMenuItemClickListener { - when { - it.itemId == R.id.action_create -> { - IgnoreListActivity.launch( - view.context, - addRule = HostmaskHelper.build(user.nick, user.user, user.host) - ) - menu.dismiss() - ignoreMenu = null - true - } - it.itemId == R.id.action_show -> { - IgnoreListActivity.launch( - view.context - ) - menu.dismiss() - ignoreMenu = null - true - } - it.isCheckable -> { - modelHelper.ignoreListManager.value?.orNull()?.requestToggleIgnoreRule(it.title.toString()) - true - } - else -> false - } - } - menu.setOnDismissListener { - ignoreMenu = null - } - menu.show() - } - } - - actionMention.setOnClickListener { view -> - ChatActivity.launch(view.context, sharedText = "${user.nick}: ") - } - - actionWhois.setOnClickListener { view -> - modelHelper.connectedSession { - it.orNull()?.let { session -> - session.bufferSyncer.find( - networkId = user.networkId, - type = Buffer_Type.of(Buffer_Type.StatusBuffer) - )?.let { statusInfo -> - session.rpcHandler.sendInput(statusInfo, "/whois ${user.nick} ${user.nick}") - } - } - } - } - - actionShortcut.setOnClickListener { - this.context?.let { context -> - currentBufferInfo?.let { info -> - ShortcutCreationHelper.create( - context = context, - messageSettings = messageSettings, - accountId = accountId, - info = info, - ircUser = currentIrcUser - ) - } - } - } - - commonChannelsAdapter.submitList(user.channels) - } - }) - - avatar.setOnClickListener { - actualUrl?.let { - context?.startActivity(Intent(Intent.ACTION_VIEW).apply { - data = Uri.parse(it) - }) - } - } - - actionMention.visibleIf(arguments?.getBoolean("openBuffer") == false) - - val movementMethod = BetterLinkMovementMethod.newInstance() - movementMethod.setOnLinkLongClickListener(LinkLongClickMenuHelper()) - realName.movementMethod = movementMethod - - actionQuery.setTooltip() - actionQuery.setCompoundDrawablesWithIntrinsicBounds( - null, - requireContext().getVectorDrawableCompat(R.drawable.ic_message_bulleted), - null, - null - ) - actionQuery.retint() - - actionIgnore.setTooltip() - actionIgnore.setCompoundDrawablesWithIntrinsicBounds( - null, - requireContext().getVectorDrawableCompat(R.drawable.ic_eye_off), - null, - null - ) - actionIgnore.retint() - - actionWhois.setTooltip() - actionWhois.setCompoundDrawablesWithIntrinsicBounds( - null, - requireContext().getVectorDrawableCompat(R.drawable.ic_info), - null, - null - ) - actionWhois.retint() - - actionMention.setTooltip() - actionMention.setCompoundDrawablesWithIntrinsicBounds( - null, - requireContext().getVectorDrawableCompat(R.drawable.ic_share_alternative), - null, - null - ) - actionMention.retint() - - actionShortcut.setTooltip() - actionShortcut.setCompoundDrawablesWithIntrinsicBounds( - null, - requireContext().getVectorDrawableCompat(R.drawable.ic_link), - null, - null - ) - actionShortcut.retint() - - return view - } -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/ui/info/user/UserInfoFragmentProvider.kt b/app/src/main/java/de/kuschku/quasseldroid/ui/info/user/UserInfoFragmentProvider.kt deleted file mode 100644 index 73b41ea10f220ec1b38462651ba4de5dbe4365a8..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/ui/info/user/UserInfoFragmentProvider.kt +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.ui.info.user - -import androidx.fragment.app.FragmentActivity -import dagger.Binds -import dagger.Module -import dagger.android.ContributesAndroidInjector - -@Module -abstract class UserInfoFragmentProvider { - @Binds - abstract fun bindFragmentActivity(activity: UserInfoActivity): FragmentActivity - - @ContributesAndroidInjector - abstract fun bindUserInfoFragment(): UserInfoFragment -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/ui/setup/ServiceBoundSetupActivity.kt b/app/src/main/java/de/kuschku/quasseldroid/ui/setup/ServiceBoundSetupActivity.kt deleted file mode 100644 index 3bf5d1679a69aef81ec916e958ff966e9bfa2a87..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/ui/setup/ServiceBoundSetupActivity.kt +++ /dev/null @@ -1,308 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.ui.setup - -import android.content.Context -import android.content.SharedPreferences -import android.content.pm.PackageManager -import android.os.Build -import android.os.Bundle -import androidx.annotation.ColorRes -import androidx.annotation.DrawableRes -import androidx.appcompat.widget.ActionMenuView -import androidx.lifecycle.MutableLiveData -import androidx.lifecycle.Observer -import androidx.viewpager.widget.ViewPager -import butterknife.BindView -import butterknife.ButterKnife -import com.google.android.material.floatingactionbutton.FloatingActionButton -import dagger.android.support.DaggerAppCompatActivity -import de.kuschku.libquassel.util.Optional -import de.kuschku.libquassel.util.helper.nullIf -import de.kuschku.libquassel.util.helper.safeValue -import de.kuschku.quasseldroid.Backend -import de.kuschku.quasseldroid.Keys -import de.kuschku.quasseldroid.R -import de.kuschku.quasseldroid.settings.AppearanceSettings -import de.kuschku.quasseldroid.settings.Settings -import de.kuschku.quasseldroid.ui.clientsettings.about.AboutActivity -import de.kuschku.quasseldroid.ui.clientsettings.client.ClientSettingsActivity -import de.kuschku.quasseldroid.ui.clientsettings.crash.CrashActivity -import de.kuschku.quasseldroid.ui.clientsettings.whitelist.WhitelistActivity -import de.kuschku.quasseldroid.util.helper.* -import de.kuschku.quasseldroid.util.service.BackendServiceConnection -import de.kuschku.quasseldroid.util.ui.LocaleHelper -import de.kuschku.quasseldroid.viewmodel.QuasselViewModel -import io.reactivex.subjects.BehaviorSubject -import javax.inject.Inject - -abstract class ServiceBoundSetupActivity : - DaggerAppCompatActivity(), SharedPreferences.OnSharedPreferenceChangeListener { - @BindView(R.id.menu_view) - lateinit var menuView: ActionMenuView - - @BindView(R.id.view_pager) - lateinit var viewPager: ViewPager - - @BindView(R.id.next_button) - lateinit var button: FloatingActionButton - - private lateinit var adapter: SlidePagerAdapter - - protected abstract val fragments: List<SlideFragment> - - private val currentPage = MutableLiveData<SlideFragment?>() - private val isValid = currentPage.safeSwitchMap(SlideFragment::valid).or(false) - - @DrawableRes - protected val icon: Int = R.mipmap.ic_launcher_recents - @ColorRes - protected val recentsHeaderColor: Int = R.color.colorPrimary - - private val connection = BackendServiceConnection() - protected val backend: BehaviorSubject<Optional<Backend>> - get() = connection.backend - - protected open val initData: Bundle = Bundle() - - protected fun runInBackground(f: () -> Unit) { - connection.backend.safeValue.ifPresent { - it.sessionManager()?.handlerService?.backend(f) - } - } - - protected fun runInBackgroundDelayed(delayMillis: Long, f: () -> Unit) { - connection.backend.safeValue.ifPresent { - it.sessionManager()?.handlerService?.backendDelayed(delayMillis, f) - } - } - - @Inject - lateinit var appearanceSettings: AppearanceSettings - - @Inject - lateinit var viewModel: QuasselViewModel - - protected var accountId: Long = -1 - - class SetupActivityViewPagerPageChangeListener(private val activity: ServiceBoundSetupActivity) : - ViewPager.OnPageChangeListener { - override fun onPageScrollStateChanged(state: Int) { - when (state) { - ViewPager.SCROLL_STATE_SETTLING -> activity.pageChanged() - } - } - - override fun onPageScrolled(position: Int, positionOffset: Float, - positionOffsetPixels: Int) = Unit - - override fun onPageSelected(position: Int) = Unit - } - - private lateinit var pageChangeListener: SetupActivityViewPagerPageChangeListener - - private fun pageChanged() { - val page = adapter.getItem(viewPager.currentItem) - currentPage.value = page - - val finish = viewPager.currentItem == adapter.totalCount - 1 - button.contentDescription = - if (finish) descriptionFinish - else descriptionNext - button.setTooltip() - button.setImageState( - if (finish) intArrayOf(android.R.attr.state_checked) - else intArrayOf(-android.R.attr.state_checked), - true - ) - - page.requestFocus() - } - - fun updateRecentsHeader() { - if (Build.VERSION.SDK_INT < Build.VERSION_CODES.P) { - updateRecentsHeaderIfExisting(title.toString(), icon, recentsHeaderColor) - } - } - - override fun setTitle(title: CharSequence?) { - super.setTitle(title) - updateRecentsHeader() - } - - private var descriptionFinish: String? = null - private var descriptionNext: String? = null - - override fun onCreate(savedInstanceState: Bundle?) { - setTheme(R.style.Theme_SetupTheme) - super.onCreate(savedInstanceState) - viewModel.backendWrapper.onNext(this.backend) - packageManager.getActivityInfo(componentName, PackageManager.GET_META_DATA).labelRes - .nullIf { it == 0 }?.let(this::setTitle) - setContentView(R.layout.activity_setup) - ButterKnife.bind(this) - - descriptionFinish = getString(R.string.label_finish) - descriptionNext = getString(R.string.label_next) - - menuView.popupTheme = R.style.Widget_PopupOverlay_Light - menuInflater.inflate(R.menu.activity_setup, menuView.menu) - menuView.setOnMenuItemClickListener { - when (it.itemId) { - R.id.action_client_settings -> { - ClientSettingsActivity.launch(this) - true - } - R.id.action_certificates -> { - WhitelistActivity.launch(this) - true - } - R.id.action_crashes -> { - CrashActivity.launch(this) - true - } - R.id.action_about -> { - AboutActivity.launch(this) - true - } - else -> false - } - } - - adapter = SlidePagerAdapter(supportFragmentManager) - fragments.forEach(adapter::addFragment) - viewPager.adapter = adapter - - pageChangeListener = SetupActivityViewPagerPageChangeListener(this) - - button.setOnClickListener { - if (viewPager.currentItem == adapter.totalCount - 1) - onDoneInternal() - else - viewPager.setCurrentItem(viewPager.currentItem + 1, true) - } - isValid.observeSticky( - this, Observer { - if (it == true) { - button.show() - adapter.lastValidItem = viewPager.currentItem - } else { - button.hide() - adapter.lastValidItem = viewPager.currentItem - 1 - } - }) - viewPager.addOnPageChangeListener(pageChangeListener) - pageChanged() - updateRecentsHeader() - adapter.result.putAll(initData) - - connection.context = this - lifecycle.addObserver(connection) - checkConnection() - } - - override fun attachBaseContext(newBase: Context) { - super.attachBaseContext(LocaleHelper.setLocale(newBase)) - } - - private fun onDoneInternal() { - onDone(adapter.result) - } - - abstract fun onDone(data: Bundle) - - override fun onSaveInstanceState(outState: Bundle) { - outState.putInt(currentItemKey, viewPager.currentItem) - outState.putInt(lastValidItemKey, adapter.lastValidItem) - outState.putBundle(resultKey, adapter.result) - super.onSaveInstanceState(outState) - } - - override fun onRestoreInstanceState(savedInstanceState: Bundle?) { - super.onRestoreInstanceState(savedInstanceState) - if (savedInstanceState != null) { - if (savedInstanceState.containsKey(resultKey)) { - adapter.result.putAll(savedInstanceState.getBundle(resultKey)) - adapter.allChanged() - } - if (savedInstanceState.containsKey(lastValidItemKey)) - adapter.lastValidItem = savedInstanceState.getInt(lastValidItemKey) - if (savedInstanceState.containsKey(currentItemKey)) - viewPager.currentItem = savedInstanceState.getInt(currentItemKey) - currentPage.value = adapter.getItem(viewPager.currentItem) - } - pageChanged() - } - - override fun onStart() { - if (Settings.appearance(this) != appearanceSettings) { - recreate() - } - sharedPreferences(Keys.Status.NAME, Context.MODE_PRIVATE) { - registerOnSharedPreferenceChangeListener(this@ServiceBoundSetupActivity) - } - checkConnection() - super.onStart() - } - - override fun onStop() { - super.onStop() - sharedPreferences(Keys.Status.NAME, Context.MODE_PRIVATE) { - unregisterOnSharedPreferenceChangeListener(this@ServiceBoundSetupActivity) - } - } - - override fun onDestroy() { - lifecycle.removeObserver(connection) - super.onDestroy() - } - - override fun onSharedPreferenceChanged(sharedPreferences: SharedPreferences?, key: String?) = - checkConnection() - - private fun checkConnection() { - accountId = getSharedPreferences(Keys.Status.NAME, Context.MODE_PRIVATE) - ?.getLong(Keys.Status.selectedAccount, -1) ?: -1 - - val reconnect = sharedPreferences(Keys.Status.NAME, Context.MODE_PRIVATE) { - getBoolean(Keys.Status.reconnect, false) - } - val accountIdValid = accountId != -1L - if (!reconnect || !accountIdValid) { - finish() - } else { - connection.start() - connection.bind() - } - } - - override fun onBackPressed() { - if (viewPager.currentItem == 0) - super.onBackPressed() - else - viewPager.currentItem -= 1 - } - - companion object { - private const val currentItemKey = ":setupActivity:currentItem" - private const val lastValidItemKey = ":setupActivity:lastValidItem" - private const val resultKey = ":setupActivity:result" - } -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/ui/setup/ServiceBoundSlideFragment.kt b/app/src/main/java/de/kuschku/quasseldroid/ui/setup/ServiceBoundSlideFragment.kt deleted file mode 100644 index d6c14bb2693887f4b5a8d4af0fd2a6e7f192ef75..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/ui/setup/ServiceBoundSlideFragment.kt +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.ui.setup - -import android.content.Context -import android.os.Bundle -import de.kuschku.libquassel.util.Optional -import de.kuschku.libquassel.util.helper.safeValue -import de.kuschku.quasseldroid.Backend -import de.kuschku.quasseldroid.Keys -import de.kuschku.quasseldroid.util.service.BackendServiceConnection -import io.reactivex.subjects.BehaviorSubject - -abstract class ServiceBoundSlideFragment : SlideFragment() { - private val connection = BackendServiceConnection() - protected val backend: BehaviorSubject<Optional<Backend>> - get() = connection.backend - - protected fun runInBackground(f: () -> Unit) { - connection.backend.safeValue.ifPresent { - it.sessionManager()?.handlerService?.backend(f) - } - } - - protected fun runInBackgroundDelayed(delayMillis: Long, f: () -> Unit) { - connection.backend.safeValue.ifPresent { - it.sessionManager()?.handlerService?.backendDelayed(delayMillis, f) - } - } - - protected var accountId: Long = -1 - - override fun onCreate(savedInstanceState: Bundle?) { - accountId = context?.getSharedPreferences(Keys.Status.NAME, Context.MODE_PRIVATE) - ?.getLong(Keys.Status.selectedAccount, -1) ?: -1 - - connection.context = context - lifecycle.addObserver(connection) - super.onCreate(savedInstanceState) - } - - override fun onStart() { - super.onStart() - accountId = context?.getSharedPreferences(Keys.Status.NAME, Context.MODE_PRIVATE) - ?.getLong(Keys.Status.selectedAccount, -1) ?: -1 - } - - override fun onDestroy() { - lifecycle.removeObserver(connection) - super.onDestroy() - } -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/ui/setup/SetupActivity.kt b/app/src/main/java/de/kuschku/quasseldroid/ui/setup/SetupActivity.kt deleted file mode 100644 index 2b42076952ddad44175a4b976476579b6692acf1..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/ui/setup/SetupActivity.kt +++ /dev/null @@ -1,227 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.ui.setup - -import android.content.Context -import android.content.pm.PackageManager -import android.os.Build -import android.os.Bundle -import androidx.annotation.ColorRes -import androidx.annotation.DrawableRes -import androidx.appcompat.widget.ActionMenuView -import androidx.lifecycle.MutableLiveData -import androidx.lifecycle.Observer -import androidx.viewpager.widget.ViewPager -import butterknife.BindView -import butterknife.ButterKnife -import com.google.android.material.floatingactionbutton.FloatingActionButton -import dagger.android.support.DaggerAppCompatActivity -import de.kuschku.libquassel.util.helper.nullIf -import de.kuschku.quasseldroid.R -import de.kuschku.quasseldroid.ui.clientsettings.about.AboutActivity -import de.kuschku.quasseldroid.ui.clientsettings.client.ClientSettingsActivity -import de.kuschku.quasseldroid.ui.clientsettings.crash.CrashActivity -import de.kuschku.quasseldroid.ui.clientsettings.whitelist.WhitelistActivity -import de.kuschku.quasseldroid.util.helper.* -import de.kuschku.quasseldroid.util.ui.LocaleHelper - -abstract class SetupActivity : DaggerAppCompatActivity() { - @BindView(R.id.menu_view) - lateinit var menuView: ActionMenuView - - @BindView(R.id.view_pager) - lateinit var viewPager: ViewPager - - @BindView(R.id.next_button) - lateinit var button: FloatingActionButton - - private lateinit var adapter: SlidePagerAdapter - - protected abstract val fragments: List<SlideFragment> - - private val currentPage = MutableLiveData<SlideFragment?>() - private val isValid = currentPage.safeSwitchMap(SlideFragment::valid).or(false) - - @DrawableRes - protected val icon: Int = R.mipmap.ic_launcher_recents - @ColorRes - protected val recentsHeaderColor: Int = R.color.colorPrimary - - class SetupActivityViewPagerPageChangeListener(private val activity: SetupActivity) : - ViewPager.OnPageChangeListener { - override fun onPageScrollStateChanged(state: Int) { - when (state) { - ViewPager.SCROLL_STATE_SETTLING -> activity.pageChanged() - } - } - - override fun onPageScrolled(position: Int, positionOffset: Float, - positionOffsetPixels: Int) = Unit - - override fun onPageSelected(position: Int) = Unit - } - - private lateinit var pageChangeListener: SetupActivityViewPagerPageChangeListener - - private fun pageChanged() { - val page = adapter.getItem(viewPager.currentItem) - currentPage.value = page - - val finish = viewPager.currentItem == adapter.totalCount - 1 - button.contentDescription = - if (finish) descriptionFinish - else descriptionNext - button.setTooltip() - button.setImageState( - if (finish) intArrayOf(android.R.attr.state_checked) - else intArrayOf(-android.R.attr.state_checked), - true - ) - - page.requestFocus() - } - - fun updateRecentsHeader() { - if (Build.VERSION.SDK_INT < Build.VERSION_CODES.P) { - updateRecentsHeaderIfExisting(title.toString(), icon, recentsHeaderColor) - } - } - - override fun setTitle(title: CharSequence?) { - super.setTitle(title) - updateRecentsHeader() - } - - private var descriptionFinish: String? = null - private var descriptionNext: String? = null - - override fun onCreate(savedInstanceState: Bundle?) { - setTheme(R.style.Theme_SetupTheme) - super.onCreate(savedInstanceState) - packageManager.getActivityInfo(componentName, PackageManager.GET_META_DATA).labelRes - .nullIf { it == 0 }?.let(this::setTitle) - setContentView(R.layout.activity_setup) - ButterKnife.bind(this) - - descriptionFinish = getString(R.string.label_finish) - descriptionNext = getString(R.string.label_next) - - menuView.popupTheme = R.style.Widget_PopupOverlay_Light - menuInflater.inflate(R.menu.activity_setup, menuView.menu) - menuView.setOnMenuItemClickListener { - when (it.itemId) { - R.id.action_client_settings -> { - ClientSettingsActivity.launch(this) - true - } - R.id.action_certificates -> { - WhitelistActivity.launch(this) - true - } - R.id.action_crashes -> { - CrashActivity.launch(this) - true - } - R.id.action_about -> { - AboutActivity.launch(this) - true - } - else -> false - } - } - - adapter = SlidePagerAdapter(supportFragmentManager) - fragments.forEach(adapter::addFragment) - viewPager.adapter = adapter - - pageChangeListener = SetupActivityViewPagerPageChangeListener(this) - - button.setOnClickListener { - if (viewPager.currentItem == adapter.totalCount - 1) - onDoneInternal() - else - viewPager.setCurrentItem(viewPager.currentItem + 1, true) - } - isValid.observeSticky( - this, Observer { - if (it == true) { - button.show() - adapter.lastValidItem = viewPager.currentItem - } else { - button.hide() - adapter.lastValidItem = viewPager.currentItem - 1 - } - }) - viewPager.addOnPageChangeListener(pageChangeListener) - pageChanged() - updateRecentsHeader() - } - - override fun attachBaseContext(newBase: Context) { - super.attachBaseContext(LocaleHelper.setLocale(newBase)) - } - - private fun onDoneInternal() { - onDone(adapter.result) - } - - fun setInitData(data: Bundle?) { - adapter.result.putAll(data) - } - - abstract fun onDone(data: Bundle) - - override fun onSaveInstanceState(outState: Bundle) { - outState.putInt(currentItemKey, viewPager.currentItem) - outState.putInt(lastValidItemKey, adapter.lastValidItem) - outState.putBundle(resultKey, adapter.result) - super.onSaveInstanceState(outState) - } - - override fun onRestoreInstanceState(savedInstanceState: Bundle?) { - super.onRestoreInstanceState(savedInstanceState) - if (savedInstanceState != null) { - if (savedInstanceState.containsKey(resultKey)) { - adapter.result.putAll(savedInstanceState.getBundle(resultKey)) - adapter.allChanged() - } - if (savedInstanceState.containsKey(lastValidItemKey)) - adapter.lastValidItem = savedInstanceState.getInt(lastValidItemKey) - if (savedInstanceState.containsKey(currentItemKey)) - viewPager.currentItem = savedInstanceState.getInt(currentItemKey) - currentPage.value = adapter.getItem(viewPager.currentItem) - } - pageChanged() - } - - override fun onBackPressed() { - if (viewPager.currentItem == 0) - super.onBackPressed() - else - viewPager.currentItem -= 1 - } - - companion object { - private const val currentItemKey = ":setupActivity:currentItem" - private const val lastValidItemKey = ":setupActivity:lastValidItem" - private const val resultKey = ":setupActivity:result" - } -} - diff --git a/app/src/main/java/de/kuschku/quasseldroid/ui/setup/SlideFragment.kt b/app/src/main/java/de/kuschku/quasseldroid/ui/setup/SlideFragment.kt deleted file mode 100644 index 93a2bd3e3993acc0629093eb858bf7a56fdeb3dd..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/ui/setup/SlideFragment.kt +++ /dev/null @@ -1,119 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.ui.setup - -import android.os.Bundle -import android.view.LayoutInflater -import android.view.View -import android.view.ViewGroup -import android.widget.TextView -import androidx.annotation.StringRes -import androidx.lifecycle.LifecycleOwner -import androidx.lifecycle.MutableLiveData -import androidx.lifecycle.Observer -import com.google.android.material.appbar.CollapsingToolbarLayout -import dagger.android.support.DaggerFragment -import de.kuschku.quasseldroid.R - -abstract class SlideFragment : DaggerFragment() { - @get:StringRes - protected abstract val title: Int - @get:StringRes - protected abstract val description: Int - - protected abstract fun isValid(): Boolean - - private var initialized = false - - val valid = object : MutableLiveData<Boolean>() { - override fun observe(owner: LifecycleOwner, observer: Observer<in Boolean>) { - super.observe(owner, observer) - observer.onChanged(value) - } - - override fun observeForever(observer: Observer<in Boolean>) { - super.observeForever(observer) - observer.onChanged(value) - } - } - - protected fun updateValidity() { - valid.value = isValid() - } - - override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, - savedInstanceState: Bundle?): View { - val view = inflater.inflate(R.layout.setup_slide, container, false) - val viewGroup = view.findViewById<View>(R.id.content_host) as ViewGroup - viewGroup.addView(onCreateContent(inflater, viewGroup, savedInstanceState)) - - view.findViewById<TextView>(R.id.title)?.setText(title) - view.findViewById<CollapsingToolbarLayout>(R.id.collapsingToolbar)?.title = - resources.getString(title) - view.findViewById<TextView>(R.id.description).setText(description) - - initialized = true - - initData?.let(this::setData) - savedInstanceState?.let(this::setData) - updateValidity() - - return view - } - - override fun onSaveInstanceState(outState: Bundle) { - super.onSaveInstanceState(outState) - if (initialized) getData(outState) - } - - override fun onViewStateRestored(savedInstanceState: Bundle?) { - super.onViewStateRestored(savedInstanceState) - if (initialized) updateValidity() - } - - protected abstract fun setData(data: Bundle) - protected abstract fun getData(data: Bundle) - - fun save(data: Bundle) { - if (initialized) getData(data) - } - - fun load(data: Bundle) { - if (initialized) setData(data) - } - - var initData: Bundle? = null - - fun requestFocus() { - this.view?.requestFocus() - } - - private var hasChangedListener: ((SlideFragment) -> Unit)? = null - fun setHasChangedListener(listener: ((SlideFragment) -> Unit)?) { - hasChangedListener = listener - } - - protected fun hasChanged() { - hasChangedListener?.invoke(this) - } - - protected abstract fun onCreateContent(inflater: LayoutInflater, container: ViewGroup?, - savedInstanceState: Bundle?): View -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/ui/setup/SlidePagerAdapter.kt b/app/src/main/java/de/kuschku/quasseldroid/ui/setup/SlidePagerAdapter.kt deleted file mode 100644 index 112857f355b3d5fbaa29c60f93abf5b54c176688..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/ui/setup/SlidePagerAdapter.kt +++ /dev/null @@ -1,105 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.ui.setup - -import android.os.Bundle -import android.os.Parcelable -import android.util.SparseArray -import android.view.ViewGroup -import androidx.fragment.app.FragmentManager -import androidx.fragment.app.FragmentStatePagerAdapter - -class SlidePagerAdapter(private val fragmentManager: FragmentManager) : - FragmentStatePagerAdapter(fragmentManager) { - private val retainedFragments = SparseArray<SlideFragment>() - - val result = Bundle() - get() { - (0 until retainedFragments.size()).map(retainedFragments::valueAt).forEach { - it.save(field) - } - return field - } - - var lastValidItem = -1 - set(value) { - field = value - notifyDataSetChanged() - } - private val list = mutableListOf<SlideFragment>() - - override fun getItem(position: Int): SlideFragment { - return retainedFragments.get(position) ?: list[position] - } - - override fun getCount() = minOf(list.size, lastValidItem + 2) - val totalCount get() = list.size - fun addFragment(fragment: SlideFragment) { - list.add(fragment) - } - - override fun instantiateItem(container: ViewGroup, position: Int): Any { - val fragment = super.instantiateItem(container, position) - storeNewFragment(position, fragment as SlideFragment) - return fragment - } - - override fun destroyItem(container: ViewGroup, position: Int, `object`: Any) { - retainedFragments.get(position)?.save(result) - retainedFragments.remove(position) - super.destroyItem(container, position, `object`) - } - - override fun restoreState(state: Parcelable?, loader: ClassLoader?) { - super.restoreState(state, loader) - if (state != null) { - val bundle = state as Bundle - val keys = bundle.keySet() - for (key in keys) { - if (key.startsWith("f")) { - val index = Integer.parseInt(key.substring(1)) - val f = fragmentManager.getFragment(bundle, key) - if (f != null && f is SlideFragment) { - storeNewFragment(index, f) - } - } - } - } - } - - private fun storeNewFragment(index: Int, fragment: SlideFragment) { - fragment.initData = result - fragment.setHasChangedListener { hasChanged(index, fragment) } - retainedFragments.put(index, fragment) - } - - fun allChanged() { - for (index in 0 until totalCount) { - hasChanged(index, getItem(index)) - } - } - - fun hasChanged(index: Int, fragment: SlideFragment) { - fragment.save(result) - if (index > -1 && (index + 1) < totalCount) { - getItem(index + 1).save(result) - } - } -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/ui/setup/accounts/edit/AccountEditActivity.kt b/app/src/main/java/de/kuschku/quasseldroid/ui/setup/accounts/edit/AccountEditActivity.kt deleted file mode 100644 index 0ef69a9d417536a31a1ba5f05c4eafe61fd25edb..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/ui/setup/accounts/edit/AccountEditActivity.kt +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.ui.setup.accounts.edit - -import android.content.Context -import android.content.Intent -import de.kuschku.quasseldroid.persistence.util.AccountId -import de.kuschku.quasseldroid.util.ui.settings.SettingsActivity - -class AccountEditActivity : SettingsActivity(AccountEditFragment()) { - companion object { - fun launch( - context: Context, - account: AccountId - ) = context.startActivity(intent(context, account)) - - fun intent( - context: Context, - account: AccountId - ) = Intent(context, AccountEditActivity::class.java).apply { - putExtra("account", account.id) - } - } -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/ui/setup/accounts/edit/AccountEditFragment.kt b/app/src/main/java/de/kuschku/quasseldroid/ui/setup/accounts/edit/AccountEditFragment.kt deleted file mode 100644 index 1b35c06b80cc021f6ea36f20c9b12b878ec4bad3..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/ui/setup/accounts/edit/AccountEditFragment.kt +++ /dev/null @@ -1,203 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.ui.setup.accounts.edit - -import android.app.Activity -import android.content.Context -import android.os.Bundle -import android.os.Handler -import android.os.HandlerThread -import android.text.Editable -import android.view.LayoutInflater -import android.view.View -import android.view.ViewGroup -import android.widget.EditText -import androidx.appcompat.widget.SwitchCompat -import butterknife.BindView -import butterknife.ButterKnife -import com.google.android.material.textfield.TextInputLayout -import de.kuschku.quasseldroid.Keys -import de.kuschku.quasseldroid.R -import de.kuschku.quasseldroid.persistence.dao.findById -import de.kuschku.quasseldroid.persistence.db.AccountDatabase -import de.kuschku.quasseldroid.persistence.models.Account -import de.kuschku.quasseldroid.persistence.util.AccountId -import de.kuschku.quasseldroid.util.Patterns -import de.kuschku.quasseldroid.util.TextValidator -import de.kuschku.quasseldroid.util.helper.editCommit -import de.kuschku.quasseldroid.util.ui.settings.fragment.Changeable -import de.kuschku.quasseldroid.util.ui.settings.fragment.Deletable -import de.kuschku.quasseldroid.util.ui.settings.fragment.Savable -import de.kuschku.quasseldroid.util.ui.settings.fragment.SettingsFragment -import javax.inject.Inject - -class AccountEditFragment : SettingsFragment(), Changeable, Savable, Deletable { - @BindView(R.id.nameWrapper) - lateinit var nameWrapper: TextInputLayout - @BindView(R.id.name) - lateinit var name: EditText - - @BindView(R.id.hostWrapper) - lateinit var hostWrapper: TextInputLayout - @BindView(R.id.host) - lateinit var host: EditText - - @BindView(R.id.portWrapper) - lateinit var portWrapper: TextInputLayout - @BindView(R.id.port) - lateinit var port: EditText - - @BindView(R.id.require_ssl) - lateinit var requireSsl: SwitchCompat - - @BindView(R.id.userWrapper) - lateinit var userWrapper: TextInputLayout - @BindView(R.id.user) - lateinit var user: EditText - - @BindView(R.id.passWrapper) - lateinit var passWrapper: TextInputLayout - @BindView(R.id.pass) - lateinit var pass: EditText - - @Inject - lateinit var database: AccountDatabase - - private var account: Account? = null - private var accountId: AccountId = AccountId(-1L) - - private lateinit var handlerThread: HandlerThread - private lateinit var handler: Handler - - override fun onCreate(savedInstanceState: Bundle?) { - super.onCreate(savedInstanceState) - handlerThread = HandlerThread("accountEdit") - handlerThread.start() - handler = Handler(handlerThread.looper) - } - - override fun onDestroy() { - super.onDestroy() - handlerThread.quit() - } - - override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, - savedInstanceState: Bundle?): View? { - val view = inflater.inflate(R.layout.setup_account_edit, container, false) - ButterKnife.bind(this, view) - - setHasOptionsMenu(true) - - handler.post { - accountId = AccountId(arguments?.getLong("account", -1L) ?: -1L) - if (!accountId.isValidId()) { - activity?.setResult(Activity.RESULT_CANCELED) - activity?.finish() - } - account = database.accounts().findById(accountId) - if (account == null) { - activity?.setResult(Activity.RESULT_CANCELED) - activity?.finish() - } - - name.setText(account?.name) - host.setText(account?.host) - port.setText(account?.port?.toString()) - requireSsl.isChecked = account?.requireSsl == true - user.setText(account?.user) - pass.setText(account?.pass) - } - - nameValidator = object : TextValidator( - activity, nameWrapper::setError, resources.getString(R.string.hint_invalid_name) - ) { - override fun validate(text: Editable) = text.isNotBlank() - } - - hostValidator = object : TextValidator( - activity, hostWrapper::setError, resources.getString(R.string.hint_invalid_host) - ) { - override fun validate(text: Editable) = text.toString().matches(Patterns.DOMAIN_NAME) - } - - portValidator = object : TextValidator( - activity, portWrapper::setError, resources.getString(R.string.hint_invalid_port) - ) { - override fun validate(text: Editable) = text.toString().toIntOrNull() in (0 until 65536) - } - - userValidator = object : TextValidator( - activity, userWrapper::setError, resources.getString(R.string.hint_invalid_user) - ) { - override fun validate(text: Editable) = text.isNotBlank() - } - - name.addTextChangedListener(nameValidator) - host.addTextChangedListener(hostValidator) - port.addTextChangedListener(portValidator) - user.addTextChangedListener(userValidator) - nameValidator.afterTextChanged(name.text) - hostValidator.afterTextChanged(host.text) - portValidator.afterTextChanged(port.text) - userValidator.afterTextChanged(user.text) - return view - } - - private lateinit var nameValidator: TextValidator - private lateinit var hostValidator: TextValidator - private lateinit var portValidator: TextValidator - private lateinit var userValidator: TextValidator - - private val isValid - get() = nameValidator.isValid && hostValidator.isValid && portValidator.isValid - && userValidator.isValid - - fun applyChanges() = account?.copy( - name = name.text.toString(), - host = host.text.toString(), - port = port.text.toString().toIntOrNull() ?: 4242, - requireSsl = requireSsl.isChecked, - user = user.text.toString(), - pass = pass.text.toString() - ) - - override fun onSave() = applyChanges()?.let { - handler.post { - database.accounts().save(it) - } - true - } ?: false - - override fun onDelete() { - handler.post { - account?.let { - val preferences = activity?.getSharedPreferences(Keys.Status.NAME, Context.MODE_PRIVATE) - if (AccountId(preferences?.getLong(Keys.Status.selectedAccount, -1) ?: -1) == it.id) { - preferences?.editCommit { - remove(Keys.Status.selectedAccount) - } - } - database.accounts().delete(it) - } - } - } - - override fun hasChanged() = account != applyChanges() -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/ui/setup/accounts/edit/AccountEditFragmentProvider.kt b/app/src/main/java/de/kuschku/quasseldroid/ui/setup/accounts/edit/AccountEditFragmentProvider.kt deleted file mode 100644 index 292bee3a1db7cb267408554d7c57f7963a0ddc21..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/ui/setup/accounts/edit/AccountEditFragmentProvider.kt +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.ui.setup.accounts.edit - -import androidx.fragment.app.FragmentActivity -import dagger.Binds -import dagger.Module -import dagger.android.ContributesAndroidInjector - -@Module -abstract class AccountEditFragmentProvider { - @Binds - abstract fun bindFragmentActivity(activity: AccountEditActivity): FragmentActivity - - @ContributesAndroidInjector - abstract fun bindAccountEditFragment(): AccountEditFragment -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/ui/setup/accounts/selection/AccountAdapter.kt b/app/src/main/java/de/kuschku/quasseldroid/ui/setup/accounts/selection/AccountAdapter.kt deleted file mode 100644 index 381b9e592c46a739dda5ecf4991d798c19b5be5c..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/ui/setup/accounts/selection/AccountAdapter.kt +++ /dev/null @@ -1,162 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.ui.setup.accounts.selection - -import android.view.LayoutInflater -import android.view.View -import android.view.ViewGroup -import androidx.recyclerview.widget.DiffUtil -import androidx.recyclerview.widget.RecyclerView -import de.kuschku.quasseldroid.R -import de.kuschku.quasseldroid.databinding.WidgetCoreAccountAddBinding -import de.kuschku.quasseldroid.databinding.WidgetCoreAccountBinding -import de.kuschku.quasseldroid.persistence.models.Account -import de.kuschku.quasseldroid.persistence.util.AccountId -import de.kuschku.quasseldroid.util.lists.ListAdapter - -class AccountAdapter : ListAdapter<Pair<Account?, Boolean>, AccountAdapter.AccountViewHolder>( - object : DiffUtil.ItemCallback<Pair<Account?, Boolean>>() { - override fun areItemsTheSame(oldItem: Pair<Account?, Boolean>, - newItem: Pair<Account?, Boolean>) = - oldItem.first?.id == newItem.first?.id - - override fun areContentsTheSame(oldItem: Pair<Account?, Boolean>, - newItem: Pair<Account?, Boolean>) = - oldItem == newItem - } -) { - private val actionListeners = mutableSetOf<(AccountId) -> Unit>() - private val addListeners = mutableSetOf<() -> Unit>() - private val clickListeners = mutableSetOf<(AccountId) -> Unit>() - - private val actionListener = object : ItemListener { - override fun onAction(id: AccountId, pos: Int) { - for (actionListener in actionListeners) { - actionListener.invoke(id) - } - } - } - - private val addListener = object : AddListener { - override fun onAction() { - for (addListener in addListeners) { - addListener.invoke() - } - } - } - - private val clickListener = object : ItemListener { - override fun onAction(id: AccountId, pos: Int) { - for (clickListener in clickListeners) { - clickListener.invoke(id) - } - } - } - - fun addEditListener(f: (AccountId) -> Unit) { - actionListeners.add(f) - } - - fun addAddListener(f: () -> Unit) { - addListeners.add(f) - } - - fun addClickListener(f: (AccountId) -> Unit) { - clickListeners.add(f) - } - - override fun onBindViewHolder(holder: AccountViewHolder, position: Int) { - val (account, selected) = getItem(position) - holder.bind(account, selected) - } - - override fun getItemViewType(position: Int) = when (getItem(position).first) { - null -> TYPE_ADD - else -> TYPE_ACCOUNT - } - - override fun onCreateViewHolder(parent: ViewGroup, viewType: Int) = when (viewType) { - TYPE_ADD -> AccountViewHolder.Add( - WidgetCoreAccountAddBinding.inflate(LayoutInflater.from(parent.context), parent, false), - addListener - ) - else -> AccountViewHolder.Item( - WidgetCoreAccountBinding.inflate(LayoutInflater.from(parent.context), parent, false), - actionListener, - clickListener - ) - } - - companion object { - private const val TYPE_ACCOUNT = 0 - private const val TYPE_ADD = 1 - } - - interface ItemListener { - fun onAction(id: AccountId, pos: Int) - } - - interface AddListener { - fun onAction() - } - - sealed class AccountViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) { - abstract fun bind(account: Account?, selected: Boolean) - - class Item( - private val binding: WidgetCoreAccountBinding, - actionListener: ItemListener, - clickListener: ItemListener - ) : AccountViewHolder(binding.root) { - private var data: Account? = null - - init { - binding.accountEdit.setOnClickListener { - actionListener.onAction(data?.id ?: AccountId(-1L), adapterPosition) - } - itemView.setOnClickListener { - clickListener.onAction(data?.id ?: AccountId(-1L), adapterPosition) - } - } - - override fun bind(account: Account?, selected: Boolean) { - data = account - binding.accountName.text = account?.name - binding.accountDescription.text = itemView.context.resources.getString( - R.string.label_user_on_host, account?.user, account?.host, account?.port - ) - binding.accountSelect.isChecked = selected - } - } - - class Add( - private val binding: WidgetCoreAccountAddBinding, - clickListener: AddListener - ) : AccountViewHolder(binding.root) { - init { - itemView.setOnClickListener { - clickListener.onAction() - } - } - - override fun bind(account: Account?, selected: Boolean) = Unit - } - } -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/ui/setup/accounts/selection/AccountSelectionActivity.kt b/app/src/main/java/de/kuschku/quasseldroid/ui/setup/accounts/selection/AccountSelectionActivity.kt deleted file mode 100644 index 39549fbf5d11e203d37f37dd7cadb53964ddfa14..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/ui/setup/accounts/selection/AccountSelectionActivity.kt +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.ui.setup.accounts.selection - -import android.app.Activity -import android.content.Context -import android.content.Intent -import android.content.SharedPreferences -import android.os.Bundle -import de.kuschku.quasseldroid.Keys -import de.kuschku.quasseldroid.ui.setup.SetupActivity -import de.kuschku.quasseldroid.util.helper.editCommit - -class AccountSelectionActivity : SetupActivity() { - companion object { - const val REQUEST_CREATE_FIRST = 0 - const val REQUEST_CREATE_NEW = 1 - - fun launch(context: Context) = context.startActivity(intent(context)) - fun intent(context: Context) = Intent(context, AccountSelectionActivity::class.java) - } - - override val fragments = listOf( - AccountSelectionSlide() - ) - - private lateinit var statusPreferences: SharedPreferences - override fun onDone(data: Bundle) { - statusPreferences.editCommit { - putLong(Keys.Status.selectedAccount, data.getLong(Keys.Status.selectedAccount, -1)) - putBoolean(Keys.Status.reconnect, true) - } - setResult(Activity.RESULT_OK) - finish() - } - - override fun onCreate(savedInstanceState: Bundle?) { - super.onCreate(savedInstanceState) - statusPreferences = this.getSharedPreferences(Keys.Status.NAME, Context.MODE_PRIVATE) - val data = Bundle() - val selectedAccount = statusPreferences.getLong(Keys.Status.selectedAccount, -1) - data.putLong(Keys.Status.selectedAccount, selectedAccount) - setInitData(data) - } -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/ui/setup/accounts/selection/AccountSelectionFragmentProvider.kt b/app/src/main/java/de/kuschku/quasseldroid/ui/setup/accounts/selection/AccountSelectionFragmentProvider.kt deleted file mode 100644 index db97a1407fbd8dc4bc3c1d00bbf5274633548148..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/ui/setup/accounts/selection/AccountSelectionFragmentProvider.kt +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.ui.setup.accounts.selection - -import androidx.fragment.app.FragmentActivity -import dagger.Binds -import dagger.Module -import dagger.android.ContributesAndroidInjector - -@Module -abstract class AccountSelectionFragmentProvider { - @Binds - abstract fun bindFragmentActivity(activity: AccountSelectionActivity): FragmentActivity - - @ContributesAndroidInjector - abstract fun bindAccountSelectionSlide(): AccountSelectionSlide -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/ui/setup/accounts/selection/AccountSelectionSlide.kt b/app/src/main/java/de/kuschku/quasseldroid/ui/setup/accounts/selection/AccountSelectionSlide.kt deleted file mode 100644 index 943349079c3ba906bd84243d6a3778f14695821f..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/ui/setup/accounts/selection/AccountSelectionSlide.kt +++ /dev/null @@ -1,123 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.ui.setup.accounts.selection - -import android.app.Activity -import android.content.Intent -import android.os.Bundle -import android.view.LayoutInflater -import android.view.View -import android.view.ViewGroup -import androidx.lifecycle.Observer -import androidx.recyclerview.widget.DefaultItemAnimator -import androidx.recyclerview.widget.LinearLayoutManager -import androidx.recyclerview.widget.RecyclerView -import butterknife.BindView -import butterknife.ButterKnife -import de.kuschku.libquassel.protocol.BufferId -import de.kuschku.libquassel.util.compatibility.LoggingHandler -import de.kuschku.libquassel.util.compatibility.LoggingHandler.Companion.log -import de.kuschku.quasseldroid.R -import de.kuschku.quasseldroid.persistence.db.AccountDatabase -import de.kuschku.quasseldroid.persistence.models.Account -import de.kuschku.quasseldroid.persistence.util.AccountId -import de.kuschku.quasseldroid.ui.setup.SlideFragment -import de.kuschku.quasseldroid.ui.setup.accounts.edit.AccountEditActivity -import de.kuschku.quasseldroid.ui.setup.accounts.selection.AccountSelectionActivity.Companion.REQUEST_CREATE_FIRST -import de.kuschku.quasseldroid.ui.setup.accounts.selection.AccountSelectionActivity.Companion.REQUEST_CREATE_NEW -import de.kuschku.quasseldroid.ui.setup.accounts.setup.AccountSetupActivity -import de.kuschku.quasseldroid.util.helper.map -import de.kuschku.quasseldroid.util.helper.observeSticky -import de.kuschku.quasseldroid.util.helper.zip -import javax.inject.Inject - -class AccountSelectionSlide : SlideFragment() { - @BindView(R.id.account_list) - lateinit var accountList: RecyclerView - - @Inject - lateinit var accountViewModel: AccountViewModel - - override fun isValid() = accountViewModel.selectedItem.value?.isValidId() == true - - override val title = R.string.slide_account_select_title - override val description = R.string.slide_account_select_description - - override fun setData(data: Bundle) { - if (data.containsKey("selectedAccount")) { - accountViewModel.selectedItem.postValue(AccountId(data.getLong("selectedAccount"))) - } - } - - override fun getData(data: Bundle) { - data.putLong("selectedAccount", accountViewModel.selectedItem.value?.id ?: -1L) - } - - private val adapter = AccountAdapter() - - override fun onCreateContent(inflater: LayoutInflater, container: ViewGroup?, - savedInstanceState: Bundle?): View { - BufferId - val view = inflater.inflate(R.layout.setup_select_account, container, false) - ButterKnife.bind(this, view) - val firstObserver = object : Observer<List<Account>?> { - override fun onChanged(t: List<Account>?) { - if (t?.isEmpty() != false) - startActivityForResult( - AccountSetupActivity.intent(requireContext()), - REQUEST_CREATE_FIRST - ) - accountViewModel.accounts.removeObserver(this) - } - } - accountViewModel.accounts.observe(viewLifecycleOwner, firstObserver) - accountList.layoutManager = LinearLayoutManager(context) - accountList.itemAnimator = DefaultItemAnimator() - accountList.adapter = adapter - - adapter.addAddListener { - startActivityForResult(AccountSetupActivity.intent(requireContext()), -1) - } - adapter.addEditListener { id -> - startActivityForResult(AccountEditActivity.intent(requireContext(), id), REQUEST_CREATE_NEW) - } - adapter.addClickListener { - accountViewModel.selectedItem.postValue(it) - } - accountViewModel.selectedItem.observeSticky(viewLifecycleOwner, Observer { - updateValidity() - }) - - accountViewModel.accounts.zip(accountViewModel.selectedItem).map { (accounts, selected) -> - accounts.map { Pair(it, it.id == selected) } - }.observe(viewLifecycleOwner, Observer { - adapter.submitList((it ?: emptyList()) + Pair(null, false)) - }) - - return view - } - - override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) { - super.onActivityResult(requestCode, resultCode, data) - if (requestCode == REQUEST_CREATE_FIRST && resultCode == Activity.RESULT_CANCELED) { - activity?.finish() - } - } -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/ui/setup/accounts/selection/AccountViewModel.kt b/app/src/main/java/de/kuschku/quasseldroid/ui/setup/accounts/selection/AccountViewModel.kt deleted file mode 100644 index 881cc936f5441ec0cc33ec752f52a2211e89105a..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/ui/setup/accounts/selection/AccountViewModel.kt +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.ui.setup.accounts.selection - -import android.app.Application -import androidx.lifecycle.AndroidViewModel -import androidx.lifecycle.LiveData -import androidx.lifecycle.MutableLiveData -import de.kuschku.quasseldroid.persistence.db.AccountDatabase -import de.kuschku.quasseldroid.persistence.models.Account -import de.kuschku.quasseldroid.persistence.util.AccountId - -class AccountViewModel(application: Application) : AndroidViewModel(application) { - private val database: AccountDatabase = AccountDatabase.Creator.init( - getApplication() - ) - val accounts: LiveData<List<Account>> = database.accounts().all() - val selectedItem = MutableLiveData<AccountId>() -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/ui/setup/accounts/setup/AccountSetupActivity.kt b/app/src/main/java/de/kuschku/quasseldroid/ui/setup/accounts/setup/AccountSetupActivity.kt deleted file mode 100644 index 15311ecb8e365446b9348beb8110acc84f0213b6..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/ui/setup/accounts/setup/AccountSetupActivity.kt +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.ui.setup.accounts.setup - -import android.app.Activity -import android.content.Context -import android.content.Intent -import android.os.Bundle -import de.kuschku.quasseldroid.persistence.dao.create -import de.kuschku.quasseldroid.persistence.db.AccountDatabase -import de.kuschku.quasseldroid.persistence.models.Account -import de.kuschku.quasseldroid.persistence.util.AccountId -import de.kuschku.quasseldroid.ui.setup.SetupActivity -import de.kuschku.quasseldroid.util.AndroidHandlerThread -import org.threeten.bp.Instant -import javax.inject.Inject - -class AccountSetupActivity : SetupActivity() { - private val handler = AndroidHandlerThread("Setup") - - @Inject - lateinit var database: AccountDatabase - - override fun onDone(data: Bundle) { - val account = Account.of( - id = AccountId(0), - host = data.getString("host", ""), - port = data.getInt("port"), - requireSsl = data.getBoolean("require_ssl"), - user = data.getString("user", ""), - pass = data.getString("pass", ""), - name = data.getString("name", ""), - lastUsed = Instant.now().epochSecond, - acceptedMissingFeatures = false, - defaultFiltered = 0 - ) - handler.post { - database.accounts().create(account) - runOnUiThread { - setResult(Activity.RESULT_OK) - finish() - } - } - } - - override fun onCreate(savedInstanceState: Bundle?) { - handler.onCreate() - super.onCreate(savedInstanceState) - } - - override fun onDestroy() { - handler.onDestroy() - super.onDestroy() - } - - override val fragments = listOf( - AccountSetupConnectionSlide(), - AccountSetupUserSlide(), - AccountSetupNameSlide() - ) - - companion object { - fun launch(context: Context) = context.startActivity(intent(context)) - fun intent(context: Context) = Intent(context, AccountSetupActivity::class.java) - } -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/ui/setup/accounts/setup/AccountSetupConnectionSlide.kt b/app/src/main/java/de/kuschku/quasseldroid/ui/setup/accounts/setup/AccountSetupConnectionSlide.kt deleted file mode 100644 index c6c03a4c8594db015626f9b78f7cdaace7293ab4..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/ui/setup/accounts/setup/AccountSetupConnectionSlide.kt +++ /dev/null @@ -1,105 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.ui.setup.accounts.setup - -import android.os.Bundle -import android.text.Editable -import android.view.LayoutInflater -import android.view.View -import android.view.ViewGroup -import android.widget.EditText -import androidx.appcompat.widget.SwitchCompat -import butterknife.BindView -import butterknife.ButterKnife -import com.google.android.material.textfield.TextInputLayout -import de.kuschku.quasseldroid.R -import de.kuschku.quasseldroid.ui.setup.SlideFragment -import de.kuschku.quasseldroid.util.Patterns -import de.kuschku.quasseldroid.util.TextValidator - -class AccountSetupConnectionSlide : SlideFragment() { - @BindView(R.id.hostWrapper) - lateinit var hostWrapper: TextInputLayout - - @BindView(R.id.host) - lateinit var hostField: EditText - - @BindView(R.id.portWrapper) - lateinit var portWrapper: TextInputLayout - - @BindView(R.id.port) - lateinit var portField: EditText - - @BindView(R.id.require_ssl) - lateinit var requireSsl: SwitchCompat - - override fun isValid(): Boolean { - return hostValidator.isValid && portValidator.isValid - } - - override val title = R.string.slide_account_connection_title - override val description = R.string.slide_account_connection_description - - override fun setData(data: Bundle) { - if (data.containsKey("host")) - hostField.setText(data.getString("host")) - if (data.containsKey("port")) - portField.setText(data.getInt("port").toString()) - if (data.containsKey("require_ssl")) - requireSsl.isChecked = data.getBoolean("require_ssl", false) - updateValidity() - } - - override fun getData(data: Bundle) { - data.putString("host", hostField.text.toString()) - data.putInt("port", portField.text.toString().toIntOrNull() ?: -1) - data.putBoolean("require_ssl", requireSsl.isChecked) - } - - override fun onCreateContent(inflater: LayoutInflater, container: ViewGroup?, - savedInstanceState: Bundle?): View { - val view = inflater.inflate(R.layout.setup_account_connection, container, false) - ButterKnife.bind(this, view) - hostValidator = object : TextValidator( - requireActivity(), hostWrapper::setError, resources.getString(R.string.hint_invalid_host) - ) { - override fun validate(text: Editable) = - text.toString().matches(Patterns.DOMAIN_NAME) - - override fun onChanged() = updateValidity() - } - portValidator = object : TextValidator( - requireActivity(), portWrapper::setError, resources.getString(R.string.hint_invalid_port) - ) { - override fun validate(text: Editable) = text.toString().toIntOrNull() in (0 until 65536) - - override fun onChanged() = updateValidity() - } - - hostField.addTextChangedListener(hostValidator) - portField.addTextChangedListener(portValidator) - hostValidator.afterTextChanged(hostField.text) - portValidator.afterTextChanged(portField.text) - return view - } - - private lateinit var hostValidator: TextValidator - private lateinit var portValidator: TextValidator -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/ui/setup/accounts/setup/AccountSetupFragmentProvider.kt b/app/src/main/java/de/kuschku/quasseldroid/ui/setup/accounts/setup/AccountSetupFragmentProvider.kt deleted file mode 100644 index d78ec563cfb702fcb77e3c2b9175bbccae6dce90..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/ui/setup/accounts/setup/AccountSetupFragmentProvider.kt +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.ui.setup.accounts.setup - -import androidx.fragment.app.FragmentActivity -import dagger.Binds -import dagger.Module -import dagger.android.ContributesAndroidInjector - -@Module -abstract class AccountSetupFragmentProvider { - @Binds - abstract fun bindFragmentActivity(activity: AccountSetupActivity): FragmentActivity - - @ContributesAndroidInjector - abstract fun bindAccountSetupConnectionSlide(): AccountSetupConnectionSlide - - @ContributesAndroidInjector - abstract fun bindAccountSetupNameSlide(): AccountSetupNameSlide - - @ContributesAndroidInjector - abstract fun bindAccountSetupUserSlide(): AccountSetupUserSlide -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/ui/setup/accounts/setup/AccountSetupNameSlide.kt b/app/src/main/java/de/kuschku/quasseldroid/ui/setup/accounts/setup/AccountSetupNameSlide.kt deleted file mode 100644 index 645e0a8d712c13c3e6e3fc30d7fbfa2afe010010..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/ui/setup/accounts/setup/AccountSetupNameSlide.kt +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.ui.setup.accounts.setup - -import android.os.Bundle -import android.text.Editable -import android.view.LayoutInflater -import android.view.View -import android.view.ViewGroup -import android.widget.EditText -import butterknife.BindView -import butterknife.ButterKnife -import com.google.android.material.textfield.TextInputLayout -import de.kuschku.quasseldroid.R -import de.kuschku.quasseldroid.ui.setup.SlideFragment -import de.kuschku.quasseldroid.util.TextValidator - -class AccountSetupNameSlide : SlideFragment() { - @BindView(R.id.nameWrapper) - lateinit var nameWrapper: TextInputLayout - @BindView(R.id.name) - lateinit var nameField: EditText - - override fun isValid(): Boolean { - return nameValidator?.isValid == true - } - - override val title = R.string.slide_account_name_title - override val description = R.string.slide_account_name_description - - override fun setData(data: Bundle) { - if (data.containsKey("name")) - nameField.setText(data.getString("name")) - updateValidity() - } - - override fun getData(data: Bundle) { - data.putString("name", nameField.text.toString()) - } - - override fun onCreateContent(inflater: LayoutInflater, container: ViewGroup?, - savedInstanceState: Bundle?): View { - val view = inflater.inflate(R.layout.setup_account_name, container, false) - ButterKnife.bind(this, view) - nameValidator = object : TextValidator( - requireActivity(), nameWrapper::setError, resources.getString(R.string.hint_invalid_name) - ) { - override fun validate(text: Editable) = text.isNotBlank() - - override fun onChanged() = updateValidity() - } - nameField.addTextChangedListener(nameValidator) - nameValidator?.afterTextChanged(nameField.text) - return view - } - - private var nameValidator: TextValidator? = null -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/ui/setup/accounts/setup/AccountSetupUserSlide.kt b/app/src/main/java/de/kuschku/quasseldroid/ui/setup/accounts/setup/AccountSetupUserSlide.kt deleted file mode 100644 index 84f8595b7c3b3b4e6e5933310d616648b25a18b3..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/ui/setup/accounts/setup/AccountSetupUserSlide.kt +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.ui.setup.accounts.setup - -import android.os.Bundle -import android.text.Editable -import android.view.LayoutInflater -import android.view.View -import android.view.ViewGroup -import android.widget.EditText -import butterknife.BindView -import butterknife.ButterKnife -import com.google.android.material.textfield.TextInputLayout -import de.kuschku.quasseldroid.R -import de.kuschku.quasseldroid.ui.setup.SlideFragment -import de.kuschku.quasseldroid.util.TextValidator - -class AccountSetupUserSlide : SlideFragment() { - @BindView(R.id.userWrapper) - lateinit var userWrapper: TextInputLayout - - @BindView(R.id.user) - lateinit var userField: EditText - - @BindView(R.id.passWrapper) - lateinit var passWrapper: TextInputLayout - - @BindView(R.id.pass) - lateinit var passField: EditText - - override fun isValid(): Boolean { - return true - } - - override val title = R.string.slide_account_user_title - override val description = R.string.slide_account_user_description - - override fun setData(data: Bundle) { - if (data.containsKey("user")) - userField.setText(data.getString("user")) - if (data.containsKey("pass")) - passField.setText(data.getString("pass")) - } - - override fun getData(data: Bundle) { - data.putString("user", userField.text.toString()) - data.putString("pass", passField.text.toString()) - } - - override fun onCreateContent(inflater: LayoutInflater, container: ViewGroup?, - savedInstanceState: Bundle?): View { - val view = inflater.inflate(R.layout.setup_account_user, container, false) - ButterKnife.bind(this, view) - userValidator = object : TextValidator( - requireActivity(), userWrapper::setError, resources.getString(R.string.hint_invalid_user) - ) { - override fun validate(text: Editable) = text.isNotBlank() - - override fun onChanged() = updateValidity() - } - userField.addTextChangedListener(userValidator) - userValidator.afterTextChanged(userField.text) - return view - } - - private lateinit var userValidator: TextValidator -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/ui/setup/core/CoreAuthenticatorBackendChooseSlide.kt b/app/src/main/java/de/kuschku/quasseldroid/ui/setup/core/CoreAuthenticatorBackendChooseSlide.kt deleted file mode 100644 index 8649e3df0b58229bbba775800a7060c5b7509eba..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/ui/setup/core/CoreAuthenticatorBackendChooseSlide.kt +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.ui.setup.core - -import de.kuschku.libquassel.protocol.coresetup.CoreSetupData -import de.kuschku.quasseldroid.R - -class CoreAuthenticatorBackendChooseSlide : CoreBackendChooseSlide() { - override val title = R.string.slide_core_authenticator_select_title - override val description = R.string.slide_core_authenticator_select_description - - override val inputKey = CoreSetupData::authenticatorInfo - override val outputKey = "authenticator" -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/ui/setup/core/CoreAuthenticatorBackendSetupSlide.kt b/app/src/main/java/de/kuschku/quasseldroid/ui/setup/core/CoreAuthenticatorBackendSetupSlide.kt deleted file mode 100644 index 09d6e75cf44155646bdaa5807dd26505ade1d722..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/ui/setup/core/CoreAuthenticatorBackendSetupSlide.kt +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.ui.setup.core - -import de.kuschku.quasseldroid.R - -class CoreAuthenticatorBackendSetupSlide : CoreBackendSetupSlide() { - override val title = R.string.slide_core_backend_setup_title - override val description = R.string.slide_core_backend_setup_description - - override val inputKey = "authenticator" - override val outputKey = "authenticatorSetup" -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/ui/setup/core/CoreBackendAdapter.kt b/app/src/main/java/de/kuschku/quasseldroid/ui/setup/core/CoreBackendAdapter.kt deleted file mode 100644 index a2969528138022bf8e98dfaf7240800da5fd8893..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/ui/setup/core/CoreBackendAdapter.kt +++ /dev/null @@ -1,130 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.ui.setup.core - -import android.view.LayoutInflater -import android.view.ViewGroup -import androidx.recyclerview.widget.DiffUtil -import androidx.recyclerview.widget.RecyclerView -import de.kuschku.libquassel.protocol.coresetup.CoreSetupBackend -import de.kuschku.quasseldroid.databinding.WidgetCoreBackendBinding - -class CoreBackendAdapter : RecyclerView.Adapter<CoreBackendAdapter.BackendViewHolder>() { - private val selectionListeners = mutableSetOf<(CoreSetupBackend) -> Unit>() - private var selectedItem: Pair<CoreSetupBackend?, CoreSetupBackend?> = Pair(null, null) - - fun selection() = selectedItem.second - - private val clickListener = { item: CoreSetupBackend -> - selectionListener.invoke(item) - } - - fun updateSelection(item: CoreSetupBackend) { - selectedItem = Pair(selectedItem.second, item) - submitList() - } - - private val selectionListener = { item: CoreSetupBackend -> - updateSelection(item) - for (selectionListener in selectionListeners) { - selectionListener.invoke(item) - } - } - - private var list: List<Pair<Boolean, CoreSetupBackend>> = emptyList() - - fun submitList( - list: List<CoreSetupBackend> = this.list.map(Pair<Boolean, CoreSetupBackend>::second)) { - val oldList = this.list - - val oldSelected = selectedItem.first - val newSelected = selectedItem.second - - val newList = list.map { - Pair(it == newSelected, it) - } - this.list = newList - - DiffUtil.calculateDiff(object : DiffUtil.Callback() { - override fun areItemsTheSame(oldItemPosition: Int, newItemPosition: Int): Boolean { - val oldItem = oldList[oldItemPosition].second - val newItem = newList[newItemPosition].second - - return oldItem == newItem - } - - override fun getOldListSize(): Int { - return oldList.size - } - - override fun getNewListSize(): Int { - return newList.size - } - - override fun areContentsTheSame(oldItemPosition: Int, newItemPosition: Int): Boolean { - val oldItem = oldList[oldItemPosition].second - val newItem = newList[newItemPosition].second - - return oldItem == newItem && - oldItem != newSelected && - newItem != newSelected && - oldItem != oldSelected && - newItem != oldSelected - } - }).dispatchUpdatesTo(this) - } - - fun addSelectionListener(f: (CoreSetupBackend) -> Unit) { - selectionListeners.add(f) - } - - override fun onBindViewHolder(holder: BackendViewHolder, position: Int) { - val item = list[position] - holder.bind(item.second, item.first) - } - - override fun onCreateViewHolder(parent: ViewGroup, viewType: Int) = BackendViewHolder( - WidgetCoreBackendBinding.inflate(LayoutInflater.from(parent.context), parent, false), - clickListener - ) - - override fun getItemCount() = list.size - - class BackendViewHolder( - private val binding: WidgetCoreBackendBinding, - clickListener: (CoreSetupBackend) -> Unit - ) : - RecyclerView.ViewHolder(binding.root) { - private var item: CoreSetupBackend? = null - - init { - itemView.setOnClickListener { - item?.let(clickListener) - } - } - - fun bind(backend: CoreSetupBackend, selected: Boolean) { - item = backend - binding.backendName.text = backend.displayName - binding.backendDescription.text = backend.description - binding.backendSelect.isChecked = selected - } - } -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/ui/setup/core/CoreBackendChooseSlide.kt b/app/src/main/java/de/kuschku/quasseldroid/ui/setup/core/CoreBackendChooseSlide.kt deleted file mode 100644 index 725149aee6ee19130ecdb13fa509c6b05720fbbb..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/ui/setup/core/CoreBackendChooseSlide.kt +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.ui.setup.core - -import android.os.Bundle -import android.view.LayoutInflater -import android.view.View -import android.view.ViewGroup -import androidx.recyclerview.widget.DefaultItemAnimator -import androidx.recyclerview.widget.LinearLayoutManager -import androidx.recyclerview.widget.RecyclerView -import butterknife.BindView -import butterknife.ButterKnife -import de.kuschku.libquassel.protocol.coresetup.CoreSetupBackend -import de.kuschku.libquassel.protocol.coresetup.CoreSetupData -import de.kuschku.quasseldroid.R -import de.kuschku.quasseldroid.ui.setup.SlideFragment - -abstract class CoreBackendChooseSlide : SlideFragment() { - @BindView(R.id.account_list) - lateinit var backendList: RecyclerView - - override fun isValid() = adapter.selection() != null - - protected val adapter = CoreBackendAdapter() - - abstract val outputKey: String - abstract val inputKey: ((CoreSetupData) -> List<CoreSetupBackend>) - - override fun getData(data: Bundle) { - data.putSerializable( - outputKey, - adapter.selection() - ) - } - - override fun setData(data: Bundle) { - val message = data.getSerializable("data") as? CoreSetupData - adapter.submitList(message?.let(inputKey).orEmpty()) - (data.getSerializable(outputKey) as? CoreSetupBackend)?.let(adapter::updateSelection) - } - - override fun onCreateContent(inflater: LayoutInflater, container: ViewGroup?, - savedInstanceState: Bundle?): View { - val view = inflater.inflate(R.layout.setup_select_account, container, false) - ButterKnife.bind(this, view) - - backendList.layoutManager = LinearLayoutManager(context) - backendList.itemAnimator = DefaultItemAnimator() - backendList.adapter = adapter - adapter.addSelectionListener { - updateValidity() - hasChanged() - } - - return view - } -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/ui/setup/core/CoreBackendSetupSlide.kt b/app/src/main/java/de/kuschku/quasseldroid/ui/setup/core/CoreBackendSetupSlide.kt deleted file mode 100644 index 13144aa99f39ce4a682e3936b287c1a9835dcbb9..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/ui/setup/core/CoreBackendSetupSlide.kt +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.ui.setup.core - -import android.os.Bundle -import android.view.LayoutInflater -import android.view.View -import android.view.ViewGroup -import android.widget.LinearLayout -import butterknife.BindView -import butterknife.ButterKnife -import de.kuschku.libquassel.protocol.QVariant_ -import de.kuschku.libquassel.protocol.coresetup.CoreSetupBackend -import de.kuschku.quasseldroid.R -import de.kuschku.quasseldroid.ui.setup.SlideFragment - -abstract class CoreBackendSetupSlide : SlideFragment() { - @BindView(R.id.frame) - lateinit var frame: LinearLayout - - @BindView(R.id.no_options_info) - lateinit var noOptionsInfo: View - - override fun isValid() = true - - abstract val inputKey: String - abstract val outputKey: String - - private var widgets = mutableListOf<QuasselSetupEntry>() - - override fun setData(data: Bundle) { - widgets.clear() - frame.removeAllViews() - noOptionsInfo.visibility = View.VISIBLE - - val backend = data.getSerializable(inputKey) as? CoreSetupBackend - for (configEntry in backend?.setupData.orEmpty()) { - val entry = QuasselSetupEntry(frame.context, - null, - 0, - configEntry) - widgets.add(entry) - frame.addView(entry) - noOptionsInfo.visibility = View.GONE - } - } - - override fun getData(data: Bundle) { - val setupData = HashMap<String, QVariant_>() - for (configEntry in widgets) { - setupData[configEntry.key()] = configEntry.value() - } - data.putSerializable(outputKey, setupData) - } - - override fun onCreateContent(inflater: LayoutInflater, container: ViewGroup?, - savedInstanceState: Bundle?): View { - val view = inflater.inflate(R.layout.setup_core_backend_configure, container, false) - ButterKnife.bind(this, view) - - return view - } -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/ui/setup/core/CoreSetupActivity.kt b/app/src/main/java/de/kuschku/quasseldroid/ui/setup/core/CoreSetupActivity.kt deleted file mode 100644 index df0141c55ab3296e05cee0afe0dc8ee622cf9744..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/ui/setup/core/CoreSetupActivity.kt +++ /dev/null @@ -1,110 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.ui.setup.core - -import android.app.Activity -import android.content.Context -import android.content.Intent -import android.os.Bundle -import de.kuschku.libquassel.protocol.QVariant_ -import de.kuschku.libquassel.protocol.coresetup.CoreSetupBackend -import de.kuschku.libquassel.protocol.coresetup.CoreSetupData -import de.kuschku.libquassel.protocol.message.HandshakeMessage -import de.kuschku.libquassel.quassel.ExtendedFeature -import de.kuschku.libquassel.util.helper.value -import de.kuschku.quasseldroid.persistence.models.Account -import de.kuschku.quasseldroid.ui.setup.ServiceBoundSetupActivity -import de.kuschku.quasseldroid.viewmodel.helper.EditorViewModelHelper -import javax.inject.Inject - -class CoreSetupActivity : ServiceBoundSetupActivity() { - @Inject - lateinit var modelHelper: EditorViewModelHelper - - override val initData = Bundle() - - override fun onCreate(savedInstanceState: Bundle?) { - initData.clear() - initData.putAll(intent.extras) - super.onCreate(savedInstanceState) - } - - override fun onDone(data: Bundle) { - val user = initData.getString("user") - val pass = initData.getString("pass") - - val storageBackend = data.getSerializable("storage") as? CoreSetupBackend - val storageBackendSetup = data.getSerializable("storageSetup") as? HashMap<String, QVariant_> - - val authenticatorBackend = data.getSerializable("authenticator") as? CoreSetupBackend - val authenticatorBackendSetup = data.getSerializable("authenticatorSetup") as? HashMap<String, QVariant_> - - modelHelper.sessionManager.value?.orNull()?.setupCore(HandshakeMessage.CoreSetupData( - adminUser = user, - adminPassword = pass, - backend = storageBackend?.backendId, - setupData = storageBackendSetup.orEmpty(), - authenticator = authenticatorBackend?.backendId, - authSetupData = authenticatorBackendSetup.orEmpty() - )) - - setResult(Activity.RESULT_OK) - finish() - } - - override val fragments - get() = if ((initData.getSerializable("data") as? CoreSetupData) - ?.features - ?.hasFeature(ExtendedFeature.Authenticators) == true) { - listOf( - CoreStorageBackendChooseSlide(), - CoreStorageBackendSetupSlide(), - CoreAuthenticatorBackendChooseSlide(), - CoreAuthenticatorBackendSetupSlide() - ) - } else { - listOf( - CoreStorageBackendChooseSlide(), - CoreStorageBackendSetupSlide() - ) - } - - companion object { - fun launch( - context: Context, - account: Account? = null, - data: CoreSetupData? = null - ) = context.startActivity(intent(context, account, data)) - - fun intent( - context: Context, - account: Account? = null, - data: CoreSetupData? = null - ) = Intent(context, CoreSetupActivity::class.java).apply { - if (account != null) { - putExtra("user", account.user) - putExtra("pass", account.pass) - } - if (data != null) { - putExtra("data", data) - } - } - } -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/ui/setup/core/CoreSetupFragmentProvider.kt b/app/src/main/java/de/kuschku/quasseldroid/ui/setup/core/CoreSetupFragmentProvider.kt deleted file mode 100644 index a4da3a29d4f1842eabebd5d8ac0e43f1fd84fddc..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/ui/setup/core/CoreSetupFragmentProvider.kt +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.ui.setup.core - -import androidx.fragment.app.FragmentActivity -import dagger.Binds -import dagger.Module -import dagger.android.ContributesAndroidInjector - -@Module -abstract class CoreSetupFragmentProvider { - @Binds - abstract fun bindFragmentActivity(activity: CoreSetupActivity): FragmentActivity - - @ContributesAndroidInjector - abstract fun bindCoreStorageBackendChooseSlide(): CoreStorageBackendChooseSlide - - @ContributesAndroidInjector - abstract fun bindCoreStorageBackendSetupSlide(): CoreStorageBackendSetupSlide - - @ContributesAndroidInjector - abstract fun bindCoreAuthenticatorBackendChooseSlide(): CoreAuthenticatorBackendChooseSlide - - @ContributesAndroidInjector - abstract fun bindCoreAuthenticatorBackendSetupSlide(): CoreAuthenticatorBackendSetupSlide -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/ui/setup/core/CoreStorageBackendChooseSlide.kt b/app/src/main/java/de/kuschku/quasseldroid/ui/setup/core/CoreStorageBackendChooseSlide.kt deleted file mode 100644 index e58b06f67a7bd70fb0e0fb778fcd54881e333d94..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/ui/setup/core/CoreStorageBackendChooseSlide.kt +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.ui.setup.core - -import de.kuschku.libquassel.protocol.coresetup.CoreSetupData -import de.kuschku.quasseldroid.R - -class CoreStorageBackendChooseSlide : CoreBackendChooseSlide() { - override val title = R.string.slide_core_backend_select_title - override val description = R.string.slide_core_backend_select_description - - override val inputKey = CoreSetupData::backendInfo - override val outputKey = "storage" -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/ui/setup/core/CoreStorageBackendSetupSlide.kt b/app/src/main/java/de/kuschku/quasseldroid/ui/setup/core/CoreStorageBackendSetupSlide.kt deleted file mode 100644 index 1d1da9517bd326a85990eb7fef88a7a222755f7e..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/ui/setup/core/CoreStorageBackendSetupSlide.kt +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.ui.setup.core - -import de.kuschku.quasseldroid.R - -class CoreStorageBackendSetupSlide : CoreBackendSetupSlide() { - override val title = R.string.slide_core_backend_setup_title - override val description = R.string.slide_core_backend_setup_description - - override val inputKey = "storage" - override val outputKey = "storageSetup" -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/ui/setup/core/QuasselSetupEntry.kt b/app/src/main/java/de/kuschku/quasseldroid/ui/setup/core/QuasselSetupEntry.kt deleted file mode 100644 index 49d43c6efd9f2e38e13313df08e0e5779e895b15..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/ui/setup/core/QuasselSetupEntry.kt +++ /dev/null @@ -1,116 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.ui.setup.core - -import android.content.Context -import android.text.InputType -import android.util.AttributeSet -import android.view.LayoutInflater -import android.widget.FrameLayout -import butterknife.BindView -import butterknife.ButterKnife -import com.google.android.material.textfield.TextInputEditText -import com.google.android.material.textfield.TextInputLayout -import de.kuschku.libquassel.protocol.QVariant_ -import de.kuschku.libquassel.protocol.Type -import de.kuschku.libquassel.protocol.coresetup.CoreSetupBackendConfigElement -import de.kuschku.libquassel.protocol.value -import de.kuschku.quasseldroid.R - -class QuasselSetupEntry : FrameLayout { - @BindView(R.id.wrapper) - lateinit var wrapper: TextInputLayout - - @BindView(R.id.field) - lateinit var field: TextInputEditText - - private var data: CoreSetupBackendConfigElement? = null - - constructor(context: Context) : - this(context, null) - - constructor(context: Context, attrs: AttributeSet?) : - this(context, attrs, 0) - - constructor(context: Context, attrs: AttributeSet?, defStyleAttr: Int) : - this(context, attrs, defStyleAttr, null) - - constructor(context: Context, attrs: AttributeSet? = null, defStyleAttr: Int = 0, - data: CoreSetupBackendConfigElement? = null - ) : super(context, attrs, defStyleAttr) { - - LayoutInflater.from(context).inflate(R.layout.widget_quassel_setup_entry, this, true) - ButterKnife.bind(this) - - if (data != null) { - this.data = data - - wrapper.hint = data.displayName - when { - data.defaultValue.type == Type.QString && - data.key.contains("password", ignoreCase = true) -> { - wrapper.isPasswordVisibilityToggleEnabled = true - field.inputType = - InputType.TYPE_CLASS_TEXT or - InputType.TYPE_TEXT_VARIATION_PASSWORD - field.setText(data.defaultValue.value("")) - } - data.defaultValue.type == Type.QString && - data.key.contains("hostname", ignoreCase = true) -> { - field.inputType = - InputType.TYPE_CLASS_TEXT or - InputType.TYPE_TEXT_VARIATION_URI - field.setText(data.defaultValue.value("")) - } - data.defaultValue.type == Type.QString -> { - field.inputType = - InputType.TYPE_CLASS_TEXT or - InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD or - InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS - field.setText(data.defaultValue.value("")) - } - data.defaultValue.type == Type.Int -> { - field.inputType = - InputType.TYPE_CLASS_NUMBER - field.setText(data.defaultValue.value<Int>()?.toString()) - } - } - } - } - - fun key() = data?.key ?: "" - - fun value(): QVariant_ { - val rawValue = field.text.toString() - val data = this.data - - return when (data?.defaultValue?.type) { - Type.QString -> { - QVariant_.of(rawValue, data.defaultValue.type) - } - Type.Int -> { - QVariant_.of(rawValue.toInt(), data.defaultValue.type) - } - else -> { - QVariant_.of("", Type.QString) - } - } - } -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/ui/setup/network/LinkNetwork.kt b/app/src/main/java/de/kuschku/quasseldroid/ui/setup/network/LinkNetwork.kt deleted file mode 100644 index 8a87c420a12b227be8d5d65ee1a699d5cec5f638..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/ui/setup/network/LinkNetwork.kt +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.ui.setup.network - -import de.kuschku.quasseldroid.defaults.DefaultNetworkServer -import java.io.Serializable - -data class LinkNetwork( - val name: String, - val defaultChannels: List<String> = emptyList(), - val server: DefaultNetworkServer -) : Serializable diff --git a/app/src/main/java/de/kuschku/quasseldroid/ui/setup/network/NetworkSetupActivity.kt b/app/src/main/java/de/kuschku/quasseldroid/ui/setup/network/NetworkSetupActivity.kt deleted file mode 100644 index a8554dbb02146700be750423a02117f0ef7cb588..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/ui/setup/network/NetworkSetupActivity.kt +++ /dev/null @@ -1,125 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.ui.setup.network - -import android.app.Activity -import android.content.Context -import android.content.Intent -import android.os.Bundle -import de.kuschku.libquassel.protocol.Buffer_Type -import de.kuschku.libquassel.protocol.IdentityId -import de.kuschku.libquassel.protocol.NetworkId -import de.kuschku.libquassel.quassel.syncables.interfaces.INetwork -import de.kuschku.libquassel.util.helper.value -import de.kuschku.quasseldroid.ui.setup.ServiceBoundSetupActivity -import de.kuschku.quasseldroid.viewmodel.helper.EditorViewModelHelper -import javax.inject.Inject - -class NetworkSetupActivity : ServiceBoundSetupActivity() { - @Inject - lateinit var modelHelper: EditorViewModelHelper - - private lateinit var arguments: Bundle - override val initData: Bundle - get() = arguments - - override fun onCreate(savedInstanceState: Bundle?) { - arguments = intent.getBundleExtra("link") - super.onCreate(savedInstanceState) - } - - override fun onDone(data: Bundle) { - val network = data.getSerializable("network") as? LinkNetwork - val networkId = NetworkId(data.getInt("network_id", -1)) - val identity = IdentityId(data.getInt("identity", -1)) - if (networkId.isValidId() || (network != null && identity.isValidId())) { - modelHelper.backend?.value?.ifPresent { backend -> - val session = modelHelper.connectedSession.value?.orNull() - session?.apply { - rpcHandler.apply { - when { - networkId.isValidId() -> { - val buffer = bufferSyncer.find(networkId = networkId, - type = Buffer_Type.of(Buffer_Type.StatusBuffer)) - if (buffer != null) { - data.getStringArray("channels")?.toList().orEmpty().forEach { - sendInput(buffer, "/join $it") - } - } - } - network != null && - network.name.isNotBlank() && - network.server.host.isNotBlank() -> { - createNetwork(INetwork.NetworkInfo( - networkName = network.name, - identity = identity, - serverList = listOf(INetwork.Server( - host = network.server.host, - port = network.server.port, - useSsl = network.server.secure - )) - ), data.getStringArray("channels")?.toList().orEmpty()) - backend.requestConnectNewNetwork() - } - } - } - } - } - } - - setResult(Activity.RESULT_OK) - finish() - } - - override val fragments = listOf( - NetworkSetupNetworkSlide(), - NetworkSetupChannelsSlide() - ) - - companion object { - fun launch( - context: Context, - network: LinkNetwork? = null, - identity: IdentityId? = null, - channels: Array<String>? = null - ) = context.startActivity(intent(context, network, identity, channels)) - - fun intent( - context: Context, - network: LinkNetwork? = null, - identity: IdentityId? = null, - channels: Array<String>? = null - ) = Intent(context, NetworkSetupActivity::class.java).apply { - if (network != null || identity != null || channels != null) { - val bundle = Bundle() - if (network != null) { - bundle.putSerializable("network", network) - } - if (identity != null) { - bundle.putInt("identity", identity.id) - } - if (channels != null) { - bundle.putStringArray("channels", channels) - } - putExtra("link", bundle) - } - } - } -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/ui/setup/network/NetworkSetupChannelsSlide.kt b/app/src/main/java/de/kuschku/quasseldroid/ui/setup/network/NetworkSetupChannelsSlide.kt deleted file mode 100644 index c34dfdfd805deb8d91c8d39432b3e25030556699..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/ui/setup/network/NetworkSetupChannelsSlide.kt +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.ui.setup.network - -import android.os.Bundle -import android.view.LayoutInflater -import android.view.View -import android.view.ViewGroup -import android.widget.EditText -import butterknife.BindView -import butterknife.ButterKnife -import com.google.android.material.textfield.TextInputLayout -import de.kuschku.quasseldroid.R -import de.kuschku.quasseldroid.ui.setup.SlideFragment - -class NetworkSetupChannelsSlide : SlideFragment() { - @BindView(R.id.channelsWrapper) - lateinit var channelsWrapper: TextInputLayout - - @BindView(R.id.channels) - lateinit var channelsField: EditText - - override fun isValid() = true - - override val title = R.string.slide_user_channels_title - override val description = R.string.slide_user_channels_description - - override fun setData(data: Bundle) { - if (data.containsKey("channels")) - channelsField.setText(data.getStringArray("channels")?.joinToString("\n")) - updateValidity() - } - - override fun getData(data: Bundle) { - data.putStringArray("channels", - channelsField.text.toString() - .split('\n', ' ', ',', ';') - .map(String::trim) - .filter(String::isNotBlank) - .toTypedArray() - ) - } - - override fun onCreateContent(inflater: LayoutInflater, container: ViewGroup?, - savedInstanceState: Bundle?): View { - val view = inflater.inflate(R.layout.setup_user_channels, container, false) - ButterKnife.bind(this, view) - return view - } -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/ui/setup/network/NetworkSetupFragmentProvider.kt b/app/src/main/java/de/kuschku/quasseldroid/ui/setup/network/NetworkSetupFragmentProvider.kt deleted file mode 100644 index 923317f7f84bd97d09fdf388cc2cdec5d87c4d4a..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/ui/setup/network/NetworkSetupFragmentProvider.kt +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.ui.setup.network - -import androidx.fragment.app.FragmentActivity -import dagger.Binds -import dagger.Module -import dagger.android.ContributesAndroidInjector - -@Module -abstract class NetworkSetupFragmentProvider { - @Binds - abstract fun bindFragmentActivity(activity: NetworkSetupActivity): FragmentActivity - - @ContributesAndroidInjector - abstract fun bindNetworkSetupNetworkSlide(): NetworkSetupNetworkSlide - - @ContributesAndroidInjector - abstract fun bindNetworkSetupChannelsSlide(): NetworkSetupChannelsSlide -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/ui/setup/network/NetworkSetupNetworkSlide.kt b/app/src/main/java/de/kuschku/quasseldroid/ui/setup/network/NetworkSetupNetworkSlide.kt deleted file mode 100644 index c6465339560653c64fe8247e9579a0decf0c03ae..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/ui/setup/network/NetworkSetupNetworkSlide.kt +++ /dev/null @@ -1,282 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.ui.setup.network - -import android.os.Bundle -import android.text.Editable -import android.view.LayoutInflater -import android.view.View -import android.view.ViewGroup -import android.widget.AdapterView -import android.widget.EditText -import android.widget.Spinner -import androidx.appcompat.widget.SwitchCompat -import androidx.lifecycle.Observer -import butterknife.BindView -import butterknife.ButterKnife -import com.google.android.material.textfield.TextInputLayout -import de.kuschku.libquassel.protocol.IdentityId -import de.kuschku.libquassel.protocol.NetworkId -import de.kuschku.libquassel.quassel.syncables.Identity -import de.kuschku.libquassel.quassel.syncables.Network -import de.kuschku.libquassel.quassel.syncables.interfaces.INetwork -import de.kuschku.libquassel.quassel.syncables.interfaces.INetwork.PortDefaults.PORT_PLAINTEXT -import de.kuschku.libquassel.quassel.syncables.interfaces.INetwork.PortDefaults.PORT_SSL -import de.kuschku.libquassel.util.helper.combineLatest -import de.kuschku.libquassel.util.helper.safeSwitchMap -import de.kuschku.quasseldroid.R -import de.kuschku.quasseldroid.defaults.DefaultNetworkServer -import de.kuschku.quasseldroid.ui.coresettings.chatlist.NetworkAdapter -import de.kuschku.quasseldroid.ui.coresettings.network.IdentityAdapter -import de.kuschku.quasseldroid.ui.setup.ServiceBoundSlideFragment -import de.kuschku.quasseldroid.util.Patterns -import de.kuschku.quasseldroid.util.TextValidator -import de.kuschku.quasseldroid.util.helper.toLiveData -import de.kuschku.quasseldroid.util.ui.AnimationHelper -import de.kuschku.quasseldroid.viewmodel.helper.EditorViewModelHelper -import javax.inject.Inject - -class NetworkSetupNetworkSlide : ServiceBoundSlideFragment() { - @BindView(R.id.identity) - lateinit var identity: Spinner - - @BindView(R.id.network) - lateinit var network: Spinner - - @BindView(R.id.network_group) - lateinit var networkGroup: ViewGroup - - @BindView(R.id.nameWrapper) - lateinit var nameWrapper: TextInputLayout - - @BindView(R.id.name) - lateinit var nameField: EditText - - @BindView(R.id.hostWrapper) - lateinit var hostWrapper: TextInputLayout - - @BindView(R.id.host) - lateinit var hostField: EditText - - @BindView(R.id.portWrapper) - lateinit var portWrapper: TextInputLayout - - @BindView(R.id.port) - lateinit var portField: EditText - - @BindView(R.id.ssl_enabled) - lateinit var sslEnabled: SwitchCompat - - @Inject - lateinit var modelHelper: EditorViewModelHelper - - private val identityAdapter = IdentityAdapter() - private val networkAdapter = NetworkAdapter(R.string.settings_chatlist_network_create) - - override fun isValid(): Boolean { - return (this.network.selectedItemPosition != -1 && - networkAdapter.getItemId(this.network.selectedItemPosition) != -1L) || - ((this.identity.selectedItemPosition != -1 && - identityAdapter.getItemId(this.identity.selectedItemPosition) != -1L) && - (nameValidator.isValid && hostValidator.isValid && portValidator.isValid)) - } - - override val title = R.string.slide_user_network_title - override val description = R.string.slide_user_network_description - - private var data: Bundle? = null - private var networks: List<INetwork.NetworkInfo>? = null - - override fun setData(data: Bundle) { - this.data = data - update() - } - - override fun getData(data: Bundle) { - data.putInt( - "identity", - identityAdapter.getItemId(this.identity.selectedItemPosition).toInt() - ) - val networkId = (network.selectedItem as? INetwork.NetworkInfo)?.networkId - if (networkId != null) { - data.putInt("network_id", networkId.id) - } else { - data.putSerializable( - "network", - LinkNetwork( - name = nameField.text.toString(), - server = DefaultNetworkServer( - host = hostField.text.toString(), - port = portField.text.toString().toUIntOrNull() - ?: if (sslEnabled.isChecked) PORT_SSL.port - else PORT_PLAINTEXT.port, - secure = sslEnabled.isChecked - ) - ) - ) - data.putInt("network_id", -1) - } - } - - override fun onCreateContent(inflater: LayoutInflater, container: ViewGroup?, - savedInstanceState: Bundle?): View { - val view = inflater.inflate(R.layout.setup_network_network, container, false) - ButterKnife.bind(this, view) - nameValidator = object : TextValidator( - requireActivity(), nameWrapper::setError, resources.getString(R.string.hint_invalid_name) - ) { - override fun validate(text: Editable) = text.isNotBlank() - - override fun onChanged() = updateValidity() - } - hostValidator = object : TextValidator( - requireActivity(), hostWrapper::setError, resources.getString(R.string.hint_invalid_host) - ) { - override fun validate(text: Editable) = - text.toString().matches(Patterns.DOMAIN_NAME) - - override fun onChanged() = updateValidity() - } - portValidator = object : TextValidator( - requireActivity(), portWrapper::setError, resources.getString(R.string.hint_invalid_port) - ) { - override fun validate(text: Editable) = text.toString().toIntOrNull() in (0 until 65536) - - override fun onChanged() = updateValidity() - } - - nameField.addTextChangedListener(nameValidator) - hostField.addTextChangedListener(hostValidator) - portField.addTextChangedListener(portValidator) - nameValidator.afterTextChanged(nameField.text) - hostValidator.afterTextChanged(hostField.text) - portValidator.afterTextChanged(portField.text) - - network.adapter = networkAdapter - network.onItemSelectedListener = object : AdapterView.OnItemSelectedListener { - fun selected(item: INetwork.NetworkInfo?) { - if (item == null) { - AnimationHelper.expand(networkGroup) - } else { - AnimationHelper.collapse(networkGroup) - } - updateValidity() - } - - override fun onNothingSelected(parent: AdapterView<*>?) = selected(null) - - override fun onItemSelected(parent: AdapterView<*>?, view: View?, position: Int, id: Long) = - selected(networkAdapter.getItem(position)) - } - - identity.adapter = identityAdapter - - modelHelper.identities.safeSwitchMap { - combineLatest(it.values.map(Identity::liveUpdates)).map { - it.sortedBy(Identity::identityName) - } - }.toLiveData().observe(viewLifecycleOwner, Observer { - if (it != null) { - identityAdapter.submitList(it) - } - }) - - modelHelper.networks.safeSwitchMap { - combineLatest(it.values.map(Network::liveNetworkInfo)).map { - it.sortedWith(compareBy(String.CASE_INSENSITIVE_ORDER, INetwork.NetworkInfo::networkName)) - } - }.toLiveData().observe(viewLifecycleOwner, Observer { - if (it != null) { - this.networks = it - update() - } - }) - - identity.adapter = identityAdapter - - sslEnabled.setOnCheckedChangeListener { _, isChecked -> - val portValue = portField.text.trim().toString() - if (isChecked && portValue == PORT_PLAINTEXT.port.toString()) { - portField.setText(PORT_SSL.port.toString()) - } else if (!isChecked && portValue == PORT_SSL.port.toString()) { - portField.setText(PORT_PLAINTEXT.port.toString()) - } - } - - return view - } - - private var hasSetUi = false - private var hasSetNetwork = false - - private fun update() { - val data = this.data - val networks = this.networks - - if (data != null && networks != null) { - networkAdapter.submitList(listOf(null) + networks) - val linkNetwork = data.getSerializable("network") as? LinkNetwork - - val selectedNetworkId = if (data.containsKey("network_id")) { - NetworkId(data.getInt("network_id")) - } else { - val existingNetwork = networks.firstOrNull { - it.serverList.any { - it.host == linkNetwork?.server?.host - } - } - existingNetwork?.networkId - } - val selectedNetworkPosition = networkAdapter.indexOf(selectedNetworkId ?: NetworkId(-1)) ?: -1 - - if (!hasSetNetwork) { - if (selectedNetworkPosition != -1 || selectedNetworkId?.isValidId() != true) { - network.setSelection(selectedNetworkPosition) - hasSetNetwork = true - } - } - - if (!hasSetUi) { - if (linkNetwork != null && !hasSetUi) { - nameField.setText(linkNetwork.name) - hostField.setText(linkNetwork.server.host) - portField.setText("${linkNetwork.server.port}") - sslEnabled.isChecked = linkNetwork.server.secure - } - - if (data.containsKey("identity")) { - val identity = IdentityId(data.getInt("identity", -1)) - if (identity.isValidId()) { - val position = identityAdapter.indexOf(identity) - if (position == -1) { - this.identity.setSelection(-1) - } - } - } - } - - updateValidity() - } - } - - private lateinit var nameValidator: TextValidator - private lateinit var hostValidator: TextValidator - private lateinit var portValidator: TextValidator -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/ui/setup/user/DefaultNetworkAdapter.kt b/app/src/main/java/de/kuschku/quasseldroid/ui/setup/user/DefaultNetworkAdapter.kt deleted file mode 100644 index 9f8ebb44701c196b310334303afc605b53ec2bcd..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/ui/setup/user/DefaultNetworkAdapter.kt +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.ui.setup.user - -import android.view.LayoutInflater -import android.view.ViewGroup -import androidx.appcompat.widget.ThemedSpinnerAdapter -import androidx.recyclerview.widget.RecyclerView -import de.kuschku.quasseldroid.R -import de.kuschku.quasseldroid.databinding.WidgetSpinnerItemMaterialBinding -import de.kuschku.quasseldroid.defaults.DefaultNetwork -import de.kuschku.quasseldroid.defaults.DefaultNetworks -import de.kuschku.quasseldroid.util.ui.ContextThemeWrapper -import de.kuschku.quasseldroid.util.ui.RecyclerSpinnerAdapter -import javax.inject.Inject - -class DefaultNetworkAdapter @Inject constructor(defaultNetworks: DefaultNetworks) : - RecyclerSpinnerAdapter<DefaultNetworkAdapter.DefaultNetworkViewHolder>(), ThemedSpinnerAdapter { - private val data: List<DefaultNetwork?> = defaultNetworks.networks + (null as DefaultNetwork?) - - override fun isEmpty() = data.isEmpty() - - override fun onBindViewHolder(holder: DefaultNetworkViewHolder, position: Int) = - holder.bind(getItem(position)) - - override fun onCreateViewHolder(parent: ViewGroup, dropDown: Boolean): DefaultNetworkViewHolder { - val inflater = LayoutInflater.from( - if (dropDown) - ContextThemeWrapper(parent.context, dropDownViewTheme) - else - parent.context - ) - return DefaultNetworkViewHolder( - WidgetSpinnerItemMaterialBinding.inflate(inflater, parent, false) - ) - } - - override fun getItem(position: Int) = data[position] - - override fun getCount() = data.size - - fun default() = data.filterNotNull().firstOrNull(DefaultNetwork::default) - - fun indexOf(value: DefaultNetwork?) = data.indexOf(value) - - override fun getItemId(position: Int) = position.toLong() - - class DefaultNetworkViewHolder( - private val binding: WidgetSpinnerItemMaterialBinding - ) : RecyclerView.ViewHolder(binding.root) { - fun bind(network: DefaultNetwork?) { - network?.let { - binding.text1.text = it.name - } ?: binding.text1.setText(R.string.label_network_custom) - } - } -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/ui/setup/user/UserSetupActivity.kt b/app/src/main/java/de/kuschku/quasseldroid/ui/setup/user/UserSetupActivity.kt deleted file mode 100644 index d64568fc4e24a6c061a00e41e304a505501e7b61..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/ui/setup/user/UserSetupActivity.kt +++ /dev/null @@ -1,101 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.ui.setup.user - -import android.app.Activity -import android.content.Context -import android.content.Intent -import android.os.Bundle -import androidx.lifecycle.Observer -import de.kuschku.libquassel.protocol.IdentityId -import de.kuschku.libquassel.quassel.syncables.Identity -import de.kuschku.libquassel.quassel.syncables.interfaces.INetwork -import de.kuschku.libquassel.util.helper.value -import de.kuschku.quasseldroid.R -import de.kuschku.quasseldroid.defaults.DefaultNetwork -import de.kuschku.quasseldroid.defaults.Defaults -import de.kuschku.quasseldroid.ui.setup.ServiceBoundSetupActivity -import de.kuschku.quasseldroid.util.helper.toLiveData -import de.kuschku.quasseldroid.viewmodel.helper.EditorViewModelHelper -import java.util.* -import javax.inject.Inject - -class UserSetupActivity : ServiceBoundSetupActivity() { - @Inject - lateinit var modelHelper: EditorViewModelHelper - - override val initData - get() = Bundle().apply { - putString("nick", getString(R.string.default_identity_nick, Random().nextInt(16))) - putString("realname", getString(R.string.default_identity_realname)) - } - - override fun onDone(data: Bundle) { - val network = data.getSerializable("network") as? DefaultNetwork - if (network != null) { - modelHelper.backend?.value?.ifPresent { backend -> - modelHelper.connectedSession.value?.orNull()?.rpcHandler?.apply { - createIdentity(Defaults.identity(this@UserSetupActivity).apply { - setIdentityName(this@UserSetupActivity.getString(R.string.default_identity_identity_name)) - setNicks(listOf(data.getString("nick"))) - setRealName(data.getString("realname")) - }, emptyMap()) - - modelHelper.identities - .map(Map<IdentityId, Identity>::values) - .filter(Collection<Identity>::isNotEmpty) - .map(Collection<Identity>::first) - .firstElement() - .toLiveData().observe(this@UserSetupActivity, Observer { - if (it != null) { - createNetwork(INetwork.NetworkInfo( - networkName = network.name, - identity = it.id(), - serverList = network.servers.map { - INetwork.Server( - host = it.host, - port = it.port, - useSsl = it.secure - ) - } - ), data.getStringArray("channels")?.toList().orEmpty()) - - backend.requestConnectNewNetwork() - } - }) - } - } - } - - setResult(Activity.RESULT_OK) - finish() - } - - override val fragments = listOf( - UserSetupIdentitySlide(), - UserSetupNetworkSlide(), - UserSetupChannelsSlide() - ) - - companion object { - fun launch(context: Context) = context.startActivity(intent(context)) - fun intent(context: Context) = Intent(context, UserSetupActivity::class.java) - } -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/ui/setup/user/UserSetupChannelsSlide.kt b/app/src/main/java/de/kuschku/quasseldroid/ui/setup/user/UserSetupChannelsSlide.kt deleted file mode 100644 index 5a90d08669cb8249615841b69d326a000a6791be..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/ui/setup/user/UserSetupChannelsSlide.kt +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.ui.setup.user - -import android.os.Bundle -import android.view.LayoutInflater -import android.view.View -import android.view.ViewGroup -import android.widget.EditText -import butterknife.BindView -import butterknife.ButterKnife -import com.google.android.material.textfield.TextInputLayout -import de.kuschku.quasseldroid.R -import de.kuschku.quasseldroid.defaults.DefaultNetwork -import de.kuschku.quasseldroid.ui.setup.SlideFragment - -class UserSetupChannelsSlide : SlideFragment() { - @BindView(R.id.channelsWrapper) - lateinit var channelsWrapper: TextInputLayout - - @BindView(R.id.channels) - lateinit var channelsField: EditText - - override fun isValid() = true - - override val title = R.string.slide_user_channels_title - override val description = R.string.slide_user_channels_description - - override fun setData(data: Bundle) { - if (data.containsKey("channels")) - channelsField.setText(data.getStringArray("channels")?.joinToString("\n")) - else if (data.containsKey("network")) - (data.getSerializable("network") as? DefaultNetwork)?.let { - channelsField.setText(it.defaultChannels.joinToString("\n")) - } - updateValidity() - } - - override fun getData(data: Bundle) { - data.putStringArray("channels", - channelsField.text.toString() - .split('\n', ' ', ',', ';') - .map(String::trim) - .filter(String::isNotBlank) - .toTypedArray() - ) - } - - override fun onCreateContent(inflater: LayoutInflater, container: ViewGroup?, - savedInstanceState: Bundle?): View { - val view = inflater.inflate(R.layout.setup_user_channels, container, false) - ButterKnife.bind(this, view) - return view - } -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/ui/setup/user/UserSetupFragmentProvider.kt b/app/src/main/java/de/kuschku/quasseldroid/ui/setup/user/UserSetupFragmentProvider.kt deleted file mode 100644 index e76e3f416a51865f15736bb517a99e3f34aabe14..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/ui/setup/user/UserSetupFragmentProvider.kt +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.ui.setup.user - -import androidx.fragment.app.FragmentActivity -import dagger.Binds -import dagger.Module -import dagger.android.ContributesAndroidInjector - -@Module -abstract class UserSetupFragmentProvider { - @Binds - abstract fun bindFragmentActivity(activity: UserSetupActivity): FragmentActivity - - @ContributesAndroidInjector - abstract fun bindUserSetupIdentitySlide(): UserSetupIdentitySlide - - @ContributesAndroidInjector - abstract fun bindUserSetupNetworkSlide(): UserSetupNetworkSlide - - @ContributesAndroidInjector - abstract fun bindUserSetupChannelsSlide(): UserSetupChannelsSlide -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/ui/setup/user/UserSetupIdentitySlide.kt b/app/src/main/java/de/kuschku/quasseldroid/ui/setup/user/UserSetupIdentitySlide.kt deleted file mode 100644 index e3150505dc036a3c24c6afaab605e14ab6b24095..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/ui/setup/user/UserSetupIdentitySlide.kt +++ /dev/null @@ -1,96 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.ui.setup.user - -import android.os.Bundle -import android.text.Editable -import android.view.LayoutInflater -import android.view.View -import android.view.ViewGroup -import android.widget.EditText -import butterknife.BindView -import butterknife.ButterKnife -import com.google.android.material.textfield.TextInputLayout -import de.kuschku.quasseldroid.R -import de.kuschku.quasseldroid.ui.setup.SlideFragment -import de.kuschku.quasseldroid.util.Patterns -import de.kuschku.quasseldroid.util.TextValidator -import de.kuschku.quasseldroid.util.irc.format.IrcFormatDeserializer -import de.kuschku.quasseldroid.util.irc.format.IrcFormatSerializer -import javax.inject.Inject - -class UserSetupIdentitySlide : SlideFragment() { - @BindView(R.id.nickWrapper) - lateinit var nickWrapper: TextInputLayout - - @BindView(R.id.nick) - lateinit var nickField: EditText - - @BindView(R.id.realnameWrapper) - lateinit var realnameWrapper: TextInputLayout - - @BindView(R.id.realname) - lateinit var realnameField: EditText - - @Inject - lateinit var ircFormatSerializer: IrcFormatSerializer - - @Inject - lateinit var ircFormatDeserializer: IrcFormatDeserializer - - override fun isValid(): Boolean { - return nickValidator.isValid - } - - override val title = R.string.slide_user_identity_title - override val description = R.string.slide_user_identity_description - - override fun setData(data: Bundle) { - if (data.containsKey("nick")) - nickField.setText(data.getString("nick")) - if (data.containsKey("realname")) - realnameField.setText(ircFormatDeserializer.formatString(data.getString("realname"), true)) - updateValidity() - } - - override fun getData(data: Bundle) { - data.putString("nick", nickField.text.toString()) - data.putString("realname", ircFormatSerializer.toEscapeCodes(realnameField.text)) - } - - override fun onCreateContent(inflater: LayoutInflater, container: ViewGroup?, - savedInstanceState: Bundle?): View { - val view = inflater.inflate(R.layout.setup_user_identity, container, false) - ButterKnife.bind(this, view) - nickValidator = object : TextValidator( - requireActivity(), nickWrapper::setError, resources.getString(R.string.hint_invalid_nick) - ) { - override fun validate(text: Editable) = text.isNotEmpty() && text.matches(Patterns.IRC_NICK) - - override fun onChanged() = updateValidity() - } - - nickField.addTextChangedListener(nickValidator) - nickValidator.afterTextChanged(nickField.text) - return view - } - - private lateinit var nickValidator: TextValidator -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/ui/setup/user/UserSetupNetworkSlide.kt b/app/src/main/java/de/kuschku/quasseldroid/ui/setup/user/UserSetupNetworkSlide.kt deleted file mode 100644 index 16a7c26fe7e964995c0ebe916a644017badc9a5f..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/ui/setup/user/UserSetupNetworkSlide.kt +++ /dev/null @@ -1,195 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.ui.setup.user - -import android.os.Bundle -import android.text.Editable -import android.view.LayoutInflater -import android.view.View -import android.view.ViewGroup -import android.widget.AdapterView -import android.widget.EditText -import android.widget.Spinner -import androidx.appcompat.widget.SwitchCompat -import butterknife.BindView -import butterknife.ButterKnife -import com.google.android.material.textfield.TextInputLayout -import de.kuschku.libquassel.quassel.syncables.interfaces.INetwork.PortDefaults.PORT_PLAINTEXT -import de.kuschku.libquassel.quassel.syncables.interfaces.INetwork.PortDefaults.PORT_SSL -import de.kuschku.libquassel.util.helper.nullIf -import de.kuschku.quasseldroid.R -import de.kuschku.quasseldroid.defaults.DefaultNetwork -import de.kuschku.quasseldroid.defaults.DefaultNetworkServer -import de.kuschku.quasseldroid.ui.setup.SlideFragment -import de.kuschku.quasseldroid.util.Patterns -import de.kuschku.quasseldroid.util.TextValidator -import de.kuschku.quasseldroid.util.ui.AnimationHelper -import javax.inject.Inject - -class UserSetupNetworkSlide : SlideFragment() { - @BindView(R.id.network) - lateinit var network: Spinner - - @BindView(R.id.network_group) - lateinit var networkGroup: ViewGroup - - @BindView(R.id.nameWrapper) - lateinit var nameWrapper: TextInputLayout - - @BindView(R.id.name) - lateinit var nameField: EditText - - @BindView(R.id.hostWrapper) - lateinit var hostWrapper: TextInputLayout - - @BindView(R.id.host) - lateinit var hostField: EditText - - @BindView(R.id.portWrapper) - lateinit var portWrapper: TextInputLayout - - @BindView(R.id.port) - lateinit var portField: EditText - - @BindView(R.id.ssl_enabled) - lateinit var sslEnabled: SwitchCompat - - @Inject - lateinit var networkAdapter: DefaultNetworkAdapter - - override fun isValid(): Boolean { - return (this.network.selectedItemPosition != -1 && - networkAdapter.getItem(this.network.selectedItemPosition) != null) || - (nameValidator.isValid && hostValidator.isValid && portValidator.isValid) - } - - override val title = R.string.slide_user_network_title - override val description = R.string.slide_user_network_description - - override fun setData(data: Bundle) { - if (data.containsKey("network")) { - val network = data.getSerializable("network") as? DefaultNetwork - ?: networkAdapter.default() - if (network != null) { - val position = networkAdapter.indexOf(network) - if (position == -1) { - this.network.setSelection(networkAdapter.indexOf(null)) - network.servers.firstOrNull()?.let { - this.hostField.setText(it.host) - this.portField.setText(it.port.toString()) - this.sslEnabled.isChecked = it.secure - } - } - } - } - updateValidity() - } - - override fun getData(data: Bundle) { - data.putSerializable( - "network", - networkAdapter.getItem(this.network.selectedItemPosition) - ?: DefaultNetwork( - name = nameField.text.toString(), - servers = listOf( - DefaultNetworkServer( - host = hostField.text.toString(), - port = portField.text.toString().toUIntOrNull() - ?: if (sslEnabled.isChecked) PORT_SSL.port - else PORT_PLAINTEXT.port, - secure = sslEnabled.isChecked - ) - ) - ) - ) - } - - override fun onCreateContent(inflater: LayoutInflater, container: ViewGroup?, - savedInstanceState: Bundle?): View { - val view = inflater.inflate(R.layout.setup_user_network, container, false) - ButterKnife.bind(this, view) - nameValidator = object : TextValidator( - requireActivity(), nameWrapper::setError, resources.getString(R.string.hint_invalid_name) - ) { - override fun validate(text: Editable) = text.isNotBlank() - - override fun onChanged() = updateValidity() - } - hostValidator = object : TextValidator( - requireActivity(), hostWrapper::setError, resources.getString(R.string.hint_invalid_host) - ) { - override fun validate(text: Editable) = - text.toString().matches(Patterns.DOMAIN_NAME) - - override fun onChanged() = updateValidity() - } - portValidator = object : TextValidator( - requireActivity(), portWrapper::setError, resources.getString(R.string.hint_invalid_port) - ) { - override fun validate(text: Editable) = text.toString().toIntOrNull() in (0 until 65536) - - override fun onChanged() = updateValidity() - } - - nameField.addTextChangedListener(nameValidator) - hostField.addTextChangedListener(hostValidator) - portField.addTextChangedListener(portValidator) - nameValidator.afterTextChanged(nameField.text) - hostValidator.afterTextChanged(hostField.text) - portValidator.afterTextChanged(portField.text) - - network.adapter = networkAdapter - network.onItemSelectedListener = object : AdapterView.OnItemSelectedListener { - fun selected(item: DefaultNetwork?) { - if (item == null) { - AnimationHelper.expand(networkGroup) - } else { - AnimationHelper.collapse(networkGroup) - } - updateValidity() - } - - override fun onNothingSelected(parent: AdapterView<*>?) = selected(null) - - override fun onItemSelected(parent: AdapterView<*>?, view: View?, position: Int, id: Long) = - selected(networkAdapter.getItem(position)) - } - networkAdapter.default()?.let { - networkAdapter.indexOf(it).nullIf { it == -1 }?.let { - network.setSelection(it) - } - } - - sslEnabled.setOnCheckedChangeListener { _, isChecked -> - val portValue = portField.text.trim().toString() - if (isChecked && portValue == PORT_PLAINTEXT.port.toString()) { - portField.setText(PORT_SSL.port.toString()) - } else if (!isChecked && portValue == PORT_SSL.port.toString()) { - portField.setText(PORT_PLAINTEXT.port.toString()) - } - } - - return view - } - - private lateinit var nameValidator: TextValidator - private lateinit var hostValidator: TextValidator - private lateinit var portValidator: TextValidator -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/ui/theme/Color.kt b/app/src/main/java/de/kuschku/quasseldroid/ui/theme/Color.kt new file mode 100644 index 0000000000000000000000000000000000000000..0826e9e5f4ba940a02c52db6d3282537ba6038ac --- /dev/null +++ b/app/src/main/java/de/kuschku/quasseldroid/ui/theme/Color.kt @@ -0,0 +1,8 @@ +package de.kuschku.quasseldroid.ui.theme + +import androidx.compose.ui.graphics.Color + +val purple200 = Color(0xFFBB86FC) +val purple500 = Color(0xFF6200EE) +val purple700 = Color(0xFF3700B3) +val teal200 = Color(0xFF03DAC5) \ No newline at end of file diff --git a/app/src/main/java/de/kuschku/quasseldroid/ui/theme/Shape.kt b/app/src/main/java/de/kuschku/quasseldroid/ui/theme/Shape.kt new file mode 100644 index 0000000000000000000000000000000000000000..cbd3ea71cf3490886223db02b00a908cd26b4fa1 --- /dev/null +++ b/app/src/main/java/de/kuschku/quasseldroid/ui/theme/Shape.kt @@ -0,0 +1,11 @@ +package de.kuschku.quasseldroid.ui.theme + +import androidx.compose.foundation.shape.RoundedCornerShape +import androidx.compose.material.Shapes +import androidx.compose.ui.unit.dp + +val shapes = Shapes( + small = RoundedCornerShape(4.dp), + medium = RoundedCornerShape(4.dp), + large = RoundedCornerShape(0.dp) +) \ No newline at end of file diff --git a/app/src/main/java/de/kuschku/quasseldroid/ui/theme/Theme.kt b/app/src/main/java/de/kuschku/quasseldroid/ui/theme/Theme.kt new file mode 100644 index 0000000000000000000000000000000000000000..5e9387128ddf2b08f7affa441faa50d65bc393db --- /dev/null +++ b/app/src/main/java/de/kuschku/quasseldroid/ui/theme/Theme.kt @@ -0,0 +1,44 @@ +package de.kuschku.quasseldroid.ui.theme + +import androidx.compose.foundation.isSystemInDarkTheme +import androidx.compose.material.MaterialTheme +import androidx.compose.material.darkColors +import androidx.compose.material.lightColors +import androidx.compose.runtime.Composable + +private val DarkColorPalette = darkColors( + primary = purple200, + primaryVariant = purple700, + secondary = teal200 +) + +private val LightColorPalette = lightColors( + primary = purple500, + primaryVariant = purple700, + secondary = teal200 + + /* Other default colors to override + background = Color.White, + surface = Color.White, + onPrimary = Color.White, + onSecondary = Color.Black, + onBackground = Color.Black, + onSurface = Color.Black, + */ +) + +@Composable +fun QuasseldroidTheme(darkTheme: Boolean = isSystemInDarkTheme(), content: @Composable() () -> Unit) { + val colors = if (darkTheme) { + DarkColorPalette + } else { + LightColorPalette + } + + MaterialTheme( + colors = colors, + typography = typography, + shapes = shapes, + content = content + ) +} \ No newline at end of file diff --git a/app/src/main/java/de/kuschku/quasseldroid/ui/theme/Type.kt b/app/src/main/java/de/kuschku/quasseldroid/ui/theme/Type.kt new file mode 100644 index 0000000000000000000000000000000000000000..88852f35d0d7fde4d5ba1d68512a041767e34a07 --- /dev/null +++ b/app/src/main/java/de/kuschku/quasseldroid/ui/theme/Type.kt @@ -0,0 +1,28 @@ +package de.kuschku.quasseldroid.ui.theme + +import androidx.compose.material.Typography +import androidx.compose.ui.text.TextStyle +import androidx.compose.ui.text.font.FontFamily +import androidx.compose.ui.text.font.FontWeight +import androidx.compose.ui.unit.sp + +// Set of Material typography styles to start with +val typography = Typography( + body1 = TextStyle( + fontFamily = FontFamily.Default, + fontWeight = FontWeight.Normal, + fontSize = 16.sp + ) + /* Other default text styles to override + button = TextStyle( + fontFamily = FontFamily.Default, + fontWeight = FontWeight.W500, + fontSize = 14.sp + ), + caption = TextStyle( + fontFamily = FontFamily.Default, + fontWeight = FontWeight.Normal, + fontSize = 12.sp + ) + */ +) \ No newline at end of file diff --git a/app/src/main/java/de/kuschku/quasseldroid/util/AndroidHandlerThread.kt b/app/src/main/java/de/kuschku/quasseldroid/util/AndroidHandlerThread.kt deleted file mode 100644 index d6eb1e305dff3b08e56726650298db2c2282e93c..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/util/AndroidHandlerThread.kt +++ /dev/null @@ -1,190 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.util - -import android.os.Handler -import android.os.HandlerThread -import android.os.Looper -import android.os.Message -import android.util.Printer - -class AndroidHandlerThread(name: String) : HandlerThread(name) { - @Volatile - private var handler: Handler? = - null - - private fun started(): AndroidHandlerThread { - onCreate() - return this - } - - fun onCreate() { - if (handler == null) { - synchronized(this@AndroidHandlerThread) { - if (handler == null) { - start() - handler = Handler(looper) - } - } - } - } - - fun onDestroy() { - if (handler != null) { - post { - quit() - if (handler != null) { - synchronized(this@AndroidHandlerThread) { - if (handler != null) { - handler = null - } - } - } - } - } - } - - fun handleMessage(msg: Message) = - started().let { handler?.handleMessage(msg) } - ?: throw RuntimeException("Thread not started") - - fun dispatchMessage(msg: Message) = - started().let { handler?.dispatchMessage(msg) } - ?: throw RuntimeException("Thread not started") - - fun getMessageName(message: Message): String = - started().let { handler?.getMessageName(message) } - ?: throw RuntimeException("Thread not started") - - fun obtainMessage(): Message = - started().let { handler?.obtainMessage() } - ?: throw RuntimeException("Thread not started") - - fun obtainMessage(what: Int): Message = - started().let { handler?.obtainMessage(what) } - ?: throw RuntimeException("Thread not started") - - fun obtainMessage(what: Int, obj: Any): Message = - started().let { handler?.obtainMessage(what, obj) } - ?: throw RuntimeException("Thread not started") - - fun obtainMessage(what: Int, arg1: Int, arg2: Int): Message = - started().let { handler?.obtainMessage(what, arg1, arg2) } - ?: throw RuntimeException("Thread not started") - - fun obtainMessage(what: Int, arg1: Int, arg2: Int, obj: Any): Message = - started().let { handler?.obtainMessage(what, arg1, arg2, obj) } - ?: throw RuntimeException("Thread not started") - - fun post(r: () -> Unit): Boolean = - started().let { handler?.post(r) } - ?: throw RuntimeException("Thread not started") - - fun postAtTime(r: () -> Unit, uptimeMillis: Long): Boolean = - started().let { handler?.postAtTime(r, uptimeMillis) } - ?: throw RuntimeException("Thread not started") - - fun postAtTime(r: () -> Unit, token: Any, uptimeMillis: Long): Boolean = - started().let { handler?.postAtTime(r, token, uptimeMillis) } - ?: throw RuntimeException("Thread not started") - - fun postDelayed(r: () -> Unit, delayMillis: Long): Boolean = - started().let { handler?.postDelayed(r, delayMillis) } - ?: throw RuntimeException("Thread not started") - - fun postAtFrontOfQueue(r: () -> Unit): Boolean = - started().let { handler?.postAtFrontOfQueue(r) } - ?: throw RuntimeException("Thread not started") - - fun removeCallbacks(r: () -> Unit) = - started().let { handler?.removeCallbacks(r) } - ?: throw RuntimeException("Thread not started") - - fun removeCallbacks(r: () -> Unit, token: Any) = - started().let { handler?.removeCallbacks(r, token) } - ?: throw RuntimeException("Thread not started") - - fun sendMessage(msg: Message): Boolean = - started().let { handler?.sendMessage(msg) } - ?: throw RuntimeException("Thread not started") - - fun sendEmptyMessage(what: Int): Boolean = - started().let { handler?.sendEmptyMessage(what) } - ?: throw RuntimeException("Thread not started") - - fun sendEmptyMessageDelayed(what: Int, delayMillis: Long): Boolean = - started().let { handler?.sendEmptyMessageDelayed(what, delayMillis) } - ?: throw RuntimeException( - "Thread not started" - ) - - fun sendEmptyMessageAtTime(what: Int, uptimeMillis: Long): Boolean = - started().let { handler?.sendEmptyMessageAtTime(what, uptimeMillis) } - ?: throw RuntimeException( - "Thread not started" - ) - - fun sendMessageDelayed(msg: Message, delayMillis: Long): Boolean = - started().let { handler?.sendMessageDelayed(msg, delayMillis) } - ?: throw RuntimeException("Thread not started") - - fun sendMessageAtTime(msg: Message, uptimeMillis: Long): Boolean = - started().let { handler?.sendMessageAtTime(msg, uptimeMillis) } - ?: throw RuntimeException("Thread not started") - - fun sendMessageAtFrontOfQueue(msg: Message): Boolean = - started().let { handler?.sendMessageAtFrontOfQueue(msg) } - ?: throw RuntimeException("Thread not started") - - fun removeMessages(what: Int) = - started().let { handler?.removeMessages(what) } - ?: throw RuntimeException("Thread not started") - - fun removeMessages(what: Int, `object`: Any) = - started().let { handler?.removeMessages(what, `object`) } - ?: throw RuntimeException("Thread not started") - - fun removeCallbacksAndMessages(token: Any) = - started().let { handler?.removeCallbacksAndMessages(token) } - ?: throw RuntimeException("Thread not started") - - fun hasMessages(what: Int): Boolean = - started().let { handler?.hasMessages(what) } - ?: throw RuntimeException("Thread not started") - - fun hasMessages(what: Int, `object`: Any): Boolean = - started().let { handler?.hasMessages(what, `object`) } - ?: throw RuntimeException("Thread not started") - - val handlerLooper: Looper - get() - - = - started().let { handler?.looper } - ?: throw RuntimeException("Thread not started") - - fun dump(pw: Printer, prefix: String) = - started().let { handler?.dump(pw, prefix) } - ?: throw RuntimeException("Thread not started") - - override fun toString(): String = - started().let { handler?.toString() } - ?: throw RuntimeException("Thread not started") -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/util/ColorContext.kt b/app/src/main/java/de/kuschku/quasseldroid/util/ColorContext.kt deleted file mode 100644 index 3a13e32a7aad4fa534960d9c1927809eb2ef33c2..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/util/ColorContext.kt +++ /dev/null @@ -1,94 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.util - -import android.content.Context -import android.graphics.Typeface -import androidx.annotation.ColorInt -import de.kuschku.libquassel.util.irc.SenderColorUtil -import de.kuschku.quasseldroid.R -import de.kuschku.quasseldroid.settings.MessageSettings -import de.kuschku.quasseldroid.util.helper.styledAttributes -import de.kuschku.quasseldroid.util.ui.drawable.TextDrawable -import de.kuschku.quasseldroid.viewmodel.helper.EditorViewModelHelper.Companion.IGNORED_CHARS -import javax.inject.Inject - -class ColorContext @Inject constructor( - context: Context, - private val messageSettings: MessageSettings -) { - private val senderColors = context.theme.styledAttributes( - R.attr.senderColor0, R.attr.senderColor1, R.attr.senderColor2, R.attr.senderColor3, - R.attr.senderColor4, R.attr.senderColor5, R.attr.senderColor6, R.attr.senderColor7, - R.attr.senderColor8, R.attr.senderColor9, R.attr.senderColorA, R.attr.senderColorB, - R.attr.senderColorC, R.attr.senderColorD, R.attr.senderColorE, R.attr.senderColorF - ) { - IntArray(length()) { - getColor(it, 0) - } - } - - private val selfColor = context.theme.styledAttributes(R.attr.colorForegroundSecondary) { - getColor(0, 0) - } - - private val textColor = context.theme.styledAttributes(R.attr.colorBackground) { - getColor(0, 0) - } - - val colorAccent = context.theme.styledAttributes(R.attr.colorAccent) { - getColor(0, 0) - } - - val colorAway = context.theme.styledAttributes(R.attr.colorAway) { - getColor(0, 0) - } - - val avatarRadius = context.resources.getDimensionPixelSize(R.dimen.avatar_radius) - val avatarSize = context.resources.getDimensionPixelSize(R.dimen.avatar_size_buffer) - - fun prepareTextDrawable(@ColorInt textColor: Int = this.textColor): TextDrawable.IShapeBuilder = - TextDrawable.builder() - .beginConfig() - .textColor(setAlpha(textColor, 0x8A)) - .useFont(Typeface.DEFAULT_BOLD) - .endConfig() - - fun buildTextDrawable(initial: String, @ColorInt backgroundColor: Int): TextDrawable = - prepareTextDrawable(textColor).let { - if (messageSettings.squareAvatars) it.buildRoundRect(initial, backgroundColor, avatarRadius) - else it.buildRound(initial, backgroundColor) - } - - fun buildTextDrawable(nickName: String, self: Boolean): TextDrawable { - val senderColorIndex = SenderColorUtil.senderColor(nickName) - val rawInitial = nickName.trimStart(*IGNORED_CHARS).firstOrNull() - ?: nickName.firstOrNull() - val initial = rawInitial?.toUpperCase().toString() - val senderColor = if (self) selfColor else senderColors[senderColorIndex] - - return buildTextDrawable(initial, senderColor) - } - - companion object { - @ColorInt - private fun setAlpha(@ColorInt color: Int, alpha: Int) = (color and 0xFFFFFF) or (alpha shl 24) - } -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/util/NotificationBuffer.kt b/app/src/main/java/de/kuschku/quasseldroid/util/NotificationBuffer.kt deleted file mode 100644 index 99a8c32292e0b602ddbb5bc4a5189b277040fdf7..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/util/NotificationBuffer.kt +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.util - -import de.kuschku.libquassel.protocol.BufferId -import de.kuschku.libquassel.protocol.Buffer_Types - -data class NotificationBuffer( - val id: BufferId, - val type: Buffer_Types, - val name: String, - val networkName: String -) diff --git a/app/src/main/java/de/kuschku/quasseldroid/util/NotificationMessage.kt b/app/src/main/java/de/kuschku/quasseldroid/util/NotificationMessage.kt deleted file mode 100644 index 60008aab1d5f27c3133cfce81b4d395c4fecca6a..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/util/NotificationMessage.kt +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.util - -import android.graphics.drawable.Drawable -import de.kuschku.libquassel.protocol.MsgId -import org.threeten.bp.Instant - -data class NotificationMessage( - val messageId: MsgId, - val fullSender: String, - val sender: CharSequence, - val content: CharSequence, - val time: Instant, - val avatar: Drawable -) diff --git a/app/src/main/java/de/kuschku/quasseldroid/util/Patterns.kt b/app/src/main/java/de/kuschku/quasseldroid/util/Patterns.kt deleted file mode 100644 index 6d168b88b8e3b8a4442ddedbd079fa05968f2537..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/util/Patterns.kt +++ /dev/null @@ -1,131 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.util - -import de.kuschku.quasseldroid.util.emoji.EmojiData -import org.intellij.lang.annotations.Language - -@SuppressWarnings("Access") -object Patterns { - @Language("RegExp") - const val WORD_BOUNDARY = "(?:\\b|$|^)" - - @Language("RegExp") - const val IPv4 = "(?:(?:[0-1]?[0-9]?[0-9]|2[0-5][0-5])\\.){3}(?:[0-1]?[0-9]?[0-9]|2[0-5][0-5])" - - @Language("RegExp") - const val IPv6 = "(?:(?:(?:[0-9a-fA-F]{1,4}:){7}(?:[0-9a-fA-F]{1,4}))|(?:(?:(?:[0-9a-fA-F]{1,4}:){1,7}|:):(?:[0-9a-fA-F]{1,4}))|(?:(?:(?:[0-9a-fA-F]{1,4}:){1,6}|:):(?:[0-9a-fA-F]{1,4}:)?(?:[0-9a-fA-F]{1,4}))|(?:(?:(?:[0-9a-fA-F]{1,4}:){1,5}|:):(?:[0-9a-fA-F]{1,4}:){0,2}(?:[0-9a-fA-F]{1,4}))|(?:(?:(?:[0-9a-fA-F]{1,4}:){1,4}|:):(?:[0-9a-fA-F]{1,4}:){0,3}(?:[0-9a-fA-F]{1,4}))|(?:(?:(?:[0-9a-fA-F]{1,4}:){1,3}|:):(?:[0-9a-fA-F]{1,4}:){1,4}(?:[0-9a-fA-F]{1,4}))|(?:(?:(?:[0-9a-fA-F]{1,4}:){1,2}|:):(?:[0-9a-fA-F]{1,4}:){0,5}(?:[0-9a-fA-F]{1,4}))|(?:(?:(?:[0-9a-fA-F]{1,4}:)|:):(?:[0-9a-fA-F]{1,4}:){0,6}(?:[0-9a-fA-F]{1,4})))" - - @Language("RegExp") - const val IP_ADDRESS_STRING = """(?:$IPv4|$IPv6)""" - - @Language("RegExp") - const val UCS_CHAR = "[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF\uD800\uDC00-\uD83F\uDFFD\uD840\uDC00-\uD87F\uDFFD\uD880\uDC00-\uD8BF\uDFFD\uD8C0\uDC00-\uD8FF\uDFFD\uD900\uDC00-\uD93F\uDFFD\uD940\uDC00-\uD97F\uDFFD\uD980\uDC00-\uD9BF\uDFFD\uD9C0\uDC00-\uD9FF\uDFFD\uDA00\uDC00-\uDA3F\uDFFD\uDA40\uDC00-\uDA7F\uDFFD\uDA80\uDC00-\uDABF\uDFFD\uDAC0\uDC00-\uDAFF\uDFFD\uDB00\uDC00-\uDB3F\uDFFD\uDB44\uDC00-\uDB7F\uDFFD&&[^\u00A0[\u2000-\u200A]\u2028\u2029\u202F\u3000]]" - /** - * Valid characters for IRI label defined in RFC 3987. - */ - @Language("RegExp") - const val LABEL_CHAR = """a-zA-Z0-9$UCS_CHAR""" - /** - * Valid characters for IRI TLD defined in RFC 3987. - */ - @Language("RegExp") - const val TLD_CHAR = """a-zA-Z$UCS_CHAR""" - /** - * RFC 1035 Section 2.3.4 limits the labels to a maximum 63 octets. - */ - @Language("RegExp") - const val IRI_LABEL = """[$LABEL_CHAR](?:[${LABEL_CHAR}_\-]{0,61}[$LABEL_CHAR])?""" - /** - * RFC 3492 references RFC 1034 and limits Punycode algorithm output to 63 characters. - */ - @Language("RegExp") - const val PUNYCODE_TLD = """xn--[\w\-]{0,58}\w""" - - @Language("RegExp") - const val TLD = """(?:$PUNYCODE_TLD|[$TLD_CHAR]{2,63})""" - - @Language("RegExp") - const val HOST_NAME = """(?:$IRI_LABEL\.)+$TLD\.?""" - - @Language("RegExp") - const val LOCAL_HOST_NAME = """(?:$IRI_LABEL\.)*$IRI_LABEL""" - - @Language("RegExp") - const val DOMAIN_NAME_STR = """(?:$LOCAL_HOST_NAME|$HOST_NAME|$IP_ADDRESS_STRING)""" - val DOMAIN_NAME = Regex(DOMAIN_NAME_STR) - /** - * Regular expression for valid email characters. Does not include some of the valid characters - * defined in RFC5321: #&~!^`{}/=$*?| - */ - @Language("RegExp") - const val EMAIL_CHAR = """$LABEL_CHAR\+-_%'""" - - /** - * Regular expression for local part of an email address. RFC5321 section 4.5.3.1.1 limits - * the local part to be at most 64 octets. - */ - @Language("RegExp") - const val EMAIL_ADDRESS_LOCAL_PART = """[$EMAIL_CHAR](?:[$EMAIL_CHAR.]{0,62}[$EMAIL_CHAR])?""" - - /** - * Regular expression for the domain part of an email address. RFC5321 section 4.5.3.1.2 limits - * the domain to be at most 255 octets. - */ - @Language("RegExp") - const val EMAIL_ADDRESS_DOMAIN = """(?=.{1,255}(?:\s|$|^))$HOST_NAME""" - - - /** - * Regular expression pattern to match email addresses. It excludes double quoted local parts - * and the special characters #&~!^`{}/=$*?| that are included in RFC5321. - */ - @Language("RegExp") - val AUTOLINK_EMAIL_ADDRESS_STR = """($WORD_BOUNDARY(?:$EMAIL_ADDRESS_LOCAL_PART@$EMAIL_ADDRESS_DOMAIN)$WORD_BOUNDARY)""" - val AUTOLINK_EMAIL_ADDRESS = Regex(AUTOLINK_EMAIL_ADDRESS_STR) - - /** - * Regular expression pattern to match IRCCloud user idents. - */ - @Language("RegExp") - const val IRCCLOUD_IDENT_STR = """(?:~?)[us]id(\d+)""" - val IRCCLOUD_IDENT = Regex(IRCCLOUD_IDENT_STR) - - /** - * Regular expression pattern to match Matrix user realnames. - */ - @Language("RegExp") - const val MATRIX_REALNAME_STR = """^@[^:]+:$DOMAIN_NAME_STR$""" - val MATRIX_REALNAME = Regex(MATRIX_REALNAME_STR) - - @Language("RegExp") - const val IRC_NICK_STR = """[A-Za-z\x5b-\x60\x7b-\x7d][A-Za-z0-9\x5b-\x60\x7b-\x7d]*""" - val IRC_NICK = Regex(IRC_NICK_STR) - - /** - * Regular expression to detect emoji - */ - val EMOJI_STRING = EmojiData.emojis.joinToString( - prefix = """(?:\s|\Q""", - separator = """\E|\Q""", - postfix = """\E)+""" - ) - val EMOJI = Regex(EMOJI_STRING) -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/util/ShortcutCreationHelper.kt b/app/src/main/java/de/kuschku/quasseldroid/util/ShortcutCreationHelper.kt deleted file mode 100644 index 77d31d5a1a712245e910dba237a9b3a5906aef3e..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/util/ShortcutCreationHelper.kt +++ /dev/null @@ -1,137 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.util - -import android.content.Context -import android.content.Intent -import android.graphics.Bitmap -import android.graphics.Canvas -import android.graphics.drawable.Drawable -import androidx.core.content.pm.ShortcutInfoCompat -import androidx.core.content.pm.ShortcutManagerCompat -import androidx.core.graphics.drawable.IconCompat -import com.bumptech.glide.request.target.CustomTarget -import com.bumptech.glide.request.transition.Transition -import de.kuschku.libquassel.protocol.Buffer_Type -import de.kuschku.libquassel.quassel.BufferInfo -import de.kuschku.libquassel.quassel.syncables.IrcUser -import de.kuschku.libquassel.util.flag.hasFlag -import de.kuschku.libquassel.util.irc.SenderColorUtil -import de.kuschku.quasseldroid.GlideApp -import de.kuschku.quasseldroid.R -import de.kuschku.quasseldroid.persistence.util.AccountId -import de.kuschku.quasseldroid.settings.MessageSettings -import de.kuschku.quasseldroid.ui.chat.ChatActivity -import de.kuschku.quasseldroid.util.avatars.AvatarHelper -import de.kuschku.quasseldroid.util.helper.loadWithFallbacks -import de.kuschku.quasseldroid.util.helper.styledAttributes -import de.kuschku.quasseldroid.viewmodel.helper.EditorViewModelHelper.Companion.IGNORED_CHARS - -object ShortcutCreationHelper { - fun create(context: Context, - messageSettings: MessageSettings, - accountId: AccountId, - info: BufferInfo, - ircUser: IrcUser? = null) { - val bitmapSize = context.resources.getInteger(R.integer.shortcut_image_size) - - val callback: (IconCompat) -> Unit = { icon -> - ShortcutManagerCompat.requestPinShortcut( - context, - ShortcutInfoCompat.Builder(context, "${System.currentTimeMillis()}") - .setShortLabel(info.bufferName ?: "") - .setIcon(icon) - .setIntent( - ChatActivity.intent( - context, - bufferId = info.bufferId, - accountId = accountId.id - ).setAction(Intent.ACTION_VIEW) - ) - .build(), - null - ) - } - - val resultAvailable: (Drawable) -> Unit = { resource -> - val bitmap = Bitmap.createBitmap(bitmapSize, bitmapSize, Bitmap.Config.ARGB_8888) - val canvas = Canvas(bitmap) - resource.setBounds(0, 0, canvas.width, canvas.height) - resource.draw(canvas) - callback(IconCompat.createWithAdaptiveBitmap(bitmap)) - } - - val senderColors = context.theme.styledAttributes( - R.attr.senderColor0, R.attr.senderColor1, R.attr.senderColor2, R.attr.senderColor3, - R.attr.senderColor4, R.attr.senderColor5, R.attr.senderColor6, R.attr.senderColor7, - R.attr.senderColor8, R.attr.senderColor9, R.attr.senderColorA, R.attr.senderColorB, - R.attr.senderColorC, R.attr.senderColorD, R.attr.senderColorE, R.attr.senderColorF - ) { - IntArray(length()) { - getColor(it, 0) - } - } - - val colorContext = ColorContext(context, messageSettings) - - if (info.type.hasFlag(Buffer_Type.QueryBuffer)) { - val nickName = info.bufferName ?: "" - val senderColorIndex = SenderColorUtil.senderColor(nickName) - val rawInitial = nickName.trimStart(*IGNORED_CHARS).firstOrNull() - ?: nickName.firstOrNull() - val initial = rawInitial?.toUpperCase().toString() - val senderColor = senderColors[senderColorIndex] - - val fallback = colorContext.prepareTextDrawable() - .beginConfig() - .scale(0.5f) - .endConfig() - .buildRect(initial, senderColor) - - val urls = ircUser?.let { - AvatarHelper.avatar(messageSettings, it, bitmapSize) - } - - if (urls == null || urls.isEmpty()) { - resultAvailable(fallback) - } else { - GlideApp.with(context) - .loadWithFallbacks(urls) - ?.placeholder(fallback) - ?.into(object : CustomTarget<Drawable>(bitmapSize, bitmapSize) { - override fun onResourceReady(resource: Drawable, - transition: Transition<in Drawable>?) { - resultAvailable(resource) - } - - override fun onLoadFailed(errorDrawable: Drawable?) { - resultAvailable(errorDrawable!!) - } - - override fun onLoadCleared(placeholder: Drawable?) { - // do nothing, as we’ve already processed the drawable - } - }) - } - } else { - callback(IconCompat.createWithResource(context, R.drawable.ic_shortcut_channel)) - } - } -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/util/TextValidator.kt b/app/src/main/java/de/kuschku/quasseldroid/util/TextValidator.kt deleted file mode 100644 index 80d27b8bb342912b70682ba29c2fa2a20d08eee9..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/util/TextValidator.kt +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.util - -import android.app.Activity -import android.text.Editable -import android.text.TextWatcher - -abstract class TextValidator(private val activity: Activity?, - private val errorListener: (String?) -> Unit, - private val error: String) : TextWatcher { - override fun afterTextChanged(p0: Editable) { - isValid = validate(p0) - activity?.runOnUiThread { - errorListener(if (isValid) null else error) - } - onChanged() - } - - protected open fun onChanged() = Unit - - override fun beforeTextChanged(p0: CharSequence?, p1: Int, p2: Int, p3: Int) = Unit - override fun onTextChanged(p0: CharSequence?, p1: Int, p2: Int, p3: Int) = Unit - - abstract fun validate(text: Editable): Boolean - var isValid = false - private set -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/util/avatars/AvatarHelper.kt b/app/src/main/java/de/kuschku/quasseldroid/util/avatars/AvatarHelper.kt deleted file mode 100644 index 12b501f18c82351c950511ced3839f2fa31e0914..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/util/avatars/AvatarHelper.kt +++ /dev/null @@ -1,116 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.util.avatars - -import de.kuschku.libquassel.quassel.syncables.IrcUser -import de.kuschku.libquassel.util.irc.HostmaskHelper -import de.kuschku.libquassel.util.irc.IrcCaseMappers -import de.kuschku.quasseldroid.persistence.models.MessageData -import de.kuschku.quasseldroid.persistence.models.NotificationData -import de.kuschku.quasseldroid.settings.MessageSettings -import de.kuschku.quasseldroid.ui.info.user.IrcUserInfo -import de.kuschku.quasseldroid.util.Patterns -import de.kuschku.quasseldroid.util.backport.codec.Hex -import de.kuschku.quasseldroid.util.helper.letIf -import de.kuschku.quasseldroid.util.helper.notBlank -import de.kuschku.quasseldroid.viewmodel.data.AutoCompleteItem -import de.kuschku.quasseldroid.viewmodel.data.Avatar -import de.kuschku.quasseldroid.viewmodel.data.IrcUserItem -import org.apache.commons.codec.digest.DigestUtils - -object AvatarHelper { - fun avatar(settings: MessageSettings, ident: String, realName: String, - avatarUrl: String?, size: Int?) = - listOfNotNull( - avatarUrl.notBlank()?.let { listOf(Avatar.NativeAvatar(it)) }, - (settings.showAvatars && settings.showIRCCloudAvatars).letIf { - ircCloudFallback(ident, size) - }, - (settings.showAvatars && settings.showGravatarAvatars).letIf { - gravatarFallback(realName, size) - }, - (settings.showAvatars && settings.showMatrixAvatars).letIf { - matrixFallback(realName, size) - } - ).flatten() - - fun avatar(settings: MessageSettings, message: NotificationData, - size: Int? = null) = - avatar(settings, HostmaskHelper.user(message.sender), message.realName, message.avatarUrl, size) - - fun avatar(settings: MessageSettings, message: MessageData, size: Int? = null) = - avatar(settings, HostmaskHelper.user(message.sender), message.realName, message.avatarUrl, size) - - fun avatar(settings: MessageSettings, user: IrcUserItem, size: Int? = null) = - avatar(settings, HostmaskHelper.user(user.hostmask), user.realname.toString(), null, size) - - fun avatar(settings: MessageSettings, user: IrcUserInfo, size: Int? = null) = - avatar(settings, user.user ?: "", user.realName ?: "", null, size) - - fun avatar(settings: MessageSettings, user: IrcUser, size: Int? = null) = - avatar(settings, user.user(), user.realName(), null, size) - - fun avatar(settings: MessageSettings, user: AutoCompleteItem.UserItem, size: Int? = null) = - avatar(settings, HostmaskHelper.user(user.hostMask), user.realname.toString(), null, size) - - private fun ircCloudFallback(ident: String, size: Int?): List<Avatar> { - val userId = Patterns.IRCCLOUD_IDENT.matchEntire(ident)?.groupValues?.lastOrNull() - ?: return emptyList() - - if (size != null) { - return listOf( - Avatar.IRCCloudAvatar( - "https://static.irccloud-cdn.com/avatar-redirect/s$size/$userId" - ) - ) - } - - return listOf( - Avatar.IRCCloudAvatar( - "https://static.irccloud-cdn.com/avatar-redirect/$userId" - ) - ) - } - - private fun gravatarFallback(realname: String, size: Int?): List<Avatar> { - return Patterns.AUTOLINK_EMAIL_ADDRESS - .findAll(realname) - .mapNotNull { - it.groups[1]?.value - }.map { email -> - val hash = Hex.encodeHexString(DigestUtils.md5(IrcCaseMappers.unicode.toLowerCase(email))) - if (size == null) { - "https://www.gravatar.com/avatar/$hash?d=404" - } else { - "https://www.gravatar.com/avatar/$hash?d=404&s=${size}" - } - }.map { Avatar.GravatarAvatar(it) }.toList() - } - - private fun matrixFallback(realname: String, size: Int?): List<Avatar> { - return if (Patterns.MATRIX_REALNAME.matches(realname)) { - listOf( - Avatar.MatrixAvatar(realname, size) - ) - } else { - emptyList() - } - } -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/util/avatars/MatrixApi.kt b/app/src/main/java/de/kuschku/quasseldroid/util/avatars/MatrixApi.kt deleted file mode 100644 index 3a7bd195f5e8776e0dac2ea6656bb95e155b9dae..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/util/avatars/MatrixApi.kt +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.util.avatars - -import okhttp3.ResponseBody -import retrofit2.Call -import retrofit2.http.GET -import retrofit2.http.Path -import retrofit2.http.Query - -interface MatrixApi { - @GET("/_matrix/client/r0/profile/{name}/avatar_url") - fun avatarUrl(@Path("name") name: String): Call<MatrixAvatarResponse> - - @GET("/_matrix/media/r0/thumbnail/{server}/{id}/") - fun avatarThumbnail( - @Path("server") server: String, - @Path("id") id: String, - @Query("width") width: Int = 512, - @Query("height") height: Int = 512, - @Query("method") method: String = "scale" - ): Call<ResponseBody> - - @GET("/_matrix/media/r0/download/{server}/{id}") - fun avatarImage( - @Path("server") server: String, - @Path("id") id: String - ): Call<ResponseBody> -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/util/avatars/MatrixAvatarInfo.kt b/app/src/main/java/de/kuschku/quasseldroid/util/avatars/MatrixAvatarInfo.kt deleted file mode 100644 index 7a3f173c366ab59a19dfca798ecb1c171114d7a0..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/util/avatars/MatrixAvatarInfo.kt +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.util.avatars - -data class MatrixAvatarInfo( - val avatarUrl: String, - val size: Int? -) diff --git a/app/src/main/java/de/kuschku/quasseldroid/util/avatars/MatrixAvatarResponse.kt b/app/src/main/java/de/kuschku/quasseldroid/util/avatars/MatrixAvatarResponse.kt deleted file mode 100644 index 11cd0d2b33b035765bcad31da83c788f782dcb3e..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/util/avatars/MatrixAvatarResponse.kt +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.util.avatars - -import com.google.gson.annotations.SerializedName - -data class MatrixAvatarResponse( - @SerializedName("avatar_url") - val avatarUrl: String? -) - diff --git a/app/src/main/java/de/kuschku/quasseldroid/util/avatars/MatrixDataFetcher.kt b/app/src/main/java/de/kuschku/quasseldroid/util/avatars/MatrixDataFetcher.kt deleted file mode 100644 index 092fb03a1fc9586d2bc1e07350341e259e52d62c..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/util/avatars/MatrixDataFetcher.kt +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.util.avatars - -import android.net.Uri -import com.bumptech.glide.Priority -import com.bumptech.glide.load.DataSource -import com.bumptech.glide.load.data.DataFetcher -import de.kuschku.quasseldroid.viewmodel.data.Avatar -import okhttp3.Call -import java.io.InputStream - -class MatrixDataFetcher( - private val model: Avatar.MatrixAvatar, - private val api: MatrixApi -) : - DataFetcher<InputStream> { - private var call: Call? = null - - override fun getDataClass(): Class<InputStream> { - return InputStream::class.java - } - - override fun cleanup() { - } - - override fun getDataSource(): DataSource { - return DataSource.REMOTE - } - - override fun cancel() { - call?.cancel() - } - - private fun loadAvatarInfo(model: Avatar.MatrixAvatar) = - api.avatarUrl(model.userId).execute().body()?.let { - it.avatarUrl?.let { - MatrixAvatarInfo(it, model.size) - } - } - - private fun inputStreamFromAvatarInfo(info: MatrixAvatarInfo): InputStream? { - val url = Uri.parse(info.avatarUrl) - return if (info.size != null && info.size < 512) { - api.avatarThumbnail(server = url.host ?: "", - id = url.pathSegments.first(), - width = info.size, - height = info.size, - method = if (info.size > 96) "scale" else "crop") - } else { - api.avatarImage(server = url.host ?: "", id = url.pathSegments.first()) - }.execute().body()?.byteStream() - } - - override fun loadData(priority: Priority, callback: DataFetcher.DataCallback<in InputStream>) { - loadAvatarInfo(model)?.let { - inputStreamFromAvatarInfo(it) - }?.let { - callback.onDataReady(it) - } ?: callback.onLoadFailed(IllegalStateException("Unknown Error!")) - } -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/util/avatars/MatrixModelLoader.kt b/app/src/main/java/de/kuschku/quasseldroid/util/avatars/MatrixModelLoader.kt deleted file mode 100644 index 3e8f45cb661523cb8c300e5b4de15980bfc20d8c..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/util/avatars/MatrixModelLoader.kt +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.util.avatars - -import com.bumptech.glide.load.Options -import com.bumptech.glide.load.model.ModelLoader -import com.bumptech.glide.signature.ObjectKey -import de.kuschku.quasseldroid.viewmodel.data.Avatar -import java.io.InputStream - -class MatrixModelLoader(private val api: MatrixApi) : - ModelLoader<Avatar.MatrixAvatar, InputStream> { - override fun buildLoadData(model: Avatar.MatrixAvatar, width: Int, height: Int, - options: Options): ModelLoader.LoadData<InputStream>? { - return ModelLoader.LoadData(ObjectKey(model), MatrixDataFetcher(model, api)) - } - - override fun handles(model: Avatar.MatrixAvatar): Boolean { - return true - } -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/util/backport/AndroidThreeTenBackport.kt b/app/src/main/java/de/kuschku/quasseldroid/util/backport/AndroidThreeTenBackport.kt deleted file mode 100644 index 6af6ad59333cfac5d77ccf502385279801158ffc..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/util/backport/AndroidThreeTenBackport.kt +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.util.backport - -import android.content.Context -import org.threeten.bp.zone.TzdbZoneRulesProvider -import org.threeten.bp.zone.ZoneRulesInitializer -import org.threeten.bp.zone.ZoneRulesProvider -import java.io.IOException -import java.util.concurrent.atomic.AtomicBoolean - -object AndroidThreeTenBackport { - private val initialized = AtomicBoolean() - - fun init(context: Context, assetPath: String = "TZDB.dat") { - if (!initialized.getAndSet(true)) { - ZoneRulesInitializer.setInitializer(AndroidThreeTenBackportInitializer(context, assetPath)) - } - } - - class AndroidThreeTenBackportInitializer( - private val context: Context, - private val assetPath: String - ) : ZoneRulesInitializer() { - override fun initializeProviders() { - try { - ZoneRulesProvider.registerProvider(context.assets.open(assetPath).use { - TzdbZoneRulesProvider(it) - }) - } catch (exception: IOException) { - throw IllegalStateException("$assetPath missing from assets", exception) - } - } - } -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/util/backport/DaggerLifecycleService.kt b/app/src/main/java/de/kuschku/quasseldroid/util/backport/DaggerLifecycleService.kt deleted file mode 100644 index a3a13b760c572091ac8c9327686d42bf0f9d6192..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/util/backport/DaggerLifecycleService.kt +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.util.backport - -import dagger.android.AndroidInjection -import de.kuschku.quasseldroid.util.compatibility.FixedLifecycleService - -abstract class DaggerLifecycleService : FixedLifecycleService() { - override fun onCreate() { - AndroidInjection.inject(this) - super.onCreate() - } -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/util/backport/OsConstants.kt b/app/src/main/java/de/kuschku/quasseldroid/util/backport/OsConstants.kt deleted file mode 100644 index 141793599db765f30547bf0d5297f627319bcde5..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/util/backport/OsConstants.kt +++ /dev/null @@ -1,435 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.util.backport - -object OsConstants { - const val EPERM = 1 - const val ENOENT = 2 - const val ESRCH = 3 - const val EINTR = 4 - const val EIO = 5 - const val ENXIO = 6 - const val E2BIG = 7 - const val ENOEXEC = 8 - const val EBADF = 9 - const val ECHILD = 10 - const val EAGAIN = 11 - const val ENOMEM = 12 - const val EACCES = 13 - const val EFAULT = 14 - const val ENOTBLK = 15 - const val EBUSY = 16 - const val EEXIST = 17 - const val EXDEV = 18 - const val ENODEV = 19 - const val ENOTDIR = 20 - const val EISDIR = 21 - const val EINVAL = 22 - const val ENFILE = 23 - const val EMFILE = 24 - const val ENOTTY = 25 - const val ETXTBSY = 26 - const val EFBIG = 27 - const val ENOSPC = 28 - const val ESPIPE = 29 - const val EROFS = 30 - const val EMLINK = 31 - const val EPIPE = 32 - const val EDOM = 33 - const val ERANGE = 34 - const val EDEADLK = 35 - const val ENAMETOOLONG = 36 - const val ENOLCK = 37 - const val ENOSYS = 38 - const val ENOTEMPTY = 39 - const val ELOOP = 40 - const val EWOULDBLOCK = 11 - const val ENOMSG = 42 - const val EIDRM = 43 - const val ECHRNG = 44 - const val EL2NSYNC = 45 - const val EL3HLT = 46 - const val EL3RST = 47 - const val ELNRNG = 48 - const val EUNATCH = 49 - const val ENOCSI = 50 - const val EL2HLT = 51 - const val EBADE = 52 - const val EBADR = 53 - const val EXFULL = 54 - const val ENOANO = 55 - const val EBADRQC = 56 - const val EBADSLT = 57 - const val EDEADLOCK = 35 - const val EBFONT = 59 - const val ENOSTR = 60 - const val ENODATA = 61 - const val ETIME = 62 - const val ENOSR = 63 - const val ENONET = 64 - const val ENOPKG = 65 - const val EREMOTE = 66 - const val ENOLINK = 67 - const val EADV = 68 - const val ESRMNT = 69 - const val ECOMM = 70 - const val EPROTO = 71 - const val EMULTIHOP = 72 - const val EDOTDOT = 73 - const val EBADMSG = 74 - const val EOVERFLOW = 75 - const val ENOTUNIQ = 76 - const val EBADFD = 77 - const val EREMCHG = 78 - const val ELIBACC = 79 - const val ELIBBAD = 80 - const val ELIBSCN = 81 - const val ELIBMAX = 82 - const val ELIBEXEC = 83 - const val EILSEQ = 84 - const val ERESTART = 85 - const val ESTRPIPE = 86 - const val EUSERS = 87 - const val ENOTSOCK = 88 - const val EDESTADDRREQ = 89 - const val EMSGSIZE = 90 - const val EPROTOTYPE = 91 - const val ENOPROTOOPT = 92 - const val EPROTONOSUPPORT = 93 - const val ESOCKTNOSUPPORT = 94 - const val EOPNOTSUPP = 95 - const val EPFNOSUPPORT = 96 - const val EAFNOSUPPORT = 97 - const val EADDRINUSE = 98 - const val EADDRNOTAVAIL = 99 - const val ENETDOWN = 100 - const val ENETUNREACH = 101 - const val ENETRESET = 102 - const val ECONNABORTED = 103 - const val ECONNRESET = 104 - const val ENOBUFS = 105 - const val EISCONN = 106 - const val ENOTCONN = 107 - const val ESHUTDOWN = 108 - const val ETOOMANYREFS = 109 - const val ETIMEDOUT = 110 - const val ECONNREFUSED = 111 - const val EHOSTDOWN = 112 - const val EHOSTUNREACH = 113 - const val EALREADY = 114 - const val EINPROGRESS = 115 - const val ESTALE = 116 - const val EUCLEAN = 117 - const val ENOTNAM = 118 - const val ENAVAIL = 119 - const val EISNAM = 120 - const val EREMOTEIO = 121 - const val EDQUOT = 122 - const val ENOMEDIUM = 123 - const val EMEDIUMTYPE = 124 - const val ECANCELED = 125 - const val ENOKEY = 126 - const val EKEYEXPIRED = 127 - const val EKEYREVOKED = 128 - const val EKEYREJECTED = 129 - const val EOWNERDEAD = 130 - const val ENOTRECOVERABLE = 131 - const val ERFKILL = 132 - const val EHWPOISON = 133 - const val ENOTSUP = 95 - - @Suppress("DUPLICATE_LABEL_IN_WHEN") - fun errnoName(errno: Int) = when (errno) { - EPERM -> "EPERM" - ENOENT -> "ENOENT" - ESRCH -> "ESRCH" - EINTR -> "EINTR" - EIO -> "EIO" - ENXIO -> "ENXIO" - E2BIG -> "E2BIG" - ENOEXEC -> "ENOEXEC" - EBADF -> "EBADF" - ECHILD -> "ECHILD" - EAGAIN -> "EAGAIN" - ENOMEM -> "ENOMEM" - EACCES -> "EACCES" - EFAULT -> "EFAULT" - ENOTBLK -> "ENOTBLK" - EBUSY -> "EBUSY" - EEXIST -> "EEXIST" - EXDEV -> "EXDEV" - ENODEV -> "ENODEV" - ENOTDIR -> "ENOTDIR" - EISDIR -> "EISDIR" - EINVAL -> "EINVAL" - ENFILE -> "ENFILE" - EMFILE -> "EMFILE" - ENOTTY -> "ENOTTY" - ETXTBSY -> "ETXTBSY" - EFBIG -> "EFBIG" - ENOSPC -> "ENOSPC" - ESPIPE -> "ESPIPE" - EROFS -> "EROFS" - EMLINK -> "EMLINK" - EPIPE -> "EPIPE" - EDOM -> "EDOM" - ERANGE -> "ERANGE" - EDEADLK -> "EDEADLK" - ENAMETOOLONG -> "ENAMETOOLONG" - ENOLCK -> "ENOLCK" - ENOSYS -> "ENOSYS" - ENOTEMPTY -> "ENOTEMPTY" - ELOOP -> "ELOOP" - EWOULDBLOCK -> "EWOULDBLOCK" - ENOMSG -> "ENOMSG" - EIDRM -> "EIDRM" - ECHRNG -> "ECHRNG" - EL2NSYNC -> "EL2NSYNC" - EL3HLT -> "EL3HLT" - EL3RST -> "EL3RST" - ELNRNG -> "ELNRNG" - EUNATCH -> "EUNATCH" - ENOCSI -> "ENOCSI" - EL2HLT -> "EL2HLT" - EBADE -> "EBADE" - EBADR -> "EBADR" - EXFULL -> "EXFULL" - ENOANO -> "ENOANO" - EBADRQC -> "EBADRQC" - EBADSLT -> "EBADSLT" - EDEADLOCK -> "EDEADLOCK" - EBFONT -> "EBFONT" - ENOSTR -> "ENOSTR" - ENODATA -> "ENODATA" - ETIME -> "ETIME" - ENOSR -> "ENOSR" - ENONET -> "ENONET" - ENOPKG -> "ENOPKG" - EREMOTE -> "EREMOTE" - ENOLINK -> "ENOLINK" - EADV -> "EADV" - ESRMNT -> "ESRMNT" - ECOMM -> "ECOMM" - EPROTO -> "EPROTO" - EMULTIHOP -> "EMULTIHOP" - EDOTDOT -> "EDOTDOT" - EBADMSG -> "EBADMSG" - EOVERFLOW -> "EOVERFLOW" - ENOTUNIQ -> "ENOTUNIQ" - EBADFD -> "EBADFD" - EREMCHG -> "EREMCHG" - ELIBACC -> "ELIBACC" - ELIBBAD -> "ELIBBAD" - ELIBSCN -> "ELIBSCN" - ELIBMAX -> "ELIBMAX" - ELIBEXEC -> "ELIBEXEC" - EILSEQ -> "EILSEQ" - ERESTART -> "ERESTART" - ESTRPIPE -> "ESTRPIPE" - EUSERS -> "EUSERS" - ENOTSOCK -> "ENOTSOCK" - EDESTADDRREQ -> "EDESTADDRREQ" - EMSGSIZE -> "EMSGSIZE" - EPROTOTYPE -> "EPROTOTYPE" - ENOPROTOOPT -> "ENOPROTOOPT" - EPROTONOSUPPORT -> "EPROTONOSUPPORT" - ESOCKTNOSUPPORT -> "ESOCKTNOSUPPORT" - EOPNOTSUPP -> "EOPNOTSUPP" - EPFNOSUPPORT -> "EPFNOSUPPORT" - EAFNOSUPPORT -> "EAFNOSUPPORT" - EADDRINUSE -> "EADDRINUSE" - EADDRNOTAVAIL -> "EADDRNOTAVAIL" - ENETDOWN -> "ENETDOWN" - ENETUNREACH -> "ENETUNREACH" - ENETRESET -> "ENETRESET" - ECONNABORTED -> "ECONNABORTED" - ECONNRESET -> "ECONNRESET" - ENOBUFS -> "ENOBUFS" - EISCONN -> "EISCONN" - ENOTCONN -> "ENOTCONN" - ESHUTDOWN -> "ESHUTDOWN" - ETOOMANYREFS -> "ETOOMANYREFS" - ETIMEDOUT -> "ETIMEDOUT" - ECONNREFUSED -> "ECONNREFUSED" - EHOSTDOWN -> "EHOSTDOWN" - EHOSTUNREACH -> "EHOSTUNREACH" - EALREADY -> "EALREADY" - EINPROGRESS -> "EINPROGRESS" - ESTALE -> "ESTALE" - EUCLEAN -> "EUCLEAN" - ENOTNAM -> "ENOTNAM" - ENAVAIL -> "ENAVAIL" - EISNAM -> "EISNAM" - EREMOTEIO -> "EREMOTEIO" - EDQUOT -> "EDQUOT" - ENOMEDIUM -> "ENOMEDIUM" - EMEDIUMTYPE -> "EMEDIUMTYPE" - ECANCELED -> "ECANCELED" - ENOKEY -> "ENOKEY" - EKEYEXPIRED -> "EKEYEXPIRED" - EKEYREVOKED -> "EKEYREVOKED" - EKEYREJECTED -> "EKEYREJECTED" - EOWNERDEAD -> "EOWNERDEAD" - ENOTRECOVERABLE -> "ENOTRECOVERABLE" - ERFKILL -> "ERFKILL" - EHWPOISON -> "EHWPOISON" - ENOTSUP -> "ENOTSUP" - else -> null - } - - @Suppress("DUPLICATE_LABEL_IN_WHEN") - fun strerror(errno: Int) = when (errno) { - EPERM -> "Operation not permitted" - ENOENT -> "No such file or directory" - ESRCH -> "No such process" - EINTR -> "Interrupted system call" - EIO -> "Input/output error" - ENXIO -> "No such device or address" - E2BIG -> "Argument list too long" - ENOEXEC -> "Exec format error" - EBADF -> "Bad file descriptor" - ECHILD -> "No child processes" - EAGAIN -> "Resource temporarily unavailable" - ENOMEM -> "Cannot allocate memory" - EACCES -> "Permission denied" - EFAULT -> "Bad address" - ENOTBLK -> "Block device required" - EBUSY -> "Device or resource busy" - EEXIST -> "File exists" - EXDEV -> "Invalid cross-device link" - ENODEV -> "No such device" - ENOTDIR -> "Not a directory" - EISDIR -> "Is a directory" - EINVAL -> "Invalid argument" - ENFILE -> "Too many open files in system" - EMFILE -> "Too many open files" - ENOTTY -> "Inappropriate ioctl for device" - ETXTBSY -> "Text file busy" - EFBIG -> "File too large" - ENOSPC -> "No space left on device" - ESPIPE -> "Illegal seek" - EROFS -> "Read-only file system" - EMLINK -> "Too many links" - EPIPE -> "Broken pipe" - EDOM -> "Numerical argument out of domain" - ERANGE -> "Numerical result out of range" - EDEADLK -> "Resource deadlock avoided" - ENAMETOOLONG -> "File name too long" - ENOLCK -> "No locks available" - ENOSYS -> "Function not implemented" - ENOTEMPTY -> "Directory not empty" - ELOOP -> "Too many levels of symbolic links" - EWOULDBLOCK -> "Resource temporarily unavailable" - ENOMSG -> "No message of desired type" - EIDRM -> "Identifier removed" - ECHRNG -> "Channel number out of range" - EL2NSYNC -> "Level 2 not synchronized" - EL3HLT -> "Level 3 halted" - EL3RST -> "Level 3 reset" - ELNRNG -> "Link number out of range" - EUNATCH -> "Protocol driver not attached" - ENOCSI -> "No CSI structure available" - EL2HLT -> "Level 2 halted" - EBADE -> "Invalid exchange" - EBADR -> "Invalid request descriptor" - EXFULL -> "Exchange full" - ENOANO -> "No anode" - EBADRQC -> "Invalid request code" - EBADSLT -> "Invalid slot" - EDEADLOCK -> "Resource deadlock avoided" - EBFONT -> "Bad font file format" - ENOSTR -> "Device not a stream" - ENODATA -> "No data available" - ETIME -> "Timer expired" - ENOSR -> "Out of streams resources" - ENONET -> "Machine is not on the network" - ENOPKG -> "Package not installed" - EREMOTE -> "Object is remote" - ENOLINK -> "Link has been severed" - EADV -> "Advertise error" - ESRMNT -> "Srmount error" - ECOMM -> "Communication error on send" - EPROTO -> "Protocol error" - EMULTIHOP -> "Multihop attempted" - EDOTDOT -> "RFS specific error" - EBADMSG -> "Bad message" - EOVERFLOW -> "Value too large for defined data type" - ENOTUNIQ -> "Name not unique on network" - EBADFD -> "File descriptor in bad state" - EREMCHG -> "Remote address changed" - ELIBACC -> "Can not access a needed shared library" - ELIBBAD -> "Accessing a corrupted shared library" - ELIBSCN -> ".lib section in a.out corrupted" - ELIBMAX -> "Attempting to link in too many shared libraries" - ELIBEXEC -> "Cannot exec a shared library directly" - EILSEQ -> "Invalid or incomplete multibyte or wide character" - ERESTART -> "Interrupted system call should be restarted" - ESTRPIPE -> "Streams pipe error" - EUSERS -> "Too many users" - ENOTSOCK -> "Socket operation on non-socket" - EDESTADDRREQ -> "Destination address required" - EMSGSIZE -> "Message too long" - EPROTOTYPE -> "Protocol wrong type for socket" - ENOPROTOOPT -> "Protocol not available" - EPROTONOSUPPORT -> "Protocol not supported" - ESOCKTNOSUPPORT -> "Socket type not supported" - EOPNOTSUPP -> "Operation not supported" - EPFNOSUPPORT -> "Protocol family not supported" - EAFNOSUPPORT -> "Address family not supported by protocol" - EADDRINUSE -> "Address already in use" - EADDRNOTAVAIL -> "Cannot assign requested address" - ENETDOWN -> "Network is down" - ENETUNREACH -> "Network is unreachable" - ENETRESET -> "Network dropped connection on reset" - ECONNABORTED -> "Software caused connection abort" - ECONNRESET -> "Connection reset by peer" - ENOBUFS -> "No bufferId space available" - EISCONN -> "Transport endpoint is already connected" - ENOTCONN -> "Transport endpoint is not connected" - ESHUTDOWN -> "Cannot send after transport endpoint shutdown" - ETOOMANYREFS -> "Too many references: cannot splice" - ETIMEDOUT -> "Connection timed out" - ECONNREFUSED -> "Connection refused" - EHOSTDOWN -> "Host is down" - EHOSTUNREACH -> "No route to host" - EALREADY -> "Operation already in progress" - EINPROGRESS -> "Operation now in progress" - ESTALE -> "Stale file handle" - EUCLEAN -> "Structure needs cleaning" - ENOTNAM -> "Not a XENIX named type file" - ENAVAIL -> "No XENIX semaphores available" - EISNAM -> "Is a named type file" - EREMOTEIO -> "Remote I/O error" - EDQUOT -> "Disk quota exceeded" - ENOMEDIUM -> "No medium found" - EMEDIUMTYPE -> "Wrong medium type" - ECANCELED -> "Operation canceled" - ENOKEY -> "Required key not available" - EKEYEXPIRED -> "Key has expired" - EKEYREVOKED -> "Key has been revoked" - EKEYREJECTED -> "Key was rejected by service" - EOWNERDEAD -> "Owner died" - ENOTRECOVERABLE -> "State not recoverable" - ERFKILL -> "Operation not possible due to RF-kill" - EHWPOISON -> "Memory page has hardware error" - ENOTSUP -> "Operation not supported" - else -> null - } -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/util/backport/ReadableWrappedChannel.kt b/app/src/main/java/de/kuschku/quasseldroid/util/backport/ReadableWrappedChannel.kt deleted file mode 100644 index 1458ecec9a13fc090279e5441569e5b3ac20c6b7..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/util/backport/ReadableWrappedChannel.kt +++ /dev/null @@ -1,91 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.util.backport - -import de.kuschku.libquassel.util.compatibility.LoggingHandler.Companion.log -import de.kuschku.libquassel.util.compatibility.LoggingHandler.LogLevel.ERROR -import java.io.InputStream -import java.nio.ByteBuffer -import java.nio.channels.ReadableByteChannel -import java.nio.channels.spi.AbstractInterruptibleChannel - -class ReadableWrappedChannel( - private var backingStream: InputStream -) : AbstractInterruptibleChannel(), ReadableByteChannel { - private val buffer = ByteBuffer.allocate(PAGE_SIZE) - private val lock = Any() - - override fun read(dst: ByteBuffer): Int { - val totalData = dst.remaining() - var remainingData = totalData - - // used to mark if we’ve already read any data. This is used to ensure that we only ever block - // once for reading - var hasRead = false - - synchronized(lock) { - // Only read as long as we have content to read, and until we’ve blocked at most once - while (remainingData > 0 && !(hasRead && backingStream.available() == 0)) { - // Data to be read, always the minimum of available data and the page size - val toReadOnce = Math.min(remainingData, PAGE_SIZE) - var readData = 0 - - try { - // begin blocking operation, this handles interruption etc. properly - begin() - // prepare bufferId for reading by resetting position and limit - buffer.clear() - // read data into bufferId - readData = backingStream.read(buffer.array(), 0, toReadOnce) - // accurately set bufferId info - buffer.position(readData) - } finally { - // end blocking operation, this handles interruption etc. properly - end(readData > 0) - } - - if (readData <= 0) { - log(ERROR, "ReadableWrappedChannel", "Read: $readData") - } - - // read is negative if no data was read, in that case, terminate - if (readData < 0) - break - - // add read amount to total - remainingData -= readData - // mark that we’ve read data (to only block once) - hasRead = true - - // flip bufferId to prepare for reading - buffer.flip() - dst.put(buffer) - } - } - - return (totalData - remainingData) - } - - override fun implCloseChannel() = backingStream.close() - - companion object { - private const val PAGE_SIZE = 8192 - } -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/util/backport/WritableWrappedChannel.kt b/app/src/main/java/de/kuschku/quasseldroid/util/backport/WritableWrappedChannel.kt deleted file mode 100644 index f4898a529e9fbba11d0f71b62a905e1d56fe7323..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/util/backport/WritableWrappedChannel.kt +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.util.backport - -import java.io.OutputStream -import java.nio.ByteBuffer -import java.nio.channels.WritableByteChannel -import java.nio.channels.spi.AbstractInterruptibleChannel - -class WritableWrappedChannel( - private var backingStream: OutputStream -) : AbstractInterruptibleChannel(), WritableByteChannel { - private val buffer = ByteBuffer.allocate(PAGE_SIZE) - private val lock = Any() - - override fun write(src: ByteBuffer): Int { - val totalData = src.remaining() - var remainingData = totalData - - synchronized(lock) { - while (remainingData > 0) { - // Data to be written, always the minimum of available data and the page size - val writtenData = Math.min(remainingData, PAGE_SIZE) - - // Set new bufferId info - buffer.clear() - buffer.limit(writtenData) - // Read data into bufferId - buffer.put(src) - - try { - // begin blocking operation, this handles interruption etc. properly - begin() - // Write data to backing stream - backingStream.write(buffer.array(), 0, writtenData) - } finally { - // end blocking operation, this handles interruption etc. properly - end(writtenData > 0) - } - - // add written amount to total - remainingData -= writtenData - } - - return (totalData - remainingData) - } - } - - override fun implCloseChannel() = backingStream.close() - - companion object { - private const val PAGE_SIZE = 8192 - } -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/util/backport/codec/Hex.kt b/app/src/main/java/de/kuschku/quasseldroid/util/backport/codec/Hex.kt deleted file mode 100644 index aebe1fd5e1c375f630fe270cdfb54b54974141dc..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/util/backport/codec/Hex.kt +++ /dev/null @@ -1,482 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package de.kuschku.quasseldroid.util.backport.codec - -import org.apache.commons.codec.* -import java.nio.ByteBuffer -import java.nio.charset.Charset - -/** - * Converts hexadecimal Strings. The charset used for certain operation can be set, the default is set in - * [.DEFAULT_CHARSET_NAME] - * - * This class is thread-safe. - * - * @since 1.1 - * @version $Id: Hex.java 1811344 2017-10-06 15:19:57Z ggregory $ - */ -class Hex : BinaryEncoder, BinaryDecoder { - - /** - * Gets the charset. - * - * @return the charset. - * @since 1.7 - */ - val charset: Charset - - /** - * Gets the charset name. - * - * @return the charset name. - * @since 1.4 - */ - val charsetName: String - get() = this.charset.name() - - /** - * Creates a new codec with the default charset name [.DEFAULT_CHARSET] - */ - constructor() { - // use default encoding - this.charset = DEFAULT_CHARSET - } - - /** - * Creates a new codec with the given Charset. - * - * @param charset - * the charset. - * @since 1.7 - */ - constructor(charset: Charset) { - this.charset = charset - } - - /** - * Creates a new codec with the given charset name. - * - * @param charsetName - * the charset name. - * @throws java.nio.charset.UnsupportedCharsetException - * If the named charset is unavailable - * @since 1.4 - * @since 1.7 throws UnsupportedCharsetException if the named charset is unavailable - */ - constructor(charsetName: String) : this(Charset.forName(charsetName)) - - /** - * Converts an array of character bytes representing hexadecimal values into an array of bytes of those same values. - * The returned array will be half the length of the passed array, as it takes two characters to represent any given - * byte. An exception is thrown if the passed char array has an odd number of elements. - * - * @param array - * An array of character bytes containing hexadecimal digits - * @return A byte array containing binary data decoded from the supplied byte array (representing characters). - * @throws DecoderException - * Thrown if an odd number of characters is supplied to this function - * @see .decodeHex - */ - @Throws(DecoderException::class) - override fun decode(array: ByteArray): ByteArray { - return decodeHex(String(array, charset).toCharArray()) - } - - /** - * Converts a bufferId of character bytes representing hexadecimal values into an array of bytes of those same values. - * The returned array will be half the length of the passed array, as it takes two characters to represent any given - * byte. An exception is thrown if the passed char array has an odd number of elements. - * - * @param buffer - * An array of character bytes containing hexadecimal digits - * @return A byte array containing binary data decoded from the supplied byte array (representing characters). - * @throws DecoderException - * Thrown if an odd number of characters is supplied to this function - * @see .decodeHex - * @since 1.11 - */ - @Throws(DecoderException::class) - fun decode(buffer: ByteBuffer): ByteArray { - return decodeHex(String(buffer.array(), charset).toCharArray()) - } - - /** - * Converts a String or an array of character bytes representing hexadecimal values into an array of bytes of those - * same values. The returned array will be half the length of the passed String or array, as it takes two characters - * to represent any given byte. An exception is thrown if the passed char array has an odd number of elements. - * - * @param obj - * A String, ByteBuffer, byte[], or an array of character bytes containing hexadecimal digits - * @return A byte array containing binary data decoded from the supplied byte array (representing characters). - * @throws DecoderException - * Thrown if an odd number of characters is supplied to this function or the object is not a String or - * char[] - * @see .decodeHex - */ - @Throws(DecoderException::class) - override fun decode(obj: Any): Any { - return when (obj) { - is String -> decode(obj.toCharArray()) - is ByteArray -> decode(obj) - is ByteBuffer -> decode(obj) - is CharArray -> decodeHex(obj) - else -> throw DecoderException() - } - } - - /** - * Converts an array of bytes into an array of bytes for the characters representing the hexadecimal values of each - * byte in order. The returned array will be double the length of the passed array, as it takes two characters to - * represent any given byte. - * - * - * The conversion from hexadecimal characters to the returned bytes is performed with the charset named by - * [.getCharset]. - * - * - * @param array - * a byte[] to convert to Hex characters - * @return A byte[] containing the bytes of the lower-case hexadecimal characters - * @since 1.7 No longer throws IllegalStateException if the charsetName is invalid. - * @see .encodeHex - */ - override fun encode(array: ByteArray): ByteArray { - return encodeHexString(array).toByteArray(this.charset) - } - - /** - * Converts byte bufferId into an array of bytes for the characters representing the hexadecimal values of each - * byte in order. The returned array will be double the length of the passed array, as it takes two characters to - * represent any given byte. - * - * - * The conversion from hexadecimal characters to the returned bytes is performed with the charset named by - * [.getCharset]. - * - * - * @param array - * a byte bufferId to convert to Hex characters - * @return A byte[] containing the bytes of the lower-case hexadecimal characters - * @see .encodeHex - * @since 1.11 - */ - fun encode(array: ByteBuffer): ByteArray { - return encodeHexString(array).toByteArray(this.charset) - } - - /** - * Converts a String or an array of bytes into an array of characters representing the hexadecimal values of each - * byte in order. The returned array will be double the length of the passed String or array, as it takes two - * characters to represent any given byte. - * - * - * The conversion from hexadecimal characters to bytes to be encoded to performed with the charset named by - * [.getCharset]. - * - * - * @param obj - * a String, ByteBuffer, or byte[] to convert to Hex characters - * @return A char[] containing lower-case hexadecimal characters - * @throws EncoderException - * Thrown if the given object is not a String or byte[] - * @see .encodeHex - */ - @Throws(EncoderException::class) - override fun encode(obj: Any) = encodeHex( - when (obj) { - is String -> obj.toByteArray(charset) - is ByteBuffer -> obj.array() - is ByteArray -> obj - else -> throw EncoderException() - } - ) - - /** - * Returns a string representation of the object, which includes the charset name. - * - * @return a string representation of the object. - */ - override fun toString(): String { - return super.toString() + "[charsetName=" + this.charset + "]" - } - - companion object { - - /** - * Default charset is [Charsets.UTF_8] - * - * @since 1.7 - */ - val DEFAULT_CHARSET: Charset = Charsets.UTF_8 - - /** - * Default charset name is [CharEncoding.UTF_8] - * - * @since 1.4 - */ - const val DEFAULT_CHARSET_NAME = CharEncoding.UTF_8 - - /** - * Used to build output as Hex - */ - private val DIGITS_LOWER = charArrayOf('0', - '1', - '2', - '3', - '4', - '5', - '6', - '7', - '8', - '9', - 'a', - 'b', - 'c', - 'd', - 'e', - 'f') - - /** - * Used to build output as Hex - */ - private val DIGITS_UPPER = charArrayOf('0', - '1', - '2', - '3', - '4', - '5', - '6', - '7', - '8', - '9', - 'A', - 'B', - 'C', - 'D', - 'E', - 'F') - - /** - * Converts a String representing hexadecimal values into an array of bytes of those same values. The - * returned array will be half the length of the passed String, as it takes two characters to represent any given - * byte. An exception is thrown if the passed String has an odd number of elements. - * - * @param data - * A String containing hexadecimal digits - * @return A byte array containing binary data decoded from the supplied char array. - * @throws DecoderException - * Thrown if an odd number or illegal of characters is supplied - * @since 1.11 - */ - @Throws(DecoderException::class) - fun decodeHex(data: String): ByteArray { - return decodeHex(data.toCharArray()) - } - - /** - * Converts an array of characters representing hexadecimal values into an array of bytes of those same values. The - * returned array will be half the length of the passed array, as it takes two characters to represent any given - * byte. An exception is thrown if the passed char array has an odd number of elements. - * - * @param data - * An array of characters containing hexadecimal digits - * @return A byte array containing binary data decoded from the supplied char array. - * @throws DecoderException - * Thrown if an odd number or illegal of characters is supplied - */ - @Throws(DecoderException::class) - fun decodeHex(data: CharArray): ByteArray { - - val len = data.size - - if (len and 0x01 != 0) { - throw DecoderException("Odd number of characters.") - } - - val out = ByteArray(len shr 1) - - // two characters form the hex value. - var i = 0 - var j = 0 - while (j < len) { - var f = toDigit(data[j], j) shl 4 - j++ - f = f or toDigit(data[j], j) - j++ - out[i] = (f and 0xFF).toByte() - i++ - } - - return out - } - - /** - * Converts an array of bytes into an array of characters representing the hexadecimal values of each byte in order. - * The returned array will be double the length of the passed array, as it takes two characters to represent any - * given byte. - * - * @param data - * a byte[] to convert to Hex characters - * @param toLowerCase - * `true` converts to lowercase, `false` to uppercase - * @return A char[] containing hexadecimal characters in the selected case - * @since 1.4 - */ - @JvmOverloads - fun encodeHex(data: ByteArray, toLowerCase: Boolean = true): CharArray { - return encodeHex(data, if (toLowerCase) DIGITS_LOWER else DIGITS_UPPER) - } - - /** - * Converts a byte bufferId into an array of characters representing the hexadecimal values of each byte in order. - * The returned array will be double the length of the passed array, as it takes two characters to represent any - * given byte. - * - * @param data - * a byte bufferId to convert to Hex characters - * @param toLowerCase - * `true` converts to lowercase, `false` to uppercase - * @return A char[] containing hexadecimal characters in the selected case - * @since 1.11 - */ - @JvmOverloads - fun encodeHex(data: ByteBuffer, toLowerCase: Boolean = true): CharArray { - return encodeHex(data, if (toLowerCase) DIGITS_LOWER else DIGITS_UPPER) - } - - /** - * Converts an array of bytes into an array of characters representing the hexadecimal values of each byte in order. - * The returned array will be double the length of the passed array, as it takes two characters to represent any - * given byte. - * - * @param data - * a byte[] to convert to Hex characters - * @param toDigits - * the output alphabet (must contain at least 16 chars) - * @return A char[] containing the appropriate characters from the alphabet - * For best results, this should be either upper- or lower-case hex. - * @since 1.4 - */ - private fun encodeHex(data: ByteArray, toDigits: CharArray): CharArray { - val l = data.size - val out = CharArray(l shl 1) - // two characters form the hex value. - var i = 0 - var j = 0 - while (i < l) { - out[j++] = toDigits[(0xF0 and data[i].toInt()).ushr(4)] - out[j++] = toDigits[0x0F and data[i].toInt()] - i++ - } - return out - } - - /** - * Converts a byte bufferId into an array of characters representing the hexadecimal values of each byte in order. - * The returned array will be double the length of the passed array, as it takes two characters to represent any - * given byte. - * - * @param data - * a byte bufferId to convert to Hex characters - * @param toDigits - * the output alphabet (must be at least 16 characters) - * @return A char[] containing the appropriate characters from the alphabet - * For best results, this should be either upper- or lower-case hex. - * @since 1.11 - */ - private fun encodeHex(data: ByteBuffer, toDigits: CharArray): CharArray { - return encodeHex(data.array(), toDigits) - } - - /** - * Converts an array of bytes into a String representing the hexadecimal values of each byte in order. The returned - * String will be double the length of the passed array, as it takes two characters to represent any given byte. - * - * @param data - * a byte[] to convert to Hex characters - * @return A String containing lower-case hexadecimal characters - * @since 1.4 - */ - fun encodeHexString(data: ByteArray): String { - return String(encodeHex(data)) - } - - /** - * Converts an array of bytes into a String representing the hexadecimal values of each byte in order. The returned - * String will be double the length of the passed array, as it takes two characters to represent any given byte. - * - * @param data - * a byte[] to convert to Hex characters - * @param toLowerCase - * `true` converts to lowercase, `false` to uppercase - * @return A String containing lower-case hexadecimal characters - * @since 1.11 - */ - fun encodeHexString(data: ByteArray, toLowerCase: Boolean): String { - return String(encodeHex(data, toLowerCase)) - } - - /** - * Converts a byte bufferId into a String representing the hexadecimal values of each byte in order. The returned - * String will be double the length of the passed array, as it takes two characters to represent any given byte. - * - * @param data - * a byte bufferId to convert to Hex characters - * @return A String containing lower-case hexadecimal characters - * @since 1.11 - */ - fun encodeHexString(data: ByteBuffer): String { - return String(encodeHex(data)) - } - - /** - * Converts a byte bufferId into a String representing the hexadecimal values of each byte in order. The returned - * String will be double the length of the passed array, as it takes two characters to represent any given byte. - * - * @param data - * a byte bufferId to convert to Hex characters - * @param toLowerCase - * `true` converts to lowercase, `false` to uppercase - * @return A String containing lower-case hexadecimal characters - * @since 1.11 - */ - fun encodeHexString(data: ByteBuffer, toLowerCase: Boolean): String { - return String(encodeHex(data, toLowerCase)) - } - - /** - * Converts a hexadecimal character to an integer. - * - * @param ch - * A character to convert to an integer digit - * @param index - * The index of the character in the source - * @return An integer - * @throws DecoderException - * Thrown if ch is an illegal hex character - */ - @Throws(DecoderException::class) - private fun toDigit(ch: Char, index: Int): Int { - val digit = Character.digit(ch, 16) - if (digit == -1) { - throw DecoderException("Illegal hexadecimal character $ch at index $index") - } - return digit - } - } -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/util/compatibility/AndroidCompatibilityUtils.kt b/app/src/main/java/de/kuschku/quasseldroid/util/compatibility/AndroidCompatibilityUtils.kt deleted file mode 100644 index 75fc33d1872045e5c866e314839dbeccfe901fce..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/util/compatibility/AndroidCompatibilityUtils.kt +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.util.compatibility - -import android.os.Build -import de.kuschku.libquassel.util.compatibility.CompatibilityUtils -import java.util.* - -object AndroidCompatibilityUtils { - fun inject() { - /** - * This is used to check if the current device supports Sockets with the KeepAlive flag. - * As that feature is only missing on Chromium devices, we just check for that - * - * @return Does the current device support KeepAlive sockets? - */ - CompatibilityUtils.supportsKeepAlive = !isChromeBook() - } - - private fun isChromeBook(): Boolean { - return Build.MANUFACTURER.toLowerCase(Locale.ENGLISH).contains("chromium") || - Build.MANUFACTURER.toLowerCase(Locale.ENGLISH).contains("chrome") || - Build.BRAND.toLowerCase(Locale.ENGLISH).contains("chromium") || - Build.BRAND.toLowerCase(Locale.ENGLISH).contains("chrome") - } -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/util/compatibility/AndroidCrashFixer.kt b/app/src/main/java/de/kuschku/quasseldroid/util/compatibility/AndroidCrashFixer.kt deleted file mode 100644 index 52cea4ed22fff3506f31c83edb1c414fa9176988..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/util/compatibility/AndroidCrashFixer.kt +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.util.compatibility - -object AndroidCrashFixer { - fun removeCrashableCharacters(text: String): String { - var previousRtlModifier = 0.toChar() - return text.fold(StringBuilder()) { builder, char -> - if (char != '\u200E' && char != '\u200F') { - if (previousRtlModifier != 0.toChar() && !char.isWhitespace()) { - builder.append(previousRtlModifier) - previousRtlModifier = 0.toChar() - } - builder.append(char) - } else { - previousRtlModifier = char - } - builder - }.toString() - } -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/util/compatibility/AndroidHandlerService.kt b/app/src/main/java/de/kuschku/quasseldroid/util/compatibility/AndroidHandlerService.kt deleted file mode 100644 index 481435c2452e3e9d7a40eea3a9536bc0b5f61a05..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/util/compatibility/AndroidHandlerService.kt +++ /dev/null @@ -1,172 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.util.compatibility - -import android.os.Handler -import android.os.HandlerThread -import android.os.Message -import android.os.Process -import de.kuschku.libquassel.util.compatibility.HandlerService -import io.reactivex.Scheduler -import io.reactivex.disposables.Disposable -import io.reactivex.disposables.Disposables -import io.reactivex.plugins.RxJavaPlugins -import java.util.concurrent.TimeUnit - -class AndroidHandlerService : HandlerService { - override lateinit var scheduler: Scheduler - - override fun serialize(f: () -> Unit) { - serializeHandler.post(f) - } - - override fun deserialize(f: () -> Unit) { - deserializeHandler.post(f) - } - - override fun write(f: () -> Unit) { - writeHandler.post(f) - } - - override fun backend(f: () -> Unit) { - backendHandler.post(f) - } - - override fun backendDelayed(delayMillis: Long, f: () -> Unit) { - backendHandler.postDelayed(f, delayMillis) - } - - private val serializeThread = HandlerThread("serialize", Process.THREAD_PRIORITY_BACKGROUND) - private val deserializeThread = HandlerThread("deserialize", Process.THREAD_PRIORITY_BACKGROUND) - private val writeThread = HandlerThread("write", Process.THREAD_PRIORITY_BACKGROUND) - private val backendThread = HandlerThread("backend", Process.THREAD_PRIORITY_BACKGROUND) - - private val serializeHandler: Handler - private val deserializeHandler: Handler - private val writeHandler: Handler - private val backendHandler: Handler - - private val internalExceptionHandler = Thread.UncaughtExceptionHandler { thread: Thread, throwable: Throwable -> - val exceptionHandler = exceptionHandler ?: Thread.getDefaultUncaughtExceptionHandler() - exceptionHandler.uncaughtException(thread, throwable) - } - - init { - serializeThread.uncaughtExceptionHandler = internalExceptionHandler - deserializeThread.uncaughtExceptionHandler = internalExceptionHandler - writeThread.uncaughtExceptionHandler = internalExceptionHandler - backendThread.uncaughtExceptionHandler = internalExceptionHandler - - serializeThread.start() - deserializeThread.start() - writeThread.start() - backendThread.start() - - serializeHandler = Handler(serializeThread.looper) - deserializeHandler = Handler(deserializeThread.looper) - writeHandler = Handler(writeThread.looper) - backendHandler = Handler(backendThread.looper) - - scheduler = HandlerScheduler(backendHandler) - } - - override var exceptionHandler: Thread.UncaughtExceptionHandler? = null - get() = field ?: Thread.getDefaultUncaughtExceptionHandler() - - override fun quit() { - serializeThread.quit() - deserializeThread.quit() - writeThread.quit() - backendThread.quit() - } - - internal class HandlerScheduler(private val handler: Handler) : Scheduler() { - override fun scheduleDirect(run: Runnable, delay: Long, unit: TimeUnit): Disposable { - val scheduled = ScheduledRunnable(handler, RxJavaPlugins.onSchedule(run)) - handler.postDelayed(scheduled, unit.toMillis(delay)) - return scheduled - } - - override fun createWorker(): Scheduler.Worker { - return HandlerWorker(handler) - } - - private class HandlerWorker constructor(private val handler: Handler) : Scheduler.Worker() { - @Volatile - private var disposed: Boolean = false - - override fun schedule(run: Runnable, delay: Long, unit: TimeUnit): Disposable { - if (disposed) { - return Disposables.disposed() - } - - val scheduled = ScheduledRunnable(handler, RxJavaPlugins.onSchedule(run)) - - val message = Message.obtain(handler, scheduled) - message.obj = this // Used as token for batch disposal of this worker's runnables. - - handler.sendMessageDelayed(message, unit.toMillis(delay)) - - // Re-check disposed state for removing in case we were racing a call to dispose(). - if (disposed) { - handler.removeCallbacks(scheduled) - return Disposables.disposed() - } - - return scheduled - } - - override fun dispose() { - disposed = true - handler.removeCallbacksAndMessages(this /* token */) - } - - override fun isDisposed(): Boolean { - return disposed - } - } - - private class ScheduledRunnable internal constructor( - private val handler: Handler, - private val delegate: Runnable - ) : Runnable, Disposable { - @Volatile - private var disposed: Boolean = false - - override fun run() { - try { - delegate.run() - } catch (t: Throwable) { - RxJavaPlugins.onError(t) - } - - } - - override fun dispose() { - disposed = true - handler.removeCallbacks(this) - } - - override fun isDisposed(): Boolean { - return disposed - } - } - } -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/util/compatibility/AndroidLoggingHandler.kt b/app/src/main/java/de/kuschku/quasseldroid/util/compatibility/AndroidLoggingHandler.kt deleted file mode 100644 index 30efd44463e322c4e739bac1a073f868664088de..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/util/compatibility/AndroidLoggingHandler.kt +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.util.compatibility - -import android.util.Log -import de.kuschku.libquassel.util.compatibility.LoggingHandler -import de.kuschku.quasseldroid.BuildConfig - -object AndroidLoggingHandler : LoggingHandler() { - override fun _isLoggable(logLevel: LogLevel, tag: String): Boolean { - return BuildConfig.DEBUG || Log.isLoggable(tag, priority(logLevel)) - } - - override fun _log(logLevel: LogLevel, tag: String, message: String?, throwable: Throwable?) { - val priority = priority( - logLevel - ) - if (message != null) - Log.println(priority, tag, message) - if (throwable != null) - Log.println(priority, tag, Log.getStackTraceString(throwable)) - } - - private fun priority(logLevel: LogLevel): Int = when (logLevel) { - LogLevel.VERBOSE -> Log.VERBOSE - LogLevel.DEBUG -> Log.DEBUG - LogLevel.INFO -> Log.INFO - LogLevel.WARN -> Log.WARN - LogLevel.ERROR -> Log.ERROR - LogLevel.ASSERT -> Log.ASSERT - } - - fun inject() { - LoggingHandler.loggingHandlers.clear() - LoggingHandler.loggingHandlers.add(this) - } -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/util/compatibility/AndroidStreamChannelFactory.kt b/app/src/main/java/de/kuschku/quasseldroid/util/compatibility/AndroidStreamChannelFactory.kt deleted file mode 100644 index a76384404696abab0b7271d005d54451c22f6e35..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/util/compatibility/AndroidStreamChannelFactory.kt +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.util.compatibility - -import de.kuschku.libquassel.util.compatibility.StreamChannelFactory -import de.kuschku.quasseldroid.util.backport.ReadableWrappedChannel -import de.kuschku.quasseldroid.util.backport.WritableWrappedChannel -import java.io.InputStream -import java.io.OutputStream -import java.nio.channels.ReadableByteChannel -import java.nio.channels.WritableByteChannel - -object AndroidStreamChannelFactory : StreamChannelFactory { - override fun create(stream: InputStream): ReadableByteChannel = ReadableWrappedChannel(stream) - override fun create(stream: OutputStream): WritableByteChannel = WritableWrappedChannel(stream) - - fun inject() { - StreamChannelFactory.instance = this - } -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/util/compatibility/FixedLifecycleService.java b/app/src/main/java/de/kuschku/quasseldroid/util/compatibility/FixedLifecycleService.java deleted file mode 100644 index 9fac9df26919a32d811e8b44985871354688e31d..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/util/compatibility/FixedLifecycleService.java +++ /dev/null @@ -1,103 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -/* - * Copyright (C) 2017 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package de.kuschku.quasseldroid.util.compatibility; - -import android.annotation.SuppressLint; -import android.app.Service; -import android.content.Intent; -import android.os.IBinder; - -import androidx.annotation.CallSuper; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import androidx.lifecycle.Lifecycle; -import androidx.lifecycle.LifecycleOwner; -import androidx.lifecycle.ServiceLifecycleDispatcher; - -/** - * A Service that is also a {@link LifecycleOwner}. - */ -@SuppressLint("Registered") -public class FixedLifecycleService extends Service implements LifecycleOwner { - - private final ServiceLifecycleDispatcher mDispatcher = new ServiceLifecycleDispatcher(this); - - @CallSuper - @Override - public void onCreate() { - mDispatcher.onServicePreSuperOnCreate(); - super.onCreate(); - } - - @CallSuper - @Nullable - @Override - public IBinder onBind(@Nullable Intent intent) { - mDispatcher.onServicePreSuperOnBind(); - return null; - } - - @SuppressWarnings("deprecation") - @CallSuper - @Override - public void onStart(@Nullable Intent intent, int startId) { - mDispatcher.onServicePreSuperOnStart(); - super.onStart(intent, startId); - } - - // this method is added only to annotate it with @CallSuper. - // In usual service super.onStartCommand is no-op, but in LifecycleService - // it results in mDispatcher.onServicePreSuperOnStart() call, because - // super.onStartCommand calls onStart(). - @CallSuper - @Override - public int onStartCommand(@Nullable Intent intent, int flags, int startId) { - return super.onStartCommand(intent, flags, startId); - } - - @CallSuper - @Override - public void onDestroy() { - mDispatcher.onServicePreSuperOnDestroy(); - super.onDestroy(); - } - - @Override - @NonNull - public Lifecycle getLifecycle() { - return mDispatcher.getLifecycle(); - } -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/util/embed/EmbedApi.kt b/app/src/main/java/de/kuschku/quasseldroid/util/embed/EmbedApi.kt deleted file mode 100644 index e1b3a157c236de91ac75883c55cacdb3721d7439..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/util/embed/EmbedApi.kt +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.util.embed - -import io.reactivex.Observable -import retrofit2.http.GET -import retrofit2.http.Query - -interface EmbedApi { - @GET() - fun embedData(@Query("url") url: String): Observable<EmbedResponse> -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/util/embed/EmbedHelper.kt b/app/src/main/java/de/kuschku/quasseldroid/util/embed/EmbedHelper.kt deleted file mode 100644 index f93a8e8d517d49ea97bb6fc9f2840c5f17a348de..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/util/embed/EmbedHelper.kt +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.util.embed - -import com.google.gson.GsonBuilder -import io.reactivex.Observable -import retrofit2.Retrofit -import retrofit2.converter.gson.GsonConverterFactory - -class EmbedHelper(baseUrl: String) { - private val api = Retrofit.Builder() - .baseUrl(baseUrl) - .addConverterFactory(GsonConverterFactory.create(GsonBuilder().setLenient().create())) - .build() - .create(EmbedApi::class.java) - - fun embedCode(url: String): Observable<EmbedResponse> = api.embedData(url) -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/util/embed/EmbedResponse.kt b/app/src/main/java/de/kuschku/quasseldroid/util/embed/EmbedResponse.kt deleted file mode 100644 index 1c10625d75fa6a8e8dfb576154e42cbcd8b03011..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/util/embed/EmbedResponse.kt +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.util.embed - -data class EmbedResponse( - val result: Boolean, - val type: String, - val code: String -) diff --git a/app/src/main/java/de/kuschku/quasseldroid/util/helper/AccountDaoHelper.kt b/app/src/main/java/de/kuschku/quasseldroid/util/helper/AccountDaoHelper.kt deleted file mode 100644 index 2393a835add88abc1e94341fe685dc75b2714394..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/util/helper/AccountDaoHelper.kt +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.util.helper - -import de.kuschku.quasseldroid.persistence.dao.AccountDao -import de.kuschku.quasseldroid.persistence.dao.create -import de.kuschku.quasseldroid.persistence.models.Account - -fun AccountDao.new(vararg entities: Account) { - val ids = create(*entities) - for (i in entities.indices) { - entities[i].id = ids[i] - } -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/util/helper/ActivityHelper.kt b/app/src/main/java/de/kuschku/quasseldroid/util/helper/ActivityHelper.kt deleted file mode 100644 index e10d716903afa4dcb89623fe416e4a250b89b8d0..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/util/helper/ActivityHelper.kt +++ /dev/null @@ -1,91 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.util.helper - -import android.annotation.TargetApi -import android.app.Activity -import android.app.ActivityManager -import android.graphics.Bitmap -import android.graphics.BitmapFactory -import android.os.Build -import androidx.annotation.ColorRes -import androidx.annotation.DrawableRes -import androidx.annotation.StringRes - -/** - * Modifies the display of an {@see Activity} in the Android Recents menu if the current version - * of Android supports doing so. - * - * @param label The text shown as label - * @param icon The icon displayed in recents - passed as Android Drawable Resource - * @param colorPrimary The color used as background for the header of the recents card - passed as Android - * Color Resource - */ -fun Activity.updateRecentsHeaderIfExisting(label: String, @DrawableRes icon: Int, - @ColorRes colorPrimary: Int) { - val iconRaw = BitmapFactory.decodeResource(resources, icon) - val colorPrimaryRaw = resources.getColorBackport(colorPrimary, theme) - updateRecentsHeaderIfExisting(label, iconRaw, colorPrimaryRaw) -} - -/** - * Modifies the display of an {@see Activity} in the Android Recents menu if the current version - * of Android supports doing so. - * - * @param label The text shown as label - passed as Android String Resource - * @param icon The icon displayed in recents - passed as Android Drawable Resource - * @param colorPrimary The color used as background for the header of the recents card - passed as Android - * Color Resource - */ -fun Activity.updateRecentsHeaderIfExisting(@StringRes label: Int, @DrawableRes icon: Int, - @ColorRes colorPrimary: Int) { - val labelRaw = resources.getString(label) - val iconRaw = BitmapFactory.decodeResource(resources, icon) - val colorPrimaryRaw = resources.getColorBackport(colorPrimary, theme) - updateRecentsHeaderIfExisting(labelRaw, iconRaw, colorPrimaryRaw) -} - -/** - * Modifies the display of an {@see Activity} in the Android Recents menu if the current version - * of Android supports doing so. - * - * @param label The text shown in recents as label - * @param icon The icon displayed in recents - * @param colorPrimary The color used as background for the header of the recents card - */ -fun Activity.updateRecentsHeaderIfExisting(label: String, icon: Bitmap, colorPrimary: Int) { - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { - updateRecentsHeader(label, icon, colorPrimary) - } -} - -/** - * Forcibly updated the recents card of an {@see Activity} in the Android Recents menu. - * - * @param label The text shown in recents as label - * @param icon The icon displayed in recents - * @param colorPrimary The color used as background for the header of the recents card - * @since Lollipop - */ -@TargetApi(Build.VERSION_CODES.LOLLIPOP) -private fun Activity.updateRecentsHeader(label: String, icon: Bitmap, - colorPrimary: Int) { - setTaskDescription(ActivityManager.TaskDescription(label, icon, colorPrimary)) -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/util/helper/AnyHelper.kt b/app/src/main/java/de/kuschku/quasseldroid/util/helper/AnyHelper.kt deleted file mode 100644 index 03c337038c7e1910923512b987aa67e59ef9e84a..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/util/helper/AnyHelper.kt +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.util.helper - -inline fun <T> T.letIf(condition: Boolean, f: (T) -> T) = if (condition) f(this) else this diff --git a/app/src/main/java/de/kuschku/quasseldroid/util/helper/BooleanHelper.kt b/app/src/main/java/de/kuschku/quasseldroid/util/helper/BooleanHelper.kt deleted file mode 100644 index 016b315912109529d993cf3c081e7577b09c2f27..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/util/helper/BooleanHelper.kt +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.util.helper - -inline fun <R> Boolean.letIf(block: () -> R): R? { - return if (this) block() else null -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/util/helper/ButtonHelper.kt b/app/src/main/java/de/kuschku/quasseldroid/util/helper/ButtonHelper.kt deleted file mode 100644 index 7a7493ac6785dd866064a7acae1f8ecb8d1e6d20..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/util/helper/ButtonHelper.kt +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.util.helper - -import android.widget.Button -import androidx.core.graphics.drawable.DrawableCompat - -fun Button.retint() { - val (left, top, right, bottom) = compoundDrawables.map { - it?.apply { - it.mutate() - DrawableCompat.setTint(it, textColors.defaultColor) - } - } - setCompoundDrawables(left, top, right, bottom) -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/util/helper/CharSequenceHelper.kt b/app/src/main/java/de/kuschku/quasseldroid/util/helper/CharSequenceHelper.kt deleted file mode 100644 index d38d2585023dddd156cdd1fb93c852ef377f76f0..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/util/helper/CharSequenceHelper.kt +++ /dev/null @@ -1,187 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ -@file:Suppress("NOTHING_TO_INLINE") - -package de.kuschku.quasseldroid.util.helper - -private class DelimitedRangesSequence( - private val input: CharSequence, - private val startIndex: Int, - private val limit: Int, - private val getNextMatch: CharSequence.(Int) -> Pair<Int, Int>? -) : Sequence<IntRange> { - override fun iterator(): Iterator<IntRange> = object : Iterator<IntRange> { - var nextState: Int = -1 // -1 for unknown, 0 for done, 1 for continue - var currentStartIndex: Int = startIndex.coerceIn(0, input.length) - var nextSearchIndex: Int = currentStartIndex - var nextItem: IntRange? = null - var counter: Int = 0 - - private fun calcNext() { - if (nextSearchIndex < 0) { - nextState = 0 - nextItem = null - } else { - if (limit > 0 && ++counter >= limit || nextSearchIndex > input.length) { - nextItem = currentStartIndex..input.lastIndex - nextSearchIndex = -1 - } else { - val match = input.getNextMatch(nextSearchIndex) - if (match == null) { - nextItem = currentStartIndex..input.lastIndex - nextSearchIndex = -1 - } else { - val (index, length) = match - nextItem = currentStartIndex until index - currentStartIndex = index + length - nextSearchIndex = currentStartIndex + if (length == 0) 1 else 0 - } - } - nextState = 1 - } - } - - override fun next(): IntRange { - if (nextState == -1) - calcNext() - if (nextState == 0) - throw java.util.NoSuchElementException() - val result = nextItem as IntRange - // Clean next to avoid keeping reference on yielded instance - nextItem = null - nextState = -1 - return result - } - - override fun hasNext(): Boolean { - if (nextState == -1) - calcNext() - return nextState == 1 - } - } -} - -internal fun CharSequence.regionMatchesImpl(thisOffset: Int, other: CharSequence, otherOffset: Int, - length: Int, ignoreCase: Boolean): Boolean { - if ((otherOffset < 0) || (thisOffset < 0) || (thisOffset > this.length - length) - || (otherOffset > other.length - length)) { - return false - } - - for (index in 0 until length) { - if (!this[thisOffset + index].equals(other[otherOffset + index], ignoreCase)) - return false - } - return true -} - -private fun CharSequence.findAnyOf(strings: Collection<String>, startIndex: Int, - ignoreCase: Boolean, last: Boolean): Pair<Int, String>? { - if (!ignoreCase && strings.size == 1) { - val string = strings.single() - val index = if (!last) indexOf(string, startIndex) else lastIndexOf(string, startIndex) - return if (index < 0) null else index to string - } - - val indices = if (!last) startIndex.coerceAtLeast(0)..length else startIndex.coerceAtMost( - lastIndex - ) downTo 0 - - if (this is String) { - for (index in indices) { - val matchingString = strings.firstOrNull { - it.regionMatches( - 0, this, index, it.length, ignoreCase - ) - } - if (matchingString != null) - return index to matchingString - } - } else { - for (index in indices) { - val matchingString = strings.firstOrNull { - it.regionMatchesImpl( - 0, this, index, it.length, ignoreCase - ) - } - if (matchingString != null) - return index to matchingString - } - } - - return null -} - -private fun CharSequence.rangesDelimitedBy(delimiters: Array<out String>, startIndex: Int = 0, - ignoreCase: Boolean = false, - limit: Int = 0): Sequence<IntRange> { - require(limit >= 0) { "Limit must be non-negative, but was $limit." } - val delimitersList = delimiters.asList() - - return DelimitedRangesSequence( - this, startIndex, limit) { startIndex -> - findAnyOf( - delimitersList, startIndex, ignoreCase = ignoreCase, last = false - )?.let { it.first to it.second.length } - } -} - -fun CharSequence.splitToSequence(vararg delimiters: String, ignoreCase: Boolean = false, - limit: Int = 0): Sequence<CharSequence> = - rangesDelimitedBy(delimiters, ignoreCase = ignoreCase, limit = limit).map { subSequence(it) } - -fun CharSequence.lineSequence(): Sequence<CharSequence> = splitToSequence("\r\n", "\n", "\r") - -fun CharSequence.lastWordIndices(cursor: Int = this.length, - onlyBeforeCursor: Boolean = false): IntRange? { - val cursorPosition = if (cursor != -1) { - cursor - } else { - length - } - - val beginningOfWord = sequenceOf( - lastIndexOf(' ', cursorPosition - 1), - lastIndexOf('\r', cursorPosition - 1), - lastIndexOf('\n', cursorPosition - 1), - lastIndexOf('\t', cursorPosition - 1) - ).max() ?: -1 - - val endOfWord = sequenceOf( - indexOf(' ', cursorPosition), - indexOf('\r', cursorPosition), - indexOf('\n', cursorPosition), - indexOf('\t', cursorPosition) - ).min() ?: -1 - - val start = beginningOfWord + 1 - val end = when { - onlyBeforeCursor -> cursorPosition - endOfWord == -1 -> cursorPosition - else -> endOfWord - } - - return if (end - start > 0 && start >= 0 && end <= length) { - start until end - } else { - null - } -} - -inline fun <T : CharSequence> T?.notBlank(): T? = if (this.isNullOrBlank()) null else this diff --git a/app/src/main/java/de/kuschku/quasseldroid/util/helper/ContextHelper.kt b/app/src/main/java/de/kuschku/quasseldroid/util/helper/ContextHelper.kt deleted file mode 100644 index f8451276c849e0e18c45c8e02bdc3edf5d40b516..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/util/helper/ContextHelper.kt +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.util.helper - -import android.content.Context -import android.content.SharedPreferences -import android.preference.PreferenceManager -import androidx.annotation.ColorInt -import androidx.annotation.ColorRes -import androidx.annotation.DrawableRes -import androidx.core.content.ContextCompat -import androidx.vectordrawable.graphics.drawable.VectorDrawableCompat - -fun Context.getDrawableCompat(@DrawableRes id: Int) = ContextCompat.getDrawable(this, id) - -fun Context.getVectorDrawableCompat(@DrawableRes id: Int) = - VectorDrawableCompat.create(this.resources, id, this.theme) - -@ColorInt -fun Context.getColorCompat(@ColorRes id: Int) = ContextCompat.getColor(this, id) - - -fun <T> Context.sharedPreferences(name: String? = null, mode: Int = 0, - f: SharedPreferences.() -> T) = - if (name == null) { - PreferenceManager.getDefaultSharedPreferences(this).f() - } else { - getSharedPreferences(name, mode).f() - } diff --git a/app/src/main/java/de/kuschku/quasseldroid/util/helper/DrawableHelper.kt b/app/src/main/java/de/kuschku/quasseldroid/util/helper/DrawableHelper.kt deleted file mode 100644 index e4f92014c90c1a33e054e3036c1dacc0f0046cf9..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/util/helper/DrawableHelper.kt +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.util.helper - -import android.graphics.drawable.Drawable -import androidx.annotation.ColorInt -import androidx.core.graphics.drawable.DrawableCompat - -fun Drawable.tint(@ColorInt tint: Int) = DrawableCompat.setTint(this, tint) diff --git a/app/src/main/java/de/kuschku/quasseldroid/util/helper/EditableHelper.kt b/app/src/main/java/de/kuschku/quasseldroid/util/helper/EditableHelper.kt deleted file mode 100644 index 3fd9503df9b74c4b13d097ba85d5a399dd927fbf..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/util/helper/EditableHelper.kt +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.util.helper - -import android.text.Editable -import android.text.Spanned -import de.kuschku.quasseldroid.util.irc.format.spans.Copyable - -inline fun <reified U, T> Editable.removeSpans( - range: IntRange, removeInvalid: Boolean = false, f: (U) -> T? -) where T : Copyable<T> { - for (raw in getSpans<U>(range.start, range.endInclusive + 1, U::class.java)) { - val spanFlags = getSpanFlags(raw) - if (spanFlags and Spanned.SPAN_COMPOSING != 0) continue - - val spanEnd = getSpanEnd(raw) - val spanStart = getSpanStart(raw) - - val span = f(raw) - if (span == null) { - if (removeInvalid) - removeSpan(raw) - } else { - removeSpan(raw) - - for (spanRange in spanStart until spanEnd without range) { - setSpan( - span.copy(), - spanRange.start, - spanRange.endInclusive + 1, - (spanFlags and 0x03.inv()) or 0x01 - ) - } - } - } -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/util/helper/FloatingActionButtonHelper.kt b/app/src/main/java/de/kuschku/quasseldroid/util/helper/FloatingActionButtonHelper.kt deleted file mode 100644 index 8ffe1620c78cbd3f1557249a46771dde1db600b5..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/util/helper/FloatingActionButtonHelper.kt +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.util.helper - -import com.google.android.material.floatingactionbutton.FloatingActionButton - -fun FloatingActionButton.toggle(visible: Boolean) { - if (visible) show() - else hide() -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/util/helper/GlideHelper.kt b/app/src/main/java/de/kuschku/quasseldroid/util/helper/GlideHelper.kt deleted file mode 100644 index 103db64991ca12f13b168b328d4bcc7db43abb96..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/util/helper/GlideHelper.kt +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.util.helper - -import android.graphics.drawable.Drawable -import android.widget.ImageView -import com.bumptech.glide.RequestBuilder -import com.bumptech.glide.load.DataSource -import com.bumptech.glide.load.engine.GlideException -import com.bumptech.glide.load.resource.bitmap.RoundedCorners -import com.bumptech.glide.request.RequestListener -import com.bumptech.glide.request.target.Target -import de.kuschku.quasseldroid.GlideApp -import de.kuschku.quasseldroid.GlideRequest -import de.kuschku.quasseldroid.GlideRequests -import de.kuschku.quasseldroid.R -import de.kuschku.quasseldroid.viewmodel.data.Avatar - -fun GlideRequests.loadWithFallbacks(urls: List<Avatar>): GlideRequest<Drawable>? { - fun fold(url: Avatar, fallback: RequestBuilder<Drawable>?): GlideRequest<Drawable> { - return when (url) { - is Avatar.NativeAvatar -> load(url.url) - is Avatar.GravatarAvatar -> load(url.url) - is Avatar.IRCCloudAvatar -> load(url.url) - is Avatar.MatrixAvatar -> load(url) - }.let { - if (fallback != null) it.error(fallback) else it - } - } - - return urls.foldRight(null, ::fold) -} - -fun ImageView.loadAvatars(urls: List<Avatar>, fallback: Drawable? = null, crop: Boolean = true, - listener: ((Any?) -> Unit)? = null) { - if (urls.isNotEmpty()) { - GlideApp.with(this) - .loadWithFallbacks(urls) - ?.let { - if (crop) { - it.optionalCircleCrop() - } else { - it.transform(RoundedCorners(this.context.resources.getDimensionPixelSize(R.dimen.avatar_radius))) - } - } - ?.placeholder(fallback) - ?.letIf(listener != null) { - it.addListener(object : RequestListener<Drawable> { - override fun onLoadFailed(e: GlideException?, model: Any?, target: Target<Drawable>?, - isFirstResource: Boolean) = false - - override fun onResourceReady(resource: Drawable?, model: Any?, target: Target<Drawable>?, - dataSource: DataSource?, isFirstResource: Boolean): Boolean { - listener?.invoke(model) - - return false - } - }) - } - ?.into(this) - } else { - GlideApp.with(this).clear(this) - setImageDrawable(fallback) - } -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/util/helper/GsonHelper.kt b/app/src/main/java/de/kuschku/quasseldroid/util/helper/GsonHelper.kt deleted file mode 100644 index 550fc382db8404830a1a26bc054671e37cd67f86..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/util/helper/GsonHelper.kt +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.util.helper - -import com.google.gson.Gson -import java.io.File -import java.io.Reader - -inline fun <reified T> Gson.fromJson(file: File): T = this.fromJson(file.reader(), T::class.java) -inline fun <reified T> Gson.fromJson(text: String): T = this.fromJson(text, T::class.java) -inline fun <reified T> Gson.fromJson(reader: Reader): T = this.fromJson(reader, T::class.java) diff --git a/app/src/main/java/de/kuschku/quasseldroid/util/helper/IntProgressionHelper.kt b/app/src/main/java/de/kuschku/quasseldroid/util/helper/IntProgressionHelper.kt deleted file mode 100644 index 0ecc964235fc781dc41b191264600072faa6fa70..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/util/helper/IntProgressionHelper.kt +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.util.helper - -val IntProgression.length: Int - get() = this.last + 1 - this.first diff --git a/app/src/main/java/de/kuschku/quasseldroid/util/helper/IntRangeHelper.kt b/app/src/main/java/de/kuschku/quasseldroid/util/helper/IntRangeHelper.kt deleted file mode 100644 index f805191a2dcde38b5af2cb898a5fc21ce2350d9a..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/util/helper/IntRangeHelper.kt +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.util.helper - -import de.kuschku.libquassel.util.helper.clampOf - -infix fun IntRange.without(other: IntRange): Iterable<IntRange> { - val otherStart = clampOf(minOf(other.start, other.last + 1), this.start, this.last + 1) - val otherLast = clampOf(maxOf(other.start, other.last + 1), this.start, this.last + 1) - - val startingFragment: IntRange = this.start until otherStart - val endingFragment: IntRange = otherLast + 1 until this.last + 1 - - return listOf(startingFragment, endingFragment).filter { it.last >= it.start } -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/util/helper/ListHelper.kt b/app/src/main/java/de/kuschku/quasseldroid/util/helper/ListHelper.kt deleted file mode 100644 index e3a1de258516d91315287634782a96e68b6e1146..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/util/helper/ListHelper.kt +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.util.helper - -inline fun <T, U> List<T>.mapReverse(mapper: (T) -> U): List<U> { - val result = mutableListOf<U>() - for (i in size - 1 downTo 0) { - result.add(0, mapper(this[i])) - } - return result -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/util/helper/LruCacheHelper.kt b/app/src/main/java/de/kuschku/quasseldroid/util/helper/LruCacheHelper.kt deleted file mode 100644 index fe3248e1ad5cf44556e87bd18d54c99cb9dc2201..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/util/helper/LruCacheHelper.kt +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.util.helper - -import android.util.LruCache - -inline fun <K, V> LruCache<K, V>.getOrPut(key: K, value: () -> V) = get(key) ?: value().let { - put(key, it) - it -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/util/helper/MenuHelper.kt b/app/src/main/java/de/kuschku/quasseldroid/util/helper/MenuHelper.kt deleted file mode 100644 index dd7b13a19994f5c0452e742ab44d33aa099b9bfd..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/util/helper/MenuHelper.kt +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.util.helper - -import android.content.Context -import android.view.Menu -import androidx.core.graphics.drawable.DrawableCompat -import de.kuschku.quasseldroid.R - -fun Menu.retint(context: Context) { - context.theme.styledAttributes(R.attr.colorControlNormal) { - val color = getColor(0, 0) - - for (item in (0 until size()).map { getItem(it) }) { - item.icon?.mutate()?.let { drawable -> - DrawableCompat.setTint(drawable, color) - item.icon = drawable - } - } - } -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/util/helper/PreferenceHelper.kt b/app/src/main/java/de/kuschku/quasseldroid/util/helper/PreferenceHelper.kt deleted file mode 100644 index 3f1059fa5893253c608221bf0e032069229faf16..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/util/helper/PreferenceHelper.kt +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.util.helper - -import androidx.preference.PreferenceCategory -import androidx.preference.PreferenceScreen - -fun PreferenceCategory.preferences() = (0 until preferenceCount).map(this::getPreference) -fun PreferenceScreen.preferences() = (0 until preferenceCount).map(this::getPreference) diff --git a/app/src/main/java/de/kuschku/quasseldroid/util/helper/ResourcesHelper.kt b/app/src/main/java/de/kuschku/quasseldroid/util/helper/ResourcesHelper.kt deleted file mode 100644 index 20a18b4e33f1857a4c9434548769a5b280a969ba..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/util/helper/ResourcesHelper.kt +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.util.helper - -import android.content.res.Resources -import android.os.Build -import androidx.annotation.ColorInt -import androidx.annotation.ColorRes - -@ColorInt -fun Resources.getColorBackport(@ColorRes color: Int, theme: Resources.Theme): Int { - return if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { - getColor(color, theme) - } else { - // We have to use this method on older systems that don’t yet support the new method - // which is used above - getColor(color) - } -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/util/helper/SelectionHelper.kt b/app/src/main/java/de/kuschku/quasseldroid/util/helper/SelectionHelper.kt deleted file mode 100644 index ff889a55b3c58169cf116066e3aca9ca3af03a78..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/util/helper/SelectionHelper.kt +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.util.helper - -import android.text.Selection -import android.widget.EditText - -val CharSequence.selection: IntRange - get() { - val start = Selection.getSelectionStart(this) - val end = Selection.getSelectionEnd(this) - - return minOf(start, end) until maxOf(start, end) - } - -val EditText.selection: IntRange - get() = text.selection diff --git a/app/src/main/java/de/kuschku/quasseldroid/util/helper/SharedPreferencesHelper.kt b/app/src/main/java/de/kuschku/quasseldroid/util/helper/SharedPreferencesHelper.kt deleted file mode 100644 index d465ff1606314438b334ee3d34ae359229cbfcec..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/util/helper/SharedPreferencesHelper.kt +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.util.helper - -import android.annotation.SuppressLint -import android.content.SharedPreferences - -fun SharedPreferences.editApply(f: SharedPreferences.Editor.() -> Unit) { - val editor = this.edit() - editor.f() - editor.apply() -} - -@SuppressLint("ApplySharedPref") -fun SharedPreferences.editCommit(f: SharedPreferences.Editor.() -> Unit) { - val editor = this.edit() - editor.f() - editor.commit() -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/util/helper/SpannedHelper.kt b/app/src/main/java/de/kuschku/quasseldroid/util/helper/SpannedHelper.kt deleted file mode 100644 index 1210433c066b5bc6ee3e363905c1970fa60275cd..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/util/helper/SpannedHelper.kt +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.util.helper - -import android.text.Spanned - -inline fun <reified U> Spanned.spans(range: IntRange) = - getSpans(range.start, range.endInclusive + 1, U::class.java).filter { - getSpanFlags(it) and Spanned.SPAN_COMPOSING == 0 && - (getSpanEnd(it) != range.start || - getSpanFlags(it) and 0x02 != 0) - } - -inline fun <reified U> Spanned.spans(range: IntRange, f: (U) -> Boolean) = - getSpans(range.start, range.last + 1, U::class.java).filter { - f(it) && - getSpanFlags(it) and Spanned.SPAN_COMPOSING == 0 && - (getSpanEnd(it) != range.start || - getSpanFlags(it) and 0x02 != 0) - } - -inline fun <reified U> Spanned.hasSpans(range: IntRange) = - getSpans(range.start, range.endInclusive + 1, U::class.java).any { - getSpanFlags(it) and Spanned.SPAN_COMPOSING == 0 && - (getSpanEnd(it) != range.start || - getSpanFlags(it) and 0x02 != 0) - } - -inline fun <reified U> Spanned.hasSpans(range: IntRange, f: (U) -> Boolean) = - getSpans(range.start, range.last + 1, U::class.java).any { - f(it) && - getSpanFlags(it) and Spanned.SPAN_COMPOSING == 0 && - (getSpanEnd(it) != range.start || - getSpanFlags(it) and 0x02 != 0) - } diff --git a/app/src/main/java/de/kuschku/quasseldroid/util/helper/SwitchCompatHelper.kt b/app/src/main/java/de/kuschku/quasseldroid/util/helper/SwitchCompatHelper.kt deleted file mode 100644 index 3f1e81f6aa60f652fe520355ec66208ba390e98c..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/util/helper/SwitchCompatHelper.kt +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.util.helper - -import android.view.ViewGroup -import androidx.appcompat.widget.SwitchCompat -import de.kuschku.quasseldroid.util.ui.AnimationHelper - -fun SwitchCompat.setDependent(view: ViewGroup, reverse: Boolean = false) { - this.setOnCheckedChangeListener { _, isChecked -> - if (reverse && !isChecked || !reverse && isChecked) { - AnimationHelper.expand(view) - } else { - AnimationHelper.collapse(view) - } - } -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/util/helper/ThemeHelper.kt b/app/src/main/java/de/kuschku/quasseldroid/util/helper/ThemeHelper.kt deleted file mode 100644 index 5c1b98f15674aa53383364ecc9ca585475c42529..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/util/helper/ThemeHelper.kt +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.util.helper - -import android.content.res.Resources -import android.content.res.TypedArray - -inline fun <R> Resources.Theme.styledAttributes(vararg attributes: Int, f: TypedArray.() -> R) = - this.obtainStyledAttributes(attributes).run { - f() - } - -inline fun <R> TypedArray.use(block: (TypedArray) -> R): R { - try { - return block(this) - } finally { - recycle() - } -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/util/helper/ViewHelper.kt b/app/src/main/java/de/kuschku/quasseldroid/util/helper/ViewHelper.kt deleted file mode 100644 index 62b84ad61d157520cf1c15d4dc1eabcb4c842322..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/util/helper/ViewHelper.kt +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.util.helper - -import android.view.View -import androidx.appcompat.widget.TooltipCompat - -fun View.visibleIf(check: Boolean) = if (check) { - this.visibility = View.VISIBLE -} else { - this.visibility = View.GONE -} - -fun View.setTooltip(tooltipText: CharSequence? = this.contentDescription) = - TooltipCompat.setTooltipText(this, tooltipText) diff --git a/app/src/main/java/de/kuschku/quasseldroid/util/helper/X509CertificateHelper.kt b/app/src/main/java/de/kuschku/quasseldroid/util/helper/X509CertificateHelper.kt deleted file mode 100644 index 1c5a4eb70d148ee702905518a1d16ce15551f2b8..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/util/helper/X509CertificateHelper.kt +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.util.helper - -import org.apache.commons.codec.digest.DigestUtils -import java.security.cert.CertificateExpiredException -import java.security.cert.CertificateNotYetValidException -import java.security.cert.X509Certificate - -val X509Certificate.isValid: Boolean - get() = try { - checkValidity() - true - } catch (e: CertificateExpiredException) { - false - } catch (e: CertificateNotYetValidException) { - false - } - -val X509Certificate.sha1Fingerprint: String - get() = DigestUtils.sha1(encoded).joinToString(":") { - (it.toInt() and 0xff).toString(16) - } - -val X509Certificate.sha256Fingerprint: String - get() = DigestUtils.sha256(encoded).joinToString(":") { - (it.toInt() and 0xff).toString(16) - } diff --git a/app/src/main/java/de/kuschku/quasseldroid/util/irc/format/ContentFormatter.kt b/app/src/main/java/de/kuschku/quasseldroid/util/irc/format/ContentFormatter.kt deleted file mode 100644 index 8a50b32c50bd2b1d9f70ea8acf80ac4b2b50088c..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/util/irc/format/ContentFormatter.kt +++ /dev/null @@ -1,199 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.util.irc.format - -import android.content.Context -import android.graphics.Typeface -import android.text.SpannableString -import android.text.style.ForegroundColorSpan -import android.text.style.StyleSpan -import androidx.annotation.ColorInt -import de.kuschku.libquassel.protocol.NetworkId -import de.kuschku.libquassel.util.irc.HostmaskHelper -import de.kuschku.libquassel.util.irc.SenderColorUtil -import de.kuschku.quasseldroid.R -import de.kuschku.quasseldroid.settings.MessageSettings -import de.kuschku.quasseldroid.util.helper.styledAttributes -import de.kuschku.quasseldroid.util.irc.format.model.FormatInfo -import de.kuschku.quasseldroid.util.irc.format.model.IrcFormat -import de.kuschku.quasseldroid.util.ui.SpanFormatter -import org.intellij.lang.annotations.Language -import javax.inject.Inject - -class ContentFormatter @Inject constructor( - context: Context, - private val ircFormatDeserializer: IrcFormatDeserializer, - private val messageSettings: MessageSettings -) { - @Language("RegExp") - private val scheme = "(?:(?:mailto:|magnet:|(?:[+.-]?\\w)+://)|www(?=\\.\\S+\\.))" - @Language("RegExp") - private val authority = "(?:(?:[,.;@:]?[-\\w]+)+\\.?|\\[[0-9a-f:.]+])?(?::\\d+)?" - @Language("RegExp") - private val urlChars = "(?:[,.;:]*[\\w~@/?&=+$()!%#*-])" - @Language("RegExp") - private val urlEnd = "((?:>|[,.;:\"]*\\s|\\b|$))" - - private val urlPattern = Regex( - "\\b($scheme$authority(?:$urlChars*)?)$urlEnd", - RegexOption.IGNORE_CASE - ) - - private val channelPattern = Regex( - "((?:#|![A-Z0-9]{5})[^,:\\s]+(?::[^,:\\s]+)?)\\b", - RegexOption.IGNORE_CASE - ) - - private val senderColors: IntArray = context.theme.styledAttributes( - R.attr.senderColor0, R.attr.senderColor1, R.attr.senderColor2, R.attr.senderColor3, - R.attr.senderColor4, R.attr.senderColor5, R.attr.senderColor6, R.attr.senderColor7, - R.attr.senderColor8, R.attr.senderColor9, R.attr.senderColorA, R.attr.senderColorB, - R.attr.senderColorC, R.attr.senderColorD, R.attr.senderColorE, R.attr.senderColorF - ) { - IntArray(16) { - getColor(it, 0) - } - } - - @ColorInt - private val selfColor: Int = context.theme.styledAttributes(R.attr.colorForegroundSecondary) { - getColor(0, 0) - } - - fun formatContent(content: String, - highlight: Boolean = false, - unhideSpoilers: Boolean = false, - networkId: NetworkId?): Pair<CharSequence, Boolean> { - val spans = mutableListOf<FormatInfo>() - val formattedText = SpannableString( - ircFormatDeserializer.formatString( - content, - messageSettings.colorizeMirc, - spans - ) - ) - - val hasSpoilers = if (unhideSpoilers) { - spans.removeAll { - when { - it.format is IrcFormat.Color -> - it.format.foreground == it.format.background - it.format is IrcFormat.Hex -> - it.format.foreground == it.format.background - else -> - false - } - } - } else { - spans.any { - when { - it.format is IrcFormat.Color -> - it.format.foreground == it.format.background - it.format is IrcFormat.Hex -> - it.format.foreground == it.format.background - else -> - false - } - } - } - - for (result in urlPattern.findAll(formattedText)) { - val group = result.groups[1] - if (group != null) { - spans.add(FormatInfo( - group.range.start, - group.range.start + group.value.length, - IrcFormat.Url(group.value, highlight) - )) - } - } - - if (networkId != null) { - for (result in channelPattern.findAll(formattedText)) { - val group = result.groups[1] - if (group != null) { - spans.add(FormatInfo( - group.range.start, - group.range.start + group.value.length, - IrcFormat.Channel(networkId, group.value, highlight) - )) - } - } - } - - for (span in spans) { - span.apply(formattedText) - } - - return Pair(formattedText, hasSpoilers) - } - - private fun formatNickNickImpl(nick: String, self: Boolean, colorize: Boolean, - senderColors: IntArray, @ColorInt selfColor: Int): CharSequence { - val spannableString = SpannableString(nick) - if (colorize) { - val color = if (self) selfColor - else senderColors[(SenderColorUtil.senderColor(nick) + senderColors.size) % senderColors.size] - spannableString.setSpan( - ForegroundColorSpan(color), - 0, - nick.length, - SpannableString.SPAN_INCLUSIVE_EXCLUSIVE - ) - } - spannableString.setSpan( - StyleSpan(Typeface.BOLD), - 0, - nick.length, - SpannableString.SPAN_INCLUSIVE_EXCLUSIVE - ) - return spannableString - } - - private fun formatNickImpl(sender: String, self: Boolean, colorize: Boolean, hostmask: Boolean, - senderColors: IntArray, @ColorInt selfColor: Int): CharSequence { - val (nick, user, host) = HostmaskHelper.split(sender) - val formattedNick = formatNickNickImpl(nick, self, colorize, senderColors, selfColor) - - return if (hostmask) { - SpanFormatter.format("%s (%s@%s)", formattedNick, user, host) - } else { - formattedNick - } - } - - fun formatNick(sender: String, self: Boolean = false, highlight: Boolean = false, - showHostmask: Boolean = false, senderColors: IntArray = this.senderColors, - @ColorInt selfColor: Int = this.selfColor) = - when (messageSettings.colorizeNicknames) { - MessageSettings.SenderColorMode.ALL -> - formatNickImpl(sender, false, !highlight, showHostmask, senderColors, selfColor) - MessageSettings.SenderColorMode.ALL_BUT_MINE -> - formatNickImpl(sender, self, !highlight, showHostmask, senderColors, selfColor) - MessageSettings.SenderColorMode.NONE -> - formatNickImpl(sender, false, false, showHostmask, senderColors, selfColor) - } - - fun formatPrefix(prefix: String) = when (messageSettings.showPrefix) { - MessageSettings.ShowPrefixMode.ALL -> prefix - MessageSettings.ShowPrefixMode.HIGHEST -> prefix.substring(0, Math.min(prefix.length, 1)) - MessageSettings.ShowPrefixMode.NONE -> "" - } -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/util/irc/format/IrcFormatDeserializer.kt b/app/src/main/java/de/kuschku/quasseldroid/util/irc/format/IrcFormatDeserializer.kt deleted file mode 100644 index 30619f43e49b3c4afbb8538c0d69e582a9529f71..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/util/irc/format/IrcFormatDeserializer.kt +++ /dev/null @@ -1,406 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.util.irc.format - -import android.content.Context -import android.text.SpannableStringBuilder -import de.kuschku.quasseldroid.R -import de.kuschku.quasseldroid.util.helper.getColorCompat -import de.kuschku.quasseldroid.util.irc.format.model.FormatDescription -import de.kuschku.quasseldroid.util.irc.format.model.FormatInfo -import de.kuschku.quasseldroid.util.irc.format.model.IrcFormat -import javax.inject.Inject - -/** - * A helper class to turn mIRC formatted Strings into Android’s SpannableStrings with the same - * color and format codes - */ -class IrcFormatDeserializer(private val mircColors: IntArray) { - @Inject - constructor(context: Context) : this( - mircColors = listOf( - R.color.mircColor00, R.color.mircColor01, R.color.mircColor02, R.color.mircColor03, - R.color.mircColor04, R.color.mircColor05, R.color.mircColor06, R.color.mircColor07, - R.color.mircColor08, R.color.mircColor09, R.color.mircColor10, R.color.mircColor11, - R.color.mircColor12, R.color.mircColor13, R.color.mircColor14, R.color.mircColor15, - R.color.mircColor16, R.color.mircColor17, R.color.mircColor18, R.color.mircColor19, - R.color.mircColor20, R.color.mircColor21, R.color.mircColor22, R.color.mircColor23, - R.color.mircColor24, R.color.mircColor25, R.color.mircColor26, R.color.mircColor27, - R.color.mircColor28, R.color.mircColor29, R.color.mircColor30, R.color.mircColor31, - R.color.mircColor32, R.color.mircColor33, R.color.mircColor34, R.color.mircColor35, - R.color.mircColor36, R.color.mircColor37, R.color.mircColor38, R.color.mircColor39, - R.color.mircColor40, R.color.mircColor41, R.color.mircColor42, R.color.mircColor43, - R.color.mircColor44, R.color.mircColor45, R.color.mircColor46, R.color.mircColor47, - R.color.mircColor48, R.color.mircColor49, R.color.mircColor50, R.color.mircColor51, - R.color.mircColor52, R.color.mircColor53, R.color.mircColor54, R.color.mircColor55, - R.color.mircColor56, R.color.mircColor57, R.color.mircColor58, R.color.mircColor59, - R.color.mircColor60, R.color.mircColor61, R.color.mircColor62, R.color.mircColor63, - R.color.mircColor64, R.color.mircColor65, R.color.mircColor66, R.color.mircColor67, - R.color.mircColor68, R.color.mircColor69, R.color.mircColor70, R.color.mircColor71, - R.color.mircColor72, R.color.mircColor73, R.color.mircColor74, R.color.mircColor75, - R.color.mircColor76, R.color.mircColor77, R.color.mircColor78, R.color.mircColor79, - R.color.mircColor80, R.color.mircColor81, R.color.mircColor82, R.color.mircColor83, - R.color.mircColor84, R.color.mircColor85, R.color.mircColor86, R.color.mircColor87, - R.color.mircColor88, R.color.mircColor89, R.color.mircColor90, R.color.mircColor91, - R.color.mircColor92, R.color.mircColor93, R.color.mircColor94, R.color.mircColor95, - R.color.mircColor96, R.color.mircColor97, R.color.mircColor98 - ).map(context::getColorCompat).toIntArray() - ) - - /** - * Function to handle mIRC formatted strings - * - * @param content mIRC formatted String - * @return a CharSequence with Android’s span format representing the input string - */ - fun formatString(str: String?, colorize: Boolean, - output: MutableList<FormatInfo>? = null): CharSequence { - if (str == null) return "" - - val plainText = SpannableStringBuilder() - var bold: FormatDescription<IrcFormat.Bold>? = null - var italic: FormatDescription<IrcFormat.Italic>? = null - var underline: FormatDescription<IrcFormat.Underline>? = null - var strikethrough: FormatDescription<IrcFormat.Strikethrough>? = null - var monospace: FormatDescription<IrcFormat.Monospace>? = null - var color: FormatDescription<IrcFormat.Color>? = null - var hexColor: FormatDescription<IrcFormat.Hex>? = null - - fun applyFormat(desc: FormatDescription<IrcFormat>) { - if (output != null) { - output.add(FormatInfo(desc.start, plainText.length, desc.format)) - } else { - desc.apply(plainText, plainText.length) - } - } - - // Iterating over every character - var normalCount = 0 - var i = 0 - while (i < str.length) { - val character = str[i] - when (character) { - CODE_BOLD -> { - plainText.append(str.substring(i - normalCount, i)) - normalCount = 0 - - // If there is an element on stack with the same code, close it - bold = if (bold != null) { - if (colorize) applyFormat(bold) - null - // Otherwise create a new one - } else { - FormatDescription(plainText.length, - IrcFormat.Bold) - } - } - CODE_ITALIC -> { - plainText.append(str.substring(i - normalCount, i)) - normalCount = 0 - - // If there is an element on stack with the same code, close it - italic = if (italic != null) { - if (colorize) applyFormat(italic) - null - // Otherwise create a new one - } else { - FormatDescription(plainText.length, - IrcFormat.Italic) - } - } - CODE_UNDERLINE -> { - plainText.append(str.substring(i - normalCount, i)) - normalCount = 0 - - // If there is an element on stack with the same code, close it - underline = if (underline != null) { - if (colorize) applyFormat(underline) - null - // Otherwise create a new one - } else { - FormatDescription(plainText.length, - IrcFormat.Underline) - } - } - CODE_STRIKETHROUGH -> { - plainText.append(str.substring(i - normalCount, i)) - normalCount = 0 - - // If there is an element on stack with the same code, close it - strikethrough = if (strikethrough != null) { - if (colorize) applyFormat(strikethrough) - null - // Otherwise create a new one - } else { - FormatDescription(plainText.length, - IrcFormat.Strikethrough) - } - } - CODE_MONOSPACE -> { - plainText.append(str.substring(i - normalCount, i)) - normalCount = 0 - - // If there is an element on stack with the same code, close it - monospace = if (monospace != null) { - if (colorize) applyFormat(monospace) - null - // Otherwise create a new one - } else { - FormatDescription(plainText.length, - IrcFormat.Monospace) - } - } - CODE_COLOR -> { - plainText.append(str.substring(i - normalCount, i)) - normalCount = 0 - - val foregroundStart = i + 1 - val foregroundEnd = findEndOfNumber(str, foregroundStart) - // If we have a foreground element - if (foregroundEnd > foregroundStart) { - val foreground = readNumber(str, foregroundStart, foregroundEnd) - - var background: Byte = -1 - var backgroundEnd = -1 - // If we have a background code, read it - if (str.length > foregroundEnd && str[foregroundEnd] == ',') { - backgroundEnd = findEndOfNumber(str, foregroundEnd + 1) - background = readNumber(str, foregroundEnd + 1, backgroundEnd) - } - // If previous element was also a color element, try to reuse background - if (color != null) { - // Apply old format - if (colorize) applyFormat(color) - // Reuse old background, if possible - if (background.toInt() == -1) - background = color.format.background - } - // Add new format - color = FormatDescription( - plainText.length, IrcFormat.Color(foreground, background, this.mircColors) - ) - - // i points in front of the next character - i = (if (backgroundEnd == -1) foregroundEnd else backgroundEnd) - 1 - - // Otherwise assume this is a closing tag - } else if (color != null) { - if (colorize) applyFormat(color) - color = null - } - } - CODE_HEXCOLOR -> { - plainText.append(str.substring(i - normalCount, i)) - normalCount = 0 - - val foregroundStart = i + 1 - val foregroundEnd = findEndOfHexNumber(str, foregroundStart) - // If we have a foreground element - if (foregroundEnd > foregroundStart) { - val foreground = readHexNumber(str, foregroundStart, foregroundEnd) - - var background: Int = -1 - var backgroundEnd = -1 - // If we have a background code, read it - if (str.length > foregroundEnd && str[foregroundEnd] == ',') { - backgroundEnd = findEndOfHexNumber(str, foregroundEnd + 1) - background = readHexNumber(str, foregroundEnd + 1, backgroundEnd) - } - // If previous element was also a color element, try to reuse background - if (hexColor != null) { - // Apply old format - if (colorize) applyFormat(hexColor) - // Reuse old background, if possible - if (background == -1) - background = hexColor.format.background - } - // Add new format - hexColor = FormatDescription(plainText.length, - IrcFormat.Hex( - foreground, - background)) - - // i points in front of the next character - i = (if (backgroundEnd == -1) foregroundEnd else backgroundEnd) - 1 - - // Otherwise assume this is a closing tag - } else if (hexColor != null) { - if (colorize) applyFormat(hexColor) - hexColor = null - } - } - CODE_SWAP -> { - plainText.append(str.substring(i - normalCount, i)) - normalCount = 0 - - // If we have a color tag before, apply it, and create a new one with swapped colors - if (color != null) { - if (colorize) applyFormat(color) - color = FormatDescription( - plainText.length, color.format.copySwapped() - ) - } - } - CODE_RESET -> { - plainText.append(str.substring(i - normalCount, i)) - normalCount = 0 - - // End all formatting tags - if (bold != null) { - if (colorize) applyFormat(bold) - bold = null - } - if (italic != null) { - if (colorize) applyFormat(italic) - italic = null - } - if (underline != null) { - if (colorize) applyFormat(underline) - underline = null - } - if (color != null) { - if (colorize) applyFormat(color) - color = null - } - if (hexColor != null) { - if (colorize) applyFormat(hexColor) - hexColor = null - } - } - else -> { - // Just append it, if it’s not special - normalCount++ - } - } - i++ - } - - plainText.append(str.substring(str.length - normalCount, str.length)) - - // End all formatting tags - if (bold != null) { - if (colorize) applyFormat(bold) - } - if (italic != null) { - if (colorize) applyFormat(italic) - } - if (underline != null) { - if (colorize) applyFormat(underline) - } - if (strikethrough != null) { - if (colorize) applyFormat(strikethrough) - } - if (monospace != null) { - if (colorize) applyFormat(monospace) - } - if (color != null) { - if (colorize) applyFormat(color) - } - if (hexColor != null) { - if (colorize) applyFormat(hexColor) - } - return plainText - } - - companion object { - private const val CODE_BOLD = 0x02.toChar() - private const val CODE_COLOR = 0x03.toChar() - private const val CODE_HEXCOLOR = 0x04.toChar() - private const val CODE_ITALIC = 0x1D.toChar() - private const val CODE_UNDERLINE = 0x1F.toChar() - private const val CODE_STRIKETHROUGH = 0x1E.toChar() - private const val CODE_MONOSPACE = 0x11.toChar() - private const val CODE_SWAP = 0x16.toChar() - private const val CODE_RESET = 0x0F.toChar() - - /** - * Try to read a number from a String in specified bounds - * - * @param str String to be read from - * @param start Start index (inclusive) - * @param end End index (exclusive) - * @return The byte represented by the digits read from the string - */ - fun readNumber(str: String, start: Int, end: Int): Byte { - val result = str.substring(start, end) - return if (result.isEmpty()) - -1 - else - result.toByteOrNull(10) ?: -1 - } - - /** - * Try to read a number from a String in specified bounds - * - * @param str String to be read from - * @param start Start index (inclusive) - * @param end End index (exclusive) - * @return The byte represented by the digits read from the string - */ - fun readHexNumber(str: String, start: Int, end: Int): Int { - val result = str.substring(start, end) - return if (result.isEmpty()) - -1 - else - result.toIntOrNull(16) ?: -1 - } - - /** - * @param str String to be searched in - * @param start Start position (inclusive) - * @return Index of first character that is not a digit - */ - private fun findEndOfNumber(str: String, start: Int): Int { - val searchFrame = str.substring(start) - var i = 0 - loop@ while (i < 2 && i < searchFrame.length) { - when (searchFrame[i]) { - '0', '1', '2', '3', '4', '5', '6', '7', '8', '9' -> { - // Do nothing - } - else -> break@loop - } - i++ - } - return start + i - } - - /** - * @param str String to be searched in - * @param start Start position (inclusive) - * @return Index of first character that is not a digit - */ - private fun findEndOfHexNumber(str: String, start: Int): Int { - val searchFrame = str.substring(start) - var i = 0 - loop@ while (i < 6 && i < searchFrame.length) { - when (searchFrame[i]) { - '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F', 'a', 'b', - 'c', 'd', 'e', 'f' -> { - // Do nothing - } - else -> break@loop - } - i++ - } - return start + i - } - } -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/util/irc/format/IrcFormatSerializer.kt b/app/src/main/java/de/kuschku/quasseldroid/util/irc/format/IrcFormatSerializer.kt deleted file mode 100644 index 266ed5cbdc91009582841b00416fc83c47769d9f..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/util/irc/format/IrcFormatSerializer.kt +++ /dev/null @@ -1,263 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.util.irc.format - -import android.content.Context -import android.graphics.Typeface -import android.text.Spanned -import android.text.style.* -import de.kuschku.quasseldroid.R -import de.kuschku.quasseldroid.util.helper.getColorCompat -import de.kuschku.quasseldroid.util.helper.styledAttributes -import java.util.* -import javax.inject.Inject - -class IrcFormatSerializer @Inject constructor(context: Context) { - private val mircColors = listOf( - R.color.mircColor00, R.color.mircColor01, R.color.mircColor02, R.color.mircColor03, - R.color.mircColor04, R.color.mircColor05, R.color.mircColor06, R.color.mircColor07, - R.color.mircColor08, R.color.mircColor09, R.color.mircColor10, R.color.mircColor11, - R.color.mircColor12, R.color.mircColor13, R.color.mircColor14, R.color.mircColor15, - R.color.mircColor16, R.color.mircColor17, R.color.mircColor18, R.color.mircColor19, - R.color.mircColor20, R.color.mircColor21, R.color.mircColor22, R.color.mircColor23, - R.color.mircColor24, R.color.mircColor25, R.color.mircColor26, R.color.mircColor27, - R.color.mircColor28, R.color.mircColor29, R.color.mircColor30, R.color.mircColor31, - R.color.mircColor32, R.color.mircColor33, R.color.mircColor34, R.color.mircColor35, - R.color.mircColor36, R.color.mircColor37, R.color.mircColor38, R.color.mircColor39, - R.color.mircColor40, R.color.mircColor41, R.color.mircColor42, R.color.mircColor43, - R.color.mircColor44, R.color.mircColor45, R.color.mircColor46, R.color.mircColor47, - R.color.mircColor48, R.color.mircColor49, R.color.mircColor50, R.color.mircColor51, - R.color.mircColor52, R.color.mircColor53, R.color.mircColor54, R.color.mircColor55, - R.color.mircColor56, R.color.mircColor57, R.color.mircColor58, R.color.mircColor59, - R.color.mircColor60, R.color.mircColor61, R.color.mircColor62, R.color.mircColor63, - R.color.mircColor64, R.color.mircColor65, R.color.mircColor66, R.color.mircColor67, - R.color.mircColor68, R.color.mircColor69, R.color.mircColor70, R.color.mircColor71, - R.color.mircColor72, R.color.mircColor73, R.color.mircColor74, R.color.mircColor75, - R.color.mircColor76, R.color.mircColor77, R.color.mircColor78, R.color.mircColor79, - R.color.mircColor80, R.color.mircColor81, R.color.mircColor82, R.color.mircColor83, - R.color.mircColor84, R.color.mircColor85, R.color.mircColor86, R.color.mircColor87, - R.color.mircColor88, R.color.mircColor89, R.color.mircColor90, R.color.mircColor91, - R.color.mircColor92, R.color.mircColor93, R.color.mircColor94, R.color.mircColor95, - R.color.mircColor96, R.color.mircColor97, R.color.mircColor98 - ).map(context::getColorCompat).toIntArray() - - private val mircColorMap = mircColors.take(16).mapIndexed { index: Int, color: Int -> - color to index - }.toMap() - - private val colorForegroundMirc = context.theme.styledAttributes(R.attr.colorForegroundMirc) { - getColor(0, 0) - } - - private val colorForegroundHex = context.theme.styledAttributes(R.attr.colorForeground) { - getColor(0, 0) - } - - fun toEscapeCodes(text: Spanned): String { - val out = StringBuilder() - withinParagraph(out, text, 0, text.length) - return out.toString() - } - - private fun withinParagraph(out: StringBuilder, text: Spanned, start: Int, end: Int) { - fun writeBold() { - out.append(CODE_BOLD) - } - - fun writeItalic() { - out.append(CODE_ITALIC) - } - - fun writeUnderline() { - out.append(CODE_UNDERLINE) - } - - fun writeStrikethrough() { - out.append(CODE_STRIKETHROUGH) - } - - fun writeMonospace() { - out.append(CODE_MONOSPACE) - } - - fun writeColor(foreground: Int?, background: Int?) { - out.append(CODE_COLOR) - if (foreground == null && background != null) { - out.append( - String.format(Locale.US, "%02d,%02d", this.colorForegroundMirc, background) - ) - } else if (background == null && foreground != null) { - out.append(String.format(Locale.US, "%02d", foreground)) - } else if (background != null && foreground != null) { - out.append(String.format(Locale.US, "%02d,%02d", foreground, background)) - } - } - - fun writeSwap(foreground: Int?, background: Int?) { - // Nothing supports this. Nothing. So we fall back to writing the colors manually - // out.append(CODE_SWAP) - writeColor(foreground, background) - } - - fun writeHexColor(foreground: Int?, background: Int?) { - out.append(CODE_HEXCOLOR) - if (foreground != null) { - out.append(String.format(Locale.US, "%06x", foreground and 0x00FFFFFF)) - if (background != null) { - out.append(',') - out.append(String.format(Locale.US, "%06x", background and 0x00FFFFFF)) - } - } else if (background != null) { - out.append(String.format(Locale.US, "%06x", this.colorForegroundHex and 0x00FFFFFF)) - out.append(',') - out.append(String.format(Locale.US, "%06x", background and 0x00FFFFFF)) - } - } - - fun writeReset() { - out.append(CODE_RESET) - } - - var next: Int - var foreground: Int? = null - var background: Int? = null - var bold = false - var underline = false - var italic = false - var strikethrough = false - var monospace = false - - var i = start - while (i < end) { - next = text.nextSpanTransition(i, end, CharacterStyle::class.java) - val style = text.getSpans(i, next, CharacterStyle::class.java) - - var afterForeground: Int? = null - var afterBackground: Int? = null - var afterBold = false - var afterUnderline = false - var afterItalic = false - var afterStrikethrough = false - var afterMonospace = false - - for (aStyle in style) { - if (text.getSpanFlags(aStyle) and Spanned.SPAN_COMPOSING != 0) - continue - - if (text.getSpanEnd(aStyle) <= i) - continue - - when (aStyle) { - is StyleSpan -> { - afterBold = afterBold || aStyle.style and Typeface.BOLD != 0 - afterItalic = afterItalic || aStyle.style and Typeface.ITALIC != 0 - } - is UnderlineSpan -> afterUnderline = true - is StrikethroughSpan -> afterStrikethrough = true - is TypefaceSpan -> afterMonospace = aStyle.family == "monospace" - is ForegroundColorSpan -> afterForeground = aStyle.foregroundColor - is BackgroundColorSpan -> afterBackground = aStyle.backgroundColor - } - } - - if (afterBold != bold) { - writeBold() - } - - if (afterUnderline != underline) { - writeUnderline() - } - - if (afterItalic != italic) { - writeItalic() - } - - if (afterStrikethrough != strikethrough) { - writeStrikethrough() - } - - if (afterMonospace != monospace) { - writeMonospace() - } - - if (afterForeground != foreground || afterBackground != background) { - val foregroundCode = this.mircColorMap[foreground] - val backgroundCode = this.mircColorMap[background] - val afterForegroundCode = this.mircColorMap[afterForeground] - val afterBackgroundCode = this.mircColorMap[afterBackground] - - val hasForegroundBefore = foreground != null - val hasBackgroundBefore = background != null - val foregroundBeforeCodeValid = foregroundCode != null && foregroundCode < 16 - val backgroundBeforeCodeValid = backgroundCode != null && backgroundCode < 16 - - val hasForegroundAfter = afterForeground != null - val hasBackgroundAfter = afterBackground != null - val foregroundAfterCodeValid = afterForegroundCode != null && afterForegroundCode < 16 - val backgroundAfterCodeValid = afterBackgroundCode != null && afterBackgroundCode < 16 - - if ((!hasBackgroundAfter || backgroundAfterCodeValid) && - (!hasForegroundAfter || foregroundAfterCodeValid) && - (hasBackgroundAfter || hasForegroundAfter)) { - if (afterForegroundCode == backgroundCode && afterBackgroundCode == foregroundCode) { - writeSwap(afterForegroundCode, afterBackgroundCode) - } else { - writeColor(afterForegroundCode, afterBackgroundCode) - } - } else if (hasForegroundAfter || hasBackgroundAfter) { - writeHexColor(afterForeground, afterBackground) - } else { - if ((!hasBackgroundBefore || backgroundBeforeCodeValid) && - (!hasForegroundBefore || foregroundBeforeCodeValid)) { - writeColor(afterForeground, afterBackground) - } else { - writeHexColor(afterForeground, afterBackground) - } - } - } - - out.append(text.subSequence(i, next)) - - bold = afterBold - italic = afterItalic - underline = afterUnderline - strikethrough = afterStrikethrough - monospace = afterMonospace - background = afterBackground - foreground = afterForeground - i = next - } - - if (bold || italic || underline || strikethrough || monospace || background != null || foreground != null) - writeReset() - } - - companion object { - private const val CODE_BOLD: Char = 0x02.toChar() - private const val CODE_COLOR: Char = 0x03.toChar() - private const val CODE_HEXCOLOR = 0x04.toChar() - private const val CODE_ITALIC: Char = 0x1D.toChar() - private const val CODE_UNDERLINE: Char = 0x1F.toChar() - private const val CODE_STRIKETHROUGH = 0x1E.toChar() - private const val CODE_MONOSPACE = 0x11.toChar() - private const val CODE_SWAP: Char = 0x16.toChar() - private const val CODE_RESET: Char = 0x0F.toChar() - } -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/util/irc/format/model/FormatDescription.kt b/app/src/main/java/de/kuschku/quasseldroid/util/irc/format/model/FormatDescription.kt deleted file mode 100644 index 47f3328de635f55220d96c6d8c5485a80d2c9791..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/util/irc/format/model/FormatDescription.kt +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.util.irc.format.model - -import android.text.SpannableStringBuilder - -class FormatDescription<out U : IrcFormat>(val start: Int, val format: U) { - fun apply(editable: SpannableStringBuilder, end: Int) { - format.applyTo(editable, start, end) - } -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/util/irc/format/model/FormatInfo.kt b/app/src/main/java/de/kuschku/quasseldroid/util/irc/format/model/FormatInfo.kt deleted file mode 100644 index 60abcb7488ed103cb23e345f77bb13412fdb5255..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/util/irc/format/model/FormatInfo.kt +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.util.irc.format.model - -import android.text.Spannable - -data class FormatInfo(val start: Int, val end: Int, val format: IrcFormat) { - fun apply(editable: Spannable) { - format.applyTo(editable, start, end) - } -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/util/irc/format/model/IrcFormat.kt b/app/src/main/java/de/kuschku/quasseldroid/util/irc/format/model/IrcFormat.kt deleted file mode 100644 index 63fc1135a5baba4a2483f2144438817d70ee2b06..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/util/irc/format/model/IrcFormat.kt +++ /dev/null @@ -1,148 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.util.irc.format.model - -import android.text.Spannable -import android.text.Spanned -import de.kuschku.libquassel.protocol.NetworkId -import de.kuschku.quasseldroid.util.irc.format.spans.* - -sealed class IrcFormat { - abstract fun applyTo(editable: Spannable, from: Int, to: Int) - - object Italic : IrcFormat() { - override fun applyTo(editable: Spannable, from: Int, to: Int) { - editable.setSpan(IrcItalicSpan(), from, to, - Spanned.SPAN_INCLUSIVE_EXCLUSIVE) - } - } - - object Underline : IrcFormat() { - override fun applyTo(editable: Spannable, from: Int, to: Int) { - editable.setSpan(IrcUnderlineSpan(), from, to, - Spanned.SPAN_INCLUSIVE_EXCLUSIVE) - } - } - - object Strikethrough : IrcFormat() { - override fun applyTo(editable: Spannable, from: Int, to: Int) { - editable.setSpan(IrcStrikethroughSpan(), from, to, - Spanned.SPAN_INCLUSIVE_EXCLUSIVE) - } - } - - object Monospace : IrcFormat() { - override fun applyTo(editable: Spannable, from: Int, to: Int) { - editable.setSpan(IrcMonospaceSpan(), from, to, - Spanned.SPAN_INCLUSIVE_EXCLUSIVE) - } - } - - object Bold : IrcFormat() { - override fun applyTo(editable: Spannable, from: Int, to: Int) { - editable.setSpan(IrcBoldSpan(), from, to, - Spanned.SPAN_INCLUSIVE_EXCLUSIVE) - } - } - - data class Hex(val foreground: Int, val background: Int) : IrcFormat() { - override fun applyTo(editable: Spannable, from: Int, to: Int) { - if (foreground >= 0) { - editable.setSpan( - IrcForegroundColorSpan.HEX(foreground or 0xFFFFFF.inv()), from, to, - Spanned.SPAN_INCLUSIVE_EXCLUSIVE - ) - } - if (background >= 0) { - editable.setSpan( - IrcBackgroundColorSpan.HEX(background or 0xFFFFFF.inv()), from, to, - Spanned.SPAN_INCLUSIVE_EXCLUSIVE - ) - } - } - } - - data class Color(val foreground: Byte, val background: Byte, - private val mircColors: IntArray) : IrcFormat() { - override fun applyTo(editable: Spannable, from: Int, to: Int) { - if (foreground.toInt() >= 0 && foreground.toInt() < mircColors.size) { - editable.setSpan( - IrcForegroundColorSpan.MIRC(foreground.toInt(), - mircColors[foreground.toInt()]), - from, - to, - Spanned.SPAN_INCLUSIVE_EXCLUSIVE - ) - } - if (background.toInt() >= 0 && background.toInt() < mircColors.size) { - editable.setSpan( - IrcBackgroundColorSpan.MIRC(background.toInt(), - mircColors[background.toInt()]), - from, - to, - Spanned.SPAN_INCLUSIVE_EXCLUSIVE - ) - } - } - - fun copySwapped(): Color { - return Color(background, foreground, mircColors) - } - - override fun toString(): String { - return "Color(foreground=$foreground, background=$background)" - } - - override fun equals(other: Any?): Boolean { - if (this === other) return true - if (javaClass != other?.javaClass) return false - - other as Color - - if (foreground != other.foreground) return false - if (background != other.background) return false - - return true - } - - override fun hashCode(): Int { - var result = foreground.toInt() - result = 31 * result + background - return result - } - } - - data class Url(val target: String, val highlight: Boolean) : IrcFormat() { - override fun applyTo(editable: Spannable, from: Int, to: Int) { - editable.setSpan( - QuasselURLSpan(target, highlight), from, to, Spanned.SPAN_INCLUSIVE_EXCLUSIVE - ) - } - } - - data class Channel(val networkId: NetworkId, val target: String, val highlight: Boolean) : - IrcFormat() { - override fun applyTo(editable: Spannable, from: Int, to: Int) { - editable.setSpan( - ChannelLinkSpan(networkId, target, highlight), from, to, Spanned.SPAN_INCLUSIVE_EXCLUSIVE - ) - } - } -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/util/irc/format/spans/ChannelLinkSpan.kt b/app/src/main/java/de/kuschku/quasseldroid/util/irc/format/spans/ChannelLinkSpan.kt deleted file mode 100644 index 81f23cc15a55160d8b85fa0e9ff8296c570875b2..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/util/irc/format/spans/ChannelLinkSpan.kt +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.util.irc.format.spans - -import android.text.TextPaint -import android.text.style.ClickableSpan -import android.view.View -import de.kuschku.libquassel.protocol.NetworkId -import de.kuschku.quasseldroid.ui.chat.ChatActivity - -class ChannelLinkSpan( - private val networkId: NetworkId, - private val text: String, - private val highlight: Boolean -) : ClickableSpan() { - override fun updateDrawState(ds: TextPaint) { - if (!highlight) ds.color = ds.linkColor - ds.isUnderlineText = true - } - - override fun onClick(widget: View) { - ChatActivity.launch( - widget.context, - networkId = networkId, - channel = text - ) - } -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/util/irc/format/spans/Copyable.kt b/app/src/main/java/de/kuschku/quasseldroid/util/irc/format/spans/Copyable.kt deleted file mode 100644 index febb8319b6384c3f87a83edc9479b2a8cd468c91..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/util/irc/format/spans/Copyable.kt +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.util.irc.format.spans - -interface Copyable<out T> { - fun copy(): T -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/util/irc/format/spans/IrcBackgroundColorSpan.kt b/app/src/main/java/de/kuschku/quasseldroid/util/irc/format/spans/IrcBackgroundColorSpan.kt deleted file mode 100644 index 0c6e16e6d3f5238c1dd5fe0ed35f50fe31bd6266..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/util/irc/format/spans/IrcBackgroundColorSpan.kt +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.util.irc.format.spans - -import android.text.style.BackgroundColorSpan -import androidx.annotation.ColorInt - -sealed class IrcBackgroundColorSpan<T : IrcBackgroundColorSpan<T>>(@ColorInt color: Int) : - BackgroundColorSpan(color), Copyable<T> { - class MIRC(private val mircColor: Int, @ColorInt color: Int) : - IrcBackgroundColorSpan<MIRC>(color), Copyable<MIRC> { - override fun copy() = MIRC(mircColor, backgroundColor) - override fun toString(): String { - return "IrcBackgroundColorSpan.MIRC(mircColor=$mircColor, color=${backgroundColor.toString(16)})" - } - - override fun equals(other: Any?) = when (other) { - is IrcBackgroundColorSpan.MIRC -> other.mircColor == mircColor - else -> false - } - } - - class HEX(@ColorInt color: Int) : - IrcBackgroundColorSpan<HEX>(color), Copyable<HEX> { - override fun copy() = HEX(backgroundColor) - override fun toString(): String { - return "IrcBackgroundColorSpan.HEX(color=${backgroundColor.toString(16)})" - } - - override fun equals(other: Any?) = when (other) { - is IrcBackgroundColorSpan.HEX -> other.backgroundColor == backgroundColor - else -> false - } - } -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/util/irc/format/spans/IrcBoldSpan.kt b/app/src/main/java/de/kuschku/quasseldroid/util/irc/format/spans/IrcBoldSpan.kt deleted file mode 100644 index b5c0dd1b10f592e1b2bb1f86045e06ac89b1c48d..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/util/irc/format/spans/IrcBoldSpan.kt +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.util.irc.format.spans - -import android.graphics.Typeface -import android.text.style.StyleSpan - -class IrcBoldSpan : StyleSpan(Typeface.BOLD), Copyable<IrcBoldSpan> { - override fun copy() = IrcBoldSpan() - override fun equals(other: Any?) = other is IrcBoldSpan -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/util/irc/format/spans/IrcForegroundColorSpan.kt b/app/src/main/java/de/kuschku/quasseldroid/util/irc/format/spans/IrcForegroundColorSpan.kt deleted file mode 100644 index 8e07dea50416a1a5df2b11ecfd76eb9c5ca28e33..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/util/irc/format/spans/IrcForegroundColorSpan.kt +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.util.irc.format.spans - -import android.text.TextPaint -import android.text.style.ForegroundColorSpan -import androidx.annotation.ColorInt - -sealed class IrcForegroundColorSpan<T : IrcForegroundColorSpan<T>>(@ColorInt color: Int) : - ForegroundColorSpan(color), Copyable<T> { - - override fun updateDrawState(ds: TextPaint) { - ds.color = foregroundColor - ds.linkColor = foregroundColor - } - - class MIRC(private val mircColor: Int, @ColorInt color: Int) : - IrcForegroundColorSpan<MIRC>(color), Copyable<MIRC> { - override fun copy() = MIRC(mircColor, foregroundColor) - override fun toString(): String { - return "IrcForegroundColorSpan.MIRC(mircColor=$mircColor, color=${foregroundColor.toUInt().toString( - 16)})" - } - - override fun equals(other: Any?) = when (other) { - is MIRC -> other.mircColor == mircColor - else -> false - } - - override fun hashCode(): Int { - return mircColor - } - } - - class HEX(@ColorInt color: Int) : - IrcForegroundColorSpan<HEX>(color), Copyable<HEX> { - override fun copy() = HEX(foregroundColor) - override fun toString(): String { - return "IrcBackgroundColorSpan.HEX(color=${foregroundColor.toUInt().toString(16)})" - } - - override fun equals(other: Any?) = when (other) { - is HEX -> other.foregroundColor == foregroundColor - else -> false - } - - override fun hashCode(): Int { - return foregroundColor - } - } -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/util/irc/format/spans/IrcItalicSpan.kt b/app/src/main/java/de/kuschku/quasseldroid/util/irc/format/spans/IrcItalicSpan.kt deleted file mode 100644 index d0949758e6909ca12348b5d228bbdc06b0619b28..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/util/irc/format/spans/IrcItalicSpan.kt +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.util.irc.format.spans - -import android.graphics.Typeface -import android.text.style.StyleSpan - -class IrcItalicSpan : StyleSpan(Typeface.ITALIC), Copyable<IrcItalicSpan> { - override fun copy() = IrcItalicSpan() - override fun equals(other: Any?) = other is IrcBoldSpan -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/util/irc/format/spans/IrcMonospaceSpan.kt b/app/src/main/java/de/kuschku/quasseldroid/util/irc/format/spans/IrcMonospaceSpan.kt deleted file mode 100644 index 8ca831790fb437d3b4691b886635b99cde7d9b09..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/util/irc/format/spans/IrcMonospaceSpan.kt +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.util.irc.format.spans - -import android.text.style.TypefaceSpan - -class IrcMonospaceSpan : TypefaceSpan("monospace"), Copyable<IrcMonospaceSpan> { - override fun copy() = IrcMonospaceSpan() - override fun equals(other: Any?) = other is IrcBoldSpan -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/util/irc/format/spans/IrcStrikethroughSpan.kt b/app/src/main/java/de/kuschku/quasseldroid/util/irc/format/spans/IrcStrikethroughSpan.kt deleted file mode 100644 index c5c6823eab7859e3614fa8b7e80bc228a40fd1a0..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/util/irc/format/spans/IrcStrikethroughSpan.kt +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.util.irc.format.spans - -import android.text.style.StrikethroughSpan - -class IrcStrikethroughSpan : StrikethroughSpan(), Copyable<IrcStrikethroughSpan> { - override fun copy() = IrcStrikethroughSpan() - override fun equals(other: Any?) = other is IrcBoldSpan -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/util/irc/format/spans/IrcUnderlineSpan.kt b/app/src/main/java/de/kuschku/quasseldroid/util/irc/format/spans/IrcUnderlineSpan.kt deleted file mode 100644 index c4f62706f5a0d0419567dbd7ed1176df85a119a7..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/util/irc/format/spans/IrcUnderlineSpan.kt +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.util.irc.format.spans - -import android.text.style.UnderlineSpan - -class IrcUnderlineSpan : UnderlineSpan(), Copyable<IrcUnderlineSpan> { - override fun copy() = IrcUnderlineSpan() - override fun equals(other: Any?) = other is IrcBoldSpan -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/util/irc/format/spans/QuasselURLSpan.kt b/app/src/main/java/de/kuschku/quasseldroid/util/irc/format/spans/QuasselURLSpan.kt deleted file mode 100644 index d13cffac94f4807057619b7474cb7d04e5c7860c..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/util/irc/format/spans/QuasselURLSpan.kt +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.util.irc.format.spans - -import android.content.ActivityNotFoundException -import android.content.Intent -import android.net.Uri -import android.text.TextPaint -import android.text.style.URLSpan -import android.util.Log -import android.view.View - -class QuasselURLSpan(text: String, private val highlight: Boolean) : URLSpan(text) { - override fun updateDrawState(ds: TextPaint) { - if (!highlight) ds.color = ds.linkColor - ds.isUnderlineText = true - } - - override fun onClick(widget: View) { - try { - widget.context?.startActivity(Intent(Intent.ACTION_VIEW).apply { - data = Uri.parse(url) - }) - } catch (e: ActivityNotFoundException) { - Log.w("QuasselURLSpan", "Actvity was not found for $url") - } - } -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/util/lists/AsyncDifferConfig.kt b/app/src/main/java/de/kuschku/quasseldroid/util/lists/AsyncDifferConfig.kt deleted file mode 100644 index d6ff7dcea877b7bbcd5a66c653f09033b8b5b50b..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/util/lists/AsyncDifferConfig.kt +++ /dev/null @@ -1,127 +0,0 @@ -/* - * Copyright 2017 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package de.kuschku.quasseldroid.util.lists - -import android.os.Handler -import android.os.Looper -import androidx.annotation.RestrictTo -import androidx.recyclerview.widget.DiffUtil - -import java.util.concurrent.Executor -import java.util.concurrent.Executors - -/** - * Configuration object for [ListAdapter], [AsyncListDiffer], and similar - * background-thread list diffing adapter logic. - * - * - * At minimum, defines item diffing behavior with a [DiffUtil.ItemCallback], used to compute - * item differences to pass to a RecyclerView adapter. - * - * @param <T> Type of items in the lists, and being compared. -</T> */ -class AsyncDifferConfig<T> private constructor( - @get:RestrictTo(RestrictTo.Scope.LIBRARY_GROUP) - /** @hide - */ - val mainThreadExecutor: Executor, - val backgroundThreadExecutor: Executor, - val diffCallback: DiffUtil.ItemCallback<T>) { - - /** - * Builder class for [AsyncDifferConfig]. - * - * @param <T> - </T> */ - class Builder<T>(private val mDiffCallback: DiffUtil.ItemCallback<T>) { - private var mMainThreadExecutor: Executor? = null - private var mBackgroundThreadExecutor: Executor? = null - - /** - * If provided, defines the main thread executor used to dispatch adapter update - * notifications on the main thread. - * - * - * If not provided, it will default to the main thread. - * - * @param executor The executor which can run tasks in the UI thread. - * @return this - * - * @hide - */ - @RestrictTo(RestrictTo.Scope.LIBRARY_GROUP) - fun setMainThreadExecutor(executor: Executor): Builder<T> { - mMainThreadExecutor = executor - return this - } - - /** - * If provided, defines the background executor used to calculate the diff between an old - * and a new list. - * - * - * If not provided, defaults to two thread pool executor, shared by all ListAdapterConfigs. - * - * @param executor The background executor to run list diffing. - * @return this - */ - fun setBackgroundThreadExecutor(executor: Executor): Builder<T> { - mBackgroundThreadExecutor = executor - return this - } - - private class MainThreadExecutor : Executor { - internal val mHandler = Handler(Looper.getMainLooper()) - override fun execute(command: Runnable) { - mHandler.post(command) - } - } - - /** - * Creates a [AsyncListDiffer] with the given parameters. - * - * @return A new AsyncDifferConfig. - */ - fun build(): AsyncDifferConfig<T> { - if (mMainThreadExecutor == null) { - mMainThreadExecutor = sMainThreadExecutor - } - if (mBackgroundThreadExecutor == null) { - synchronized(sExecutorLock) { - if (sDiffExecutor == null) { - sDiffExecutor = Executors.newFixedThreadPool(2) - } - } - mBackgroundThreadExecutor = sDiffExecutor - } - return AsyncDifferConfig( - mMainThreadExecutor!!, - mBackgroundThreadExecutor!!, - mDiffCallback) - } - - companion object { - - // TODO: remove the below once supportlib has its own appropriate executors - private val sExecutorLock = Any() - private var sDiffExecutor: Executor? = null - - // TODO: use MainThreadExecutor from supportlib once one exists - private val sMainThreadExecutor = MainThreadExecutor() - } - } -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/util/lists/AsyncListDiffer.kt b/app/src/main/java/de/kuschku/quasseldroid/util/lists/AsyncListDiffer.kt deleted file mode 100644 index 0bd12a4120e805a8c762e0ce8d801c0c42a0e3a5..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/util/lists/AsyncListDiffer.kt +++ /dev/null @@ -1,266 +0,0 @@ -/* - * Copyright 2017 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package de.kuschku.quasseldroid.util.lists - -import androidx.recyclerview.widget.AdapterListUpdateCallback -import androidx.recyclerview.widget.DiffUtil -import androidx.recyclerview.widget.ListUpdateCallback -import androidx.recyclerview.widget.RecyclerView -import java.util.* - -/** - * Helper for computing the difference between two lists via [DiffUtil] on a background - * thread. - * - * - * It can be connected to a - * [RecyclerView.Adapter][androidx.recyclerview.widget.RecyclerView.Adapter], and will signal the - * adapter of changes between sumbitted lists. - * - * - * For simplicity, the [ListAdapter] wrapper class can often be used instead of the - * AsyncListDiffer directly. This AsyncListDiffer can be used for complex cases, where overriding an - * adapter base class to support asynchronous List diffing isn't convenient. - * - * - * The AsyncListDiffer can consume the values from a LiveData of `List` and present the - * data simply for an adapter. It computes differences in list contents via [DiffUtil] on a - * background thread as new `List`s are received. - * - * - * Use [.getCurrentList] to access the current List, and present its data objects. Diff - * results will be dispatched to the ListUpdateCallback immediately before the current list is - * updated. If you're dispatching list updates directly to an Adapter, this means the Adapter can - * safely access list items and total size via [.getCurrentList]. - * - * - * A complete usage pattern with Room would look like this: - * <pre> - * @Dao - * interface UserDao { - * @Query("SELECT * FROM user ORDER BY lastName ASC") - * public abstract LiveData<List<User>> usersByLastName(); - * } - * - * class MyViewModel extends ViewModel { - * public final LiveData<List<User>> usersList; - * public MyViewModel(UserDao userDao) { - * usersList = userDao.usersByLastName(); - * } - * } - * - * class MyActivity extends AppCompatActivity { - * @Override - * public void onCreate(Bundle savedState) { - * super.onCreate(savedState); - * MyViewModel viewModel = ViewModelProviders.of(this).get(MyViewModel.class); - * RecyclerView recyclerView = findViewById(R.id.user_list); - * UserAdapter adapter = new UserAdapter(); - * viewModel.usersList.observe(this, list -> adapter.submitList(list)); - * recyclerView.setAdapter(adapter); - * } - * } - * - * class UserAdapter extends RecyclerView.Adapter<UserViewHolder> { - * private final AsyncListDiffer<User> mDiffer = new AsyncListDiffer(this, DIFF_CALLBACK); - * @Override - * public int getItemCount() { - * return mDiffer.getCurrentList().size(); - * } - * public void submitList(List<User> list) { - * mDiffer.submitList(list); - * } - * @Override - * public void onBindViewHolder(UserViewHolder holder, int position) { - * User user = mDiffer.getCurrentList().get(position); - * holder.bindTo(user); - * } - * public static final DiffUtil.ItemCallback<User> DIFF_CALLBACK - * = new DiffUtil.ItemCallback<User>() { - * @Override - * public boolean areItemsTheSame( - * @NonNull User oldUser, @NonNull User newUser) { - * // User properties may have changed if reloaded from the DB, but ID is fixed - * return oldUser.getId() == newUser.getId(); - * } - * @Override - * public boolean areContentsTheSame( - * @NonNull User oldUser, @NonNull User newUser) { - * // NOTE: if you use equals, your object must properly override Object#equals() - * // Incorrectly returning false here will result in too many animations. - * return oldUser.equals(newUser); - * } - * } - * }</pre> - * - * @param <T> Type of the lists this AsyncListDiffer will receive. - * - * @see DiffUtil - * - * @see AdapterListUpdateCallback -</T> */ -class AsyncListDiffer<T> { - private val mUpdateCallback: ListUpdateCallback - private val mUpdateFinishedCallback: ((List<T>) -> Unit)? - private val mConfig: AsyncDifferConfig<T> - - private var mList: List<T>? = null - - /** - * Non-null, unmodifiable version of mList. - * - * - * Collections.emptyList when mList is null, wrapped by Collections.unmodifiableList otherwise - */ - /** - * Get the current List - any diffing to present this list has already been computed and - * dispatched via the ListUpdateCallback. - * - * - * If a `null` List, or no List has been submitted, an empty list will be returned. - * - * - * The returned list may not be mutated - mutations to content must be done through - * [.submitList]. - * - * @return current List. - */ - var currentList = emptyList<T>() - private set - - // Max generation of currently scheduled runnable - private var mMaxScheduledGeneration: Int = 0 - - /** - * Convenience for - * `AsyncListDiffer(new AdapterListUpdateCallback(adapter), - * new AsyncDifferConfig.Builder().setDiffCallback(diffCallback).build());` - * - * @param adapter Adapter to dispatch position updates to. - * @param diffCallback ItemCallback that compares items to dispatch appropriate animations when - * - * @see DiffUtil.DiffResult.dispatchUpdatesTo - */ - constructor(adapter: RecyclerView.Adapter<*>, - updateFinishedCallback: ((List<T>) -> Unit)? = null, - diffCallback: DiffUtil.ItemCallback<T>) { - mUpdateCallback = AdapterListUpdateCallback(adapter) - mUpdateFinishedCallback = updateFinishedCallback - mConfig = AsyncDifferConfig.Builder(diffCallback).build() - } - - /** - * Create a AsyncListDiffer with the provided config, and ListUpdateCallback to dispatch - * updates to. - * - * @param listUpdateCallback Callback to dispatch updates to. - * @param config Config to define background work Executor, and DiffUtil.ItemCallback for - * computing List diffs. - * - * @see DiffUtil.DiffResult.dispatchUpdatesTo - */ - constructor(listUpdateCallback: ListUpdateCallback, - updateFinishedCallback: ((List<T>) -> Unit)? = null, - config: AsyncDifferConfig<T>) { - mUpdateCallback = listUpdateCallback - mUpdateFinishedCallback = updateFinishedCallback - mConfig = config - } - - /** - * Pass a new List to the AdapterHelper. Adapter updates will be computed on a background - * thread. - * - * - * If a List is already present, a diff will be computed asynchronously on a background thread. - * When the diff is computed, it will be applied (dispatched to the [ListUpdateCallback]), - * and the new List will be swapped in. - * - * @param newList The new List. - */ - fun submitList(newList: List<T>?) { - val oldList = mList - - if (newList === oldList) { - // nothing to do - return - } - - // incrementing generation means any currently-running diffs are discarded when they finish - val runGeneration = ++mMaxScheduledGeneration - - // fast simple remove all - if (newList == null) { - val countRemoved = oldList?.size ?: 0 - mList = null - currentList = emptyList() - // notify last, after list is updated - mUpdateCallback.onRemoved(0, countRemoved) - return - } - - // fast simple first insert - if (oldList == null) { - mList = newList - currentList = Collections.unmodifiableList(newList) - // notify last, after list is updated - mUpdateCallback.onInserted(0, newList.size) - return - } - - mConfig.backgroundThreadExecutor.execute { - val result = DiffUtil.calculateDiff(object : DiffUtil.Callback() { - override fun getOldListSize(): Int { - return oldList.size - } - - override fun getNewListSize(): Int { - return newList.size - } - - override fun areItemsTheSame(oldItemPosition: Int, newItemPosition: Int): Boolean { - return mConfig.diffCallback.areItemsTheSame( - oldList[oldItemPosition], newList[newItemPosition]) - } - - override fun areContentsTheSame(oldItemPosition: Int, newItemPosition: Int): Boolean { - return mConfig.diffCallback.areContentsTheSame( - oldList[oldItemPosition], newList[newItemPosition]) - } - - override fun getChangePayload(oldItemPosition: Int, newItemPosition: Int): Any? { - return mConfig.diffCallback.getChangePayload( - oldList[oldItemPosition], newList[newItemPosition]) - } - }) - - mConfig.mainThreadExecutor.execute { - if (mMaxScheduledGeneration == runGeneration) { - latchList(newList, result) - } - } - } - } - - private fun latchList(newList: List<T>, diffResult: DiffUtil.DiffResult) { - mList = newList - // notify last, after list is updated - currentList = Collections.unmodifiableList(newList) - diffResult.dispatchUpdatesTo(mUpdateCallback) - mUpdateFinishedCallback?.invoke(newList) - } -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/util/lists/ListAdapter.kt b/app/src/main/java/de/kuschku/quasseldroid/util/lists/ListAdapter.kt deleted file mode 100644 index 352edd0aa72f6cf90323b7aa87d70e1bda2dd0af..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/util/lists/ListAdapter.kt +++ /dev/null @@ -1,133 +0,0 @@ -/* - * Copyright 2017 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package de.kuschku.quasseldroid.util.lists - -import androidx.recyclerview.widget.AdapterListUpdateCallback -import androidx.recyclerview.widget.DiffUtil -import androidx.recyclerview.widget.RecyclerView - -/** - * [RecyclerView.Adapter] base class for presenting List data in a - * [RecyclerView], including computing diffs between Lists on a background thread. - * - * - * This class is a convenience wrapper around [AsyncListDiffer] that implements Adapter common - * default behavior for item access and counting. - * - * - * While using a LiveData<List> is an easy way to provide data to the adapter, it isn't required - * - you can use [.submitList] when new lists are available. - * - * - * A complete usage pattern with Room would look like this: - * <pre> - * @Dao - * interface UserDao { - * @Query("SELECT * FROM user ORDER BY lastName ASC") - * public abstract LiveData<List<User>> usersByLastName(); - * } - * - * class MyViewModel extends ViewModel { - * public final LiveData<List<User>> usersList; - * public MyViewModel(UserDao userDao) { - * usersList = userDao.usersByLastName(); - * } - * } - * - * class MyActivity extends AppCompatActivity { - * @Override - * public void onCreate(Bundle savedState) { - * super.onCreate(savedState); - * MyViewModel viewModel = ViewModelProviders.of(this).get(MyViewModel.class); - * RecyclerView recyclerView = findViewById(R.id.user_list); - * UserAdapter<User> adapter = new UserAdapter(); - * viewModel.usersList.observe(this, list -> adapter.submitList(list)); - * recyclerView.setAdapter(adapter); - * } - * } - * - * class UserAdapter extends ListAdapter<User, UserViewHolder> { - * public UserAdapter() { - * super(User.DIFF_CALLBACK); - * } - * @Override - * public void onBindViewHolder(UserViewHolder holder, int position) { - * holder.bindTo(getItem(position)); - * } - * public static final DiffUtil.ItemCallback<User> DIFF_CALLBACK = - * new DiffUtil.ItemCallback<User>() { - * @Override - * public boolean areItemsTheSame( - * @NonNull User oldUser, @NonNull User newUser) { - * // User properties may have changed if reloaded from the DB, but ID is fixed - * return oldUser.getId() == newUser.getId(); - * } - * @Override - * public boolean areContentsTheSame( - * @NonNull User oldUser, @NonNull User newUser) { - * // NOTE: if you use equals, your object must properly override Object#equals() - * // Incorrectly returning false here will result in too many animations. - * return oldUser.equals(newUser); - * } - * } - * }</pre> - * - * Advanced users that wish for more control over adapter behavior, or to provide a specific base - * class should refer to [AsyncListDiffer], which provides custom mapping from diff events - * to adapter positions. - * - * @param <T> Type of the Lists this Adapter will receive. - * @param <VH> A class that extends ViewHolder that will be used by the adapter. -</VH></T> */ -abstract class ListAdapter<T, VH : RecyclerView.ViewHolder> : RecyclerView.Adapter<VH> { - private val mHelper: AsyncListDiffer<T> - - protected constructor(diffCallback: DiffUtil.ItemCallback<T>) { - mHelper = AsyncListDiffer(AdapterListUpdateCallback(this), - ::onUpdateFinished, - AsyncDifferConfig.Builder(diffCallback).build()) - } - - protected constructor(config: AsyncDifferConfig<T>) { - mHelper = AsyncListDiffer(AdapterListUpdateCallback(this), - ::onUpdateFinished, - config) - } - - /** - * Submits a new list to be diffed, and displayed. - * - * - * If a list is already being displayed, a diff will be computed on a background thread, which - * will dispatch Adapter.notifyItem events on the main thread. - * - * @param list The new list to be displayed. - */ - fun submitList(list: List<T>) { - mHelper.submitList(list) - } - - protected fun getItem(position: Int): T { - return mHelper.currentList[position] - } - - override fun getItemCount(): Int { - return mHelper.currentList.size - } - - open fun onUpdateFinished(list: List<T>) = Unit -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/util/missingfeatures/MissingFeature.kt b/app/src/main/java/de/kuschku/quasseldroid/util/missingfeatures/MissingFeature.kt deleted file mode 100644 index bb7b1d3f5ba8451fbde5924dbc3946d5d80f540e..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/util/missingfeatures/MissingFeature.kt +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.util.missingfeatures - -import androidx.annotation.StringRes -import de.kuschku.libquassel.quassel.ExtendedFeature - -data class MissingFeature( - val feature: ExtendedFeature, - val minimumVersion: QuasselVersion, - @StringRes val description: Int -) diff --git a/app/src/main/java/de/kuschku/quasseldroid/util/missingfeatures/MissingFeaturesAdapter.kt b/app/src/main/java/de/kuschku/quasseldroid/util/missingfeatures/MissingFeaturesAdapter.kt deleted file mode 100644 index 3194924c42392e0493e5dc5fa1222dc6b9d74002..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/util/missingfeatures/MissingFeaturesAdapter.kt +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.util.missingfeatures - -import android.view.LayoutInflater -import android.view.ViewGroup -import androidx.recyclerview.widget.DiffUtil -import androidx.recyclerview.widget.ListAdapter -import androidx.recyclerview.widget.RecyclerView -import de.kuschku.quasseldroid.databinding.WidgetMissingFeatureBinding - -class MissingFeaturesAdapter : - ListAdapter<MissingFeature, MissingFeaturesAdapter.MissingFeatureViewHolder>( - object : DiffUtil.ItemCallback<MissingFeature>() { - override fun areItemsTheSame(oldItem: MissingFeature, newItem: MissingFeature) = - oldItem.feature == newItem.feature - - override fun areContentsTheSame(oldItem: MissingFeature, newItem: MissingFeature) = - oldItem == newItem - } - ) { - override fun onCreateViewHolder(parent: ViewGroup, viewType: Int) = MissingFeatureViewHolder( - WidgetMissingFeatureBinding.inflate(LayoutInflater.from(parent.context), parent, false) - ) - - override fun onBindViewHolder(holder: MissingFeatureViewHolder, position: Int) = - holder.bind(getItem(position)) - - class MissingFeatureViewHolder( - private val binding: WidgetMissingFeatureBinding - ) : RecyclerView.ViewHolder(binding.root) { - fun bind(item: MissingFeature) { - binding.name.text = item.feature.name - binding.description.setText(item.description) - } - } -} - diff --git a/app/src/main/java/de/kuschku/quasseldroid/util/missingfeatures/MissingFeaturesDialog.kt b/app/src/main/java/de/kuschku/quasseldroid/util/missingfeatures/MissingFeaturesDialog.kt deleted file mode 100644 index 40a2b53fda211f0a2e20c9dd41e2d83c8dd1c0d7..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/util/missingfeatures/MissingFeaturesDialog.kt +++ /dev/null @@ -1,128 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.util.missingfeatures - -import android.annotation.SuppressLint -import android.app.Dialog -import android.content.DialogInterface -import android.os.Bundle -import android.text.Html -import android.widget.TextView -import androidx.fragment.app.DialogFragment -import androidx.fragment.app.FragmentActivity -import androidx.fragment.app.FragmentManager -import androidx.recyclerview.widget.LinearLayoutManager -import androidx.recyclerview.widget.RecyclerView -import butterknife.BindView -import butterknife.ButterKnife -import com.afollestad.materialdialogs.MaterialDialog -import de.kuschku.quasseldroid.R -import de.kuschku.quasseldroid.util.ui.BetterLinkMovementMethod - -class MissingFeaturesDialog : DialogFragment() { - private var builder: Builder? = null - - @BindView(R.id.list) - lateinit var list: RecyclerView - - @BindView(R.id.message) - lateinit var message: TextView - - @SuppressLint("StringFormatInvalid") - override fun onCreateDialog(savedInstanceState: Bundle?): Dialog { - val dialog = MaterialDialog.Builder(requireContext()) - .customView(R.layout.dialog_missing_features, true) - .title(R.string.label_missing_features) - .also { - it.positiveText(if (builder?.readOnly == true) R.string.label_close - else R.string.label_accept) - builder?.positiveListener?.let(it::onPositive) - } - .build() - ButterKnife.bind(this, dialog.customView!!) - val version = builder?.missingFeatures?.maxBy(MissingFeature::minimumVersion)?.minimumVersion - ?: QuasselVersion.VERSION_0_13 - message.text = Html.fromHtml(getString(R.string.info_missing_features, version.humanName)) - message.movementMethod = BetterLinkMovementMethod.newInstance() - list.layoutManager = LinearLayoutManager(list.context) - val adapter = MissingFeaturesAdapter() - list.adapter = adapter - list.itemAnimator = null - adapter.submitList(builder?.missingFeatures.orEmpty()) - return dialog - } - - override fun onDismiss(dialog: DialogInterface) { - super.onDismiss(dialog) - builder?.dismissListener?.onDismiss(this.dialog) - } - - fun show(context: FragmentActivity) = show(context.supportFragmentManager) - fun show(context: FragmentManager) { - dismissIfNecessary(context) - show(context, TAG) - } - - private fun dismissIfNecessary(fragmentManager: FragmentManager) { - fragmentManager.findFragmentByTag(tag)?.let { frag -> - (frag as? DialogFragment)?.dismiss() - fragmentManager.beginTransaction().remove(frag).commit() - } - } - - class Builder(private val fragmentManager: FragmentManager) { - constructor(context: FragmentActivity) : this(context.supportFragmentManager) - - var dismissListener: DialogInterface.OnDismissListener? = null - var positiveListener: MaterialDialog.SingleButtonCallback? = null - var missingFeatures: List<MissingFeature>? = null - var readOnly: Boolean = false - - fun missingFeatures(missingFeatures: List<MissingFeature>): Builder { - this.missingFeatures = missingFeatures - return this - } - - fun readOnly(readOnly: Boolean): Builder { - this.readOnly = readOnly - return this - } - - fun dismissListener(dismissListener: DialogInterface.OnDismissListener): Builder { - this.dismissListener = dismissListener - return this - } - - fun positiveListener(positiveListener: MaterialDialog.SingleButtonCallback): Builder { - this.positiveListener = positiveListener - return this - } - - fun build() = MissingFeaturesDialog().apply { - builder = this@Builder - } - - fun show() = build().show(fragmentManager) - } - - companion object { - const val TAG = "[MISSING_FEATURES]" - } -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/util/missingfeatures/QuasselVersion.kt b/app/src/main/java/de/kuschku/quasseldroid/util/missingfeatures/QuasselVersion.kt deleted file mode 100644 index cf4542368e79ca817e6fe1e4ed783ffde98103ff..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/util/missingfeatures/QuasselVersion.kt +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.util.missingfeatures - -enum class QuasselVersion(val humanName: String) { - VERSION_0_13("v0.13"); -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/util/missingfeatures/RequiredFeatures.kt b/app/src/main/java/de/kuschku/quasseldroid/util/missingfeatures/RequiredFeatures.kt deleted file mode 100644 index fbd01cd44688b19320c3bc8d37a06ea182d7039c..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/util/missingfeatures/RequiredFeatures.kt +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.util.missingfeatures - -import de.kuschku.libquassel.quassel.ExtendedFeature -import de.kuschku.quasseldroid.R - -object RequiredFeatures { - val features = listOf( - MissingFeature(ExtendedFeature.BufferActivitySync, - QuasselVersion.VERSION_0_13, - R.string.label_feature_bufferactivitysync), - MissingFeature(ExtendedFeature.CoreSideHighlights, - QuasselVersion.VERSION_0_13, - R.string.label_feature_coresidehighlights), - MissingFeature(ExtendedFeature.BacklogFilterType, - QuasselVersion.VERSION_0_13, - R.string.label_feature_backlogfiltertype), - - MissingFeature(ExtendedFeature.RichMessages, - QuasselVersion.VERSION_0_13, - R.string.label_feature_richmessages), - MissingFeature(ExtendedFeature.SenderPrefixes, - QuasselVersion.VERSION_0_13, - R.string.label_feature_senderprefixes), - MissingFeature(ExtendedFeature.RemoteDisconnect, - QuasselVersion.VERSION_0_13, - R.string.label_feature_remotedisconnect), - MissingFeature(ExtendedFeature.SynchronizedMarkerLine, - QuasselVersion.VERSION_0_13, - R.string.label_feature_synchronizedmarkerline), - - MissingFeature(ExtendedFeature.AwayFormatTimestamp, - QuasselVersion.VERSION_0_13, - R.string.label_feature_awayformattimestamp), - MissingFeature(ExtendedFeature.PasswordChange, - QuasselVersion.VERSION_0_13, - R.string.label_feature_passwordchange), - MissingFeature(ExtendedFeature.CapNegotiation, - QuasselVersion.VERSION_0_13, - R.string.label_feature_capnegotiation), - MissingFeature(ExtendedFeature.CustomRateLimits, - QuasselVersion.VERSION_0_13, - R.string.label_feature_customratelimits), - MissingFeature(ExtendedFeature.HideInactiveNetworks, - QuasselVersion.VERSION_0_13, - R.string.label_feature_hideinactivenetworks), - MissingFeature(ExtendedFeature.SaslAuthentication, - QuasselVersion.VERSION_0_13, - R.string.label_feature_saslauthentication), - MissingFeature(ExtendedFeature.SaslExternal, - QuasselVersion.VERSION_0_13, - R.string.label_feature_saslexternal), - MissingFeature(ExtendedFeature.VerifyServerSSL, - QuasselVersion.VERSION_0_13, - R.string.label_feature_verifyserverssl) - ) -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/util/service/BackendServiceConnection.kt b/app/src/main/java/de/kuschku/quasseldroid/util/service/BackendServiceConnection.kt deleted file mode 100644 index 4bcaa70ee8619eda7981f43a51c2cd9d730e9f24..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/util/service/BackendServiceConnection.kt +++ /dev/null @@ -1,106 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.util.service - -import android.content.ComponentName -import android.content.Context -import android.content.Intent -import android.content.ServiceConnection -import android.os.IBinder -import androidx.lifecycle.DefaultLifecycleObserver -import androidx.lifecycle.LifecycleOwner -import de.kuschku.libquassel.util.Optional -import de.kuschku.quasseldroid.Backend -import de.kuschku.quasseldroid.service.QuasselBinder -import de.kuschku.quasseldroid.service.QuasselService -import io.reactivex.subjects.BehaviorSubject - -class BackendServiceConnection : ServiceConnection, DefaultLifecycleObserver { - val backend: BehaviorSubject<Optional<Backend>> = BehaviorSubject.createDefault(Optional.empty()) - - var context: Context? = null - - enum class State { - UNBOUND, - BINDING, - BOUND, - UNBINDING - } - - private var state: State = State.UNBOUND - - override fun onServiceDisconnected(component: ComponentName?) { - synchronized(this@BackendServiceConnection) { - state = State.UNBOUND - backend.onNext(Optional.empty()) - } - } - - override fun onServiceConnected(component: ComponentName?, binder: IBinder?) { - when (component) { - ComponentName(context!!, QuasselService::class.java) -> - if (binder is QuasselBinder) { - synchronized(this@BackendServiceConnection) { - state = State.BOUND - backend.onNext(Optional.of(binder.backend)) - } - } - } - } - - fun start(intent: Intent? = null): Boolean { - try { - context?.let { - it.startService( - intent - ?: QuasselService.intent(it) - ) - return true - } - return false - } catch (e: IllegalStateException) { - return false - } - } - - @Synchronized - fun bind(intent: Intent = QuasselService.intent(context!!), flags: Int = 0) { - if (state == State.UNBOUND || state == State.UNBINDING) { - state = State.BINDING - context?.bindService(intent, this, flags) - } - } - - @Synchronized - fun unbind() { - if (state == State.BOUND || state == State.BINDING) { - state = State.UNBINDING - context?.unbindService(this) - } - } - - override fun onCreate(owner: LifecycleOwner) { - start() - } - - override fun onStart(owner: LifecycleOwner) = bind() - - override fun onStop(owner: LifecycleOwner) = unbind() -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/util/service/ServiceBoundActivity.kt b/app/src/main/java/de/kuschku/quasseldroid/util/service/ServiceBoundActivity.kt deleted file mode 100644 index de466fa46e17bac35d45aeea572b0e5fc2ed7822..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/util/service/ServiceBoundActivity.kt +++ /dev/null @@ -1,171 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.util.service - -import android.app.UiModeManager -import android.content.Context -import android.content.SharedPreferences -import android.content.res.Configuration -import android.os.Build -import android.os.Bundle -import android.view.WindowManager -import android.widget.Toast -import androidx.annotation.ColorRes -import androidx.annotation.DrawableRes -import de.kuschku.libquassel.util.Optional -import de.kuschku.libquassel.util.helper.safeValue -import de.kuschku.quasseldroid.Backend -import de.kuschku.quasseldroid.Keys -import de.kuschku.quasseldroid.R -import de.kuschku.quasseldroid.persistence.util.AccountId -import de.kuschku.quasseldroid.settings.ConnectionSettings -import de.kuschku.quasseldroid.settings.Settings -import de.kuschku.quasseldroid.util.helper.editCommit -import de.kuschku.quasseldroid.util.helper.sharedPreferences -import de.kuschku.quasseldroid.util.helper.updateRecentsHeaderIfExisting -import de.kuschku.quasseldroid.util.ui.ThemedActivity -import de.kuschku.quasseldroid.viewmodel.QuasselViewModel -import io.reactivex.subjects.BehaviorSubject -import javax.inject.Inject - -abstract class ServiceBoundActivity : - ThemedActivity(), SharedPreferences.OnSharedPreferenceChangeListener { - @DrawableRes - protected val icon: Int = R.mipmap.ic_launcher_recents - @ColorRes - protected val recentsHeaderColor: Int = R.color.colorPrimary - - private val connection = BackendServiceConnection() - protected val backend: BehaviorSubject<Optional<Backend>> - get() = connection.backend - - private var uiModeManager: UiModeManager? = null - private var nightMode: Int? = null - - protected fun runInBackground(f: () -> Unit) { - connection.backend.safeValue.ifPresent { - it.sessionManager()?.handlerService?.backend(f) - } - } - - protected fun runInBackgroundDelayed(delayMillis: Long, f: () -> Unit) { - connection.backend.safeValue.ifPresent { - it.sessionManager()?.handlerService?.backendDelayed(delayMillis, f) - } - } - - fun connectToAccount(accountId: AccountId) { - getSharedPreferences(Keys.Status.NAME, Context.MODE_PRIVATE).editCommit { - putBoolean(Keys.Status.reconnect, false) - } - getSharedPreferences(Keys.Status.NAME, Context.MODE_PRIVATE).editCommit { - putLong(Keys.Status.selectedAccount, accountId.id) - putBoolean(Keys.Status.reconnect, true) - } - } - - @Inject - lateinit var connectionSettings: ConnectionSettings - - @Inject - lateinit var quasselViewModel: QuasselViewModel - - protected var accountId: AccountId = AccountId(-1L) - - override fun onCreate(savedInstanceState: Bundle?) { - super.onCreate(savedInstanceState) - quasselViewModel.backendWrapper.onNext(this.backend) - updateRecentsHeader() - connection.context = this - lifecycle.addObserver(connection) - checkConnection() - - if (appearanceSettings.keepScreenOn) { - window.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON) - } - - nightMode = resources.configuration.uiMode and Configuration.UI_MODE_NIGHT_MASK - } - - fun updateRecentsHeader() { - if (Build.VERSION.SDK_INT < Build.VERSION_CODES.P) { - updateRecentsHeaderIfExisting(title.toString(), icon, recentsHeaderColor) - } - } - - override fun setTitle(title: CharSequence?) { - super.setTitle(title) - updateRecentsHeader() - } - - override fun onStart() { - if (Settings.appearance(this) != appearanceSettings || - (resources.configuration.uiMode and Configuration.UI_MODE_NIGHT_MASK) != nightMode) { - recreate() - } - sharedPreferences(Keys.Status.NAME, Context.MODE_PRIVATE) { - registerOnSharedPreferenceChangeListener(this@ServiceBoundActivity) - } - checkConnection() - super.onStart() - } - - override fun onStop() { - super.onStop() - sharedPreferences(Keys.Status.NAME, Context.MODE_PRIVATE) { - unregisterOnSharedPreferenceChangeListener(this@ServiceBoundActivity) - } - } - - override fun onDestroy() { - lifecycle.removeObserver(connection) - connection.context = null - super.onDestroy() - } - - override fun onSharedPreferenceChanged(sharedPreferences: SharedPreferences?, key: String?) = - checkConnection() - - protected fun checkConnection() { - accountId = AccountId(getSharedPreferences(Keys.Status.NAME, Context.MODE_PRIVATE) - ?.getLong(Keys.Status.selectedAccount, -1) ?: -1) - - val reconnect = sharedPreferences(Keys.Status.NAME, Context.MODE_PRIVATE) { - getBoolean(Keys.Status.reconnect, false) - } - if (!reconnect || !accountId.isValidId()) { - onSelectAccount() - } else { - if (!connection.start()) - Toast.makeText( - this, - getString(R.string.label_service_connection_failed), - Toast.LENGTH_SHORT - ).show() - connection.bind() - } - } - - protected open fun onSelectAccount() = Unit - - companion object { - const val REQUEST_SELECT_ACCOUNT = 1 - } -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/util/service/ServiceBoundFragment.kt b/app/src/main/java/de/kuschku/quasseldroid/util/service/ServiceBoundFragment.kt deleted file mode 100644 index 1a30474a47f5b2a516066e4a019ae807a3f160a9..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/util/service/ServiceBoundFragment.kt +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.util.service - -import android.content.Context -import android.os.Bundle -import dagger.android.support.DaggerFragment -import de.kuschku.libquassel.util.Optional -import de.kuschku.libquassel.util.helper.safeValue -import de.kuschku.quasseldroid.Backend -import de.kuschku.quasseldroid.Keys -import de.kuschku.quasseldroid.persistence.util.AccountId -import de.kuschku.quasseldroid.viewmodel.QuasselViewModel -import io.reactivex.subjects.BehaviorSubject -import javax.inject.Inject - -abstract class ServiceBoundFragment : DaggerFragment() { - @Inject - lateinit var quasselViewModel: QuasselViewModel - - private val connection = BackendServiceConnection() - protected val backend: BehaviorSubject<Optional<Backend>> - get() = connection.backend - - protected fun runInBackground(f: () -> Unit) { - connection.backend.safeValue.ifPresent { - it.sessionManager()?.handlerService?.backend(f) - } - } - - protected fun runInBackgroundDelayed(delayMillis: Long, f: () -> Unit) { - connection.backend.safeValue.ifPresent { - it.sessionManager()?.handlerService?.backendDelayed(delayMillis, f) - } - } - - protected var accountId = AccountId(-1L) - - override fun onCreate(savedInstanceState: Bundle?) { - accountId = AccountId(context?.getSharedPreferences(Keys.Status.NAME, Context.MODE_PRIVATE) - ?.getLong(Keys.Status.selectedAccount, -1) ?: -1) - - connection.context = context - lifecycle.addObserver(connection) - super.onCreate(savedInstanceState) - } - - override fun onStart() { - super.onStart() - accountId = AccountId(context?.getSharedPreferences(Keys.Status.NAME, Context.MODE_PRIVATE) - ?.getLong(Keys.Status.selectedAccount, -1) ?: -1) - } - - override fun onDestroy() { - lifecycle.removeObserver(connection) - super.onDestroy() - } -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/util/ui/AnimationHelper.kt b/app/src/main/java/de/kuschku/quasseldroid/util/ui/AnimationHelper.kt deleted file mode 100644 index b7dcec1a53f6ecd6da803be53474ca2549ce0dac..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/util/ui/AnimationHelper.kt +++ /dev/null @@ -1,81 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.util.ui - -import android.view.View -import android.view.ViewGroup -import android.view.animation.Animation -import android.view.animation.Transformation -import kotlin.math.roundToLong - -object AnimationHelper { - fun expand(v: ViewGroup) { - v.measure(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT) - val targetHeight = v.measuredHeight - - // Older versions of android (pre API 21) cancel animations for views with a height of 0. - v.layoutParams.height = 1 - v.visibility = View.VISIBLE - - v.clearAnimation() - v.startAnimation(object : Animation() { - init { - duration = (targetHeight / v.context.resources.displayMetrics.density).roundToLong() - } - - override fun applyTransformation(interpolatedTime: Float, t: Transformation) { - v.layoutParams.height = if (interpolatedTime == 1f) - ViewGroup.LayoutParams.WRAP_CONTENT - else - (targetHeight * interpolatedTime).toInt() - v.alpha = interpolatedTime - v.requestLayout() - } - - override fun willChangeBounds(): Boolean { - return true - } - }) - } - - fun collapse(v: ViewGroup) { - val initialHeight = v.measuredHeight - v.clearAnimation() - v.startAnimation(object : Animation() { - init { - duration = (initialHeight / v.context.resources.displayMetrics.density).roundToLong() - } - - override fun applyTransformation(interpolatedTime: Float, t: Transformation) { - if (interpolatedTime == 1f) { - v.visibility = View.GONE - } else { - v.layoutParams.height = initialHeight - (initialHeight * interpolatedTime).toInt() - v.alpha = 1 - interpolatedTime - v.requestLayout() - } - } - - override fun willChangeBounds(): Boolean { - return true - } - }) - } -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/util/ui/BetterLinkMovementMethod.java b/app/src/main/java/de/kuschku/quasseldroid/util/ui/BetterLinkMovementMethod.java deleted file mode 100644 index 572ebfd44bb2d2263ac9026a6d40b1aae59e08ed..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/util/ui/BetterLinkMovementMethod.java +++ /dev/null @@ -1,472 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.util.ui; - -import android.app.Activity; -import android.graphics.RectF; -import android.text.Layout; -import android.text.Selection; -import android.text.Spannable; -import android.text.Spanned; -import android.text.method.LinkMovementMethod; -import android.text.style.BackgroundColorSpan; -import android.text.style.ClickableSpan; -import android.text.style.URLSpan; -import android.text.util.Linkify; -import android.view.HapticFeedbackConstants; -import android.view.MotionEvent; -import android.view.View; -import android.view.ViewConfiguration; -import android.view.ViewGroup; -import android.view.Window; -import android.widget.TextView; - -/** - * Handles URL clicks on TextViews. Unlike the default implementation, this: - * <p> - * <ul> - * <li>Reliably applies a highlight color on links when they're touched.</li> - * <li>Let's you handle single and long clicks on URLs</li> - * <li>Correctly identifies focused URLs (Unlike the default implementation where a click is registered even if it's - * made outside of the URL's bounds if there is no more text in that direction.)</li> - * </ul> - */ -public class BetterLinkMovementMethod extends LinkMovementMethod { - - private static final int LINKIFY_NONE = -2; - private static BetterLinkMovementMethod singleInstance; - private final RectF touchedLineBounds = new RectF(); - private OnLinkClickListener onLinkClickListener; - private OnLinkLongClickListener onLinkLongClickListener; - private boolean isUrlHighlighted; - private ClickableSpan clickableSpanUnderTouchOnActionDown; - private int activeTextViewHashcode; - private LongPressTimer ongoingLongPressTimer; - private boolean wasLongPressRegistered; - - protected BetterLinkMovementMethod() { - } - - /** - * Return a new instance of BetterLinkMovementMethod. - */ - public static BetterLinkMovementMethod newInstance() { - return new BetterLinkMovementMethod(); - } - - /** - * @param linkifyMask One of {@link Linkify#ALL}, {@link Linkify#PHONE_NUMBERS}, {@link Linkify#MAP_ADDRESSES}, - * {@link Linkify#WEB_URLS} and {@link Linkify#EMAIL_ADDRESSES}. - * @param textViews The TextViews on which a {@link BetterLinkMovementMethod} should be registered. - * @return The registered {@link BetterLinkMovementMethod} on the TextViews. - */ - public static BetterLinkMovementMethod linkify(int linkifyMask, TextView... textViews) { - BetterLinkMovementMethod movementMethod = newInstance(); - for (TextView textView : textViews) { - addLinks(linkifyMask, movementMethod, textView); - } - return movementMethod; - } - - /** - * Like {@link #linkify(int, TextView...)}, but can be used for TextViews with HTML links. - * - * @param textViews The TextViews on which a {@link BetterLinkMovementMethod} should be registered. - * @return The registered {@link BetterLinkMovementMethod} on the TextViews. - */ - public static BetterLinkMovementMethod linkifyHtml(TextView... textViews) { - return linkify(LINKIFY_NONE, textViews); - } - - /** - * Recursively register a {@link BetterLinkMovementMethod} on every TextView inside a layout. - * - * @param linkifyMask One of {@link Linkify#ALL}, {@link Linkify#PHONE_NUMBERS}, {@link Linkify#MAP_ADDRESSES}, - * {@link Linkify#WEB_URLS} and {@link Linkify#EMAIL_ADDRESSES}. - * @return The registered {@link BetterLinkMovementMethod} on the TextViews. - */ - public static BetterLinkMovementMethod linkify(int linkifyMask, ViewGroup viewGroup) { - BetterLinkMovementMethod movementMethod = newInstance(); - rAddLinks(linkifyMask, viewGroup, movementMethod); - return movementMethod; - } - - /** - * Like {@link #linkify(int, TextView...)}, but can be used for TextViews with HTML links. - * - * @return The registered {@link BetterLinkMovementMethod} on the TextViews. - */ - public static BetterLinkMovementMethod linkifyHtml(ViewGroup viewGroup) { - return linkify(LINKIFY_NONE, viewGroup); - } - - /** - * Recursively register a {@link BetterLinkMovementMethod} on every TextView inside a layout. - * - * @param linkifyMask One of {@link Linkify#ALL}, {@link Linkify#PHONE_NUMBERS}, {@link Linkify#MAP_ADDRESSES}, - * {@link Linkify#WEB_URLS} and {@link Linkify#EMAIL_ADDRESSES}. - * @return The registered {@link BetterLinkMovementMethod} on the TextViews. - */ - public static BetterLinkMovementMethod linkify(int linkifyMask, Activity activity) { - // Find the layout passed to setContentView(). - ViewGroup activityLayout = ((ViewGroup) ((ViewGroup) activity.findViewById(Window.ID_ANDROID_CONTENT)).getChildAt(0)); - - BetterLinkMovementMethod movementMethod = newInstance(); - rAddLinks(linkifyMask, activityLayout, movementMethod); - return movementMethod; - } - - /** - * Like {@link #linkify(int, TextView...)}, but can be used for TextViews with HTML links. - * - * @return The registered {@link BetterLinkMovementMethod} on the TextViews. - */ - public static BetterLinkMovementMethod linkifyHtml(Activity activity) { - return linkify(LINKIFY_NONE, activity); - } - - /** - * Get a static instance of BetterLinkMovementMethod. Do note that registering a click listener on the returned - * instance is not supported because it will potentially be shared on multiple TextViews. - */ - public static BetterLinkMovementMethod getInstance() { - if (singleInstance == null) { - singleInstance = new BetterLinkMovementMethod(); - } - return singleInstance; - } - - private static void rAddLinks(int linkifyMask, ViewGroup viewGroup, BetterLinkMovementMethod movementMethod) { - for (int i = 0; i < viewGroup.getChildCount(); i++) { - View child = viewGroup.getChildAt(i); - - if (child instanceof ViewGroup) { - // Recursively find child TextViews. - rAddLinks(linkifyMask, ((ViewGroup) child), movementMethod); - - } else if (child instanceof TextView) { - TextView textView = (TextView) child; - addLinks(linkifyMask, movementMethod, textView); - } - } - } - - private static void addLinks(int linkifyMask, BetterLinkMovementMethod movementMethod, TextView textView) { - textView.setMovementMethod(movementMethod); - if (linkifyMask != LINKIFY_NONE) { - Linkify.addLinks(textView, linkifyMask); - } - } - - /** - * Set a listener that will get called whenever any link is clicked on the TextView. - */ - public BetterLinkMovementMethod setOnLinkClickListener(OnLinkClickListener clickListener) { - if (this == singleInstance) { - throw new UnsupportedOperationException("Setting a click listener on the instance returned by getInstance() is not supported to avoid memory " + - "leaks. Please use newInstance() or any of the linkify() methods instead."); - } - - this.onLinkClickListener = clickListener; - return this; - } - - /** - * Set a listener that will get called whenever any link is clicked on the TextView. - */ - public BetterLinkMovementMethod setOnLinkLongClickListener(OnLinkLongClickListener longClickListener) { - if (this == singleInstance) { - throw new UnsupportedOperationException("Setting a long-click listener on the instance returned by getInstance() is not supported to avoid " + - "memory leaks. Please use newInstance() or any of the linkify() methods instead."); - } - - this.onLinkLongClickListener = longClickListener; - return this; - } - -// ======== PUBLIC APIs END ======== // - - @Override - public boolean onTouchEvent(final TextView textView, Spannable text, MotionEvent event) { - if (activeTextViewHashcode != textView.hashCode()) { - // Bug workaround: TextView stops calling onTouchEvent() once any URL is highlighted. - // A hacky solution is to reset any "autoLink" property set in XML. But we also want - // to do this once per TextView. - activeTextViewHashcode = textView.hashCode(); - textView.setAutoLinkMask(0); - } - - final ClickableSpan clickableSpanUnderTouch = findClickableSpanUnderTouch(textView, text, event); - if (event.getAction() == MotionEvent.ACTION_DOWN) { - clickableSpanUnderTouchOnActionDown = clickableSpanUnderTouch; - } - final boolean touchStartedOverAClickableSpan = clickableSpanUnderTouchOnActionDown != null; - - switch (event.getAction()) { - case MotionEvent.ACTION_DOWN: - if (clickableSpanUnderTouch != null) { - highlightUrl(textView, clickableSpanUnderTouch, text); - } - - if (touchStartedOverAClickableSpan && onLinkLongClickListener != null) { - LongPressTimer.OnTimerReachedListener longClickListener = new LongPressTimer.OnTimerReachedListener() { - @Override - public void onTimerReached() { - wasLongPressRegistered = true; - textView.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS); - removeUrlHighlightColor(textView); - dispatchUrlLongClick(textView, clickableSpanUnderTouch); - } - }; - startTimerForRegisteringLongClick(textView, longClickListener); - } - return touchStartedOverAClickableSpan; - - case MotionEvent.ACTION_UP: - // Register a click only if the touch started and ended on the same URL. - if (!wasLongPressRegistered && touchStartedOverAClickableSpan && clickableSpanUnderTouch == clickableSpanUnderTouchOnActionDown) { - dispatchUrlClick(textView, clickableSpanUnderTouch); - } - cleanupOnTouchUp(textView); - - // Consume this event even if we could not find any spans to avoid letting Android handle this event. - // Android's TextView implementation has a bug where links get clicked even when there is no more text - // next to the link and the touch lies outside its bounds in the same direction. - return touchStartedOverAClickableSpan; - - case MotionEvent.ACTION_CANCEL: - cleanupOnTouchUp(textView); - return false; - - case MotionEvent.ACTION_MOVE: - // Stop listening for a long-press as soon as the user wanders off to unknown lands. - if (clickableSpanUnderTouch != clickableSpanUnderTouchOnActionDown) { - removeLongPressCallback(textView); - } - - if (!wasLongPressRegistered) { - // Toggle highlight. - if (clickableSpanUnderTouch != null) { - highlightUrl(textView, clickableSpanUnderTouch, text); - } else { - removeUrlHighlightColor(textView); - } - } - - return touchStartedOverAClickableSpan; - - default: - return false; - } - } - - private void cleanupOnTouchUp(TextView textView) { - wasLongPressRegistered = false; - clickableSpanUnderTouchOnActionDown = null; - removeUrlHighlightColor(textView); - removeLongPressCallback(textView); - } - - /** - * Determines the touched location inside the TextView's text and returns the ClickableSpan found under it (if any). - * - * @return The touched ClickableSpan or null. - */ - protected ClickableSpan findClickableSpanUnderTouch(TextView textView, Spannable text, MotionEvent event) { - // So we need to find the location in text where touch was made, regardless of whether the TextView - // has scrollable text. That is, not the entire text is currently visible. - int touchX = (int) event.getX(); - int touchY = (int) event.getY(); - - // Ignore padding. - touchX -= textView.getTotalPaddingLeft(); - touchY -= textView.getTotalPaddingTop(); - - // Account for scrollable text. - touchX += textView.getScrollX(); - touchY += textView.getScrollY(); - - final Layout layout = textView.getLayout(); - final int touchedLine = layout.getLineForVertical(touchY); - final int touchOffset = layout.getOffsetForHorizontal(touchedLine, touchX); - - touchedLineBounds.left = layout.getLineLeft(touchedLine); - touchedLineBounds.top = layout.getLineTop(touchedLine); - touchedLineBounds.right = layout.getLineWidth(touchedLine) + touchedLineBounds.left; - touchedLineBounds.bottom = layout.getLineBottom(touchedLine); - - if (touchedLineBounds.contains(touchX, touchY)) { - // Find a ClickableSpan that lies under the touched area. - final Object[] spans = text.getSpans(touchOffset, touchOffset, ClickableSpan.class); - for (final Object span : spans) { - if (span instanceof ClickableSpan) { - return (ClickableSpan) span; - } - } - // No ClickableSpan found under the touched location. - return null; - - } else { - // Touch lies outside the line's horizontal bounds where no spans should exist. - return null; - } - } - - /** - * Adds a background color span at <var>clickableSpan</var>'s location. - */ - protected void highlightUrl(TextView textView, ClickableSpan clickableSpan, Spannable text) { - if (isUrlHighlighted) { - return; - } - isUrlHighlighted = true; - - final int spanStart = text.getSpanStart(clickableSpan); - final int spanEnd = text.getSpanEnd(clickableSpan); - text.setSpan(new BackgroundColorSpan(textView.getHighlightColor()), spanStart, spanEnd, Spannable.SPAN_INCLUSIVE_INCLUSIVE | Spannable.SPAN_COMPOSING); - - Selection.setSelection(text, spanStart, spanEnd); - } - - /** - * Removes the highlight color under the Url. - */ - protected void removeUrlHighlightColor(TextView textView) { - if (!isUrlHighlighted) { - return; - } - isUrlHighlighted = false; - - final Spannable text = (Spannable) textView.getText(); - - BackgroundColorSpan[] highlightSpans = text.getSpans(0, text.length(), BackgroundColorSpan.class); - for (BackgroundColorSpan highlightSpan : highlightSpans) { - if ((text.getSpanFlags(highlightSpan) & Spannable.SPAN_COMPOSING) != 0) - text.removeSpan(highlightSpan); - } - - Selection.removeSelection(text); - } - - protected void startTimerForRegisteringLongClick(TextView textView, LongPressTimer.OnTimerReachedListener longClickListener) { - ongoingLongPressTimer = new LongPressTimer(); - ongoingLongPressTimer.setOnTimerReachedListener(longClickListener); - textView.postDelayed(ongoingLongPressTimer, ViewConfiguration.getLongPressTimeout()); - } - - /** - * Remove the long-press detection timer. - */ - protected void removeLongPressCallback(TextView textView) { - if (ongoingLongPressTimer != null) { - textView.removeCallbacks(ongoingLongPressTimer); - ongoingLongPressTimer = null; - } - } - - protected void dispatchUrlClick(TextView textView, ClickableSpan clickableSpan) { - ClickableSpanWithText clickableSpanWithText = ClickableSpanWithText.ofSpan(textView, clickableSpan); - boolean handled = onLinkClickListener != null && onLinkClickListener.onClick(textView, clickableSpanWithText.text()); - - if (!handled) { - // Let Android handle this click. - clickableSpanWithText.span().onClick(textView); - } - } - - protected void dispatchUrlLongClick(TextView textView, ClickableSpan clickableSpan) { - ClickableSpanWithText clickableSpanWithText = ClickableSpanWithText.ofSpan(textView, clickableSpan); - boolean handled = onLinkLongClickListener != null && onLinkLongClickListener.onLongClick(textView, clickableSpanWithText.text()); - - if (!handled) { - // Let Android handle this long click as a short-click. - clickableSpanWithText.span().onClick(textView); - } - } - - public interface OnLinkClickListener { - /** - * @param textView The TextView on which a click was registered. - * @param url The clicked URL. - * @return True if this click was handled. False to let Android handle the URL. - */ - boolean onClick(TextView textView, String url); - } - - public interface OnLinkLongClickListener { - /** - * @param textView The TextView on which a long-click was registered. - * @param url The long-clicked URL. - * @return True if this long-click was handled. False to let Android handle the URL (as a short-click). - */ - boolean onLongClick(TextView textView, String url); - } - - protected static final class LongPressTimer implements Runnable { - private OnTimerReachedListener onTimerReachedListener; - - @Override - public void run() { - onTimerReachedListener.onTimerReached(); - } - - public void setOnTimerReachedListener(OnTimerReachedListener listener) { - onTimerReachedListener = listener; - } - - interface OnTimerReachedListener { - void onTimerReached(); - } - } - - /** - * A wrapper to support all {@link ClickableSpan}s that may or may not provide URLs. - */ - protected static class ClickableSpanWithText { - private final ClickableSpan span; - private final String text; - - private ClickableSpanWithText(ClickableSpan span, String text) { - this.span = span; - this.text = text; - } - - protected static ClickableSpanWithText ofSpan(TextView textView, ClickableSpan span) { - Spanned s = (Spanned) textView.getText(); - String text; - if (span instanceof URLSpan) { - text = ((URLSpan) span).getURL(); - } else { - int start = s.getSpanStart(span); - int end = s.getSpanEnd(span); - text = s.subSequence(start, end).toString(); - } - return new ClickableSpanWithText(span, text); - } - - ClickableSpan span() { - return span; - } - - String text() { - return text; - } - } -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/util/ui/ColorChooserDialog.java b/app/src/main/java/de/kuschku/quasseldroid/util/ui/ColorChooserDialog.java deleted file mode 100644 index 1339e2c5eb17ce88845a35ca7626eacaf15c6c51..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/util/ui/ColorChooserDialog.java +++ /dev/null @@ -1,806 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.util.ui; - -import android.app.Dialog; -import android.content.Context; -import android.content.DialogInterface; -import android.graphics.Color; -import android.os.Bundle; -import android.text.Editable; -import android.text.InputFilter; -import android.text.TextWatcher; -import android.view.View; -import android.view.ViewGroup; -import android.widget.BaseAdapter; -import android.widget.EditText; -import android.widget.GridView; -import android.widget.SeekBar; -import android.widget.TextView; - -import androidx.annotation.ArrayRes; -import androidx.annotation.ColorInt; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import androidx.annotation.StringDef; -import androidx.annotation.StringRes; -import androidx.core.content.res.ResourcesCompat; -import androidx.fragment.app.DialogFragment; -import androidx.fragment.app.Fragment; -import androidx.fragment.app.FragmentActivity; -import androidx.fragment.app.FragmentManager; - -import com.afollestad.materialdialogs.DialogAction; -import com.afollestad.materialdialogs.MaterialDialog; -import com.afollestad.materialdialogs.Theme; -import com.afollestad.materialdialogs.color.CircleView; -import com.afollestad.materialdialogs.internal.MDTintHelper; -import com.afollestad.materialdialogs.util.DialogUtils; - -import java.io.Serializable; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.util.Locale; - -import de.kuschku.quasseldroid.R; - -/** - * @author Aidan Follestad (afollestad) - */ -@SuppressWarnings({"FieldCanBeLocal", "ConstantConditions", "PrivateResource"}) -public class ColorChooserDialog extends DialogFragment - implements View.OnClickListener, View.OnLongClickListener { - - public static final String TAG_PRIMARY = "[MD_COLOR_CHOOSER]"; - public static final String TAG_ACCENT = "[MD_COLOR_CHOOSER]"; - public static final String TAG_CUSTOM = "[MD_COLOR_CHOOSER]"; - private int[] colorsTop; - @Nullable - private int[][] colorsSub; - private int circleSize; - private GridView grid; - private View colorChooserCustomFrame; - private EditText customColorHex; - private View customColorIndicator; - private TextWatcher customColorTextWatcher; - private SeekBar customSeekA; - private TextView customSeekAValue; - private SeekBar customSeekR; - private TextView customSeekRValue; - private SeekBar customSeekG; - private TextView customSeekGValue; - private SeekBar customSeekB; - private TextView customSeekBValue; - private SeekBar.OnSeekBarChangeListener customColorRgbListener; - private int selectedCustomColor; - - public ColorChooserDialog() { - } - - private void generateColors() { - Builder builder = getBuilder(); - colorsTop = builder.colorsTop; - colorsSub = builder.colorsSub; - } - - @Override - public void onSaveInstanceState(Bundle outState) { - super.onSaveInstanceState(outState); - outState.putInt("top_index", topIndex()); - outState.putBoolean("in_sub", isInSub()); - outState.putInt("sub_index", subIndex()); - outState.putBoolean( - "in_custom", - colorChooserCustomFrame != null && colorChooserCustomFrame.getVisibility() == View.VISIBLE); - } - - private boolean isInSub() { - return getArguments().getBoolean("in_sub", false); - } - - private void isInSub(boolean value) { - getArguments().putBoolean("in_sub", value); - } - - private int topIndex() { - return getArguments().getInt("top_index", -1); - } - - private void topIndex(int value) { - if (value > -1) { - findSubIndexForColor(value, colorsTop[value]); - } - getArguments().putInt("top_index", value); - } - - private int subIndex() { - if (colorsSub == null) { - return -1; - } - return getArguments().getInt("sub_index", -1); - } - - private void subIndex(int value) { - if (colorsSub == null) { - return; - } - getArguments().putInt("sub_index", value); - } - - @StringRes - public int getTitle() { - Builder builder = getBuilder(); - int title; - if (isInSub()) { - title = builder.titleSub; - } else { - title = builder.title; - } - if (title == 0) { - title = builder.title; - } - return title; - } - - public String tag() { - Builder builder = getBuilder(); - if (builder.tag != null) { - return builder.tag; - } else { - return super.getTag(); - } - } - - @Override - public void onClick(View v) { - if (v.getTag() != null) { - final String[] tag = ((String) v.getTag()).split(":"); - final int index = Integer.parseInt(tag[0]); - final MaterialDialog dialog = (MaterialDialog) getDialog(); - final Builder builder = getBuilder(); - - if (isInSub()) { - subIndex(index); - } else { - topIndex(index); - if (colorsSub != null && index < colorsSub.length) { - dialog.setActionButton(DialogAction.NEGATIVE, builder.backBtn); - isInSub(true); - } - } - - if (builder.allowUserCustom) { - selectedCustomColor = getSelectedColor(); - } - invalidateDynamicButtonColors(); - invalidate(); - } - } - - @Override - public boolean onLongClick(View v) { - if (v.getTag() != null) { - final String[] tag = ((String) v.getTag()).split(":"); - final int color = Integer.parseInt(tag[1]); - ((CircleView) v).showHint(color); - return true; - } - return false; - } - - private void invalidateDynamicButtonColors() { - final MaterialDialog dialog = (MaterialDialog) getDialog(); - if (dialog == null) { - return; - } - final Builder builder = getBuilder(); - if (builder.dynamicButtonColor) { - int selectedColor = getSelectedColor(); - if (Color.alpha(selectedColor) < 64 - || (Color.red(selectedColor) > 247 - && Color.green(selectedColor) > 247 - && Color.blue(selectedColor) > 247)) { - // Once we get close to white or transparent, - // the action buttons and seekbars will be a very light gray. - selectedColor = Color.parseColor("#DEDEDE"); - } - - if (getBuilder().dynamicButtonColor) { - dialog.getActionButton(DialogAction.POSITIVE).setTextColor(selectedColor); - dialog.getActionButton(DialogAction.NEGATIVE).setTextColor(selectedColor); - dialog.getActionButton(DialogAction.NEUTRAL).setTextColor(selectedColor); - } - - if (customSeekR != null) { - if (customSeekA.getVisibility() == View.VISIBLE) { - MDTintHelper.setTint(customSeekA, selectedColor); - } - MDTintHelper.setTint(customSeekR, selectedColor); - MDTintHelper.setTint(customSeekG, selectedColor); - MDTintHelper.setTint(customSeekB, selectedColor); - } - } - } - - @ColorInt - private int getSelectedColor() { - if (colorChooserCustomFrame != null - && colorChooserCustomFrame.getVisibility() == View.VISIBLE) { - return selectedCustomColor; - } - - int color = 0; - if (subIndex() > -1) { - color = colorsSub[topIndex()][subIndex()]; - } else if (topIndex() > -1) { - color = colorsTop[topIndex()]; - } - return color; - } - - private void findSubIndexForColor(int topIndex, int color) { - if (colorsSub == null || colorsSub.length - 1 < topIndex) { - return; - } - int[] subColors = colorsSub[topIndex]; - for (int subIndex = 0; subIndex < subColors.length; subIndex++) { - if (subColors[subIndex] == color) { - subIndex(subIndex); - break; - } - } - } - - @NonNull - @Override - public Dialog onCreateDialog(Bundle savedInstanceState) { - if (getArguments() == null || !getArguments().containsKey("builder")) { - throw new IllegalStateException( - "ColorChooserDialog should be created using its Builder interface."); - } - generateColors(); - - int preselectColor; - boolean foundPreselectColor = false; - - if (savedInstanceState != null) { - preselectColor = getSelectedColor(); - } else { - if (getBuilder().setPreselectionColor) { - preselectColor = getBuilder().preselectColor; - if (preselectColor != 0) { - for (int topIndex = 0; topIndex < colorsTop.length; topIndex++) { - if (colorsTop[topIndex] == preselectColor) { - topIndex(topIndex); - if (colorsSub != null) { - findSubIndexForColor(topIndex, preselectColor); - } else { - subIndex(5); - } - break; - } - - if (colorsSub != null) { - for (int subIndex = 0; subIndex < colorsSub[topIndex].length; subIndex++) { - if (colorsSub[topIndex][subIndex] == preselectColor) { - foundPreselectColor = true; - topIndex(topIndex); - subIndex(subIndex); - break; - } - } - if (foundPreselectColor) { - break; - } - } - } - } - } else { - preselectColor = Color.BLACK; - } - } - - circleSize = getResources().getDimensionPixelSize(R.dimen.colorchooser_circlesize); - final Builder builder = getBuilder(); - - MaterialDialog.Builder bd = - new MaterialDialog.Builder(getActivity()) - .title(getTitle()) - .autoDismiss(false) - .customView(R.layout.dialog_colorchooser, false) - .negativeText(builder.cancelBtn) - .positiveText(builder.doneBtn) - .neutralText(builder.allowUserCustom ? builder.customBtn : 0) - .typeface(builder.mediumFont, builder.regularFont) - .titleColorAttr(R.attr.colorTextPrimary) - .backgroundColorAttr(R.attr.colorBackgroundCard) - .contentColorAttr(R.attr.colorTextPrimary) - .onPositive( - new MaterialDialog.SingleButtonCallback() { - @Override - public void onClick(@NonNull MaterialDialog dialog, @NonNull DialogAction which) { - builder.callback.onColorSelection(ColorChooserDialog.this, getSelectedColor()); - dismiss(); - } - }) - .onNegative( - new MaterialDialog.SingleButtonCallback() { - @Override - public void onClick(@NonNull MaterialDialog dialog, @NonNull DialogAction which) { - if (isInSub()) { - dialog.setActionButton(DialogAction.NEGATIVE, getBuilder().cancelBtn); - isInSub(false); - subIndex(-1); // Do this to avoid ArrayIndexOutOfBoundsException - invalidate(); - } else { - builder.callback.onColorReset(ColorChooserDialog.this); - dialog.cancel(); - } - } - }) - .onNeutral( - new MaterialDialog.SingleButtonCallback() { - @Override - public void onClick(@NonNull MaterialDialog dialog, @NonNull DialogAction which) { - toggleCustom(dialog); - } - }) - .showListener( - new DialogInterface.OnShowListener() { - @Override - public void onShow(DialogInterface dialog) { - invalidateDynamicButtonColors(); - } - }); - - if (builder.theme != null) { - bd.theme(builder.theme); - } - - final MaterialDialog dialog = bd.build(); - final View v = dialog.getCustomView(); - grid = v.findViewById(R.id.md_grid); - - if (builder.allowUserCustom) { - selectedCustomColor = preselectColor; - colorChooserCustomFrame = v.findViewById(R.id.md_colorChooserCustomFrame); - customColorHex = v.findViewById(R.id.md_hexInput); - customColorIndicator = v.findViewById(R.id.md_colorIndicator); - customSeekA = v.findViewById(R.id.md_colorA); - customSeekAValue = v.findViewById(R.id.md_colorAValue); - customSeekR = v.findViewById(R.id.md_colorR); - customSeekRValue = v.findViewById(R.id.md_colorRValue); - customSeekG = v.findViewById(R.id.md_colorG); - customSeekGValue = v.findViewById(R.id.md_colorGValue); - customSeekB = v.findViewById(R.id.md_colorB); - customSeekBValue = v.findViewById(R.id.md_colorBValue); - - if (!builder.allowUserCustomAlpha) { - v.findViewById(R.id.md_colorALabel).setVisibility(View.GONE); - customSeekA.setVisibility(View.GONE); - customSeekAValue.setVisibility(View.GONE); - customColorHex.setHint("2196F3"); - customColorHex.setFilters(new InputFilter[]{new InputFilter.LengthFilter(6)}); - } else { - customColorHex.setHint("FF2196F3"); - customColorHex.setFilters(new InputFilter[]{new InputFilter.LengthFilter(8)}); - } - } - - invalidate(); - return dialog; - } - - @Override - public void onDismiss(DialogInterface dialog) { - super.onDismiss(dialog); - if (getBuilder().callback != null) { - getBuilder().callback.onColorChooserDismissed(this); - } - } - - private void toggleCustom(MaterialDialog dialog) { - if (dialog == null) { - dialog = (MaterialDialog) getDialog(); - } - if (grid.getVisibility() == View.VISIBLE) { - dialog.setTitle(getBuilder().customBtn); - dialog.setActionButton(DialogAction.NEUTRAL, getBuilder().presetsBtn); - dialog.setActionButton(DialogAction.NEGATIVE, getBuilder().cancelBtn); - grid.setVisibility(View.INVISIBLE); - colorChooserCustomFrame.setVisibility(View.VISIBLE); - - customColorTextWatcher = - new TextWatcher() { - @Override - public void beforeTextChanged(CharSequence s, int start, int count, int after) { - } - - @Override - public void onTextChanged(CharSequence s, int start, int before, int count) { - try { - selectedCustomColor = Color.parseColor("#" + s.toString()); - } catch (IllegalArgumentException e) { - selectedCustomColor = Color.BLACK; - } - customColorIndicator.setBackgroundColor(selectedCustomColor); - if (customSeekA.getVisibility() == View.VISIBLE) { - int alpha = Color.alpha(selectedCustomColor); - customSeekA.setProgress(alpha); - customSeekAValue.setText(String.format(Locale.US, "%d", alpha)); - } - int red = Color.red(selectedCustomColor); - customSeekR.setProgress(red); - int green = Color.green(selectedCustomColor); - customSeekG.setProgress(green); - int blue = Color.blue(selectedCustomColor); - customSeekB.setProgress(blue); - isInSub(false); - topIndex(-1); - subIndex(-1); - invalidateDynamicButtonColors(); - } - - @Override - public void afterTextChanged(Editable s) { - } - }; - - customColorHex.addTextChangedListener(customColorTextWatcher); - customColorRgbListener = - new SeekBar.OnSeekBarChangeListener() { - @Override - public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) { - if (fromUser) { - if (getBuilder().allowUserCustomAlpha) { - int color = - Color.argb( - customSeekA.getProgress(), - customSeekR.getProgress(), - customSeekG.getProgress(), - customSeekB.getProgress()); - customColorHex.setText(String.format(Locale.US, "%08X", color)); - } else { - int color = - Color.rgb( - customSeekR.getProgress(), - customSeekG.getProgress(), - customSeekB.getProgress()); - customColorHex.setText(String.format(Locale.US, "%06X", 0xFFFFFF & color)); - } - } - customSeekAValue.setText(String.format(Locale.US, "%d", customSeekA.getProgress())); - customSeekRValue.setText(String.format(Locale.US, "%d", customSeekR.getProgress())); - customSeekGValue.setText(String.format(Locale.US, "%d", customSeekG.getProgress())); - customSeekBValue.setText(String.format(Locale.US, "%d", customSeekB.getProgress())); - } - - @Override - public void onStartTrackingTouch(SeekBar seekBar) { - } - - @Override - public void onStopTrackingTouch(SeekBar seekBar) { - } - }; - - customSeekR.setOnSeekBarChangeListener(customColorRgbListener); - customSeekG.setOnSeekBarChangeListener(customColorRgbListener); - customSeekB.setOnSeekBarChangeListener(customColorRgbListener); - if (customSeekA.getVisibility() == View.VISIBLE) { - customSeekA.setOnSeekBarChangeListener(customColorRgbListener); - customColorHex.setText(String.format("%08X", selectedCustomColor)); - } else { - customColorHex.setText(String.format("%06X", 0xFFFFFF & selectedCustomColor)); - } - } else { - dialog.setTitle(getBuilder().title); - dialog.setActionButton(DialogAction.NEUTRAL, getBuilder().customBtn); - if (isInSub()) { - dialog.setActionButton(DialogAction.NEGATIVE, getBuilder().backBtn); - } else { - dialog.setActionButton(DialogAction.NEGATIVE, getBuilder().cancelBtn); - } - grid.setVisibility(View.VISIBLE); - colorChooserCustomFrame.setVisibility(View.GONE); - customColorHex.removeTextChangedListener(customColorTextWatcher); - customColorTextWatcher = null; - customSeekR.setOnSeekBarChangeListener(null); - customSeekG.setOnSeekBarChangeListener(null); - customSeekB.setOnSeekBarChangeListener(null); - customColorRgbListener = null; - } - } - - private void invalidate() { - if (grid.getAdapter() == null) { - grid.setAdapter(new ColorGridAdapter()); - grid.setSelector( - ResourcesCompat.getDrawable(getResources(), R.drawable.bg_transparent, null)); - } else { - ((BaseAdapter) grid.getAdapter()).notifyDataSetChanged(); - } - if (getDialog() != null) { - getDialog().setTitle(getTitle()); - } - } - - private Builder getBuilder() { - if (getArguments() == null || !getArguments().containsKey("builder")) { - return null; - } - return (Builder) getArguments().getSerializable("builder"); - } - - private void dismissIfNecessary(FragmentManager fragmentManager, String tag) { - Fragment frag = fragmentManager.findFragmentByTag(tag); - if (frag != null) { - ((DialogFragment) frag).dismiss(); - fragmentManager.beginTransaction().remove(frag).commit(); - } - } - - @NonNull - public ColorChooserDialog show(FragmentManager fragmentManager) { - String tag; - Builder builder = getBuilder(); - if (builder.colorsTop != null) { - tag = TAG_CUSTOM; - } else { - tag = TAG_PRIMARY; - } - dismissIfNecessary(fragmentManager, tag); - show(fragmentManager, tag); - return this; - } - - @NonNull - public ColorChooserDialog show(FragmentActivity fragmentActivity) { - return show(fragmentActivity.getSupportFragmentManager()); - } - - @Retention(RetentionPolicy.SOURCE) - @StringDef({TAG_PRIMARY, TAG_ACCENT, TAG_CUSTOM}) - public @interface ColorChooserTag { - } - - public interface ColorCallback { - void onColorReset(@NonNull ColorChooserDialog dialog); - - void onColorSelection(@NonNull ColorChooserDialog dialog, @ColorInt int selectedColor); - - void onColorChooserDismissed(@NonNull ColorChooserDialog dialog); - } - - public static class Builder implements Serializable { - - @NonNull - final transient Context context; - @StringRes - final int title; - @Nullable - String mediumFont; - @Nullable - String regularFont; - @StringRes - int titleSub; - @ColorInt - int preselectColor; - @StringRes - int doneBtn = R.string.md_done_label; - @StringRes - int backBtn = R.string.md_back_label; - @StringRes - int cancelBtn = R.string.md_cancel_label; - @StringRes - int customBtn = R.string.md_custom_label; - @StringRes - int presetsBtn = R.string.md_presets_label; - @Nullable - int[] colorsTop; - @Nullable - int[][] colorsSub; - @Nullable - String tag; - @Nullable - Theme theme; - - ColorCallback callback; - - boolean dynamicButtonColor = true; - boolean allowUserCustom = true; - boolean allowUserCustomAlpha = true; - boolean setPreselectionColor = false; - - public Builder(@NonNull Context context, @StringRes int title) { - this.context = context; - this.title = title; - } - - @NonNull - public Builder typeface(@Nullable String medium, @Nullable String regular) { - this.mediumFont = medium; - this.regularFont = regular; - return this; - } - - @NonNull - public Builder titleSub(@StringRes int titleSub) { - this.titleSub = titleSub; - return this; - } - - @NonNull - public Builder tag(@Nullable String tag) { - this.tag = tag; - return this; - } - - @NonNull - public Builder theme(@NonNull Theme theme) { - this.theme = theme; - return this; - } - - @NonNull - public Builder preselect(@ColorInt int preselect) { - preselectColor = preselect; - setPreselectionColor = true; - return this; - } - - @NonNull - public Builder doneButton(@StringRes int text) { - doneBtn = text; - return this; - } - - @NonNull - public Builder backButton(@StringRes int text) { - backBtn = text; - return this; - } - - @NonNull - public Builder cancelButton(@StringRes int text) { - cancelBtn = text; - return this; - } - - @NonNull - public Builder customButton(@StringRes int text) { - customBtn = text; - return this; - } - - @NonNull - public Builder presetsButton(@StringRes int text) { - presetsBtn = text; - return this; - } - - @NonNull - public Builder dynamicButtonColor(boolean enabled) { - dynamicButtonColor = enabled; - return this; - } - - @NonNull - public Builder customColors(@NonNull int[] topLevel, @Nullable int[][] subLevel) { - colorsTop = topLevel; - colorsSub = subLevel; - return this; - } - - @NonNull - public Builder customColors(@ArrayRes int topLevel, @Nullable int[][] subLevel) { - colorsTop = DialogUtils.getColorArray(context, topLevel); - colorsSub = subLevel; - return this; - } - - @NonNull - public Builder allowUserColorInput(boolean allow) { - allowUserCustom = allow; - return this; - } - - @NonNull - public Builder allowUserColorInputAlpha(boolean allow) { - allowUserCustomAlpha = allow; - return this; - } - - @NonNull - public ColorChooserDialog build() { - ColorChooserDialog dialog = new ColorChooserDialog(); - Bundle args = new Bundle(); - args.putSerializable("builder", this); - dialog.setArguments(args); - return dialog; - } - - public Builder callback(ColorCallback callback) { - this.callback = callback; - return this; - } - - @NonNull - public ColorChooserDialog show(FragmentManager fragmentManager) { - ColorChooserDialog dialog = build(); - dialog.show(fragmentManager); - return dialog; - } - - @NonNull - public ColorChooserDialog show(FragmentActivity fragmentActivity) { - return show(fragmentActivity.getSupportFragmentManager()); - } - } - - private class ColorGridAdapter extends BaseAdapter { - - ColorGridAdapter() { - } - - @Override - public int getCount() { - if (isInSub()) { - return colorsSub[topIndex()].length; - } else { - return colorsTop.length; - } - } - - @Override - public Object getItem(int position) { - if (isInSub()) { - return colorsSub[topIndex()][position]; - } else { - return colorsTop[position]; - } - } - - @Override - public long getItemId(int position) { - return position; - } - - @Override - public View getView(int position, View convertView, ViewGroup parent) { - if (convertView == null) { - convertView = new CircleView(getContext()); - convertView.setLayoutParams(new GridView.LayoutParams(circleSize, circleSize)); - } - CircleView child = (CircleView) convertView; - @ColorInt final int color = isInSub() ? colorsSub[topIndex()][position] : colorsTop[position]; - child.setBackgroundColor(color); - if (isInSub()) { - child.setSelected(subIndex() == position); - } else { - child.setSelected(topIndex() == position); - } - child.setTag(String.format(Locale.US, "%d:%d", position, color)); - child.setOnClickListener(ColorChooserDialog.this); - child.setOnLongClickListener(ColorChooserDialog.this); - return convertView; - } - } -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/util/ui/ContextThemeWrapper.kt b/app/src/main/java/de/kuschku/quasseldroid/util/ui/ContextThemeWrapper.kt deleted file mode 100644 index 98713df9de842aa9cdd2107e7acd2ee24fbf731c..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/util/ui/ContextThemeWrapper.kt +++ /dev/null @@ -1,189 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.util.ui - -import android.content.Context -import android.content.ContextWrapper -import android.content.res.AssetManager -import android.content.res.Configuration -import android.content.res.Resources -import android.view.LayoutInflater -import androidx.annotation.StyleRes -import de.kuschku.quasseldroid.R - -/** - * A ContextWrapper that allows you to modify the theme from what is in the - * wrapped context. - * - * @hide - */ -open class ContextThemeWrapper : ContextWrapper { - var themeResId: Int = 0 - private set - private var mTheme: Resources.Theme? = null - private var mInflater: LayoutInflater? = null - /** - * Used by ActivityThread to apply the overridden configuration to onConfigurationChange - * callbacks. - * @hide - */ - var overrideConfiguration: Configuration? = null - private set - private var mResources: Resources? = null - - /** - * Creates a new context wrapper with no theme and no base context. - * - * - * **Note:** A base context **must** be attached - * using [.attachBaseContext] before calling any other - * method on the newly constructed context wrapper. - */ - constructor() : super(null) - - /** - * Creates a new context wrapper with the specified theme. - * - * - * The specified theme will be applied on top of the base context's theme. - * Any attributes not explicitly defined in the theme identified by - * <var>themeResId</var> will retain their original values. - * - * @param base the base context - * @param themeResId the resource ID of the theme to be applied on top of - * the base context's theme - */ - constructor(base: Context, @StyleRes themeResId: Int) : super(base) { - this.themeResId = themeResId - } - - /** - * Creates a new context wrapper with the specified theme. - * - * - * Unlike [.ContextThemeWrapper], the theme passed to - * this constructor will completely replace the base context's theme. - * - * @param base the base context - * @param theme the theme against which resources should be inflated - */ - constructor(base: Context, theme: Resources.Theme?) : super(base) { - mTheme = theme - } - - /** - * Call to set an "override configuration" on this context -- this is - * a configuration that replies one or more values of the standard - * configuration that is applied to the context. See - * [Context.createConfigurationContext] for more - * information. - * - * - * This method can only be called once, and must be called before any - * calls to [.getResources] or [.getAssets] are made. - */ - fun applyOverrideConfiguration(overrideConfiguration: Configuration) { - if (mResources != null) { - throw IllegalStateException( - "getResources() or getAssets() has already been called" - ) - } - if (this.overrideConfiguration != null) { - throw IllegalStateException("Override configuration has already been set") - } - this.overrideConfiguration = Configuration(overrideConfiguration) - } - - override fun getResources(): Resources? { - return resourcesInternal - } - - private val resourcesInternal: Resources? - get() { - if (mResources == null) { - mResources = overrideConfiguration?.let { - createConfigurationContext(it).resources - } ?: super.getResources() - } - return mResources - } - - override fun setTheme(resid: Int) { - if (themeResId != resid) { - themeResId = resid - initializeTheme() - } - } - - override fun getTheme(): Resources.Theme? { - if (mTheme != null) { - return mTheme - } - - if (themeResId == 0) { - themeResId = R.style.Theme_AppCompat_Light - } - initializeTheme() - - return mTheme - } - - override fun getSystemService(name: String): Any? { - if (Context.LAYOUT_INFLATER_SERVICE == name) { - if (mInflater == null) { - mInflater = LayoutInflater.from(baseContext).cloneInContext(this) - } - return mInflater - } - return baseContext.getSystemService(name) - } - - /** - * Called by [.setTheme] and [.getTheme] to apply a theme - * resource to the current Theme object. Can override to change the - * default (simple) behavior. This method will not be called in multiple - * threads simultaneously. - * - * @param theme The Theme object being modified. - * @param resid The theme style resource being applied to <var>theme</var>. - * @param first Set to true if this is the first time a style is being - * applied to <var>theme</var>. - */ - protected fun onApplyThemeResource(theme: Resources.Theme, resid: Int, first: Boolean) { - theme.applyStyle(resid, true) - } - - private fun initializeTheme() { - val first = mTheme == null - if (first) { - mTheme = resources!!.newTheme() - val theme = baseContext.theme - if (theme != null) { - mTheme!!.setTo(theme) - } - } - onApplyThemeResource(mTheme!!, themeResId, first) - } - - override fun getAssets(): AssetManager { - // Ensure we're returning assets with the correct configuration. - return resources!!.assets - } -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/util/ui/DoubleClickHelper.kt b/app/src/main/java/de/kuschku/quasseldroid/util/ui/DoubleClickHelper.kt deleted file mode 100644 index d4ffe4a939904f1cd7b96500a2b3d8c463192821..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/util/ui/DoubleClickHelper.kt +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.util.ui - -import android.annotation.SuppressLint -import android.view.GestureDetector -import android.view.MotionEvent -import android.view.View - -class DoubleClickHelper(view: View) : View.OnTouchListener { - var doubleClickListener: (() -> Unit)? = null - - private val gestureDetector = GestureDetector( - view.context, - object : GestureDetector.SimpleOnGestureListener() { - override fun onDoubleTap(e: MotionEvent?): Boolean { - doubleClickListener?.invoke() - return true - } - - override fun onDoubleTapEvent(e: MotionEvent?): Boolean { - return true - } - } - ) - - @SuppressLint("ClickableViewAccessibility") - override fun onTouch(v: View?, event: MotionEvent?) = gestureDetector.onTouchEvent(event) -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/util/ui/DragInterceptBottomSheetBehavior.kt b/app/src/main/java/de/kuschku/quasseldroid/util/ui/DragInterceptBottomSheetBehavior.kt deleted file mode 100644 index 09346312d87a5094abc5685bed4bed6f37db6743..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/util/ui/DragInterceptBottomSheetBehavior.kt +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.util.ui - -import android.content.Context -import android.util.AttributeSet -import android.view.MotionEvent -import android.view.View -import androidx.coordinatorlayout.widget.CoordinatorLayout -import com.google.android.material.bottomsheet.BottomSheetBehavior - -class DragInterceptBottomSheetBehavior<V : View> : BottomSheetBehavior<V> { - constructor() : super() - constructor(context: Context, attrs: AttributeSet?) : super(context, attrs) - - var allowDragging = true - - override fun onInterceptTouchEvent(parent: CoordinatorLayout, child: V, - event: MotionEvent): Boolean { - if (!allowDragging) return false - return super.onInterceptTouchEvent(parent, child, event) - } - - companion object { - /** - * A utility function to get the [BottomSheetBehavior] associated with the `view`. - * - * @param view The [View] with [BottomSheetBehavior]. - * @return The [BottomSheetBehavior] associated with the `view`. - */ - fun <V : View> from(view: V?): DragInterceptBottomSheetBehavior<V> { - val params = view?.layoutParams as? CoordinatorLayout.LayoutParams - ?: throw IllegalArgumentException("The view is not a child of CoordinatorLayout") - val behavior = params.behavior as? DragInterceptBottomSheetBehavior<*> - ?: throw IllegalArgumentException("The view is not associated with BottomSheetBehavior") - return behavior as DragInterceptBottomSheetBehavior<V> - } - } -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/util/ui/EditTextSelectionChange.kt b/app/src/main/java/de/kuschku/quasseldroid/util/ui/EditTextSelectionChange.kt deleted file mode 100644 index b8bfc820c2353b410ad75669c45908b7c86ac538..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/util/ui/EditTextSelectionChange.kt +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.util.ui - -import android.content.Context -import android.util.AttributeSet -import androidx.appcompat.widget.AppCompatEditText - -open class EditTextSelectionChange : AppCompatEditText { - constructor(context: Context?) : super(context) - constructor(context: Context?, attrs: AttributeSet?) : super(context, attrs) - constructor(context: Context?, attrs: AttributeSet?, defStyleAttr: Int) : - super(context, attrs, defStyleAttr) - - private var selectionChangeListener: ((IntRange) -> Unit)? = null - - fun setSelectionChangeListener(f: (IntRange) -> Unit) { - selectionChangeListener = f - } - - fun removeSelectionChangeListener() { - selectionChangeListener = null - } - - override fun onSelectionChanged(selStart: Int, selEnd: Int) { - super.onSelectionChanged(selStart, selEnd) - selectionChangeListener?.invoke(selStart until selEnd) - } -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/util/ui/FixedNestingScrollView.kt b/app/src/main/java/de/kuschku/quasseldroid/util/ui/FixedNestingScrollView.kt deleted file mode 100644 index acd5bc1f8afad45d35661a1afa6e54c762467c48..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/util/ui/FixedNestingScrollView.kt +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.util.ui - -import android.content.Context -import android.util.AttributeSet -import android.view.MotionEvent -import androidx.core.widget.NestedScrollView - -class FixedNestingScrollView : NestedScrollView { - constructor(context: Context) : - super(context) - - constructor(context: Context, attrs: AttributeSet?) : - super(context, attrs) - - constructor(context: Context, attrs: AttributeSet?, defStyleAttr: Int) : - super(context, attrs, defStyleAttr) - - override fun onInterceptTouchEvent(ev: MotionEvent?): Boolean { - if (!canScrollVertically(-1)) - return false - return super.onInterceptTouchEvent(ev) - } -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/util/ui/LinkLongClickMenuHelper.kt b/app/src/main/java/de/kuschku/quasseldroid/util/ui/LinkLongClickMenuHelper.kt deleted file mode 100644 index 8e4dfb835ab29f42d032c331ee157c1f1e402b1a..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/util/ui/LinkLongClickMenuHelper.kt +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.util.ui - -import android.content.ClipData -import android.content.ClipboardManager -import android.content.Context -import android.content.Intent -import android.widget.TextView -import androidx.appcompat.widget.PopupMenu -import de.kuschku.quasseldroid.R - -class LinkLongClickMenuHelper : - BetterLinkMovementMethod.OnLinkLongClickListener, - ((TextView, String) -> Boolean) { - private var linkMenu: PopupMenu? = null - - override fun invoke(anchor: TextView, url: String) = onLongClick(anchor, url) - override fun onLongClick(anchor: TextView, url: String?): Boolean { - if (linkMenu == null) { - linkMenu = PopupMenu(anchor.context, anchor).also { menu -> - linkMenu?.dismiss() - menu.menuInflater.inflate(R.menu.context_link, menu.menu) - menu.setOnMenuItemClickListener { - when (it.itemId) { - R.id.action_copy -> { - val clipboard = anchor.context.getSystemService(Context.CLIPBOARD_SERVICE) as ClipboardManager - clipboard.setPrimaryClip(ClipData.newPlainText(null, url)) - menu.dismiss() - linkMenu = null - true - } - R.id.action_share -> { - val intent = Intent(Intent.ACTION_SEND) - intent.type = "text/plain" - intent.putExtra(Intent.EXTRA_TEXT, url) - anchor.context.startActivity( - Intent.createChooser(intent, anchor.context.getString(R.string.label_share)) - ) - menu.dismiss() - linkMenu = null - true - } - else -> false - } - } - menu.setOnDismissListener { - linkMenu = null - } - menu.show() - } - } - return true - } -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/util/ui/LocaleHelper.kt b/app/src/main/java/de/kuschku/quasseldroid/util/ui/LocaleHelper.kt deleted file mode 100644 index 216e9ca16f0ed623bb305bf5e194363f330509f9..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/util/ui/LocaleHelper.kt +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.util.ui - -import android.content.Context -import android.content.res.Configuration -import de.kuschku.quasseldroid.settings.Settings -import java.util.* - - -object LocaleHelper { - fun setLocale(context: Context): Context { - return updateResources(context, Settings.appearance(context).language) - } - - fun parseLanguageCode(rawLanguage: String): Locale { - val split = rawLanguage.split("-", limit = 3) - return when (split.size) { - 3 -> Locale(split[0], split[2], split[1]) - 2 -> Locale(split[0], split[1], "") - else -> Locale(split[0], "", "") - } - } - - private fun updateResources(context: Context, language: String) = if (language.isNotEmpty()) { - val locale = parseLanguageCode(language) - Locale.setDefault(locale) - context.createConfigurationContext(Configuration(context.resources.configuration).apply { - setLocale(locale) - }) - } else context -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/util/ui/RecyclerSpinnerAdapter.kt b/app/src/main/java/de/kuschku/quasseldroid/util/ui/RecyclerSpinnerAdapter.kt deleted file mode 100644 index e07f635fe294a5d3e38a7a909463df9216b88515..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/util/ui/RecyclerSpinnerAdapter.kt +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.util.ui - -import android.content.res.Resources -import android.view.View -import android.view.ViewGroup -import android.widget.BaseAdapter -import androidx.appcompat.widget.ThemedSpinnerAdapter -import androidx.recyclerview.widget.RecyclerView - -abstract class RecyclerSpinnerAdapter<VH : RecyclerView.ViewHolder> : BaseAdapter(), - ThemedSpinnerAdapter { - private var dropDownViewTheme: Resources.Theme? = null - override fun getDropDownViewTheme() = dropDownViewTheme - override fun setDropDownViewTheme(theme: Resources.Theme?) { - dropDownViewTheme = theme - } - - override fun getDropDownView(position: Int, convertView: View?, parent: ViewGroup): View { - val tag = convertView?.tag - val holder: VH = tag as? VH ?: onCreateViewHolder(parent, true) - holder.itemView.tag = holder - onBindViewHolder(holder, position) - return holder.itemView - } - - override fun getView(position: Int, convertView: View?, parent: ViewGroup): View { - val tag = convertView?.tag - val holder = tag as? VH ?: onCreateViewHolder(parent, false) - holder.itemView.tag = holder - onBindViewHolder(holder, position) - return holder.itemView - } - - protected abstract fun onBindViewHolder(holder: VH, position: Int) - protected abstract fun onCreateViewHolder(parent: ViewGroup, dropDown: Boolean): VH -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/util/ui/SpanFormatter.kt b/app/src/main/java/de/kuschku/quasseldroid/util/ui/SpanFormatter.kt deleted file mode 100644 index 6e59e4c02f92afb497e2375a2e73f7221e570632..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/util/ui/SpanFormatter.kt +++ /dev/null @@ -1,89 +0,0 @@ -/* - * Copyright © 2014 George T. Steel - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package de.kuschku.quasseldroid.util.ui - -import android.text.Spannable -import android.text.SpannableStringBuilder -import android.text.Spanned -import android.text.SpannedString -import java.util.* -import java.util.regex.Pattern - -/** - * Provides [String.format] style functions that work with [Spanned] strings and preserve formatting. - * - * @author George T. Steel - */ -object SpanFormatter { - private val FORMAT_SEQUENCE = Pattern.compile("%([0-9]+\\$|<?)([^a-zA-z%]*)([[a-zA-Z%]&&[^tT]]|[tT][a-zA-Z])") - - /** - * Version of [String.format] that works on [Spanned] strings to preserve rich text formatting. - * Both the `format` as well as any `%s args` can be Spanned and will have their formatting preserved. - * Due to the way [Spannable]s work, any argument's spans will can only be included **once** in the result. - * Any duplicates will appear as text only. - * - * @param locale the locale to apply; `null` value means no localization. - * @param format the format string (see [java.util.Formatter.format]) - * @param args the list of arguments passed to the formatter. - * @return the formatted string (with spans). - * @see String.format - */ - fun format(format: CharSequence, vararg args: Any?, - locale: Locale = Locale.getDefault()): SpannedString { - val out = SpannableStringBuilder(format) - - var i = 0 - var argAt = -1 - - while (i < out.length) { - val m = FORMAT_SEQUENCE.matcher(out) - if (!m.find(i)) break - i = m.start() - val exprEnd = m.end() - - val argTerm = m.group(1) - val modTerm = m.group(2) - val typeTerm = m.group(3) - - val cookedArg: CharSequence - - if (typeTerm == "%") { - cookedArg = "%" - } else { - val argIdx = when (argTerm) { - "" -> ++argAt - "<" -> argAt - else -> Integer.parseInt(argTerm.substring(0, argTerm.length - 1)) - 1 - } - - val argItem = args[argIdx] - - cookedArg = if (typeTerm == "s" && argItem is Spanned) { - argItem - } else { - String.format(locale, "%$modTerm$typeTerm", argItem) - } - } - - out.replace(i, exprEnd, cookedArg) - i += cookedArg.length - } - - return SpannedString(out) - } -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/util/ui/ThemedActivity.kt b/app/src/main/java/de/kuschku/quasseldroid/util/ui/ThemedActivity.kt deleted file mode 100644 index e881c16dbb78ebe5540f27638c0901e95d8cb26f..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/util/ui/ThemedActivity.kt +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.util.ui - -import android.content.Context -import android.content.pm.PackageManager -import android.os.Bundle -import androidx.appcompat.app.AppCompatActivity -import dagger.android.AndroidInjection -import dagger.android.AndroidInjector -import dagger.android.DispatchingAndroidInjector -import dagger.android.HasAndroidInjector -import de.kuschku.libquassel.util.helper.nullIf -import de.kuschku.quasseldroid.settings.AppearanceSettings -import javax.inject.Inject - -abstract class ThemedActivity : AppCompatActivity(), HasAndroidInjector { - @Inject - lateinit var androidInjector: DispatchingAndroidInjector<Any> - - @Inject - lateinit var appearanceSettings: AppearanceSettings - - override fun onCreate(savedInstanceState: Bundle?) { - AndroidInjection.inject(this) - setTheme(appearanceSettings.theme.style) - super.onCreate(savedInstanceState) - packageManager.getActivityInfo(componentName, PackageManager.GET_META_DATA).labelRes - .nullIf { it == 0 }?.let(this::setTitle) - } - - override fun attachBaseContext(newBase: Context) { - super.attachBaseContext(LocaleHelper.setLocale(newBase)) - } - - override fun androidInjector(): AndroidInjector<Any> { - return androidInjector - } -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/util/ui/drawable/DrawerToggleActivityDrawable.kt b/app/src/main/java/de/kuschku/quasseldroid/util/ui/drawable/DrawerToggleActivityDrawable.kt deleted file mode 100644 index 814d2d16087d101eee145188ca23009d169eaefd..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/util/ui/drawable/DrawerToggleActivityDrawable.kt +++ /dev/null @@ -1,116 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.util.ui.drawable - -import android.content.Context -import android.graphics.* -import android.graphics.drawable.Drawable -import androidx.annotation.ColorRes -import de.kuschku.quasseldroid.R -import de.kuschku.quasseldroid.util.helper.styledAttributes - -class DrawerToggleActivityDrawable(context: Context, @ColorRes colorAttribute: Int) : Drawable() { - private val size = context.resources.getDimensionPixelSize(R.dimen.drawer_toggle_size) - private val thickness = context.resources.getDimension(R.dimen.drawer_toggle_thickness) - - private val overlayPaint = Paint().apply { - color = context.theme.styledAttributes(colorAttribute) { - getColor(0, 0) - } - style = Paint.Style.FILL - isAntiAlias = true - } - - private val togglePaint = Paint().apply { - color = context.theme.styledAttributes(R.attr.colorControlNormal) { - getColor(0, 0) - } - style = Paint.Style.STROKE - strokeJoin = Paint.Join.MITER - strokeCap = Paint.Cap.BUTT - isAntiAlias = true - strokeWidth = thickness - } - - - private val overlayPath = Path().apply { - arcTo(RectF(22f, 22f, 24f, 24f), 0f, 90f) - arcTo(RectF(16f, 22f, 18f, 24f), 90f, 90f) - arcTo(RectF(16f, 16f, 18f, 18f), 180f, 90f) - arcTo(RectF(22f, 16f, 24f, 18f), 270f, 90f) - close() - } - - private val togglePath = Path().apply { - // top bar - moveTo(3f, 7f) - rLineTo(18f, 0f) - - // draw middle bar - moveTo(3f, 12f) - rLineTo(18f, 0f) - - // bottom bar - moveTo(3f, 17f) - rLineTo(18f, 0f) - } - - override fun getIntrinsicHeight() = size - override fun getIntrinsicWidth() = size - - // Not supported - override fun setAlpha(alpha: Int) = Unit - - override fun getOpacity(): Int = PixelFormat.TRANSLUCENT - - // Not supported - override fun setColorFilter(colorFilter: ColorFilter?) = Unit - - private val transformationMatrix = Matrix() - private val transformedOverlayPath = Path() - private val transformedTogglePath = Path() - - private fun transformPaths() { - transformationMatrix.reset() - transformationMatrix.apply { - val smallestDimension = Math.min(bounds.width(), bounds.height()) - preScale(smallestDimension / 24f, smallestDimension / 24f, 0f, 0f) - } - - transformedOverlayPath.set(overlayPath) - transformedOverlayPath.transform(transformationMatrix) - transformedTogglePath.set(togglePath) - transformedTogglePath.transform(transformationMatrix) - } - - override fun onBoundsChange(bounds: Rect?) { - transformPaths() - } - - override fun draw(canvas: Canvas) { - if (bounds.width() <= 0 || bounds.height() <= 0) { - // Nothing to draw - return - } - - canvas.drawPath(transformedTogglePath, togglePaint) - canvas.drawPath(transformedOverlayPath, overlayPaint) - } -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/util/ui/drawable/NickCountDrawable.kt b/app/src/main/java/de/kuschku/quasseldroid/util/ui/drawable/NickCountDrawable.kt deleted file mode 100644 index ca11b79b9a28808357ddcfcfb12c093a0785ea7c..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/util/ui/drawable/NickCountDrawable.kt +++ /dev/null @@ -1,108 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.util.ui.drawable - -import android.graphics.* -import android.graphics.drawable.Drawable -import androidx.annotation.ColorInt -import androidx.annotation.Dimension - -class NickCountDrawable( - count: Int, - @Dimension private val size: Int, - @ColorInt textColor: Int -) : Drawable() { - private val paint = Paint().apply { - color = textColor - isAntiAlias = true - style = Paint.Style.FILL - typeface = Typeface.DEFAULT_BOLD - textAlign = Paint.Align.CENTER - } - - private val formattedText: String = formatCount(count) - - private fun formatCount(count: Int) = when { - count >= 10_000 -> String.format("%.00fK", count / 1_000f) - count >= 1_000 -> String.format("%.01fK", count / 1_000f) - else -> "$count" - } - - private val showText: Boolean = count > 0 - - private val icon = Path().apply { - moveTo(16f, 13f) - cubicTo(15.71f, 13f, 15.38f, 13f, 15.03f, 13.05f) - cubicTo(16.19f, 13.89f, 17f, 15f, 17f, 16.5f) - lineTo(17f, 19f) - lineTo(23f, 19f) - lineTo(23f, 16.5f) - cubicTo(23f, 14.17f, 18.33f, 13f, 16f, 13f) - moveTo(8f, 13f) - cubicTo(5.67f, 13f, 1f, 14.17f, 1f, 16.5f) - lineTo(1f, 19f) - lineTo(15f, 19f) - lineTo(15f, 16.5f) - cubicTo(15f, 14.17f, 10.33f, 13f, 8f, 13f) - addCircle(8f, 8f, 3f, Path.Direction.CCW) - addCircle(16f, 8f, 3f, Path.Direction.CCW) - close() - } - - override fun getIntrinsicHeight() = size - override fun getIntrinsicWidth() = size - - private val tmpPath = Path() - - override fun setAlpha(alpha: Int) { - paint.alpha = alpha - } - - override fun getOpacity(): Int = PixelFormat.TRANSLUCENT - - override fun setColorFilter(colorFilter: ColorFilter?) { - paint.colorFilter = colorFilter - } - - override fun draw(canvas: Canvas) { - if (bounds.width() <= 0 || bounds.height() <= 0) { - // Nothing to draw - return - } - - val smallestDimension = Math.min(bounds.width(), bounds.height()) - - tmpPath.set(icon) - tmpPath.transform(Matrix().apply { - preScale(smallestDimension / 24f, smallestDimension / 24f, 0f, 0f) - if (showText) { - preTranslate(0f, -8f) - } - }) - - paint.textSize = smallestDimension * 0.6f - - canvas.drawPath(tmpPath, paint) - if (showText) { - canvas.drawText(formattedText, bounds.width() / 2f, - bounds.height() * 0.85f - ((paint.descent() + paint.ascent()) / 2f), paint) - } - } -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/util/ui/drawable/TextDrawable.java b/app/src/main/java/de/kuschku/quasseldroid/util/ui/drawable/TextDrawable.java deleted file mode 100644 index 952e015f5589c1bd587dd1a131c0616367a9214e..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/util/ui/drawable/TextDrawable.java +++ /dev/null @@ -1,347 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.util.ui.drawable; - -import android.graphics.Canvas; -import android.graphics.Color; -import android.graphics.ColorFilter; -import android.graphics.Paint; -import android.graphics.PixelFormat; -import android.graphics.Rect; -import android.graphics.RectF; -import android.graphics.Typeface; -import android.graphics.drawable.ShapeDrawable; -import android.graphics.drawable.shapes.OvalShape; -import android.graphics.drawable.shapes.RectShape; -import android.graphics.drawable.shapes.RoundRectShape; - -import java.util.Locale; - -/** - * @author amulya - * created 14 Oct 2014 - */ -public class TextDrawable extends ShapeDrawable { - - private static final float SHADE_FACTOR = 0.9f; - private final Paint textPaint; - private final Paint borderPaint; - private final String text; - private final RectShape shape; - private final int height; - private final int width; - private final int fontSize; - private final float radius; - private final int borderThickness; - private final float scale; - - private TextDrawable(Builder builder) { - super(builder.shape); - - // shape properties - shape = builder.shape; - height = builder.height; - width = builder.width; - radius = builder.radius; - - scale = builder.scale; - - // text and color - text = builder.toUpperCase ? builder.text.toUpperCase(Locale.getDefault()) : builder.text; - - // text paint settings - fontSize = builder.fontSize; - textPaint = new Paint(); - textPaint.setColor(builder.textColor); - textPaint.setAntiAlias(true); - textPaint.setFakeBoldText(builder.isBold); - textPaint.setStyle(Paint.Style.FILL); - textPaint.setTypeface(builder.font); - textPaint.setTextAlign(Paint.Align.CENTER); - textPaint.setStrokeWidth(builder.borderThickness); - - // border paint settings - borderThickness = builder.borderThickness; - borderPaint = new Paint(); - borderPaint.setColor(getDarkerShade(builder.color)); - borderPaint.setStyle(Paint.Style.STROKE); - borderPaint.setStrokeWidth(borderThickness); - - // drawable paint color - Paint paint = getPaint(); - paint.setColor(builder.color); - - } - - public static IShapeBuilder builder() { - return new Builder(); - } - - private int getDarkerShade(int color) { - return Color.rgb((int) (SHADE_FACTOR * Color.red(color)), - (int) (SHADE_FACTOR * Color.green(color)), - (int) (SHADE_FACTOR * Color.blue(color))); - } - - @Override - public void draw(Canvas canvas) { - super.draw(canvas); - Rect r = getBounds(); - - - // draw border - if (borderThickness > 0) { - drawBorder(canvas); - } - - int count = canvas.save(); - canvas.translate(r.left, r.top); - - // draw text - int width = this.width < 0 ? r.width() : this.width; - int height = this.height < 0 ? r.height() : this.height; - int fontSize = this.fontSize < 0 ? (int) (Math.min(width, height) * scale) : this.fontSize; - textPaint.setTextSize(fontSize); - canvas.drawText(text, width / 2, height / 2 - ((textPaint.descent() + textPaint.ascent()) / 2), textPaint); - - canvas.restoreToCount(count); - - } - - private void drawBorder(Canvas canvas) { - RectF rect = new RectF(getBounds()); - rect.inset(borderThickness / 2, borderThickness / 2); - - if (shape instanceof OvalShape) { - canvas.drawOval(rect, borderPaint); - } else if (shape instanceof RoundRectShape) { - canvas.drawRoundRect(rect, radius, radius, borderPaint); - } else { - canvas.drawRect(rect, borderPaint); - } - } - - @Override - public void setAlpha(int alpha) { - textPaint.setAlpha(alpha); - } - - @Override - public void setColorFilter(ColorFilter cf) { - textPaint.setColorFilter(cf); - } - - @Override - public int getOpacity() { - return PixelFormat.TRANSLUCENT; - } - - @Override - public int getIntrinsicWidth() { - return width; - } - - @Override - public int getIntrinsicHeight() { - return height; - } - - public interface IConfigBuilder { - IConfigBuilder width(int width); - - IConfigBuilder height(int height); - - IConfigBuilder scale(float scale); - - IConfigBuilder textColor(int color); - - IConfigBuilder withBorder(int thickness); - - IConfigBuilder useFont(Typeface font); - - IConfigBuilder fontSize(int size); - - IConfigBuilder bold(); - - IConfigBuilder toUpperCase(); - - IShapeBuilder endConfig(); - } - - public interface IBuilder { - TextDrawable build(String text, int color); - } - - public interface IShapeBuilder { - IConfigBuilder beginConfig(); - - IBuilder rect(); - - IBuilder round(); - - IBuilder roundRect(int radius); - - TextDrawable buildRect(String text, int color); - - TextDrawable buildRoundRect(String text, int color, int radius); - - TextDrawable buildRound(String text, int color); - } - - public static class Builder implements IConfigBuilder, IShapeBuilder, IBuilder { - public int textColor; - public float radius; - private float scale; - private String text; - private int color; - private int borderThickness; - private int width; - private int height; - private Typeface font; - private RectShape shape; - private int fontSize; - private boolean isBold; - private boolean toUpperCase; - - private Builder() { - text = ""; - color = Color.GRAY; - textColor = Color.WHITE; - borderThickness = 0; - width = -1; - height = -1; - scale = 0.67f; - shape = new RectShape(); - font = Typeface.create("sans-serif-light", Typeface.NORMAL); - fontSize = -1; - isBold = false; - toUpperCase = false; - } - - @Override - public IConfigBuilder width(int width) { - this.width = width; - return this; - } - - @Override - public IConfigBuilder height(int height) { - this.height = height; - return this; - } - - @Override - public IConfigBuilder textColor(int color) { - this.textColor = color; - return this; - } - - @Override - public IConfigBuilder scale(float scale) { - this.scale = scale; - return this; - } - - @Override - public IConfigBuilder withBorder(int thickness) { - this.borderThickness = thickness; - return this; - } - - @Override - public IConfigBuilder useFont(Typeface font) { - this.font = font; - return this; - } - - @Override - public IConfigBuilder fontSize(int size) { - this.fontSize = size; - return this; - } - - @Override - public IConfigBuilder bold() { - this.isBold = true; - return this; - } - - @Override - public IConfigBuilder toUpperCase() { - this.toUpperCase = true; - return this; - } - - @Override - public IConfigBuilder beginConfig() { - return this; - } - - @Override - public IShapeBuilder endConfig() { - return this; - } - - @Override - public IBuilder rect() { - this.shape = new RectShape(); - return this; - } - - @Override - public IBuilder round() { - this.shape = new OvalShape(); - return this; - } - - @Override - public IBuilder roundRect(int radius) { - this.radius = radius; - float[] radii = {radius, radius, radius, radius, radius, radius, radius, radius}; - this.shape = new RoundRectShape(radii, null, null); - return this; - } - - @Override - public TextDrawable buildRect(String text, int color) { - rect(); - return build(text, color); - } - - @Override - public TextDrawable buildRoundRect(String text, int color, int radius) { - roundRect(radius); - return build(text, color); - } - - @Override - public TextDrawable buildRound(String text, int color) { - round(); - return build(text, color); - } - - @Override - public TextDrawable build(String text, int color) { - this.color = color; - this.text = text; - return new TextDrawable(this); - } - } -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/util/ui/fastscroll/interfaces/OnFastScrollStateChangeListener.java b/app/src/main/java/de/kuschku/quasseldroid/util/ui/fastscroll/interfaces/OnFastScrollStateChangeListener.java deleted file mode 100644 index 7c09583b7447fcc777a765c6cd5bd3802e830268..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/util/ui/fastscroll/interfaces/OnFastScrollStateChangeListener.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.util.ui.fastscroll.interfaces; - -public interface OnFastScrollStateChangeListener { - - /** - * Called when fast scrolling begins - */ - void onFastScrollStart(); - - /** - * Called when fast scrolling ends - */ - void onFastScrollStop(); -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/util/ui/fastscroll/utils/Utils.java b/app/src/main/java/de/kuschku/quasseldroid/util/ui/fastscroll/utils/Utils.java deleted file mode 100644 index fe3557af69b5dc71d40542356d11dcbf547b8861..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/util/ui/fastscroll/utils/Utils.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright (c) 2016 Tim Malseed - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package de.kuschku.quasseldroid.util.ui.fastscroll.utils; - -import android.content.res.Resources; -import android.util.TypedValue; -import android.view.View; - -public class Utils { - - /** - * Converts dp to px - * - * @param res Resources - * @param dp the value in dp - * @return int - */ - public static int toPixels(Resources res, float dp) { - return (int) (dp * res.getDisplayMetrics().density); - } - - /** - * Converts sp to px - * - * @param res Resources - * @param sp the value in sp - * @return int - */ - public static int toScreenPixels(Resources res, float sp) { - return (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_SP, sp, res.getDisplayMetrics()); - } - - public static boolean isRtl(Resources res) { - return res.getConfiguration().getLayoutDirection() == View.LAYOUT_DIRECTION_RTL; - } -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/util/ui/fastscroll/views/FastScrollPopup.java b/app/src/main/java/de/kuschku/quasseldroid/util/ui/fastscroll/views/FastScrollPopup.java deleted file mode 100644 index 87e8e3c4bf5205a3eda327809a99058f0091e09c..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/util/ui/fastscroll/views/FastScrollPopup.java +++ /dev/null @@ -1,238 +0,0 @@ -/* - * Copyright (c) 2016 Tim Malseed - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package de.kuschku.quasseldroid.util.ui.fastscroll.views; - -import android.animation.ObjectAnimator; -import android.content.res.Resources; -import android.graphics.Canvas; -import android.graphics.Color; -import android.graphics.Paint; -import android.graphics.Path; -import android.graphics.Rect; -import android.graphics.RectF; -import android.graphics.Typeface; -import android.text.TextUtils; - -import androidx.annotation.Keep; - -import de.kuschku.quasseldroid.util.ui.fastscroll.utils.Utils; - -public class FastScrollPopup { - - private FastScrollRecyclerView mRecyclerView; - - private Resources mRes; - - private int mBackgroundSize; - private int mCornerRadius; - - private Path mBackgroundPath = new Path(); - private RectF mBackgroundRect = new RectF(); - private Paint mBackgroundPaint; - private int mBackgroundColor = 0xff000000; - - private Rect mInvalidateRect = new Rect(); - private Rect mTmpRect = new Rect(); - - // The absolute bounds of the fast scroller bg - private Rect mBgBounds = new Rect(); - - private String mSectionName; - - private Paint mTextPaint; - private Rect mTextBounds = new Rect(); - - private float mAlpha = 1; - - private ObjectAnimator mAlphaAnimator; - private boolean mVisible; - - @FastScroller.FastScrollerPopupPosition - private int mPosition; - - FastScrollPopup(Resources resources, FastScrollRecyclerView recyclerView) { - - mRes = resources; - - mRecyclerView = recyclerView; - - mBackgroundPaint = new Paint(Paint.ANTI_ALIAS_FLAG); - - mTextPaint = new Paint(Paint.ANTI_ALIAS_FLAG); - mTextPaint.setAlpha(0); - - setTextSize(Utils.toScreenPixels(mRes, 44)); - setBackgroundSize(Utils.toPixels(mRes, 88)); - } - - public void setBgColor(int color) { - mBackgroundColor = color; - mBackgroundPaint.setColor(color); - mRecyclerView.invalidate(mBgBounds); - } - - public void setTextColor(int color) { - mTextPaint.setColor(color); - mRecyclerView.invalidate(mBgBounds); - } - - public void setTextSize(int size) { - mTextPaint.setTextSize(size); - mRecyclerView.invalidate(mBgBounds); - } - - public void setBackgroundSize(int size) { - mBackgroundSize = size; - mCornerRadius = mBackgroundSize / 2; - mRecyclerView.invalidate(mBgBounds); - } - - public void setTypeface(Typeface typeface) { - mTextPaint.setTypeface(typeface); - mRecyclerView.invalidate(mBgBounds); - } - - /** - * Animates the visibility of the fast scroller popup. - */ - public void animateVisibility(boolean visible) { - if (mVisible != visible) { - mVisible = visible; - if (mAlphaAnimator != null) { - mAlphaAnimator.cancel(); - } - mAlphaAnimator = ObjectAnimator.ofFloat(this, "alpha", visible ? 1f : 0f); - mAlphaAnimator.setDuration(visible ? 200 : 150); - mAlphaAnimator.start(); - } - } - - @Keep - public float getAlpha() { - return mAlpha; - } - - // Setter/getter for the popup alpha for animations - @Keep - public void setAlpha(float alpha) { - mAlpha = alpha; - mRecyclerView.invalidate(mBgBounds); - } - - @FastScroller.FastScrollerPopupPosition - public int getPopupPosition() { - return mPosition; - } - - public void setPopupPosition(@FastScroller.FastScrollerPopupPosition int position) { - mPosition = position; - } - - private float[] createRadii() { - if (mPosition == FastScroller.FastScrollerPopupPosition.CENTER) { - return new float[]{mCornerRadius, mCornerRadius, mCornerRadius, mCornerRadius, mCornerRadius, mCornerRadius, mCornerRadius, mCornerRadius}; - } - - if (Utils.isRtl(mRes)) { - return new float[]{mCornerRadius, mCornerRadius, mCornerRadius, mCornerRadius, mCornerRadius, mCornerRadius, 0, 0}; - } else { - return new float[]{mCornerRadius, mCornerRadius, mCornerRadius, mCornerRadius, 0, 0, mCornerRadius, mCornerRadius}; - } - } - - public void draw(Canvas canvas) { - if (isVisible()) { - // Draw the fast scroller popup - int restoreCount = canvas.save(); - canvas.translate(mBgBounds.left, mBgBounds.top); - mTmpRect.set(mBgBounds); - mTmpRect.offsetTo(0, 0); - - mBackgroundPath.reset(); - mBackgroundRect.set(mTmpRect); - - float[] radii = createRadii(); - - mBackgroundPath.addRoundRect(mBackgroundRect, radii, Path.Direction.CW); - - mBackgroundPaint.setAlpha((int) (Color.alpha(mBackgroundColor) * mAlpha)); - mTextPaint.setAlpha((int) (mAlpha * 255)); - canvas.drawPath(mBackgroundPath, mBackgroundPaint); - canvas.drawText(mSectionName, (mBgBounds.width() - mTextBounds.width()) / 2, - mBgBounds.height() - (mBgBounds.height() - mTextBounds.height()) / 2, - mTextPaint); - canvas.restoreToCount(restoreCount); - } - } - - public void setSectionName(String sectionName) { - if (!sectionName.equals(mSectionName)) { - mSectionName = sectionName; - mTextPaint.getTextBounds(sectionName, 0, sectionName.length(), mTextBounds); - // Update the width to use measureText since that is more accurate - mTextBounds.right = (int) (mTextBounds.left + mTextPaint.measureText(sectionName)); - } - } - - /** - * Updates the bounds for the fast scroller. - * - * @return the invalidation rect for this update. - */ - public Rect updateFastScrollerBounds(FastScrollRecyclerView recyclerView, int thumbOffsetY) { - mInvalidateRect.set(mBgBounds); - - mBgBounds.top += recyclerView.getPaddingTop(); - mBgBounds.left += recyclerView.getPaddingLeft(); - mBgBounds.right -= recyclerView.getPaddingRight(); - mBgBounds.bottom -= recyclerView.getPaddingBottom(); - - if (isVisible()) { - // Calculate the dimensions and position of the fast scroller popup - int edgePadding = recyclerView.getScrollBarWidth(); - int bgPadding = Math.round((mBackgroundSize - mTextBounds.height()) / 10) * 5; - int bgHeight = mBackgroundSize; - int bgWidth = Math.max(mBackgroundSize, mTextBounds.width() + (2 * bgPadding)); - if (mPosition == FastScroller.FastScrollerPopupPosition.CENTER) { - mBgBounds.left = (recyclerView.getWidth() - bgWidth) / 2; - mBgBounds.right = mBgBounds.left + bgWidth; - mBgBounds.top = (recyclerView.getHeight() - bgHeight) / 2; - } else { - if (Utils.isRtl(mRes)) { - mBgBounds.left = (2 * recyclerView.getScrollBarWidth()); - mBgBounds.right = mBgBounds.left + bgWidth; - } else { - mBgBounds.right = recyclerView.getWidth() - (2 * recyclerView.getScrollBarWidth()); - mBgBounds.left = mBgBounds.right - bgWidth; - } - mBgBounds.top = recyclerView.getPaddingTop() + thumbOffsetY - bgHeight + recyclerView.getScrollBarThumbHeight() / 2; - mBgBounds.top = Math.max(edgePadding + recyclerView.getPaddingTop(), Math.min(mBgBounds.top, recyclerView.getHeight() - edgePadding - bgHeight - recyclerView.getPaddingBottom())); - } - mBgBounds.bottom = mBgBounds.top + bgHeight; - } else { - mBgBounds.setEmpty(); - } - - // Combine the old and new fast scroller bounds to create the full invalidate rect - mInvalidateRect.union(mBgBounds); - return mInvalidateRect; - } - - public boolean isVisible() { - return (mAlpha > 0f) && (!TextUtils.isEmpty(mSectionName)); - } -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/util/ui/fastscroll/views/FastScrollRecyclerView.java b/app/src/main/java/de/kuschku/quasseldroid/util/ui/fastscroll/views/FastScrollRecyclerView.java deleted file mode 100644 index ad3af0418268b356ea1c7851ba724bade0694235..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/util/ui/fastscroll/views/FastScrollRecyclerView.java +++ /dev/null @@ -1,562 +0,0 @@ -/* - * Copyright (c) 2016 Tim Malseed - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package de.kuschku.quasseldroid.util.ui.fastscroll.views; - -import android.content.Context; -import android.content.res.TypedArray; -import android.graphics.Canvas; -import android.graphics.Typeface; -import android.util.AttributeSet; -import android.util.Log; -import android.util.SparseIntArray; -import android.view.MotionEvent; -import android.view.View; - -import androidx.annotation.ColorInt; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import androidx.recyclerview.widget.GridLayoutManager; -import androidx.recyclerview.widget.LinearLayoutManager; -import androidx.recyclerview.widget.RecyclerView; - -import de.kuschku.quasseldroid.R; -import de.kuschku.quasseldroid.util.ui.fastscroll.interfaces.OnFastScrollStateChangeListener; -import de.kuschku.quasseldroid.util.ui.fastscroll.utils.Utils; - -public class FastScrollRecyclerView extends RecyclerView implements RecyclerView.OnItemTouchListener { - - private static final String TAG = "FastScrollRecyclerView"; - - private FastScroller mScrollbar; - - private boolean mFastScrollEnabled = true; - private ScrollPositionState mScrollPosState = new ScrollPositionState(); - private int mDownX; - private int mDownY; - private int mLastY; - private SparseIntArray mScrollOffsets; - private ScrollOffsetInvalidator mScrollOffsetInvalidator; - private OnFastScrollStateChangeListener mStateChangeListener; - - public FastScrollRecyclerView(Context context) { - this(context, null); - } - - public FastScrollRecyclerView(Context context, AttributeSet attrs) { - this(context, attrs, 0); - } - - public FastScrollRecyclerView(Context context, AttributeSet attrs, int defStyleAttr) { - super(context, attrs, defStyleAttr); - - TypedArray typedArray = context.getTheme().obtainStyledAttributes( - attrs, R.styleable.FastScrollRecyclerView, 0, 0); - try { - mFastScrollEnabled = typedArray.getBoolean(R.styleable.FastScrollRecyclerView_fastScrollThumbEnabled, true); - } finally { - typedArray.recycle(); - } - - mScrollbar = new FastScroller(context, this, attrs); - mScrollOffsetInvalidator = new ScrollOffsetInvalidator(); - mScrollOffsets = new SparseIntArray(); - } - - public int getScrollBarWidth() { - return mScrollbar.getWidth(); - } - - public int getScrollBarThumbHeight() { - return mScrollbar.getThumbHeight(); - } - - @Override - protected void onFinishInflate() { - super.onFinishInflate(); - addOnItemTouchListener(this); - } - - @Override - public void setAdapter(Adapter adapter) { - if (getAdapter() != null) { - getAdapter().unregisterAdapterDataObserver(mScrollOffsetInvalidator); - } - - if (adapter != null) { - adapter.registerAdapterDataObserver(mScrollOffsetInvalidator); - } - - super.setAdapter(adapter); - } - - /** - * We intercept the touch handling only to support fast scrolling when initiated from the - * scroll bar. Otherwise, we fall back to the default RecyclerView touch handling. - */ - @Override - public boolean onInterceptTouchEvent(RecyclerView rv, MotionEvent ev) { - return handleTouchEvent(ev); - } - - @Override - public void onTouchEvent(RecyclerView rv, MotionEvent ev) { - handleTouchEvent(ev); - } - - /** - * Handles the touch event and determines whether to show the fast scroller (or updates it if - * it is already showing). - */ - private boolean handleTouchEvent(MotionEvent ev) { - int action = ev.getAction(); - int x = (int) ev.getX(); - int y = (int) ev.getY(); - switch (action) { - case MotionEvent.ACTION_DOWN: - // Keep track of the down positions - mDownX = x; - mDownY = mLastY = y; - mScrollbar.handleTouchEvent(ev, mDownX, mDownY, mLastY, mStateChangeListener); - break; - case MotionEvent.ACTION_MOVE: - mLastY = y; - mScrollbar.handleTouchEvent(ev, mDownX, mDownY, mLastY, mStateChangeListener); - break; - case MotionEvent.ACTION_UP: - case MotionEvent.ACTION_CANCEL: - mScrollbar.handleTouchEvent(ev, mDownX, mDownY, mLastY, mStateChangeListener); - break; - } - return mScrollbar.isDragging(); - } - - @Override - public void onRequestDisallowInterceptTouchEvent(boolean disallowIntercept) { - - } - - /** - * Returns the available scroll height: - * AvailableScrollHeight = Total height of the all items - last page height - * - * @param yOffset the offset from the top of the recycler view to start tracking. - */ - protected int getAvailableScrollHeight(int adapterHeight, int yOffset) { - int visibleHeight = getHeight(); - int scrollHeight = getPaddingTop() + yOffset + adapterHeight + getPaddingBottom(); - int availableScrollHeight = scrollHeight - visibleHeight; - return availableScrollHeight; - } - - /** - * Returns the available scroll bar height: - * AvailableScrollBarHeight = Total height of the visible view - thumb height - */ - protected int getAvailableScrollBarHeight() { - int visibleHeight = getHeight(); - int availableScrollBarHeight = visibleHeight - mScrollbar.getThumbHeight(); - return availableScrollBarHeight; - } - - @Override - public void draw(Canvas c) { - super.draw(c); - if (mFastScrollEnabled) { - onUpdateScrollbar(); - mScrollbar.draw(c); - } - } - - /** - * Updates the scrollbar thumb offset to match the visible scroll of the recycler view. It does - * this by mapping the available scroll area of the recycler view to the available space for the - * scroll bar. - * - * @param scrollPosState the current scroll position - * @param rowCount the number of rows, used to calculate the total scroll height (assumes that - */ - protected void updateThumbPosition(ScrollPositionState scrollPosState, int rowCount) { - - int availableScrollHeight; - int availableScrollBarHeight; - int scrolledPastHeight; - - if (getAdapter() instanceof MeasurableAdapter) { - availableScrollHeight = getAvailableScrollHeight(calculateAdapterHeight(), 0); - scrolledPastHeight = calculateScrollDistanceToPosition(scrollPosState.rowIndex); - } else { - availableScrollHeight = getAvailableScrollHeight(rowCount * scrollPosState.rowHeight, 0); - scrolledPastHeight = scrollPosState.rowIndex * scrollPosState.rowHeight; - } - - availableScrollBarHeight = getAvailableScrollBarHeight(); - - // Only show the scrollbar if there is height to be scrolled - if (availableScrollHeight <= 0) { - mScrollbar.setThumbPosition(-1, -1); - return; - } - - // Calculate the current scroll position, the scrollY of the recycler view accounts for the - // view padding, while the scrollBarY is drawn right up to the background padding (ignoring - // padding) - int scrollY = getPaddingTop() + scrolledPastHeight - scrollPosState.rowTopOffset; - int scrollBarY = (int) (((float) scrollY / availableScrollHeight) * availableScrollBarHeight); - - // Calculate the position and size of the scroll bar - int scrollBarX; - if (Utils.isRtl(getResources())) { - scrollBarX = 0; - } else { - scrollBarX = getWidth() - mScrollbar.getWidth(); - } - mScrollbar.setThumbPosition(scrollBarX, scrollBarY); - } - - /** - * Maps the touch (from 0..1) to the adapter position that should be visible. - */ - public String scrollToPositionAtProgress(float touchFraction) { - int itemCount = getAdapter().getItemCount(); - if (itemCount == 0) { - return ""; - } - int spanCount = 1; - int rowCount = itemCount; - if (getLayoutManager() instanceof GridLayoutManager) { - spanCount = ((GridLayoutManager) getLayoutManager()).getSpanCount(); - rowCount = (int) Math.ceil((double) rowCount / spanCount); - } - - // Stop the scroller if it is scrolling - stopScroll(); - - getCurScrollState(mScrollPosState); - - float itemPos; - int availableScrollHeight; - - int scrollPosition; - int scrollOffset; - - if (getAdapter() instanceof MeasurableAdapter) { - itemPos = findItemPosition(touchFraction); - availableScrollHeight = calculateAdapterHeight(); - scrollPosition = (int) itemPos; - scrollOffset = calculateScrollDistanceToPosition(scrollPosition) - (int) (touchFraction * availableScrollHeight); - } else { - itemPos = findItemPosition(touchFraction); - availableScrollHeight = getAvailableScrollHeight(rowCount * mScrollPosState.rowHeight, 0); - - //The exact position of our desired item - int exactItemPos = (int) (availableScrollHeight * touchFraction); - - //The offset used here is kind of hard to explain. - //If the position we wish to scroll to is, say, position 10.5, we scroll to position 10, - //and then offset by 0.5 * rowHeight. This is how we achieve smooth scrolling. - scrollPosition = spanCount * exactItemPos / mScrollPosState.rowHeight; - scrollOffset = -(exactItemPos % mScrollPosState.rowHeight); - } - - LinearLayoutManager layoutManager = ((LinearLayoutManager) getLayoutManager()); - layoutManager.scrollToPositionWithOffset(scrollPosition, scrollOffset); - - if (!(getAdapter() instanceof SectionedAdapter)) { - return ""; - } - - int posInt = (int) ((touchFraction == 1) ? itemPos - 1 : itemPos); - - SectionedAdapter sectionedAdapter = (SectionedAdapter) getAdapter(); - return sectionedAdapter.getSectionName(posInt); - } - - @SuppressWarnings("unchecked") - private float findItemPosition(float touchFraction) { - - if (getAdapter() instanceof MeasurableAdapter) { - MeasurableAdapter measurer = (MeasurableAdapter) getAdapter(); - int viewTop = (int) (touchFraction * calculateAdapterHeight()); - - for (int i = 0; i < getAdapter().getItemCount(); i++) { - int top = calculateScrollDistanceToPosition(i); - int bottom = top + measurer.getViewTypeHeight(this, findViewHolderForAdapterPosition(i), getAdapter().getItemViewType(i)); - if (viewTop >= top && viewTop <= bottom) { - return i; - } - } - - // Should never happen - Log.w(TAG, "Failed to find a view at the provided scroll fraction (" + touchFraction + ")"); - return touchFraction * getAdapter().getItemCount(); - } else { - return getAdapter().getItemCount() * touchFraction; - } - } - - /** - * Updates the bounds for the scrollbar. - */ - public void onUpdateScrollbar() { - - if (getAdapter() == null) { - return; - } - - int rowCount = getAdapter().getItemCount(); - if (getLayoutManager() instanceof GridLayoutManager) { - int spanCount = ((GridLayoutManager) getLayoutManager()).getSpanCount(); - rowCount = (int) Math.ceil((double) rowCount / spanCount); - } - // Skip early if, there are no items. - if (rowCount == 0) { - mScrollbar.setThumbPosition(-1, -1); - return; - } - - // Skip early if, there no child laid out in the container. - getCurScrollState(mScrollPosState); - if (mScrollPosState.rowIndex < 0) { - mScrollbar.setThumbPosition(-1, -1); - return; - } - - updateThumbPosition(mScrollPosState, rowCount); - } - - /** - * Returns the current scroll state of the apps rows. - */ - private void getCurScrollState(ScrollPositionState stateOut) { - stateOut.rowIndex = -1; - stateOut.rowTopOffset = -1; - stateOut.rowHeight = -1; - - int itemCount = getAdapter().getItemCount(); - - // Return early if there are no items, or no children. - if (itemCount == 0 || getChildCount() == 0) { - return; - } - - View child = getChildAt(0); - - stateOut.rowIndex = getChildAdapterPosition(child); - if (getLayoutManager() instanceof GridLayoutManager) { - stateOut.rowIndex = stateOut.rowIndex / ((GridLayoutManager) getLayoutManager()).getSpanCount(); - } - stateOut.rowTopOffset = getLayoutManager().getDecoratedTop(child); - stateOut.rowHeight = child.getHeight() + getLayoutManager().getTopDecorationHeight(child) - + getLayoutManager().getBottomDecorationHeight(child); - } - - /** - * Calculates the total height of all views above a position in the recycler view. This method - * should only be called when the attached adapter implements {@link MeasurableAdapter}. - * - * @param adapterIndex The index in the adapter to find the total height above the - * corresponding view - * @return The total height of all views above {@code adapterIndex} in pixels - */ - @SuppressWarnings("unchecked") - private int calculateScrollDistanceToPosition(int adapterIndex) { - if (!(getAdapter() instanceof MeasurableAdapter)) { - throw new IllegalStateException("calculateScrollDistanceToPosition() should only be called where the RecyclerView.Adapter is an instance of MeasurableAdapter"); - } - - if (mScrollOffsets.indexOfKey(adapterIndex) >= 0) { - return mScrollOffsets.get(adapterIndex); - } - - int totalHeight = 0; - MeasurableAdapter measurer = (MeasurableAdapter) getAdapter(); - - // TODO Take grid layouts into account - - for (int i = 0; i < adapterIndex; i++) { - mScrollOffsets.put(i, totalHeight); - int viewType = getAdapter().getItemViewType(i); - totalHeight += measurer.getViewTypeHeight(this, findViewHolderForAdapterPosition(i), viewType); - } - - mScrollOffsets.put(adapterIndex, totalHeight); - return totalHeight; - } - - /** - * Calculates the total height of the recycler view. This method should only be called when the - * attached adapter implements {@link MeasurableAdapter}. - * - * @return The total height of all rows in the RecyclerView - */ - private int calculateAdapterHeight() { - if (!(getAdapter() instanceof MeasurableAdapter)) { - throw new IllegalStateException("calculateAdapterHeight() should only be called where the RecyclerView.Adapter is an instance of MeasurableAdapter"); - } - return calculateScrollDistanceToPosition(getAdapter().getItemCount()); - } - - public void showScrollbar() { - mScrollbar.show(); - } - - public void setThumbColor(@ColorInt int color) { - mScrollbar.setThumbColor(color); - } - - public void setTrackColor(@ColorInt int color) { - mScrollbar.setTrackColor(color); - } - - public void setPopupBgColor(@ColorInt int color) { - mScrollbar.setPopupBgColor(color); - } - - public void setPopupTextColor(@ColorInt int color) { - mScrollbar.setPopupTextColor(color); - } - - public void setPopupTextSize(int textSize) { - mScrollbar.setPopupTextSize(textSize); - } - - public void setPopUpTypeface(Typeface typeface) { - mScrollbar.setPopupTypeface(typeface); - } - - public void setAutoHideDelay(int hideDelay) { - mScrollbar.setAutoHideDelay(hideDelay); - } - - public void setAutoHideEnabled(boolean autoHideEnabled) { - mScrollbar.setAutoHideEnabled(autoHideEnabled); - } - - public void setOnFastScrollStateChangeListener(OnFastScrollStateChangeListener stateChangeListener) { - mStateChangeListener = stateChangeListener; - } - - @Deprecated - public void setStateChangeListener(OnFastScrollStateChangeListener stateChangeListener) { - setOnFastScrollStateChangeListener(stateChangeListener); - } - - public void setThumbInactiveColor(@ColorInt int color) { - mScrollbar.setThumbInactiveColor(color); - } - - public void allowThumbInactiveColor(boolean allowInactiveColor) { - mScrollbar.enableThumbInactiveColor(allowInactiveColor); - } - - @Deprecated - public void setThumbInactiveColor(boolean allowInactiveColor) { - allowThumbInactiveColor(allowInactiveColor); - } - - public void setFastScrollEnabled(boolean fastScrollEnabled) { - mFastScrollEnabled = fastScrollEnabled; - } - - @Deprecated - public void setThumbEnabled(boolean thumbEnabled) { - setFastScrollEnabled(thumbEnabled); - } - - /** - * Set the FastScroll Popup position. This is either {@link FastScroller.FastScrollerPopupPosition#ADJACENT}, - * meaning the popup moves adjacent to the FastScroll thumb, or {@link FastScroller.FastScrollerPopupPosition#CENTER}, - * meaning the popup is static and centered within the RecyclerView. - */ - public void setPopupPosition(@FastScroller.FastScrollerPopupPosition int popupPosition) { - mScrollbar.setPopupPosition(popupPosition); - } - - public interface SectionedAdapter { - @NonNull - String getSectionName(int position); - } - - /** - * FastScrollRecyclerView by default assumes that all items in a RecyclerView will have - * ItemViews with the same heights so that the total height of all views in the RecyclerView - * can be calculated. If your list uses different view heights, then make your adapter implement - * this interface. - */ - public interface MeasurableAdapter<VH extends ViewHolder> { - /** - * Gets the height of a specific view type, including item decorations - * - * @param recyclerView The recyclerView that this item view will be placed in - * @param viewHolder The viewHolder that corresponds to this item view - * @param viewType The view type to get the height of - * @return The height of a single view for the given view type in pixels - */ - int getViewTypeHeight(RecyclerView recyclerView, @Nullable VH viewHolder, int viewType); - } - - /** - * The current scroll state of the recycler view. We use this in onUpdateScrollbar() - * and scrollToPositionAtProgress() to determine the scroll position of the recycler view so - * that we can calculate what the scroll bar looks like, and where to jump to from the fast - * scroller. - */ - public static class ScrollPositionState { - // The index of the first visible row - int rowIndex; - // The offset of the first visible row - int rowTopOffset; - // The height of a given row (they are currently all the same height) - int rowHeight; - } - - private class ScrollOffsetInvalidator extends AdapterDataObserver { - private void invalidateAllScrollOffsets() { - mScrollOffsets.clear(); - } - - @Override - public void onChanged() { - invalidateAllScrollOffsets(); - } - - @Override - public void onItemRangeChanged(int positionStart, int itemCount) { - invalidateAllScrollOffsets(); - } - - @Override - public void onItemRangeChanged(int positionStart, int itemCount, Object payload) { - invalidateAllScrollOffsets(); - } - - @Override - public void onItemRangeInserted(int positionStart, int itemCount) { - invalidateAllScrollOffsets(); - } - - @Override - public void onItemRangeRemoved(int positionStart, int itemCount) { - invalidateAllScrollOffsets(); - } - - @Override - public void onItemRangeMoved(int fromPosition, int toPosition, int itemCount) { - invalidateAllScrollOffsets(); - } - } -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/util/ui/fastscroll/views/FastScroller.java b/app/src/main/java/de/kuschku/quasseldroid/util/ui/fastscroll/views/FastScroller.java deleted file mode 100644 index 16ea796eaf434a85aae67b652fe871a1cc0696ca..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/util/ui/fastscroll/views/FastScroller.java +++ /dev/null @@ -1,421 +0,0 @@ -/* - * Copyright (c) 2016 Tim Malseed - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package de.kuschku.quasseldroid.util.ui.fastscroll.views; - -import android.animation.Animator; -import android.animation.AnimatorListenerAdapter; -import android.animation.ObjectAnimator; -import android.content.Context; -import android.content.res.Resources; -import android.content.res.TypedArray; -import android.graphics.Canvas; -import android.graphics.Paint; -import android.graphics.Point; -import android.graphics.Rect; -import android.graphics.Typeface; -import android.util.AttributeSet; -import android.view.MotionEvent; -import android.view.ViewConfiguration; - -import androidx.annotation.ColorInt; -import androidx.annotation.IntDef; -import androidx.annotation.Keep; -import androidx.interpolator.view.animation.FastOutLinearInInterpolator; -import androidx.interpolator.view.animation.LinearOutSlowInInterpolator; -import androidx.recyclerview.widget.RecyclerView; - -import java.lang.annotation.Retention; - -import de.kuschku.quasseldroid.R; -import de.kuschku.quasseldroid.util.ui.fastscroll.interfaces.OnFastScrollStateChangeListener; -import de.kuschku.quasseldroid.util.ui.fastscroll.utils.Utils; - -import static java.lang.annotation.RetentionPolicy.SOURCE; - -public class FastScroller { - private static final int DEFAULT_AUTO_HIDE_DELAY = 1500; - private final Runnable mHideRunnable; - private FastScrollRecyclerView mRecyclerView; - private FastScrollPopup mPopup; - private int mThumbHeight; - private int mWidth; - private Paint mThumb; - private Paint mTrack; - private Rect mTmpRect = new Rect(); - private Rect mInvalidateRect = new Rect(); - private Rect mInvalidateTmpRect = new Rect(); - // The inset is the bufferId around which a point will still register as a click on the scrollbar - private int mTouchInset; - // This is the offset from the top of the scrollbar when the user first starts touching. To - // prevent jumping, this offset is applied as the user scrolls. - private int mTouchOffset; - private Point mThumbPosition = new Point(-1, -1); - private Point mOffset = new Point(0, 0); - private boolean mIsDragging; - private Animator mAutoHideAnimator; - private boolean mAnimatingShow; - private int mAutoHideDelay = DEFAULT_AUTO_HIDE_DELAY; - private boolean mAutoHideEnabled = true; - private int mThumbActiveColor; - private int mThumbInactiveColor = 0x79000000; - private boolean mThumbInactiveState; - - public FastScroller(Context context, FastScrollRecyclerView recyclerView, AttributeSet attrs) { - - Resources resources = context.getResources(); - - mRecyclerView = recyclerView; - mPopup = new FastScrollPopup(resources, recyclerView); - - mThumbHeight = Utils.toPixels(resources, 48); - mWidth = Utils.toPixels(resources, 8); - - mTouchInset = Utils.toPixels(resources, -24); - - mThumb = new Paint(Paint.ANTI_ALIAS_FLAG); - mTrack = new Paint(Paint.ANTI_ALIAS_FLAG); - - TypedArray typedArray = context.getTheme().obtainStyledAttributes( - attrs, R.styleable.FastScrollRecyclerView, 0, 0); - try { - mAutoHideEnabled = typedArray.getBoolean(R.styleable.FastScrollRecyclerView_fastScrollAutoHide, true); - mAutoHideDelay = typedArray.getInteger(R.styleable.FastScrollRecyclerView_fastScrollAutoHideDelay, DEFAULT_AUTO_HIDE_DELAY); - mThumbInactiveState = typedArray.getBoolean(R.styleable.FastScrollRecyclerView_fastScrollEnableThumbInactiveColor, true); - mThumbActiveColor = typedArray.getColor(R.styleable.FastScrollRecyclerView_fastScrollThumbColor, 0x79000000); - mThumbInactiveColor = typedArray.getColor(R.styleable.FastScrollRecyclerView_fastScrollThumbInactiveColor, 0x79000000); - - int trackColor = typedArray.getColor(R.styleable.FastScrollRecyclerView_fastScrollTrackColor, 0x28000000); - int popupBgColor = typedArray.getColor(R.styleable.FastScrollRecyclerView_fastScrollPopupBgColor, 0xff000000); - int popupTextColor = typedArray.getColor(R.styleable.FastScrollRecyclerView_fastScrollPopupTextColor, 0xffffffff); - int popupTextSize = typedArray.getDimensionPixelSize(R.styleable.FastScrollRecyclerView_fastScrollPopupTextSize, Utils.toScreenPixels(resources, 44)); - int popupBackgroundSize = typedArray.getDimensionPixelSize(R.styleable.FastScrollRecyclerView_fastScrollPopupBackgroundSize, Utils.toPixels(resources, 88)); - @FastScrollerPopupPosition int popupPosition = typedArray.getInteger(R.styleable.FastScrollRecyclerView_fastScrollPopupPosition, FastScrollerPopupPosition.ADJACENT); - - mTrack.setColor(trackColor); - mThumb.setColor(mThumbInactiveState ? mThumbInactiveColor : mThumbActiveColor); - mPopup.setBgColor(popupBgColor); - mPopup.setTextColor(popupTextColor); - mPopup.setTextSize(popupTextSize); - mPopup.setBackgroundSize(popupBackgroundSize); - mPopup.setPopupPosition(popupPosition); - } finally { - typedArray.recycle(); - } - - mHideRunnable = new Runnable() { - @Override - public void run() { - if (!mIsDragging) { - if (mAutoHideAnimator != null) { - mAutoHideAnimator.cancel(); - } - mAutoHideAnimator = ObjectAnimator.ofInt(FastScroller.this, "offsetX", (Utils.isRtl(mRecyclerView.getResources()) ? -1 : 1) * mWidth); - mAutoHideAnimator.setInterpolator(new FastOutLinearInInterpolator()); - mAutoHideAnimator.setDuration(200); - mAutoHideAnimator.start(); - } - } - }; - - mRecyclerView.addOnScrollListener(new RecyclerView.OnScrollListener() { - @Override - public void onScrolled(RecyclerView recyclerView, int dx, int dy) { - super.onScrolled(recyclerView, dx, dy); - - if (!mRecyclerView.isInEditMode()) { - show(); - } - } - }); - - if (mAutoHideEnabled) { - postAutoHideDelayed(); - } - } - - public int getThumbHeight() { - return mThumbHeight; - } - - public int getWidth() { - return mWidth; - } - - public boolean isDragging() { - return mIsDragging; - } - - /** - * Handles the touch event and determines whether to show the fast scroller (or updates it if - * it is already showing). - */ - public void handleTouchEvent(MotionEvent ev, int downX, int downY, int lastY, - OnFastScrollStateChangeListener stateChangeListener) { - ViewConfiguration config = ViewConfiguration.get(mRecyclerView.getContext()); - - int action = ev.getAction(); - int y = (int) ev.getY(); - switch (action) { - case MotionEvent.ACTION_DOWN: - if (isNearPoint(downX, downY)) { - mTouchOffset = downY - mThumbPosition.y; - } - break; - case MotionEvent.ACTION_MOVE: - // Check if we should start scrolling - if (!mIsDragging && isNearPoint(downX, downY) && - Math.abs(y - downY) > config.getScaledTouchSlop()) { - mRecyclerView.getParent().requestDisallowInterceptTouchEvent(true); - mIsDragging = true; - mTouchOffset += (lastY - downY); - mPopup.animateVisibility(true); - if (stateChangeListener != null) { - stateChangeListener.onFastScrollStart(); - } - if (mThumbInactiveState) { - mThumb.setColor(mThumbActiveColor); - } - } - if (mIsDragging) { - // Update the fastscroller section name at this touch position - int top = 0; - int bottom = mRecyclerView.getHeight() - mThumbHeight; - float boundedY = (float) Math.max(top, Math.min(bottom, y - mTouchOffset)); - String sectionName = mRecyclerView.scrollToPositionAtProgress((boundedY - top) / (bottom - top)); - mPopup.setSectionName(sectionName); - mPopup.animateVisibility(!sectionName.isEmpty()); - mRecyclerView.invalidate(mPopup.updateFastScrollerBounds(mRecyclerView, mThumbPosition.y)); - } - break; - case MotionEvent.ACTION_UP: - case MotionEvent.ACTION_CANCEL: - mTouchOffset = 0; - if (mIsDragging) { - mIsDragging = false; - mPopup.animateVisibility(false); - if (stateChangeListener != null) { - stateChangeListener.onFastScrollStop(); - } - } - if (mThumbInactiveState) { - mThumb.setColor(mThumbInactiveColor); - } - break; - } - } - - public void draw(Canvas canvas) { - - if (mThumbPosition.x < 0 || mThumbPosition.y < 0) { - return; - } - - //Background - canvas.drawRect( - mThumbPosition.x + mOffset.x, - mOffset.y, - mWidth + mThumbPosition.x + mOffset.x, - mRecyclerView.getHeight() + mOffset.y, - mTrack - ); - - //Handle - canvas.drawRect( - mThumbPosition.x + mOffset.x, - mThumbPosition.y + mOffset.y, - mWidth + mThumbPosition.x + mOffset.x, - mThumbHeight + mThumbPosition.y + mOffset.y, - mThumb - ); - - //Popup - mPopup.draw(canvas); - } - - /** - * Returns whether the specified points are near the scroll bar bounds. - */ - private boolean isNearPoint(int x, int y) { - mTmpRect.set(mThumbPosition.x, mThumbPosition.y, mThumbPosition.x + mWidth, - mThumbPosition.y + mThumbHeight); - mTmpRect.inset(mTouchInset, mTouchInset); - return mTmpRect.contains(x, y); - } - - public void setThumbPosition(int x, int y) { - if (mThumbPosition.x == x && mThumbPosition.y == y) { - return; - } - // do not create new objects here, this is called quite often - mInvalidateRect.set(mRecyclerView.getPaddingLeft() + mThumbPosition.x + mOffset.x, mRecyclerView.getPaddingTop() + mOffset.y, mThumbPosition.x + mOffset.x + mWidth - mRecyclerView.getPaddingRight(), mRecyclerView.getPaddingTop() + mRecyclerView.getHeight() - mRecyclerView.getPaddingBottom() + mOffset.y); - int totalWidth = mRecyclerView.getWidth() + mRecyclerView.getPaddingLeft(); - int totalHeight = mRecyclerView.getHeight() + mRecyclerView.getPaddingTop(); - - int dx; - if (totalWidth == 0) { - dx = 0; - } else { - dx = x * (mRecyclerView.getWidth() - mRecyclerView.getPaddingLeft() - mRecyclerView.getPaddingLeft()) / totalWidth; - } - - int dy; - if (totalHeight == 0) { - dy = 0; - } else { - dy = y * (mRecyclerView.getHeight() - mRecyclerView.getPaddingTop() - mRecyclerView.getPaddingBottom()) / totalHeight; - } - mThumbPosition.set(dx, dy); - mInvalidateTmpRect.set(mRecyclerView.getPaddingLeft() + mThumbPosition.x + mOffset.x, mRecyclerView.getPaddingTop() + mOffset.y, mThumbPosition.x + mOffset.x + mWidth - mRecyclerView.getPaddingRight(), mRecyclerView.getPaddingTop() + mRecyclerView.getHeight() - mRecyclerView.getPaddingBottom() + mOffset.y); - mInvalidateRect.union(mInvalidateTmpRect); - mRecyclerView.invalidate(mInvalidateRect); - } - - public void setOffset(int x, int y) { - if (mOffset.x == x && mOffset.y == y) { - return; - } - // do not create new objects here, this is called quite often - mInvalidateRect.set(mRecyclerView.getPaddingLeft() + mThumbPosition.x + mOffset.x, mRecyclerView.getPaddingTop() + mOffset.y, mThumbPosition.x + mOffset.x + mWidth - mRecyclerView.getPaddingRight(), mRecyclerView.getPaddingTop() + mRecyclerView.getHeight() - mRecyclerView.getPaddingBottom() + mOffset.y); - mOffset.set(x, y); - mInvalidateTmpRect.set(mRecyclerView.getPaddingLeft() + mThumbPosition.x + mOffset.x, mRecyclerView.getPaddingTop() + mOffset.y, mThumbPosition.x + mOffset.x + mWidth - mRecyclerView.getPaddingRight(), mRecyclerView.getPaddingTop() + mRecyclerView.getHeight() - mRecyclerView.getPaddingBottom() + mOffset.y); - mInvalidateRect.union(mInvalidateTmpRect); - mRecyclerView.invalidate(mInvalidateRect); - } - - @Keep - public int getOffsetX() { - return mOffset.x; - } - - // Setter/getter for the popup alpha for animations - @Keep - public void setOffsetX(int x) { - setOffset(x, mOffset.y); - } - - public void show() { - if (!mAnimatingShow) { - if (mAutoHideAnimator != null) { - mAutoHideAnimator.cancel(); - } - mAutoHideAnimator = ObjectAnimator.ofInt(this, "offsetX", 0); - mAutoHideAnimator.setInterpolator(new LinearOutSlowInInterpolator()); - mAutoHideAnimator.setDuration(150); - mAutoHideAnimator.addListener(new AnimatorListenerAdapter() { - @Override - public void onAnimationCancel(Animator animation) { - super.onAnimationCancel(animation); - mAnimatingShow = false; - } - - @Override - public void onAnimationEnd(Animator animation) { - super.onAnimationEnd(animation); - mAnimatingShow = false; - } - }); - mAnimatingShow = true; - mAutoHideAnimator.start(); - } - if (mAutoHideEnabled) { - postAutoHideDelayed(); - } else { - cancelAutoHide(); - } - } - - protected void postAutoHideDelayed() { - if (mRecyclerView != null) { - cancelAutoHide(); - mRecyclerView.postDelayed(mHideRunnable, mAutoHideDelay); - } - } - - protected void cancelAutoHide() { - if (mRecyclerView != null) { - mRecyclerView.removeCallbacks(mHideRunnable); - } - } - - public void setThumbColor(@ColorInt int color) { - mThumb.setColor(color); - mRecyclerView.invalidate(mInvalidateRect); - } - - public void setTrackColor(@ColorInt int color) { - mTrack.setColor(color); - mRecyclerView.invalidate(mInvalidateRect); - } - - public void setPopupBgColor(@ColorInt int color) { - mPopup.setBgColor(color); - } - - public void setPopupTextColor(@ColorInt int color) { - mPopup.setTextColor(color); - } - - public void setPopupTypeface(Typeface typeface) { - mPopup.setTypeface(typeface); - } - - public void setPopupTextSize(int size) { - mPopup.setTextSize(size); - } - - public void setAutoHideDelay(int hideDelay) { - mAutoHideDelay = hideDelay; - if (mAutoHideEnabled) { - postAutoHideDelayed(); - } - } - - public void setAutoHideEnabled(boolean autoHideEnabled) { - mAutoHideEnabled = autoHideEnabled; - if (autoHideEnabled) { - postAutoHideDelayed(); - } else { - cancelAutoHide(); - } - } - - public void setPopupPosition(@FastScrollerPopupPosition int popupPosition) { - mPopup.setPopupPosition(popupPosition); - } - - public void setThumbInactiveColor(@ColorInt int color) { - mThumbInactiveColor = color; - enableThumbInactiveColor(true); - } - - public void enableThumbInactiveColor(boolean enableInactiveColor) { - mThumbInactiveState = enableInactiveColor; - mThumb.setColor(mThumbInactiveState ? mThumbInactiveColor : mThumbActiveColor); - } - - @Deprecated - public void setThumbInactiveColor(boolean thumbInactiveColor) { - enableThumbInactiveColor(thumbInactiveColor); - } - - @Retention(SOURCE) - @IntDef({FastScrollerPopupPosition.ADJACENT, FastScrollerPopupPosition.CENTER}) - public @interface FastScrollerPopupPosition { - int ADJACENT = 0; - int CENTER = 1; - } -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/util/ui/presenter/BufferContextPresenter.kt b/app/src/main/java/de/kuschku/quasseldroid/util/ui/presenter/BufferContextPresenter.kt deleted file mode 100644 index cb69524c0cf561c888c905b94f1fa220f7c858d8..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/util/ui/presenter/BufferContextPresenter.kt +++ /dev/null @@ -1,224 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.util.ui.presenter - -import android.content.Context -import android.view.ActionMode -import android.view.MenuItem -import com.afollestad.materialdialogs.MaterialDialog -import de.kuschku.libquassel.protocol.Buffer_Type -import de.kuschku.libquassel.quassel.BufferInfo -import de.kuschku.libquassel.quassel.syncables.BufferSyncer -import de.kuschku.libquassel.quassel.syncables.BufferViewConfig -import de.kuschku.libquassel.quassel.syncables.Network -import de.kuschku.libquassel.quassel.syncables.interfaces.INetwork -import de.kuschku.libquassel.session.ISession -import de.kuschku.quasseldroid.R -import de.kuschku.quasseldroid.ui.coresettings.network.NetworkEditActivity -import de.kuschku.quasseldroid.ui.info.channellist.ChannelListActivity -import de.kuschku.quasseldroid.viewmodel.data.BufferHiddenState -import de.kuschku.quasseldroid.viewmodel.data.SelectedBufferItem - -object BufferContextPresenter { - fun present(actionMode: ActionMode, buffer: SelectedBufferItem?) { - if (buffer != null) { - val menu = actionMode.menu - if (menu != null) { - val allActions = setOf( - R.id.action_channellist, - R.id.action_configure, - R.id.action_connect, - R.id.action_disconnect, - R.id.action_join, - R.id.action_part, - R.id.action_delete, - R.id.action_rename, - R.id.action_unhide, - R.id.action_archive - ) - - val visibilityActions = when (buffer.hiddenState) { - BufferHiddenState.VISIBLE -> setOf( - R.id.action_archive - ) - BufferHiddenState.HIDDEN_TEMPORARY -> setOf( - R.id.action_unhide - ) - BufferHiddenState.HIDDEN_PERMANENT -> setOf( - R.id.action_unhide - ) - } - - val availableActions = when (buffer.info?.type?.enabledValues()?.firstOrNull()) { - Buffer_Type.StatusBuffer -> { - when (buffer.connectionState) { - INetwork.ConnectionState.Disconnected -> setOf( - R.id.action_configure, R.id.action_connect - ) - INetwork.ConnectionState.Initialized -> setOf( - R.id.action_channellist, R.id.action_configure, R.id.action_disconnect - ) - else -> setOf( - R.id.action_configure, R.id.action_connect, R.id.action_disconnect - ) - } - } - Buffer_Type.ChannelBuffer -> { - if (buffer.joined) { - setOf(R.id.action_part) - } else { - setOf(R.id.action_join, R.id.action_delete) - } + visibilityActions - } - Buffer_Type.QueryBuffer -> { - setOf(R.id.action_delete, R.id.action_rename) + visibilityActions - } - else -> visibilityActions - } - - val unavailableActions = allActions - availableActions - - for (action in availableActions) { - menu.findItem(action)?.isVisible = true - } - for (action in unavailableActions) { - menu.findItem(action)?.isVisible = false - } - } - } else { - actionMode.finish() - } - } - - fun handleAction( - context: Context, - actionMode: ActionMode, - item: MenuItem, - info: BufferInfo, - session: ISession, - bufferSyncer: BufferSyncer, - bufferViewConfig: BufferViewConfig?, - network: Network? - ) = when (item.itemId) { - R.id.action_channellist -> { - network?.let { - ChannelListActivity.launch(context, network = it.networkId()) - } - actionMode.finish() - true - } - R.id.action_configure -> { - network?.let { - NetworkEditActivity.launch(context, network = it.networkId()) - } - actionMode.finish() - true - } - R.id.action_connect -> { - network?.requestConnect() - actionMode.finish() - true - } - R.id.action_disconnect -> { - network?.requestDisconnect() - actionMode.finish() - true - } - R.id.action_join -> { - session.rpcHandler.sendInput(info, "/join ${info.bufferName}") - actionMode.finish() - true - } - R.id.action_part -> { - session.rpcHandler.sendInput(info, "/part ${info.bufferName}") - actionMode.finish() - true - } - R.id.action_delete -> { - MaterialDialog.Builder(context) - .content(R.string.buffer_delete_confirmation) - .positiveText(R.string.label_yes) - .negativeText(R.string.label_no) - .negativeColorAttr(R.attr.colorTextPrimary) - .backgroundColorAttr(R.attr.colorBackgroundCard) - .contentColorAttr(R.attr.colorTextPrimary) - .onPositive { _, _ -> - session.bufferSyncer.requestRemoveBuffer(info.bufferId) - } - .onAny { _, _ -> - actionMode.finish() - } - .build() - .show() - true - } - R.id.action_rename -> { - MaterialDialog.Builder(context) - .input( - context.getString(R.string.label_buffer_name), - info.bufferName, - false - ) { _, input -> - session.bufferSyncer.requestRenameBuffer(info.bufferId, input.toString()) - } - .positiveText(R.string.label_save) - .negativeText(R.string.label_cancel) - .negativeColorAttr(R.attr.colorTextPrimary) - .backgroundColorAttr(R.attr.colorBackgroundCard) - .contentColorAttr(R.attr.colorTextPrimary) - .onAny { _, _ -> - actionMode.finish() - } - .build() - .show() - true - } - R.id.action_unhide -> { - bufferViewConfig?.insertBufferSorted(info, bufferSyncer) - actionMode.finish() - true - } - R.id.action_archive -> { - MaterialDialog.Builder(context) - .title(R.string.label_archive_chat) - .content(R.string.buffer_archive_confirmation) - .checkBoxPromptRes(R.string.buffer_archive_temporarily, true, null) - .positiveText(R.string.label_archive) - .negativeText(R.string.label_cancel) - .negativeColorAttr(R.attr.colorTextPrimary) - .backgroundColorAttr(R.attr.colorBackgroundCard) - .contentColorAttr(R.attr.colorTextPrimary) - .onAny { _, _ -> - actionMode.finish() - } - .onPositive { dialog, _ -> - if (dialog.isPromptCheckBoxChecked) { - bufferViewConfig?.requestRemoveBuffer(info.bufferId) - } else { - bufferViewConfig?.requestRemoveBufferPermanently(info.bufferId) - } - } - .build() - .show() - true - } - else -> false - } -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/util/ui/presenter/BufferPresenter.kt b/app/src/main/java/de/kuschku/quasseldroid/util/ui/presenter/BufferPresenter.kt deleted file mode 100644 index 0bfa57680544344c92205afa0774f31a21092074..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/util/ui/presenter/BufferPresenter.kt +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.util.ui.presenter - -import de.kuschku.libquassel.protocol.Buffer_Type -import de.kuschku.libquassel.util.flag.hasFlag -import de.kuschku.quasseldroid.settings.AppearanceSettings -import de.kuschku.quasseldroid.settings.MessageSettings -import de.kuschku.quasseldroid.util.ColorContext -import de.kuschku.quasseldroid.util.avatars.AvatarHelper -import de.kuschku.quasseldroid.util.irc.format.ContentFormatter -import de.kuschku.quasseldroid.util.irc.format.IrcFormatDeserializer -import de.kuschku.quasseldroid.viewmodel.data.BufferListItem -import de.kuschku.quasseldroid.viewmodel.data.BufferProps -import de.kuschku.quasseldroid.viewmodel.data.BufferStatus -import javax.inject.Inject - -class BufferPresenter @Inject constructor( - val appearanceSettings: AppearanceSettings, - val messageSettings: MessageSettings, - val ircFormatDeserializer: IrcFormatDeserializer, - val contentFormatter: ContentFormatter, - val colorContext: ColorContext -) { - fun render(props: BufferProps): BufferProps { - return props.copy( - name = when { - props.info.type.hasFlag(Buffer_Type.QueryBuffer) -> - ircFormatDeserializer.formatString(props.info.bufferName, messageSettings.colorizeMirc) - props.info.type.hasFlag(Buffer_Type.StatusBuffer) -> - props.network.networkName - else -> - props.info.bufferName ?: "" - }, - description = ircFormatDeserializer.formatString( - props.description.toString(), - colorize = messageSettings.colorizeMirc - ), - fallbackDrawable = if (props.info.type.hasFlag(Buffer_Type.QueryBuffer)) { - props.ircUser?.let { - val nickName = it.nick() - val useSelfColor = when (messageSettings.colorizeNicknames) { - MessageSettings.SenderColorMode.ALL -> false - MessageSettings.SenderColorMode.ALL_BUT_MINE -> - props.ircUser?.network()?.isMyNick(nickName) == true - MessageSettings.SenderColorMode.NONE -> true - } - - colorContext.buildTextDrawable(it.nick(), useSelfColor) - } ?: colorContext.buildTextDrawable("", colorContext.colorAway) - } else { - val color = if (props.bufferStatus == BufferStatus.ONLINE) colorContext.colorAccent - else colorContext.colorAway - - colorContext.buildTextDrawable("#", color) - }, - avatarUrls = props.ircUser?.let { - AvatarHelper.avatar(messageSettings, it, colorContext.avatarSize) - } ?: emptyList() - ) - } - - fun render(buffers: List<BufferListItem>) = - buffers.map { - it.copy(props = render(it.props)) - } -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/util/ui/settings/ActivityLauncher.kt b/app/src/main/java/de/kuschku/quasseldroid/util/ui/settings/ActivityLauncher.kt deleted file mode 100644 index eef145fb9b2e75b52e767d5d34182531d3488a96..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/util/ui/settings/ActivityLauncher.kt +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.util.ui.settings - -import android.content.Intent - -interface ActivityLauncher { - fun startActivityForResult(intent: Intent, requestCode: Int) - fun registerOnActivityResultListener(listener: OnActivityResultListener) - fun unregisterOnActivityResultListener(listener: OnActivityResultListener) - fun getNextRequestCode(): Int -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/util/ui/settings/AttachingPreferenceFragmentCompat.kt b/app/src/main/java/de/kuschku/quasseldroid/util/ui/settings/AttachingPreferenceFragmentCompat.kt deleted file mode 100644 index 006b94a9741e92b7371adebda65dc4fc1ebc8f2f..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/util/ui/settings/AttachingPreferenceFragmentCompat.kt +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.util.ui.settings - -import android.content.Intent -import android.os.Bundle -import androidx.preference.Preference -import androidx.preference.PreferenceCategory -import androidx.preference.PreferenceFragmentCompat -import androidx.preference.PreferenceScreen -import de.kuschku.quasseldroid.util.helper.preferences -import java.util.concurrent.atomic.AtomicInteger - -abstract class AttachingPreferenceFragmentCompat : PreferenceFragmentCompat(), ActivityLauncher { - private val nextRequestCode = AtomicInteger(0) - - private var activityResultListeners = emptySet<OnActivityResultListener>() - - override fun registerOnActivityResultListener(listener: OnActivityResultListener) { - activityResultListeners += listener - } - - override fun unregisterOnActivityResultListener(listener: OnActivityResultListener) { - activityResultListeners -= listener - } - - override fun getNextRequestCode() = nextRequestCode.getAndIncrement() - - override fun onCreate(savedInstanceState: Bundle?) { - super.onCreate(savedInstanceState) - attachPreference(preferenceScreen) - } - - private fun attachPreference(preference: Preference) { - when (preference) { - is PreferenceScreen -> preference.preferences().forEach(::attachPreference) - is PreferenceCategory -> preference.preferences().forEach(::attachPreference) - is RequiresActivityLauncher -> preference.activityLauncher = this - } - } - - override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) { - for (it in activityResultListeners) { - it.onActivityResult(requestCode, resultCode, data) - } - } -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/util/ui/settings/DaggerPreferenceFragmentCompat.kt b/app/src/main/java/de/kuschku/quasseldroid/util/ui/settings/DaggerPreferenceFragmentCompat.kt deleted file mode 100644 index a9ea8543e19616de6165080d857bd679855d9432..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/util/ui/settings/DaggerPreferenceFragmentCompat.kt +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.util.ui.settings - -import android.content.Context -import dagger.android.AndroidInjector -import dagger.android.DispatchingAndroidInjector -import dagger.android.HasAndroidInjector -import dagger.android.support.AndroidSupportInjection -import javax.inject.Inject - -abstract class DaggerPreferenceFragmentCompat : AttachingPreferenceFragmentCompat(), - HasAndroidInjector { - @Inject - lateinit var androidInjector: DispatchingAndroidInjector<Any> - - override fun onAttach(context: Context) { - AndroidSupportInjection.inject(this) - super.onAttach(context) - } - - override fun androidInjector(): AndroidInjector<Any> { - return androidInjector - } -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/util/ui/settings/ListPreferenceDialogFragmentCompat.java b/app/src/main/java/de/kuschku/quasseldroid/util/ui/settings/ListPreferenceDialogFragmentCompat.java deleted file mode 100644 index f4a585581a7426ef0a3c5fecf381718b113ef6a5..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/util/ui/settings/ListPreferenceDialogFragmentCompat.java +++ /dev/null @@ -1,137 +0,0 @@ -/* - * Copyright (C) 2015 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License - */ - -package de.kuschku.quasseldroid.util.ui.settings; - -import android.os.Bundle; -import android.view.View; - -import androidx.annotation.NonNull; -import androidx.preference.ListPreference; - -import com.afollestad.materialdialogs.DialogAction; -import com.afollestad.materialdialogs.MaterialDialog; - -import java.util.ArrayList; - -public class ListPreferenceDialogFragmentCompat extends PreferenceDialogFragmentCompat { - - private static final String SAVE_STATE_INDEX = "ListPreferenceDialogFragment.index"; - private static final String SAVE_STATE_ENTRIES = "ListPreferenceDialogFragment.entries"; - private static final String SAVE_STATE_ENTRY_VALUES = - "ListPreferenceDialogFragment.entryValues"; - - private int mClickedDialogEntryIndex; - private CharSequence[] mEntries; - private CharSequence[] mEntryValues; - - public static ListPreferenceDialogFragmentCompat newInstance(String key) { - final ListPreferenceDialogFragmentCompat fragment = - new ListPreferenceDialogFragmentCompat(); - final Bundle b = new Bundle(1); - b.putString(ARG_KEY, key); - fragment.setArguments(b); - return fragment; - } - - private static void putCharSequenceArray(Bundle out, String key, CharSequence[] entries) { - final ArrayList<String> stored = new ArrayList<>(entries.length); - - for (final CharSequence cs : entries) { - stored.add(cs.toString()); - } - - out.putStringArrayList(key, stored); - } - - private static CharSequence[] getCharSequenceArray(Bundle in, String key) { - final ArrayList<String> stored = in.getStringArrayList(key); - - return stored == null ? null : stored.toArray(new CharSequence[stored.size()]); - } - - @Override - public void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - if (savedInstanceState == null) { - final ListPreference preference = getListPreference(); - - if (preference.getEntries() == null || preference.getEntryValues() == null) { - throw new IllegalStateException( - "ListPreference requires an entries array and an entryValues array."); - } - - mClickedDialogEntryIndex = preference.findIndexOfValue(preference.getValue()); - mEntries = preference.getEntries(); - mEntryValues = preference.getEntryValues(); - } else { - mClickedDialogEntryIndex = savedInstanceState.getInt(SAVE_STATE_INDEX, 0); - mEntries = getCharSequenceArray(savedInstanceState, SAVE_STATE_ENTRIES); - mEntryValues = getCharSequenceArray(savedInstanceState, SAVE_STATE_ENTRY_VALUES); - } - } - - @Override - public void onSaveInstanceState(@NonNull Bundle outState) { - super.onSaveInstanceState(outState); - outState.putInt(SAVE_STATE_INDEX, mClickedDialogEntryIndex); - putCharSequenceArray(outState, SAVE_STATE_ENTRIES, mEntries); - putCharSequenceArray(outState, SAVE_STATE_ENTRY_VALUES, mEntryValues); - } - - private ListPreference getListPreference() { - return (ListPreference) getPreference(); - } - - @Override - protected void onPrepareDialogBuilder(MaterialDialog.Builder builder) { - super.onPrepareDialogBuilder(builder); - - builder.items(mEntries).itemsCallbackSingleChoice(mClickedDialogEntryIndex, new MaterialDialog.ListCallbackSingleChoice() { - @Override - public boolean onSelection(MaterialDialog dialog, View itemView, int which, CharSequence text) { - mClickedDialogEntryIndex = which; - - /* - * Clicking on an item simulates the positive button - * click, and dismisses the dialog. - */ - ListPreferenceDialogFragmentCompat.this.onClick(dialog, DialogAction.POSITIVE); - dialog.dismiss(); - return true; - } - }); - - /* - * The typical interaction for list-based dialogs is to have - * click-on-an-item dismiss the dialog instead of the user having to - * press 'Ok'. - */ - builder.positiveText(null); - } - - @Override - public void onDialogClosed(boolean positiveResult) { - final ListPreference preference = getListPreference(); - if (positiveResult && mClickedDialogEntryIndex >= 0) { - String value = mEntryValues[mClickedDialogEntryIndex].toString(); - if (preference.callChangeListener(value)) { - preference.setValue(value); - } - } - } - -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/util/ui/settings/OnActivityResultListener.kt b/app/src/main/java/de/kuschku/quasseldroid/util/ui/settings/OnActivityResultListener.kt deleted file mode 100644 index db5ed8eff8b65c07881cae0838034b73c248687c..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/util/ui/settings/OnActivityResultListener.kt +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.util.ui.settings - -import android.content.Intent - -interface OnActivityResultListener { - /** - * See Activity's onActivityResult. - * - * @return Whether the request code was handled (in which case - * subsequent listeners will not be called. - */ - fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?): Boolean -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/util/ui/settings/PreferenceDialogFragmentCompat.java b/app/src/main/java/de/kuschku/quasseldroid/util/ui/settings/PreferenceDialogFragmentCompat.java deleted file mode 100644 index 33678e3214ed5278b69e95f98f608e01d954a3ab..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/util/ui/settings/PreferenceDialogFragmentCompat.java +++ /dev/null @@ -1,280 +0,0 @@ -/* - * Copyright (C) 2015 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License - */ - -package de.kuschku.quasseldroid.util.ui.settings; - -import android.app.Dialog; -import android.content.Context; -import android.content.DialogInterface; -import android.graphics.Bitmap; -import android.graphics.Canvas; -import android.graphics.drawable.BitmapDrawable; -import android.graphics.drawable.Drawable; -import android.os.Bundle; -import android.text.TextUtils; -import android.view.LayoutInflater; -import android.view.View; -import android.view.Window; -import android.view.WindowManager; -import android.widget.TextView; - -import androidx.annotation.LayoutRes; -import androidx.annotation.NonNull; -import androidx.appcompat.app.AlertDialog; -import androidx.fragment.app.DialogFragment; -import androidx.fragment.app.Fragment; -import androidx.preference.DialogPreference; -import androidx.preference.PreferenceFragmentCompat; - -import com.afollestad.materialdialogs.DialogAction; -import com.afollestad.materialdialogs.MaterialDialog; - -import de.kuschku.quasseldroid.R; - -/** - * Abstract base class which presents a dialog associated with a - * {@link androidx.fragment.app.DialogFragment}. Since the preference object may - * not be available during fragment re-creation, the necessary information for displaying the dialog - * is read once during the initial call to {@link #onCreate(Bundle)} and saved/restored in the saved - * instance state. Custom subclasses should also follow this pattern. - */ -public abstract class PreferenceDialogFragmentCompat extends DialogFragment implements MaterialDialog.SingleButtonCallback { - - protected static final String ARG_KEY = "key"; - - private static final String SAVE_STATE_TITLE = "PreferenceDialogFragment.title"; - private static final String SAVE_STATE_POSITIVE_TEXT = "PreferenceDialogFragment.positiveText"; - private static final String SAVE_STATE_NEGATIVE_TEXT = "PreferenceDialogFragment.negativeText"; - private static final String SAVE_STATE_MESSAGE = "PreferenceDialogFragment.message"; - private static final String SAVE_STATE_LAYOUT = "PreferenceDialogFragment.layout"; - private static final String SAVE_STATE_ICON = "PreferenceDialogFragment.icon"; - - private DialogPreference mPreference; - - private CharSequence mDialogTitle; - private CharSequence mPositiveButtonText; - private CharSequence mNegativeButtonText; - private CharSequence mDialogMessage; - private @LayoutRes - int mDialogLayoutRes; - - private BitmapDrawable mDialogIcon; - - /** - * Which button was clicked. - */ - private DialogAction mWhichButtonClicked; - - @Override - public void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - - final Fragment rawFragment = getTargetFragment(); - if (!(rawFragment instanceof DialogPreference.TargetFragment)) { - throw new IllegalStateException("Target fragment must implement TargetFragment" + - " interface"); - } - - final DialogPreference.TargetFragment fragment = - (DialogPreference.TargetFragment) rawFragment; - - final String key = getArguments().getString(ARG_KEY); - if (savedInstanceState == null) { - mPreference = (DialogPreference) fragment.findPreference(key); - mDialogTitle = mPreference.getDialogTitle(); - mPositiveButtonText = mPreference.getPositiveButtonText(); - mNegativeButtonText = mPreference.getNegativeButtonText(); - mDialogMessage = mPreference.getDialogMessage(); - mDialogLayoutRes = mPreference.getDialogLayoutResource(); - - final Drawable icon = mPreference.getDialogIcon(); - if (icon == null || icon instanceof BitmapDrawable) { - mDialogIcon = (BitmapDrawable) icon; - } else { - final Bitmap bitmap = Bitmap.createBitmap(icon.getIntrinsicWidth(), - icon.getIntrinsicHeight(), Bitmap.Config.ARGB_8888); - final Canvas canvas = new Canvas(bitmap); - icon.setBounds(0, 0, canvas.getWidth(), canvas.getHeight()); - icon.draw(canvas); - mDialogIcon = new BitmapDrawable(getResources(), bitmap); - } - } else { - mDialogTitle = savedInstanceState.getCharSequence(SAVE_STATE_TITLE); - mPositiveButtonText = savedInstanceState.getCharSequence(SAVE_STATE_POSITIVE_TEXT); - mNegativeButtonText = savedInstanceState.getCharSequence(SAVE_STATE_NEGATIVE_TEXT); - mDialogMessage = savedInstanceState.getCharSequence(SAVE_STATE_MESSAGE); - mDialogLayoutRes = savedInstanceState.getInt(SAVE_STATE_LAYOUT, 0); - final Bitmap bitmap = savedInstanceState.getParcelable(SAVE_STATE_ICON); - if (bitmap != null) { - mDialogIcon = new BitmapDrawable(getResources(), bitmap); - } - } - } - - @Override - public void onSaveInstanceState(@NonNull Bundle outState) { - super.onSaveInstanceState(outState); - - outState.putCharSequence(SAVE_STATE_TITLE, mDialogTitle); - outState.putCharSequence(SAVE_STATE_POSITIVE_TEXT, mPositiveButtonText); - outState.putCharSequence(SAVE_STATE_NEGATIVE_TEXT, mNegativeButtonText); - outState.putCharSequence(SAVE_STATE_MESSAGE, mDialogMessage); - outState.putInt(SAVE_STATE_LAYOUT, mDialogLayoutRes); - if (mDialogIcon != null) { - outState.putParcelable(SAVE_STATE_ICON, mDialogIcon.getBitmap()); - } - } - - @Override - public @NonNull - Dialog onCreateDialog(Bundle savedInstanceState) { - final Context context = getActivity(); - mWhichButtonClicked = DialogAction.NEGATIVE; - - final MaterialDialog.Builder builder = new MaterialDialog.Builder(context) - .title(mDialogTitle) - .icon(mDialogIcon) - .positiveText(mPositiveButtonText) - .negativeText(mNegativeButtonText) - .negativeColorAttr(R.attr.colorTextPrimary) - .neutralColorAttr(R.attr.colorTextPrimary) - .backgroundColorAttr(R.attr.colorBackgroundCard) - .contentColorAttr(R.attr.colorTextPrimary) - .titleColorAttr(R.attr.colorTextPrimary) - .onPositive(this); - - View contentView = onCreateDialogView(context); - if (contentView != null) { - onBindDialogView(contentView); - builder.customView(contentView, true); - } else { - builder.content(mDialogMessage); - } - - onPrepareDialogBuilder(builder); - - // Create the dialog - final Dialog dialog = builder.build(); - if (needInputMethod()) { - requestInputMethod(dialog); - } - - return dialog; - } - - /** - * Get the preference that requested this dialog. Available after {@link #onCreate(Bundle)} has - * been called on the {@link PreferenceFragmentCompat} which launched this dialog. - * - * @return The {@link DialogPreference} associated with this - * dialog. - */ - public DialogPreference getPreference() { - if (mPreference == null) { - final String key = getArguments().getString(ARG_KEY); - final DialogPreference.TargetFragment fragment = - (DialogPreference.TargetFragment) getTargetFragment(); - mPreference = (DialogPreference) fragment.findPreference(key); - } - return mPreference; - } - - /** - * Prepares the dialog builder to be shown when the preference is clicked. - * Use this to set custom properties on the dialog. - * <p> - * Do not {@link AlertDialog.Builder#create()} or - * {@link AlertDialog.Builder#show()}. - */ - protected void onPrepareDialogBuilder(MaterialDialog.Builder builder) { - } - - /** - * Returns whether the preference needs to display a soft input method when the dialog - * is displayed. Default is false. Subclasses should override this method if they need - * the soft input method brought up automatically. - */ - protected boolean needInputMethod() { - return false; - } - - /** - * Sets the required flags on the dialog window to enable input method window to show up. - */ - private void requestInputMethod(Dialog dialog) { - Window window = dialog.getWindow(); - window.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE); - } - - /** - * Creates the content view for the dialog (if a custom content view is - * required). By default, it inflates the dialog layout resource if it is - * set. - * - * @return The content View for the dialog. - * @see DialogPreference#setLayoutResource(int) - */ - protected View onCreateDialogView(Context context) { - final int resId = mDialogLayoutRes; - if (resId == 0) { - return null; - } - - LayoutInflater inflater = LayoutInflater.from(context); - return inflater.inflate(resId, null); - } - - /** - * Binds views in the content View of the dialog to data. - * <p> - * Make sure to call through to the superclass implementation. - * - * @param view The content View of the dialog, if it is custom. - */ - protected void onBindDialogView(View view) { - View dialogMessageView = view.findViewById(android.R.id.message); - - if (dialogMessageView != null) { - final CharSequence message = mDialogMessage; - int newVisibility = View.GONE; - - if (!TextUtils.isEmpty(message)) { - if (dialogMessageView instanceof TextView) { - ((TextView) dialogMessageView).setText(message); - } - - newVisibility = View.VISIBLE; - } - - if (dialogMessageView.getVisibility() != newVisibility) { - dialogMessageView.setVisibility(newVisibility); - } - } - } - - @Override - public void onClick(@NonNull MaterialDialog dialog, @NonNull DialogAction which) { - mWhichButtonClicked = which; - } - - @Override - public void onDismiss(DialogInterface dialog) { - super.onDismiss(dialog); - onDialogClosed(mWhichButtonClicked == DialogAction.POSITIVE); - } - - public abstract void onDialogClosed(boolean positiveResult); -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/util/ui/settings/RequiresActivityLauncher.kt b/app/src/main/java/de/kuschku/quasseldroid/util/ui/settings/RequiresActivityLauncher.kt deleted file mode 100644 index 023340ff86bf265a5baec79af5058cc95e32f420..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/util/ui/settings/RequiresActivityLauncher.kt +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.util.ui.settings - -interface RequiresActivityLauncher { - var activityLauncher: ActivityLauncher? -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/util/ui/settings/RingtonePreference.kt b/app/src/main/java/de/kuschku/quasseldroid/util/ui/settings/RingtonePreference.kt deleted file mode 100644 index 4e9e9fdba3858e42d2ab1ef67eba30eb384f108e..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/util/ui/settings/RingtonePreference.kt +++ /dev/null @@ -1,226 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.util.ui.settings - -import android.content.Context -import android.content.Intent -import android.content.res.TypedArray -import android.media.RingtoneManager -import android.net.Uri -import android.text.TextUtils -import android.util.AttributeSet -import androidx.preference.DialogPreference -import de.kuschku.quasseldroid.R - -open class RingtonePreference : DialogPreference, - RequiresActivityLauncher, - OnActivityResultListener { - private val TAG = "RingtonePreference" - - private var mRingtoneType: Int = 0 - private var mShowDefault: Boolean = false - private var mShowSilent: Boolean = false - - private var mRequestCode: Int? = null - - override var activityLauncher: ActivityLauncher? = null - set(value) { - field?.unregisterOnActivityResultListener(this) - - field = value - - value?.registerOnActivityResultListener(this) - mRequestCode = value?.getNextRequestCode() - } - - constructor(context: Context) : - this(context, null) - - constructor(context: Context, attrs: AttributeSet?) : - this(context, attrs, android.R.attr.ringtonePreferenceStyle) - - constructor(context: Context, attrs: AttributeSet?, defStyleAttr: Int) : - this(context, attrs, defStyleAttr, 0) - - constructor(context: Context, attrs: AttributeSet?, styleAttr: Int, styleRes: Int) : - super(context, attrs, styleAttr, styleRes) { - val a = context.obtainStyledAttributes( - attrs, R.styleable.RingtonePreference, styleAttr, styleRes) - mRingtoneType = a.getInt(R.styleable.RingtonePreference_ringtoneType, - RingtoneManager.TYPE_RINGTONE) - mShowDefault = a.getBoolean(R.styleable.RingtonePreference_showDefault, true) - mShowSilent = a.getBoolean(R.styleable.RingtonePreference_showSilent, true) - a.recycle() - } - - /** - * Returns the sound type(s) that are shown in the picker. - * - * @return The sound type(s) that are shown in the picker. - * @see .setRingtoneType - */ - fun getRingtoneType(): Int { - return mRingtoneType - } - - /** - * Sets the sound type(s) that are shown in the picker. - * - * @param type The sound type(s) that are shown in the picker. - * @see RingtoneManager.EXTRA_RINGTONE_TYPE - */ - fun setRingtoneType(type: Int) { - mRingtoneType = type - } - - /** - * Returns whether to a show an item for the default sound/ringtone. - * - * @return Whether to show an item for the default sound/ringtone. - */ - fun getShowDefault(): Boolean { - return mShowDefault - } - - /** - * Sets whether to show an item for the default sound/ringtone. The default - * to use will be deduced from the sound type(s) being shown. - * - * @param showDefault Whether to show the default or not. - * @see RingtoneManager.EXTRA_RINGTONE_SHOW_DEFAULT - */ - fun setShowDefault(showDefault: Boolean) { - mShowDefault = showDefault - } - - /** - * Returns whether to a show an item for 'Silent'. - * - * @return Whether to show an item for 'Silent'. - */ - fun getShowSilent(): Boolean { - return mShowSilent - } - - /** - * Sets whether to show an item for 'Silent'. - * - * @param showSilent Whether to show 'Silent'. - * @see RingtoneManager.EXTRA_RINGTONE_SHOW_SILENT - */ - fun setShowSilent(showSilent: Boolean) { - mShowSilent = showSilent - } - - override fun onClick() { - // Launch the ringtone picker - val intent = Intent(RingtoneManager.ACTION_RINGTONE_PICKER) - onPrepareRingtonePickerIntent(intent) - mRequestCode?.let { - activityLauncher?.startActivityForResult(intent, it) - } - } - - /** - * Prepares the intent to launch the ringtone picker. This can be modified - * to adjust the parameters of the ringtone picker. - * - * @param ringtonePickerIntent The ringtone picker intent that can be - * modified by putting extras. - */ - protected fun onPrepareRingtonePickerIntent(ringtonePickerIntent: Intent) { - - ringtonePickerIntent.putExtra(RingtoneManager.EXTRA_RINGTONE_SHOW_DEFAULT, mShowDefault) - ringtonePickerIntent.putExtra(RingtoneManager.EXTRA_RINGTONE_SHOW_SILENT, mShowSilent) - ringtonePickerIntent.putExtra(RingtoneManager.EXTRA_RINGTONE_TYPE, mRingtoneType) - ringtonePickerIntent.putExtra(RingtoneManager.EXTRA_RINGTONE_TITLE, title) - if (mShowDefault) { - ringtonePickerIntent.putExtra(RingtoneManager.EXTRA_RINGTONE_DEFAULT_URI, - RingtoneManager.getDefaultUri(getRingtoneType())) - } - ringtonePickerIntent.putExtra(RingtoneManager.EXTRA_RINGTONE_EXISTING_URI, onRestoreRingtone()) - } - - /** - * Called when a ringtone is chosen. - * - * - * By default, this saves the ringtone URI to the persistent storage as a - * string. - * - * @param ringtoneUri The chosen ringtone's [Uri]. Can be null. - */ - protected fun onSaveRingtone(ringtoneUri: Uri?) { - persistString(ringtoneUri?.toString() ?: "") - updateSummary(ringtoneUri) - } - - /** - * Called when the chooser is about to be shown and the current ringtone - * should be marked. Can return null to not mark any ringtone. - * - * - * By default, this restores the previous ringtone URI from the persistent - * storage. - * - * @return The ringtone to be marked as the current ringtone. - */ - protected fun onRestoreRingtone(): Uri? { - val uriString = getPersistedString(null) - return if (!TextUtils.isEmpty(uriString)) Uri.parse(uriString) else null - } - - private fun updateSummary(ringtoneUri: Uri?) { - summary = ringtoneUri?.let { - RingtoneManager.getRingtone(context, ringtoneUri)?.getTitle(context) - } ?: context.getString(R.string.label_no_sound) - } - - override fun onGetDefaultValue(a: TypedArray, index: Int): Any? { - return a.getString(index) - } - - override fun onSetInitialValue(restorePersistedValue: Boolean, defaultValueObj: Any?) { - val defaultValue = defaultValueObj as? String ?: "" - - if (restorePersistedValue) { - updateSummary(onRestoreRingtone()) - return - } - - // If we are setting to the default value, we should persist it. - if (!TextUtils.isEmpty(defaultValue)) { - onSaveRingtone(Uri.parse(defaultValue)) - } - } - - override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?): Boolean { - if (requestCode == mRequestCode) { - if (data != null) { - val uri = data.getParcelableExtra<Uri>(RingtoneManager.EXTRA_RINGTONE_PICKED_URI) - if (callChangeListener(uri?.toString() ?: "")) { - onSaveRingtone(uri) - } - } - return true - } - return false - } -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/util/ui/settings/SeekBarPreference.kt b/app/src/main/java/de/kuschku/quasseldroid/util/ui/settings/SeekBarPreference.kt deleted file mode 100644 index acfac525847f8f4a1127b881fd3328e172bdea1d..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/util/ui/settings/SeekBarPreference.kt +++ /dev/null @@ -1,166 +0,0 @@ -/* - * Copyright (c) 2015 IRCCloud, Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package de.kuschku.quasseldroid.util.ui.settings - -import android.content.Context -import android.content.res.TypedArray -import android.util.AttributeSet -import android.util.Log -import android.widget.SeekBar -import android.widget.TextView -import androidx.appcompat.widget.AppCompatSeekBar -import androidx.preference.Preference -import androidx.preference.PreferenceViewHolder -import butterknife.BindView -import butterknife.ButterKnife -import de.kuschku.quasseldroid.R - -class SeekBarPreference : Preference, SeekBar.OnSeekBarChangeListener { - private var maxValue = 100 - private var minValue = 0 - private var interval = 1 - private var currentValue: Int = 0 - - private var unitsLeftText = "" - private var unitsRightText = "" - - @BindView(R.id.seekBarPrefSeekBar) - @JvmField - var seekBar: AppCompatSeekBar? = null - - @BindView(R.id.seekBarPrefValue) - @JvmField - var statusText: TextView? = null - - @BindView(R.id.seekBarPrefUnitsLeft) - @JvmField - var unitsLeft: TextView? = null - - @BindView(R.id.seekBarPrefUnitsRight) - @JvmField - var unitsRight: TextView? = null - - constructor(context: Context, attrs: AttributeSet, defStyleAttr: Int) : - super(context, attrs, defStyleAttr) { - initPreference(context, attrs) - } - - constructor(context: Context, attrs: AttributeSet) : - super(context, attrs) { - initPreference(context, attrs) - } - - private fun initPreference(context: Context, attrs: AttributeSet) { - setValuesFromXml(attrs) - layoutResource = R.layout.preference_vertical - widgetLayoutResource = R.layout.preference_seekbar - } - - private fun setValuesFromXml(attrs: AttributeSet) { - maxValue = attrs.getAttributeIntValue(NAMESPACE_ANDROID, "max", 100) - minValue = attrs.getAttributeIntValue(NAMESPACE_ROBOBUNNY, "min", 0) - unitsLeftText = getAttributeStringValue(attrs, - NAMESPACE_ROBOBUNNY, "unitsLeft", "") - val units = getAttributeStringValue(attrs, - NAMESPACE_ROBOBUNNY, "units", "") - unitsRightText = getAttributeStringValue(attrs, - NAMESPACE_ROBOBUNNY, "unitsRight", units) - try { - val newInterval = attrs.getAttributeValue(NAMESPACE_ROBOBUNNY, "interval") - if (newInterval != null) - interval = Integer.parseInt(newInterval) - } catch (e: Exception) { - Log.e("SeekBarPreference", "Invalid interval value", e) - } - } - - private fun getAttributeStringValue(attrs: AttributeSet, namespace: String, name: String, - defaultValue: String) = - attrs.getAttributeValue(namespace, name) ?: defaultValue - - override fun onBindViewHolder(holder: PreferenceViewHolder?) { - super.onBindViewHolder(holder) - holder?.itemView?.let { view -> - ButterKnife.bind(this, view) - seekBar?.max = maxValue - minValue - seekBar?.setOnSeekBarChangeListener(this) - statusText?.text = currentValue.toString() - statusText?.minimumWidth = 30 - seekBar?.progress = currentValue - minValue - unitsRight?.text = this.unitsRightText - unitsLeft?.text = this.unitsLeftText - } - } - - override fun onProgressChanged(seekBar: SeekBar, progress: Int, fromUser: Boolean) { - var newValue = progress + minValue - if (newValue > maxValue) - newValue = maxValue - else if (newValue < minValue) - newValue = minValue - else if (interval != 1 && newValue % interval != 0) - newValue = Math.round(newValue.toFloat() / interval) * interval - // change rejected, revert to the previous value - if (!callChangeListener(newValue)) { - seekBar.progress = currentValue - minValue - return - } - // change accepted, store it - currentValue = newValue - statusText?.text = newValue.toString() - persistInt(newValue) - } - - override fun onStartTrackingTouch(seekBar: SeekBar) = Unit - override fun onStopTrackingTouch(seekBar: SeekBar) = notifyChanged() - override fun onGetDefaultValue(ta: TypedArray, index: Int) = ta.getInt(index, - DEFAULT_VALUE) - - override fun onSetInitialValue(restoreValue: Boolean, defaultValue: Any?) { - if (restoreValue) { - currentValue = getPersistedInt(currentValue) - } else { - var temp = 0 - try { - temp = defaultValue as Int - } catch (ex: Exception) { - Log.e("SeekBarPreference", "Invalid default value: " + defaultValue.toString()) - } - persistInt(temp) - currentValue = temp - } - } - - /** - * make sure that the seekbar is disabled if the preference is disabled - */ - override fun setEnabled(enabled: Boolean) { - super.setEnabled(enabled) - seekBar?.isEnabled = enabled - } - - override fun onDependencyChanged(dependency: Preference, disableDependent: Boolean) { - super.onDependencyChanged(dependency, disableDependent) - //Disable movement of seek bar when dependency is false - seekBar?.isEnabled = !disableDependent - } - - companion object { - private const val NAMESPACE_ANDROID = "http://schemas.android.com/apk/res/android" - private const val NAMESPACE_ROBOBUNNY = "http://robobunny.com" - private const val DEFAULT_VALUE = 50 - } -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/util/ui/settings/ServiceBoundSettingsActivity.kt b/app/src/main/java/de/kuschku/quasseldroid/util/ui/settings/ServiceBoundSettingsActivity.kt deleted file mode 100644 index 575bcbfa9ea8ec6ca8cbc08d0e9492f55b4d28b4..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/util/ui/settings/ServiceBoundSettingsActivity.kt +++ /dev/null @@ -1,112 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.util.ui.settings - -import android.os.Bundle -import android.view.MenuItem -import androidx.appcompat.widget.Toolbar -import androidx.fragment.app.Fragment -import butterknife.BindView -import butterknife.ButterKnife -import com.afollestad.materialdialogs.MaterialDialog -import de.kuschku.quasseldroid.R -import de.kuschku.quasseldroid.util.service.ServiceBoundActivity -import de.kuschku.quasseldroid.util.ui.settings.fragment.Changeable - -abstract class ServiceBoundSettingsActivity(private val fragment: Fragment? = null) : - ServiceBoundActivity() { - protected open fun fragment(): Fragment? = null - - private var changeable: Changeable? = null - protected var actualFragment: Fragment? = null - - @BindView(R.id.toolbar) - lateinit var toolbar: Toolbar - - override fun onCreate(savedInstanceState: Bundle?) { - val arguments = intent.extras - super.onCreate(savedInstanceState) - setContentView(R.layout.activity_settings) - ButterKnife.bind(this) - - setSupportActionBar(toolbar) - supportActionBar?.setDisplayHomeAsUpEnabled(true) - - val existingFragment = savedInstanceState?.let { - supportFragmentManager.getFragment(it, "settings_content") - } - - actualFragment = existingFragment ?: this.fragment ?: this.fragment() - if (existingFragment == null) { - actualFragment?.let { - val transaction = supportFragmentManager.beginTransaction() - it.arguments = arguments - transaction.replace(R.id.fragment_container, it) - transaction.commit() - } - } - - this.changeable = fragment as? Changeable - } - - override fun onSaveInstanceState(outState: Bundle) { - super.onSaveInstanceState(outState) - actualFragment?.let { - supportFragmentManager.putFragment(outState, "settings_content", it) - } - } - - private fun shouldNavigateAway(callback: () -> Unit) { - val changeable = this.changeable - if (changeable?.hasChanged() == true) { - MaterialDialog.Builder(this) - .content(R.string.cancel_confirmation) - .positiveText(R.string.label_yes) - .negativeText(R.string.label_no) - .negativeColorAttr(R.attr.colorTextPrimary) - .backgroundColorAttr(R.attr.colorBackgroundCard) - .contentColorAttr(R.attr.colorTextPrimary) - .onPositive { _, _ -> - callback() - } - .build() - .show() - } else callback() - } - - override fun onBackPressed() = shouldNavigateAway { - super.onBackPressed() - } - - override fun onOptionsItemSelected(item: MenuItem?) = when (item?.itemId) { - android.R.id.home -> { - shouldNavigateAway { - if (supportParentActivityIntent != null) { - startActivity(supportParentActivityIntent) - finish() - } else { - super.onBackPressed() - } - } - true - } - else -> super.onOptionsItemSelected(item) - } -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/util/ui/settings/SettingsActivity.kt b/app/src/main/java/de/kuschku/quasseldroid/util/ui/settings/SettingsActivity.kt deleted file mode 100644 index 4b58a727041b3f574ef5e91e1c36b21a5f035e91..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/util/ui/settings/SettingsActivity.kt +++ /dev/null @@ -1,111 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.util.ui.settings - -import android.os.Bundle -import android.view.MenuItem -import androidx.appcompat.widget.Toolbar -import androidx.fragment.app.Fragment -import butterknife.BindView -import butterknife.ButterKnife -import com.afollestad.materialdialogs.MaterialDialog -import de.kuschku.quasseldroid.R -import de.kuschku.quasseldroid.util.ui.ThemedActivity -import de.kuschku.quasseldroid.util.ui.settings.fragment.Changeable - -abstract class SettingsActivity(protected val fragment: Fragment? = null) : ThemedActivity() { - protected open fun fragment(): Fragment? = null - - private var changeable: Changeable? = null - protected var actualFragment: Fragment? = null - - @BindView(R.id.toolbar) - lateinit var toolbar: Toolbar - - override fun onCreate(savedInstanceState: Bundle?) { - val arguments = intent.extras - super.onCreate(savedInstanceState) - setContentView(R.layout.activity_settings) - ButterKnife.bind(this) - - setSupportActionBar(toolbar) - supportActionBar?.setDisplayHomeAsUpEnabled(true) - - val existingFragment = savedInstanceState?.let { - supportFragmentManager.getFragment(it, "settings_content") - } - - actualFragment = existingFragment ?: this.fragment ?: this.fragment() - if (existingFragment == null) { - actualFragment?.let { - val transaction = supportFragmentManager.beginTransaction() - it.arguments = arguments - transaction.replace(R.id.fragment_container, it) - transaction.commit() - } - } - - this.changeable = fragment as? Changeable - } - - override fun onSaveInstanceState(outState: Bundle) { - super.onSaveInstanceState(outState) - actualFragment?.let { - supportFragmentManager.putFragment(outState, "settings_content", it) - } - } - - private fun shouldNavigateAway(callback: () -> Unit) { - val changeable = this.changeable - if (changeable?.hasChanged() == true) { - MaterialDialog.Builder(this) - .content(R.string.cancel_confirmation) - .positiveText(R.string.label_yes) - .negativeText(R.string.label_no) - .negativeColorAttr(R.attr.colorTextPrimary) - .backgroundColorAttr(R.attr.colorBackgroundCard) - .contentColorAttr(R.attr.colorTextPrimary) - .onPositive { _, _ -> - callback() - } - .build() - .show() - } else callback() - } - - override fun onBackPressed() = shouldNavigateAway { - super.onBackPressed() - } - - override fun onOptionsItemSelected(item: MenuItem?) = when (item?.itemId) { - android.R.id.home -> { - shouldNavigateAway { - if (supportParentActivityIntent != null) { - startActivity(supportParentActivityIntent) - finish() - } else { - super.onBackPressed() - } - } - true - } - else -> super.onOptionsItemSelected(item) - } -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/util/ui/settings/fragment/Changeable.kt b/app/src/main/java/de/kuschku/quasseldroid/util/ui/settings/fragment/Changeable.kt deleted file mode 100644 index 100a7b10cf8b83244e5cb2b81ac940a6eabfd3f2..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/util/ui/settings/fragment/Changeable.kt +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.util.ui.settings.fragment - -interface Changeable { - fun hasChanged(): Boolean -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/util/ui/settings/fragment/Deletable.kt b/app/src/main/java/de/kuschku/quasseldroid/util/ui/settings/fragment/Deletable.kt deleted file mode 100644 index 817138e4926ba33bb683d111ac4ff1de381de448..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/util/ui/settings/fragment/Deletable.kt +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.util.ui.settings.fragment - -interface Deletable { - fun onDelete() -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/util/ui/settings/fragment/Savable.kt b/app/src/main/java/de/kuschku/quasseldroid/util/ui/settings/fragment/Savable.kt deleted file mode 100644 index 7f9e1bd8b577566a03c6ba7db2adab6b0f65a4d4..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/util/ui/settings/fragment/Savable.kt +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.util.ui.settings.fragment - -interface Savable { - fun onSave(): Boolean -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/util/ui/settings/fragment/ServiceBoundSettingsFragment.kt b/app/src/main/java/de/kuschku/quasseldroid/util/ui/settings/fragment/ServiceBoundSettingsFragment.kt deleted file mode 100644 index 2a19e65b0f46b8baf43e3a430c900a4b10f0e605..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/util/ui/settings/fragment/ServiceBoundSettingsFragment.kt +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.util.ui.settings.fragment - -import android.os.Bundle -import android.view.Menu -import android.view.MenuInflater -import android.view.MenuItem -import de.kuschku.quasseldroid.util.service.ServiceBoundFragment - -abstract class ServiceBoundSettingsFragment : ServiceBoundFragment() { - private lateinit var helper: SettingsFragmentHelper - - override fun onCreate(savedInstanceState: Bundle?) { - super.onCreate(savedInstanceState) - setHasOptionsMenu(true) - helper = SettingsFragmentHelper( - this as? Savable, - this as? Deletable - ) - } - - override fun onCreateOptionsMenu(menu: Menu, inflater: MenuInflater) { - helper.onCreateOptionsMenu(menu, inflater) - super.onCreateOptionsMenu(menu, inflater) - } - - override fun onOptionsItemSelected(item: MenuItem) = - helper.onOptionsItemSelected(activity, item) - ?: super.onOptionsItemSelected(item) -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/util/ui/settings/fragment/SettingsFragment.kt b/app/src/main/java/de/kuschku/quasseldroid/util/ui/settings/fragment/SettingsFragment.kt deleted file mode 100644 index 7c9e0b63833fa08950e920a48f718c4b430719d0..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/util/ui/settings/fragment/SettingsFragment.kt +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.util.ui.settings.fragment - -import android.os.Bundle -import android.view.Menu -import android.view.MenuInflater -import android.view.MenuItem -import dagger.android.support.DaggerFragment - -abstract class SettingsFragment : DaggerFragment() { - private lateinit var helper: SettingsFragmentHelper - - override fun onCreate(savedInstanceState: Bundle?) { - super.onCreate(savedInstanceState) - setHasOptionsMenu(true) - helper = SettingsFragmentHelper( - this as? Savable, - this as? Deletable - ) - } - - override fun onCreateOptionsMenu(menu: Menu, inflater: MenuInflater) { - helper.onCreateOptionsMenu(menu, inflater) - super.onCreateOptionsMenu(menu, inflater) - } - - override fun onOptionsItemSelected(item: MenuItem) = - helper.onOptionsItemSelected(activity, item) - ?: super.onOptionsItemSelected(item) -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/util/ui/settings/fragment/SettingsFragmentHelper.kt b/app/src/main/java/de/kuschku/quasseldroid/util/ui/settings/fragment/SettingsFragmentHelper.kt deleted file mode 100644 index a6b6e39b6c7d85840af74cc03851de3b5d53c982..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/util/ui/settings/fragment/SettingsFragmentHelper.kt +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.util.ui.settings.fragment - -import android.app.Activity -import android.view.Menu -import android.view.MenuInflater -import android.view.MenuItem -import com.afollestad.materialdialogs.MaterialDialog -import de.kuschku.quasseldroid.R - -class SettingsFragmentHelper( - private val saveable: Savable?, - private val deletable: Deletable? -) { - fun onCreateOptionsMenu(menu: Menu, inflater: MenuInflater) { - inflater.inflate(R.menu.context_setting, menu) - menu.findItem(R.id.action_save)?.isVisible = saveable != null - menu.findItem(R.id.action_delete)?.isVisible = deletable != null - } - - fun onOptionsItemSelected(activity: Activity?, item: MenuItem) = when (item.itemId) { - R.id.action_save -> { - saveable?.let { - if (it.onSave()) activity?.finish() - } - true - } - R.id.action_delete -> { - activity?.let { - deletable?.let { - MaterialDialog.Builder(activity) - .content(R.string.delete_confirmation) - .positiveText(R.string.label_yes) - .negativeText(R.string.label_no) - .negativeColorAttr(R.attr.colorTextPrimary) - .backgroundColorAttr(R.attr.colorBackgroundCard) - .contentColorAttr(R.attr.colorTextPrimary) - .onPositive { _, _ -> - it.onDelete() - activity.finish() - } - .build() - .show() - } - } - true - } - else -> null - } -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/util/ui/view/BannerView.kt b/app/src/main/java/de/kuschku/quasseldroid/util/ui/view/BannerView.kt deleted file mode 100644 index 8bb879911f2803bcb1b5ffa5ae4cda11e2be5d1c..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/util/ui/view/BannerView.kt +++ /dev/null @@ -1,85 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.util.ui.view - -import android.content.Context -import android.graphics.drawable.LayerDrawable -import android.util.AttributeSet -import android.view.LayoutInflater -import android.widget.FrameLayout -import android.widget.TextView -import androidx.annotation.StringRes -import androidx.appcompat.widget.AppCompatImageView -import butterknife.BindView -import butterknife.ButterKnife -import de.kuschku.quasseldroid.R -import de.kuschku.quasseldroid.util.helper.styledAttributes -import de.kuschku.quasseldroid.util.helper.use - -class BannerView : FrameLayout { - @BindView(R.id.icon) - lateinit var icon: AppCompatImageView - - @BindView(R.id.text) - lateinit var text: TextView - - @BindView(R.id.button) - lateinit var button: TextView - - constructor(context: Context) : - this(context, null) - - constructor(context: Context, attrs: AttributeSet?) : - this(context, attrs, 0) - - constructor(context: Context, attrs: AttributeSet?, defStyleAttr: Int) : - super(context, attrs, defStyleAttr) { - - val content = LayoutInflater.from(context).inflate(R.layout.widget_banner, this, true) - ButterKnife.bind(this) - - context.theme.styledAttributes(R.attr.colorBackgroundSnackbar, - R.attr.selectableItemBackground) { - content.background = LayerDrawable(arrayOf( - getDrawable(0), - getDrawable(1) - )) - } - - context.theme.obtainStyledAttributes(attrs, R.styleable.BannerView, 0, 0).use { - if (it.hasValue(R.styleable.BannerView_icon)) - icon.setImageResource(it.getResourceId(R.styleable.BannerView_icon, 0)) - - if (it.hasValue(R.styleable.BannerView_text)) - text.text = it.getString(R.styleable.BannerView_text) - - if (it.hasValue(R.styleable.BannerView_buttonText)) - button.text = it.getString(R.styleable.BannerView_buttonText) - } - } - - fun setText(content: String) { - text.text = content - } - - fun setText(@StringRes content: Int) { - text.setText(content) - } -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/util/ui/view/DrawerRecyclerView.kt b/app/src/main/java/de/kuschku/quasseldroid/util/ui/view/DrawerRecyclerView.kt deleted file mode 100644 index cdfb8bb7f36c815e8e27cdf977ed28f336ab90e8..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/util/ui/view/DrawerRecyclerView.kt +++ /dev/null @@ -1,124 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.util.ui.view - -import android.content.Context -import android.graphics.Canvas -import android.graphics.Rect -import android.graphics.drawable.Drawable -import android.util.AttributeSet -import androidx.core.view.ViewCompat -import de.kuschku.quasseldroid.R -import de.kuschku.quasseldroid.util.ui.fastscroll.views.FastScrollRecyclerView - -class DrawerRecyclerView @JvmOverloads constructor( - context: Context, - attrs: AttributeSet? = null, - defStyleAttr: Int = 0 -) : FastScrollRecyclerView(context, attrs, defStyleAttr) { - private var mInsetForeground: Drawable? = null - private var mInsets: Rect? = null - private val mTempRect = Rect() - private val maxWidth: Int - - init { - val a = context.obtainStyledAttributes( - attrs, - R.styleable.DrawerRecyclerView, defStyleAttr, - R.style.Widget_DrawerRecyclerView - ) - mInsetForeground = a.getDrawable(R.styleable.DrawerRecyclerView_insetBackground) - a.recycle() - setWillNotDraw(true) // No need to draw until the insets are adjusted - ViewCompat.setOnApplyWindowInsetsListener(this) { _, insets -> - if (null == mInsets) { - mInsets = Rect() - } - mInsets!!.set( - insets.systemWindowInsetLeft, - insets.systemWindowInsetTop, - insets.systemWindowInsetRight, - insets.systemWindowInsetBottom - ) - setPadding( - insets.systemWindowInsetLeft, - insets.systemWindowInsetTop, - insets.systemWindowInsetRight, - insets.systemWindowInsetBottom - ) - setWillNotDraw(!insets.hasSystemWindowInsets() || mInsetForeground == null) - ViewCompat.postInvalidateOnAnimation(this@DrawerRecyclerView) - insets.consumeSystemWindowInsets() - } - - maxWidth = context.resources.getDimensionPixelSize(R.dimen.navigation_drawer_max_width) - } - - override fun onMeasure(widthMeasureSpec: Int, heightMeasureSpec: Int) { - super.onMeasure( - MeasureSpec.makeMeasureSpec( - Math.min(MeasureSpec.getSize(widthMeasureSpec), maxWidth), - MeasureSpec.getMode(widthMeasureSpec) - ), - heightMeasureSpec - ) - } - - override fun draw(canvas: Canvas) { - super.draw(canvas) - val width = width - val height = height - if (mInsets != null && mInsetForeground != null) { - val sc = canvas.save() - canvas.translate(scrollX.toFloat(), scrollY.toFloat()) - // Top - mTempRect.set(0, 0, width, mInsets!!.top) - mInsetForeground!!.bounds = mTempRect - mInsetForeground!!.draw(canvas) - // Bottom - mTempRect.set(0, height - mInsets!!.bottom, width, height) - mInsetForeground!!.bounds = mTempRect - mInsetForeground!!.draw(canvas) - // Left - mTempRect.set(0, mInsets!!.top, mInsets!!.left, height - mInsets!!.bottom) - mInsetForeground!!.bounds = mTempRect - mInsetForeground!!.draw(canvas) - // Right - mTempRect.set(width - mInsets!!.right, mInsets!!.top, width, height - mInsets!!.bottom) - mInsetForeground!!.bounds = mTempRect - mInsetForeground!!.draw(canvas) - canvas.restoreToCount(sc) - } - } - - override fun onAttachedToWindow() { - super.onAttachedToWindow() - if (mInsetForeground != null) { - mInsetForeground!!.callback = this - } - } - - override fun onDetachedFromWindow() { - super.onDetachedFromWindow() - if (mInsetForeground != null) { - mInsetForeground!!.callback = null - } - } -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/util/ui/view/InlineSnackBar.kt b/app/src/main/java/de/kuschku/quasseldroid/util/ui/view/InlineSnackBar.kt deleted file mode 100644 index d2dbc31513072cb20b49facee8fe45f18d454771..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/util/ui/view/InlineSnackBar.kt +++ /dev/null @@ -1,86 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.util.ui.view - -import android.content.Context -import android.util.AttributeSet -import android.view.LayoutInflater -import android.view.View -import android.widget.Button -import android.widget.FrameLayout -import android.widget.TextView -import androidx.annotation.StringRes -import butterknife.BindView -import butterknife.ButterKnife -import de.kuschku.quasseldroid.R -import de.kuschku.quasseldroid.util.helper.use - -class InlineSnackBar : FrameLayout { - @BindView(R.id.text) - lateinit var text: TextView - - @BindView(R.id.button) - lateinit var button: Button - - constructor(context: Context) : - this(context, null) - - constructor(context: Context, attrs: AttributeSet?) : - this(context, attrs, 0) - - constructor(context: Context, attrs: AttributeSet?, defStyleAttr: Int) : - super(context, attrs, defStyleAttr) { - - LayoutInflater.from(context).inflate(R.layout.widget_inline_snackbar, this, true) - ButterKnife.bind(this) - - context.theme.obtainStyledAttributes(attrs, R.styleable.InlineSnackBar, 0, 0).use { - if (it.hasValue(R.styleable.InlineSnackBar_text)) - text.text = it.getString(R.styleable.InlineSnackBar_text) - - if (it.hasValue(R.styleable.InlineSnackBar_buttonText)) - button.text = it.getString(R.styleable.InlineSnackBar_buttonText) - } - } - - fun setText(content: String) { - text.text = content - } - - fun setText(@StringRes content: Int) { - text.setText(content) - } - - fun setButtonText(content: String) { - button.text = content - } - - fun setButtonText(@StringRes content: Int) { - button.setText(content) - } - - fun setOnClickListener(listener: ((View) -> Unit)?) { - button.setOnClickListener(listener) - } - - override fun setOnClickListener(listener: OnClickListener?) { - button.setOnClickListener(listener) - } -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/util/ui/view/MaterialContentLoadingProgressBar.kt b/app/src/main/java/de/kuschku/quasseldroid/util/ui/view/MaterialContentLoadingProgressBar.kt deleted file mode 100644 index 9b68afc56a3d16f2f15a0a06f8893ae7ebc5684a..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/util/ui/view/MaterialContentLoadingProgressBar.kt +++ /dev/null @@ -1,110 +0,0 @@ -/* - * Copyright (C) 2013 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package de.kuschku.quasseldroid.util.ui.view - -import android.content.Context -import android.util.AttributeSet -import android.view.View -import me.zhanghai.android.materialprogressbar.MaterialProgressBar - -/** - * ContentLoadingProgressBar implements a ProgressBar that waits a minimum time to be - * dismissed before showing. Once visible, the progress bar will be visible for - * a minimum amount of time to avoid "flashes" in the UI when an event could take - * a largely variable time to complete (from none, to a user perceivable amount) - */ -class MaterialContentLoadingProgressBar @JvmOverloads constructor(context: Context, - attrs: AttributeSet? = null) : - MaterialProgressBar(context, attrs, 0) { - private var mStartTime: Long = -1 - private var mPostedHide = false - private var mPostedShow = false - private var mDismissed = false - - private val mDelayedHide = Runnable { - mPostedHide = false - mStartTime = -1 - visibility = View.GONE - } - - private val mDelayedShow = Runnable { - mPostedShow = false - if (!mDismissed) { - mStartTime = System.currentTimeMillis() - visibility = View.VISIBLE - } - } - - public override fun onAttachedToWindow() { - super.onAttachedToWindow() - removeCallbacks() - } - - public override fun onDetachedFromWindow() { - super.onDetachedFromWindow() - removeCallbacks() - } - - private fun removeCallbacks() { - removeCallbacks(mDelayedHide) - removeCallbacks(mDelayedShow) - } - - /** - * Hide the progress view if it is visible. The progress view will not be - * hidden until it has been shown for at least a minimum show time. If the - * progress view was not yet visible, cancels showing the progress view. - */ - fun hide() { - mDismissed = true - removeCallbacks(mDelayedShow) - val diff = System.currentTimeMillis() - mStartTime - if (diff >= MIN_SHOW_TIME || mStartTime == -1L) { - // The progress spinner has been shown long enough - // OR was not shown yet. If it wasn't shown yet, - // it will just never be shown. - visibility = View.GONE - } else { - // The progress spinner is shown, but not long enough, - // so put a delayed message in to hide it when its been - // shown long enough. - if (!mPostedHide) { - postDelayed(mDelayedHide, MIN_SHOW_TIME - diff) - mPostedHide = true - } - } - } - - /** - * Show the progress view after waiting for a minimum delay. If - * during that time, hide() is called, the view is never made visible. - */ - fun show() { - // Reset the start time. - mStartTime = -1 - mDismissed = false - removeCallbacks(mDelayedHide) - if (!mPostedShow) { - postDelayed(mDelayedShow, MIN_DELAY.toLong()) - mPostedShow = true - } - } - - companion object { - private const val MIN_SHOW_TIME = 500 // ms - private const val MIN_DELAY = 500 // ms - } -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/util/ui/view/NavigationDrawerLayout.kt b/app/src/main/java/de/kuschku/quasseldroid/util/ui/view/NavigationDrawerLayout.kt deleted file mode 100644 index 14dcca5120df05a60c3f0fee0117c7e555e697c2..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/util/ui/view/NavigationDrawerLayout.kt +++ /dev/null @@ -1,120 +0,0 @@ -/* - * Copyright (C) 2015 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package de.kuschku.quasseldroid.util.ui.view - -import android.content.Context -import android.graphics.Canvas -import android.graphics.Rect -import android.graphics.drawable.Drawable -import android.util.AttributeSet -import android.widget.FrameLayout -import androidx.core.view.ViewCompat -import de.kuschku.quasseldroid.R - -class NavigationDrawerLayout @JvmOverloads constructor( - context: Context, - attrs: AttributeSet? = null, - defStyleAttr: Int = 0 -) : FrameLayout(context, attrs, defStyleAttr) { - private var mInsetForeground: Drawable? = null - private var mInsets: Rect? = null - private val mTempRect = Rect() - private val maxWidth: Int - - init { - val a = context.obtainStyledAttributes( - attrs, - R.styleable.NavigationDrawerLayout, defStyleAttr, - R.style.Widget_NavigationDrawerLayout - ) - mInsetForeground = a.getDrawable(R.styleable.NavigationDrawerLayout_insetBackground) - a.recycle() - setWillNotDraw(true) // No need to draw until the insets are adjusted - ViewCompat.setOnApplyWindowInsetsListener(this) { _, insets -> - if (null == mInsets) { - mInsets = Rect() - } - mInsets!!.set( - insets.systemWindowInsetLeft, - insets.systemWindowInsetTop, - insets.systemWindowInsetRight, - insets.systemWindowInsetBottom - ) - setPadding( - insets.systemWindowInsetLeft, - insets.systemWindowInsetTop, - insets.systemWindowInsetRight, - insets.systemWindowInsetBottom - ) - setWillNotDraw(!insets.hasSystemWindowInsets() || mInsetForeground == null) - ViewCompat.postInvalidateOnAnimation(this@NavigationDrawerLayout) - insets.consumeSystemWindowInsets() - } - - maxWidth = context.resources.getDimensionPixelSize(R.dimen.navigation_drawer_max_width) - } - - override fun onMeasure(widthMeasureSpec: Int, heightMeasureSpec: Int) { - super.onMeasure( - MeasureSpec.makeMeasureSpec( - Math.min(MeasureSpec.getSize(widthMeasureSpec), maxWidth), - MeasureSpec.getMode(widthMeasureSpec) - ), - heightMeasureSpec - ) - } - - override fun draw(canvas: Canvas) { - super.draw(canvas) - val width = width - val height = height - if (mInsets != null && mInsetForeground != null) { - val sc = canvas.save() - canvas.translate(scrollX.toFloat(), scrollY.toFloat()) - // Top - mTempRect.set(0, 0, width, mInsets!!.top) - mInsetForeground!!.bounds = mTempRect - mInsetForeground!!.draw(canvas) - // Bottom - mTempRect.set(0, height - mInsets!!.bottom, width, height) - mInsetForeground!!.bounds = mTempRect - mInsetForeground!!.draw(canvas) - // Left - mTempRect.set(0, mInsets!!.top, mInsets!!.left, height - mInsets!!.bottom) - mInsetForeground!!.bounds = mTempRect - mInsetForeground!!.draw(canvas) - // Right - mTempRect.set(width - mInsets!!.right, mInsets!!.top, width, height - mInsets!!.bottom) - mInsetForeground!!.bounds = mTempRect - mInsetForeground!!.draw(canvas) - canvas.restoreToCount(sc) - } - } - - override fun onAttachedToWindow() { - super.onAttachedToWindow() - if (mInsetForeground != null) { - mInsetForeground!!.callback = this - } - } - - override fun onDetachedFromWindow() { - super.onDetachedFromWindow() - if (mInsetForeground != null) { - mInsetForeground!!.callback = null - } - } -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/util/ui/view/RipplePassthroughTextView.kt b/app/src/main/java/de/kuschku/quasseldroid/util/ui/view/RipplePassthroughTextView.kt deleted file mode 100644 index 5a2a5a6d59018284f751c3aac5b95b9b7dc15493..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/util/ui/view/RipplePassthroughTextView.kt +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.util.ui.view - -import android.annotation.SuppressLint -import android.content.Context -import android.text.Spannable -import android.util.AttributeSet -import android.view.MotionEvent -import androidx.appcompat.widget.AppCompatTextView - -class RipplePassthroughTextView : AppCompatTextView { - constructor(context: Context?) : super(context) - constructor(context: Context?, attrs: AttributeSet?) : super(context, attrs) - constructor(context: Context?, attrs: AttributeSet?, defStyleAttr: Int) : - super(context, attrs, defStyleAttr) - - // The goal is to provide all normal interaction to the parent view, unless a link is touched - // But additionally, we want to provide all normal textview interactions as well - @SuppressLint("ClickableViewAccessibility") - override fun onTouchEvent(event: MotionEvent): Boolean { - val movementMethod = this.movementMethod - this.movementMethod = null - super.onTouchEvent(event) - this.movementMethod = movementMethod - return movementMethod?.onTouchEvent(this, text as? Spannable, event) == true - } -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/util/ui/view/ShadowView.kt b/app/src/main/java/de/kuschku/quasseldroid/util/ui/view/ShadowView.kt deleted file mode 100644 index 89636356e4667731a8df4201829ae06e3f3bfdae..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/util/ui/view/ShadowView.kt +++ /dev/null @@ -1,187 +0,0 @@ -/* - * Copyright 2014 Google Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package de.kuschku.quasseldroid.util.ui.view - -import android.annotation.SuppressLint -import android.content.Context -import android.graphics.Color -import android.graphics.LinearGradient -import android.graphics.Shader -import android.graphics.drawable.Drawable -import android.graphics.drawable.PaintDrawable -import android.graphics.drawable.ShapeDrawable -import android.graphics.drawable.shapes.RectShape -import android.os.Build -import android.util.AttributeSet -import android.util.LruCache -import android.view.Gravity -import android.view.View -import androidx.annotation.RequiresApi -import de.kuschku.quasseldroid.R - -/** - * Shadow view based on the `ScrimUtil.java` class from the Muzei App. Take a look at - * [this post](https://plus.google.com/+RomanNurik/posts/2QvHVFWrHZf) from Roman - * Nurik for more details. Find the source code - * [here](https://github.com/romannurik/muzei/blob/master/main/src/main/java/com/google/android/apps/muzei/util/ScrimUtil.java). - */ -class ShadowView : View { - constructor(context: Context) : super(context) { - initialize(context, null, 0, 0) - } - - constructor(context: Context, attrs: AttributeSet?) : super(context, attrs) { - initialize(context, attrs, 0, 0) - } - - constructor(context: Context, attrs: AttributeSet?, defStyleAttr: Int) : - super(context, attrs, defStyleAttr) { - initialize(context, attrs, defStyleAttr, 0) - } - - @RequiresApi(api = Build.VERSION_CODES.LOLLIPOP) - constructor(context: Context, attrs: AttributeSet?, defStyleAttr: Int, defStyleRes: Int) : - super(context, attrs, defStyleAttr, defStyleRes) { - initialize(context, attrs, defStyleAttr, defStyleRes) - } - - /** - * Initializes the view. - * - * @param context The Context the view is running in, through which it can - * access the current theme, resources, etc. - * @param attrs The attributes of the XML tag that is inflating the view. - * @param defStyleAttr An attribute in the current theme that contains a - * reference to a style resource that supplies default values for - * the view. Can be 0 to not look for defaults. - * @param defStyleRes A resource identifier of a style resource that - * supplies default values for the view, used only if - * defStyleAttr is 0 or can not be found in the theme. Can be 0 - * to not look for defaults. - * @see View - */ - private fun initialize(context: Context, attrs: AttributeSet?, defStyleAttr: Int, - defStyleRes: Int) { - var gravity = Gravity.TOP - - // Get the attributes. - val a = context.obtainStyledAttributes(attrs, R.styleable.ShadowView, defStyleAttr, defStyleRes) - try { - if (a != null) { - gravity = a.getInt(R.styleable.ShadowView_android_gravity, gravity) - } - - } finally { - a?.recycle() - } - - // Set the gradient as background. - background = makeCubicGradientScrimDrawable(0x44000000, 8, gravity) - } - - /** - * Creates an approximated cubic gradient using a multi-stop linear gradient. - */ - @SuppressLint("RtlHardcoded") - private fun makeCubicGradientScrimDrawable(baseColor: Int, numStops: Int, - gravity: Int): Drawable { - // Generate a cache key by hashing together the inputs, based on the method described in the Effective Java book - val cacheKeyHash = ((baseColor) * 31 + numStops) * 31 + gravity - val cachedGradient = cubicGradientScrimCache.get(cacheKeyHash) - if (cachedGradient != null) { - return cachedGradient - } - - val paintDrawable = PaintDrawable() - paintDrawable.shape = RectShape() - - val red = Color.red(baseColor) - val green = Color.green(baseColor) - val blue = Color.blue(baseColor) - val alpha = Color.alpha(baseColor) - - val stopColors = IntArray(numStops) { - val x = it * 1f / (numStops - 1) - val opacity = constrain(0f, 1f, Math.pow(x.toDouble(), 3.0).toFloat()) - Color.argb((alpha * opacity).toInt(), red, green, blue) - } - - val x0: Float - val x1: Float - val y0: Float - val y1: Float - when (gravity and Gravity.HORIZONTAL_GRAVITY_MASK) { - Gravity.LEFT -> { - x0 = 1f - x1 = 0f - } - Gravity.RIGHT -> { - x0 = 0f - x1 = 1f - } - else -> { - x0 = 0f - x1 = 0f - } - } - when (gravity and Gravity.VERTICAL_GRAVITY_MASK) { - Gravity.TOP -> { - y0 = 1f - y1 = 0f - } - Gravity.BOTTOM -> { - y0 = 0f - y1 = 1f - } - else -> { - y0 = 0f - y1 = 0f - } - } - - paintDrawable.shaderFactory = ShadowShaderFactory( - x0, - y0, - x1, - y1, - stopColors) - cubicGradientScrimCache.put(cacheKeyHash, paintDrawable) - return paintDrawable - } - - private fun constrain(min: Float, max: Float, v: Float): Float { - return Math.max(min, Math.min(max, v)) - } - - class ShadowShaderFactory( - private val x0: Float, private val y0: Float, - private val x1: Float, private val y1: Float, - private val stopColors: IntArray - ) : ShapeDrawable.ShaderFactory() { - override fun resize(width: Int, height: Int) = LinearGradient( - width * x0, - height * y0, - width * x1, - height * y1, - stopColors, null, - Shader.TileMode.CLAMP) - } - - companion object { - private val cubicGradientScrimCache = LruCache<Int, Drawable>(10) - } -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/util/ui/view/TouchInterceptingFrameLayout.kt b/app/src/main/java/de/kuschku/quasseldroid/util/ui/view/TouchInterceptingFrameLayout.kt deleted file mode 100644 index ba539664ce8de838259f918a44fb0891985b8410..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/util/ui/view/TouchInterceptingFrameLayout.kt +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.util.ui.view - -import android.annotation.SuppressLint -import android.content.Context -import android.util.AttributeSet -import android.view.MotionEvent -import android.widget.FrameLayout - -class TouchInterceptingFrameLayout : FrameLayout { - constructor(context: Context) : super(context) - constructor(context: Context, attrs: AttributeSet?) : super(context, attrs) - constructor(context: Context, attrs: AttributeSet?, defStyleAttr: Int) : - super(context, attrs, defStyleAttr) - - @SuppressLint("ClickableViewAccessibility") - override fun onTouchEvent(event: MotionEvent): Boolean { - return true - } -} diff --git a/app/src/main/java/de/kuschku/quasseldroid/util/ui/view/WarningBarView.kt b/app/src/main/java/de/kuschku/quasseldroid/util/ui/view/WarningBarView.kt deleted file mode 100644 index 87ef926146195d87766a49fa4c43ee02bb1e0fda..0000000000000000000000000000000000000000 --- a/app/src/main/java/de/kuschku/quasseldroid/util/ui/view/WarningBarView.kt +++ /dev/null @@ -1,113 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.util.ui.view - -import android.annotation.SuppressLint -import android.content.Context -import android.util.AttributeSet -import android.view.LayoutInflater -import android.view.View -import android.widget.FrameLayout -import android.widget.TextView -import androidx.annotation.IntDef -import androidx.annotation.StringRes -import androidx.appcompat.widget.AppCompatImageView -import butterknife.BindView -import butterknife.ButterKnife -import de.kuschku.quasseldroid.R -import de.kuschku.quasseldroid.util.helper.use - -class WarningBarView : FrameLayout { - @BindView(R.id.icon) - lateinit var icon: AppCompatImageView - - @BindView(R.id.progress) - lateinit var progress: View - - @BindView(R.id.text) - lateinit var text: TextView - - constructor(context: Context) : - this(context, null) - - constructor(context: Context, attrs: AttributeSet?) : - this(context, attrs, 0) - - constructor(context: Context, attrs: AttributeSet?, defStyleAttr: Int) : - super(context, attrs, defStyleAttr) { - - LayoutInflater.from(context).inflate(R.layout.widget_warning_bar, this, true) - ButterKnife.bind(this) - - context.theme.obtainStyledAttributes(attrs, R.styleable.WarningBarView, 0, 0).use { - if (it.hasValue(R.styleable.WarningBarView_icon)) - icon.setImageResource(it.getResourceId(R.styleable.WarningBarView_icon, 0)) - - if (it.hasValue(R.styleable.WarningBarView_text)) - text.text = it.getString(R.styleable.WarningBarView_text) - - if (it.hasValue(R.styleable.WarningBarView_mode)) - setMode(it.getInt(R.styleable.WarningBarView_mode, - MODE_NONE)) - } - } - - fun setText(content: String) { - text.text = content - } - - fun setText(@StringRes content: Int) { - text.setText(content) - } - - @SuppressLint("SwitchIntDef") - fun setMode(@WarningMode mode: Int) { - when (mode) { - MODE_NONE -> { - visibility = View.GONE - } - MODE_TEXT -> { - visibility = View.VISIBLE - icon.visibility = View.GONE - progress.visibility = View.GONE - } - MODE_ICON -> { - visibility = View.VISIBLE - icon.visibility = View.VISIBLE - progress.visibility = View.GONE - } - MODE_PROGRESS -> { - visibility = View.VISIBLE - icon.visibility = View.GONE - progress.visibility = View.VISIBLE - } - } - } - - @IntDef(value = [MODE_NONE, MODE_TEXT, MODE_ICON, MODE_PROGRESS]) - annotation class WarningMode - - companion object { - const val MODE_NONE = 0 - const val MODE_TEXT = 1 - const val MODE_ICON = 2 - const val MODE_PROGRESS = 3 - } -} diff --git a/app/src/main/java/libcore/io/ErrnoException.java b/app/src/main/java/libcore/io/ErrnoException.java deleted file mode 100644 index 16960d6d096e0364faaf87140b52e91d9ec9fa84..0000000000000000000000000000000000000000 --- a/app/src/main/java/libcore/io/ErrnoException.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright (C) 2011 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package libcore.io; - -public final class ErrnoException extends Exception { - public final int errno; - private final String functionName; - - public ErrnoException(String functionName, int errno) { - this.functionName = functionName; - this.errno = errno; - } - - public ErrnoException(String functionName, int errno, Throwable cause) { - super(cause); - this.functionName = functionName; - this.errno = errno; - } -} diff --git a/app/src/main/res/color/color_icons.xml b/app/src/main/res/color/color_icons.xml deleted file mode 100644 index 42d390528bf34e6af0f7dd2fc7c1cae295952867..0000000000000000000000000000000000000000 --- a/app/src/main/res/color/color_icons.xml +++ /dev/null @@ -1,21 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - Copyright (C) 2018 The Android Open Source Project - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. ---> -<selector xmlns:android="http://schemas.android.com/apk/res/android"> - <item android:color="?colorAccent" android:state_focused="true" /> - <item android:alpha="1.00" android:color="?colorTextSecondary" android:state_hovered="true" /> - <item android:alpha="0.38" android:color="?colorTextSecondary" android:state_enabled="false" /> - <item android:alpha="0.87" android:color="?colorTextSecondary" /> -</selector> diff --git a/app/src/main/res/color/color_outlined_stroke.xml b/app/src/main/res/color/color_outlined_stroke.xml deleted file mode 100644 index 4d6f9b841fb5ec05beea20c5079e7440838d76a8..0000000000000000000000000000000000000000 --- a/app/src/main/res/color/color_outlined_stroke.xml +++ /dev/null @@ -1,21 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - Copyright (C) 2018 The Android Open Source Project - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. ---> -<selector xmlns:android="http://schemas.android.com/apk/res/android"> - <item android:color="?colorAccent" android:state_focused="true" /> - <item android:alpha="0.87" android:color="?colorTextSecondary" android:state_hovered="true" /> - <item android:alpha="0.12" android:color="?colorTextSecondary" android:state_enabled="false" /> - <item android:alpha="0.38" android:color="?colorTextSecondary" /> -</selector> diff --git a/app/src/main/res/drawable-hdpi/ic_splash.png b/app/src/main/res/drawable-hdpi/ic_splash.png deleted file mode 100644 index 2cd62c04fb0d5e86ef736e6f60e3bcf665d24a9e..0000000000000000000000000000000000000000 Binary files a/app/src/main/res/drawable-hdpi/ic_splash.png and /dev/null differ diff --git a/app/src/main/res/drawable-ldrtl/ic_send.xml b/app/src/main/res/drawable-ldrtl/ic_send.xml deleted file mode 100644 index fbf3bb3cd929bd0292e7980f74196fd7773dfdd0..0000000000000000000000000000000000000000 --- a/app/src/main/res/drawable-ldrtl/ic_send.xml +++ /dev/null @@ -1,28 +0,0 @@ -<!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<vector xmlns:android="http://schemas.android.com/apk/res/android" - android:width="24dp" - android:height="24dp" - android:viewportWidth="24" - android:viewportHeight="24"> - <path - android:fillColor="#000" - android:pathData="M22,21L1,12L22,3V10L7,12L22,14V21Z" /> -</vector> diff --git a/app/src/main/res/drawable-mdpi/ic_splash.png b/app/src/main/res/drawable-mdpi/ic_splash.png deleted file mode 100644 index 51ce6b2e9f7409bd122083fbf01ebd6c010e15bb..0000000000000000000000000000000000000000 Binary files a/app/src/main/res/drawable-mdpi/ic_splash.png and /dev/null differ diff --git a/app/src/main/res/drawable-v21/bg_menuitem_dark.xml b/app/src/main/res/drawable-v21/bg_menuitem_dark.xml deleted file mode 100644 index 39762f7d4f014d6bb0ff20581c2d9bf7a9eee5a7..0000000000000000000000000000000000000000 --- a/app/src/main/res/drawable-v21/bg_menuitem_dark.xml +++ /dev/null @@ -1,29 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<selector xmlns:android="http://schemas.android.com/apk/res/android"> - <item android:state_selected="true"> - <shape android:shape="rectangle"> - <solid android:color="@color/ripple_dark" /> - </shape> - </item> - <item> - <ripple android:color="@color/ripple_dark" /> - </item> -</selector> diff --git a/app/src/main/res/drawable-v21/bg_menuitem_light.xml b/app/src/main/res/drawable-v21/bg_menuitem_light.xml deleted file mode 100644 index 5baa69c49d33beecaf9c3428a1e62d8c87d4ecc2..0000000000000000000000000000000000000000 --- a/app/src/main/res/drawable-v21/bg_menuitem_light.xml +++ /dev/null @@ -1,29 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<selector xmlns:android="http://schemas.android.com/apk/res/android"> - <item android:state_selected="true"> - <shape android:shape="rectangle"> - <solid android:color="@color/ripple_light" /> - </shape> - </item> - <item> - <ripple android:color="@color/ripple_light" /> - </item> -</selector> diff --git a/app/src/main/res/drawable-v21/bg_menuitem_rounded_dark.xml b/app/src/main/res/drawable-v21/bg_menuitem_rounded_dark.xml deleted file mode 100644 index fa3e24dfe486895993507dc3ad5eb09828437478..0000000000000000000000000000000000000000 --- a/app/src/main/res/drawable-v21/bg_menuitem_rounded_dark.xml +++ /dev/null @@ -1,37 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<selector xmlns:android="http://schemas.android.com/apk/res/android"> - <item android:state_selected="true"> - <shape android:shape="rectangle"> - <corners android:radius="@dimen/button_corner_radius" /> - <solid android:color="@color/ripple_dark" /> - </shape> - </item> - <item> - <ripple android:color="@color/ripple_dark"> - <item android:id="@android:id/mask"> - <shape> - <corners android:radius="@dimen/button_corner_radius" /> - <solid android:color="#fff" /> - </shape> - </item> - </ripple> - </item> -</selector> diff --git a/app/src/main/res/drawable-v21/bg_menuitem_rounded_light.xml b/app/src/main/res/drawable-v21/bg_menuitem_rounded_light.xml deleted file mode 100644 index fdc934f88d36da3c5ce05196dd3bf10630149242..0000000000000000000000000000000000000000 --- a/app/src/main/res/drawable-v21/bg_menuitem_rounded_light.xml +++ /dev/null @@ -1,37 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<selector xmlns:android="http://schemas.android.com/apk/res/android"> - <item android:state_selected="true"> - <shape> - <corners android:radius="@dimen/button_corner_radius" /> - <solid android:color="@color/ripple_light" /> - </shape> - </item> - <item> - <ripple android:color="@color/ripple_light"> - <item android:id="@android:id/mask"> - <shape> - <corners android:radius="@dimen/button_corner_radius" /> - <solid android:color="#fff" /> - </shape> - </item> - </ripple> - </item> -</selector> diff --git a/app/src/main/res/drawable-v24/ic_launcher_foreground.xml b/app/src/main/res/drawable-v24/ic_launcher_foreground.xml new file mode 100644 index 0000000000000000000000000000000000000000..2b068d11462a4b96669193de13a711a3a36220a0 --- /dev/null +++ b/app/src/main/res/drawable-v24/ic_launcher_foreground.xml @@ -0,0 +1,30 @@ +<vector xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:aapt="http://schemas.android.com/aapt" + android:width="108dp" + android:height="108dp" + android:viewportWidth="108" + android:viewportHeight="108"> + <path android:pathData="M31,63.928c0,0 6.4,-11 12.1,-13.1c7.2,-2.6 26,-1.4 26,-1.4l38.1,38.1L107,108.928l-32,-1L31,63.928z"> + <aapt:attr name="android:fillColor"> + <gradient + android:endX="85.84757" + android:endY="92.4963" + android:startX="42.9492" + android:startY="49.59793" + android:type="linear"> + <item + android:color="#44000000" + android:offset="0.0" /> + <item + android:color="#00000000" + android:offset="1.0" /> + </gradient> + </aapt:attr> + </path> + <path + android:fillColor="#FFFFFF" + android:fillType="nonZero" + android:pathData="M65.3,45.828l3.8,-6.6c0.2,-0.4 0.1,-0.9 -0.3,-1.1c-0.4,-0.2 -0.9,-0.1 -1.1,0.3l-3.9,6.7c-6.3,-2.8 -13.4,-2.8 -19.7,0l-3.9,-6.7c-0.2,-0.4 -0.7,-0.5 -1.1,-0.3C38.8,38.328 38.7,38.828 38.9,39.228l3.8,6.6C36.2,49.428 31.7,56.028 31,63.928h46C76.3,56.028 71.8,49.428 65.3,45.828zM43.4,57.328c-0.8,0 -1.5,-0.5 -1.8,-1.2c-0.3,-0.7 -0.1,-1.5 0.4,-2.1c0.5,-0.5 1.4,-0.7 2.1,-0.4c0.7,0.3 1.2,1 1.2,1.8C45.3,56.528 44.5,57.328 43.4,57.328L43.4,57.328zM64.6,57.328c-0.8,0 -1.5,-0.5 -1.8,-1.2s-0.1,-1.5 0.4,-2.1c0.5,-0.5 1.4,-0.7 2.1,-0.4c0.7,0.3 1.2,1 1.2,1.8C66.5,56.528 65.6,57.328 64.6,57.328L64.6,57.328z" + android:strokeWidth="1" + android:strokeColor="#00000000" /> +</vector> \ No newline at end of file diff --git a/app/src/main/res/drawable-v26/ic_launcher_background.xml b/app/src/main/res/drawable-v26/ic_launcher_background.xml deleted file mode 100644 index 70329d40c2b982a25258abcfcf5609c4c3ac749e..0000000000000000000000000000000000000000 --- a/app/src/main/res/drawable-v26/ic_launcher_background.xml +++ /dev/null @@ -1,27 +0,0 @@ -<!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<shape xmlns:android="http://schemas.android.com/apk/res/android" - android:shape="rectangle"> - <gradient - android:angle="270" - android:endColor="@color/colorIconDark" - android:startColor="@color/colorIconLight" - android:type="linear" /> -</shape> diff --git a/app/src/main/res/drawable-v26/ic_shortcut_channel.xml b/app/src/main/res/drawable-v26/ic_shortcut_channel.xml deleted file mode 100644 index c8cd28576805a11129dc88f9cb4d29fe160ba57b..0000000000000000000000000000000000000000 --- a/app/src/main/res/drawable-v26/ic_shortcut_channel.xml +++ /dev/null @@ -1,23 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android"> - <background android:drawable="@color/colorAccent" /> - <foreground android:drawable="@drawable/ic_shortcut_channel_foreground" /> -</adaptive-icon> diff --git a/app/src/main/res/drawable-v26/ic_shortcut_query.xml b/app/src/main/res/drawable-v26/ic_shortcut_query.xml deleted file mode 100644 index af383a0284a07e6c05ab7231070d0243e83faa36..0000000000000000000000000000000000000000 --- a/app/src/main/res/drawable-v26/ic_shortcut_query.xml +++ /dev/null @@ -1,23 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android"> - <background android:drawable="@color/colorPrimaryDark" /> - <foreground android:drawable="@drawable/ic_shortcut_query_foreground" /> -</adaptive-icon> diff --git a/app/src/main/res/drawable-xhdpi/ic_splash.png b/app/src/main/res/drawable-xhdpi/ic_splash.png deleted file mode 100644 index f208b7051960432c4ac5cb26150340d6f3f59912..0000000000000000000000000000000000000000 Binary files a/app/src/main/res/drawable-xhdpi/ic_splash.png and /dev/null differ diff --git a/app/src/main/res/drawable-xxhdpi/ic_splash.png b/app/src/main/res/drawable-xxhdpi/ic_splash.png deleted file mode 100644 index c94ce343cb92e07243c60e28b00cc5a32f1e7ed9..0000000000000000000000000000000000000000 Binary files a/app/src/main/res/drawable-xxhdpi/ic_splash.png and /dev/null differ diff --git a/app/src/main/res/drawable-xxxhdpi/ic_splash.png b/app/src/main/res/drawable-xxxhdpi/ic_splash.png deleted file mode 100644 index 1ddfb16cd7b91b25ef31cf07dc78602f005d586c..0000000000000000000000000000000000000000 Binary files a/app/src/main/res/drawable-xxxhdpi/ic_splash.png and /dev/null differ diff --git a/app/src/main/res/drawable/bg_badge.xml b/app/src/main/res/drawable/bg_badge.xml deleted file mode 100644 index 2ccf20f536f1d16c5cbacce9a96f647726b2f43b..0000000000000000000000000000000000000000 --- a/app/src/main/res/drawable/bg_badge.xml +++ /dev/null @@ -1,28 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<shape xmlns:android="http://schemas.android.com/apk/res/android"> - <corners android:radius="16dp" /> - <padding - android:bottom="4dp" - android:left="8dp" - android:right="8dp" - android:top="4dp" /> - <solid /> -</shape> diff --git a/app/src/main/res/drawable/bg_intro.xml b/app/src/main/res/drawable/bg_intro.xml deleted file mode 100644 index 9c60106951d10246cc58cc15b38a85a24ef5b33b..0000000000000000000000000000000000000000 --- a/app/src/main/res/drawable/bg_intro.xml +++ /dev/null @@ -1,53 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<vector xmlns:android="http://schemas.android.com/apk/res/android" - android:width="144dp" - android:height="81dp" - android:viewportWidth="1440" - android:viewportHeight="810"> - - <path - android:fillColor="#d7d7d7" - android:pathData="M 0 0 L 0 810 L 1440 810 L 1440 0 L 0 0 z" /> - <path - android:fillColor="#dcdcdc" - android:pathData="M 259.01562 810 L 1440 810 L 1440 0 L 745.32812 0 L 97.171875 648.15625 L 259.01562 810 z" /> - <path - android:fillColor="#e1e1e1" - android:pathData="M 556.24609 810 L 1440 810 L 1440 0 L 1366.2441 0 L 556.24609 810 z" /> - <path - android:fillColor="#e6e6e6" - android:pathData="M 644.31836 810 L 1440 810 L 1440 14.318359 L 644.31836 810 z" /> - <path - android:fillColor="#ebebeb" - android:pathData="M 1439.0195 810 L 1440 810 L 1440 270.47656 L 1169.748 540.72852 L 1439.0195 810z" /> - <path - android:fillColor="#f0f0f0" - android:pathData="M 900.47656 810 L 1440 810 L 1440 805.58203 L 1172.4473 538.0293 L 900.47656 810z" /> - <path - android:fillColor="#f5f5f5" - android:pathData="M 334.24023 0 L 0 0 L 0 810 L 1144.2402 810 L 334.24023 0 z" /> - <path - android:fillColor="#fafafa" - android:pathData="M 0 455.43359 L 0 810 L 354.56836 810 L 0 455.43359 z" /> - <path - android:fillColor="#ffffff" - android:pathData="M 0 536.39453 L 0 810 L 273.60547 810 L 0 536.39453 z" /> -</vector> diff --git a/app/src/main/res/drawable/bg_menuitem_dark.xml b/app/src/main/res/drawable/bg_menuitem_dark.xml deleted file mode 100644 index f535f846684497ce20e43a828b57f511235afd96..0000000000000000000000000000000000000000 --- a/app/src/main/res/drawable/bg_menuitem_dark.xml +++ /dev/null @@ -1,31 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<selector xmlns:android="http://schemas.android.com/apk/res/android"> - <item android:state_selected="true"> - <shape android:shape="rectangle"> - <solid android:color="@color/ripple_dark" /> - </shape> - </item> - <item android:state_pressed="true"> - <shape android:shape="rectangle"> - <solid android:color="@color/ripple_dark" /> - </shape> - </item> -</selector> diff --git a/app/src/main/res/drawable/bg_menuitem_light.xml b/app/src/main/res/drawable/bg_menuitem_light.xml deleted file mode 100644 index 33dc5abe5aba98dce0ff57b011ecdc2329c9c504..0000000000000000000000000000000000000000 --- a/app/src/main/res/drawable/bg_menuitem_light.xml +++ /dev/null @@ -1,31 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<selector xmlns:android="http://schemas.android.com/apk/res/android"> - <item android:state_selected="true"> - <shape android:shape="rectangle"> - <solid android:color="@color/ripple_light" /> - </shape> - </item> - <item android:state_pressed="true"> - <shape android:shape="rectangle"> - <solid android:color="@color/ripple_light" /> - </shape> - </item> -</selector> diff --git a/app/src/main/res/drawable/bg_menuitem_rounded_dark.xml b/app/src/main/res/drawable/bg_menuitem_rounded_dark.xml deleted file mode 100644 index d632e1afb8b208099c575b0cd4ac8578e2bace9b..0000000000000000000000000000000000000000 --- a/app/src/main/res/drawable/bg_menuitem_rounded_dark.xml +++ /dev/null @@ -1,33 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<selector xmlns:android="http://schemas.android.com/apk/res/android"> - <item android:state_selected="true"> - <shape android:shape="rectangle"> - <corners android:radius="@dimen/button_corner_radius" /> - <solid android:color="@color/ripple_dark" /> - </shape> - </item> - <item android:state_pressed="true"> - <shape android:shape="rectangle"> - <corners android:radius="@dimen/button_corner_radius" /> - <solid android:color="@color/ripple_dark" /> - </shape> - </item> -</selector> diff --git a/app/src/main/res/drawable/bg_menuitem_rounded_light.xml b/app/src/main/res/drawable/bg_menuitem_rounded_light.xml deleted file mode 100644 index cc57283dd3f5adb684599c30b69ea90a8e028e77..0000000000000000000000000000000000000000 --- a/app/src/main/res/drawable/bg_menuitem_rounded_light.xml +++ /dev/null @@ -1,33 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<selector xmlns:android="http://schemas.android.com/apk/res/android"> - <item android:state_selected="true"> - <shape android:shape="rectangle"> - <corners android:radius="@dimen/button_corner_radius" /> - <solid android:color="@color/ripple_light" /> - </shape> - </item> - <item android:state_pressed="true"> - <shape android:shape="rectangle"> - <corners android:radius="@dimen/button_corner_radius" /> - <solid android:color="@color/ripple_light" /> - </shape> - </item> -</selector> diff --git a/app/src/main/res/drawable/bg_splash.xml b/app/src/main/res/drawable/bg_splash.xml deleted file mode 100644 index 7827ef27f53ff662138a9997521d9ae45e4e6724..0000000000000000000000000000000000000000 --- a/app/src/main/res/drawable/bg_splash.xml +++ /dev/null @@ -1,27 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<layer-list xmlns:android="http://schemas.android.com/apk/res/android"> - <item android:drawable="@color/colorPrimary" /> - <item> - <bitmap - android:gravity="center" - android:src="@drawable/ic_splash" /> - </item> -</layer-list> diff --git a/app/src/main/res/drawable/bg_transparent.xml b/app/src/main/res/drawable/bg_transparent.xml deleted file mode 100644 index 6ab46ccd08845d78a150a5af6f5cb9145fd842be..0000000000000000000000000000000000000000 --- a/app/src/main/res/drawable/bg_transparent.xml +++ /dev/null @@ -1,23 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<shape xmlns:android="http://schemas.android.com/apk/res/android" - android:shape="rectangle"> - <solid android:color="@android:color/transparent" /> -</shape> diff --git a/app/src/main/res/drawable/ic_account.xml b/app/src/main/res/drawable/ic_account.xml deleted file mode 100644 index e5584881aae6bc397b185dcc6ad54e1d0c79e651..0000000000000000000000000000000000000000 --- a/app/src/main/res/drawable/ic_account.xml +++ /dev/null @@ -1,28 +0,0 @@ -<!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<vector xmlns:android="http://schemas.android.com/apk/res/android" - android:width="24dp" - android:height="24dp" - android:viewportWidth="24" - android:viewportHeight="24"> - <path - android:fillColor="#000" - android:pathData="M12,4A4,4 0 0,1 16,8A4,4 0 0,1 12,12A4,4 0 0,1 8,8A4,4 0 0,1 12,4M12,14C16.42,14 20,15.79 20,18V20H4V18C4,15.79 7.58,14 12,14Z" /> -</vector> diff --git a/app/src/main/res/drawable/ic_account_card.xml b/app/src/main/res/drawable/ic_account_card.xml deleted file mode 100644 index a64101ca997426fb413b0730c6a854a25b8a20c5..0000000000000000000000000000000000000000 --- a/app/src/main/res/drawable/ic_account_card.xml +++ /dev/null @@ -1,28 +0,0 @@ -<!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<vector xmlns:android="http://schemas.android.com/apk/res/android" - android:width="24dp" - android:height="24dp" - android:viewportWidth="24" - android:viewportHeight="24"> - <path - android:fillColor="#000" - android:pathData="M2,3H22C23.05,3 24,3.95 24,5V19C24,20.05 23.05,21 22,21H2C0.95,21 0,20.05 0,19V5C0,3.95 0.95,3 2,3M14,6V7H22V6H14M14,8V9H21.5L22,9V8H14M14,10V11H21V10H14M8,13.91C6,13.91 2,15 2,17V18H14V17C14,15 10,13.91 8,13.91M8,6A3,3 0 0,0 5,9A3,3 0 0,0 8,12A3,3 0 0,0 11,9A3,3 0 0,0 8,6Z" /> -</vector> diff --git a/app/src/main/res/drawable/ic_account_minus.xml b/app/src/main/res/drawable/ic_account_minus.xml deleted file mode 100644 index 82a3d7e5b647469ae3f8d1e1a624f35a8bbe0349..0000000000000000000000000000000000000000 --- a/app/src/main/res/drawable/ic_account_minus.xml +++ /dev/null @@ -1,28 +0,0 @@ -<!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<vector xmlns:android="http://schemas.android.com/apk/res/android" - android:width="24dp" - android:height="24dp" - android:viewportWidth="24" - android:viewportHeight="24"> - <path - android:fillColor="#000" - android:pathData="M15,14C12.33,14 7,15.33 7,18V20H23V18C23,15.33 17.67,14 15,14M1,10V12H9V10M15,12A4,4 0 0,0 19,8A4,4 0 0,0 15,4A4,4 0 0,0 11,8A4,4 0 0,0 15,12Z" /> -</vector> diff --git a/app/src/main/res/drawable/ic_account_multiple.xml b/app/src/main/res/drawable/ic_account_multiple.xml deleted file mode 100644 index d57eda3aed3332ddeb6c91c6cb4dc4ac284b553e..0000000000000000000000000000000000000000 --- a/app/src/main/res/drawable/ic_account_multiple.xml +++ /dev/null @@ -1,28 +0,0 @@ -<!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<vector xmlns:android="http://schemas.android.com/apk/res/android" - android:width="24dp" - android:height="24dp" - android:viewportWidth="24" - android:viewportHeight="24"> - <path - android:fillColor="#000" - android:pathData="M16,13C15.71,13 15.38,13 15.03,13.05C16.19,13.89 17,15 17,16.5V19H23V16.5C23,14.17 18.33,13 16,13M8,13C5.67,13 1,14.17 1,16.5V19H15V16.5C15,14.17 10.33,13 8,13M8,11A3,3 0 0,0 11,8A3,3 0 0,0 8,5A3,3 0 0,0 5,8A3,3 0 0,0 8,11M16,11A3,3 0 0,0 19,8A3,3 0 0,0 16,5A3,3 0 0,0 13,8A3,3 0 0,0 16,11Z" /> -</vector> diff --git a/app/src/main/res/drawable/ic_account_plus.xml b/app/src/main/res/drawable/ic_account_plus.xml deleted file mode 100644 index 61308fe964a6e4f0ce6914d5c179e0d516f8f071..0000000000000000000000000000000000000000 --- a/app/src/main/res/drawable/ic_account_plus.xml +++ /dev/null @@ -1,28 +0,0 @@ -<!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<vector xmlns:android="http://schemas.android.com/apk/res/android" - android:width="24dp" - android:height="24dp" - android:viewportWidth="24" - android:viewportHeight="24"> - <path - android:fillColor="#000" - android:pathData="M15,14C12.33,14 7,15.33 7,18V20H23V18C23,15.33 17.67,14 15,14M6,10V7H4V10H1V12H4V15H6V12H9V10M15,12A4,4 0 0,0 19,8A4,4 0 0,0 15,4A4,4 0 0,0 11,8A4,4 0 0,0 15,12Z" /> -</vector> diff --git a/app/src/main/res/drawable/ic_add.xml b/app/src/main/res/drawable/ic_add.xml deleted file mode 100644 index a061141b48f486e50da9bf9fda1fc10b87e10d3e..0000000000000000000000000000000000000000 --- a/app/src/main/res/drawable/ic_add.xml +++ /dev/null @@ -1,28 +0,0 @@ -<!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<vector xmlns:android="http://schemas.android.com/apk/res/android" - android:width="24dp" - android:height="24dp" - android:viewportWidth="24" - android:viewportHeight="24"> - <path - android:fillColor="#fff" - android:pathData="M19,13H13V19H11V13H5V11H11V5H13V11H19V13Z" /> -</vector> diff --git a/app/src/main/res/drawable/ic_alert.xml b/app/src/main/res/drawable/ic_alert.xml deleted file mode 100644 index 2ee2859623d0d782dbbf70db9c31e464003894cf..0000000000000000000000000000000000000000 --- a/app/src/main/res/drawable/ic_alert.xml +++ /dev/null @@ -1,28 +0,0 @@ -<!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<vector xmlns:android="http://schemas.android.com/apk/res/android" - android:width="24dp" - android:height="24dp" - android:viewportWidth="24" - android:viewportHeight="24"> - <path - android:fillColor="#000" - android:pathData="M13,14H11V10H13M13,18H11V16H13M1,21H23L12,2L1,21Z" /> -</vector> diff --git a/app/src/main/res/drawable/ic_arrow_right.xml b/app/src/main/res/drawable/ic_arrow_right.xml deleted file mode 100644 index cec2a5ce1558706e2b6fd89897500a9eec59f17a..0000000000000000000000000000000000000000 --- a/app/src/main/res/drawable/ic_arrow_right.xml +++ /dev/null @@ -1,28 +0,0 @@ -<!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<vector xmlns:android="http://schemas.android.com/apk/res/android" - android:width="24dp" - android:height="24dp" - android:viewportWidth="24" - android:viewportHeight="24"> - <path - android:fillColor="#000" - android:pathData="M4,11V13H16L10.5,18.5L11.92,19.92L19.84,12L11.92,4.08L10.5,5.5L16,11H4Z" /> -</vector> diff --git a/app/src/main/res/drawable/ic_bell.xml b/app/src/main/res/drawable/ic_bell.xml deleted file mode 100644 index 2bac5f160145537505d9ce7b30707abd14e99a8f..0000000000000000000000000000000000000000 --- a/app/src/main/res/drawable/ic_bell.xml +++ /dev/null @@ -1,28 +0,0 @@ -<!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<vector xmlns:android="http://schemas.android.com/apk/res/android" - android:width="24dp" - android:height="24dp" - android:viewportWidth="24" - android:viewportHeight="24"> - <path - android:fillColor="#000" - android:pathData="M12,22A2,2 0 0,0 14,20H10A2,2 0 0,0 12,22M18,16V11C18,7.93 16.36,5.36 13.5,4.68V4A1.5,1.5 0 0,0 12,2.5A1.5,1.5 0 0,0 10.5,4V4.68C7.63,5.36 6,7.92 6,11V16L4,18V19H20V18L18,16Z" /> -</vector> diff --git a/app/src/main/res/drawable/ic_channel.xml b/app/src/main/res/drawable/ic_channel.xml deleted file mode 100644 index 090ce1c9bb6bee2e085614f033bf29802d13ad88..0000000000000000000000000000000000000000 --- a/app/src/main/res/drawable/ic_channel.xml +++ /dev/null @@ -1,28 +0,0 @@ -<!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<vector xmlns:android="http://schemas.android.com/apk/res/android" - android:width="24dp" - android:height="24dp" - android:viewportWidth="24" - android:viewportHeight="24"> - <path - android:fillColor="#000" - android:pathData="M5.41,21L6.12,17H2.12L2.47,15H6.47L7.53,9H3.53L3.88,7H7.88L8.59,3H10.59L9.88,7H15.88L16.59,3H18.59L17.88,7H21.88L21.53,9H17.53L16.47,15H20.47L20.12,17H16.12L15.41,21H13.41L14.12,17H8.12L7.41,21H5.41M9.53,9L8.47,15H14.47L15.53,9H9.53Z" /> -</vector> diff --git a/app/src/main/res/drawable/ic_check.xml b/app/src/main/res/drawable/ic_check.xml deleted file mode 100644 index aa25f4b5da4f8beef2520fb790d29f193992e97c..0000000000000000000000000000000000000000 --- a/app/src/main/res/drawable/ic_check.xml +++ /dev/null @@ -1,28 +0,0 @@ -<!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<vector xmlns:android="http://schemas.android.com/apk/res/android" - android:width="24dp" - android:height="24dp" - android:viewportWidth="24" - android:viewportHeight="24"> - <path - android:fillColor="#000" - android:pathData="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z" /> -</vector> diff --git a/app/src/main/res/drawable/ic_chevron_down.xml b/app/src/main/res/drawable/ic_chevron_down.xml deleted file mode 100644 index 671af433d6acac65a331fbeb6cf5de667138dcd5..0000000000000000000000000000000000000000 --- a/app/src/main/res/drawable/ic_chevron_down.xml +++ /dev/null @@ -1,28 +0,0 @@ -<!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<vector xmlns:android="http://schemas.android.com/apk/res/android" - android:width="24dp" - android:height="24dp" - android:viewportWidth="24" - android:viewportHeight="24"> - <path - android:fillColor="#000" - android:pathData="M7.41,8.58L12,13.17L16.59,8.58L18,10L12,16L6,10L7.41,8.58Z" /> -</vector> diff --git a/app/src/main/res/drawable/ic_chevron_up.xml b/app/src/main/res/drawable/ic_chevron_up.xml deleted file mode 100644 index 9f1157df2fb8f3d7a32ef68308a303dc3e283e12..0000000000000000000000000000000000000000 --- a/app/src/main/res/drawable/ic_chevron_up.xml +++ /dev/null @@ -1,28 +0,0 @@ -<!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<vector xmlns:android="http://schemas.android.com/apk/res/android" - android:width="24dp" - android:height="24dp" - android:viewportWidth="24" - android:viewportHeight="24"> - <path - android:fillColor="#000" - android:pathData="M7.41,15.41L12,10.83L16.59,15.41L18,14L12,8L6,14L7.41,15.41Z" /> -</vector> diff --git a/app/src/main/res/drawable/ic_clock.xml b/app/src/main/res/drawable/ic_clock.xml deleted file mode 100644 index 798394b7d246b00bfd96f3704a2c0383be572f1a..0000000000000000000000000000000000000000 --- a/app/src/main/res/drawable/ic_clock.xml +++ /dev/null @@ -1,28 +0,0 @@ -<!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<vector xmlns:android="http://schemas.android.com/apk/res/android" - android:width="24dp" - android:height="24dp" - android:viewportWidth="24" - android:viewportHeight="24"> - <path - android:fillColor="#000" - android:pathData="M12,20A8,8 0 0,0 20,12A8,8 0 0,0 12,4A8,8 0 0,0 4,12A8,8 0 0,0 12,20M12,2A10,10 0 0,1 22,12A10,10 0 0,1 12,22C6.47,22 2,17.5 2,12A10,10 0 0,1 12,2M12.5,7V12.25L17,14.92L16.25,16.15L11,13V7H12.5Z" /> -</vector> diff --git a/app/src/main/res/drawable/ic_close.xml b/app/src/main/res/drawable/ic_close.xml deleted file mode 100644 index ebccb731f12de13742defe635feba94d885a369a..0000000000000000000000000000000000000000 --- a/app/src/main/res/drawable/ic_close.xml +++ /dev/null @@ -1,28 +0,0 @@ -<!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<vector xmlns:android="http://schemas.android.com/apk/res/android" - android:width="24dp" - android:height="24dp" - android:viewportWidth="24" - android:viewportHeight="24"> - <path - android:fillColor="#000" - android:pathData="M19,6.41L17.59,5L12,10.59L6.41,5L5,6.41L10.59,12L5,17.59L6.41,19L12,13.41L17.59,19L19,17.59L13.41,12L19,6.41Z" /> -</vector> diff --git a/app/src/main/res/drawable/ic_copy.xml b/app/src/main/res/drawable/ic_copy.xml deleted file mode 100644 index 65e6c2c5890fd5e22d3893fc397f42c8e2d12640..0000000000000000000000000000000000000000 --- a/app/src/main/res/drawable/ic_copy.xml +++ /dev/null @@ -1,28 +0,0 @@ -<!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<vector xmlns:android="http://schemas.android.com/apk/res/android" - android:width="24dp" - android:height="24dp" - android:viewportWidth="24" - android:viewportHeight="24"> - <path - android:fillColor="#000" - android:pathData="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z" /> -</vector> diff --git a/app/src/main/res/drawable/ic_debug.xml b/app/src/main/res/drawable/ic_debug.xml deleted file mode 100644 index d35945533aeffff7d55576744ba8197093be16f9..0000000000000000000000000000000000000000 --- a/app/src/main/res/drawable/ic_debug.xml +++ /dev/null @@ -1,28 +0,0 @@ -<!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<vector xmlns:android="http://schemas.android.com/apk/res/android" - android:width="24dp" - android:height="24dp" - android:viewportWidth="24" - android:viewportHeight="24"> - <path - android:fillColor="#000" - android:pathData="M14,12H10V10H14M14,16H10V14H14M20,8H17.19C16.74,7.22 16.12,6.55 15.37,6.04L17,4.41L15.59,3L13.42,5.17C12.96,5.06 12.5,5 12,5C11.5,5 11.04,5.06 10.59,5.17L8.41,3L7,4.41L8.62,6.04C7.88,6.55 7.26,7.22 6.81,8H4V10H6.09C6.04,10.33 6,10.66 6,11V12H4V14H6V15C6,15.34 6.04,15.67 6.09,16H4V18H6.81C7.85,19.79 9.78,21 12,21C14.22,21 16.15,19.79 17.19,18H20V16H17.91C17.96,15.67 18,15.34 18,15V14H20V12H18V11C18,10.66 17.96,10.33 17.91,10H20V8Z" /> -</vector> diff --git a/app/src/main/res/drawable/ic_delete.xml b/app/src/main/res/drawable/ic_delete.xml deleted file mode 100644 index edcca949a9312a284c7a3a39b6862b82dbc64369..0000000000000000000000000000000000000000 --- a/app/src/main/res/drawable/ic_delete.xml +++ /dev/null @@ -1,28 +0,0 @@ -<!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<vector xmlns:android="http://schemas.android.com/apk/res/android" - android:width="24dp" - android:height="24dp" - android:viewportWidth="24" - android:viewportHeight="24"> - <path - android:fillColor="#000" - android:pathData="M19,4H15.5L14.5,3H9.5L8.5,4H5V6H19M6,19A2,2 0 0,0 8,21H16A2,2 0 0,0 18,19V7H6V19Z" /> -</vector> diff --git a/app/src/main/res/drawable/ic_disconnected.xml b/app/src/main/res/drawable/ic_disconnected.xml deleted file mode 100644 index 6e979f185d3b7902bbcdcfc96bc33eda1c1fff2d..0000000000000000000000000000000000000000 --- a/app/src/main/res/drawable/ic_disconnected.xml +++ /dev/null @@ -1,28 +0,0 @@ -<!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<vector xmlns:android="http://schemas.android.com/apk/res/android" - android:width="24dp" - android:height="24dp" - android:viewportWidth="24" - android:viewportHeight="24"> - <path - android:fillColor="#000" - android:pathData="M19,17H21V9H19M19,21H21V19H19M1,21H17V7H21V1" /> -</vector> diff --git a/app/src/main/res/drawable/ic_domain.xml b/app/src/main/res/drawable/ic_domain.xml deleted file mode 100644 index 728a9553584aae100172d3a742b9de0327f50d16..0000000000000000000000000000000000000000 --- a/app/src/main/res/drawable/ic_domain.xml +++ /dev/null @@ -1,28 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<vector xmlns:android="http://schemas.android.com/apk/res/android" - android:width="24dp" - android:height="24dp" - android:viewportWidth="24" - android:viewportHeight="24"> - <path - android:fillColor="#000" - android:pathData="M18,15H16V17H18M18,11H16V13H18M20,19H12V17H14V15H12V13H14V11H12V9H20M10,7H8V5H10M10,11H8V9H10M10,15H8V13H10M10,19H8V17H10M6,7H4V5H6M6,11H4V9H6M6,15H4V13H6M6,19H4V17H6M12,7V3H2V21H22V7H12Z" /> -</vector> diff --git a/app/src/main/res/drawable/ic_drawer_toggle.xml b/app/src/main/res/drawable/ic_drawer_toggle.xml deleted file mode 100644 index 081693c69cf08fcac1abd576076cb5ff32447477..0000000000000000000000000000000000000000 --- a/app/src/main/res/drawable/ic_drawer_toggle.xml +++ /dev/null @@ -1,34 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<vector xmlns:android="http://schemas.android.com/apk/res/android" - android:width="24dp" - android:height="24dp" - android:viewportWidth="24" - android:viewportHeight="24"> - <path - android:fillColor="#000" - android:pathData=" - M20,6 a-1,1 0 0,0 1,1 a-1,1 0 0,0 -1,1 l -16,0 a-1,1 0 0,0 -1,-1 a-1,1 0 0,0 1,-1Z - M20,11 a-1,1 0 0,0 1,1 a-1,1 0 0,0 -1,1 l -16,0 a-1,1 0 0,0 -1,-1 a-1,1 0 0,0 1,-1Z - M20,16 a-1,1 0 0,0 1,1 a-1,1 0 0,0 -1,1 l -16,0 a-1,1 0 0,0 -1,-1 a-1,1 0 0,0 1,-1Z" /> - <path - android:fillColor="#f00" - android:pathData="M16,17 16,23 A1,1 0 0,0 17,24 L 23,24 A1,1 0 0,0 24,23 L 24,17 A1,1 0 0,0 23,16 L 17,16 A1,1 0 0,0 16,17" /> -</vector> diff --git a/app/src/main/res/drawable/ic_eye.xml b/app/src/main/res/drawable/ic_eye.xml deleted file mode 100644 index d9816f6e1abcc0130c1bdf6e76a0921aee9e5cd6..0000000000000000000000000000000000000000 --- a/app/src/main/res/drawable/ic_eye.xml +++ /dev/null @@ -1,28 +0,0 @@ -<!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<vector xmlns:android="http://schemas.android.com/apk/res/android" - android:width="24dp" - android:height="24dp" - android:viewportWidth="24" - android:viewportHeight="24"> - <path - android:fillColor="#000" - android:pathData="M12,9A3,3 0 0,0 9,12A3,3 0 0,0 12,15A3,3 0 0,0 15,12A3,3 0 0,0 12,9M12,17A5,5 0 0,1 7,12A5,5 0 0,1 12,7A5,5 0 0,1 17,12A5,5 0 0,1 12,17M12,4.5C7,4.5 2.73,7.61 1,12C2.73,16.39 7,19.5 12,19.5C17,19.5 21.27,16.39 23,12C21.27,7.61 17,4.5 12,4.5Z" /> -</vector> diff --git a/app/src/main/res/drawable/ic_eye_off.xml b/app/src/main/res/drawable/ic_eye_off.xml deleted file mode 100644 index 0cbcd1249fe3b6186a4f8cd609d0c399364ae47d..0000000000000000000000000000000000000000 --- a/app/src/main/res/drawable/ic_eye_off.xml +++ /dev/null @@ -1,28 +0,0 @@ -<!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<vector xmlns:android="http://schemas.android.com/apk/res/android" - android:width="24dp" - android:height="24dp" - android:viewportWidth="24" - android:viewportHeight="24"> - <path - android:fillColor="#000" - android:pathData="M11.83,9L15,12.16C15,12.11 15,12.05 15,12A3,3 0 0,0 12,9C11.94,9 11.89,9 11.83,9M7.53,9.8L9.08,11.35C9.03,11.56 9,11.77 9,12A3,3 0 0,0 12,15C12.22,15 12.44,14.97 12.65,14.92L14.2,16.47C13.53,16.8 12.79,17 12,17A5,5 0 0,1 7,12C7,11.21 7.2,10.47 7.53,9.8M2,4.27L4.28,6.55L4.73,7C3.08,8.3 1.78,10 1,12C2.73,16.39 7,19.5 12,19.5C13.55,19.5 15.03,19.2 16.38,18.66L16.81,19.08L19.73,22L21,20.73L3.27,3M12,7A5,5 0 0,1 17,12C17,12.64 16.87,13.26 16.64,13.82L19.57,16.75C21.07,15.5 22.27,13.86 23,12C21.27,7.61 17,4.5 12,4.5C10.6,4.5 9.26,4.75 8,5.2L10.17,7.35C10.74,7.13 11.35,7 12,7Z" /> -</vector> diff --git a/app/src/main/res/drawable/ic_filter.xml b/app/src/main/res/drawable/ic_filter.xml deleted file mode 100644 index fd5f993a26e27b56d45798e53530bd02959d23aa..0000000000000000000000000000000000000000 --- a/app/src/main/res/drawable/ic_filter.xml +++ /dev/null @@ -1,28 +0,0 @@ -<!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<vector xmlns:android="http://schemas.android.com/apk/res/android" - android:width="24dp" - android:height="24dp" - android:viewportWidth="24" - android:viewportHeight="24"> - <path - android:fillColor="#000" - android:pathData="M3,2H21V2H21V4H20.92L14,10.92V22.91L10,18.91V10.91L3.09,4H3V2Z" /> -</vector> diff --git a/app/src/main/res/drawable/ic_fingerprint.xml b/app/src/main/res/drawable/ic_fingerprint.xml deleted file mode 100644 index 0458596a266fb9cc70d3d49215ea6df3f323cbc3..0000000000000000000000000000000000000000 --- a/app/src/main/res/drawable/ic_fingerprint.xml +++ /dev/null @@ -1,30 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<vector xmlns:android="http://schemas.android.com/apk/res/android" - xmlns:tools="http://schemas.android.com/tools" - android:width="24dp" - android:height="24dp" - android:viewportWidth="24" - android:viewportHeight="24" - tools:ignore="VectorPath"> - <path - android:fillColor="#000" - android:pathData="M17.81,4.47C17.73,4.47 17.65,4.45 17.58,4.41C15.66,3.42 14,3 12,3C10.03,3 8.15,3.47 6.44,4.41C6.2,4.54 5.9,4.45 5.76,4.21C5.63,3.97 5.72,3.66 5.96,3.53C7.82,2.5 9.86,2 12,2C14.14,2 16,2.47 18.04,3.5C18.29,3.65 18.38,3.95 18.25,4.19C18.16,4.37 18,4.47 17.81,4.47M3.5,9.72C3.4,9.72 3.3,9.69 3.21,9.63C3,9.47 2.93,9.16 3.09,8.93C4.08,7.53 5.34,6.43 6.84,5.66C10,4.04 14,4.03 17.15,5.65C18.65,6.42 19.91,7.5 20.9,8.9C21.06,9.12 21,9.44 20.78,9.6C20.55,9.76 20.24,9.71 20.08,9.5C19.18,8.22 18.04,7.23 16.69,6.54C13.82,5.07 10.15,5.07 7.29,6.55C5.93,7.25 4.79,8.25 3.89,9.5C3.81,9.65 3.66,9.72 3.5,9.72M9.75,21.79C9.62,21.79 9.5,21.74 9.4,21.64C8.53,20.77 8.06,20.21 7.39,19C6.7,17.77 6.34,16.27 6.34,14.66C6.34,11.69 8.88,9.27 12,9.27C15.12,9.27 17.66,11.69 17.66,14.66A0.5,0.5 0 0,1 17.16,15.16A0.5,0.5 0 0,1 16.66,14.66C16.66,12.24 14.57,10.27 12,10.27C9.43,10.27 7.34,12.24 7.34,14.66C7.34,16.1 7.66,17.43 8.27,18.5C8.91,19.66 9.35,20.15 10.12,20.93C10.31,21.13 10.31,21.44 10.12,21.64C10,21.74 9.88,21.79 9.75,21.79M16.92,19.94C15.73,19.94 14.68,19.64 13.82,19.05C12.33,18.04 11.44,16.4 11.44,14.66A0.5,0.5 0 0,1 11.94,14.16A0.5,0.5 0 0,1 12.44,14.66C12.44,16.07 13.16,17.4 14.38,18.22C15.09,18.7 15.92,18.93 16.92,18.93C17.16,18.93 17.56,18.9 17.96,18.83C18.23,18.78 18.5,18.96 18.54,19.24C18.59,19.5 18.41,19.77 18.13,19.82C17.56,19.93 17.06,19.94 16.92,19.94M14.91,22C14.87,22 14.82,22 14.78,22C13.19,21.54 12.15,20.95 11.06,19.88C9.66,18.5 8.89,16.64 8.89,14.66C8.89,13.04 10.27,11.72 11.97,11.72C13.67,11.72 15.05,13.04 15.05,14.66C15.05,15.73 16,16.6 17.13,16.6C18.28,16.6 19.21,15.73 19.21,14.66C19.21,10.89 15.96,7.83 11.96,7.83C9.12,7.83 6.5,9.41 5.35,11.86C4.96,12.67 4.76,13.62 4.76,14.66C4.76,15.44 4.83,16.67 5.43,18.27C5.53,18.53 5.4,18.82 5.14,18.91C4.88,19 4.59,18.87 4.5,18.62C4,17.31 3.77,16 3.77,14.66C3.77,13.46 4,12.37 4.45,11.42C5.78,8.63 8.73,6.82 11.96,6.82C16.5,6.82 20.21,10.33 20.21,14.65C20.21,16.27 18.83,17.59 17.13,17.59C15.43,17.59 14.05,16.27 14.05,14.65C14.05,13.58 13.12,12.71 11.97,12.71C10.82,12.71 9.89,13.58 9.89,14.65C9.89,16.36 10.55,17.96 11.76,19.16C12.71,20.1 13.62,20.62 15.03,21C15.3,21.08 15.45,21.36 15.38,21.62C15.33,21.85 15.12,22 14.91,22Z" /> -</vector> diff --git a/app/src/main/res/drawable/ic_format_background.xml b/app/src/main/res/drawable/ic_format_background.xml deleted file mode 100644 index 3bc32ac5a83f85c81d9a5ac34d54048dadf414cb..0000000000000000000000000000000000000000 --- a/app/src/main/res/drawable/ic_format_background.xml +++ /dev/null @@ -1,28 +0,0 @@ -<!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<vector xmlns:android="http://schemas.android.com/apk/res/android" - android:width="24dp" - android:height="24dp" - android:viewportWidth="24" - android:viewportHeight="24"> - <path - android:fillColor="#000" - android:pathData="M19,11.5C19,11.5 17,13.67 17,15A2,2 0 0,0 19,17A2,2 0 0,0 21,15C21,13.67 19,11.5 19,11.5M5.21,10L10,5.21L14.79,10M16.56,8.94L7.62,0L6.21,1.41L8.59,3.79L3.44,8.94C2.85,9.5 2.85,10.47 3.44,11.06L8.94,16.56C9.23,16.85 9.62,17 10,17C10.38,17 10.77,16.85 11.06,16.56L16.56,11.06C17.15,10.47 17.15,9.5 16.56,8.94Z" /> -</vector> diff --git a/app/src/main/res/drawable/ic_format_bold.xml b/app/src/main/res/drawable/ic_format_bold.xml deleted file mode 100644 index 722cd36ed759181a6fa45cf0326004b08fd293db..0000000000000000000000000000000000000000 --- a/app/src/main/res/drawable/ic_format_bold.xml +++ /dev/null @@ -1,28 +0,0 @@ -<!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<vector xmlns:android="http://schemas.android.com/apk/res/android" - android:width="24dp" - android:height="24dp" - android:viewportWidth="24" - android:viewportHeight="24"> - <path - android:fillColor="#000" - android:pathData="M13.5,15.5H10V12.5H13.5A1.5,1.5 0 0,1 15,14A1.5,1.5 0 0,1 13.5,15.5M10,6.5H13A1.5,1.5 0 0,1 14.5,8A1.5,1.5 0 0,1 13,9.5H10M15.6,10.79C16.57,10.11 17.25,9 17.25,8C17.25,5.74 15.5,4 13.25,4H7V18H14.04C16.14,18 17.75,16.3 17.75,14.21C17.75,12.69 16.89,11.39 15.6,10.79Z" /> -</vector> diff --git a/app/src/main/res/drawable/ic_format_clear.xml b/app/src/main/res/drawable/ic_format_clear.xml deleted file mode 100644 index 2de0b97ca46290446c202976b7d6a3739fbf024b..0000000000000000000000000000000000000000 --- a/app/src/main/res/drawable/ic_format_clear.xml +++ /dev/null @@ -1,28 +0,0 @@ -<!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<vector xmlns:android="http://schemas.android.com/apk/res/android" - android:width="24dp" - android:height="24dp" - android:viewportWidth="24" - android:viewportHeight="24"> - <path - android:fillColor="#000" - android:pathData="M6,5V5.18L8.82,8H11.22L10.5,9.68L12.6,11.78L14.21,8H20V5H6M3.27,5L2,6.27L8.97,13.24L6.5,19H9.5L11.07,15.34L16.73,21L18,19.73L3.55,5.27L3.27,5Z" /> -</vector> diff --git a/app/src/main/res/drawable/ic_format_foreground.xml b/app/src/main/res/drawable/ic_format_foreground.xml deleted file mode 100644 index 82a5717d1370247472efd38d3bf0b7d0ef25fe24..0000000000000000000000000000000000000000 --- a/app/src/main/res/drawable/ic_format_foreground.xml +++ /dev/null @@ -1,28 +0,0 @@ -<!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<vector xmlns:android="http://schemas.android.com/apk/res/android" - android:width="24dp" - android:height="24dp" - android:viewportWidth="24" - android:viewportHeight="24"> - <path - android:fillColor="#000" - android:pathData="M9.62,12L12,5.67L14.37,12M11,3L5.5,17H7.75L8.87,14H15.12L16.25,17H18.5L13,3H11Z" /> -</vector> diff --git a/app/src/main/res/drawable/ic_format_italic.xml b/app/src/main/res/drawable/ic_format_italic.xml deleted file mode 100644 index 2e3d9705d8aaab9e8e6b426febb528c630e2928b..0000000000000000000000000000000000000000 --- a/app/src/main/res/drawable/ic_format_italic.xml +++ /dev/null @@ -1,28 +0,0 @@ -<!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<vector xmlns:android="http://schemas.android.com/apk/res/android" - android:width="24dp" - android:height="24dp" - android:viewportWidth="24" - android:viewportHeight="24"> - <path - android:fillColor="#000" - android:pathData="M10,4V7H12.21L8.79,15H6V18H14V15H11.79L15.21,7H18V4H10Z" /> -</vector> diff --git a/app/src/main/res/drawable/ic_format_monospace.xml b/app/src/main/res/drawable/ic_format_monospace.xml deleted file mode 100644 index c94b1887a4991c98e101b1ee422d8c1b67f9bc1b..0000000000000000000000000000000000000000 --- a/app/src/main/res/drawable/ic_format_monospace.xml +++ /dev/null @@ -1,28 +0,0 @@ -<!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<vector xmlns:android="http://schemas.android.com/apk/res/android" - android:width="24dp" - android:height="24dp" - android:viewportWidth="24" - android:viewportHeight="24"> - <path - android:fillColor="#000" - android:pathData="M14.6,16.6L19.2,12L14.6,7.4L16,6L22,12L16,18L14.6,16.6M9.4,16.6L4.8,12L9.4,7.4L8,6L2,12L8,18L9.4,16.6Z" /> -</vector> diff --git a/app/src/main/res/drawable/ic_format_strikethrough.xml b/app/src/main/res/drawable/ic_format_strikethrough.xml deleted file mode 100644 index 33c12f8267b9e7549a62e361a018f292fa8279b4..0000000000000000000000000000000000000000 --- a/app/src/main/res/drawable/ic_format_strikethrough.xml +++ /dev/null @@ -1,28 +0,0 @@ -<!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<vector xmlns:android="http://schemas.android.com/apk/res/android" - android:width="24dp" - android:height="24dp" - android:viewportWidth="24" - android:viewportHeight="24"> - <path - android:fillColor="#000" - android:pathData="M23,12V14H18.61C19.61,16.14 19.56,22 12.38,22C4.05,22.05 4.37,15.5 4.37,15.5L8.34,15.55C8.37,18.92 11.5,18.92 12.12,18.88C12.76,18.83 15.15,18.84 15.34,16.5C15.42,15.41 14.32,14.58 13.12,14H1V12H23M19.41,7.89L15.43,7.86C15.43,7.86 15.6,5.09 12.15,5.08C8.7,5.06 9,7.28 9,7.56C9.04,7.84 9.34,9.22 12,9.88H5.71C5.71,9.88 2.22,3.15 10.74,2C19.45,0.8 19.43,7.91 19.41,7.89Z" /> -</vector> diff --git a/app/src/main/res/drawable/ic_format_underline.xml b/app/src/main/res/drawable/ic_format_underline.xml deleted file mode 100644 index 963f2c45b83afce6362942f11bc1fbb2dae350d1..0000000000000000000000000000000000000000 --- a/app/src/main/res/drawable/ic_format_underline.xml +++ /dev/null @@ -1,28 +0,0 @@ -<!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<vector xmlns:android="http://schemas.android.com/apk/res/android" - android:width="24dp" - android:height="24dp" - android:viewportWidth="24" - android:viewportHeight="24"> - <path - android:fillColor="#000" - android:pathData="M5,21H19V19H5V21M12,17A6,6 0 0,0 18,11V3H15.5V11A3.5,3.5 0 0,1 12,14.5A3.5,3.5 0 0,1 8.5,11V3H6V11A6,6 0 0,0 12,17Z" /> -</vector> diff --git a/app/src/main/res/drawable/ic_forward.xml b/app/src/main/res/drawable/ic_forward.xml deleted file mode 100644 index 9b3ad4ee11963aa8c50b0d653dbd6ce761fd10c6..0000000000000000000000000000000000000000 --- a/app/src/main/res/drawable/ic_forward.xml +++ /dev/null @@ -1,23 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<selector xmlns:android="http://schemas.android.com/apk/res/android"> - <item android:drawable="@drawable/ic_arrow_right" android:state_checked="false" /> - <item android:drawable="@drawable/ic_check" android:state_checked="true" /> -</selector> diff --git a/app/src/main/res/drawable/ic_help.xml b/app/src/main/res/drawable/ic_help.xml deleted file mode 100644 index acfe3459cbe2a8c564118cfc84a8cd664d99bc73..0000000000000000000000000000000000000000 --- a/app/src/main/res/drawable/ic_help.xml +++ /dev/null @@ -1,28 +0,0 @@ -<!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<vector xmlns:android="http://schemas.android.com/apk/res/android" - android:width="24dp" - android:height="24dp" - android:viewportWidth="24" - android:viewportHeight="24"> - <path - android:fillColor="#000" - android:pathData="M15.07,11.25L14.17,12.17C13.45,12.89 13,13.5 13,15H11V14.5C11,13.39 11.45,12.39 12.17,11.67L13.41,10.41C13.78,10.05 14,9.55 14,9C14,7.89 13.1,7 12,7A2,2 0 0,0 10,9H8A4,4 0 0,1 12,5A4,4 0 0,1 16,9C16,9.88 15.64,10.67 15.07,11.25M13,19H11V17H13M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12C22,6.47 17.5,2 12,2Z" /> -</vector> diff --git a/app/src/main/res/drawable/ic_history.xml b/app/src/main/res/drawable/ic_history.xml deleted file mode 100644 index 0a637d61ecb3a4c90137bf7ad07fb33307d69050..0000000000000000000000000000000000000000 --- a/app/src/main/res/drawable/ic_history.xml +++ /dev/null @@ -1,28 +0,0 @@ -<!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<vector xmlns:android="http://schemas.android.com/apk/res/android" - android:width="24dp" - android:height="24dp" - android:viewportWidth="24" - android:viewportHeight="24"> - <path - android:fillColor="#000" - android:pathData="M11,7V12.11L15.71,14.9L16.5,13.62L12.5,11.25V7M12.5,2C8.97,2 5.91,3.92 4.27,6.77L2,4.5V11H8.5L5.75,8.25C6.96,5.73 9.5,4 12.5,4A7.5,7.5 0 0,1 20,11.5A7.5,7.5 0 0,1 12.5,19C9.23,19 6.47,16.91 5.44,14H3.34C4.44,18.03 8.11,21 12.5,21C17.74,21 22,16.75 22,11.5A9.5,9.5 0 0,0 12.5,2Z" /> -</vector> diff --git a/app/src/main/res/drawable/ic_info.xml b/app/src/main/res/drawable/ic_info.xml deleted file mode 100644 index e3d92efad5897bd3878cc6b9b77b1a1f6beabcc2..0000000000000000000000000000000000000000 --- a/app/src/main/res/drawable/ic_info.xml +++ /dev/null @@ -1,28 +0,0 @@ -<!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<vector xmlns:android="http://schemas.android.com/apk/res/android" - android:width="24dp" - android:height="24dp" - android:viewportWidth="24" - android:viewportHeight="24"> - <path - android:fillColor="#000" - android:pathData="M13,9H11V7H13M13,17H11V11H13M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10,10 0 0,0 12,2Z" /> -</vector> diff --git a/app/src/main/res/drawable/ic_key_variant.xml b/app/src/main/res/drawable/ic_key_variant.xml deleted file mode 100644 index 0fc71d186644ec943fd97ab7099efe9eecfaf0c9..0000000000000000000000000000000000000000 --- a/app/src/main/res/drawable/ic_key_variant.xml +++ /dev/null @@ -1,28 +0,0 @@ -<!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<vector xmlns:android="http://schemas.android.com/apk/res/android" - android:width="24dp" - android:height="24dp" - android:viewportWidth="24" - android:viewportHeight="24"> - <path - android:fillColor="#000" - android:pathData="M22,18V22H18V19H15V16H12L9.74,13.74C9.19,13.91 8.61,14 8,14A6,6 0 0,1 2,8A6,6 0 0,1 8,2A6,6 0 0,1 14,8C14,8.61 13.91,9.19 13.74,9.74L22,18M7,5A2,2 0 0,0 5,7A2,2 0 0,0 7,9A2,2 0 0,0 9,7A2,2 0 0,0 7,5Z" /> -</vector> diff --git a/app/src/main/res/drawable/ic_launcher_background.xml b/app/src/main/res/drawable/ic_launcher_background.xml new file mode 100644 index 0000000000000000000000000000000000000000..07d5da9cbf141911847041df5d7b87f0dd5ef9d4 --- /dev/null +++ b/app/src/main/res/drawable/ic_launcher_background.xml @@ -0,0 +1,170 @@ +<?xml version="1.0" encoding="utf-8"?> +<vector xmlns:android="http://schemas.android.com/apk/res/android" + android:width="108dp" + android:height="108dp" + android:viewportWidth="108" + android:viewportHeight="108"> + <path + android:fillColor="#3DDC84" + android:pathData="M0,0h108v108h-108z" /> + <path + android:fillColor="#00000000" + android:pathData="M9,0L9,108" + android:strokeWidth="0.8" + android:strokeColor="#33FFFFFF" /> + <path + android:fillColor="#00000000" + android:pathData="M19,0L19,108" + android:strokeWidth="0.8" + android:strokeColor="#33FFFFFF" /> + <path + android:fillColor="#00000000" + android:pathData="M29,0L29,108" + android:strokeWidth="0.8" + android:strokeColor="#33FFFFFF" /> + <path + android:fillColor="#00000000" + android:pathData="M39,0L39,108" + android:strokeWidth="0.8" + android:strokeColor="#33FFFFFF" /> + <path + android:fillColor="#00000000" + android:pathData="M49,0L49,108" + android:strokeWidth="0.8" + android:strokeColor="#33FFFFFF" /> + <path + android:fillColor="#00000000" + android:pathData="M59,0L59,108" + android:strokeWidth="0.8" + android:strokeColor="#33FFFFFF" /> + <path + android:fillColor="#00000000" + android:pathData="M69,0L69,108" + android:strokeWidth="0.8" + android:strokeColor="#33FFFFFF" /> + <path + android:fillColor="#00000000" + android:pathData="M79,0L79,108" + android:strokeWidth="0.8" + android:strokeColor="#33FFFFFF" /> + <path + android:fillColor="#00000000" + android:pathData="M89,0L89,108" + android:strokeWidth="0.8" + android:strokeColor="#33FFFFFF" /> + <path + android:fillColor="#00000000" + android:pathData="M99,0L99,108" + android:strokeWidth="0.8" + android:strokeColor="#33FFFFFF" /> + <path + android:fillColor="#00000000" + android:pathData="M0,9L108,9" + android:strokeWidth="0.8" + android:strokeColor="#33FFFFFF" /> + <path + android:fillColor="#00000000" + android:pathData="M0,19L108,19" + android:strokeWidth="0.8" + android:strokeColor="#33FFFFFF" /> + <path + android:fillColor="#00000000" + android:pathData="M0,29L108,29" + android:strokeWidth="0.8" + android:strokeColor="#33FFFFFF" /> + <path + android:fillColor="#00000000" + android:pathData="M0,39L108,39" + android:strokeWidth="0.8" + android:strokeColor="#33FFFFFF" /> + <path + android:fillColor="#00000000" + android:pathData="M0,49L108,49" + android:strokeWidth="0.8" + android:strokeColor="#33FFFFFF" /> + <path + android:fillColor="#00000000" + android:pathData="M0,59L108,59" + android:strokeWidth="0.8" + android:strokeColor="#33FFFFFF" /> + <path + android:fillColor="#00000000" + android:pathData="M0,69L108,69" + android:strokeWidth="0.8" + android:strokeColor="#33FFFFFF" /> + <path + android:fillColor="#00000000" + android:pathData="M0,79L108,79" + android:strokeWidth="0.8" + android:strokeColor="#33FFFFFF" /> + <path + android:fillColor="#00000000" + android:pathData="M0,89L108,89" + android:strokeWidth="0.8" + android:strokeColor="#33FFFFFF" /> + <path + android:fillColor="#00000000" + android:pathData="M0,99L108,99" + android:strokeWidth="0.8" + android:strokeColor="#33FFFFFF" /> + <path + android:fillColor="#00000000" + android:pathData="M19,29L89,29" + android:strokeWidth="0.8" + android:strokeColor="#33FFFFFF" /> + <path + android:fillColor="#00000000" + android:pathData="M19,39L89,39" + android:strokeWidth="0.8" + android:strokeColor="#33FFFFFF" /> + <path + android:fillColor="#00000000" + android:pathData="M19,49L89,49" + android:strokeWidth="0.8" + android:strokeColor="#33FFFFFF" /> + <path + android:fillColor="#00000000" + android:pathData="M19,59L89,59" + android:strokeWidth="0.8" + android:strokeColor="#33FFFFFF" /> + <path + android:fillColor="#00000000" + android:pathData="M19,69L89,69" + android:strokeWidth="0.8" + android:strokeColor="#33FFFFFF" /> + <path + android:fillColor="#00000000" + android:pathData="M19,79L89,79" + android:strokeWidth="0.8" + android:strokeColor="#33FFFFFF" /> + <path + android:fillColor="#00000000" + android:pathData="M29,19L29,89" + android:strokeWidth="0.8" + android:strokeColor="#33FFFFFF" /> + <path + android:fillColor="#00000000" + android:pathData="M39,19L39,89" + android:strokeWidth="0.8" + android:strokeColor="#33FFFFFF" /> + <path + android:fillColor="#00000000" + android:pathData="M49,19L49,89" + android:strokeWidth="0.8" + android:strokeColor="#33FFFFFF" /> + <path + android:fillColor="#00000000" + android:pathData="M59,19L59,89" + android:strokeWidth="0.8" + android:strokeColor="#33FFFFFF" /> + <path + android:fillColor="#00000000" + android:pathData="M69,19L69,89" + android:strokeWidth="0.8" + android:strokeColor="#33FFFFFF" /> + <path + android:fillColor="#00000000" + android:pathData="M79,19L79,89" + android:strokeWidth="0.8" + android:strokeColor="#33FFFFFF" /> +</vector> diff --git a/app/src/main/res/drawable/ic_link.xml b/app/src/main/res/drawable/ic_link.xml deleted file mode 100644 index 8286226cdbff92e7f6390e7f22c64a37f6758539..0000000000000000000000000000000000000000 --- a/app/src/main/res/drawable/ic_link.xml +++ /dev/null @@ -1,28 +0,0 @@ -<!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<vector xmlns:android="http://schemas.android.com/apk/res/android" - android:width="24dp" - android:height="24dp" - android:viewportWidth="24" - android:viewportHeight="24"> - <path - android:fillColor="#000" - android:pathData="M3.9,12C3.9,10.29 5.29,8.9 7,8.9H11V7H7A5,5 0 0,0 2,12A5,5 0 0,0 7,17H11V15.1H7C5.29,15.1 3.9,13.71 3.9,12M8,13H16V11H8V13M17,7H13V8.9H17C18.71,8.9 20.1,10.29 20.1,12C20.1,13.71 18.71,15.1 17,15.1H13V17H17A5,5 0 0,0 22,12A5,5 0 0,0 17,7Z" /> -</vector> diff --git a/app/src/main/res/drawable/ic_list_bulleted.xml b/app/src/main/res/drawable/ic_list_bulleted.xml deleted file mode 100644 index 9436e676bbf4ec364ce269fce7f11c000a81fedd..0000000000000000000000000000000000000000 --- a/app/src/main/res/drawable/ic_list_bulleted.xml +++ /dev/null @@ -1,28 +0,0 @@ -<!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<vector xmlns:android="http://schemas.android.com/apk/res/android" - android:width="24dp" - android:height="24dp" - android:viewportWidth="24" - android:viewportHeight="24"> - <path - android:fillColor="#000" - android:pathData="M7,5H21V7H7V5M7,13V11H21V13H7M4,4.5A1.5,1.5 0 0,1 5.5,6A1.5,1.5 0 0,1 4,7.5A1.5,1.5 0 0,1 2.5,6A1.5,1.5 0 0,1 4,4.5M4,10.5A1.5,1.5 0 0,1 5.5,12A1.5,1.5 0 0,1 4,13.5A1.5,1.5 0 0,1 2.5,12A1.5,1.5 0 0,1 4,10.5M7,19V17H21V19H7M4,16.5A1.5,1.5 0 0,1 5.5,18A1.5,1.5 0 0,1 4,19.5A1.5,1.5 0 0,1 2.5,18A1.5,1.5 0 0,1 4,16.5Z" /> -</vector> diff --git a/app/src/main/res/drawable/ic_lock.xml b/app/src/main/res/drawable/ic_lock.xml deleted file mode 100644 index e9ec82f183608c8ddd4e2a8031577950cc96900c..0000000000000000000000000000000000000000 --- a/app/src/main/res/drawable/ic_lock.xml +++ /dev/null @@ -1,28 +0,0 @@ -<!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<vector xmlns:android="http://schemas.android.com/apk/res/android" - android:width="24dp" - android:height="24dp" - android:viewportWidth="24" - android:viewportHeight="24"> - <path - android:fillColor="#000" - android:pathData="M12,17A2,2 0 0,0 14,15C14,13.89 13.1,13 12,13A2,2 0 0,0 10,15A2,2 0 0,0 12,17M18,8A2,2 0 0,1 20,10V20A2,2 0 0,1 18,22H6A2,2 0 0,1 4,20V10C4,8.89 4.9,8 6,8H7V6A5,5 0 0,1 12,1A5,5 0 0,1 17,6V8H18M12,3A3,3 0 0,0 9,6V8H15V6A3,3 0 0,0 12,3Z" /> -</vector> diff --git a/app/src/main/res/drawable/ic_lock_open.xml b/app/src/main/res/drawable/ic_lock_open.xml deleted file mode 100644 index ee938fc9d84eb5a2fc37bb22cd07a7bd4ea5ae80..0000000000000000000000000000000000000000 --- a/app/src/main/res/drawable/ic_lock_open.xml +++ /dev/null @@ -1,28 +0,0 @@ -<!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<vector xmlns:android="http://schemas.android.com/apk/res/android" - android:width="24dp" - android:height="24dp" - android:viewportWidth="24" - android:viewportHeight="24"> - <path - android:fillColor="#000" - android:pathData="M18,20V10H6V20H18M18,8A2,2 0 0,1 20,10V20A2,2 0 0,1 18,22H6C4.89,22 4,21.1 4,20V10A2,2 0 0,1 6,8H15V6A3,3 0 0,0 12,3A3,3 0 0,0 9,6H7A5,5 0 0,1 12,1A5,5 0 0,1 17,6V8H18M12,17A2,2 0 0,1 10,15A2,2 0 0,1 12,13A2,2 0 0,1 14,15A2,2 0 0,1 12,17Z" /> -</vector> diff --git a/app/src/main/res/drawable/ic_message_bulleted.xml b/app/src/main/res/drawable/ic_message_bulleted.xml deleted file mode 100644 index ce2ad4d973af0e3502811d413aff2f06c33d45d0..0000000000000000000000000000000000000000 --- a/app/src/main/res/drawable/ic_message_bulleted.xml +++ /dev/null @@ -1,28 +0,0 @@ -<!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<vector xmlns:android="http://schemas.android.com/apk/res/android" - android:width="24dp" - android:height="24dp" - android:viewportWidth="24" - android:viewportHeight="24"> - <path - android:fillColor="#000" - android:pathData="M20,2H4A2,2 0 0,0 2,4V22L6,18H20A2,2 0 0,0 22,16V4A2,2 0 0,0 20,2M8,14H6V12H8V14M8,11H6V9H8V11M8,8H6V6H8V8M15,14H10V12H15V14M18,11H10V9H18V11M18,8H10V6H18V8Z" /> -</vector> diff --git a/app/src/main/res/drawable/ic_modify.xml b/app/src/main/res/drawable/ic_modify.xml deleted file mode 100644 index fb269e881d0472b8fd3ecc82973cb87acbbcc7f5..0000000000000000000000000000000000000000 --- a/app/src/main/res/drawable/ic_modify.xml +++ /dev/null @@ -1,28 +0,0 @@ -<!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<vector xmlns:android="http://schemas.android.com/apk/res/android" - android:width="24dp" - android:height="24dp" - android:viewportWidth="24" - android:viewportHeight="24"> - <path - android:fillColor="#000" - android:pathData="M20.71,7.04C21.1,6.65 21.1,6 20.71,5.63L18.37,3.29C18,2.9 17.35,2.9 16.96,3.29L15.12,5.12L18.87,8.87M3,17.25V21H6.75L17.81,9.93L14.06,6.18L3,17.25Z" /> -</vector> diff --git a/app/src/main/res/drawable/ic_pencil.xml b/app/src/main/res/drawable/ic_pencil.xml deleted file mode 100644 index fb269e881d0472b8fd3ecc82973cb87acbbcc7f5..0000000000000000000000000000000000000000 --- a/app/src/main/res/drawable/ic_pencil.xml +++ /dev/null @@ -1,28 +0,0 @@ -<!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<vector xmlns:android="http://schemas.android.com/apk/res/android" - android:width="24dp" - android:height="24dp" - android:viewportWidth="24" - android:viewportHeight="24"> - <path - android:fillColor="#000" - android:pathData="M20.71,7.04C21.1,6.65 21.1,6 20.71,5.63L18.37,3.29C18,2.9 17.35,2.9 16.96,3.29L15.12,5.12L18.87,8.87M3,17.25V21H6.75L17.81,9.93L14.06,6.18L3,17.25Z" /> -</vector> diff --git a/app/src/main/res/drawable/ic_reorder.xml b/app/src/main/res/drawable/ic_reorder.xml deleted file mode 100644 index 77d6409f5b7b9a1e0a65b1108e14ce57225c3f91..0000000000000000000000000000000000000000 --- a/app/src/main/res/drawable/ic_reorder.xml +++ /dev/null @@ -1,28 +0,0 @@ -<!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<vector xmlns:android="http://schemas.android.com/apk/res/android" - android:width="24dp" - android:height="24dp" - android:viewportWidth="24" - android:viewportHeight="24"> - <path - android:fillColor="#000" - android:pathData="M3,15H21V13H3V15M3,19H21V17H3V19M3,11H21V9H3V11M3,5V7H21V5H3Z" /> -</vector> diff --git a/app/src/main/res/drawable/ic_save.xml b/app/src/main/res/drawable/ic_save.xml deleted file mode 100644 index e86827cfa066a2fbc3477248651fc49e804e4cff..0000000000000000000000000000000000000000 --- a/app/src/main/res/drawable/ic_save.xml +++ /dev/null @@ -1,28 +0,0 @@ -<!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<vector xmlns:android="http://schemas.android.com/apk/res/android" - android:width="24dp" - android:height="24dp" - android:viewportWidth="24" - android:viewportHeight="24"> - <path - android:fillColor="#000" - android:pathData="M15,9H5V5H15M12,19A3,3 0 0,1 9,16A3,3 0 0,1 12,13A3,3 0 0,1 15,16A3,3 0 0,1 12,19M17,3H5C3.89,3 3,3.9 3,5V19A2,2 0 0,0 5,21H19A2,2 0 0,0 21,19V7L17,3Z" /> -</vector> diff --git a/app/src/main/res/drawable/ic_scroll_down.xml b/app/src/main/res/drawable/ic_scroll_down.xml deleted file mode 100644 index 2d06f07dd69b0e0383dc4c51f71e5d0a2880da47..0000000000000000000000000000000000000000 --- a/app/src/main/res/drawable/ic_scroll_down.xml +++ /dev/null @@ -1,28 +0,0 @@ -<!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<vector xmlns:android="http://schemas.android.com/apk/res/android" - android:width="24dp" - android:height="24dp" - android:viewportWidth="24" - android:viewportHeight="24"> - <path - android:fillColor="#000" - android:pathData="M16.59,5.59L18,7L12,13L6,7L7.41,5.59L12,10.17L16.59,5.59M16.59,11.59L18,13L12,19L6,13L7.41,11.59L12,16.17L16.59,11.59Z" /> -</vector> diff --git a/app/src/main/res/drawable/ic_scroll_up.xml b/app/src/main/res/drawable/ic_scroll_up.xml deleted file mode 100644 index b7717298a4d08022cb489935afed176cfe1ebae6..0000000000000000000000000000000000000000 --- a/app/src/main/res/drawable/ic_scroll_up.xml +++ /dev/null @@ -1,28 +0,0 @@ -<!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<vector xmlns:android="http://schemas.android.com/apk/res/android" - android:width="24dp" - android:height="24dp" - android:viewportWidth="24" - android:viewportHeight="24"> - <path - android:fillColor="#000" - android:pathData="M7.41,18.41L6,17L12,11L18,17L16.59,18.41L12,13.83L7.41,18.41M7.41,12.41L6,11L12,5L18,11L16.59,12.41L12,7.83L7.41,12.41Z" /> -</vector> diff --git a/app/src/main/res/drawable/ic_search.xml b/app/src/main/res/drawable/ic_search.xml deleted file mode 100644 index 7abf594a74527f38eefc7e48a61310f8e66caf11..0000000000000000000000000000000000000000 --- a/app/src/main/res/drawable/ic_search.xml +++ /dev/null @@ -1,28 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<vector xmlns:android="http://schemas.android.com/apk/res/android" - android:width="24dp" - android:height="24dp" - android:viewportWidth="24" - android:viewportHeight="24"> - <path - android:fillColor="#000" - android:pathData="M9.5,3A6.5,6.5 0 0,1 16,9.5C16,11.11 15.41,12.59 14.44,13.73L14.71,14H15.5L20.5,19L19,20.5L14,15.5V14.71L13.73,14.44C12.59,15.41 11.11,16 9.5,16A6.5,6.5 0 0,1 3,9.5A6.5,6.5 0 0,1 9.5,3M9.5,5C7,5 5,7 5,9.5C5,12 7,14 9.5,14C12,14 14,12 14,9.5C14,7 12,5 9.5,5Z" /> -</vector> diff --git a/app/src/main/res/drawable/ic_send.xml b/app/src/main/res/drawable/ic_send.xml deleted file mode 100644 index 0e6c810f9fb789e242601a0eb973f1a69ea635d9..0000000000000000000000000000000000000000 --- a/app/src/main/res/drawable/ic_send.xml +++ /dev/null @@ -1,28 +0,0 @@ -<!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<vector xmlns:android="http://schemas.android.com/apk/res/android" - android:width="24dp" - android:height="24dp" - android:viewportWidth="24" - android:viewportHeight="24"> - <path - android:fillColor="#000" - android:pathData="M2,21L23,12L2,3V10L17,12L2,14V21Z" /> -</vector> diff --git a/app/src/main/res/drawable/ic_server.xml b/app/src/main/res/drawable/ic_server.xml deleted file mode 100644 index d0fbc8b50646e351b4894eda11fc05598a778d7b..0000000000000000000000000000000000000000 --- a/app/src/main/res/drawable/ic_server.xml +++ /dev/null @@ -1,28 +0,0 @@ -<!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<vector xmlns:android="http://schemas.android.com/apk/res/android" - android:width="24dp" - android:height="24dp" - android:viewportWidth="24" - android:viewportHeight="24"> - <path - android:fillColor="#000" - android:pathData="M13,18H14A1,1 0 0,1 15,19H22V21H15A1,1 0 0,1 14,22H10A1,1 0 0,1 9,21H2V19H9A1,1 0 0,1 10,18H11V16H4A1,1 0 0,1 3,15V11A1,1 0 0,1 4,10H20A1,1 0 0,1 21,11V15A1,1 0 0,1 20,16H13V18M4,2H20A1,1 0 0,1 21,3V7A1,1 0 0,1 20,8H4A1,1 0 0,1 3,7V3A1,1 0 0,1 4,2M9,6H10V4H9V6M9,14H10V12H9V14M5,4V6H7V4H5M5,12V14H7V12H5Z" /> -</vector> diff --git a/app/src/main/res/drawable/ic_server_network.xml b/app/src/main/res/drawable/ic_server_network.xml deleted file mode 100644 index d0fbc8b50646e351b4894eda11fc05598a778d7b..0000000000000000000000000000000000000000 --- a/app/src/main/res/drawable/ic_server_network.xml +++ /dev/null @@ -1,28 +0,0 @@ -<!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<vector xmlns:android="http://schemas.android.com/apk/res/android" - android:width="24dp" - android:height="24dp" - android:viewportWidth="24" - android:viewportHeight="24"> - <path - android:fillColor="#000" - android:pathData="M13,18H14A1,1 0 0,1 15,19H22V21H15A1,1 0 0,1 14,22H10A1,1 0 0,1 9,21H2V19H9A1,1 0 0,1 10,18H11V16H4A1,1 0 0,1 3,15V11A1,1 0 0,1 4,10H20A1,1 0 0,1 21,11V15A1,1 0 0,1 20,16H13V18M4,2H20A1,1 0 0,1 21,3V7A1,1 0 0,1 20,8H4A1,1 0 0,1 3,7V3A1,1 0 0,1 4,2M9,6H10V4H9V6M9,14H10V12H9V14M5,4V6H7V4H5M5,12V14H7V12H5Z" /> -</vector> diff --git a/app/src/main/res/drawable/ic_settings.xml b/app/src/main/res/drawable/ic_settings.xml deleted file mode 100644 index 22f0c1b30aa69e6444f4cc730189c1b94664c784..0000000000000000000000000000000000000000 --- a/app/src/main/res/drawable/ic_settings.xml +++ /dev/null @@ -1,30 +0,0 @@ -<!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<vector xmlns:android="http://schemas.android.com/apk/res/android" - xmlns:tools="http://schemas.android.com/tools" - android:width="24dp" - android:height="24dp" - android:viewportWidth="24" - android:viewportHeight="24" - tools:ignore="VectorPath"> - <path - android:fillColor="#000" - android:pathData="M12,15.5A3.5,3.5 0 0,1 8.5,12A3.5,3.5 0 0,1 12,8.5A3.5,3.5 0 0,1 15.5,12A3.5,3.5 0 0,1 12,15.5M19.43,12.97C19.47,12.65 19.5,12.33 19.5,12C19.5,11.67 19.47,11.34 19.43,11L21.54,9.37C21.73,9.22 21.78,8.95 21.66,8.73L19.66,5.27C19.54,5.05 19.27,4.96 19.05,5.05L16.56,6.05C16.04,5.66 15.5,5.32 14.87,5.07L14.5,2.42C14.46,2.18 14.25,2 14,2H10C9.75,2 9.54,2.18 9.5,2.42L9.13,5.07C8.5,5.32 7.96,5.66 7.44,6.05L4.95,5.05C4.73,4.96 4.46,5.05 4.34,5.27L2.34,8.73C2.21,8.95 2.27,9.22 2.46,9.37L4.57,11C4.53,11.34 4.5,11.67 4.5,12C4.5,12.33 4.53,12.65 4.57,12.97L2.46,14.63C2.27,14.78 2.21,15.05 2.34,15.27L4.34,18.73C4.46,18.95 4.73,19.03 4.95,18.95L7.44,17.94C7.96,18.34 8.5,18.68 9.13,18.93L9.5,21.58C9.54,21.82 9.75,22 10,22H14C14.25,22 14.46,21.82 14.5,21.58L14.87,18.93C15.5,18.67 16.04,18.34 16.56,17.94L19.05,18.95C19.27,19.03 19.54,18.95 19.66,18.73L21.66,15.27C21.78,15.05 21.73,14.78 21.54,14.63L19.43,12.97Z" /> -</vector> diff --git a/app/src/main/res/drawable/ic_share.xml b/app/src/main/res/drawable/ic_share.xml deleted file mode 100644 index 922d620f9f779e50c3c1da46593c40edb52589b5..0000000000000000000000000000000000000000 --- a/app/src/main/res/drawable/ic_share.xml +++ /dev/null @@ -1,28 +0,0 @@ -<!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<vector xmlns:android="http://schemas.android.com/apk/res/android" - android:width="24dp" - android:height="24dp" - android:viewportWidth="24" - android:viewportHeight="24"> - <path - android:fillColor="#000" - android:pathData="M18,16.08C17.24,16.08 16.56,16.38 16.04,16.85L8.91,12.7C8.96,12.47 9,12.24 9,12C9,11.76 8.96,11.53 8.91,11.3L15.96,7.19C16.5,7.69 17.21,8 18,8A3,3 0 0,0 21,5A3,3 0 0,0 18,2A3,3 0 0,0 15,5C15,5.24 15.04,5.47 15.09,5.7L8.04,9.81C7.5,9.31 6.79,9 6,9A3,3 0 0,0 3,12A3,3 0 0,0 6,15C6.79,15 7.5,14.69 8.04,14.19L15.16,18.34C15.11,18.55 15.08,18.77 15.08,19C15.08,20.61 16.39,21.91 18,21.91C19.61,21.91 20.92,20.61 20.92,19A2.92,2.92 0 0,0 18,16.08Z" /> -</vector> diff --git a/app/src/main/res/drawable/ic_share_alternative.xml b/app/src/main/res/drawable/ic_share_alternative.xml deleted file mode 100644 index b850899bf518cbd124808d354b582d48675174cf..0000000000000000000000000000000000000000 --- a/app/src/main/res/drawable/ic_share_alternative.xml +++ /dev/null @@ -1,28 +0,0 @@ -<!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<vector xmlns:android="http://schemas.android.com/apk/res/android" - android:width="24dp" - android:height="24dp" - android:viewportWidth="24" - android:viewportHeight="24"> - <path - android:fillColor="#000" - android:pathData="M21,11L14,4V8C7,9 4,14 3,19C5.5,15.5 9,13.9 14,13.9V18L21,11Z" /> -</vector> diff --git a/app/src/main/res/drawable/ic_shortcut_channel_foreground.xml b/app/src/main/res/drawable/ic_shortcut_channel_foreground.xml deleted file mode 100644 index d8a97e096422feffcb38a954d0fef16dc304466e..0000000000000000000000000000000000000000 --- a/app/src/main/res/drawable/ic_shortcut_channel_foreground.xml +++ /dev/null @@ -1,34 +0,0 @@ -<!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<vector xmlns:android="http://schemas.android.com/apk/res/android" - android:width="108dp" - android:height="108dp" - android:viewportWidth="108" - android:viewportHeight="108"> - <path - android:fillColor="#8affffff" - android:pathData="m47.116,47.211 0.885,-6.39a1.875,1.875 0 0 1 3.714,0.51l-0.81,5.859 8.337, - -0.045 0.879,-6.327a1.876,1.876 0 0 1 3.717,0.513l-0.804,5.796 4.827,-0.024a1.876,1.876 0 1 1 - 0.018,3.75l-5.367,0.027-0.993,7.164 5.136,-0.027a1.875,1.875 0 0 1 0.021,3.747l-5.676,0.03-0.915 - ,6.588a1.875,1.875 0 0 1-3.714,-0.516l0.84,-6.054-8.34,0.045-0.906,6.525a1.875,1.875 0 0 1-3.714 - ,-0.516l0.831,-5.991-4.254,0.021a1.875,1.875 0 0 1-0.018,-3.747l4.794,-0.024 1.512,-10.914-0.519 - ,3.75-4.563,0.024a1.875,1.875 0 0 1-0.018,-3.747zm3.267,3.732-0.993,7.164 8.337,-0.045 0.993, - -7.161z" /> -</vector> diff --git a/app/src/main/res/drawable/ic_shortcut_query_foreground.xml b/app/src/main/res/drawable/ic_shortcut_query_foreground.xml deleted file mode 100644 index a70ea4ac314db8d9e9bac9ba5974dfa5d3540ebf..0000000000000000000000000000000000000000 --- a/app/src/main/res/drawable/ic_shortcut_query_foreground.xml +++ /dev/null @@ -1,29 +0,0 @@ -<!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<vector xmlns:android="http://schemas.android.com/apk/res/android" - android:width="108dp" - android:height="108dp" - android:viewportWidth="108" - android:viewportHeight="108"> - <path - android:fillColor="#8affffff" - android:pathData="m 54,40 a 7,7 0 0 1 7,7 7,7 0 0 1 -7,7 7,7 0 0 1 -7,-7 7,7 0 0 1 7,-7 m 0,17 c - 7.735,0 14,3.1325 14,7 l 0,3.5 -28,0 0,-3.5 c 0,-3.8675 6.265,-7 14,-7 z" /> -</vector> diff --git a/app/src/main/res/drawable/ic_sort.xml b/app/src/main/res/drawable/ic_sort.xml deleted file mode 100644 index af8a17cdcde0e274415e868df6f3ecd1ed41098c..0000000000000000000000000000000000000000 --- a/app/src/main/res/drawable/ic_sort.xml +++ /dev/null @@ -1,28 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<vector xmlns:android="http://schemas.android.com/apk/res/android" - android:width="24dp" - android:height="24dp" - android:viewportWidth="24" - android:viewportHeight="24"> - <path - android:fillColor="#000" - android:pathData="M3,13H15V11H3M3,6V8H21V6M3,18H9V16H3V18Z" /> -</vector> diff --git a/app/src/main/res/drawable/ic_status.xml b/app/src/main/res/drawable/ic_status.xml deleted file mode 100644 index 3bcd93482143b110c15976d9fec3de3dcc31a8f0..0000000000000000000000000000000000000000 --- a/app/src/main/res/drawable/ic_status.xml +++ /dev/null @@ -1,28 +0,0 @@ -<!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<vector xmlns:android="http://schemas.android.com/apk/res/android" - android:width="24dp" - android:height="24dp" - android:viewportWidth="24" - android:viewportHeight="24"> - <path - android:fillColor="#000" - android:pathData="M12,12m-10,0a10,10 0,1 1,20 0a10,10 0,1 1,-20 0" /> -</vector> diff --git a/app/src/main/res/drawable/ic_status_channel.xml b/app/src/main/res/drawable/ic_status_channel.xml deleted file mode 100644 index dadfe489967381b6c49e9b3fd44b785aaa663eaf..0000000000000000000000000000000000000000 --- a/app/src/main/res/drawable/ic_status_channel.xml +++ /dev/null @@ -1,34 +0,0 @@ -<!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<vector xmlns:android="http://schemas.android.com/apk/res/android" - android:width="24dp" - android:height="24dp" - android:viewportWidth="20" - android:viewportHeight="20"> - <path - android:fillColor="#000" - android:pathData="M0,10a10,10 0 1,0 20,0 10,10 0 1,0-20,0 - M7.7,7.7l0.295,-2.13a0.625,0.625 0 0 1 1.238,0.17l-0.27,1.953 2.779,-0.015 0.293,-2.109a - 0.625,0.625 0 0 1 1.239,0.171l-0.268,1.932 1.609,0a0.625,0.625 0 1 1 0,1.25l-1.789,0-0.331,2.388 - 1.712,0a0.625,0.625 0 0 1 0,1.249l-1.892,0.01-0.305,2.196a0.625,0.625 0 0 1-1.238,-0.172l0.28, - -2.018-2.78,0.015-0.302,2.175a0.625,0.625 0 0 1-1.238,-0.172l0.277,-1.997-1.418,0a0.625,0.625 0 - 0 1 0,-1.249l1.598,0 0.504,-3.638-0.173,1.25-1.521,0a0.625,0.625 0 0 1 0,-1.25z - M7.7,7.7m1.089,1.25-0.331,2.388 2.779,-0.015 0.331,-2.387z" /> -</vector> diff --git a/app/src/main/res/drawable/ic_status_channel_offline.xml b/app/src/main/res/drawable/ic_status_channel_offline.xml deleted file mode 100644 index 1951f1ab05b6a10c9aaedb7373014cdeb933e352..0000000000000000000000000000000000000000 --- a/app/src/main/res/drawable/ic_status_channel_offline.xml +++ /dev/null @@ -1,35 +0,0 @@ -<!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<vector xmlns:android="http://schemas.android.com/apk/res/android" - android:width="24dp" - android:height="24dp" - android:viewportWidth="20" - android:viewportHeight="20"> - <path - android:fillColor="#000" - android:pathData="M0,10a10,10 0 1,0 20,0 10,10 0 1,0-20,0 - m1.5,0a8.5,8.5 0 0,1 17,0a8.5,8.5 0 0,1-17,0 - M7.7,7.7l0.295,-2.13a0.625,0.625 0 0 1 1.238,0.17l-0.27,1.953 2.779,-0.015 0.293,-2.109a - 0.625,0.625 0 0 1 1.239,0.171l-0.268,1.932 1.609,0a0.625,0.625 0 1 1 0,1.25l-1.789,0-0.331,2.388 - 1.712,0a0.625,0.625 0 0 1 0,1.249l-1.892,0.01-0.305,2.196a0.625,0.625 0 0 1-1.238,-0.172l0.28, - -2.018-2.78,0.015-0.302,2.175a0.625,0.625 0 0 1-1.238,-0.172l0.277,-1.997-1.418,0a0.625,0.625 0 - 0 1 0,-1.249l1.598,0 0.504,-3.638-0.173,1.25-1.521,0a0.625,0.625 0 0 1 0,-1.25z - M7.7,7.7m1.089,1.25-0.331,2.388 2.779,-0.015 0.331,-2.387z" /> -</vector> diff --git a/app/src/main/res/drawable/ic_status_offline.xml b/app/src/main/res/drawable/ic_status_offline.xml deleted file mode 100644 index 0092e97b116010c0b4f5371f19ed41dd3346d6c4..0000000000000000000000000000000000000000 --- a/app/src/main/res/drawable/ic_status_offline.xml +++ /dev/null @@ -1,29 +0,0 @@ -<!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<vector xmlns:android="http://schemas.android.com/apk/res/android" - android:width="24dp" - android:height="24dp" - android:viewportWidth="20" - android:viewportHeight="20"> - <path - android:fillColor="#000" - android:pathData="M0,10a10,10 0 1,0 20,0 10,10 0 1,0-20,0 - m1.5,0a8.5,8.5 0 0,1 17,0a8.5,8.5 0 0,1-17,0" /> -</vector> diff --git a/app/src/main/res/drawable/ic_tab.xml b/app/src/main/res/drawable/ic_tab.xml deleted file mode 100644 index cbed5d9551f95f894d56da158c9a3712619af473..0000000000000000000000000000000000000000 --- a/app/src/main/res/drawable/ic_tab.xml +++ /dev/null @@ -1,28 +0,0 @@ -<!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<vector xmlns:android="http://schemas.android.com/apk/res/android" - android:width="24dp" - android:height="24dp" - android:viewportWidth="24" - android:viewportHeight="24"> - <path - android:fillColor="#000" - android:pathData="M20,18H22V6H20M11.59,7.41L15.17,11H1V13H15.17L11.59,16.58L13,18L19,12L13,6L11.59,7.41Z" /> -</vector> diff --git a/app/src/main/res/drawable/ic_tag_text.xml b/app/src/main/res/drawable/ic_tag_text.xml deleted file mode 100644 index b4864d45966533041893a58a4eb35f8bc07bcfc8..0000000000000000000000000000000000000000 --- a/app/src/main/res/drawable/ic_tag_text.xml +++ /dev/null @@ -1,28 +0,0 @@ -<!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<vector xmlns:android="http://schemas.android.com/apk/res/android" - android:width="24dp" - android:height="24dp" - android:viewportWidth="24" - android:viewportHeight="24"> - <path - android:fillColor="#000" - android:pathData="M5.5,7A1.5,1.5 0 0,0 7,5.5A1.5,1.5 0 0,0 5.5,4A1.5,1.5 0 0,0 4,5.5A1.5,1.5 0 0,0 5.5,7M21.41,11.58C21.77,11.94 22,12.44 22,13C22,13.55 21.78,14.05 21.41,14.41L14.41,21.41C14.05,21.77 13.55,22 13,22C12.45,22 11.95,21.77 11.58,21.41L2.59,12.41C2.22,12.05 2,11.55 2,11V4C2,2.89 2.89,2 4,2H11C11.55,2 12.05,2.22 12.41,2.58L21.41,11.58M13,20L20,13L11.5,4.5L4.5,11.5L13,20M10.09,8.91L11.5,7.5L17,13L15.59,14.41L10.09,8.91M7.59,11.41L9,10L13,14L11.59,15.41L7.59,11.41Z" /> -</vector> diff --git a/app/src/main/res/layout-land/layout_main.xml b/app/src/main/res/layout-land/layout_main.xml deleted file mode 100644 index 23c39c90ef01f8933e7b30cdd961dc92798f38db..0000000000000000000000000000000000000000 --- a/app/src/main/res/layout-land/layout_main.xml +++ /dev/null @@ -1,104 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" - xmlns:app="http://schemas.android.com/apk/res-auto" - xmlns:tools="http://schemas.android.com/tools" - android:layout_width="match_parent" - android:layout_height="match_parent" - android:gravity="bottom" - android:orientation="vertical"> - - <androidx.coordinatorlayout.widget.CoordinatorLayout - android:layout_width="match_parent" - android:layout_height="match_parent" - android:gravity="bottom"> - - <LinearLayout - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:orientation="vertical" - app:layout_anchor="@id/fragment_chatline" - app:layout_anchorGravity="top"> - - <Space - android:layout_width="match_parent" - android:layout_height="@dimen/shadow_height" /> - - <de.kuschku.quasseldroid.util.ui.view.ShadowView - android:layout_width="match_parent" - android:layout_height="@dimen/shadow_height" - android:gravity="bottom" /> - </LinearLayout> - - <androidx.coordinatorlayout.widget.CoordinatorLayout - android:layout_width="match_parent" - android:layout_height="match_parent" - android:layout_marginBottom="?actionBarSize" - android:orientation="vertical"> - - <FrameLayout - android:layout_width="match_parent" - android:layout_height="match_parent" - app:layout_behavior="@string/appbar_scrolling_view_behavior"> - - <de.kuschku.quasseldroid.util.ui.view.WarningBarView - android:id="@+id/connection_status" - android:layout_width="match_parent" - android:layout_height="wrap_content" - app:icon="@drawable/ic_disconnected" - app:mode="none" /> - - <fragment - android:id="@+id/fragment_messages" - android:name="de.kuschku.quasseldroid.ui.chat.messages.MessageListFragment" - android:layout_width="match_parent" - android:layout_height="match_parent" - tools:ignore="FragmentTagUsage" - tools:layout="@layout/chat_messages" /> - </FrameLayout> - - <androidx.recyclerview.widget.RecyclerView - android:id="@+id/autocomplete_list" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:background="?colorBackgroundCard" - app:behavior_hideable="true" - app:behavior_peekHeight="92dp" - app:layout_behavior="@string/bottom_sheet_behavior" - tools:listitem="@layout/widget_nick" /> - - <include - android:id="@+id/layout_toolbar" - layout="@layout/layout_toolbar" /> - </androidx.coordinatorlayout.widget.CoordinatorLayout> - - <fragment - android:id="@+id/fragment_chatline" - android:name="de.kuschku.quasseldroid.ui.chat.input.ChatlineFragment" - android:layout_width="match_parent" - android:layout_height="match_parent" - app:behavior_hideable="false" - app:behavior_peekHeight="?actionBarSize" - app:layout_behavior="@string/drag_intercept_bottom_sheet_behavior" - tools:ignore="FragmentTagUsage" - tools:layout="@layout/chat_chatline" /> - - </androidx.coordinatorlayout.widget.CoordinatorLayout> -</LinearLayout> diff --git a/app/src/main/res/layout-sw600dp-land/activity_setup.xml b/app/src/main/res/layout-sw600dp-land/activity_setup.xml deleted file mode 100644 index 11b005eea5c82072f6e93c94cbb8c5f77a69b4ff..0000000000000000000000000000000000000000 --- a/app/src/main/res/layout-sw600dp-land/activity_setup.xml +++ /dev/null @@ -1,54 +0,0 @@ -<!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<merge xmlns:android="http://schemas.android.com/apk/res/android" - xmlns:app="http://schemas.android.com/apk/res-auto" - xmlns:tools="http://schemas.android.com/tools" - android:layout_width="match_parent" - android:layout_height="match_parent"> - - <androidx.appcompat.widget.ActionMenuView - android:id="@+id/menu_view" - android:layout_width="56dp" - android:layout_height="?actionBarSize" - android:layout_gravity="end|top" - android:theme="?attr/actionBarPopupTheme" /> - - <androidx.viewpager.widget.ViewPager - android:id="@+id/view_pager" - android:layout_width="match_parent" - android:layout_height="match_parent" /> - - <com.google.android.material.floatingactionbutton.FloatingActionButton - android:id="@+id/next_button" - style="@style/Widget.MaterialComponents.FloatingActionButton" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_gravity="right|bottom" - android:layout_marginRight="24dp" - android:layout_marginBottom="24dp" - app:backgroundTint="#8A000000" - app:elevation="0dip" - app:fabSize="normal" - app:pressedTranslationZ="0dip" - app:srcCompat="@drawable/ic_forward" - app:tint="#ffffffff" - tools:ignore="RtlHardcoded" /> - -</merge> diff --git a/app/src/main/res/layout-sw600dp-land/layout_main.xml b/app/src/main/res/layout-sw600dp-land/layout_main.xml deleted file mode 100644 index 7c1e8fdb6f32f8bf7c5e875e73338fb5a8776c4b..0000000000000000000000000000000000000000 --- a/app/src/main/res/layout-sw600dp-land/layout_main.xml +++ /dev/null @@ -1,105 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" - xmlns:app="http://schemas.android.com/apk/res-auto" - xmlns:tools="http://schemas.android.com/tools" - android:layout_width="match_parent" - android:layout_height="match_parent" - android:fitsSystemWindows="true" - android:orientation="vertical"> - - <include - android:id="@+id/layout_toolbar" - layout="@layout/layout_toolbar" /> - - <androidx.coordinatorlayout.widget.CoordinatorLayout - android:layout_width="match_parent" - android:layout_height="match_parent" - android:gravity="bottom"> - - <LinearLayout - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:orientation="vertical" - app:layout_anchor="@id/fragment_chatline" - app:layout_anchorGravity="top"> - - <Space - android:layout_width="match_parent" - android:layout_height="@dimen/shadow_height" /> - - <de.kuschku.quasseldroid.util.ui.view.ShadowView - android:layout_width="match_parent" - android:layout_height="@dimen/shadow_height" - android:gravity="bottom" /> - </LinearLayout> - - <androidx.coordinatorlayout.widget.CoordinatorLayout - android:layout_width="match_parent" - android:layout_height="match_parent" - android:layout_marginBottom="?actionBarSize" - android:orientation="vertical"> - - <FrameLayout - android:layout_width="match_parent" - android:layout_height="match_parent" - app:layout_behavior="@string/appbar_scrolling_view_behavior"> - - <fragment - android:id="@+id/fragment_messages" - android:name="de.kuschku.quasseldroid.ui.chat.messages.MessageListFragment" - android:layout_width="match_parent" - android:layout_height="match_parent" - tools:ignore="FragmentTagUsage" - tools:layout="@layout/chat_messages" /> - - <de.kuschku.quasseldroid.util.ui.view.WarningBarView - android:id="@+id/connection_status" - android:layout_width="match_parent" - android:layout_height="wrap_content" - app:icon="@drawable/ic_disconnected" - app:mode="none" /> - </FrameLayout> - - <androidx.recyclerview.widget.RecyclerView - android:id="@+id/autocomplete_list" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:background="?colorBackgroundCard" - app:behavior_hideable="true" - app:behavior_peekHeight="92dp" - app:layout_behavior="@string/bottom_sheet_behavior" - tools:listitem="@layout/widget_nick" /> - </androidx.coordinatorlayout.widget.CoordinatorLayout> - - <fragment - android:id="@+id/fragment_chatline" - android:name="de.kuschku.quasseldroid.ui.chat.input.ChatlineFragment" - android:layout_width="match_parent" - android:layout_height="match_parent" - app:behavior_hideable="false" - app:behavior_peekHeight="?actionBarSize" - app:layout_behavior="@string/drag_intercept_bottom_sheet_behavior" - tools:layout="@layout/chat_chatline" - tools:ignore="FragmentTagUsage" /> - - </androidx.coordinatorlayout.widget.CoordinatorLayout> - -</LinearLayout> diff --git a/app/src/main/res/layout-sw600dp-land/setup_slide.xml b/app/src/main/res/layout-sw600dp-land/setup_slide.xml deleted file mode 100644 index b75aa447652987138c217165774b72993c09e322..0000000000000000000000000000000000000000 --- a/app/src/main/res/layout-sw600dp-land/setup_slide.xml +++ /dev/null @@ -1,87 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> - -<!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" - xmlns:app="http://schemas.android.com/apk/res-auto" - xmlns:tools="http://schemas.android.com/tools" - android:layout_width="match_parent" - android:layout_height="match_parent" - android:paddingLeft="?attr/actionBarSize" - android:paddingRight="?attr/actionBarSize" - tools:ignore="InconsistentLayout"> - - <LinearLayout - android:layout_width="0dip" - android:layout_height="wrap_content" - android:layout_gravity="center_vertical|end" - android:layout_weight="1" - android:orientation="vertical"> - - <Space - android:layout_width="match_parent" - android:layout_height="8dp" - android:layout_gravity="end" /> - - <TextView - android:id="@+id/title" - style="@style/Widget.RtlConformTextView" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_gravity="end" - android:gravity="end" - android:textColor="?android:attr/textColorPrimaryInverse" - android:textSize="28sp" - tools:text="Connection" /> - - <TextView - android:id="@+id/description" - style="@style/Widget.RtlConformTextView" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_gravity="end" - android:gravity="end" - android:textColor="?android:attr/textColorSecondaryInverse" - android:textSize="16sp" - tools:text="First, please choose which server your core is hosted on." /> - - </LinearLayout> - - <Space - android:layout_width="?attr/actionBarSize" - android:layout_height="match_parent" /> - - <androidx.core.widget.NestedScrollView - android:id="@+id/scrollView" - android:layout_width="0dip" - android:layout_height="wrap_content" - android:layout_gravity="center_vertical|start" - android:layout_weight="1"> - - <com.google.android.material.card.MaterialCardView - android:id="@+id/content_host" - android:layout_width="400dp" - android:layout_height="wrap_content" - android:minHeight="400dp" - app:cardElevation="4dp" /> - - </androidx.core.widget.NestedScrollView> - -</LinearLayout> diff --git a/app/src/main/res/layout-sw600dp/activity_setup.xml b/app/src/main/res/layout-sw600dp/activity_setup.xml deleted file mode 100644 index 11b005eea5c82072f6e93c94cbb8c5f77a69b4ff..0000000000000000000000000000000000000000 --- a/app/src/main/res/layout-sw600dp/activity_setup.xml +++ /dev/null @@ -1,54 +0,0 @@ -<!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<merge xmlns:android="http://schemas.android.com/apk/res/android" - xmlns:app="http://schemas.android.com/apk/res-auto" - xmlns:tools="http://schemas.android.com/tools" - android:layout_width="match_parent" - android:layout_height="match_parent"> - - <androidx.appcompat.widget.ActionMenuView - android:id="@+id/menu_view" - android:layout_width="56dp" - android:layout_height="?actionBarSize" - android:layout_gravity="end|top" - android:theme="?attr/actionBarPopupTheme" /> - - <androidx.viewpager.widget.ViewPager - android:id="@+id/view_pager" - android:layout_width="match_parent" - android:layout_height="match_parent" /> - - <com.google.android.material.floatingactionbutton.FloatingActionButton - android:id="@+id/next_button" - style="@style/Widget.MaterialComponents.FloatingActionButton" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_gravity="right|bottom" - android:layout_marginRight="24dp" - android:layout_marginBottom="24dp" - app:backgroundTint="#8A000000" - app:elevation="0dip" - app:fabSize="normal" - app:pressedTranslationZ="0dip" - app:srcCompat="@drawable/ic_forward" - app:tint="#ffffffff" - tools:ignore="RtlHardcoded" /> - -</merge> diff --git a/app/src/main/res/layout-sw600dp/setup_slide.xml b/app/src/main/res/layout-sw600dp/setup_slide.xml deleted file mode 100644 index ab17cbb331d5ebd3e9245ad2cf2381b9adb058b6..0000000000000000000000000000000000000000 --- a/app/src/main/res/layout-sw600dp/setup_slide.xml +++ /dev/null @@ -1,72 +0,0 @@ -<!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<androidx.core.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android" - xmlns:app="http://schemas.android.com/apk/res-auto" - xmlns:tools="http://schemas.android.com/tools" - android:layout_width="match_parent" - android:layout_height="match_parent" - tools:ignore="InconsistentLayout"> - - <LinearLayout - android:layout_width="400dp" - android:layout_height="wrap_content" - android:layout_gravity="center" - android:layout_marginLeft="?attr/actionBarSize" - android:layout_marginRight="?attr/actionBarSize" - android:orientation="vertical"> - - <LinearLayout - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:layout_marginTop="?attr/actionBarSize" - android:orientation="vertical" - android:paddingBottom="32dp"> - - <TextView - android:id="@+id/title" - style="@style/Widget.RtlConformTextView" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_marginBottom="8dp" - android:textColor="?android:attr/textColorPrimaryInverse" - android:textSize="28sp" - tools:text="Connection" /> - - <TextView - android:id="@+id/description" - style="@style/Widget.RtlConformTextView" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:textColor="?android:attr/textColorSecondaryInverse" - android:textSize="16sp" - tools:text="First, please choose which server your core is hosted on." /> - - </LinearLayout> - - <com.google.android.material.card.MaterialCardView - android:id="@+id/content_host" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:minHeight="400dp" - app:cardElevation="4dp" /> - - </LinearLayout> - -</androidx.core.widget.NestedScrollView> diff --git a/app/src/main/res/layout-sw720dp-land/activity_main.xml b/app/src/main/res/layout-sw720dp-land/activity_main.xml deleted file mode 100644 index b501d47ef06b5ba978061c3eccc2ec7d50006af4..0000000000000000000000000000000000000000 --- a/app/src/main/res/layout-sw720dp-land/activity_main.xml +++ /dev/null @@ -1,77 +0,0 @@ -<!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<androidx.drawerlayout.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android" - xmlns:app="http://schemas.android.com/apk/res-auto" - xmlns:tools="http://schemas.android.com/tools" - android:id="@+id/drawer_layout" - android:layout_width="match_parent" - android:layout_height="match_parent" - android:fitsSystemWindows="true"> - - <LinearLayout - android:layout_width="match_parent" - android:layout_height="match_parent" - android:orientation="horizontal"> - - <LinearLayout - android:layout_width="1dp" - android:layout_height="match_parent" - android:orientation="vertical"> - - <View - android:layout_width="1dp" - android:layout_height="0dip" - android:layout_weight="1" - android:background="?colorDivider" /> - - <com.google.android.material.appbar.AppBarLayout - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:theme="?attr/actionBarTheme"> - - <androidx.appcompat.widget.Toolbar - android:layout_width="match_parent" - android:layout_height="?attr/actionBarSize" - app:contentInsetStartWithNavigation="0dp" - app:popupTheme="?attr/actionBarPopupTheme" /> - - </com.google.android.material.appbar.AppBarLayout> - </LinearLayout> - - <fragment - android:id="@+id/fragment_chat_list" - android:name="de.kuschku.quasseldroid.ui.chat.buffers.BufferViewConfigFragment" - android:layout_width="320dp" - android:layout_height="match_parent" - tools:ignore="FragmentTagUsage" - tools:layout="@layout/chat_chatlist" /> - - <include android:id="@+id/layout_main" layout="@layout/layout_main" /> - </LinearLayout> - - <fragment - android:id="@+id/fragment_nick_list" - android:name="de.kuschku.quasseldroid.ui.chat.nicks.NickListFragment" - android:layout_width="match_parent" - android:layout_height="match_parent" - android:layout_gravity="end" - tools:ignore="FragmentTagUsage" - tools:layout="@layout/chat_nicklist" /> -</androidx.drawerlayout.widget.DrawerLayout> diff --git a/app/src/main/res/layout-sw720dp/activity_settings.xml b/app/src/main/res/layout-sw720dp/activity_settings.xml deleted file mode 100644 index 75117c5846ff2397ca5a7fc232f6a5b5342d52e1..0000000000000000000000000000000000000000 --- a/app/src/main/res/layout-sw720dp/activity_settings.xml +++ /dev/null @@ -1,67 +0,0 @@ -<!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<androidx.drawerlayout.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android" - xmlns:app="http://schemas.android.com/apk/res-auto" - xmlns:tools="http://schemas.android.com/tools" - android:layout_width="match_parent" - android:layout_height="match_parent" - android:background="?attr/colorBackgroundSecondary" - android:fitsSystemWindows="true" - android:orientation="vertical"> - - <LinearLayout - android:layout_width="match_parent" - android:layout_height="match_parent" - android:fitsSystemWindows="true" - android:orientation="vertical"> - - <com.google.android.material.appbar.AppBarLayout - android:layout_width="match_parent" - android:layout_height="172dp" - android:theme="?attr/actionBarTheme"> - - <androidx.appcompat.widget.Toolbar - android:id="@+id/toolbar" - android:layout_width="match_parent" - android:layout_height="?attr/actionBarSize" - app:contentInsetStartWithNavigation="0dp" - app:popupTheme="?attr/actionBarPopupTheme" /> - - </com.google.android.material.appbar.AppBarLayout> - - <com.google.android.material.card.MaterialCardView - android:layout_width="@dimen/max_content_width" - android:layout_height="match_parent" - android:layout_gravity="center_horizontal" - android:layout_marginTop="-64dp" - android:layout_marginBottom="32dp" - android:clipToPadding="false" - app:cardBackgroundColor="?attr/colorBackground" - app:cardElevation="4dp"> - - <FrameLayout - android:id="@+id/fragment_container" - android:layout_width="match_parent" - android:layout_height="match_parent" - tools:layout="@layout/preferences_about" /> - </com.google.android.material.card.MaterialCardView> - - </LinearLayout> -</androidx.drawerlayout.widget.DrawerLayout> diff --git a/app/src/main/res/layout/activity_drawable.xml b/app/src/main/res/layout/activity_drawable.xml deleted file mode 100644 index 5f3965786f6bd5ce7dfbd1d45c490ac57c249c38..0000000000000000000000000000000000000000 --- a/app/src/main/res/layout/activity_drawable.xml +++ /dev/null @@ -1,63 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<androidx.drawerlayout.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android" - xmlns:app="http://schemas.android.com/apk/res-auto" - xmlns:tools="http://schemas.android.com/tools" - android:id="@+id/drawer_layout" - android:layout_width="match_parent" - android:layout_height="match_parent" - android:fitsSystemWindows="true"> - - <LinearLayout - android:layout_width="match_parent" - android:layout_height="match_parent" - android:fitsSystemWindows="true" - android:orientation="vertical"> - - <com.google.android.material.appbar.AppBarLayout - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:theme="?attr/actionBarTheme" - tools:showIn="@layout/activity_main"> - - <androidx.appcompat.widget.Toolbar - android:id="@+id/toolbar" - android:layout_width="match_parent" - android:layout_height="?attr/actionBarSize" - app:popupTheme="?attr/actionBarPopupTheme" /> - - </com.google.android.material.appbar.AppBarLayout> - - <androidx.appcompat.widget.AppCompatImageView - android:id="@+id/imageView" - android:layout_width="match_parent" - android:layout_height="match_parent" - android:layout_gravity="center" - android:scaleType="fitCenter" /> - </LinearLayout> - - <de.kuschku.quasseldroid.util.ui.view.NavigationDrawerLayout - android:layout_width="match_parent" - android:layout_height="match_parent" - android:layout_gravity="start" - android:background="?attr/colorBackground" - android:fitsSystemWindows="true" - app:insetBackground="?attr/colorPrimaryDark" /> -</androidx.drawerlayout.widget.DrawerLayout> diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml deleted file mode 100644 index ca5c72dcccfb89b26c90bf7f6b7a642270a48284..0000000000000000000000000000000000000000 --- a/app/src/main/res/layout/activity_main.xml +++ /dev/null @@ -1,57 +0,0 @@ -<!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<androidx.drawerlayout.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android" - xmlns:app="http://schemas.android.com/apk/res-auto" - xmlns:tools="http://schemas.android.com/tools" - android:id="@+id/drawer_layout" - android:layout_width="match_parent" - android:layout_height="match_parent" - android:fitsSystemWindows="true"> - - <include - android:id="@+id/layout_main" - layout="@layout/layout_main" /> - - <fragment - android:id="@+id/fragment_nick_list" - android:name="de.kuschku.quasseldroid.ui.chat.nicks.NickListFragment" - android:layout_width="match_parent" - android:layout_height="match_parent" - android:layout_gravity="end" - tools:ignore="FragmentTagUsage" - tools:layout="@layout/chat_nicklist" /> - - <de.kuschku.quasseldroid.util.ui.view.NavigationDrawerLayout - android:layout_width="match_parent" - android:layout_height="match_parent" - android:layout_gravity="start" - android:background="?attr/colorBackground" - android:fitsSystemWindows="true" - app:insetBackground="?attr/colorPrimaryDark"> - - <fragment - android:id="@+id/fragment_chat_list" - android:name="de.kuschku.quasseldroid.ui.chat.buffers.BufferViewConfigFragment" - android:layout_width="match_parent" - android:layout_height="match_parent" - tools:ignore="FragmentTagUsage" - tools:layout="@layout/chat_chatlist" /> - </de.kuschku.quasseldroid.util.ui.view.NavigationDrawerLayout> -</androidx.drawerlayout.widget.DrawerLayout> diff --git a/app/src/main/res/layout/activity_settings.xml b/app/src/main/res/layout/activity_settings.xml deleted file mode 100644 index c239b44d1a7fd1dab2985e40e121b3bfdecc9287..0000000000000000000000000000000000000000 --- a/app/src/main/res/layout/activity_settings.xml +++ /dev/null @@ -1,52 +0,0 @@ -<!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<androidx.drawerlayout.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android" - xmlns:app="http://schemas.android.com/apk/res-auto" - android:layout_width="match_parent" - android:layout_height="match_parent" - android:fitsSystemWindows="true"> - - <LinearLayout - android:layout_width="match_parent" - android:layout_height="match_parent" - android:fitsSystemWindows="true" - android:orientation="vertical"> - - <com.google.android.material.appbar.AppBarLayout - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:theme="?attr/actionBarTheme"> - - <androidx.appcompat.widget.Toolbar - android:id="@+id/toolbar" - android:layout_width="match_parent" - android:layout_height="?attr/actionBarSize" - app:contentInsetStartWithNavigation="0dp" - app:popupTheme="?attr/actionBarPopupTheme" /> - - </com.google.android.material.appbar.AppBarLayout> - - <FrameLayout - android:id="@+id/fragment_container" - android:layout_width="match_parent" - android:layout_height="match_parent" /> - </LinearLayout> - -</androidx.drawerlayout.widget.DrawerLayout> diff --git a/app/src/main/res/layout/activity_setup.xml b/app/src/main/res/layout/activity_setup.xml deleted file mode 100644 index 6abe56c07eea2136fe9ded8c21185691f18f0492..0000000000000000000000000000000000000000 --- a/app/src/main/res/layout/activity_setup.xml +++ /dev/null @@ -1,53 +0,0 @@ -<!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<merge xmlns:android="http://schemas.android.com/apk/res/android" - xmlns:app="http://schemas.android.com/apk/res-auto" - xmlns:tools="http://schemas.android.com/tools" - android:layout_width="match_parent" - android:layout_height="match_parent"> - - <androidx.viewpager.widget.ViewPager - android:id="@+id/view_pager" - android:layout_width="match_parent" - android:layout_height="match_parent" /> - - <androidx.appcompat.widget.ActionMenuView - android:id="@+id/menu_view" - android:layout_width="56dp" - android:layout_height="?actionBarSize" - android:layout_gravity="end|top" - android:theme="?attr/actionBarPopupTheme" /> - - <com.google.android.material.floatingactionbutton.FloatingActionButton - android:id="@+id/next_button" - style="@style/Widget.MaterialComponents.FloatingActionButton" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_gravity="right|bottom" - android:layout_marginRight="16dp" - android:layout_marginBottom="16dp" - app:backgroundTint="?colorAccent" - app:fabSize="normal" - app:srcCompat="@drawable/ic_forward" - app:tint="#ffffffff" - tools:ignore="RtlHardcoded" - tools:src="@drawable/ic_arrow_right" /> - -</merge> diff --git a/app/src/main/res/layout/add_create.xml b/app/src/main/res/layout/add_create.xml deleted file mode 100644 index e9214418af636277f96d45d601eb431cbfb028b3..0000000000000000000000000000000000000000 --- a/app/src/main/res/layout/add_create.xml +++ /dev/null @@ -1,156 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> - -<!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" - xmlns:app="http://schemas.android.com/apk/res-auto" - xmlns:tools="http://schemas.android.com/tools" - android:layout_width="match_parent" - android:layout_height="match_parent" - android:orientation="vertical"> - - <FrameLayout - android:layout_width="match_parent" - android:layout_height="0dip" - android:layout_weight="1"> - - <androidx.core.widget.NestedScrollView - android:layout_width="match_parent" - android:layout_height="match_parent"> - - <LinearLayout style="@style/Widget.CoreSettings.Wrapper"> - - <de.kuschku.ui.spinner.MaterialSpinnerLayout - style="@style/Widget.CustomSpinnerLayout" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:hint="@string/label_network"> - - <androidx.appcompat.widget.AppCompatSpinner - android:id="@+id/network" - style="@style/Widget.MaterialSpinner" - android:layout_width="match_parent" - android:layout_height="wrap_content" - tools:listitem="@layout/widget_spinner_item_material" /> - </de.kuschku.ui.spinner.MaterialSpinnerLayout> - - <com.google.android.material.textfield.TextInputLayout - style="@style/Widget.CustomTextInput" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:hint="@string/label_channel_name"> - - <com.google.android.material.textfield.TextInputEditText - android:id="@+id/name" - style="@style/Widget.CoreSettings.EditText" - tools:text="#trees" /> - </com.google.android.material.textfield.TextInputLayout> - - <LinearLayout - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:minHeight="48dp"> - - <androidx.appcompat.widget.AppCompatImageView - style="@style/Widget.CoreSettings.PrimaryItemIcon" - app:srcCompat="@drawable/ic_eye_off" /> - - <androidx.appcompat.widget.SwitchCompat - android:id="@+id/hidden" - style="@style/Widget.CoreSettings.PrimaryItemSwitch" - android:text="@string/addchat_channel_hidden" /> - </LinearLayout> - - <LinearLayout - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:minHeight="48dp"> - - <androidx.appcompat.widget.AppCompatImageView - style="@style/Widget.CoreSettings.PrimaryItemIcon" - app:srcCompat="@drawable/ic_account_card" /> - - <androidx.appcompat.widget.SwitchCompat - android:id="@+id/invite_only" - style="@style/Widget.CoreSettings.PrimaryItemSwitch" - android:text="@string/addchat_channel_invite_only" /> - </LinearLayout> - - <LinearLayout - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:minHeight="48dp"> - - <androidx.appcompat.widget.AppCompatImageView - style="@style/Widget.CoreSettings.PrimaryItemIcon" - app:srcCompat="@drawable/ic_key_variant" /> - - <androidx.appcompat.widget.SwitchCompat - android:id="@+id/password_protected" - style="@style/Widget.CoreSettings.PrimaryItemSwitch" - android:text="@string/addchat_channel_password_protected" /> - </LinearLayout> - - <LinearLayout - android:id="@+id/password_group" - style="@style/Widget.CoreSettings.DependentGroup" - tools:visibility="visible"> - - <com.google.android.material.textfield.TextInputLayout - style="@style/Widget.CustomTextInput" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:hint="@string/addchat_channel_password" - app:passwordToggleEnabled="true"> - - <com.google.android.material.textfield.TextInputEditText - android:id="@+id/password" - style="@style/Widget.CoreSettings.EditText" - android:inputType="textPassword" - tools:text="NickServ" /> - </com.google.android.material.textfield.TextInputLayout> - </LinearLayout> - </LinearLayout> - </androidx.core.widget.NestedScrollView> - - <de.kuschku.quasseldroid.util.ui.view.ShadowView - android:layout_width="match_parent" - android:layout_height="@dimen/shadow_height" - android:layout_gravity="bottom" - android:gravity="bottom" /> - </FrameLayout> - - <LinearLayout - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:gravity="end" - android:paddingLeft="16dp" - android:paddingTop="4dp" - android:paddingRight="16dp" - android:paddingBottom="4dp"> - - <com.google.android.material.button.MaterialButton - android:id="@+id/save" - style="@style/Widget.Button.Colored" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:text="@string/label_save" /> - </LinearLayout> -</LinearLayout> diff --git a/app/src/main/res/layout/add_join.xml b/app/src/main/res/layout/add_join.xml deleted file mode 100644 index 99bb236fc22fcce85b43cef1aad019bc2872686e..0000000000000000000000000000000000000000 --- a/app/src/main/res/layout/add_join.xml +++ /dev/null @@ -1,85 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> - -<!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" - xmlns:tools="http://schemas.android.com/tools" - android:layout_width="match_parent" - android:layout_height="match_parent" - android:orientation="vertical"> - - <FrameLayout - android:layout_width="match_parent" - android:layout_height="0dip" - android:layout_weight="1"> - - <LinearLayout style="@style/Widget.CoreSettings.Wrapper"> - - <de.kuschku.ui.spinner.MaterialSpinnerLayout - style="@style/Widget.CustomSpinnerLayout" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:hint="@string/label_network"> - - <androidx.appcompat.widget.AppCompatSpinner - android:id="@+id/network" - style="@style/Widget.MaterialSpinner" - android:layout_width="match_parent" - android:layout_height="wrap_content" - tools:listitem="@layout/widget_spinner_item_material" /> - </de.kuschku.ui.spinner.MaterialSpinnerLayout> - - <com.google.android.material.textfield.TextInputLayout - style="@style/Widget.CustomTextInput" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:hint="@string/label_channel_name"> - - <com.google.android.material.textfield.TextInputEditText - android:id="@+id/name" - style="@style/Widget.CoreSettings.EditText" - tools:text="#trees" /> - </com.google.android.material.textfield.TextInputLayout> - </LinearLayout> - - <de.kuschku.quasseldroid.util.ui.view.ShadowView - android:layout_width="match_parent" - android:layout_height="@dimen/shadow_height" - android:layout_gravity="bottom" - android:gravity="bottom" /> - </FrameLayout> - - <LinearLayout - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:gravity="end" - android:paddingLeft="16dp" - android:paddingTop="4dp" - android:paddingRight="16dp" - android:paddingBottom="4dp"> - - <com.google.android.material.button.MaterialButton - android:id="@+id/join" - style="@style/Widget.Button.Colored" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:text="@string/label_join" /> - </LinearLayout> -</LinearLayout> diff --git a/app/src/main/res/layout/add_query.xml b/app/src/main/res/layout/add_query.xml deleted file mode 100644 index 8ab6758eba2f8304670a31b4a9343aaab73654ef..0000000000000000000000000000000000000000 --- a/app/src/main/res/layout/add_query.xml +++ /dev/null @@ -1,96 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" - xmlns:tools="http://schemas.android.com/tools" - android:layout_width="match_parent" - android:layout_height="match_parent" - android:orientation="vertical"> - - <FrameLayout - android:layout_width="match_parent" - android:layout_height="0dip" - android:layout_weight="1"> - - <LinearLayout - android:layout_width="match_parent" - android:layout_height="match_parent" - android:orientation="vertical"> - - <LinearLayout style="@style/Widget.CoreSettings.Wrapper"> - - <de.kuschku.ui.spinner.MaterialSpinnerLayout - style="@style/Widget.CustomSpinnerLayout" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:hint="@string/label_network"> - - <androidx.appcompat.widget.AppCompatSpinner - android:id="@+id/network" - style="@style/Widget.MaterialSpinner" - android:layout_width="match_parent" - android:layout_height="wrap_content" - tools:listitem="@layout/widget_spinner_item_material" /> - </de.kuschku.ui.spinner.MaterialSpinnerLayout> - - <com.google.android.material.textfield.TextInputLayout - style="@style/Widget.CustomTextInput" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:hint="@string/label_nick"> - - <com.google.android.material.textfield.TextInputEditText - android:id="@+id/name" - style="@style/Widget.CoreSettings.EditText" - tools:text="justJanne" /> - </com.google.android.material.textfield.TextInputLayout> - </LinearLayout> - - <de.kuschku.quasseldroid.util.ui.fastscroll.views.FastScrollRecyclerView - android:id="@+id/list" - style="@style/Widget.FastScroller" - android:layout_width="match_parent" - android:layout_height="match_parent" - tools:listitem="@layout/widget_nick" /> - </LinearLayout> - - <de.kuschku.quasseldroid.util.ui.view.ShadowView - android:layout_width="match_parent" - android:layout_height="@dimen/shadow_height" - android:layout_gravity="bottom" - android:gravity="bottom" /> - </FrameLayout> - - <LinearLayout - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:gravity="end" - android:paddingLeft="16dp" - android:paddingTop="4dp" - android:paddingRight="16dp" - android:paddingBottom="4dp"> - - <com.google.android.material.button.MaterialButton - android:id="@+id/query" - style="@style/Widget.Button.Colored" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:text="@string/label_query_medium" /> - </LinearLayout> -</LinearLayout> diff --git a/app/src/main/res/layout/chat_archive.xml b/app/src/main/res/layout/chat_archive.xml deleted file mode 100644 index 673305f4f2af83deb7453dae09c212aeb0bc77a7..0000000000000000000000000000000000000000 --- a/app/src/main/res/layout/chat_archive.xml +++ /dev/null @@ -1,27 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - - -<de.kuschku.quasseldroid.util.ui.fastscroll.views.FastScrollRecyclerView xmlns:android="http://schemas.android.com/apk/res/android" - xmlns:tools="http://schemas.android.com/tools" - android:id="@+id/list" - style="@style/Widget.FastScroller" - android:layout_width="match_parent" - android:layout_height="match_parent" - tools:listitem="@layout/widget_buffer" /> diff --git a/app/src/main/res/layout/chat_channel_join.xml b/app/src/main/res/layout/chat_channel_join.xml deleted file mode 100644 index 3564417f8ca497d9bd42eaebe8ad09e3f64ec298..0000000000000000000000000000000000000000 --- a/app/src/main/res/layout/chat_channel_join.xml +++ /dev/null @@ -1,117 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" - xmlns:app="http://schemas.android.com/apk/res-auto" - xmlns:tools="http://schemas.android.com/tools" - android:layout_width="match_parent" - android:layout_height="match_parent" - android:orientation="vertical"> - - <de.kuschku.ui.spinner.MaterialSpinnerLayout - style="@style/Widget.CustomSpinnerLayout" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:hint="@string/label_network"> - - <androidx.appcompat.widget.AppCompatSpinner - android:id="@+id/network" - style="@style/Widget.MaterialSpinner" - android:layout_width="match_parent" - android:layout_height="wrap_content" - tools:listitem="@layout/widget_spinner_item_material" /> - </de.kuschku.ui.spinner.MaterialSpinnerLayout> - - <androidx.cardview.widget.CardView - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:layout_margin="6dp" - app:cardBackgroundColor="?colorBackgroundCard" - app:cardElevation="2dp"> - - <LinearLayout - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:orientation="vertical"> - - <LinearLayout - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:orientation="horizontal"> - - <EditText - android:id="@+id/search_input" - android:layout_width="0dip" - android:layout_height="wrap_content" - android:layout_weight="1" - android:background="@android:color/transparent" - android:hint="@string/label_search_channels" - android:imeOptions="actionSearch" - android:importantForAutofill="no" - android:inputType="textNoSuggestions" - android:lines="1" - android:minHeight="40dp" - android:paddingLeft="8dp" - android:paddingRight="8dp" - android:textColor="?colorTextPrimary" - android:textColorHint="?colorTextSecondary" - android:textSize="16sp" /> - - <androidx.appcompat.widget.AppCompatImageButton - android:id="@+id/search_button" - android:layout_width="40dp" - android:layout_height="match_parent" - android:background="?selectableItemBackgroundBorderless" - android:contentDescription="@string/label_search" - app:srcCompat="@drawable/ic_search" - app:tint="?colorTextSecondary" /> - - </LinearLayout> - - <de.kuschku.quasseldroid.util.ui.view.MaterialContentLoadingProgressBar - android:id="@+id/progress" - style="@style/Widget.MaterialProgressBar.ProgressBar.Horizontal.NoPadding" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:layout_gravity="bottom" - android:visibility="gone" - app:mpb_progressStyle="horizontal" - app:mpb_setBothDrawables="true" - app:mpb_useIntrinsicPadding="false" - tools:indeterminate="true" /> - - </LinearLayout> - - </androidx.cardview.widget.CardView> - - <de.kuschku.quasseldroid.util.ui.view.WarningBarView - android:id="@+id/error" - android:layout_width="match_parent" - android:layout_height="wrap_content" - app:icon="@drawable/ic_alert" - app:mode="none" /> - - <de.kuschku.quasseldroid.util.ui.fastscroll.views.FastScrollRecyclerView - android:id="@+id/search_results" - style="@style/Widget.FastScroller" - android:layout_width="match_parent" - android:layout_height="match_parent" - tools:listitem="@layout/widget_channel_search" /> - -</LinearLayout> diff --git a/app/src/main/res/layout/chat_chatline.xml b/app/src/main/res/layout/chat_chatline.xml deleted file mode 100644 index d732f309208d21c9300ef0eaa401e42ad773b4ba..0000000000000000000000000000000000000000 --- a/app/src/main/res/layout/chat_chatline.xml +++ /dev/null @@ -1,31 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android" - android:id="@+id/history_panel" - android:layout_width="match_parent" - android:layout_height="match_parent" - android:background="?colorBackground" - android:gravity="bottom"> - - <include layout="@layout/layout_editor" /> - - <include layout="@layout/layout_history" /> - -</androidx.coordinatorlayout.widget.CoordinatorLayout> diff --git a/app/src/main/res/layout/chat_chatlist.xml b/app/src/main/res/layout/chat_chatlist.xml deleted file mode 100644 index 6ac291043af387511c1f369958304f2bd669cf07..0000000000000000000000000000000000000000 --- a/app/src/main/res/layout/chat_chatlist.xml +++ /dev/null @@ -1,92 +0,0 @@ -<!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android" - xmlns:app="http://schemas.android.com/apk/res-auto" - xmlns:tools="http://schemas.android.com/tools" - android:layout_width="match_parent" - android:layout_height="match_parent"> - - <com.google.android.material.appbar.AppBarLayout - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:theme="?attr/actionBarTheme"> - - <androidx.appcompat.widget.Toolbar - android:id="@+id/chatListToolbar" - android:layout_width="match_parent" - android:layout_height="?attr/actionBarSize" - app:contentInsetLeft="0dip" - app:contentInsetStart="0dip" - app:contentInsetStartWithNavigation="0dip" - app:popupTheme="?attr/actionBarPopupTheme"> - - <androidx.appcompat.widget.AppCompatSpinner - android:id="@+id/chatListSpinner" - style="@style/Widget.FullWidthSpinner" - android:layout_width="fill_parent" - android:layout_height="match_parent" - app:popupTheme="?attr/actionBarPopupTheme" - tools:listitem="@layout/widget_spinner_item_toolbar" /> - - </androidx.appcompat.widget.Toolbar> - - <LinearLayout - android:layout_width="match_parent" - android:layout_height="match_parent" - android:orientation="vertical" - app:layout_behavior="@string/appbar_scrolling_view_behavior"> - - <include layout="@layout/widget_search" /> - - <de.kuschku.quasseldroid.util.ui.view.WarningBarView - android:id="@+id/feature_context_bufferactivitysync" - android:layout_width="match_parent" - android:layout_height="wrap_content" - app:icon="@drawable/ic_alert" - app:text="@string/label_feature_context_bufferactivitysync" /> - </LinearLayout> - - </com.google.android.material.appbar.AppBarLayout> - - <de.kuschku.quasseldroid.util.ui.fastscroll.views.FastScrollRecyclerView - android:id="@+id/chatList" - style="@style/Widget.FastScroller" - android:layout_width="match_parent" - android:layout_height="match_parent" - app:layout_behavior="@string/appbar_scrolling_view_behavior" - tools:listitem="@layout/widget_buffer" /> - - <com.leinardi.android.speeddial.SpeedDialOverlayLayout - android:id="@+id/fab_chatlist_overlay" - android:layout_width="match_parent" - android:layout_height="match_parent" - android:background="?colorBackgroundAlpha" - app:layout_behavior="@string/appbar_scrolling_view_behavior" /> - - <com.leinardi.android.speeddial.SpeedDialView - android:id="@+id/fab_chatlist" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_gravity="bottom|end" - app:layout_behavior="@string/speeddial_scrolling_view_snackbar_behavior" - app:sdMainFabClosedSrc="@drawable/ic_add" - app:sdOverlayLayout="@id/fab_chatlist_overlay" /> - -</androidx.coordinatorlayout.widget.CoordinatorLayout> diff --git a/app/src/main/res/layout/chat_messages.xml b/app/src/main/res/layout/chat_messages.xml deleted file mode 100644 index 148eaf96457830ce5f4d30404f07d68cb75b96d0..0000000000000000000000000000000000000000 --- a/app/src/main/res/layout/chat_messages.xml +++ /dev/null @@ -1,76 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" - xmlns:app="http://schemas.android.com/apk/res-auto" - xmlns:tools="http://schemas.android.com/tools" - android:layout_width="match_parent" - android:layout_height="match_parent" - android:background="?attr/colorBackground" - tools:showIn="@layout/activity_main"> - - <androidx.swiperefreshlayout.widget.SwipeRefreshLayout - android:id="@+id/swipeRefreshLayout" - android:layout_width="match_parent" - android:layout_height="match_parent"> - - <androidx.recyclerview.widget.RecyclerView - android:id="@+id/messages" - android:layout_width="match_parent" - android:layout_height="match_parent" - android:scrollbars="vertical" - app:stackFromEnd="true" - tools:listitem="@layout/widget_chatmessage_plain" /> - - </androidx.swiperefreshlayout.widget.SwipeRefreshLayout> - <LinearLayout - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:orientation="vertical" - android:layout_gravity="end|bottom" - android:layout_marginEnd="12dp" - android:layout_marginBottom="12dp"> - - <com.google.android.material.floatingactionbutton.FloatingActionButton - android:id="@+id/scrollUp" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:tint="@color/colorFillDark" - android:visibility="gone" - app:backgroundTint="#8A808080" - app:elevation="0dip" - app:fabSize="mini" - app:pressedTranslationZ="0dip" - app:srcCompat="@drawable/ic_scroll_up" /> - - <com.google.android.material.floatingactionbutton.FloatingActionButton - android:id="@+id/scrollDown" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:tint="@color/colorFillDark" - android:visibility="gone" - app:backgroundTint="#8A808080" - app:elevation="0dip" - app:fabSize="mini" - app:pressedTranslationZ="0dip" - app:srcCompat="@drawable/ic_scroll_down" /> - - </LinearLayout> - -</FrameLayout> diff --git a/app/src/main/res/layout/chat_nicklist.xml b/app/src/main/res/layout/chat_nicklist.xml deleted file mode 100644 index 0984abeb91b07fa7ddd524a7b854f046de167e05..0000000000000000000000000000000000000000 --- a/app/src/main/res/layout/chat_nicklist.xml +++ /dev/null @@ -1,30 +0,0 @@ -<!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<de.kuschku.quasseldroid.util.ui.view.DrawerRecyclerView xmlns:android="http://schemas.android.com/apk/res/android" - xmlns:tools="http://schemas.android.com/tools" - android:id="@+id/nickList" - style="@style/Widget.FastScroller" - android:layout_width="match_parent" - android:layout_height="match_parent" - android:background="?attr/colorBackground" - android:clipToPadding="false" - android:fitsSystemWindows="true" - tools:listitem="@layout/widget_nick" - tools:showIn="@layout/activity_main" /> diff --git a/app/src/main/res/layout/chat_toolbar.xml b/app/src/main/res/layout/chat_toolbar.xml deleted file mode 100644 index 0f3afc4d98ed9e93d762f63380b33c2d9c224064..0000000000000000000000000000000000000000 --- a/app/src/main/res/layout/chat_toolbar.xml +++ /dev/null @@ -1,84 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" - xmlns:tools="http://schemas.android.com/tools" - android:id="@+id/toolbar_action_area" - android:layout_width="match_parent" - android:layout_height="match_parent" - android:background="?attr/selectableItemBackgroundBorderless" - android:clickable="true" - android:contentDescription="@string/label_info" - android:focusable="true" - android:focusableInTouchMode="false" - android:minHeight="?attr/actionBarSize" - android:orientation="horizontal" - android:theme="?attr/actionBarTheme" - tools:showIn="@layout/activity_main"> - - <androidx.appcompat.widget.AppCompatImageView - android:id="@+id/toolbar_icon" - android:layout_width="@dimen/avatar_size_buffer" - android:layout_height="@dimen/avatar_size_buffer" - android:layout_gravity="center_vertical" - android:layout_marginEnd="8dp" - android:visibility="gone" - tools:src="@tools:sample/avatars" - tools:visibility="visible" /> - - <LinearLayout - android:layout_width="match_parent" - android:layout_height="match_parent" - android:gravity="center_vertical|start" - android:orientation="vertical"> - - <LinearLayout - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_gravity="center_vertical|start" - android:layout_marginTop="-2dp" - android:baselineAligned="false"> - - <TextView - android:id="@+id/toolbar_title" - style="@style/Widget.RtlConformTextView" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:ellipsize="end" - android:gravity="center_vertical" - android:singleLine="true" - android:text="@string/app_name" - android:textAppearance="@style/TextAppearance.AppCompat.Widget.ActionBar.Title" - android:textColor="?android:textColorPrimary" /> - - </LinearLayout> - - <TextView - android:id="@+id/toolbar_subtitle" - style="@style/TextAppearance.AppCompat.Widget.ActionBar.Subtitle" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_marginTop="-3dp" - android:ellipsize="end" - android:singleLine="true" - android:textColor="?android:textColorSecondary" - android:visibility="gone" /> - - </LinearLayout> -</LinearLayout> diff --git a/app/src/main/res/layout/dialog_colorchooser.xml b/app/src/main/res/layout/dialog_colorchooser.xml deleted file mode 100644 index 0eb8def4cb1d872616ac296d119cfc05af0506ed..0000000000000000000000000000000000000000 --- a/app/src/main/res/layout/dialog_colorchooser.xml +++ /dev/null @@ -1,39 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<ScrollView xmlns:android="http://schemas.android.com/apk/res/android" - xmlns:tools="http://schemas.android.com/tools" - android:layout_width="match_parent" - android:layout_height="match_parent" - tools:ignore="PrivateResource"> - - <FrameLayout - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:orientation="vertical"> - - <include layout="@layout/dialog_colorchooser_presets" /> - - <include - layout="@layout/dialog_colorchooser_custom" - android:visibility="gone" /> - - </FrameLayout> - -</ScrollView> diff --git a/app/src/main/res/layout/dialog_colorchooser_custom.xml b/app/src/main/res/layout/dialog_colorchooser_custom.xml deleted file mode 100644 index 348f547e6f1112c915732e2591f085061d3b86eb..0000000000000000000000000000000000000000 --- a/app/src/main/res/layout/dialog_colorchooser_custom.xml +++ /dev/null @@ -1,235 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" - xmlns:tools="http://schemas.android.com/tools" - android:id="@+id/md_colorChooserCustomFrame" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:orientation="vertical" - android:paddingTop="@dimen/md_title_frame_margin_bottom" - android:paddingBottom="@dimen/md_title_frame_margin_bottom" - tools:ignore="PrivateResource"> - - <View - android:id="@+id/md_colorIndicator" - android:layout_width="match_parent" - android:layout_height="120dp" - tools:background="@color/md_material_blue_600" /> - - <LinearLayout - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:layout_gravity="center_horizontal" - android:layout_marginTop="@dimen/md_title_frame_margin_bottom" - android:gravity="center"> - - <TextView - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_marginEnd="2dp" - android:digits="0123456789abcdefABCDEF" - android:text="#" - android:textColor="?colorTextPrimary" - android:textSize="@dimen/md_title_textsize" - tools:ignore="HardcodedText,TextViewEdits" /> - - <EditText - android:id="@+id/md_hexInput" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:digits="0123456789abcdefABCDEF" - android:focusable="true" - android:hint="FF0099CC" - android:inputType="textNoSuggestions" - android:textColor="?colorTextPrimary" - android:textColorHint="?colorTextSecondary" - android:textSize="@dimen/md_title_textsize" - tools:ignore="HardcodedText" /> - - </LinearLayout> - - <RelativeLayout - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:layout_marginTop="@dimen/md_title_frame_margin_bottom" - android:paddingLeft="@dimen/md_dialog_frame_margin" - android:paddingRight="@dimen/md_dialog_frame_margin"> - - <!-- Alpha --> - - <TextView - android:id="@+id/md_colorALabel" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_alignTop="@+id/md_colorA" - android:layout_alignBottom="@+id/md_colorA" - android:layout_marginEnd="4dp" - android:text="A" - android:textColor="?colorTextPrimary" - android:textSize="@dimen/md_content_textsize" - tools:ignore="HardcodedText" /> - - <SeekBar - android:id="@+id/md_colorA" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:layout_marginTop="@dimen/md_title_frame_margin_bottom" - android:layout_toStartOf="@+id/md_colorAValue" - android:layout_toEndOf="@+id/md_colorALabel" - android:focusable="true" - android:max="255" /> - - <TextView - android:id="@+id/md_colorAValue" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_alignTop="@+id/md_colorA" - android:layout_alignBottom="@+id/md_colorA" - android:layout_alignParentEnd="true" - android:layout_marginStart="4dp" - android:gravity="center" - android:minWidth="24dp" - android:text="0" - android:textColor="?colorTextPrimary" - android:textSize="@dimen/md_content_textsize" - tools:ignore="HardcodedText" /> - - <!-- Red --> - - <TextView - android:id="@+id/md_colorRLabel" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_alignTop="@+id/md_colorR" - android:layout_alignBottom="@+id/md_colorR" - android:layout_marginEnd="4dp" - android:text="R" - android:textColor="?colorTextPrimary" - android:textSize="@dimen/md_content_textsize" - tools:ignore="HardcodedText" /> - - <androidx.appcompat.widget.AppCompatSeekBar - android:id="@+id/md_colorR" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:layout_below="@+id/md_colorA" - android:layout_marginTop="@dimen/md_title_frame_margin_bottom" - android:layout_toStartOf="@+id/md_colorRValue" - android:layout_toEndOf="@+id/md_colorRLabel" - android:focusable="true" - android:max="255" /> - - <TextView - android:id="@+id/md_colorRValue" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_alignTop="@+id/md_colorR" - android:layout_alignBottom="@+id/md_colorR" - android:layout_alignParentEnd="true" - android:layout_marginStart="4dp" - android:gravity="center" - android:minWidth="24dp" - android:text="0" - android:textColor="?colorTextPrimary" - android:textSize="@dimen/md_content_textsize" - tools:ignore="HardcodedText" /> - - <!-- Green --> - - <TextView - android:id="@+id/md_colorGLabel" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_alignTop="@+id/md_colorG" - android:layout_alignBottom="@+id/md_colorG" - android:layout_marginEnd="4dp" - android:text="G" - android:textColor="?colorTextPrimary" - android:textSize="@dimen/md_content_textsize" - tools:ignore="HardcodedText" /> - - <SeekBar - android:id="@+id/md_colorG" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:layout_below="@+id/md_colorR" - android:layout_marginTop="@dimen/md_title_frame_margin_bottom" - android:layout_toStartOf="@+id/md_colorGValue" - android:layout_toEndOf="@+id/md_colorGLabel" - android:focusable="true" - android:max="255" /> - - <TextView - android:id="@+id/md_colorGValue" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_alignTop="@+id/md_colorG" - android:layout_alignBottom="@+id/md_colorG" - android:layout_alignParentEnd="true" - android:layout_marginStart="4dp" - android:gravity="center" - android:minWidth="24dp" - android:text="0" - android:textColor="?colorTextPrimary" - android:textSize="@dimen/md_content_textsize" - tools:ignore="HardcodedText" /> - - <!-- Blue --> - - <TextView - android:id="@+id/md_colorBLabel" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_alignTop="@+id/md_colorB" - android:layout_alignBottom="@+id/md_colorB" - android:layout_marginEnd="4dp" - android:text="B" - android:textColor="?colorTextPrimary" - android:textSize="@dimen/md_content_textsize" - tools:ignore="HardcodedText" /> - - <SeekBar - android:id="@+id/md_colorB" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:layout_below="@+id/md_colorG" - android:layout_marginTop="@dimen/md_title_frame_margin_bottom" - android:layout_toStartOf="@+id/md_colorBValue" - android:layout_toEndOf="@+id/md_colorBLabel" - android:max="255" /> - - <TextView - android:id="@+id/md_colorBValue" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_alignTop="@+id/md_colorB" - android:layout_alignBottom="@+id/md_colorB" - android:layout_alignParentEnd="true" - android:layout_marginStart="4dp" - android:gravity="center" - android:minWidth="24dp" - android:text="0" - android:textColor="?colorTextPrimary" - android:textSize="@dimen/md_content_textsize" - tools:ignore="HardcodedText" /> - - </RelativeLayout> - -</LinearLayout> diff --git a/app/src/main/res/layout/dialog_colorchooser_presets.xml b/app/src/main/res/layout/dialog_colorchooser_presets.xml deleted file mode 100644 index 26b6811fa9b024c3f7ad55f46c6e21c8bce1e643..0000000000000000000000000000000000000000 --- a/app/src/main/res/layout/dialog_colorchooser_presets.xml +++ /dev/null @@ -1,34 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<com.afollestad.materialdialogs.color.FillGridView xmlns:android="http://schemas.android.com/apk/res/android" - xmlns:tools="http://schemas.android.com/tools" - android:id="@+id/md_grid" - android:layout_width="match_parent" - android:layout_height="match_parent" - android:clipToPadding="false" - android:columnWidth="@dimen/colorchooser_circlesize" - android:gravity="center" - android:horizontalSpacing="8dp" - android:numColumns="auto_fit" - android:orientation="vertical" - android:padding="16dp" - android:stretchMode="columnWidth" - android:verticalSpacing="8dp" - tools:ignore="PrivateResource" /> diff --git a/app/src/main/res/layout/dialog_missing_features.xml b/app/src/main/res/layout/dialog_missing_features.xml deleted file mode 100644 index fc8988e99e2a1342cff636a0ac55e457301558ae..0000000000000000000000000000000000000000 --- a/app/src/main/res/layout/dialog_missing_features.xml +++ /dev/null @@ -1,54 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<androidx.core.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android" - xmlns:tools="http://schemas.android.com/tools" - android:layout_width="match_parent" - android:layout_height="match_parent"> - - <LinearLayout - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:descendantFocusability="blocksDescendants" - android:orientation="vertical" - android:paddingTop="8dp" - android:paddingBottom="8dp"> - - <TextView - android:id="@+id/message" - style="@style/Widget.RtlConformTextView" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:paddingStart="?listPreferredItemPaddingLeft" - android:paddingTop="8dp" - android:paddingEnd="?listPreferredItemPaddingRight" - android:paddingBottom="8dp" - android:textColor="?colorTextPrimary" - android:textSize="16sp" /> - - <androidx.recyclerview.widget.RecyclerView - android:id="@+id/list" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:nestedScrollingEnabled="false" - tools:ignore="UnusedAttribute" - tools:itemCount="3" - tools:listitem="@layout/widget_missing_feature" /> - </LinearLayout> -</androidx.core.widget.NestedScrollView> diff --git a/app/src/main/res/layout/info_certificate.xml b/app/src/main/res/layout/info_certificate.xml deleted file mode 100644 index 0f7a7bbfbf94db4b6c0cf3b8858e6d068a18ada3..0000000000000000000000000000000000000000 --- a/app/src/main/res/layout/info_certificate.xml +++ /dev/null @@ -1,248 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - - -<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" - xmlns:app="http://schemas.android.com/apk/res-auto" - xmlns:tools="http://schemas.android.com/tools" - android:layout_width="match_parent" - android:layout_height="match_parent"> - - <androidx.core.widget.NestedScrollView - android:id="@+id/content" - android:layout_width="match_parent" - android:layout_height="match_parent" - android:orientation="vertical"> - - <LinearLayout - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:orientation="vertical"> - - <LinearLayout style="@style/Widget.CoreSettings.PrimaryItemGroupHeader"> - - <androidx.appcompat.widget.AppCompatImageView - style="@style/Widget.CoreSettings.PrimaryItemIcon" - app:srcCompat="@drawable/ic_account" /> - - <TextView - style="@style/Widget.CoreSettings.PrimaryItemSwitch" - android:text="@string/certificate_subject" /> - </LinearLayout> - - <LinearLayout - android:id="@+id/subject_common_name_wrapper" - style="@style/Widget.CoreSettings.PrimaryItemGroup"> - - <TextView - style="@style/Widget.CoreSettings.SubHeader" - android:text="@string/certificate_common_name" /> - - <TextView - android:id="@+id/subject_common_name" - style="@style/Widget.CoreSettings.SelectableTextView" - tools:text="*.reddit.com" /> - </LinearLayout> - - <LinearLayout - android:id="@+id/subject_hostnames_wrapper" - style="@style/Widget.CoreSettings.PrimaryItemGroup"> - - <TextView - style="@style/Widget.CoreSettings.SubHeader" - android:text="@string/certificate_hostnames" /> - - <TextView - android:id="@+id/subject_hostnames" - style="@style/Widget.CoreSettings.SelectableTextView" - tools:text="*.reddit.com, reddit.com, *.redditmedia.com, redditmedia.com, *.redd.it, redd.it, www.redditstatic.com, i.reddituploads.com, *.thumbs.redditmedia.com, www.redditinc.com, redditinc.com" /> - </LinearLayout> - - <LinearLayout - android:id="@+id/subject_organization_wrapper" - style="@style/Widget.CoreSettings.PrimaryItemGroup"> - - <TextView - style="@style/Widget.CoreSettings.SubHeader" - android:text="@string/certificate_organization" /> - - <TextView - android:id="@+id/subject_organization" - style="@style/Widget.CoreSettings.SelectableTextView" - tools:text="Reddit Inc." /> - </LinearLayout> - - <LinearLayout - android:id="@+id/subject_organizational_unit_wrapper" - style="@style/Widget.CoreSettings.PrimaryItemGroup"> - - <TextView - style="@style/Widget.CoreSettings.SubHeader" - android:text="@string/certificate_organizational_unit" /> - - <TextView - android:id="@+id/subject_organizational_unit" - style="@style/Widget.CoreSettings.SelectableTextView" - tools:text="<Not Part Of Certificate>" /> - </LinearLayout> - - <LinearLayout style="@style/Widget.CoreSettings.PrimaryItemGroupHeader"> - - <androidx.appcompat.widget.AppCompatImageView - style="@style/Widget.CoreSettings.PrimaryItemIcon" - app:srcCompat="@drawable/ic_domain" /> - - <TextView - style="@style/Widget.CoreSettings.PrimaryItemSwitch" - android:text="@string/certificate_issuer" /> - </LinearLayout> - - <LinearLayout - android:id="@+id/issuer_common_name_wrapper" - style="@style/Widget.CoreSettings.PrimaryItemGroup"> - - <TextView - style="@style/Widget.CoreSettings.SubHeader" - android:text="@string/certificate_common_name" /> - - <TextView - android:id="@+id/issuer_common_name" - style="@style/Widget.CoreSettings.SelectableTextView" - tools:text="DigiCert SHA2 Secure Server CA" /> - </LinearLayout> - - <LinearLayout - android:id="@+id/issuer_organization_wrapper" - style="@style/Widget.CoreSettings.PrimaryItemGroup"> - - <TextView - style="@style/Widget.CoreSettings.SubHeader" - android:text="@string/certificate_organization" /> - - <TextView - android:id="@+id/issuer_organization" - style="@style/Widget.CoreSettings.SelectableTextView" - tools:text="DigiCert Inc" /> - </LinearLayout> - - <LinearLayout - android:id="@+id/issuer_organizational_unit_wrapper" - style="@style/Widget.CoreSettings.PrimaryItemGroup"> - - <TextView - style="@style/Widget.CoreSettings.SubHeader" - android:text="@string/certificate_organizational_unit" /> - - <TextView - android:id="@+id/issuer_organizational_unit" - style="@style/Widget.CoreSettings.SelectableTextView" - tools:text="<Not Part Of Certificate>" /> - </LinearLayout> - - <LinearLayout style="@style/Widget.CoreSettings.PrimaryItemGroupHeader"> - - <androidx.appcompat.widget.AppCompatImageView - style="@style/Widget.CoreSettings.PrimaryItemIcon" - app:srcCompat="@drawable/ic_clock" /> - - <TextView - style="@style/Widget.CoreSettings.PrimaryItemSwitch" - android:text="@string/certificate_validity" /> - </LinearLayout> - - <LinearLayout style="@style/Widget.CoreSettings.PrimaryItemGroup"> - - <TextView - style="@style/Widget.CoreSettings.SubHeader" - android:text="@string/certificate_not_before" /> - - <TextView - android:id="@+id/not_before" - style="@style/Widget.CoreSettings.SelectableTextView" - tools:text="17. August 2018" /> - </LinearLayout> - - <LinearLayout style="@style/Widget.CoreSettings.PrimaryItemGroup"> - - <TextView - style="@style/Widget.CoreSettings.SubHeader" - android:text="@string/certificate_not_after" /> - - <TextView - android:id="@+id/not_after" - style="@style/Widget.CoreSettings.SelectableTextView" - tools:text="2. September 2020" /> - </LinearLayout> - - <LinearLayout style="@style/Widget.CoreSettings.PrimaryItemGroupHeader"> - - <androidx.appcompat.widget.AppCompatImageView - style="@style/Widget.CoreSettings.PrimaryItemIcon" - app:srcCompat="@drawable/ic_fingerprint" /> - - <TextView - style="@style/Widget.CoreSettings.PrimaryItemSwitch" - android:text="@string/certificate_fingerprints" /> - </LinearLayout> - - <LinearLayout style="@style/Widget.CoreSettings.PrimaryItemGroup"> - - <TextView - style="@style/Widget.CoreSettings.SubHeader" - android:text="@string/certificate_fingerprint_sha256" /> - - <TextView - android:id="@+id/fingerprint_sha256" - style="@style/Widget.CoreSettings.SelectableTextView" - tools:text="77:C7:6C:11:70:33:25:EE:F0:6C:3B:E3:0F:15:C2:CB:2A:73:7A:56:F3:40:FD:76:29:1E:06:CB:0D:45:48:2C" /> - </LinearLayout> - - <LinearLayout style="@style/Widget.CoreSettings.PrimaryItemGroup"> - - <TextView - style="@style/Widget.CoreSettings.SubHeader" - android:text="@string/certificate_fingerprint_sha1" /> - - <TextView - android:id="@+id/fingerprint_sha1" - style="@style/Widget.CoreSettings.SelectableTextView" - tools:text="E3:C0:F1:CF:CB:A4:61:09:02:1A:74:06:71:83:CD:A8:59:28:B4:0D" /> - </LinearLayout> - - <Space - android:layout_width="match_parent" - android:layout_height="16dp" /> - </LinearLayout> - </androidx.core.widget.NestedScrollView> - - <TextView - android:id="@+id/error" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:layout_gravity="center" - android:gravity="center" - android:minHeight="?android:attr/listPreferredItemHeightSmall" - android:paddingStart="?listPreferredItemPaddingLeft" - android:paddingEnd="?listPreferredItemPaddingRight" - android:text="@string/label_error_certificate_no_certificate" - android:textColor="?colorTextSecondary" - android:textStyle="italic" - android:visibility="gone" - tools:visibility="visible" /> -</FrameLayout> diff --git a/app/src/main/res/layout/info_channel.xml b/app/src/main/res/layout/info_channel.xml deleted file mode 100644 index 6dce3124b01ab288ecd0e84ede953bbfcc59e0af..0000000000000000000000000000000000000000 --- a/app/src/main/res/layout/info_channel.xml +++ /dev/null @@ -1,111 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<androidx.core.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android" - xmlns:tools="http://schemas.android.com/tools" - android:layout_width="match_parent" - android:layout_height="match_parent" - android:orientation="vertical"> - - <LinearLayout - android:layout_width="match_parent" - android:layout_height="match_parent" - android:animateLayoutChanges="true" - android:orientation="vertical"> - - <LinearLayout style="@style/Widget.Info.Header"> - - <TextView - android:id="@+id/name" - style="@style/Widget.Info.Header.Name" - android:textIsSelectable="true" - tools:text="#quassel" /> - - <TextView - android:id="@+id/topic" - style="@style/Widget.Info.Header.Description" - android:textIsSelectable="true" - tools:text="Quassel IRC - https://quassel-irc.org || Latest: 0.12.4 || Mailing Lists: https://lists.quassel-irc.org || Tracker: https://bugs.quassel-irc.org || Activity RSS: #quassel-announce || German: #quassel.de || Quassel on Android: #quasseldroid; on iOS: #woboquassel || Server migration complete; new IPs may still need some time to propagate" /> - </LinearLayout> - - <View - android:layout_width="match_parent" - android:layout_height="1dp" - android:background="?colorDivider" /> - - <HorizontalScrollView - android:layout_width="match_parent" - android:layout_height="wrap_content"> - - <LinearLayout - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:paddingStart="?android:attr/listPreferredItemPaddingLeft" - android:paddingEnd="?android:attr/listPreferredItemPaddingRight"> - - <androidx.appcompat.widget.AppCompatButton - android:id="@+id/action_edit_topic" - style="@style/Widget.Info.ActionButton" - android:contentDescription="@string/label_edit_topic_long" - android:text="@string/label_edit_topic" - tools:drawableTint="?colorTextSecondary" - tools:drawableTop="@drawable/ic_pencil" /> - - <androidx.appcompat.widget.AppCompatButton - android:id="@+id/action_who" - style="@style/Widget.Info.ActionButton" - android:contentDescription="@string/label_who_long" - android:text="@string/label_who" - tools:drawableTint="?colorTextSecondary" - tools:drawableTop="@drawable/ic_info" /> - - <androidx.appcompat.widget.AppCompatButton - android:id="@+id/action_join" - style="@style/Widget.Info.ActionButton" - android:contentDescription="@string/label_join_long" - android:text="@string/label_join" - android:visibility="gone" - tools:drawableTint="?colorTextSecondary" - tools:drawableTop="@drawable/ic_account_plus" - tools:visibility="visible" /> - - <androidx.appcompat.widget.AppCompatButton - android:id="@+id/action_part" - style="@style/Widget.Info.ActionButton" - android:contentDescription="@string/label_part_long" - android:text="@string/label_part" - tools:drawableTint="?colorTextSecondary" - tools:drawableTop="@drawable/ic_account_minus" /> - - <androidx.appcompat.widget.AppCompatButton - android:id="@+id/action_shortcut" - style="@style/Widget.Info.ActionButton" - android:contentDescription="@string/label_shortcut_long" - android:text="@string/label_shortcut" - tools:drawableTint="?colorTextSecondary" - tools:drawableTop="@drawable/ic_link" /> - </LinearLayout> - </HorizontalScrollView> - - <View - android:layout_width="match_parent" - android:layout_height="1dp" - android:background="?colorDivider" /> - </LinearLayout> -</androidx.core.widget.NestedScrollView> diff --git a/app/src/main/res/layout/info_channellist.xml b/app/src/main/res/layout/info_channellist.xml deleted file mode 100644 index 1d1f2321863fc5c4c57692c018d012e0f7a9d4df..0000000000000000000000000000000000000000 --- a/app/src/main/res/layout/info_channellist.xml +++ /dev/null @@ -1,103 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" - xmlns:app="http://schemas.android.com/apk/res-auto" - xmlns:tools="http://schemas.android.com/tools" - android:layout_width="match_parent" - android:layout_height="match_parent" - android:orientation="vertical"> - - <androidx.cardview.widget.CardView - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:layout_margin="6dp" - app:cardBackgroundColor="?colorBackgroundCard" - app:cardElevation="2dp"> - - <LinearLayout - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:orientation="vertical"> - - <LinearLayout - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:orientation="horizontal"> - - <EditText - android:id="@+id/search_input" - android:layout_width="0dip" - android:layout_height="wrap_content" - android:layout_weight="1" - android:background="@android:color/transparent" - android:hint="@string/label_search_channels" - android:imeOptions="actionSearch" - android:importantForAutofill="no" - android:inputType="textNoSuggestions" - android:lines="1" - android:minHeight="40dp" - android:paddingLeft="8dp" - android:paddingRight="8dp" - android:textColor="?colorTextPrimary" - android:textColorHint="?colorTextSecondary" - android:textSize="16sp" /> - - <androidx.appcompat.widget.AppCompatImageButton - android:id="@+id/search_button" - android:layout_width="40dp" - android:layout_height="match_parent" - android:background="?selectableItemBackgroundBorderless" - android:contentDescription="@string/label_search" - app:srcCompat="@drawable/ic_search" - app:tint="?colorTextSecondary" /> - - </LinearLayout> - - <de.kuschku.quasseldroid.util.ui.view.MaterialContentLoadingProgressBar - android:id="@+id/progress" - style="@style/Widget.MaterialProgressBar.ProgressBar.Horizontal.NoPadding" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:layout_gravity="bottom" - android:visibility="gone" - app:mpb_progressStyle="horizontal" - app:mpb_setBothDrawables="true" - app:mpb_useIntrinsicPadding="false" - tools:indeterminate="true" /> - - </LinearLayout> - - </androidx.cardview.widget.CardView> - - <de.kuschku.quasseldroid.util.ui.view.WarningBarView - android:id="@+id/error" - android:layout_width="match_parent" - android:layout_height="wrap_content" - app:icon="@drawable/ic_alert" - app:mode="none" /> - - <de.kuschku.quasseldroid.util.ui.fastscroll.views.FastScrollRecyclerView - android:id="@+id/search_results" - style="@style/Widget.FastScroller" - android:layout_width="match_parent" - android:layout_height="match_parent" - tools:listitem="@layout/widget_channel_search" /> - -</LinearLayout> diff --git a/app/src/main/res/layout/info_core.xml b/app/src/main/res/layout/info_core.xml deleted file mode 100644 index 8b5f3afe78a2f03de1535668da8d7822172fd756..0000000000000000000000000000000000000000 --- a/app/src/main/res/layout/info_core.xml +++ /dev/null @@ -1,155 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<androidx.core.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android" - xmlns:app="http://schemas.android.com/apk/res-auto" - xmlns:tools="http://schemas.android.com/tools" - android:layout_width="match_parent" - android:layout_height="match_parent" - android:orientation="vertical"> - - <LinearLayout - android:layout_width="match_parent" - android:layout_height="match_parent" - android:animateLayoutChanges="true" - android:orientation="vertical"> - - <TextView - style="@style/Widget.Info.Section" - android:text="@string/label_core_version" /> - - <LinearLayout style="@style/Widget.Info.Item"> - - <TextView - android:id="@+id/version" - style="@style/Widget.Info.Item.Content" - android:textIsSelectable="true" - tools:text="v0.13-pre (0.12.0+617 git-f4c93cad)" /> - - <TextView - android:id="@+id/version_date" - style="@style/Widget.Info.Item.Description" - android:textIsSelectable="true" - tools:text="June 8, 2018" /> - - <com.google.android.material.button.MaterialButton - android:id="@+id/missing_features" - style="@style/Widget.Button.Borderless.Colored" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:text="@string/label_missing_features" /> - </LinearLayout> - - <View - android:layout_width="match_parent" - android:layout_height="1dp" - android:background="?colorDivider" /> - - <TextView - style="@style/Widget.Info.Section" - android:text="@string/label_core_uptime" /> - - <LinearLayout - android:id="@+id/uptime_container" - style="@style/Widget.Info.Item" - android:visibility="gone" - tools:visibility="visible"> - - <TextView - android:id="@+id/uptime" - style="@style/Widget.Info.Item.Content" - tools:text="30 minutes" /> - </LinearLayout> - - <View - android:layout_width="match_parent" - android:layout_height="1dp" - android:background="?colorDivider" /> - - <TextView - style="@style/Widget.Info.Section" - android:text="@string/label_core_security" /> - - <LinearLayout - style="@style/Widget.Info.Item" - android:orientation="vertical"> - - <LinearLayout - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:orientation="horizontal"> - - <TextView - android:id="@+id/secure_certificate" - style="@style/Widget.CoreSettings.TextView" - android:layout_width="0dip" - android:layout_weight="1" - tools:text="Connection verified by Let’s Encrypt" /> - - <androidx.appcompat.widget.AppCompatImageView - android:id="@+id/secure_certificate_icon" - android:layout_width="24dp" - android:layout_height="24dp" - android:layout_gravity="center" - android:layout_marginStart="16dp" - app:srcCompat="@drawable/ic_lock" /> - - </LinearLayout> - - <TextView - android:id="@+id/secure_connection_protocol" - style="@style/Widget.CoreSettings.TextView" - tools:text="The connection uses TLS 1.2" /> - - <TextView - android:id="@+id/secure_connection_ciphersuite" - style="@style/Widget.CoreSettings.TextView" - tools:text="The connection is encrypted and authenticated using CHACHA20_POLY1305 and uses ECDHE_RSA as the key exchange mechanism" /> - - <com.google.android.material.button.MaterialButton - android:id="@+id/secure_details" - style="@style/Widget.Button.Borderless.Colored" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_gravity="end" - android:text="@string/label_info" /> - </LinearLayout> - - <View - android:layout_width="match_parent" - android:layout_height="1dp" - android:background="?colorDivider" /> - - <TextView - android:id="@+id/clients_title" - style="@style/Widget.Info.Section" - android:text="@string/label_core_clients" - android:visibility="gone" - tools:visibility="visible" /> - - <androidx.recyclerview.widget.RecyclerView - android:id="@+id/clients" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:nestedScrollingEnabled="false" - tools:ignore="UnusedAttribute" - tools:listitem="@layout/widget_client" /> - - </LinearLayout> -</androidx.core.widget.NestedScrollView> diff --git a/app/src/main/res/layout/info_topic.xml b/app/src/main/res/layout/info_topic.xml deleted file mode 100644 index 79e98de8d90e2c1ed39e7ec191ef453838c2d3f3..0000000000000000000000000000000000000000 --- a/app/src/main/res/layout/info_topic.xml +++ /dev/null @@ -1,78 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" - xmlns:app="http://schemas.android.com/apk/res-auto" - xmlns:tools="http://schemas.android.com/tools" - android:layout_width="match_parent" - android:layout_height="match_parent" - android:orientation="vertical"> - - <androidx.coordinatorlayout.widget.CoordinatorLayout - android:layout_width="match_parent" - android:layout_height="0dip" - android:layout_weight="1"> - - <ScrollView - android:layout_width="match_parent" - android:layout_height="match_parent" - android:scrollbars="vertical"> - - <de.kuschku.quasseldroid.ui.chat.input.RichEditText - android:id="@+id/chatline" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:background="@android:color/transparent" - android:gravity="center_vertical" - android:hint="@string/label_placeholder_topic" - android:imeOptions="flagNoExtractUi" - android:inputType="textCapSentences|textAutoCorrect|textShortMessage|textMultiLine" - android:minHeight="?attr/actionBarSize" - android:paddingLeft="20dp" - android:paddingTop="8dp" - android:paddingRight="20dp" - android:paddingBottom="8dp" - android:textColor="?attr/colorForeground" - android:textSize="16sp" /> - </ScrollView> - - <androidx.recyclerview.widget.RecyclerView - android:id="@+id/autocomplete_list" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:background="?colorBackgroundCard" - app:behavior_hideable="true" - app:behavior_peekHeight="@dimen/autocomplete_max_height" - app:layout_behavior="@string/bottom_sheet_behavior" - tools:listitem="@layout/widget_nick" /> - - </androidx.coordinatorlayout.widget.CoordinatorLayout> - - <com.google.android.material.appbar.AppBarLayout - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:background="?attr/colorBackgroundCard"> - - <de.kuschku.quasseldroid.ui.chat.input.RichToolbar - android:id="@+id/formatting_toolbar" - android:layout_width="match_parent" - android:layout_height="?attr/actionBarSize" - app:contentInsetStart="0dip" /> - </com.google.android.material.appbar.AppBarLayout> -</LinearLayout> diff --git a/app/src/main/res/layout/info_user.xml b/app/src/main/res/layout/info_user.xml deleted file mode 100644 index b10582711530edbfb0bc185f131a6f599a0d2f0e..0000000000000000000000000000000000000000 --- a/app/src/main/res/layout/info_user.xml +++ /dev/null @@ -1,264 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android" - xmlns:app="http://schemas.android.com/apk/res-auto" - xmlns:tools="http://schemas.android.com/tools" - android:layout_width="match_parent" - android:layout_height="match_parent"> - - <com.google.android.material.appbar.AppBarLayout - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:background="#40000000" - app:elevation="0dip"> - - <com.google.android.material.appbar.CollapsingToolbarLayout - android:layout_width="match_parent" - android:layout_height="wrap_content" - app:layout_scrollFlags="scroll"> - - <androidx.constraintlayout.widget.ConstraintLayout - android:layout_width="match_parent" - android:layout_height="wrap_content" - app:layout_collapseMode="parallax"> - - <ImageView - android:id="@+id/avatar" - android:layout_width="0dp" - android:layout_height="0dp" - android:adjustViewBounds="true" - android:contentDescription="@string/label_avatar" - android:scaleType="centerCrop" - app:layout_constraintDimensionRatio="1:1" - app:layout_constraintEnd_toEndOf="parent" - app:layout_constraintStart_toStartOf="parent" - app:layout_constraintTop_toTopOf="parent" - tools:src="@tools:sample/avatars" /> - - </androidx.constraintlayout.widget.ConstraintLayout> - - </com.google.android.material.appbar.CollapsingToolbarLayout> - </com.google.android.material.appbar.AppBarLayout> - - <androidx.core.widget.NestedScrollView - android:layout_width="match_parent" - android:layout_height="match_parent" - android:orientation="vertical" - app:layout_behavior="@string/appbar_scrolling_view_behavior"> - - <LinearLayout - android:layout_width="match_parent" - android:layout_height="match_parent" - android:animateLayoutChanges="true" - android:elevation="4dp" - android:orientation="vertical" - tools:ignore="UnusedAttribute"> - - <LinearLayout style="@style/Widget.Info.Header"> - - <TextView - android:id="@+id/nick" - style="@style/Widget.Info.Header.Name" - android:textIsSelectable="true" - tools:text="justJanne" /> - - <TextView - android:id="@+id/real_name" - style="@style/Widget.Info.Header.Description" - android:textIsSelectable="true" - tools:text="Janne Mareike Koschinski https://kuschku.de/" /> - </LinearLayout> - - <View - android:layout_width="match_parent" - android:layout_height="1dp" - android:background="?colorDivider" /> - - <HorizontalScrollView - android:layout_width="match_parent" - android:layout_height="wrap_content"> - - <LinearLayout - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:paddingStart="?android:attr/listPreferredItemPaddingLeft" - android:paddingEnd="?android:attr/listPreferredItemPaddingRight"> - - <androidx.appcompat.widget.AppCompatButton - android:id="@+id/action_query" - style="@style/Widget.Info.ActionButton" - android:contentDescription="@string/label_query_long" - android:text="@string/label_query" - tools:drawableTint="?colorTextSecondary" - tools:drawableTop="@drawable/ic_message_bulleted" /> - - <androidx.appcompat.widget.AppCompatButton - android:id="@+id/action_ignore" - style="@style/Widget.Info.ActionButton" - android:contentDescription="@string/label_ignore_long" - android:text="@string/label_ignore" - tools:drawableTint="?colorTextSecondary" - tools:drawableTop="@drawable/ic_eye_off" /> - - <androidx.appcompat.widget.AppCompatButton - android:id="@+id/action_whois" - style="@style/Widget.Info.ActionButton" - android:contentDescription="@string/label_whois_long" - android:text="@string/label_whois" - tools:drawableTint="?colorTextSecondary" - tools:drawableTop="@drawable/ic_info" /> - - <androidx.appcompat.widget.AppCompatButton - android:id="@+id/action_mention" - style="@style/Widget.Info.ActionButton" - android:contentDescription="@string/label_mention_long" - android:text="@string/label_mention" - tools:drawableTint="?colorTextSecondary" - tools:drawableTop="@drawable/ic_share_alternative" /> - - <androidx.appcompat.widget.AppCompatButton - android:id="@+id/action_shortcut" - style="@style/Widget.Info.ActionButton" - android:contentDescription="@string/label_shortcut_long" - android:text="@string/label_shortcut" - tools:drawableTint="?colorTextSecondary" - tools:drawableTop="@drawable/ic_link" /> - </LinearLayout> - </HorizontalScrollView> - - <View - android:layout_width="match_parent" - android:layout_height="1dp" - android:background="?colorDivider" /> - - <LinearLayout - android:id="@+id/away_container" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:orientation="vertical" - android:visibility="gone" - tools:visibility="visible"> - - <TextView - style="@style/Widget.Info.Section" - android:text="@string/label_user_away" /> - - <LinearLayout style="@style/Widget.Info.Item"> - - <TextView - android:id="@+id/away_message" - style="@style/Widget.Info.Item.Content" - android:textIsSelectable="true" - tools:text="~justJanne" /> - - <TextView - style="@style/Widget.Info.Item.Description" - android:text="@string/label_user_away_reason" /> - </LinearLayout> - - <View - android:layout_width="match_parent" - android:layout_height="1dp" - android:background="?colorDivider" /> - </LinearLayout> - - <TextView - style="@style/Widget.Info.Section" - android:text="@string/label_user_identity" /> - - <LinearLayout - android:id="@+id/account_container" - style="@style/Widget.Info.Item" - android:visibility="gone" - tools:visibility="visible"> - - <TextView - android:id="@+id/account" - style="@style/Widget.Info.Item.Content" - android:textIsSelectable="true" - tools:text="kuschku" /> - - <TextView - style="@style/Widget.Info.Item.Description" - android:text="@string/label_user_account" /> - </LinearLayout> - - <LinearLayout - android:id="@+id/ident_container" - style="@style/Widget.Info.Item" - android:visibility="gone" - tools:visibility="visible"> - - <TextView - android:id="@+id/ident" - style="@style/Widget.Info.Item.Content" - android:textIsSelectable="true" - tools:text="~justJanne" /> - - <TextView - style="@style/Widget.Info.Item.Description" - android:text="@string/label_user_ident" /> - </LinearLayout> - - <LinearLayout - android:id="@+id/host_container" - style="@style/Widget.Info.Item" - android:visibility="gone" - tools:visibility="visible"> - - <TextView - android:id="@+id/host" - style="@style/Widget.Info.Item.Content" - android:textIsSelectable="true" - tools:text="lithium.kuschku.de" /> - - <TextView - style="@style/Widget.Info.Item.Description" - android:text="@string/label_user_host" /> - </LinearLayout> - - <LinearLayout - android:id="@+id/server_container" - style="@style/Widget.Info.Item" - android:visibility="gone" - tools:visibility="visible"> - - <TextView - android:id="@+id/server" - style="@style/Widget.Info.Item.Content" - android:textIsSelectable="true" - tools:text="irc.freenode.org" /> - - <TextView - style="@style/Widget.Info.Item.Description" - android:text="@string/label_user_server" /> - </LinearLayout> - - <TextView - style="@style/Widget.Info.Section" - android:text="@string/label_user_common_channels" /> - - <androidx.recyclerview.widget.RecyclerView - android:id="@+id/common_channels" - android:layout_width="match_parent" - android:layout_height="wrap_content" /> - </LinearLayout> - </androidx.core.widget.NestedScrollView> -</androidx.coordinatorlayout.widget.CoordinatorLayout> diff --git a/app/src/main/res/layout/layout_editor.xml b/app/src/main/res/layout/layout_editor.xml deleted file mode 100644 index 5b7ea6a01b6fa67182b9edca5ca7d056c049830a..0000000000000000000000000000000000000000 --- a/app/src/main/res/layout/layout_editor.xml +++ /dev/null @@ -1,121 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" - xmlns:app="http://schemas.android.com/apk/res-auto" - xmlns:tools="http://schemas.android.com/tools" - android:id="@+id/editor_container" - android:layout_width="match_parent" - android:layout_height="match_parent" - android:orientation="vertical"> - - <androidx.coordinatorlayout.widget.CoordinatorLayout - android:layout_width="match_parent" - android:layout_height="0dip" - android:layout_weight="1" - android:orientation="vertical"> - - <LinearLayout - android:layout_width="match_parent" - android:layout_height="match_parent" - android:orientation="horizontal"> - - <androidx.appcompat.widget.AppCompatImageButton - android:id="@+id/tab_complete" - style="?attr/buttonStyleSmall" - android:layout_width="?attr/actionBarSize" - android:layout_height="?attr/actionBarSize" - android:layout_gravity="top" - android:background="?attr/selectableItemBackgroundBorderless" - android:contentDescription="@string/label_autocomplete" - android:padding="12dp" - android:scaleType="fitXY" - app:layout_constraintStart_toStartOf="parent" - app:layout_constraintTop_toTopOf="parent" - app:srcCompat="@drawable/ic_tab" - app:tint="?attr/colorTextSecondary" /> - - <de.kuschku.quasseldroid.util.ui.FixedNestingScrollView - android:id="@+id/chatline_scroller" - android:layout_width="0dip" - android:layout_height="match_parent" - android:layout_weight="1"> - - <de.kuschku.quasseldroid.ui.chat.input.RichEditText - android:id="@+id/chatline" - style="@style/Widget.RtlConformTextView" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:background="@android:color/transparent" - android:gravity="center_vertical" - android:hint="@string/label_placeholder_message" - android:imeOptions="flagNoExtractUi" - android:inputType="textCapSentences|textAutoCorrect|textShortMessage" - android:minHeight="?attr/actionBarSize" - android:paddingLeft="20dp" - android:paddingTop="8dp" - android:paddingRight="20dp" - android:paddingBottom="8dp" - android:textColor="?attr/colorForeground" - android:textSize="16sp" /> - </de.kuschku.quasseldroid.util.ui.FixedNestingScrollView> - - <androidx.appcompat.widget.AppCompatImageButton - android:id="@+id/send" - style="?attr/buttonStyleSmall" - android:layout_width="?attr/actionBarSize" - android:layout_height="?attr/actionBarSize" - android:layout_gravity="top" - android:autoMirrored="true" - android:background="?attr/selectableItemBackgroundBorderless" - android:contentDescription="@string/label_send" - android:padding="12dp" - android:scaleType="fitXY" - app:layout_constraintEnd_toEndOf="parent" - app:layout_constraintTop_toTopOf="parent" - app:srcCompat="@drawable/ic_send" - app:tint="?attr/colorAccent" - tools:ignore="UnusedAttribute" /> - </LinearLayout> - - <androidx.recyclerview.widget.RecyclerView - android:id="@+id/autocomplete_list" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:background="?colorBackgroundCard" - app:behavior_hideable="true" - app:behavior_peekHeight="@dimen/autocomplete_max_height" - app:layout_behavior="@string/bottom_sheet_behavior" - tools:listitem="@layout/widget_nick" /> - </androidx.coordinatorlayout.widget.CoordinatorLayout> - - <com.google.android.material.appbar.AppBarLayout - android:id="@+id/formatting_toolbar_container" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:background="?attr/colorBackgroundCard" - app:layout_constraintBottom_toBottomOf="parent"> - - <de.kuschku.quasseldroid.ui.chat.input.RichToolbar - android:id="@+id/formatting_toolbar" - android:layout_width="match_parent" - android:layout_height="?attr/actionBarSize" - app:contentInsetStart="0dip" /> - </com.google.android.material.appbar.AppBarLayout> -</LinearLayout> diff --git a/app/src/main/res/layout/layout_history.xml b/app/src/main/res/layout/layout_history.xml deleted file mode 100644 index 4d9b41b9bdffbf7d62133a1f15451de2a2cf2bab..0000000000000000000000000000000000000000 --- a/app/src/main/res/layout/layout_history.xml +++ /dev/null @@ -1,87 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<de.kuschku.quasseldroid.util.ui.view.TouchInterceptingFrameLayout xmlns:android="http://schemas.android.com/apk/res/android" - xmlns:app="http://schemas.android.com/apk/res-auto" - xmlns:tools="http://schemas.android.com/tools" - android:id="@+id/card_panel" - android:layout_width="match_parent" - android:layout_height="match_parent" - app:behavior_hideable="true" - app:behavior_skipCollapsed="true" - app:layout_behavior="@string/bottom_sheet_behavior" - tools:ignore="KeyboardInaccessibleWidget"> - - <com.google.android.material.card.MaterialCardView - style="?attr/cardStyle" - android:layout_width="match_parent" - android:layout_height="match_parent" - android:layout_marginLeft="16dp" - android:layout_marginTop="16dp" - android:layout_marginRight="16dp" - android:layout_marginBottom="16dp" - app:cardBackgroundColor="?attr/colorBackgroundCard"> - - <LinearLayout - android:layout_width="match_parent" - android:layout_height="match_parent" - android:orientation="vertical"> - - <LinearLayout - android:layout_width="match_parent" - android:layout_height="48dp" - android:orientation="horizontal"> - - <TextView - style="@style/Widget.RtlConformTextView" - android:layout_width="wrap_content" - android:layout_height="match_parent" - android:gravity="center_vertical|start" - android:paddingLeft="16dp" - android:paddingRight="16dp" - android:text="@string/label_input_history" - android:textAppearance="@style/TextAppearance.AppCompat.Body2" - android:textColor="?attr/colorForegroundSecondary" /> - - <Space - android:layout_width="0dip" - android:layout_height="match_parent" - android:layout_weight="1" /> - - <androidx.appcompat.widget.AppCompatImageButton - android:id="@+id/close" - android:layout_width="48dp" - android:layout_height="48dp" - android:layout_gravity="top|end" - android:background="?attr/selectableItemBackgroundBorderless" - android:contentDescription="@string/label_close" - android:padding="12dp" - android:scaleType="fitXY" - app:srcCompat="@drawable/ic_chevron_down" - app:tint="?attr/colorForegroundSecondary" /> - </LinearLayout> - - <androidx.recyclerview.widget.RecyclerView - android:id="@+id/msg_history" - android:layout_width="match_parent" - android:layout_height="match_parent" - tools:listitem="@layout/widget_history_message" /> - </LinearLayout> - </com.google.android.material.card.MaterialCardView> -</de.kuschku.quasseldroid.util.ui.view.TouchInterceptingFrameLayout> diff --git a/app/src/main/res/layout/layout_main.xml b/app/src/main/res/layout/layout_main.xml deleted file mode 100644 index d11f5d14abb2cc167b215a701dce914c6eba3bfe..0000000000000000000000000000000000000000 --- a/app/src/main/res/layout/layout_main.xml +++ /dev/null @@ -1,106 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" - xmlns:app="http://schemas.android.com/apk/res-auto" - xmlns:tools="http://schemas.android.com/tools" - android:layout_width="match_parent" - android:layout_height="match_parent" - android:fitsSystemWindows="true" - android:orientation="vertical"> - - <include - android:id="@+id/layout_toolbar" - layout="@layout/layout_toolbar" /> - - <androidx.coordinatorlayout.widget.CoordinatorLayout - android:layout_width="match_parent" - android:layout_height="match_parent" - android:gravity="bottom"> - - <androidx.coordinatorlayout.widget.CoordinatorLayout - android:layout_width="match_parent" - android:layout_height="match_parent" - android:layout_marginBottom="?actionBarSize" - android:orientation="vertical"> - - <FrameLayout - android:layout_width="match_parent" - android:layout_height="match_parent" - app:layout_behavior="@string/appbar_scrolling_view_behavior"> - - <fragment - android:id="@+id/fragment_messages" - android:name="de.kuschku.quasseldroid.ui.chat.messages.MessageListFragment" - android:layout_width="match_parent" - android:layout_height="match_parent" - tools:ignore="FragmentTagUsage" - tools:layout="@layout/chat_messages" /> - - <de.kuschku.quasseldroid.util.ui.view.WarningBarView - android:id="@+id/connection_status" - android:layout_width="match_parent" - android:layout_height="wrap_content" - app:icon="@drawable/ic_disconnected" - app:mode="none" /> - - </FrameLayout> - - <androidx.recyclerview.widget.RecyclerView - android:id="@+id/autocomplete_list" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:background="?colorBackgroundCard" - app:behavior_hideable="true" - app:behavior_peekHeight="@dimen/autocomplete_max_height" - app:layout_behavior="@string/bottom_sheet_behavior" - tools:listitem="@layout/widget_nick" /> - </androidx.coordinatorlayout.widget.CoordinatorLayout> - - <LinearLayout - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:orientation="vertical" - app:layout_anchor="@id/fragment_chatline" - app:layout_anchorGravity="top"> - - <de.kuschku.quasseldroid.util.ui.view.ShadowView - android:layout_width="match_parent" - android:layout_height="@dimen/shadow_height" - android:gravity="bottom" /> - - <Space - android:layout_width="match_parent" - android:layout_height="@dimen/shadow_height" /> - </LinearLayout> - - <fragment - android:id="@+id/fragment_chatline" - android:name="de.kuschku.quasseldroid.ui.chat.input.ChatlineFragment" - android:layout_width="match_parent" - android:layout_height="match_parent" - app:behavior_hideable="false" - app:behavior_peekHeight="?actionBarSize" - app:layout_behavior="@string/drag_intercept_bottom_sheet_behavior" - tools:layout="@layout/chat_chatline" - tools:ignore="FragmentTagUsage" /> - - </androidx.coordinatorlayout.widget.CoordinatorLayout> - -</LinearLayout> diff --git a/app/src/main/res/layout/layout_toolbar.xml b/app/src/main/res/layout/layout_toolbar.xml deleted file mode 100644 index 738fe777caa8efe2ba78b2bee7378a9ad059fcce..0000000000000000000000000000000000000000 --- a/app/src/main/res/layout/layout_toolbar.xml +++ /dev/null @@ -1,61 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<com.google.android.material.appbar.AppBarLayout xmlns:android="http://schemas.android.com/apk/res/android" - xmlns:app="http://schemas.android.com/apk/res-auto" - xmlns:tools="http://schemas.android.com/tools" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:theme="?attr/actionBarTheme" - tools:showIn="@layout/activity_main"> - - <FrameLayout - android:layout_width="match_parent" - android:layout_height="?attr/actionBarSize"> - - <androidx.appcompat.widget.Toolbar - android:id="@+id/toolbar" - android:layout_width="match_parent" - android:layout_height="match_parent" - app:contentInsetStartWithNavigation="0dp" - app:popupTheme="?attr/actionBarPopupTheme"> - - <fragment - android:id="@+id/fragment_toolbar" - android:name="de.kuschku.quasseldroid.ui.chat.ToolbarFragment" - android:layout_width="fill_parent" - android:layout_height="fill_parent" - tools:ignore="FragmentTagUsage" - tools:layout="@layout/chat_toolbar" /> - - </androidx.appcompat.widget.Toolbar> - - <de.kuschku.quasseldroid.util.ui.view.MaterialContentLoadingProgressBar - android:id="@+id/progress_bar" - style="@style/Widget.MaterialProgressBar.ProgressBar.Horizontal.NoPadding" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:layout_gravity="bottom" - app:mpb_progressStyle="horizontal" - app:mpb_setBothDrawables="true" - app:mpb_useIntrinsicPadding="false" - tools:indeterminate="true" /> - </FrameLayout> - -</com.google.android.material.appbar.AppBarLayout> diff --git a/app/src/main/res/layout/preference_seekbar.xml b/app/src/main/res/layout/preference_seekbar.xml deleted file mode 100644 index 68e2fc5f4690fcaddc5e3f0219f63eaf63df8023..0000000000000000000000000000000000000000 --- a/app/src/main/res/layout/preference_seekbar.xml +++ /dev/null @@ -1,52 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - ~ Copyright (c) 2015 IRCCloud, Ltd. - ~ - ~ Licensed under the Apache License, Version 2.0 (the "License"); - ~ you may not use this file except in compliance with the License. - ~ You may obtain a copy of the License at - ~ - ~ http://www.apache.org/licenses/LICENSE-2.0 - ~ - ~ Unless required by applicable law or agreed to in writing, software - ~ distributed under the License is distributed on an "AS IS" BASIS, - ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - ~ See the License for the specific language governing permissions and - ~ limitations under the License. - --> -<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" - xmlns:tools="http://schemas.android.com/tools" - android:id="@android:id/widget_frame" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:gravity="center_vertical" - android:orientation="horizontal" - android:paddingStart="15dp" - android:paddingTop="5dp" - android:paddingEnd="10dp" - android:paddingBottom="5dp"> - - <androidx.appcompat.widget.AppCompatSeekBar - android:id="@+id/seekBarPrefSeekBar" - android:layout_width="0dip" - android:layout_height="wrap_content" - android:layout_gravity="bottom" - android:layout_weight="1" /> - - <TextView - android:id="@+id/seekBarPrefUnitsRight" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - tools:text="%" /> - - <TextView - android:id="@+id/seekBarPrefValue" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - tools:text="100" /> - - <TextView - android:id="@+id/seekBarPrefUnitsLeft" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - tools:text="$" /> -</LinearLayout> diff --git a/app/src/main/res/layout/preference_vertical.xml b/app/src/main/res/layout/preference_vertical.xml deleted file mode 100644 index 3a675602cb48a0c27e7b75cae5390910c105ffc4..0000000000000000000000000000000000000000 --- a/app/src/main/res/layout/preference_vertical.xml +++ /dev/null @@ -1,90 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" - xmlns:app="http://schemas.android.com/apk/res-auto" - xmlns:tools="http://schemas.android.com/tools" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:background="?android:attr/selectableItemBackground" - android:baselineAligned="false" - android:clipToPadding="false" - android:focusable="true" - android:gravity="center_vertical" - android:minHeight="?android:attr/listPreferredItemHeightSmall" - android:paddingStart="?android:attr/listPreferredItemPaddingLeft" - android:paddingEnd="?android:attr/listPreferredItemPaddingRight"> - - <FrameLayout - android:id="@+id/icon_frame" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_marginStart="-4dp" - android:gravity="start|center_vertical" - android:minWidth="60dp" - android:orientation="horizontal" - android:paddingStart="0dp" - android:paddingTop="4dp" - android:paddingEnd="12dp" - android:paddingBottom="4dp"> - - <androidx.appcompat.widget.AppCompatImageView - android:id="@android:id/icon" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - app:maxHeight="48dp" - app:maxWidth="48dp" - app:tint="?colorTextSecondary" - tools:src="@drawable/ic_account" /> - </FrameLayout> - - <LinearLayout - android:layout_width="0dip" - android:layout_height="wrap_content" - android:layout_weight="1" - android:orientation="vertical" - android:paddingTop="16dp" - android:paddingBottom="16dp"> - - <TextView - android:id="@android:id/title" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:ellipsize="marquee" - android:singleLine="true" - android:textColor="?colorTextPrimary" - android:textSize="16sp" - tools:text="Font Size" /> - - <TextView - android:id="@android:id/summary" - style="@style/Widget.RtlConformTextView" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:maxLines="10" - android:textAppearance="?android:attr/textAppearanceSmall" - android:textColor="?colorTextSecondary" /> - - <LinearLayout - android:id="@android:id/widget_frame" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:orientation="vertical" /> - </LinearLayout> -</LinearLayout> diff --git a/app/src/main/res/layout/preferences_about.xml b/app/src/main/res/layout/preferences_about.xml deleted file mode 100644 index 271dcea7e458577fba792cf29de4139a0ccb2943..0000000000000000000000000000000000000000 --- a/app/src/main/res/layout/preferences_about.xml +++ /dev/null @@ -1,108 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<androidx.core.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android" - xmlns:tools="http://schemas.android.com/tools" - android:layout_width="match_parent" - android:layout_height="match_parent" - android:scrollbars="vertical"> - - <LinearLayout - android:layout_width="match_parent" - android:layout_height="match_parent" - android:orientation="vertical"> - - <include layout="@layout/preferences_about_header" /> - - <LinearLayout - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:descendantFocusability="blocksDescendants" - android:orientation="vertical"> - - <TextView - style="@style/Widget.Subhead" - android:text="@string/label_authors" /> - - <androidx.recyclerview.widget.RecyclerView - android:id="@+id/authors" - android:layout_width="match_parent" - android:layout_height="wrap_content" - tools:itemCount="1" - tools:listitem="@layout/widget_contributor" /> - - </LinearLayout> - - <LinearLayout - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:descendantFocusability="blocksDescendants" - android:orientation="vertical"> - - <TextView - style="@style/Widget.Subhead" - android:text="@string/label_acknowledgements" /> - - <androidx.recyclerview.widget.RecyclerView - android:id="@+id/acknowledgements" - android:layout_width="match_parent" - android:layout_height="wrap_content" - tools:itemCount="5" - tools:listitem="@layout/widget_contributor" /> - - </LinearLayout> - - <LinearLayout - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:descendantFocusability="blocksDescendants" - android:orientation="vertical"> - - <TextView - style="@style/Widget.Subhead" - android:text="@string/label_translators" /> - - <androidx.recyclerview.widget.RecyclerView - android:id="@+id/translators" - android:layout_width="match_parent" - android:layout_height="wrap_content" - tools:itemCount="5" - tools:listitem="@layout/widget_translator" /> - - </LinearLayout> - - <LinearLayout - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:orientation="vertical"> - - <TextView - style="@style/Widget.Subhead" - android:text="@string/label_libraries" /> - - <androidx.recyclerview.widget.RecyclerView - android:id="@+id/libraries" - android:layout_width="match_parent" - android:layout_height="wrap_content" - tools:listitem="@layout/widget_library" /> - - </LinearLayout> - - </LinearLayout> -</androidx.core.widget.NestedScrollView> diff --git a/app/src/main/res/layout/preferences_about_header.xml b/app/src/main/res/layout/preferences_about_header.xml deleted file mode 100644 index b876f7a768ad9afab9e14902f3f6d861199a50c7..0000000000000000000000000000000000000000 --- a/app/src/main/res/layout/preferences_about_header.xml +++ /dev/null @@ -1,124 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" - xmlns:app="http://schemas.android.com/apk/res-auto" - xmlns:tools="http://schemas.android.com/tools" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:orientation="vertical" - android:paddingStart="?listPreferredItemPaddingLeft" - android:paddingTop="?listPreferredItemHeight" - android:paddingEnd="?listPreferredItemPaddingRight"> - - <LinearLayout - android:id="@+id/version_container" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:background="?selectableItemBackground" - android:clickable="true" - android:focusable="true" - android:orientation="horizontal"> - - <androidx.appcompat.widget.AppCompatImageView - android:layout_width="?actionBarSize" - android:layout_height="?actionBarSize" - android:layout_gravity="center" - android:layout_marginEnd="?listPreferredItemPaddingRight" - app:srcCompat="@mipmap/ic_launcher_legacy" /> - - <LinearLayout - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:layout_gravity="center" - android:orientation="vertical"> - - <TextView - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:text="@string/app_name" - android:textAppearance="@style/TextAppearance.AppCompat.Title" /> - - <TextView - android:id="@+id/version" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:textAppearance="@style/TextAppearance.AppCompat.Small" - tools:text="v0.3.0-310-ge2d1d05" /> - </LinearLayout> - </LinearLayout> - - <com.google.android.flexbox.FlexboxLayout - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:layout_marginTop="8dp" - android:layout_marginBottom="8dp" - android:theme="?attr/actionBarTheme" - app:alignContent="flex_start" - app:alignItems="flex_start" - app:flexWrap="wrap"> - - <com.google.android.material.button.MaterialButton - android:id="@+id/action_website" - style="@style/Widget.Button.Colored" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:text="@string/label_website" /> - - <Space - android:layout_width="8dp" - android:layout_height="wrap_content" /> - - <com.google.android.material.button.MaterialButton - android:id="@+id/action_source" - style="@style/Widget.Button" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:text="@string/label_source" /> - - <Space - android:layout_width="8dp" - android:layout_height="wrap_content" /> - - <com.google.android.material.button.MaterialButton - android:id="@+id/action_donate" - style="@style/Widget.Button" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:text="@string/advertisement_support_button" /> - - </com.google.android.flexbox.FlexboxLayout> - - <TextView - style="@style/Widget.RtlConformTextView" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:layout_marginLeft="4dp" - android:layout_marginRight="4dp" - android:text="@string/app_description_long" - android:textAlignment="gravity" /> - - <com.google.android.material.button.MaterialButton - android:id="@+id/action_privacy_policy" - style="@style/Widget.Button.Borderless.Colored" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:text="@string/label_privacy_policy" /> - -</LinearLayout> diff --git a/app/src/main/res/layout/preferences_crash.xml b/app/src/main/res/layout/preferences_crash.xml deleted file mode 100644 index eb535042fdc134f74891ba504eba6e8af7ca0ea1..0000000000000000000000000000000000000000 --- a/app/src/main/res/layout/preferences_crash.xml +++ /dev/null @@ -1,46 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" - xmlns:tools="http://schemas.android.com/tools" - android:layout_width="match_parent" - android:layout_height="match_parent"> - - <androidx.recyclerview.widget.RecyclerView - android:id="@+id/list" - android:layout_width="match_parent" - android:layout_height="match_parent" - android:scrollbars="vertical" - tools:listitem="@layout/widget_crash" /> - - <TextView - android:id="@+id/crashes_empty" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:layout_gravity="center" - android:gravity="center" - android:minHeight="?android:attr/listPreferredItemHeightSmall" - android:paddingStart="?listPreferredItemPaddingLeft" - android:paddingEnd="?listPreferredItemPaddingRight" - android:text="@string/label_crashes_empty" - android:textColor="?colorTextSecondary" - android:textStyle="italic" - android:visibility="gone" - tools:visibility="visible" /> -</FrameLayout> diff --git a/app/src/main/res/layout/preferences_license.xml b/app/src/main/res/layout/preferences_license.xml deleted file mode 100644 index 53a832257038391562257b6ab5de4864224a435d..0000000000000000000000000000000000000000 --- a/app/src/main/res/layout/preferences_license.xml +++ /dev/null @@ -1,31 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<androidx.core.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android" - android:layout_width="match_parent" - android:layout_height="match_parent" - android:scrollbars="vertical"> - - <TextView - android:id="@+id/text" - style="@style/Widget.RtlConformTextView" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:padding="16dp" /> -</androidx.core.widget.NestedScrollView> diff --git a/app/src/main/res/layout/preferences_whitelist.xml b/app/src/main/res/layout/preferences_whitelist.xml deleted file mode 100644 index 28f700f93eaf968f3703a7e972cbe0bf86ffae60..0000000000000000000000000000000000000000 --- a/app/src/main/res/layout/preferences_whitelist.xml +++ /dev/null @@ -1,84 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<androidx.core.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android" - xmlns:tools="http://schemas.android.com/tools" - android:layout_width="match_parent" - android:layout_height="match_parent" - android:orientation="vertical"> - - <LinearLayout - android:layout_width="match_parent" - android:layout_height="match_parent" - android:orientation="vertical"> - - <TextView - style="@style/Widget.Subhead" - android:text="@string/label_whitelist_certificates" /> - - <TextView - android:id="@+id/certificate_whitelist_empty" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:gravity="center_vertical" - android:minHeight="?android:attr/listPreferredItemHeightSmall" - android:paddingStart="?listPreferredItemPaddingLeft" - android:paddingEnd="?listPreferredItemPaddingRight" - android:text="@string/label_whitelist_certificates_empty" - android:textColor="?colorTextSecondary" - android:textStyle="italic" - android:visibility="gone" /> - - <androidx.recyclerview.widget.RecyclerView - android:id="@+id/certificate_whitelist" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:paddingLeft="2dp" - android:paddingRight="2dp" - tools:itemCount="2" - tools:listitem="@layout/preferences_whitelist_certificate_item" /> - - <TextView - style="@style/Widget.Subhead" - android:text="@string/label_whitelist_hostnames" /> - - <TextView - android:id="@+id/hostname_whitelist_empty" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:gravity="center_vertical" - android:minHeight="?android:attr/listPreferredItemHeightSmall" - android:paddingStart="?listPreferredItemPaddingLeft" - android:paddingEnd="?listPreferredItemPaddingRight" - android:text="@string/label_whitelist_hostnames_empty" - android:textColor="?colorTextSecondary" - android:textStyle="italic" - android:visibility="gone" /> - - <androidx.recyclerview.widget.RecyclerView - android:id="@+id/hostname_whitelist" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:paddingLeft="2dp" - android:paddingRight="2dp" - tools:itemCount="3" - tools:listitem="@layout/preferences_whitelist_hostname_item" /> - - </LinearLayout> -</androidx.core.widget.NestedScrollView> diff --git a/app/src/main/res/layout/preferences_whitelist_certificate_item.xml b/app/src/main/res/layout/preferences_whitelist_certificate_item.xml deleted file mode 100644 index 8084ad0ca2bce0836765a26b7bf90c0c01e4f6d4..0000000000000000000000000000000000000000 --- a/app/src/main/res/layout/preferences_whitelist_certificate_item.xml +++ /dev/null @@ -1,72 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" - xmlns:app="http://schemas.android.com/apk/res-auto" - xmlns:tools="http://schemas.android.com/tools" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:minHeight="?android:attr/listPreferredItemHeightSmall" - android:orientation="horizontal" - tools:showIn="@layout/preferences_whitelist"> - - <LinearLayout - android:layout_width="0dip" - android:layout_height="wrap_content" - android:layout_gravity="center_vertical" - android:layout_weight="1" - android:orientation="vertical" - android:paddingStart="?listPreferredItemPaddingLeft" - android:paddingTop="16dp" - android:paddingEnd="0dip" - android:paddingBottom="16dp"> - - <TextView - android:id="@+id/fingerprint" - style="@style/Widget.RtlConformTextView" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:textAppearance="?android:textAppearanceMedium" - android:textColor="?colorTextPrimary" - android:textSize="16sp" - tools:text="65:F9:0D:04:8A:7B:4F:D8:C8:D8:75:8D:EC:48:8C:F2:96:86:00:44" /> - - <TextView - android:id="@+id/ignore_date" - style="@style/Widget.RtlConformTextView" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:text="@string/label_whitelist_ignore_date" - android:textAppearance="?textAppearanceListItemSecondary" - android:textColor="?colorTextSecondary" /> - - </LinearLayout> - - <androidx.appcompat.widget.AppCompatImageButton - android:id="@+id/action_delete" - android:layout_width="wrap_content" - android:layout_height="match_parent" - android:layout_gravity="center_vertical" - android:background="?selectableItemBackgroundBorderless" - android:contentDescription="@string/label_delete" - android:paddingStart="32dp" - android:paddingEnd="?listPreferredItemPaddingRight" - app:srcCompat="@drawable/ic_delete" - app:tint="?colorTextSecondary" /> -</LinearLayout> diff --git a/app/src/main/res/layout/preferences_whitelist_hostname_item.xml b/app/src/main/res/layout/preferences_whitelist_hostname_item.xml deleted file mode 100644 index 483a7363085be36f9306b3966d24b396e289973b..0000000000000000000000000000000000000000 --- a/app/src/main/res/layout/preferences_whitelist_hostname_item.xml +++ /dev/null @@ -1,72 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" - xmlns:app="http://schemas.android.com/apk/res-auto" - xmlns:tools="http://schemas.android.com/tools" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:minHeight="?android:attr/listPreferredItemHeightSmall" - android:orientation="horizontal" - tools:showIn="@layout/preferences_whitelist"> - - <LinearLayout - android:layout_width="0dip" - android:layout_height="wrap_content" - android:layout_gravity="center_vertical" - android:layout_weight="1" - android:orientation="vertical" - android:paddingStart="?listPreferredItemPaddingLeft" - android:paddingTop="16dp" - android:paddingEnd="0dip" - android:paddingBottom="16dp"> - - <TextView - android:id="@+id/hostname" - style="@style/Widget.RtlConformTextView" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:textAppearance="?android:textAppearanceMedium" - android:textColor="?colorTextPrimary" - android:textSize="16sp" - tools:text="www.google.com" /> - - <TextView - android:id="@+id/fingerprint" - style="@style/Widget.RtlConformTextView" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:textAppearance="?textAppearanceListItemSecondary" - android:textColor="?colorTextSecondary" - tools:text="65:F9:0D:04:8A:7B:4F:D8:C8:D8:75:8D:EC:48:8C:F2:96:86:00:44" /> - - </LinearLayout> - - <androidx.appcompat.widget.AppCompatImageButton - android:id="@+id/action_delete" - android:layout_width="wrap_content" - android:layout_height="match_parent" - android:layout_gravity="center_vertical" - android:background="?selectableItemBackgroundBorderless" - android:contentDescription="@string/label_delete" - android:paddingStart="32dp" - android:paddingEnd="?listPreferredItemPaddingRight" - app:srcCompat="@drawable/ic_delete" - app:tint="?colorTextSecondary" /> -</LinearLayout> diff --git a/app/src/main/res/layout/settings_aliasitem.xml b/app/src/main/res/layout/settings_aliasitem.xml deleted file mode 100644 index 47d935911b4a48a330013b9da0bb6d97416bbb5d..0000000000000000000000000000000000000000 --- a/app/src/main/res/layout/settings_aliasitem.xml +++ /dev/null @@ -1,106 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" - xmlns:app="http://schemas.android.com/apk/res-auto" - xmlns:tools="http://schemas.android.com/tools" - android:layout_width="match_parent" - android:layout_height="match_parent" - android:orientation="vertical"> - - <androidx.coordinatorlayout.widget.CoordinatorLayout - android:layout_width="match_parent" - android:layout_height="0dip" - android:layout_weight="1"> - - <androidx.core.widget.NestedScrollView - android:layout_width="match_parent" - android:layout_height="match_parent" - android:scrollbars="vertical"> - - <LinearLayout - android:layout_width="match_parent" - android:layout_height="match_parent" - android:orientation="vertical"> - - <LinearLayout style="@style/Widget.CoreSettings.Wrapper"> - - <LinearLayout - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:minHeight="48dp"> - - <com.google.android.material.textfield.TextInputLayout - style="@style/Widget.CustomTextInput" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:hint="@string/settings_aliasitem_name"> - - <com.google.android.material.textfield.TextInputEditText - android:id="@+id/name" - style="@style/Widget.CoreSettings.EditText" - tools:text="back" /> - </com.google.android.material.textfield.TextInputLayout> - </LinearLayout> - </LinearLayout> - - <LinearLayout style="@style/Widget.CoreSettings.Wrapper"> - - <com.google.android.material.textfield.TextInputLayout - style="@style/Widget.CustomTextInput" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:hint="@string/settings_aliasitem_expansion"> - - <de.kuschku.quasseldroid.ui.chat.input.RichEditText - android:id="@+id/expansion" - style="@style/Widget.CoreSettings.EditText" - android:imeOptions="flagNoExtractUi" - android:inputType="textMultiLine" - android:textColor="?attr/colorForeground" - android:textSize="16sp" /> - </com.google.android.material.textfield.TextInputLayout> - </LinearLayout> - </LinearLayout> - </androidx.core.widget.NestedScrollView> - - <androidx.recyclerview.widget.RecyclerView - android:id="@+id/autocomplete_list" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:background="?colorBackgroundCard" - app:behavior_hideable="true" - app:behavior_peekHeight="@dimen/autocomplete_max_height" - app:layout_behavior="@string/bottom_sheet_behavior" - tools:listitem="@layout/widget_nick" /> - - </androidx.coordinatorlayout.widget.CoordinatorLayout> - - <com.google.android.material.appbar.AppBarLayout - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:background="?attr/colorBackgroundCard"> - - <de.kuschku.quasseldroid.ui.chat.input.RichToolbar - android:id="@+id/formatting_toolbar" - android:layout_width="match_parent" - android:layout_height="?attr/actionBarSize" - app:contentInsetStart="0dip" /> - </com.google.android.material.appbar.AppBarLayout> -</LinearLayout> diff --git a/app/src/main/res/layout/settings_aliaslist.xml b/app/src/main/res/layout/settings_aliaslist.xml deleted file mode 100644 index 5325ba9ff8799ee8b92fdb028b9749016b05e09c..0000000000000000000000000000000000000000 --- a/app/src/main/res/layout/settings_aliaslist.xml +++ /dev/null @@ -1,42 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" - xmlns:app="http://schemas.android.com/apk/res-auto" - xmlns:tools="http://schemas.android.com/tools" - android:layout_width="match_parent" - android:layout_height="match_parent"> - - <androidx.recyclerview.widget.RecyclerView - android:id="@+id/list" - android:layout_width="match_parent" - android:layout_height="match_parent" - tools:listitem="@layout/settings_aliaslist_item" /> - - <com.google.android.material.floatingactionbutton.FloatingActionButton - android:id="@+id/add" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_gravity="end|bottom" - android:layout_margin="16dp" - app:fabSize="normal" - app:srcCompat="@drawable/ic_add" - app:tint="?colorTextPrimaryInverse" /> - -</FrameLayout> diff --git a/app/src/main/res/layout/settings_aliaslist_item.xml b/app/src/main/res/layout/settings_aliaslist_item.xml deleted file mode 100644 index 386890896d26cc9923d338ef825d638bbf556794..0000000000000000000000000000000000000000 --- a/app/src/main/res/layout/settings_aliaslist_item.xml +++ /dev/null @@ -1,71 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" - xmlns:app="http://schemas.android.com/apk/res-auto" - xmlns:tools="http://schemas.android.com/tools" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:minHeight="?android:attr/listPreferredItemHeightSmall" - android:orientation="horizontal" - tools:showIn="@layout/settings_aliaslist"> - - <androidx.appcompat.widget.AppCompatImageView - android:id="@+id/handle" - android:layout_width="wrap_content" - android:layout_height="match_parent" - android:layout_gravity="center_vertical" - android:paddingStart="?listPreferredItemPaddingLeft" - android:paddingEnd="32dp" - app:srcCompat="@drawable/ic_reorder" - app:tint="?colorTextSecondary" /> - - <LinearLayout - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:layout_gravity="center_vertical" - android:orientation="vertical" - android:paddingStart="0dip" - android:paddingTop="16dp" - android:paddingEnd="?listPreferredItemPaddingRight" - android:paddingBottom="16dp"> - - <TextView - android:id="@+id/name" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:ellipsize="marquee" - android:orientation="vertical" - android:singleLine="true" - android:textAppearance="?android:textAppearanceMedium" - android:textColor="?colorTextPrimary" - android:textSize="16sp" - tools:text="back" /> - - <TextView - android:id="@+id/expansion" - style="@style/Widget.RtlConformTextView" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:textAppearance="?textAppearanceListItemSecondary" - android:textColor="?colorTextSecondary" - tools:text="/quote away" /> - - </LinearLayout> -</LinearLayout> diff --git a/app/src/main/res/layout/settings_chatlist.xml b/app/src/main/res/layout/settings_chatlist.xml deleted file mode 100644 index 7a4f301a3ea91eea222f758743da00f627c6338e..0000000000000000000000000000000000000000 --- a/app/src/main/res/layout/settings_chatlist.xml +++ /dev/null @@ -1,191 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<androidx.core.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android" - xmlns:app="http://schemas.android.com/apk/res-auto" - xmlns:tools="http://schemas.android.com/tools" - android:layout_width="match_parent" - android:layout_height="match_parent" - android:scrollbars="vertical"> - - <LinearLayout style="@style/Widget.CoreSettings.Wrapper"> - - <LinearLayout - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:minHeight="48dp"> - - <androidx.appcompat.widget.AppCompatImageView - style="@style/Widget.CoreSettings.PrimaryItemIcon" - app:srcCompat="@drawable/ic_eye" /> - - <TextView - style="@style/Widget.CoreSettings.PrimaryItemSwitch" - android:text="@string/settings_chatlist_ui" /> - </LinearLayout> - - <LinearLayout - style="@style/Widget.CoreSettings.DependentGroup" - android:visibility="visible"> - - <com.google.android.material.textfield.TextInputLayout - style="@style/Widget.CustomTextInput" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:hint="@string/settings_chatlist_buffer_view_name"> - - <com.google.android.material.textfield.TextInputEditText - android:id="@+id/buffer_view_name" - style="@style/Widget.CoreSettings.EditText" - tools:text="All Chats" /> - </com.google.android.material.textfield.TextInputLayout> - - <androidx.appcompat.widget.SwitchCompat - android:id="@+id/show_search" - style="@style/Widget.CoreSettings.PrimaryItemSwitch" - android:checked="true" - android:text="@string/settings_chatlist_show_search" /> - - <androidx.appcompat.widget.SwitchCompat - android:id="@+id/sort_alphabetically" - style="@style/Widget.CoreSettings.PrimaryItemSwitch" - android:checked="true" - android:text="@string/settings_chatlist_sort_alphabetically" /> - - <androidx.appcompat.widget.SwitchCompat - android:id="@+id/add_new_buffers_automatically" - style="@style/Widget.CoreSettings.PrimaryItemSwitch" - android:checked="true" - android:text="@string/settings_chatlist_add_new_buffers_automatically" /> - </LinearLayout> - - <LinearLayout - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:minHeight="48dp"> - - <androidx.appcompat.widget.AppCompatImageView - style="@style/Widget.CoreSettings.PrimaryItemIcon" - app:srcCompat="@drawable/ic_server_network" /> - - <TextView - style="@style/Widget.CoreSettings.PrimaryItemSwitch" - android:text="@string/settings_chatlist_network" /> - </LinearLayout> - - <LinearLayout - style="@style/Widget.CoreSettings.DependentGroup" - android:visibility="visible"> - - <de.kuschku.ui.spinner.MaterialSpinnerLayout - style="@style/Widget.CustomSpinnerLayout" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:hint="@string/settings_chatlist_network"> - - <androidx.appcompat.widget.AppCompatSpinner - android:id="@+id/network_id" - style="@style/Widget.MaterialSpinner" - android:layout_width="match_parent" - android:layout_height="wrap_content" - tools:listitem="@layout/widget_spinner_item_material" /> - </de.kuschku.ui.spinner.MaterialSpinnerLayout> - - <androidx.appcompat.widget.SwitchCompat - android:id="@+id/show_status_buffer" - style="@style/Widget.CoreSettings.PrimaryItemSwitch" - android:checked="true" - android:text="@string/settings_chatlist_show_status_buffer" /> - </LinearLayout> - - <LinearLayout - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:minHeight="48dp"> - - <androidx.appcompat.widget.AppCompatImageView - style="@style/Widget.CoreSettings.PrimaryItemIcon" - app:srcCompat="@drawable/ic_tag_text" /> - - <TextView - style="@style/Widget.CoreSettings.PrimaryItemSwitch" - android:text="@string/settings_chatlist_types" /> - </LinearLayout> - - <LinearLayout - style="@style/Widget.CoreSettings.DependentGroup" - android:visibility="visible"> - - <androidx.appcompat.widget.SwitchCompat - android:id="@+id/show_channels" - style="@style/Widget.CoreSettings.PrimaryItemSwitch" - android:checked="true" - android:text="@string/settings_chatlist_show_channels" /> - - <androidx.appcompat.widget.SwitchCompat - android:id="@+id/show_queries" - style="@style/Widget.CoreSettings.PrimaryItemSwitch" - android:checked="true" - android:text="@string/settings_chatlist_show_queries" /> - </LinearLayout> - - <LinearLayout - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:minHeight="48dp"> - - <androidx.appcompat.widget.AppCompatImageView - style="@style/Widget.CoreSettings.PrimaryItemIcon" - app:srcCompat="@drawable/ic_clock" /> - - <TextView - style="@style/Widget.CoreSettings.PrimaryItemSwitch" - android:text="@string/settings_chatlist_activity" /> - </LinearLayout> - - <LinearLayout - style="@style/Widget.CoreSettings.DependentGroup" - android:visibility="visible"> - - <de.kuschku.ui.spinner.MaterialSpinnerLayout - style="@style/Widget.CustomSpinnerLayout" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:hint="@string/settings_chatlist_activity"> - - <androidx.appcompat.widget.AppCompatSpinner - android:id="@+id/minimum_activity" - style="@style/Widget.MaterialSpinner" - android:layout_width="match_parent" - android:layout_height="wrap_content" - tools:listitem="@layout/widget_spinner_item_material" /> - </de.kuschku.ui.spinner.MaterialSpinnerLayout> - - <androidx.appcompat.widget.SwitchCompat - android:id="@+id/hide_inactive_buffers" - style="@style/Widget.CoreSettings.PrimaryItemSwitch" - android:text="@string/settings_chatlist_hide_inactive_buffers" /> - - <androidx.appcompat.widget.SwitchCompat - android:id="@+id/hide_inactive_networks" - style="@style/Widget.CoreSettings.PrimaryItemSwitch" - android:text="@string/settings_chatlist_hide_inactive_networks" /> - </LinearLayout> - </LinearLayout> -</androidx.core.widget.NestedScrollView> diff --git a/app/src/main/res/layout/settings_highlightlist.xml b/app/src/main/res/layout/settings_highlightlist.xml deleted file mode 100644 index 98b5f9c383672edfd31c4a725a1daa059f6467d6..0000000000000000000000000000000000000000 --- a/app/src/main/res/layout/settings_highlightlist.xml +++ /dev/null @@ -1,159 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<androidx.core.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android" - xmlns:app="http://schemas.android.com/apk/res-auto" - xmlns:tools="http://schemas.android.com/tools" - android:layout_width="match_parent" - android:layout_height="match_parent" - android:scrollbars="vertical"> - - <LinearLayout - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:orientation="vertical"> - - <de.kuschku.quasseldroid.util.ui.view.WarningBarView - android:id="@+id/feature_context_coresidehighlights" - android:layout_width="match_parent" - android:layout_height="wrap_content" - app:icon="@drawable/ic_alert" - app:mode="none" - app:text="@string/label_feature_context_coresidehighlights" /> - - <LinearLayout style="@style/Widget.CoreSettings.Wrapper"> - - <LinearLayout - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:minHeight="48dp"> - - <androidx.appcompat.widget.AppCompatImageView - style="@style/Widget.CoreSettings.PrimaryItemIcon" - app:srcCompat="@drawable/ic_server_network" /> - - <TextView - style="@style/Widget.CoreSettings.PrimaryItemSwitch" - android:text="@string/settings_highlightlist_highlight_nick" /> - </LinearLayout> - - <LinearLayout - style="@style/Widget.CoreSettings.DependentGroup" - android:visibility="visible"> - - <de.kuschku.ui.spinner.MaterialSpinnerLayout - style="@style/Widget.CustomSpinnerLayout" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:hint="@string/settings_highlightlist_highlight_nick"> - - <androidx.appcompat.widget.AppCompatSpinner - android:id="@+id/highlight_nick_type" - style="@style/Widget.MaterialSpinner" - android:layout_width="match_parent" - android:layout_height="wrap_content" - tools:listitem="@layout/widget_spinner_item_material" /> - </de.kuschku.ui.spinner.MaterialSpinnerLayout> - - <androidx.appcompat.widget.SwitchCompat - android:id="@+id/is_case_sensitive" - style="@style/Widget.CoreSettings.PrimaryItemSwitch" - android:text="@string/settings_highlightlist_nicks_case_sensitive" /> - </LinearLayout> - - <LinearLayout - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:minHeight="48dp"> - - <androidx.appcompat.widget.AppCompatImageView - style="@style/Widget.CoreSettings.PrimaryItemIcon" - app:srcCompat="@drawable/ic_server_network" /> - - <TextView - style="@style/Widget.CoreSettings.PrimaryItemSwitch" - android:text="@string/settings_highlightlist_rules" /> - </LinearLayout> - - <LinearLayout - style="@style/Widget.CoreSettings.DependentGroup" - android:visibility="visible"> - - <androidx.recyclerview.widget.RecyclerView - android:id="@+id/highlight_rules" - android:layout_width="match_parent" - android:layout_height="wrap_content" - tools:itemCount="2" - tools:listitem="@layout/settings_highlightlist_rule" /> - - <LinearLayout - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:orientation="horizontal"> - - <com.google.android.material.button.MaterialButton - android:id="@+id/new_highlight_rule" - style="@style/Widget.Button.Borderless.Colored" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:text="@string/label_new_highlight_rule" /> - </LinearLayout> - </LinearLayout> - - <LinearLayout - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:minHeight="48dp"> - - <androidx.appcompat.widget.AppCompatImageView - style="@style/Widget.CoreSettings.PrimaryItemIcon" - app:srcCompat="@drawable/ic_server_network" /> - - <TextView - style="@style/Widget.CoreSettings.PrimaryItemSwitch" - android:text="@string/settings_highlightlist_ignore_rules" /> - </LinearLayout> - - <LinearLayout - style="@style/Widget.CoreSettings.DependentGroup" - android:visibility="visible"> - - <androidx.recyclerview.widget.RecyclerView - android:id="@+id/highlight_ignore_rules" - android:layout_width="match_parent" - android:layout_height="wrap_content" - tools:itemCount="2" - tools:listitem="@layout/settings_highlightlist_rule" /> - - <LinearLayout - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:orientation="horizontal"> - - <com.google.android.material.button.MaterialButton - android:id="@+id/new_highlight_ignore_rule" - style="@style/Widget.Button.Borderless.Colored" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:text="@string/label_new_highlight_ignore_rule" /> - </LinearLayout> - </LinearLayout> - </LinearLayout> - </LinearLayout> -</androidx.core.widget.NestedScrollView> diff --git a/app/src/main/res/layout/settings_highlightlist_rule.xml b/app/src/main/res/layout/settings_highlightlist_rule.xml deleted file mode 100644 index c27b23144fde0236fc4a48cb1a4dca3ca183aad2..0000000000000000000000000000000000000000 --- a/app/src/main/res/layout/settings_highlightlist_rule.xml +++ /dev/null @@ -1,163 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<com.google.android.material.card.MaterialCardView xmlns:android="http://schemas.android.com/apk/res/android" - xmlns:app="http://schemas.android.com/apk/res-auto" - xmlns:tools="http://schemas.android.com/tools" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:layout_margin="2dp" - app:cardBackgroundColor="?colorBackgroundCard" - app:cardElevation="2dp"> - - <LinearLayout - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:background="?selectableItemBackground" - android:focusable="true" - android:gravity="center_vertical" - android:minHeight="?listPreferredItemHeightSmall"> - - <androidx.appcompat.widget.AppCompatImageView - android:id="@+id/handle" - android:layout_width="wrap_content" - android:layout_height="match_parent" - android:layout_gravity="center_vertical" - android:paddingStart="?listPreferredItemPaddingRight" - android:paddingEnd="32dp" - app:srcCompat="@drawable/ic_reorder" - app:tint="?colorTextSecondary" /> - - <LinearLayout - android:layout_width="0dip" - android:layout_height="wrap_content" - android:layout_weight="1" - android:orientation="vertical" - android:paddingTop="16dp" - android:paddingBottom="16dp"> - - <TextView - android:id="@+id/match_all" - style="@style/Widget.RtlConformTextView" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_gravity="center_vertical" - android:ellipsize="marquee" - android:orientation="vertical" - android:singleLine="true" - android:text="@string/label_match_all" - android:textAppearance="?android:textAppearanceMedium" - android:textColor="?colorTextPrimary" - android:textSize="16sp" - android:textStyle="italic" - android:visibility="gone" - tools:visibility="visible" /> - - <LinearLayout - android:id="@+id/name_row" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:orientation="horizontal"> - - <androidx.appcompat.widget.AppCompatImageView - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_marginEnd="8dp" - app:srcCompat="@drawable/ic_message_bulleted" - app:tint="?colorTextSecondary" /> - - <TextView - android:id="@+id/name" - style="@style/Widget.RtlConformTextView" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_gravity="center_vertical" - android:ellipsize="marquee" - android:orientation="vertical" - android:singleLine="true" - android:textAppearance="?android:textAppearanceMedium" - android:textColor="?colorTextPrimary" - android:textSize="16sp" - tools:text="(janne): " /> - - </LinearLayout> - - <LinearLayout - android:id="@+id/sender_row" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:orientation="horizontal"> - - <androidx.appcompat.widget.AppCompatImageView - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_marginEnd="8dp" - app:srcCompat="@drawable/ic_account" - app:tint="?colorTextSecondary" /> - - <TextView - android:id="@+id/sender" - style="@style/Widget.RtlConformTextView" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_gravity="center_vertical" - android:ellipsize="marquee" - android:singleLine="true" - android:textAppearance="?textAppearanceListItemSecondary" - android:textColor="?colorTextSecondary" - tools:text="TARS" /> - </LinearLayout> - - <LinearLayout - android:id="@+id/channel_row" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:orientation="horizontal"> - - <androidx.appcompat.widget.AppCompatImageView - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_marginEnd="8dp" - app:srcCompat="@drawable/ic_channel" - app:tint="?colorTextSecondary" /> - - <TextView - android:id="@+id/channel" - style="@style/Widget.RtlConformTextView" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_gravity="center_vertical" - android:ellipsize="marquee" - android:singleLine="true" - android:textAppearance="?textAppearanceListItemSecondary" - android:textColor="?colorTextSecondary" - tools:text="#yepityha" /> - </LinearLayout> - - </LinearLayout> - - <androidx.appcompat.widget.SwitchCompat - android:id="@+id/toggle" - android:layout_width="wrap_content" - android:layout_height="match_parent" - android:paddingStart="?listPreferredItemPaddingLeft" - android:paddingEnd="?listPreferredItemPaddingRight" - android:text="" /> - </LinearLayout> -</com.google.android.material.card.MaterialCardView> diff --git a/app/src/main/res/layout/settings_highlightrule.xml b/app/src/main/res/layout/settings_highlightrule.xml deleted file mode 100644 index 4a40d07b77eeee678af851baedb5d00e98b6a63a..0000000000000000000000000000000000000000 --- a/app/src/main/res/layout/settings_highlightrule.xml +++ /dev/null @@ -1,96 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<androidx.core.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android" - xmlns:app="http://schemas.android.com/apk/res-auto" - xmlns:tools="http://schemas.android.com/tools" - android:layout_width="match_parent" - android:layout_height="match_parent" - android:scrollbars="vertical"> - - <LinearLayout style="@style/Widget.CoreSettings.Wrapper"> - - <LinearLayout - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:minHeight="48dp"> - - <androidx.appcompat.widget.AppCompatImageView - style="@style/Widget.CoreSettings.PrimaryItemIcon" - app:srcCompat="@drawable/ic_filter" /> - - <androidx.appcompat.widget.SwitchCompat - android:id="@+id/enabled" - style="@style/Widget.CoreSettings.PrimaryItemSwitch" - android:checked="true" - android:text="@string/settings_highlightrule_enabled" /> - </LinearLayout> - - <LinearLayout - style="@style/Widget.CoreSettings.DependentGroup" - android:visibility="visible"> - - <com.google.android.material.textfield.TextInputLayout - style="@style/Widget.CustomTextInput" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:hint="@string/settings_highlightrule_name"> - - <com.google.android.material.textfield.TextInputEditText - android:id="@+id/name" - style="@style/Widget.CoreSettings.EditText" - tools:text="https://clbin.com/*.jpg*" /> - </com.google.android.material.textfield.TextInputLayout> - - <androidx.appcompat.widget.SwitchCompat - android:id="@+id/is_regex" - style="@style/Widget.CoreSettings.PrimaryItemSwitch" - android:text="@string/settings_highlightrule_regular_expression" /> - - <androidx.appcompat.widget.SwitchCompat - android:id="@+id/is_case_sensitive" - style="@style/Widget.CoreSettings.PrimaryItemSwitch" - android:text="@string/settings_highlightrule_case_sensitive" /> - - <com.google.android.material.textfield.TextInputLayout - style="@style/Widget.CustomTextInput" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:hint="@string/settings_highlightrule_sender"> - - <com.google.android.material.textfield.TextInputEditText - android:id="@+id/sender" - style="@style/Widget.CoreSettings.EditText" - tools:text="TARS" /> - </com.google.android.material.textfield.TextInputLayout> - - <com.google.android.material.textfield.TextInputLayout - style="@style/Widget.CustomTextInput" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:hint="@string/settings_highlightrule_channel"> - - <com.google.android.material.textfield.TextInputEditText - android:id="@+id/channel" - style="@style/Widget.CoreSettings.EditText" - tools:text="#yepityha" /> - </com.google.android.material.textfield.TextInputLayout> - </LinearLayout> - </LinearLayout> -</androidx.core.widget.NestedScrollView> diff --git a/app/src/main/res/layout/settings_identity.xml b/app/src/main/res/layout/settings_identity.xml deleted file mode 100644 index 9cbb5681923d4bf7d009dbe01b622f66336be564..0000000000000000000000000000000000000000 --- a/app/src/main/res/layout/settings_identity.xml +++ /dev/null @@ -1,231 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<androidx.core.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android" - xmlns:app="http://schemas.android.com/apk/res-auto" - xmlns:tools="http://schemas.android.com/tools" - android:layout_width="match_parent" - android:layout_height="match_parent" - android:scrollbars="vertical"> - - <LinearLayout style="@style/Widget.CoreSettings.Wrapper"> - - <LinearLayout - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:minHeight="48dp"> - - <androidx.appcompat.widget.AppCompatImageView - style="@style/Widget.CoreSettings.PrimaryItemIcon" - app:srcCompat="@drawable/ic_account_card" /> - - <TextView - style="@style/Widget.CoreSettings.PrimaryItemSwitch" - android:text="@string/settings_identity_names" /> - </LinearLayout> - - <LinearLayout - style="@style/Widget.CoreSettings.DependentGroup" - android:visibility="visible"> - - <com.google.android.material.textfield.TextInputLayout - style="@style/Widget.CustomTextInput" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:hint="@string/settings_identity_identity_name"> - - <com.google.android.material.textfield.TextInputEditText - android:id="@+id/identity_name" - style="@style/Widget.CoreSettings.EditText" - tools:text="Standardidentität" /> - </com.google.android.material.textfield.TextInputLayout> - - <com.google.android.material.textfield.TextInputLayout - style="@style/Widget.CustomTextInput" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:hint="@string/settings_identity_real_name"> - - <com.google.android.material.textfield.TextInputEditText - android:id="@+id/real_name" - style="@style/Widget.CoreSettings.EditText" - tools:text="Janne Mareike Koschinski" /> - </com.google.android.material.textfield.TextInputLayout> - - <com.google.android.material.textfield.TextInputLayout - style="@style/Widget.CustomTextInput" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:hint="@string/settings_identity_ident"> - - <com.google.android.material.textfield.TextInputEditText - android:id="@+id/ident" - style="@style/Widget.CoreSettings.EditText" - tools:text="justJanne" /> - </com.google.android.material.textfield.TextInputLayout> - </LinearLayout> - - <LinearLayout - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:minHeight="48dp"> - - <Space style="@style/Widget.CoreSettings.PrimaryItemIcon" /> - - <TextView - style="@style/Widget.CoreSettings.PrimaryItemSwitch" - android:text="@string/settings_identity_nicks" /> - </LinearLayout> - - <LinearLayout - style="@style/Widget.CoreSettings.DependentGroup" - android:orientation="vertical" - android:visibility="visible"> - - <androidx.recyclerview.widget.RecyclerView - android:id="@+id/nicks" - android:layout_width="match_parent" - android:layout_height="wrap_content" - tools:itemCount="4" - tools:listitem="@layout/settings_identity_nick" /> - - <LinearLayout - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:orientation="horizontal"> - - <com.google.android.material.button.MaterialButton - android:id="@+id/new_nick" - style="@style/Widget.Button.Borderless.Colored" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:text="@string/label_new_nick" /> - </LinearLayout> - </LinearLayout> - - <LinearLayout - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:minHeight="48dp"> - - <androidx.appcompat.widget.AppCompatImageView - style="@style/Widget.CoreSettings.PrimaryItemIcon" - app:srcCompat="@drawable/ic_message_bulleted" /> - - <TextView - style="@style/Widget.CoreSettings.PrimaryItemSwitch" - android:text="@string/settings_identity_messages" /> - </LinearLayout> - - <LinearLayout - style="@style/Widget.CoreSettings.DependentGroup" - android:visibility="visible"> - - <com.google.android.material.textfield.TextInputLayout - style="@style/Widget.CustomTextInput" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:hint="@string/settings_identity_kick_reason"> - - <com.google.android.material.textfield.TextInputEditText - android:id="@+id/kick_reason" - style="@style/Widget.CoreSettings.EditText" - tools:text="" /> - </com.google.android.material.textfield.TextInputLayout> - - <com.google.android.material.textfield.TextInputLayout - style="@style/Widget.CustomTextInput" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:hint="@string/settings_identity_part_reason"> - - <com.google.android.material.textfield.TextInputEditText - android:id="@+id/part_reason" - style="@style/Widget.CoreSettings.EditText" - tools:text="So if you care to find me, look to the western sky. As someone told me lately, everyone deserves a chance to fly." /> - </com.google.android.material.textfield.TextInputLayout> - - <com.google.android.material.textfield.TextInputLayout - style="@style/Widget.CustomTextInput" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:hint="@string/settings_identity_quit_reason"> - - <com.google.android.material.textfield.TextInputEditText - android:id="@+id/quit_reason" - style="@style/Widget.CoreSettings.EditText" - tools:text="So if you care to find me, look to the western sky. As someone told me lately, everyone deserves a chance to fly." /> - </com.google.android.material.textfield.TextInputLayout> - </LinearLayout> - - <LinearLayout - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:minHeight="48dp"> - - <androidx.appcompat.widget.AppCompatImageView - style="@style/Widget.CoreSettings.PrimaryItemIcon" - app:srcCompat="@drawable/ic_clock" /> - - <TextView - style="@style/Widget.CoreSettings.PrimaryItemSwitch" - android:text="@string/settings_identity_away" /> - </LinearLayout> - - <LinearLayout - style="@style/Widget.CoreSettings.DependentGroup" - android:visibility="visible"> - - <com.google.android.material.textfield.TextInputLayout - style="@style/Widget.CustomTextInput" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:hint="@string/settings_identity_away_reason"> - - <com.google.android.material.textfield.TextInputEditText - android:id="@+id/away_reason" - style="@style/Widget.CoreSettings.EditText" - tools:text="Gone Fishing." /> - </com.google.android.material.textfield.TextInputLayout> - - <androidx.appcompat.widget.SwitchCompat - android:id="@+id/detach_away" - style="@style/Widget.CoreSettings.PrimaryItemSwitch" - android:text="@string/settings_identity_detach_away" /> - - <LinearLayout - android:id="@+id/detach_away_group" - android:layout_width="match_parent" - android:layout_height="wrap_content"> - - <com.google.android.material.textfield.TextInputLayout - style="@style/Widget.CustomTextInput" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:hint="@string/settings_identity_detach_away_reason"> - - <com.google.android.material.textfield.TextInputEditText - android:id="@+id/detach_away_reason" - style="@style/Widget.CoreSettings.EditText" - tools:text="Gone Fishing." /> - </com.google.android.material.textfield.TextInputLayout> - </LinearLayout> - </LinearLayout> - </LinearLayout> -</androidx.core.widget.NestedScrollView> diff --git a/app/src/main/res/layout/settings_identity_nick.xml b/app/src/main/res/layout/settings_identity_nick.xml deleted file mode 100644 index 88732fb102988f10f89637960d4e73dfca5fa22b..0000000000000000000000000000000000000000 --- a/app/src/main/res/layout/settings_identity_nick.xml +++ /dev/null @@ -1,58 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<com.google.android.material.card.MaterialCardView xmlns:android="http://schemas.android.com/apk/res/android" - xmlns:app="http://schemas.android.com/apk/res-auto" - xmlns:tools="http://schemas.android.com/tools" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:layout_margin="2dp" - app:cardBackgroundColor="?colorBackgroundCard" - app:cardElevation="2dp" - tools:showIn="@layout/settings_identity"> - - <LinearLayout - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:minHeight="?android:attr/listPreferredItemHeightSmall" - android:orientation="horizontal"> - - <TextView - android:id="@+id/nick" - style="@style/Widget.RtlConformTextView" - android:layout_width="0dip" - android:layout_height="wrap_content" - android:layout_gravity="center_vertical" - android:layout_weight="1" - android:paddingStart="?listPreferredItemPaddingLeft" - android:paddingEnd="0dip" - android:textAppearance="?android:attr/textAppearanceListItemSmall" - tools:text="@sample/messages.json/data/sender" /> - - <androidx.appcompat.widget.AppCompatImageView - android:id="@+id/handle" - android:layout_width="wrap_content" - android:layout_height="match_parent" - android:layout_gravity="center_vertical" - android:paddingStart="32dp" - android:paddingEnd="?listPreferredItemPaddingRight" - app:srcCompat="@drawable/ic_reorder" - app:tint="?colorTextSecondary" /> - </LinearLayout> -</com.google.android.material.card.MaterialCardView> diff --git a/app/src/main/res/layout/settings_ignoreitem.xml b/app/src/main/res/layout/settings_ignoreitem.xml deleted file mode 100644 index 4edafc8f6dc2aac0a5da6ecec61eaaba254950ba..0000000000000000000000000000000000000000 --- a/app/src/main/res/layout/settings_ignoreitem.xml +++ /dev/null @@ -1,146 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<androidx.core.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android" - xmlns:app="http://schemas.android.com/apk/res-auto" - xmlns:tools="http://schemas.android.com/tools" - android:layout_width="match_parent" - android:layout_height="match_parent" - android:scrollbars="vertical"> - - <LinearLayout style="@style/Widget.CoreSettings.Wrapper"> - - <LinearLayout - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:minHeight="48dp"> - - <androidx.appcompat.widget.AppCompatImageView - style="@style/Widget.CoreSettings.PrimaryItemIcon" - app:srcCompat="@drawable/ic_filter" /> - - <androidx.appcompat.widget.SwitchCompat - android:id="@+id/enabled" - style="@style/Widget.CoreSettings.PrimaryItemSwitch" - android:checked="true" - android:text="@string/settings_ignoreitem_enabled" /> - </LinearLayout> - - <LinearLayout - style="@style/Widget.CoreSettings.DependentGroup" - android:visibility="visible"> - - <com.google.android.material.textfield.TextInputLayout - style="@style/Widget.CustomTextInput" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:hint="@string/settings_ignoreitem_ignorerule"> - - <com.google.android.material.textfield.TextInputEditText - android:id="@+id/ignore_rule" - style="@style/Widget.CoreSettings.EditText" - tools:text="https://clbin.com/*.jpg*" /> - </com.google.android.material.textfield.TextInputLayout> - - <androidx.appcompat.widget.SwitchCompat - android:id="@+id/isregex" - style="@style/Widget.CoreSettings.PrimaryItemSwitch" - android:text="@string/settings_ignoreitem_isregex" /> - - <de.kuschku.ui.spinner.MaterialSpinnerLayout - style="@style/Widget.CustomSpinnerLayout" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:hint="@string/settings_ignoreitem_type"> - - <androidx.appcompat.widget.AppCompatSpinner - android:id="@+id/type" - style="@style/Widget.MaterialSpinner" - android:layout_width="match_parent" - android:layout_height="wrap_content" - tools:listitem="@layout/widget_spinner_item_material" /> - </de.kuschku.ui.spinner.MaterialSpinnerLayout> - - <de.kuschku.ui.spinner.MaterialSpinnerLayout - style="@style/Widget.CustomSpinnerLayout" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:hint="@string/settings_ignoreitem_strictness"> - - <androidx.appcompat.widget.AppCompatSpinner - android:id="@+id/strictness" - style="@style/Widget.MaterialSpinner" - android:layout_width="match_parent" - android:layout_height="wrap_content" - tools:listitem="@layout/widget_spinner_item_material" /> - </de.kuschku.ui.spinner.MaterialSpinnerLayout> - </LinearLayout> - - <LinearLayout - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:minHeight="48dp"> - - <androidx.appcompat.widget.AppCompatImageView - style="@style/Widget.CoreSettings.PrimaryItemIcon" - app:srcCompat="@drawable/ic_tag_text" /> - - <TextView - style="@style/Widget.CoreSettings.PrimaryItemSwitch" - android:text="@string/settings_ignoreitem_scope" /> - </LinearLayout> - - <LinearLayout - style="@style/Widget.CoreSettings.DependentGroup" - android:visibility="visible"> - - <de.kuschku.ui.spinner.MaterialSpinnerLayout - style="@style/Widget.CustomSpinnerLayout" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:hint="@string/settings_ignoreitem_scope"> - - <androidx.appcompat.widget.AppCompatSpinner - android:id="@+id/scope" - style="@style/Widget.MaterialSpinner" - android:layout_width="match_parent" - android:layout_height="wrap_content" - tools:listitem="@layout/widget_spinner_item_material" /> - </de.kuschku.ui.spinner.MaterialSpinnerLayout> - </LinearLayout> - - <LinearLayout - android:id="@+id/scopegroup" - style="@style/Widget.CoreSettings.DependentGroup" - android:visibility="visible"> - - <com.google.android.material.textfield.TextInputLayout - style="@style/Widget.CustomTextInput" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:hint="@string/settings_ignoreitem_scoperule"> - - <com.google.android.material.textfield.TextInputEditText - android:id="@+id/scope_rule" - style="@style/Widget.CoreSettings.EditText" - tools:text="https://clbin.com/*.jpg*" /> - </com.google.android.material.textfield.TextInputLayout> - </LinearLayout> - </LinearLayout> -</androidx.core.widget.NestedScrollView> diff --git a/app/src/main/res/layout/settings_ignorelist.xml b/app/src/main/res/layout/settings_ignorelist.xml deleted file mode 100644 index a80f4741dcb120d60b843d7febc8cd706b5074d7..0000000000000000000000000000000000000000 --- a/app/src/main/res/layout/settings_ignorelist.xml +++ /dev/null @@ -1,45 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" - xmlns:app="http://schemas.android.com/apk/res-auto" - xmlns:tools="http://schemas.android.com/tools" - android:layout_width="match_parent" - android:layout_height="match_parent"> - - <androidx.recyclerview.widget.RecyclerView - android:id="@+id/list" - android:layout_width="match_parent" - android:layout_height="match_parent" - android:paddingLeft="2dp" - android:paddingRight="2dp" - tools:listitem="@layout/settings_ignorelist_item" /> - - <com.google.android.material.floatingactionbutton.FloatingActionButton - android:id="@+id/add" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_gravity="end|bottom" - android:layout_margin="16dp" - android:contentDescription="@string/label_new_ignore_rule" - app:fabSize="normal" - app:srcCompat="@drawable/ic_add" - app:tint="?colorTextPrimaryInverse" /> - -</FrameLayout> diff --git a/app/src/main/res/layout/settings_ignorelist_item.xml b/app/src/main/res/layout/settings_ignorelist_item.xml deleted file mode 100644 index 6eb915e2f8efec56e8e34f2876558db269af7abb..0000000000000000000000000000000000000000 --- a/app/src/main/res/layout/settings_ignorelist_item.xml +++ /dev/null @@ -1,81 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" - xmlns:app="http://schemas.android.com/apk/res-auto" - xmlns:tools="http://schemas.android.com/tools" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:background="?selectableItemBackground" - android:focusable="true" - android:gravity="center_vertical" - android:minHeight="?listPreferredItemHeightSmall" - tools:showIn="@layout/settings_ignorelist"> - - <androidx.appcompat.widget.AppCompatImageView - android:id="@+id/handle" - android:layout_width="wrap_content" - android:layout_height="match_parent" - android:layout_gravity="center_vertical" - android:paddingStart="?listPreferredItemPaddingRight" - android:paddingEnd="32dp" - app:srcCompat="@drawable/ic_reorder" - app:tint="?colorTextSecondary" /> - - <LinearLayout - android:layout_width="0dip" - android:layout_height="wrap_content" - android:layout_weight="1" - android:orientation="vertical" - android:paddingTop="16dp" - android:paddingBottom="16dp"> - - <TextView - android:id="@+id/ignore_rule" - style="@style/Widget.RtlConformTextView" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:ellipsize="marquee" - android:orientation="vertical" - android:singleLine="true" - android:textAppearance="?android:textAppearanceMedium" - android:textColor="?colorTextPrimary" - android:textSize="16sp" - tools:text="SoniEx2" /> - - <TextView - android:id="@+id/scope_rule" - style="@style/Widget.RtlConformTextView" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:ellipsize="marquee" - android:singleLine="true" - android:textAppearance="?textAppearanceListItemSecondary" - android:textColor="?colorTextSecondary" - tools:text="#quasseldroid" /> - - </LinearLayout> - - <androidx.appcompat.widget.SwitchCompat - android:id="@+id/toggle" - android:layout_width="wrap_content" - android:layout_height="match_parent" - android:paddingStart="?listPreferredItemPaddingLeft" - android:paddingEnd="?listPreferredItemPaddingRight" /> -</LinearLayout> diff --git a/app/src/main/res/layout/settings_item.xml b/app/src/main/res/layout/settings_item.xml deleted file mode 100644 index 081c9ce7dc4a2515e04794f8075249786bbcf4fb..0000000000000000000000000000000000000000 --- a/app/src/main/res/layout/settings_item.xml +++ /dev/null @@ -1,60 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" - xmlns:tools="http://schemas.android.com/tools" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:background="?selectableItemBackground" - android:focusable="true" - android:gravity="center_vertical" - android:minHeight="?listPreferredItemHeightSmall" - android:paddingStart="8dp" - android:paddingEnd="?listPreferredItemPaddingRight" - tools:showIn="@layout/settings_list"> - - <LinearLayout - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:orientation="vertical" - android:paddingTop="16dp" - android:paddingBottom="16dp"> - - <TextView - android:id="@+id/title" - style="@style/Widget.RtlConformTextView" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:ellipsize="marquee" - android:singleLine="true" - android:textAppearance="?android:textAppearanceMedium" - android:textColor="?colorTextPrimary" - android:textSize="16sp" - tools:text="IRC Config" /> - - <TextView - android:id="@+id/summary" - style="@style/Widget.RtlConformTextView" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:textAppearance="?android:textAppearanceSmall" - android:textColor="?colorTextPrimary" - android:visibility="gone" /> - </LinearLayout> -</LinearLayout> diff --git a/app/src/main/res/layout/settings_list.xml b/app/src/main/res/layout/settings_list.xml deleted file mode 100644 index c02834b2fd4d6d073ef928b65e00e53433b6ae96..0000000000000000000000000000000000000000 --- a/app/src/main/res/layout/settings_list.xml +++ /dev/null @@ -1,231 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<androidx.core.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android" - xmlns:app="http://schemas.android.com/apk/res-auto" - xmlns:tools="http://schemas.android.com/tools" - android:layout_width="match_parent" - android:layout_height="match_parent" - android:scrollbars="vertical"> - - <LinearLayout - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:orientation="vertical"> - - <de.kuschku.quasseldroid.util.ui.view.BannerView - android:id="@+id/feature_context_missing" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:layout_marginBottom="8dp" - app:buttonText="@string/label_feature_context_missing_button" - app:icon="@drawable/ic_alert" - app:text="@string/label_feature_context_missing" /> - - <LinearLayout style="@style/Widget.CoreSettings.PrimaryItemGroupHeader"> - - <androidx.appcompat.widget.AppCompatImageView - style="@style/Widget.CoreSettings.PrimaryItemIcon" - app:srcCompat="@drawable/ic_server_network" /> - - <TextView - style="@style/Widget.CoreSettings.PrimaryItemSwitch" - android:text="@string/settings_networks_title" /> - </LinearLayout> - - <LinearLayout style="@style/Widget.CoreSettings.PrimaryItemGroup"> - - <androidx.recyclerview.widget.RecyclerView - android:id="@+id/networks" - android:layout_width="match_parent" - android:layout_height="wrap_content" - tools:itemCount="2" - tools:listitem="@layout/settings_item" /> - - <LinearLayout - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:orientation="horizontal"> - - <com.google.android.material.button.MaterialButton - android:id="@+id/new_network" - style="@style/Widget.Button.Borderless.Colored" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:text="@string/label_new_network" /> - </LinearLayout> - </LinearLayout> - - <LinearLayout style="@style/Widget.CoreSettings.PrimaryItemGroupHeader"> - - <androidx.appcompat.widget.AppCompatImageView - style="@style/Widget.CoreSettings.PrimaryItemIcon" - app:srcCompat="@drawable/ic_account_card" /> - - <TextView - style="@style/Widget.CoreSettings.PrimaryItemSwitch" - android:text="@string/settings_identities_title" /> - </LinearLayout> - - <LinearLayout - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:layout_marginStart="72dp" - android:orientation="vertical"> - - <androidx.recyclerview.widget.RecyclerView - android:id="@+id/identities" - android:layout_width="match_parent" - android:layout_height="wrap_content" - tools:itemCount="1" - tools:listitem="@layout/settings_item" /> - - <LinearLayout - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:orientation="horizontal"> - - <com.google.android.material.button.MaterialButton - android:id="@+id/new_identity" - style="@style/Widget.Button.Borderless.Colored" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:text="@string/label_new_identity" /> - </LinearLayout> - </LinearLayout> - - <LinearLayout style="@style/Widget.CoreSettings.PrimaryItemGroupHeader"> - - <androidx.appcompat.widget.AppCompatImageView - style="@style/Widget.CoreSettings.PrimaryItemIcon" - app:srcCompat="@drawable/ic_list_bulleted" /> - - <TextView - style="@style/Widget.CoreSettings.PrimaryItemSwitch" - android:text="@string/settings_chatlists_title" /> - </LinearLayout> - - <LinearLayout style="@style/Widget.CoreSettings.PrimaryItemGroup"> - - <androidx.recyclerview.widget.RecyclerView - android:id="@+id/chatlists" - android:layout_width="match_parent" - android:layout_height="wrap_content" - tools:itemCount="2" - tools:listitem="@layout/settings_item" /> - - <LinearLayout - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:orientation="horizontal"> - - <com.google.android.material.button.MaterialButton - android:id="@+id/new_chatlist" - style="@style/Widget.Button.Borderless.Colored" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:text="@string/label_new_chatlist" /> - </LinearLayout> - </LinearLayout> - - <LinearLayout - android:id="@+id/ignorelist" - style="@style/Widget.CoreSettings.PrimaryItemGroupHeader" - android:focusable="true"> - - <androidx.appcompat.widget.AppCompatImageView - style="@style/Widget.CoreSettings.PrimaryItemIcon" - app:srcCompat="@drawable/ic_filter" /> - - <TextView - style="@style/Widget.CoreSettings.PrimaryItemSwitch" - android:text="@string/settings_ignorelist_title" /> - </LinearLayout> - - <LinearLayout - android:id="@+id/highlightlist" - style="@style/Widget.CoreSettings.PrimaryItemGroupHeader" - android:focusable="true"> - - <androidx.appcompat.widget.AppCompatImageView - style="@style/Widget.CoreSettings.PrimaryItemIcon" - app:srcCompat="@drawable/ic_bell" /> - - <TextView - style="@style/Widget.CoreSettings.PrimaryItemSwitch" - android:text="@string/settings_highlightlist_title" /> - </LinearLayout> - - <LinearLayout - android:id="@+id/aliaslist" - style="@style/Widget.CoreSettings.PrimaryItemGroupHeader" - android:focusable="true"> - - <androidx.appcompat.widget.AppCompatImageView - style="@style/Widget.CoreSettings.PrimaryItemIcon" - app:srcCompat="@drawable/ic_message_bulleted" /> - - <TextView - style="@style/Widget.CoreSettings.PrimaryItemSwitch" - android:text="@string/settings_aliaslist_title" /> - </LinearLayout> - - <LinearLayout - android:id="@+id/networkconfig" - style="@style/Widget.CoreSettings.PrimaryItemGroupHeader" - android:focusable="true"> - - <androidx.appcompat.widget.AppCompatImageView - style="@style/Widget.CoreSettings.PrimaryItemIcon" - app:srcCompat="@drawable/ic_settings" /> - - <TextView - style="@style/Widget.CoreSettings.PrimaryItemSwitch" - android:text="@string/settings_networkconfig_title" /> - </LinearLayout> - - <LinearLayout - android:id="@+id/coreinfo" - style="@style/Widget.CoreSettings.PrimaryItemGroupHeader" - android:focusable="true"> - - <androidx.appcompat.widget.AppCompatImageView - style="@style/Widget.CoreSettings.PrimaryItemIcon" - app:srcCompat="@drawable/ic_info" /> - - <TextView - style="@style/Widget.CoreSettings.PrimaryItemSwitch" - android:text="@string/label_info_core" /> - </LinearLayout> - - <LinearLayout - android:id="@+id/passwordchange" - style="@style/Widget.CoreSettings.PrimaryItemGroupHeader" - android:focusable="true"> - - <androidx.appcompat.widget.AppCompatImageView - style="@style/Widget.CoreSettings.PrimaryItemIcon" - app:srcCompat="@drawable/ic_key_variant" /> - - <TextView - style="@style/Widget.CoreSettings.PrimaryItemSwitch" - android:text="@string/label_password_change" /> - </LinearLayout> - </LinearLayout> -</androidx.core.widget.NestedScrollView> diff --git a/app/src/main/res/layout/settings_network.xml b/app/src/main/res/layout/settings_network.xml deleted file mode 100644 index 01245c4d5508b1e3a423a7fa206e73922716a095..0000000000000000000000000000000000000000 --- a/app/src/main/res/layout/settings_network.xml +++ /dev/null @@ -1,387 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<androidx.core.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android" - xmlns:app="http://schemas.android.com/apk/res-auto" - xmlns:tools="http://schemas.android.com/tools" - android:layout_width="match_parent" - android:layout_height="match_parent" - android:scrollbars="vertical" - tools:ignore="UnusedAttribute"> - - <LinearLayout style="@style/Widget.CoreSettings.Wrapper"> - - <LinearLayout - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:minHeight="48dp"> - - <androidx.appcompat.widget.AppCompatImageView - style="@style/Widget.CoreSettings.PrimaryItemIcon" - app:srcCompat="@drawable/ic_message_bulleted" /> - - <TextView - style="@style/Widget.CoreSettings.PrimaryItemSwitch" - android:text="@string/settings_network_title" /> - </LinearLayout> - - <LinearLayout - style="@style/Widget.CoreSettings.DependentGroup" - android:visibility="visible"> - - <com.google.android.material.textfield.TextInputLayout - style="@style/Widget.CustomTextInput" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:hint="@string/settings_network_network_name"> - - <com.google.android.material.textfield.TextInputEditText - android:id="@+id/network_name" - style="@style/Widget.CoreSettings.EditText" - tools:text="Snoonet" /> - </com.google.android.material.textfield.TextInputLayout> - </LinearLayout> - - <LinearLayout - style="@style/Widget.CoreSettings.DependentGroup" - android:orientation="vertical" - android:visibility="visible"> - - <androidx.recyclerview.widget.RecyclerView - android:id="@+id/servers" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:layout_marginTop="8dp" - tools:itemCount="4" - tools:listitem="@layout/settings_network_server" /> - - <LinearLayout - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:orientation="horizontal"> - - <com.google.android.material.button.MaterialButton - android:id="@+id/new_server" - style="@style/Widget.Button.Borderless.Colored" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:text="@string/label_new_server" /> - </LinearLayout> - </LinearLayout> - - <LinearLayout - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:minHeight="48dp"> - - <androidx.appcompat.widget.AppCompatImageView - style="@style/Widget.CoreSettings.PrimaryItemIcon" - app:srcCompat="@drawable/ic_account_card" /> - - <TextView - style="@style/Widget.CoreSettings.PrimaryItemSwitch" - android:text="@string/settings_network_identity" /> - </LinearLayout> - - <LinearLayout - style="@style/Widget.CoreSettings.DependentGroup" - android:visibility="visible"> - - <de.kuschku.ui.spinner.MaterialSpinnerLayout - style="@style/Widget.CustomSpinnerLayout" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:hint="@string/settings_network_identity"> - - <androidx.appcompat.widget.AppCompatSpinner - android:id="@+id/identity" - style="@style/Widget.MaterialSpinner" - android:layout_width="match_parent" - android:layout_height="wrap_content" - tools:listitem="@layout/widget_spinner_item_material" /> - </de.kuschku.ui.spinner.MaterialSpinnerLayout> - </LinearLayout> - - <LinearLayout - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:minHeight="48dp"> - - <androidx.appcompat.widget.AppCompatImageView - style="@style/Widget.CoreSettings.PrimaryItemIcon" - app:srcCompat="@drawable/ic_key_variant" /> - - <androidx.appcompat.widget.SwitchCompat - android:id="@+id/sasl_enabled" - style="@style/Widget.CoreSettings.PrimaryItemSwitch" - android:text="@string/settings_network_sasl_enabled" /> - </LinearLayout> - - <LinearLayout - android:id="@+id/sasl_group" - style="@style/Widget.CoreSettings.DependentGroup" - tools:visibility="gone"> - - <com.google.android.material.textfield.TextInputLayout - style="@style/Widget.CustomTextInput" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:hint="@string/settings_network_sasl_account"> - - <com.google.android.material.textfield.TextInputEditText - android:id="@+id/sasl_account" - style="@style/Widget.CoreSettings.EditText" - android:autofillHints="username" - android:importantForAutofill="yes" - tools:text="justjanne" /> - </com.google.android.material.textfield.TextInputLayout> - - <com.google.android.material.textfield.TextInputLayout - style="@style/Widget.CustomTextInput" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:hint="@string/settings_network_sasl_password" - app:passwordToggleEnabled="true"> - - <com.google.android.material.textfield.TextInputEditText - android:id="@+id/sasl_password" - style="@style/Widget.CoreSettings.EditText" - android:autofillHints="password" - android:importantForAutofill="yes" - android:inputType="textPassword" - tools:text="thisisasecurepassword" /> - </com.google.android.material.textfield.TextInputLayout> - - <!-- TODO: Add info box to show if network supports SASL when connected --> - </LinearLayout> - - <LinearLayout - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:minHeight="48dp"> - - <androidx.appcompat.widget.AppCompatImageView - style="@style/Widget.CoreSettings.PrimaryItemIcon" - app:srcCompat="@drawable/ic_key_variant" /> - - <androidx.appcompat.widget.SwitchCompat - android:id="@+id/autoidentify_enabled" - style="@style/Widget.CoreSettings.PrimaryItemSwitch" - android:text="@string/settings_network_autoidentify_enabled" /> - </LinearLayout> - - <LinearLayout - android:id="@+id/autoidentify_group" - style="@style/Widget.CoreSettings.DependentGroup" - tools:visibility="visible"> - - <de.kuschku.quasseldroid.util.ui.view.InlineSnackBar - android:id="@+id/autoidentify_warning" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:layout_marginTop="8dp" - android:layout_marginBottom="8dp" - app:buttonText="@string/settings_network_sasl_upgrade" - app:text="@string/settings_network_sasl_supported" /> - - <com.google.android.material.textfield.TextInputLayout - style="@style/Widget.CustomTextInput" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:hint="@string/settings_network_autoidentify_service"> - - <com.google.android.material.textfield.TextInputEditText - android:id="@+id/autoidentify_service" - style="@style/Widget.CoreSettings.EditText" - tools:text="NickServ" /> - </com.google.android.material.textfield.TextInputLayout> - - <com.google.android.material.textfield.TextInputLayout - style="@style/Widget.CustomTextInput" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:hint="@string/settings_network_autoidentify_password" - app:passwordToggleEnabled="true"> - - <com.google.android.material.textfield.TextInputEditText - android:id="@+id/autoidentify_password" - style="@style/Widget.CoreSettings.EditText" - android:autofillHints="password" - android:importantForAutofill="yes" - android:inputType="textPassword" - tools:text="thisisasecurepassword" /> - </com.google.android.material.textfield.TextInputLayout> - </LinearLayout> - - <LinearLayout - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:minHeight="48dp"> - - <androidx.appcompat.widget.AppCompatImageView - style="@style/Widget.CoreSettings.PrimaryItemIcon" - app:srcCompat="@drawable/ic_server_network" /> - - <TextView - style="@style/Widget.CoreSettings.PrimaryItemSwitch" - android:text="@string/settings_network_connection" /> - </LinearLayout> - - <LinearLayout - style="@style/Widget.CoreSettings.DependentGroup" - android:visibility="visible"> - - <com.google.android.material.textfield.TextInputLayout - style="@style/Widget.CustomTextInput" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:hint="@string/settings_network_perform"> - - <com.google.android.material.textfield.TextInputEditText - android:id="@+id/perform" - style="@style/Widget.CoreSettings.EditText" - android:inputType="textMultiLine" - tools:text="/mode -x" /> - </com.google.android.material.textfield.TextInputLayout> - - <androidx.appcompat.widget.SwitchCompat - android:id="@+id/rejoin_channels" - style="@style/Widget.CoreSettings.PrimaryItemSwitch" - android:text="@string/settings_network_rejoin_channels" /> - </LinearLayout> - - <LinearLayout - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:minHeight="48dp"> - - <androidx.appcompat.widget.AppCompatImageView - style="@style/Widget.CoreSettings.PrimaryItemIcon" - app:srcCompat="@drawable/ic_clock" /> - - <androidx.appcompat.widget.SwitchCompat - android:id="@+id/autoreconnect_enabled" - style="@style/Widget.CoreSettings.PrimaryItemSwitch" - android:text="@string/settings_network_autoreconnect_enabled" /> - </LinearLayout> - - <LinearLayout - android:id="@+id/autoreconnect_group" - style="@style/Widget.CoreSettings.DependentGroup" - tools:visibility="visible"> - - <FrameLayout - android:layout_width="match_parent" - android:layout_height="wrap_content"> - - <com.google.android.material.textfield.TextInputLayout - style="@style/Widget.CustomTextInput" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:hint="@string/settings_network_autoreconnect_interval"> - - <com.google.android.material.textfield.TextInputEditText - android:id="@+id/autoreconnect_interval" - style="@style/Widget.CoreSettings.EditText" - tools:text="60" /> - </com.google.android.material.textfield.TextInputLayout> - - <TextView - style="@style/Widget.CoreSettings.EditTextSuffix" - android:text="@string/settings_network_autoreconnect_interval_unit" /> - </FrameLayout> - - <com.google.android.material.textfield.TextInputLayout - style="@style/Widget.CustomTextInput" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:hint="@string/settings_network_autoreconnect_attempts"> - - <com.google.android.material.textfield.TextInputEditText - android:id="@+id/autoreconnect_attempts" - style="@style/Widget.CoreSettings.EditText" - tools:text="20" /> - </com.google.android.material.textfield.TextInputLayout> - - <androidx.appcompat.widget.SwitchCompat - android:id="@+id/autoreconnect_unlimited" - style="@style/Widget.CoreSettings.PrimaryItemSwitch" - android:text="@string/settings_network_autoreconnect_unlimited" /> - </LinearLayout> - - <LinearLayout - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:minHeight="48dp"> - - <androidx.appcompat.widget.AppCompatImageView - style="@style/Widget.CoreSettings.PrimaryItemIcon" - app:srcCompat="@drawable/ic_settings" /> - - <androidx.appcompat.widget.SwitchCompat - android:id="@+id/customratelimits_enabled" - style="@style/Widget.CoreSettings.PrimaryItemSwitch" - android:text="@string/settings_network_customratelimits_enabled" /> - </LinearLayout> - - <LinearLayout - android:id="@+id/customratelimits_group" - style="@style/Widget.CoreSettings.DependentGroup" - tools:visibility="visible"> - - <androidx.appcompat.widget.SwitchCompat - android:id="@+id/customratelimits_unlimited" - style="@style/Widget.CoreSettings.PrimaryItemSwitch" - android:text="@string/settings_network_customratelimits_unlimited" /> - - <com.google.android.material.textfield.TextInputLayout - style="@style/Widget.CustomTextInput" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:hint="@string/settings_network_customratelimits_burstsize"> - - <com.google.android.material.textfield.TextInputEditText - android:id="@+id/customratelimits_burstsize" - style="@style/Widget.CoreSettings.EditText" - tools:text="5" /> - </com.google.android.material.textfield.TextInputLayout> - - <FrameLayout - android:layout_width="match_parent" - android:layout_height="wrap_content"> - - <com.google.android.material.textfield.TextInputLayout - style="@style/Widget.CustomTextInput" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:hint="@string/settings_network_customratelimits_delay"> - - <com.google.android.material.textfield.TextInputEditText - android:id="@+id/customratelimits_delay" - style="@style/Widget.CoreSettings.EditText" - tools:text="2.20" /> - </com.google.android.material.textfield.TextInputLayout> - - <TextView - style="@style/Widget.CoreSettings.EditTextSuffix" - android:text="@string/settings_network_customratelimits_interval_unit" /> - </FrameLayout> - </LinearLayout> - </LinearLayout> -</androidx.core.widget.NestedScrollView> diff --git a/app/src/main/res/layout/settings_network_server.xml b/app/src/main/res/layout/settings_network_server.xml deleted file mode 100644 index 922b6f80670a4c945480cca6f8157a8a4bdee5ee..0000000000000000000000000000000000000000 --- a/app/src/main/res/layout/settings_network_server.xml +++ /dev/null @@ -1,87 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<com.google.android.material.card.MaterialCardView xmlns:android="http://schemas.android.com/apk/res/android" - xmlns:app="http://schemas.android.com/apk/res-auto" - xmlns:tools="http://schemas.android.com/tools" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:layout_margin="2dp" - app:cardBackgroundColor="?colorBackgroundCard" - app:cardElevation="2dp" - tools:showIn="@layout/settings_network"> - - <LinearLayout - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:minHeight="?android:attr/listPreferredItemHeightSmall" - android:orientation="horizontal" - android:paddingTop="10dp" - android:paddingBottom="10dp"> - - <androidx.appcompat.widget.AppCompatImageView - android:id="@+id/ssl_enabled" - android:layout_width="wrap_content" - android:layout_height="match_parent" - android:layout_gravity="center_vertical" - android:paddingStart="?listPreferredItemPaddingLeft" - android:paddingEnd="32dp" - tools:srcCompat="@drawable/ic_lock" - tools:tint="?colorTintSecure" /> - - <LinearLayout - android:layout_width="0dip" - android:layout_height="wrap_content" - android:layout_gravity="center_vertical" - android:layout_weight="1" - android:orientation="vertical"> - - <TextView - android:id="@+id/host" - style="@style/Widget.RtlConformTextView" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:ellipsize="marquee" - android:singleLine="true" - android:textAppearance="?textAppearanceListItemSmall" - tools:text="@sample/networks.json/data/host" /> - - <TextView - android:id="@+id/port" - style="@style/Widget.RtlConformTextView" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:ellipsize="marquee" - android:singleLine="true" - android:textAppearance="?textAppearanceListItemSecondary" - android:textColor="?colorTextSecondary" - tools:text="@sample/networks.json/data/port" /> - </LinearLayout> - - <androidx.appcompat.widget.AppCompatImageView - android:id="@+id/handle" - android:layout_width="wrap_content" - android:layout_height="match_parent" - android:layout_gravity="center_vertical" - android:paddingStart="32dp" - android:paddingEnd="?listPreferredItemPaddingRight" - app:srcCompat="@drawable/ic_reorder" - app:tint="?colorTextSecondary" /> - </LinearLayout> -</com.google.android.material.card.MaterialCardView> diff --git a/app/src/main/res/layout/settings_networkconfig.xml b/app/src/main/res/layout/settings_networkconfig.xml deleted file mode 100644 index 4c63eba9f75a5cacf3aa5af5f5c23a6ad1a3e287..0000000000000000000000000000000000000000 --- a/app/src/main/res/layout/settings_networkconfig.xml +++ /dev/null @@ -1,196 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<androidx.core.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android" - xmlns:app="http://schemas.android.com/apk/res-auto" - xmlns:tools="http://schemas.android.com/tools" - android:layout_width="match_parent" - android:layout_height="match_parent" - android:scrollbars="vertical"> - - <LinearLayout style="@style/Widget.CoreSettings.Wrapper"> - - <LinearLayout - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:minHeight="48dp"> - - <androidx.appcompat.widget.AppCompatImageView - style="@style/Widget.CoreSettings.PrimaryItemIcon" - app:srcCompat="@drawable/ic_history" /> - - <androidx.appcompat.widget.SwitchCompat - android:id="@+id/ping_timeout_enabled" - style="@style/Widget.CoreSettings.PrimaryItemSwitch" - android:text="@string/settings_networkconfig_ping_timeout" /> - </LinearLayout> - - <LinearLayout - android:id="@+id/ping_timeout_group" - style="@style/Widget.CoreSettings.DependentGroup" - tools:visibility="visible"> - - <FrameLayout - android:layout_width="match_parent" - android:layout_height="wrap_content"> - - <com.google.android.material.textfield.TextInputLayout - style="@style/Widget.CustomTextInput" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:hint="@string/settings_networkconfig_ping_interval"> - - <com.google.android.material.textfield.TextInputEditText - android:id="@+id/ping_interval" - style="@style/Widget.CoreSettings.EditText" - android:inputType="number" - tools:text="30" /> - </com.google.android.material.textfield.TextInputLayout> - - <TextView - style="@style/Widget.CoreSettings.EditTextSuffix" - android:text="@string/settings_networkconfig_ping_interval_unit" /> - </FrameLayout> - - <FrameLayout - android:layout_width="match_parent" - android:layout_height="wrap_content"> - - <com.google.android.material.textfield.TextInputLayout - style="@style/Widget.CustomTextInput" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:hint="@string/settings_networkconfig_max_ping_count"> - - <com.google.android.material.textfield.TextInputEditText - android:id="@+id/max_ping_count" - style="@style/Widget.CoreSettings.EditText" - android:inputType="number" - tools:text="10" /> - </com.google.android.material.textfield.TextInputLayout> - - <TextView - style="@style/Widget.CoreSettings.EditTextSuffix" - android:text="@string/settings_networkconfig_max_ping_count_unit" /> - </FrameLayout> - </LinearLayout> - - <LinearLayout - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:minHeight="48dp"> - - <androidx.appcompat.widget.AppCompatImageView - style="@style/Widget.CoreSettings.PrimaryItemIcon" - app:srcCompat="@drawable/ic_account" /> - - <androidx.appcompat.widget.SwitchCompat - android:id="@+id/auto_who_enabled" - style="@style/Widget.CoreSettings.PrimaryItemSwitch" - android:text="@string/settings_networkconfig_auto_who" /> - </LinearLayout> - - <LinearLayout - android:id="@+id/auto_who_group" - style="@style/Widget.CoreSettings.DependentGroup" - tools:visibility="visible"> - - <FrameLayout - android:layout_width="match_parent" - android:layout_height="wrap_content"> - - <com.google.android.material.textfield.TextInputLayout - style="@style/Widget.CustomTextInput" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:hint="@string/settings_networkconfig_auto_who_interval"> - - <com.google.android.material.textfield.TextInputEditText - android:id="@+id/auto_who_interval" - style="@style/Widget.CoreSettings.EditText" - android:inputType="number" - tools:text="90" /> - </com.google.android.material.textfield.TextInputLayout> - - <TextView - style="@style/Widget.CoreSettings.EditTextSuffix" - android:text="@string/settings_networkconfig_auto_who_interval_unit" /> - </FrameLayout> - - <FrameLayout - android:layout_width="match_parent" - android:layout_height="wrap_content"> - - <com.google.android.material.textfield.TextInputLayout - style="@style/Widget.CustomTextInput" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:hint="@string/settings_networkconfig_auto_who_nick_limit"> - - <com.google.android.material.textfield.TextInputEditText - android:id="@+id/auto_who_nick_limit" - style="@style/Widget.CoreSettings.EditText" - android:inputType="number" - tools:text="100" /> - </com.google.android.material.textfield.TextInputLayout> - - <TextView - style="@style/Widget.CoreSettings.EditTextSuffix" - android:text="@string/settings_networkconfig_auto_who_nick_limit_unit" /> - </FrameLayout> - - <FrameLayout - android:layout_width="match_parent" - android:layout_height="wrap_content"> - - <com.google.android.material.textfield.TextInputLayout - style="@style/Widget.CustomTextInput" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:hint="@string/settings_networkconfig_auto_who_delay"> - - <com.google.android.material.textfield.TextInputEditText - android:id="@+id/auto_who_delay" - style="@style/Widget.CoreSettings.EditText" - android:inputType="number" - tools:text="5" /> - </com.google.android.material.textfield.TextInputLayout> - - <TextView - style="@style/Widget.CoreSettings.EditTextSuffix" - android:text="@string/settings_networkconfig_auto_who_delay_unit" /> - </FrameLayout> - </LinearLayout> - - <LinearLayout - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:minHeight="48dp"> - - <androidx.appcompat.widget.AppCompatImageView - style="@style/Widget.CoreSettings.PrimaryItemIcon" - app:srcCompat="@drawable/ic_message_bulleted" /> - - <androidx.appcompat.widget.SwitchCompat - android:id="@+id/standard_ctcp" - style="@style/Widget.CoreSettings.PrimaryItemSwitch" - android:text="@string/settings_networkconfig_standard_ctcp" /> - </LinearLayout> - </LinearLayout> -</androidx.core.widget.NestedScrollView> diff --git a/app/src/main/res/layout/settings_networkserver.xml b/app/src/main/res/layout/settings_networkserver.xml deleted file mode 100644 index f173de691326fab902d0eedd944c249afe3b6d66..0000000000000000000000000000000000000000 --- a/app/src/main/res/layout/settings_networkserver.xml +++ /dev/null @@ -1,183 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<androidx.core.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android" - xmlns:app="http://schemas.android.com/apk/res-auto" - xmlns:tools="http://schemas.android.com/tools" - android:layout_width="match_parent" - android:layout_height="match_parent" - android:scrollbars="vertical"> - - <LinearLayout style="@style/Widget.CoreSettings.Wrapper"> - - <LinearLayout - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:minHeight="48dp"> - - <androidx.appcompat.widget.AppCompatImageView - style="@style/Widget.CoreSettings.PrimaryItemIcon" - app:srcCompat="@drawable/ic_server_network" /> - - <TextView - style="@style/Widget.CoreSettings.PrimaryItemSwitch" - android:text="@string/settings_networkserver_connection" /> - </LinearLayout> - - <LinearLayout - style="@style/Widget.CoreSettings.DependentGroup" - android:visibility="visible"> - - <com.google.android.material.textfield.TextInputLayout - style="@style/Widget.CustomTextInput" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:hint="@string/settings_networkserver_host"> - - <com.google.android.material.textfield.TextInputEditText - android:id="@+id/host" - style="@style/Widget.CoreSettings.EditText" - tools:text="irc.freenode.org" /> - </com.google.android.material.textfield.TextInputLayout> - - <com.google.android.material.textfield.TextInputLayout - style="@style/Widget.CustomTextInput" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:hint="@string/settings_networkserver_port"> - - <com.google.android.material.textfield.TextInputEditText - android:id="@+id/port" - style="@style/Widget.CoreSettings.EditText" - android:inputType="number" - tools:text="6667" /> - </com.google.android.material.textfield.TextInputLayout> - - <androidx.appcompat.widget.SwitchCompat - android:id="@+id/ssl_enabled" - style="@style/Widget.CoreSettings.PrimaryItemSwitch" - android:text="@string/settings_networkserver_ssl_enabled" /> - - <androidx.appcompat.widget.SwitchCompat - android:id="@+id/ssl_verify" - style="@style/Widget.CoreSettings.PrimaryItemSwitch" - android:text="@string/settings_networkserver_ssl_verify" /> - - <com.google.android.material.textfield.TextInputLayout - style="@style/Widget.CustomTextInput" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:hint="@string/settings_networkserver_password" - app:passwordToggleEnabled="true"> - - <com.google.android.material.textfield.TextInputEditText - android:id="@+id/password" - style="@style/Widget.CoreSettings.EditText" - android:inputType="textPassword" - tools:text="thisisasecurepassword" /> - </com.google.android.material.textfield.TextInputLayout> - </LinearLayout> - - <LinearLayout - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:minHeight="48dp"> - - <androidx.appcompat.widget.AppCompatImageView - style="@style/Widget.CoreSettings.PrimaryItemIcon" - app:srcCompat="@drawable/ic_settings" /> - - <androidx.appcompat.widget.SwitchCompat - android:id="@+id/proxy_enabled" - style="@style/Widget.CoreSettings.PrimaryItemSwitch" - android:text="@string/settings_networkserver_proxy_enabled" /> - </LinearLayout> - - <LinearLayout - android:id="@+id/proxy_group" - style="@style/Widget.CoreSettings.DependentGroup" - tools:visibility="visible"> - - <de.kuschku.ui.spinner.MaterialSpinnerLayout - style="@style/Widget.CustomSpinnerLayout" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:hint="@string/settings_networkserver_proxy_type"> - - <androidx.appcompat.widget.AppCompatSpinner - android:id="@+id/proxy_type" - style="@style/Widget.MaterialSpinner" - android:layout_width="match_parent" - android:layout_height="wrap_content" - tools:listitem="@layout/widget_spinner_item_material" /> - </de.kuschku.ui.spinner.MaterialSpinnerLayout> - - <com.google.android.material.textfield.TextInputLayout - style="@style/Widget.CustomTextInput" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:hint="@string/settings_networkserver_proxy_host"> - - <com.google.android.material.textfield.TextInputEditText - android:id="@+id/proxy_host" - style="@style/Widget.CoreSettings.EditText" - tools:text="localhost" /> - </com.google.android.material.textfield.TextInputLayout> - - <com.google.android.material.textfield.TextInputLayout - style="@style/Widget.CustomTextInput" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:hint="@string/settings_networkserver_proxy_port"> - - <com.google.android.material.textfield.TextInputEditText - android:id="@+id/proxy_port" - style="@style/Widget.CoreSettings.EditText" - android:inputType="number" - tools:text="8080" /> - </com.google.android.material.textfield.TextInputLayout> - - <com.google.android.material.textfield.TextInputLayout - style="@style/Widget.CustomTextInput" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:hint="@string/settings_networkserver_proxy_user"> - - <com.google.android.material.textfield.TextInputEditText - android:id="@+id/proxy_user" - style="@style/Widget.CoreSettings.EditText" - tools:text="justjanne" /> - </com.google.android.material.textfield.TextInputLayout> - - <com.google.android.material.textfield.TextInputLayout - style="@style/Widget.CustomTextInput" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:hint="@string/settings_networkserver_proxy_pass" - app:passwordToggleEnabled="true"> - - <com.google.android.material.textfield.TextInputEditText - android:id="@+id/proxy_pass" - style="@style/Widget.CoreSettings.EditText" - android:inputType="textPassword" - tools:text="thisisasecurepassword" /> - </com.google.android.material.textfield.TextInputLayout> - </LinearLayout> - </LinearLayout> -</androidx.core.widget.NestedScrollView> diff --git a/app/src/main/res/layout/settings_passwordchange.xml b/app/src/main/res/layout/settings_passwordchange.xml deleted file mode 100644 index e246ed3fdf7608046c2862cf467efb8b3261bc8a..0000000000000000000000000000000000000000 --- a/app/src/main/res/layout/settings_passwordchange.xml +++ /dev/null @@ -1,146 +0,0 @@ -<!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<androidx.core.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android" - xmlns:app="http://schemas.android.com/apk/res-auto" - xmlns:tools="http://schemas.android.com/tools" - android:layout_width="match_parent" - android:layout_height="match_parent" - android:orientation="vertical"> - - <LinearLayout - android:layout_width="match_parent" - android:layout_height="match_parent" - android:orientation="vertical" - android:padding="32dp"> - - <com.google.android.material.textfield.TextInputLayout - android:id="@+id/userWrapper" - style="@style/Widget.CustomTextInput" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:layout_marginBottom="16dp" - android:hint="@string/label_account_user" - tools:ignore="LabelFor"> - - <com.google.android.material.textfield.TextInputEditText - android:id="@+id/user" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:enabled="false" - android:inputType="textVisiblePassword|textNoSuggestions" - app:errorEnabled="true" - tools:text="kuschku" /> - </com.google.android.material.textfield.TextInputLayout> - - <com.google.android.material.textfield.TextInputLayout - android:id="@+id/password_old_wrapper" - style="@style/Widget.CustomTextInput" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:layout_marginBottom="16dp" - android:hint="@string/label_password_old" - app:passwordToggleEnabled="true" - tools:ignore="LabelFor"> - - <com.google.android.material.textfield.TextInputEditText - android:id="@+id/password_old" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:inputType="textPassword" - app:errorEnabled="true" /> - </com.google.android.material.textfield.TextInputLayout> - - <com.google.android.material.textfield.TextInputLayout - style="@style/Widget.CustomTextInput" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:hint="@string/label_password_new" - app:passwordToggleEnabled="true" - tools:ignore="LabelFor"> - - <com.google.android.material.textfield.TextInputEditText - android:id="@+id/password_new" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:inputType="textPassword" - app:errorEnabled="true" /> - </com.google.android.material.textfield.TextInputLayout> - - <com.google.android.material.textfield.TextInputLayout - android:id="@+id/password_repeat_wrapper" - style="@style/Widget.CustomTextInput" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:layout_marginBottom="16dp" - android:hint="@string/label_password_repeat" - app:passwordToggleEnabled="true" - tools:ignore="LabelFor"> - - <com.google.android.material.textfield.TextInputEditText - android:id="@+id/password_repeat" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:inputType="textPassword" - app:errorEnabled="true" /> - </com.google.android.material.textfield.TextInputLayout> - - - <TextView - android:id="@+id/error" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:layout_marginLeft="4dp" - android:layout_marginRight="4dp" - android:layout_marginBottom="16dp" - android:textColor="?colorForegroundError" - android:visibility="gone" - tools:text="Error occured: Passwords do not match" - tools:visibility="visible" /> - - <LinearLayout - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:orientation="horizontal"> - - <com.google.android.material.button.MaterialButton - android:id="@+id/save" - style="@style/Widget.Button.Colored" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:text="@string/label_save" /> - - <Space - android:layout_width="0dip" - android:layout_height="match_parent" - android:layout_weight="1" /> - - <me.zhanghai.android.materialprogressbar.MaterialProgressBar - android:id="@+id/progress" - android:layout_width="32dp" - android:layout_height="32dp" - android:layout_gravity="center_vertical" - android:visibility="gone" - tools:visibility="visible" /> - - </LinearLayout> - - </LinearLayout> - -</androidx.core.widget.NestedScrollView> diff --git a/app/src/main/res/layout/setup_account_connection.xml b/app/src/main/res/layout/setup_account_connection.xml deleted file mode 100644 index ac49fc80d7871d92b9b61063067f5adbbbd25e91..0000000000000000000000000000000000000000 --- a/app/src/main/res/layout/setup_account_connection.xml +++ /dev/null @@ -1,70 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> - -<!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" - xmlns:app="http://schemas.android.com/apk/res-auto" - xmlns:tools="http://schemas.android.com/tools" - android:layout_width="match_parent" - android:layout_height="match_parent" - android:orientation="vertical" - android:padding="32dp"> - - <com.google.android.material.textfield.TextInputLayout - android:id="@+id/hostWrapper" - style="@style/Widget.CustomTextInput" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:hint="@string/label_connection_host" - app:errorEnabled="true" - tools:ignore="LabelFor"> - - <com.google.android.material.textfield.TextInputEditText - android:id="@+id/host" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:inputType="textUri" /> - </com.google.android.material.textfield.TextInputLayout> - - <com.google.android.material.textfield.TextInputLayout - android:id="@+id/portWrapper" - style="@style/Widget.CustomTextInput" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:hint="@string/label_connection_port" - app:errorEnabled="true" - tools:ignore="LabelFor"> - - <com.google.android.material.textfield.TextInputEditText - android:id="@+id/port" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:inputType="number" - android:text="@string/defaultConnectionPort" /> - </com.google.android.material.textfield.TextInputLayout> - - <androidx.appcompat.widget.SwitchCompat - android:id="@+id/require_ssl" - style="@style/Widget.CoreSettings.PrimaryItemSwitch" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:text="@string/label_connection_ssl" /> - -</LinearLayout> diff --git a/app/src/main/res/layout/setup_account_edit.xml b/app/src/main/res/layout/setup_account_edit.xml deleted file mode 100644 index f8af1268bf010f62bb80092c1d5f9ca9308ed1be..0000000000000000000000000000000000000000 --- a/app/src/main/res/layout/setup_account_edit.xml +++ /dev/null @@ -1,210 +0,0 @@ -<!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<androidx.core.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android" - xmlns:app="http://schemas.android.com/apk/res-auto" - xmlns:tools="http://schemas.android.com/tools" - android:layout_width="match_parent" - android:layout_height="match_parent"> - - <LinearLayout - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:orientation="vertical"> - - <Space - android:layout_width="match_parent" - android:layout_height="16dp" /> - - <LinearLayout - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:paddingLeft="16dp" - android:paddingRight="16dp"> - - <FrameLayout - android:layout_width="56dp" - android:layout_height="68dp"> - - <androidx.appcompat.widget.AppCompatImageView - android:layout_width="24dp" - android:layout_height="24dp" - android:layout_gravity="center_vertical" - app:srcCompat="@drawable/ic_pencil" - app:tint="?android:textColorSecondary" - tools:ignore="ContentDescription" /> - </FrameLayout> - - <com.google.android.material.textfield.TextInputLayout - android:id="@+id/nameWrapper" - style="@style/Widget.CustomTextInput" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:hint="@string/label_account_name" - tools:ignore="LabelFor"> - - <com.google.android.material.textfield.TextInputEditText - android:id="@+id/name" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:inputType="text" - app:errorEnabled="true" /> - </com.google.android.material.textfield.TextInputLayout> - </LinearLayout> - - <Space - android:layout_width="match_parent" - android:layout_height="16dp" /> - - <LinearLayout - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:paddingLeft="16dp" - android:paddingRight="16dp"> - - <FrameLayout - android:layout_width="56dp" - android:layout_height="68dp"> - - <androidx.appcompat.widget.AppCompatImageView - android:layout_width="24dp" - android:layout_height="24dp" - android:layout_gravity="center_vertical" - app:srcCompat="@drawable/ic_server_network" - app:tint="?android:textColorSecondary" - tools:ignore="ContentDescription" /> - </FrameLayout> - - <LinearLayout - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:orientation="vertical"> - - <com.google.android.material.textfield.TextInputLayout - android:id="@+id/hostWrapper" - style="@style/Widget.CustomTextInput" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:hint="@string/label_connection_host" - tools:ignore="LabelFor"> - - <com.google.android.material.textfield.TextInputEditText - android:id="@+id/host" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:inputType="textUri" - app:errorEnabled="true" /> - </com.google.android.material.textfield.TextInputLayout> - - <com.google.android.material.textfield.TextInputLayout - android:id="@+id/portWrapper" - style="@style/Widget.CustomTextInput" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:hint="@string/label_connection_port" - tools:ignore="LabelFor"> - - <com.google.android.material.textfield.TextInputEditText - android:id="@+id/port" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:inputType="number" - android:text="@string/defaultConnectionPort" - app:errorEnabled="true" /> - </com.google.android.material.textfield.TextInputLayout> - - <androidx.appcompat.widget.SwitchCompat - android:id="@+id/require_ssl" - style="@style/Widget.CoreSettings.PrimaryItemSwitch" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:text="@string/label_connection_ssl" /> - </LinearLayout> - </LinearLayout> - - <Space - android:layout_width="match_parent" - android:layout_height="16dp" /> - - - <LinearLayout - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:paddingLeft="16dp" - android:paddingRight="16dp"> - - <FrameLayout - android:layout_width="56dp" - android:layout_height="68dp"> - - <androidx.appcompat.widget.AppCompatImageView - android:layout_width="24dp" - android:layout_height="24dp" - android:layout_gravity="center_vertical" - app:srcCompat="@drawable/ic_account" - app:tint="?android:textColorSecondary" - tools:ignore="ContentDescription" /> - </FrameLayout> - - <LinearLayout - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:orientation="vertical"> - - <com.google.android.material.textfield.TextInputLayout - android:id="@+id/userWrapper" - style="@style/Widget.CustomTextInput" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:hint="@string/label_account_user" - tools:ignore="LabelFor"> - - <com.google.android.material.textfield.TextInputEditText - android:id="@+id/user" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:inputType="textVisiblePassword|textNoSuggestions" - app:errorEnabled="true" /> - </com.google.android.material.textfield.TextInputLayout> - - <com.google.android.material.textfield.TextInputLayout - android:id="@+id/passWrapper" - style="@style/Widget.CustomTextInput" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:hint="@string/label_account_pass" - app:passwordToggleEnabled="true" - tools:ignore="LabelFor"> - - <com.google.android.material.textfield.TextInputEditText - android:id="@+id/pass" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:inputType="textPassword" - app:errorEnabled="true" /> - </com.google.android.material.textfield.TextInputLayout> - - </LinearLayout> - </LinearLayout> - - <Space - android:layout_width="match_parent" - android:layout_height="16dp" /> - </LinearLayout> -</androidx.core.widget.NestedScrollView> diff --git a/app/src/main/res/layout/setup_account_name.xml b/app/src/main/res/layout/setup_account_name.xml deleted file mode 100644 index 8a6613354fde21580a0ca1f338379a2a126e7fe2..0000000000000000000000000000000000000000 --- a/app/src/main/res/layout/setup_account_name.xml +++ /dev/null @@ -1,44 +0,0 @@ -<!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" - xmlns:app="http://schemas.android.com/apk/res-auto" - xmlns:tools="http://schemas.android.com/tools" - android:layout_width="match_parent" - android:layout_height="match_parent" - android:orientation="vertical" - android:padding="32dp"> - - <com.google.android.material.textfield.TextInputLayout - android:id="@+id/nameWrapper" - style="@style/Widget.CustomTextInput" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:hint="@string/label_account_name" - app:errorEnabled="true" - tools:ignore="LabelFor"> - - <com.google.android.material.textfield.TextInputEditText - android:id="@+id/name" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:inputType="text" /> - </com.google.android.material.textfield.TextInputLayout> - -</LinearLayout> diff --git a/app/src/main/res/layout/setup_account_user.xml b/app/src/main/res/layout/setup_account_user.xml deleted file mode 100644 index 09005de2fe2f9f228bf2eee8aa2f833094df729d..0000000000000000000000000000000000000000 --- a/app/src/main/res/layout/setup_account_user.xml +++ /dev/null @@ -1,61 +0,0 @@ -<!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" - xmlns:app="http://schemas.android.com/apk/res-auto" - xmlns:tools="http://schemas.android.com/tools" - android:layout_width="match_parent" - android:layout_height="match_parent" - android:orientation="vertical" - android:padding="32dp"> - - <com.google.android.material.textfield.TextInputLayout - android:id="@+id/userWrapper" - style="@style/Widget.CustomTextInput" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:hint="@string/label_account_user" - tools:ignore="LabelFor"> - - <com.google.android.material.textfield.TextInputEditText - android:id="@+id/user" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:inputType="textVisiblePassword|textNoSuggestions" - app:errorEnabled="true" /> - </com.google.android.material.textfield.TextInputLayout> - - <com.google.android.material.textfield.TextInputLayout - android:id="@+id/passWrapper" - style="@style/Widget.CustomTextInput" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:hint="@string/label_account_pass" - app:passwordToggleEnabled="true" - tools:ignore="LabelFor"> - - <com.google.android.material.textfield.TextInputEditText - android:id="@+id/pass" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:inputType="textPassword" - app:errorEnabled="true" /> - </com.google.android.material.textfield.TextInputLayout> - -</LinearLayout> diff --git a/app/src/main/res/layout/setup_core_backend_configure.xml b/app/src/main/res/layout/setup_core_backend_configure.xml deleted file mode 100644 index e0213b1e61dc848ba371e397ad131522a4af679e..0000000000000000000000000000000000000000 --- a/app/src/main/res/layout/setup_core_backend_configure.xml +++ /dev/null @@ -1,37 +0,0 @@ -<!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" - android:layout_width="match_parent" - android:layout_height="match_parent" - android:orientation="vertical" - android:padding="32dp"> - - <TextView - android:id="@+id/no_options_info" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:text="@string/setup_core_backend_no_options" /> - - <LinearLayout - android:id="@+id/frame" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:orientation="vertical" /> -</LinearLayout> diff --git a/app/src/main/res/layout/setup_network_network.xml b/app/src/main/res/layout/setup_network_network.xml deleted file mode 100644 index 04c32fe74e57890e2a2e81d7b39f819e9e028ae0..0000000000000000000000000000000000000000 --- a/app/src/main/res/layout/setup_network_network.xml +++ /dev/null @@ -1,121 +0,0 @@ -<!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" - xmlns:app="http://schemas.android.com/apk/res-auto" - xmlns:tools="http://schemas.android.com/tools" - android:layout_width="match_parent" - android:layout_height="match_parent" - android:orientation="vertical" - android:padding="32dp"> - - <de.kuschku.ui.spinner.MaterialSpinnerLayout - style="@style/Widget.CustomSpinnerLayout" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:hint="@string/settings_network_title"> - - <androidx.appcompat.widget.AppCompatSpinner - android:id="@+id/network" - style="@style/Widget.MaterialSpinner" - android:layout_width="match_parent" - android:layout_height="wrap_content" - tools:listitem="@layout/widget_spinner_item_material" /> - </de.kuschku.ui.spinner.MaterialSpinnerLayout> - - <LinearLayout - android:id="@+id/network_group" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:orientation="vertical"> - - <de.kuschku.ui.spinner.MaterialSpinnerLayout - style="@style/Widget.CustomSpinnerLayout" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:hint="@string/settings_identity_title"> - - <androidx.appcompat.widget.AppCompatSpinner - android:id="@+id/identity" - style="@style/Widget.MaterialSpinner" - android:layout_width="match_parent" - android:layout_height="wrap_content" - tools:listitem="@layout/widget_spinner_item_material" /> - </de.kuschku.ui.spinner.MaterialSpinnerLayout> - - <com.google.android.material.textfield.TextInputLayout - android:id="@+id/nameWrapper" - style="@style/Widget.CustomTextInput" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:hint="@string/settings_network_network_name" - tools:ignore="LabelFor"> - - <com.google.android.material.textfield.TextInputEditText - android:id="@+id/name" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:inputType="textUri|textNoSuggestions" - app:errorEnabled="true" /> - </com.google.android.material.textfield.TextInputLayout> - - <com.google.android.material.textfield.TextInputLayout - android:id="@+id/hostWrapper" - style="@style/Widget.CustomTextInput" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:hint="@string/settings_networkserver_host" - tools:ignore="LabelFor"> - - <com.google.android.material.textfield.TextInputEditText - android:id="@+id/host" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:inputType="textUri|textNoSuggestions" - app:errorEnabled="true" /> - </com.google.android.material.textfield.TextInputLayout> - - <com.google.android.material.textfield.TextInputLayout - android:id="@+id/portWrapper" - style="@style/Widget.CustomTextInput" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:hint="@string/settings_networkserver_port" - app:passwordToggleEnabled="true" - tools:ignore="LabelFor"> - - <com.google.android.material.textfield.TextInputEditText - android:id="@+id/port" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:inputType="number" - android:text="6667" - app:errorEnabled="true" - tools:ignore="HardcodedText" /> - </com.google.android.material.textfield.TextInputLayout> - - <androidx.appcompat.widget.SwitchCompat - android:id="@+id/ssl_enabled" - style="@style/Widget.CoreSettings.PrimaryItemSwitch" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:text="@string/settings_networkserver_ssl_enabled" /> - </LinearLayout> - -</LinearLayout> diff --git a/app/src/main/res/layout/setup_select_account.xml b/app/src/main/res/layout/setup_select_account.xml deleted file mode 100644 index aeacf0ec4305f519e079fcffc4c2c7b913bb7bc7..0000000000000000000000000000000000000000 --- a/app/src/main/res/layout/setup_select_account.xml +++ /dev/null @@ -1,25 +0,0 @@ -<!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<androidx.recyclerview.widget.RecyclerView xmlns:android="http://schemas.android.com/apk/res/android" - xmlns:tools="http://schemas.android.com/tools" - android:id="@+id/account_list" - android:layout_width="match_parent" - android:layout_height="match_parent" - tools:listitem="@layout/widget_core_account" /> diff --git a/app/src/main/res/layout/setup_slide.xml b/app/src/main/res/layout/setup_slide.xml deleted file mode 100644 index 0d48cd01eac39dd8dccecd789892ab0825238ea3..0000000000000000000000000000000000000000 --- a/app/src/main/res/layout/setup_slide.xml +++ /dev/null @@ -1,90 +0,0 @@ -<!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android" - xmlns:app="http://schemas.android.com/apk/res-auto" - xmlns:tools="http://schemas.android.com/tools" - android:layout_width="match_parent" - android:layout_height="match_parent" - tools:ignore="InconsistentLayout"> - - <com.google.android.material.appbar.AppBarLayout - android:layout_width="match_parent" - android:layout_height="wrap_content"> - - <com.google.android.material.appbar.CollapsingToolbarLayout - android:id="@+id/collapsingToolbar" - android:layout_width="match_parent" - android:layout_height="wrap_content" - app:collapsedTitleTextAppearance="@style/TextAppearance.AppCompat.Widget.ActionBar.Title.Inverse" - app:contentScrim="?colorPrimary" - app:expandedTitleGravity="top" - app:expandedTitleMarginBottom="0dp" - app:expandedTitleMarginEnd="48dp" - app:expandedTitleMarginStart="32dp" - app:expandedTitleMarginTop="24dp" - app:expandedTitleTextAppearance="@style/TextAppearance.AppCompat.Title.Inverse" - app:layout_scrollFlags="scroll|exitUntilCollapsed"> - - <LinearLayout - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:orientation="vertical" - app:layout_collapseMode="parallax" - app:layout_collapseParallaxMultiplier="1"> - - <Space - android:layout_width="match_parent" - android:layout_height="21sp" - android:layout_marginTop="24dp" /> - - <TextView - android:id="@+id/description" - style="@style/Widget.RtlConformTextView" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_marginStart="32dp" - android:layout_marginTop="8dp" - android:layout_marginEnd="48dp" - android:layout_marginBottom="24dp" - android:textColor="?android:attr/textColorSecondaryInverse" - android:textSize="16sp" - tools:text="First, please choose which server your core is hosted on." /> - </LinearLayout> - - <androidx.appcompat.widget.Toolbar - android:layout_width="match_parent" - android:layout_height="?actionBarSize" - app:layout_collapseMode="pin" - app:titleMarginEnd="48dp" - app:titleMarginStart="16dp" /> - </com.google.android.material.appbar.CollapsingToolbarLayout> - </com.google.android.material.appbar.AppBarLayout> - - <androidx.core.widget.NestedScrollView - android:layout_width="match_parent" - android:layout_height="wrap_content" - app:layout_behavior="@string/appbar_scrolling_view_behavior"> - - <FrameLayout - android:id="@+id/content_host" - android:layout_width="match_parent" - android:layout_height="wrap_content" /> - </androidx.core.widget.NestedScrollView> -</androidx.coordinatorlayout.widget.CoordinatorLayout> diff --git a/app/src/main/res/layout/setup_user_channels.xml b/app/src/main/res/layout/setup_user_channels.xml deleted file mode 100644 index 087a893824d79163e238256df007ea24d0a36a38..0000000000000000000000000000000000000000 --- a/app/src/main/res/layout/setup_user_channels.xml +++ /dev/null @@ -1,44 +0,0 @@ -<!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" - xmlns:app="http://schemas.android.com/apk/res-auto" - xmlns:tools="http://schemas.android.com/tools" - android:layout_width="match_parent" - android:layout_height="match_parent" - android:orientation="vertical" - android:padding="32dp"> - - <com.google.android.material.textfield.TextInputLayout - android:id="@+id/channelsWrapper" - style="@style/Widget.CustomTextInput" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:hint="@string/label_channels" - tools:ignore="LabelFor"> - - <com.google.android.material.textfield.TextInputEditText - android:id="@+id/channels" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:inputType="textMultiLine" - app:errorEnabled="true" /> - </com.google.android.material.textfield.TextInputLayout> - -</LinearLayout> diff --git a/app/src/main/res/layout/setup_user_identity.xml b/app/src/main/res/layout/setup_user_identity.xml deleted file mode 100644 index 5e39522fbb468f4c903044bae368bf7ae21e9364..0000000000000000000000000000000000000000 --- a/app/src/main/res/layout/setup_user_identity.xml +++ /dev/null @@ -1,61 +0,0 @@ -<!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" - xmlns:app="http://schemas.android.com/apk/res-auto" - xmlns:tools="http://schemas.android.com/tools" - android:layout_width="match_parent" - android:layout_height="match_parent" - android:orientation="vertical" - android:padding="32dp"> - - <com.google.android.material.textfield.TextInputLayout - android:id="@+id/nickWrapper" - style="@style/Widget.CustomTextInput" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:hint="@string/settings_identity_nick" - tools:ignore="LabelFor"> - - <com.google.android.material.textfield.TextInputEditText - android:id="@+id/nick" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:inputType="textVisiblePassword|textNoSuggestions" - app:errorEnabled="true" /> - </com.google.android.material.textfield.TextInputLayout> - - <com.google.android.material.textfield.TextInputLayout - android:id="@+id/realnameWrapper" - style="@style/Widget.CustomTextInput" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:hint="@string/settings_identity_real_name" - app:passwordToggleEnabled="true" - tools:ignore="LabelFor"> - - <com.google.android.material.textfield.TextInputEditText - android:id="@+id/realname" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:inputType="textPersonName" - app:errorEnabled="true" /> - </com.google.android.material.textfield.TextInputLayout> - -</LinearLayout> diff --git a/app/src/main/res/layout/setup_user_network.xml b/app/src/main/res/layout/setup_user_network.xml deleted file mode 100644 index b60d6ad51daf0f3d9d6a6e1956848f64d805a676..0000000000000000000000000000000000000000 --- a/app/src/main/res/layout/setup_user_network.xml +++ /dev/null @@ -1,107 +0,0 @@ -<!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" - xmlns:app="http://schemas.android.com/apk/res-auto" - xmlns:tools="http://schemas.android.com/tools" - android:layout_width="match_parent" - android:layout_height="match_parent" - android:orientation="vertical" - android:padding="32dp"> - - <de.kuschku.ui.spinner.MaterialSpinnerLayout - style="@style/Widget.CustomSpinnerLayout" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:hint="@string/settings_network_title"> - - <androidx.appcompat.widget.AppCompatSpinner - android:id="@+id/network" - style="@style/Widget.MaterialSpinner" - android:layout_width="match_parent" - android:layout_height="wrap_content" - tools:listitem="@layout/widget_spinner_item_material" /> - </de.kuschku.ui.spinner.MaterialSpinnerLayout> - - <LinearLayout - android:id="@+id/network_group" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:orientation="vertical"> - - <com.google.android.material.textfield.TextInputLayout - android:id="@+id/nameWrapper" - style="@style/Widget.CustomTextInput" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:hint="@string/settings_network_network_name" - tools:ignore="LabelFor"> - - <com.google.android.material.textfield.TextInputEditText - android:id="@+id/name" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:inputType="textUri|textNoSuggestions" - app:errorEnabled="true" /> - </com.google.android.material.textfield.TextInputLayout> - - <com.google.android.material.textfield.TextInputLayout - android:id="@+id/hostWrapper" - style="@style/Widget.CustomTextInput" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:hint="@string/settings_networkserver_host" - tools:ignore="LabelFor"> - - <com.google.android.material.textfield.TextInputEditText - android:id="@+id/host" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:inputType="textUri|textNoSuggestions" - app:errorEnabled="true" /> - </com.google.android.material.textfield.TextInputLayout> - - <com.google.android.material.textfield.TextInputLayout - android:id="@+id/portWrapper" - style="@style/Widget.CustomTextInput" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:hint="@string/settings_networkserver_port" - app:passwordToggleEnabled="true" - tools:ignore="LabelFor"> - - <com.google.android.material.textfield.TextInputEditText - android:id="@+id/port" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:inputType="number" - android:text="6667" - app:errorEnabled="true" - tools:ignore="HardcodedText" /> - </com.google.android.material.textfield.TextInputLayout> - - <androidx.appcompat.widget.SwitchCompat - android:id="@+id/ssl_enabled" - style="@style/Widget.CoreSettings.PrimaryItemSwitch" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:text="@string/settings_networkserver_ssl_enabled" /> - </LinearLayout> - -</LinearLayout> diff --git a/app/src/main/res/layout/widget_advertisement_support_patreon.xml b/app/src/main/res/layout/widget_advertisement_support_patreon.xml deleted file mode 100644 index e952973df028b505c266854e3cd03819c2666076..0000000000000000000000000000000000000000 --- a/app/src/main/res/layout/widget_advertisement_support_patreon.xml +++ /dev/null @@ -1,26 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<de.kuschku.quasseldroid.util.ui.view.BannerView xmlns:android="http://schemas.android.com/apk/res/android" - xmlns:app="http://schemas.android.com/apk/res-auto" - android:layout_width="match_parent" - android:layout_height="wrap_content" - app:buttonText="@string/advertisement_support_button" - app:icon="@drawable/ic_splash" - app:text="@string/advertisement_support_patreon" /> diff --git a/app/src/main/res/layout/widget_alias.xml b/app/src/main/res/layout/widget_alias.xml deleted file mode 100644 index 7b501116e8278f1da7c0b79126feb2d40d1f6419..0000000000000000000000000000000000000000 --- a/app/src/main/res/layout/widget_alias.xml +++ /dev/null @@ -1,52 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" - xmlns:tools="http://schemas.android.com/tools" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:background="?attr/backgroundMenuItem" - android:minHeight="48dp" - android:orientation="vertical" - android:paddingLeft="16dp" - android:paddingTop="8dp" - android:paddingRight="16dp" - android:paddingBottom="8dp"> - - <TextView - android:id="@+id/alias" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_gravity="center_vertical|start" - android:fontFamily="sans-serif-medium" - android:singleLine="true" - android:textColor="?attr/colorTextPrimary" - android:textSize="13sp" - tools:text="#quasseldroid" /> - - <TextView - android:id="@+id/expansion" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_gravity="center_vertical|start" - android:singleLine="true" - android:textColor="?attr/colorTextSecondary" - android:textSize="12sp" - tools:text="Quasseldroid is an Android client for #quassel ♥ justJanne's much improved version: https://dl.kuschku.de/releases/quasseldroid/ ♥ http://github.com/sandsmark/Quasseldroid ♥ Quasseldroid on play https://market.android.com/details?id=com.iskrembilen.quasseldroid ♥ Sign up for beta: https://plus.google.com/communities/104094956084217666662" /> -</LinearLayout> diff --git a/app/src/main/res/layout/widget_archive_placeholder.xml b/app/src/main/res/layout/widget_archive_placeholder.xml deleted file mode 100644 index 23bb9cea73f4b820362a8cfd419508098eda6f24..0000000000000000000000000000000000000000 --- a/app/src/main/res/layout/widget_archive_placeholder.xml +++ /dev/null @@ -1,27 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<TextView xmlns:android="http://schemas.android.com/apk/res/android" - xmlns:tools="http://schemas.android.com/tools" - android:id="@+id/content" - style="@style/Widget.CoreSettings.TextView" - android:paddingStart="72dp" - android:paddingEnd="16dp" - android:textStyle="italic" - tools:text="@string/label_temporarily_archived_empty" /> diff --git a/app/src/main/res/layout/widget_banner.xml b/app/src/main/res/layout/widget_banner.xml deleted file mode 100644 index 10321649e68367a217724d3e85a3950a5b9cbeee..0000000000000000000000000000000000000000 --- a/app/src/main/res/layout/widget_banner.xml +++ /dev/null @@ -1,93 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" - xmlns:app="http://schemas.android.com/apk/res-auto" - xmlns:tools="http://schemas.android.com/tools" - android:id="@android:id/content" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:baselineAligned="false" - android:clipToPadding="false" - android:focusable="true" - android:orientation="vertical" - android:paddingStart="?android:attr/listPreferredItemPaddingLeft" - android:paddingEnd="?android:attr/listPreferredItemPaddingRight" - android:theme="?attr/actionBarTheme"> - - <LinearLayout - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:layout_marginStart="-4dp" - android:baselineAligned="false" - android:gravity="center_vertical" - android:minHeight="?android:attr/listPreferredItemHeightSmall" - android:orientation="horizontal"> - - <FrameLayout - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:gravity="start|center_vertical" - android:minWidth="60dp" - android:orientation="horizontal" - android:paddingStart="0dp" - android:paddingTop="4dp" - android:paddingEnd="12dp" - android:paddingBottom="4dp"> - - <androidx.appcompat.widget.AppCompatImageView - android:id="@+id/icon" - android:layout_width="32dp" - android:layout_height="32dp" - app:tint="?android:textColorPrimary" - tools:srcCompat="@drawable/ic_alert" /> - </FrameLayout> - - <LinearLayout - android:layout_width="0dip" - android:layout_height="wrap_content" - android:layout_weight="1" - android:orientation="vertical" - android:paddingTop="16dp" - android:paddingBottom="16dp"> - - <TextView - android:id="@+id/text" - style="@style/Widget.RtlConformTextView" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:maxLines="10" - android:textAppearance="?android:attr/textAppearanceSmall" - android:textColor="?android:textColorPrimary" - tools:text="Your core is missing features that are required for Quasseldroid to work correctly." /> - </LinearLayout> - - </LinearLayout> - - - <TextView - android:id="@+id/button" - style="@style/Widget.Button.Borderless.Colored" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_gravity="end" - android:clickable="false" - android:textColor="?android:textColorPrimary" - tools:text="Details" /> -</LinearLayout> diff --git a/app/src/main/res/layout/widget_buffer.xml b/app/src/main/res/layout/widget_buffer.xml deleted file mode 100644 index 63d68f73a943ac26ef3178f04d67d6b0d18202a4..0000000000000000000000000000000000000000 --- a/app/src/main/res/layout/widget_buffer.xml +++ /dev/null @@ -1,87 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" - xmlns:app="http://schemas.android.com/apk/res-auto" - xmlns:tools="http://schemas.android.com/tools" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:background="?attr/backgroundMenuItem" - android:minHeight="?listPreferredItemHeightSmall" - android:orientation="horizontal" - android:paddingLeft="16dp" - android:paddingTop="4dp" - android:paddingRight="16dp" - android:paddingBottom="4dp" - android:textAppearance="?android:attr/textAppearanceListItemSmall"> - - <androidx.appcompat.widget.AppCompatImageView - android:id="@+id/status" - android:layout_width="@dimen/avatar_size_buffer" - android:layout_height="@dimen/avatar_size_buffer" - android:layout_gravity="center_vertical" - android:layout_marginEnd="16dp" - android:contentDescription="@string/label_avatar" - tools:src="@tools:sample/avatars" /> - - <LinearLayout - android:layout_width="0dip" - android:layout_height="wrap_content" - android:layout_gravity="center_vertical" - android:layout_weight="1" - android:orientation="vertical"> - - <TextView - android:id="@+id/name" - style="@style/Widget.RtlConformTextView" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_gravity="center_vertical|start" - android:ellipsize="marquee" - android:fontFamily="sans-serif-medium" - android:singleLine="true" - android:textColor="?attr/colorTextPrimary" - android:textSize="13sp" - tools:text="@sample/messages.json/data/sender" /> - - <TextView - android:id="@+id/description" - style="@style/Widget.RtlConformTextView" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:ellipsize="marquee" - android:singleLine="true" - android:textColor="?attr/colorTextSecondary" - android:textSize="12sp" - tools:text="@sample/messages.json/data/sender" - tools:visibility="visible" /> - </LinearLayout> - - <androidx.appcompat.widget.AppCompatImageView - android:id="@+id/handle" - android:layout_width="24dp" - android:layout_height="24dp" - android:layout_gravity="center_vertical" - android:layout_marginStart="16dp" - android:contentDescription="@string/label_reorder" - android:visibility="gone" - app:srcCompat="@drawable/ic_reorder" - app:tint="?colorTextSecondary" - tools:visibility="visible" /> -</LinearLayout> diff --git a/app/src/main/res/layout/widget_buffer_away.xml b/app/src/main/res/layout/widget_buffer_away.xml deleted file mode 100644 index 876d72f5f954c791a7b63a94ac54c38960f4fb3f..0000000000000000000000000000000000000000 --- a/app/src/main/res/layout/widget_buffer_away.xml +++ /dev/null @@ -1,96 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" - xmlns:app="http://schemas.android.com/apk/res-auto" - xmlns:tools="http://schemas.android.com/tools" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:background="?attr/backgroundMenuItem" - android:minHeight="?listPreferredItemHeightSmall" - android:orientation="horizontal" - android:paddingLeft="16dp" - android:paddingTop="4dp" - android:paddingRight="16dp" - android:paddingBottom="4dp" - android:textAppearance="?android:attr/textAppearanceListItemSmall"> - - <androidx.appcompat.widget.AppCompatImageView - android:id="@+id/status" - android:layout_width="@dimen/avatar_size_buffer" - android:layout_height="@dimen/avatar_size_buffer" - android:layout_gravity="center_vertical" - android:layout_marginEnd="16dp" - android:contentDescription="@string/label_avatar" - tools:src="@tools:sample/avatars" /> - - <LinearLayout - android:layout_width="0dip" - android:layout_height="wrap_content" - android:layout_gravity="center_vertical" - android:layout_weight="1" - android:orientation="vertical"> - - <TextView - android:id="@+id/name" - style="@style/Widget.RtlConformTextView" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_gravity="center_vertical|start" - android:ellipsize="marquee" - android:fontFamily="sans-serif-medium" - android:singleLine="true" - android:textColor="?attr/colorTextSecondary" - android:textSize="13sp" - android:textStyle="italic" - tools:text="@sample/messages.json/data/sender" /> - - <TextView - android:id="@+id/description" - style="@style/Widget.RtlConformTextView" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:ellipsize="marquee" - android:singleLine="true" - android:textColor="?attr/colorTextSecondary" - android:textSize="12sp" - android:textStyle="italic" - tools:text="@sample/messages.json/data/sender" - tools:visibility="visible" /> - </LinearLayout> - - <androidx.appcompat.widget.AppCompatImageView - android:layout_width="24dp" - android:layout_height="24dp" - android:layout_gravity="center_vertical" - android:layout_marginStart="16dp" - android:contentDescription="@string/label_user_away" - app:srcCompat="@drawable/ic_clock" - app:tint="?colorTextSecondary" /> - - <androidx.appcompat.widget.AppCompatImageView - android:id="@+id/handle" - android:layout_width="24dp" - android:layout_height="24dp" - android:layout_gravity="center_vertical" - android:layout_marginStart="16dp" - android:contentDescription="@string/label_reorder" - app:srcCompat="@drawable/ic_reorder" - app:tint="?colorTextSecondary" /> -</LinearLayout> diff --git a/app/src/main/res/layout/widget_channel_search.xml b/app/src/main/res/layout/widget_channel_search.xml deleted file mode 100644 index 6030d6eb9f11a43927c4749f41f58d250796bf12..0000000000000000000000000000000000000000 --- a/app/src/main/res/layout/widget_channel_search.xml +++ /dev/null @@ -1,95 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" - xmlns:tools="http://schemas.android.com/tools" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:background="?attr/backgroundMenuItem" - android:minHeight="?listPreferredItemHeightSmall" - android:orientation="horizontal" - android:paddingLeft="16dp" - android:paddingTop="4dp" - android:paddingRight="16dp" - android:paddingBottom="4dp" - android:textAppearance="?android:attr/textAppearanceListItemSmall"> - - <ImageView - android:id="@+id/status" - android:layout_width="@dimen/avatar_size_buffer" - android:layout_height="@dimen/avatar_size_buffer" - android:layout_gravity="center_vertical" - android:layout_marginEnd="16dp" - android:contentDescription="@string/label_avatar" - tools:src="@tools:sample/avatars" /> - - <LinearLayout - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:layout_gravity="center_vertical" - android:orientation="vertical"> - - <LinearLayout - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:orientation="horizontal"> - - - <TextView - android:id="@+id/name" - style="@style/Widget.RtlConformTextView" - android:layout_width="0dip" - android:layout_height="wrap_content" - android:layout_gravity="center_vertical|start" - android:layout_weight="1" - android:ellipsize="marquee" - android:fontFamily="sans-serif-medium" - android:singleLine="true" - android:textColor="?attr/colorTextPrimary" - android:textSize="13sp" - tools:text="@sample/channels.json/data/name" /> - - <TextView - android:id="@+id/users" - style="@style/Widget.RtlConformTextView" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_marginStart="8dp" - android:ellipsize="marquee" - android:singleLine="true" - android:textColor="?attr/colorTextSecondary" - android:textSize="12sp" - tools:text="@sample/channels.json/data/users" - tools:visibility="visible" /> - - </LinearLayout> - - <TextView - android:id="@+id/topic" - style="@style/Widget.RtlConformTextView" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:ellipsize="marquee" - android:singleLine="true" - android:textColor="?attr/colorTextSecondary" - android:textSize="12sp" - tools:text="@sample/channels.json/data/topic" - tools:visibility="visible" /> - </LinearLayout> -</LinearLayout> diff --git a/app/src/main/res/layout/widget_chatmessage_action.xml b/app/src/main/res/layout/widget_chatmessage_action.xml deleted file mode 100644 index 72a3fad35a03005eff90b68d35e39f8930c64c51..0000000000000000000000000000000000000000 --- a/app/src/main/res/layout/widget_chatmessage_action.xml +++ /dev/null @@ -1,110 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" - xmlns:tools="http://schemas.android.com/tools" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:orientation="vertical"> - - <include layout="@layout/widget_chatmessage_daychange" /> - - <LinearLayout - android:id="@+id/message_container" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:background="?attr/backgroundMenuItem" - android:orientation="horizontal" - android:paddingStart="@dimen/message_horizontal" - android:paddingLeft="@dimen/message_horizontal" - android:paddingTop="@dimen/message_vertical" - android:paddingEnd="@dimen/message_horizontal" - android:paddingRight="@dimen/message_horizontal" - android:paddingBottom="@dimen/message_vertical" - android:textAppearance="?android:attr/textAppearanceListItemSmall"> - - <TextView - android:id="@+id/time_left" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_gravity="top" - android:layout_marginEnd="@dimen/message_horizontal" - android:textColor="?attr/colorForegroundSecondary" - android:typeface="monospace" - tools:text="@sample/messages.json/data/time" - tools:visibility="gone" /> - - <FrameLayout - android:id="@+id/avatar_container" - android:layout_width="@dimen/avatar_size" - android:layout_height="@dimen/avatar_size" - android:layout_marginEnd="@dimen/message_horizontal" - android:visibility="gone" - tools:ignore="UselessParent" - tools:visibility="visible"> - - <ImageView - android:id="@+id/avatar" - android:layout_width="21sp" - android:layout_height="21sp" - android:layout_gravity="end" - android:contentDescription="@string/label_avatar" - tools:src="@tools:sample/avatars" /> - </FrameLayout> - - <LinearLayout - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:layout_gravity="center_vertical|fill_horizontal" - android:orientation="horizontal"> - - <LinearLayout - android:layout_width="0dip" - android:layout_height="wrap_content" - android:layout_weight="1" - android:orientation="vertical"> - - <de.kuschku.quasseldroid.util.ui.view.RipplePassthroughTextView - android:id="@+id/combined" - style="@style/Widget.RtlConformTextView" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:textColor="?attr/colorForegroundAction" - android:textStyle="italic" - tools:text="@sample/messages.json/data/message" /> - - </LinearLayout> - - <TextView - android:id="@+id/time_right" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_gravity="top" - android:layout_marginStart="@dimen/message_horizontal" - android:textColor="?attr/colorForegroundSecondary" - android:textStyle="italic" - android:visibility="gone" - tools:ignore="SmallSp" - tools:text="@sample/messages.json/data/time" - tools:textSize="11.9sp" - tools:visibility="visible" /> - </LinearLayout> - </LinearLayout> - -</LinearLayout> diff --git a/app/src/main/res/layout/widget_chatmessage_daychange.xml b/app/src/main/res/layout/widget_chatmessage_daychange.xml deleted file mode 100644 index 4f40272969f0ef0e7333686bd4c42853108518f3..0000000000000000000000000000000000000000 --- a/app/src/main/res/layout/widget_chatmessage_daychange.xml +++ /dev/null @@ -1,69 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" - xmlns:tools="http://schemas.android.com/tools" - android:id="@+id/daychange_container" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:background="?attr/backgroundMenuItem" - android:orientation="vertical" - android:textAppearance="?android:attr/textAppearanceListItemSmall"> - - <LinearLayout - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:orientation="horizontal" - android:paddingStart="@dimen/message_horizontal" - android:paddingLeft="@dimen/message_horizontal" - android:paddingTop="@dimen/message_vertical_daychange" - android:paddingEnd="@dimen/message_horizontal" - android:paddingRight="@dimen/message_horizontal" - android:paddingBottom="@dimen/message_vertical_daychange"> - - <View - android:layout_width="0dip" - android:layout_height="1dp" - android:layout_gravity="center_vertical" - android:layout_weight="1" - android:background="?colorDivider" /> - - <de.kuschku.quasseldroid.util.ui.view.RipplePassthroughTextView - android:id="@+id/daychange" - style="@style/Widget.RtlConformTextView" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - - android:layout_marginStart="@dimen/message_horizontal" - android:layout_marginLeft="@dimen/message_horizontal" - android:layout_marginEnd="@dimen/message_horizontal" - android:layout_marginRight="@dimen/message_horizontal" - android:gravity="center" - android:textColor="?attr/colorForeground" - android:textStyle="bold" - tools:text="27.03.2018" /> - - <View - android:layout_width="0dip" - android:layout_height="1dp" - android:layout_gravity="center_vertical" - android:layout_weight="1" - android:background="?colorDivider" /> - </LinearLayout> -</LinearLayout> diff --git a/app/src/main/res/layout/widget_chatmessage_error.xml b/app/src/main/res/layout/widget_chatmessage_error.xml deleted file mode 100644 index 78f13ddf1f83d2a21a839900a3cdf825b9876f55..0000000000000000000000000000000000000000 --- a/app/src/main/res/layout/widget_chatmessage_error.xml +++ /dev/null @@ -1,83 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" - xmlns:tools="http://schemas.android.com/tools" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:orientation="vertical" - tools:showIn="@layout/chat_messages"> - - <include layout="@layout/widget_chatmessage_daychange" /> - - <LinearLayout - android:id="@+id/message_container" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:background="?attr/backgroundMenuItem" - android:orientation="horizontal" - android:paddingStart="@dimen/message_horizontal" - android:paddingLeft="@dimen/message_horizontal" - android:paddingTop="@dimen/message_vertical" - android:paddingEnd="@dimen/message_horizontal" - android:paddingRight="@dimen/message_horizontal" - android:paddingBottom="@dimen/message_vertical" - android:textAppearance="?android:attr/textAppearanceListItemSmall"> - - <TextView - android:id="@+id/time_left" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_gravity="top" - android:layout_marginEnd="@dimen/message_horizontal" - android:textColor="?attr/colorForegroundSecondary" - android:typeface="monospace" - tools:text="@sample/messages.json/data/time" /> - - <Space - android:id="@+id/avatar_placeholder" - android:layout_width="@dimen/avatar_size" - android:layout_height="match_parent" - android:layout_marginEnd="@dimen/message_horizontal" - android:visibility="gone" /> - - <de.kuschku.quasseldroid.util.ui.view.RipplePassthroughTextView - android:id="@+id/combined" - style="@style/Widget.RtlConformTextView" - android:layout_width="0dip" - android:layout_height="wrap_content" - android:layout_weight="1" - android:textColor="?attr/colorForegroundError" - tools:text="@sample/messages.json/data/message" /> - - <TextView - android:id="@+id/time_right" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_gravity="top" - android:layout_marginStart="@dimen/message_horizontal" - android:textColor="?attr/colorForegroundSecondary" - android:textStyle="italic" - android:visibility="gone" - tools:ignore="SmallSp" - tools:text="@sample/messages.json/data/time" - tools:textSize="11.9sp" - tools:visibility="visible" /> - </LinearLayout> -</LinearLayout> diff --git a/app/src/main/res/layout/widget_chatmessage_info.xml b/app/src/main/res/layout/widget_chatmessage_info.xml deleted file mode 100644 index 967f7a759eb9d42375d39a51012b8d2d0f3f1020..0000000000000000000000000000000000000000 --- a/app/src/main/res/layout/widget_chatmessage_info.xml +++ /dev/null @@ -1,84 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" - xmlns:tools="http://schemas.android.com/tools" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:orientation="vertical" - tools:showIn="@layout/chat_messages"> - - <include layout="@layout/widget_chatmessage_daychange" /> - - <LinearLayout - android:id="@+id/message_container" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:background="?attr/backgroundMenuItem" - android:orientation="horizontal" - android:paddingStart="@dimen/message_horizontal" - android:paddingLeft="@dimen/message_horizontal" - android:paddingTop="@dimen/message_vertical" - android:paddingEnd="@dimen/message_horizontal" - android:paddingRight="@dimen/message_horizontal" - android:paddingBottom="@dimen/message_vertical" - android:textAppearance="?android:attr/textAppearanceListItemSmall"> - - <TextView - android:id="@+id/time_left" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_gravity="top" - android:layout_marginEnd="@dimen/message_horizontal" - android:textColor="?attr/colorForegroundSecondary" - android:typeface="monospace" - tools:text="@sample/messages.json/data/time" /> - - <Space - android:id="@+id/avatar_placeholder" - android:layout_width="@dimen/avatar_size" - android:layout_height="match_parent" - android:layout_marginEnd="@dimen/message_horizontal" - android:visibility="gone" /> - - <de.kuschku.quasseldroid.util.ui.view.RipplePassthroughTextView - android:id="@+id/combined" - style="@style/Widget.RtlConformTextView" - android:layout_width="0dip" - android:layout_height="wrap_content" - android:layout_weight="1" - android:textColor="?attr/colorForegroundSecondary" - android:textStyle="italic" - tools:text="@sample/messages.json/data/message" /> - - <TextView - android:id="@+id/time_right" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_gravity="top" - android:layout_marginStart="@dimen/message_horizontal" - android:textColor="?attr/colorForegroundSecondary" - android:textStyle="italic" - android:visibility="gone" - tools:ignore="SmallSp" - tools:text="@sample/messages.json/data/time" - tools:textSize="11.9sp" - tools:visibility="visible" /> - </LinearLayout> -</LinearLayout> diff --git a/app/src/main/res/layout/widget_chatmessage_notice.xml b/app/src/main/res/layout/widget_chatmessage_notice.xml deleted file mode 100644 index 3a442765786b02324c3a94de4a40592fdcdf807a..0000000000000000000000000000000000000000 --- a/app/src/main/res/layout/widget_chatmessage_notice.xml +++ /dev/null @@ -1,83 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" - xmlns:tools="http://schemas.android.com/tools" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:orientation="vertical" - tools:showIn="@layout/chat_messages"> - - <include layout="@layout/widget_chatmessage_daychange" /> - - <LinearLayout - android:id="@+id/message_container" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:background="?attr/backgroundMenuItem" - android:orientation="horizontal" - android:paddingStart="@dimen/message_horizontal" - android:paddingLeft="@dimen/message_horizontal" - android:paddingTop="@dimen/message_vertical" - android:paddingEnd="@dimen/message_horizontal" - android:paddingRight="@dimen/message_horizontal" - android:paddingBottom="@dimen/message_vertical" - android:textAppearance="?android:attr/textAppearanceListItemSmall"> - - <TextView - android:id="@+id/time_left" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_gravity="top" - android:layout_marginEnd="@dimen/message_horizontal" - android:textColor="?attr/colorForegroundSecondary" - android:typeface="monospace" - tools:text="@sample/messages.json/data/time" /> - - <Space - android:id="@+id/avatar_placeholder" - android:layout_width="@dimen/avatar_size" - android:layout_height="match_parent" - android:layout_marginEnd="@dimen/message_horizontal" - android:visibility="gone" /> - - <de.kuschku.quasseldroid.util.ui.view.RipplePassthroughTextView - android:id="@+id/combined" - style="@style/Widget.RtlConformTextView" - android:layout_width="0dip" - android:layout_height="wrap_content" - android:layout_weight="1" - android:textColor="?attr/colorForegroundNotice" - tools:text="@sample/messages.json/data/message" /> - - <TextView - android:id="@+id/time_right" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_gravity="top" - android:layout_marginStart="@dimen/message_horizontal" - android:textColor="?attr/colorForegroundSecondary" - android:textStyle="italic" - android:visibility="gone" - tools:ignore="SmallSp" - tools:text="@sample/messages.json/data/time" - tools:textSize="11.9sp" - tools:visibility="visible" /> - </LinearLayout> -</LinearLayout> diff --git a/app/src/main/res/layout/widget_chatmessage_placeholder.xml b/app/src/main/res/layout/widget_chatmessage_placeholder.xml deleted file mode 100644 index af9932c587aefe771ddf81a59db605560aa6b370..0000000000000000000000000000000000000000 --- a/app/src/main/res/layout/widget_chatmessage_placeholder.xml +++ /dev/null @@ -1,22 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<View xmlns:android="http://schemas.android.com/apk/res/android" - android:layout_width="match_parent" - android:layout_height="48dp" /> diff --git a/app/src/main/res/layout/widget_chatmessage_plain.xml b/app/src/main/res/layout/widget_chatmessage_plain.xml deleted file mode 100644 index 9db3f272c372d389a5a0131e8e06b9f824e47e09..0000000000000000000000000000000000000000 --- a/app/src/main/res/layout/widget_chatmessage_plain.xml +++ /dev/null @@ -1,159 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" - xmlns:tools="http://schemas.android.com/tools" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:orientation="vertical" - tools:showIn="@layout/chat_messages"> - - <include layout="@layout/widget_chatmessage_daychange" /> - - <LinearLayout - android:id="@+id/message_container" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:background="?attr/backgroundMenuItem" - android:orientation="horizontal" - android:paddingLeft="@dimen/message_horizontal" - android:paddingTop="@dimen/message_vertical" - android:paddingRight="@dimen/message_horizontal" - android:paddingBottom="@dimen/message_vertical" - android:textAppearance="?android:attr/textAppearanceListItemSmall"> - - <TextView - android:id="@+id/time_left" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_gravity="top" - android:layout_marginEnd="@dimen/message_horizontal" - android:textColor="?attr/colorForegroundSecondary" - android:typeface="monospace" - tools:text="@sample/messages.json/data/time" - tools:visibility="gone" /> - - <FrameLayout - android:id="@+id/avatar_container" - android:layout_width="@dimen/avatar_size" - android:layout_height="@dimen/avatar_size" - android:layout_marginEnd="@dimen/message_horizontal" - android:visibility="gone" - tools:visibility="visible"> - - <ImageView - android:id="@+id/avatar" - android:layout_width="match_parent" - android:layout_height="match_parent" - android:contentDescription="@string/label_avatar" - tools:src="@tools:sample/avatars" /> - </FrameLayout> - - <LinearLayout - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:layout_gravity="fill_vertical" - android:orientation="vertical"> - - <LinearLayout - android:layout_width="match_parent" - android:layout_height="wrap_content"> - - <TextView - android:id="@+id/name" - style="@style/Widget.RtlConformTextView" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_gravity="center_vertical" - android:ellipsize="marquee" - android:singleLine="true" - android:textColor="?attr/colorForegroundSecondary" - android:visibility="gone" - tools:text="@sample/messages.json/data/sender" - tools:visibility="visible" /> - - <Space - android:layout_width="4dp" - android:layout_height="0dip" /> - - <TextView - android:id="@+id/realname" - style="@style/Widget.RtlConformTextView" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_gravity="center_vertical" - android:ellipsize="marquee" - android:singleLine="true" - android:textColor="?attr/colorForegroundSecondary" - android:visibility="gone" - tools:text="@sample/messages.json/data/sender" - tools:visibility="visible" /> - </LinearLayout> - - <LinearLayout - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:layout_gravity="center_vertical|fill_horizontal" - android:orientation="horizontal"> - - <LinearLayout - android:layout_width="0dip" - android:layout_height="wrap_content" - android:layout_weight="1" - android:orientation="vertical"> - - <de.kuschku.quasseldroid.util.ui.view.RipplePassthroughTextView - android:id="@+id/content" - style="@style/Widget.RtlConformTextView" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:textColor="?attr/colorForeground" - android:visibility="gone" - tools:text="@sample/messages.json/data/content" - tools:visibility="visible" /> - - <de.kuschku.quasseldroid.util.ui.view.RipplePassthroughTextView - android:id="@+id/combined" - style="@style/Widget.RtlConformTextView" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:textColor="?attr/colorForeground" - tools:text="@sample/messages.json/data/message" - tools:visibility="gone" /> - - </LinearLayout> - - <TextView - android:id="@+id/time_right" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_gravity="top" - android:layout_marginStart="@dimen/message_horizontal" - android:textColor="?attr/colorForegroundSecondary" - android:textStyle="italic" - android:visibility="gone" - tools:ignore="SmallSp" - tools:text="@sample/messages.json/data/time" - tools:textSize="11.9sp" - tools:visibility="visible" /> - </LinearLayout> - </LinearLayout> - </LinearLayout> - -</LinearLayout> diff --git a/app/src/main/res/layout/widget_chatmessage_server.xml b/app/src/main/res/layout/widget_chatmessage_server.xml deleted file mode 100644 index bd618c9ef642a252b019aecc5ff4b4bd35ec83cc..0000000000000000000000000000000000000000 --- a/app/src/main/res/layout/widget_chatmessage_server.xml +++ /dev/null @@ -1,83 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" - xmlns:tools="http://schemas.android.com/tools" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:orientation="vertical" - tools:showIn="@layout/chat_messages"> - - <include layout="@layout/widget_chatmessage_daychange" /> - - <LinearLayout - android:id="@+id/message_container" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:background="?attr/backgroundMenuItem" - android:orientation="horizontal" - android:paddingStart="@dimen/message_horizontal" - android:paddingLeft="@dimen/message_horizontal" - android:paddingTop="@dimen/message_vertical" - android:paddingEnd="@dimen/message_horizontal" - android:paddingRight="@dimen/message_horizontal" - android:paddingBottom="@dimen/message_vertical" - android:textAppearance="?android:attr/textAppearanceListItemSmall"> - - <TextView - android:id="@+id/time_left" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_gravity="top" - android:layout_marginEnd="@dimen/message_horizontal" - android:textColor="?attr/colorForegroundSecondary" - android:typeface="monospace" - tools:text="@sample/messages.json/data/time" /> - - <Space - android:id="@+id/avatar_placeholder" - android:layout_width="@dimen/avatar_size" - android:layout_height="match_parent" - android:layout_marginEnd="@dimen/message_horizontal" - android:visibility="gone" /> - - <de.kuschku.quasseldroid.util.ui.view.RipplePassthroughTextView - android:id="@+id/combined" - style="@style/Widget.RtlConformTextView" - android:layout_width="0dip" - android:layout_height="wrap_content" - android:layout_weight="1" - android:textColor="?attr/colorForegroundSecondary" - tools:text="@sample/messages.json/data/message" /> - - <TextView - android:id="@+id/time_right" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_gravity="top" - android:layout_marginStart="@dimen/message_horizontal" - android:textColor="?attr/colorForegroundSecondary" - android:textStyle="italic" - android:visibility="gone" - tools:ignore="SmallSp" - tools:text="@sample/messages.json/data/time" - tools:textSize="11.9sp" - tools:visibility="visible" /> - </LinearLayout> -</LinearLayout> diff --git a/app/src/main/res/layout/widget_client.xml b/app/src/main/res/layout/widget_client.xml deleted file mode 100644 index f28eda5a5faac1bc5aa20940caeec6637bc8bc8c..0000000000000000000000000000000000000000 --- a/app/src/main/res/layout/widget_client.xml +++ /dev/null @@ -1,71 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" - xmlns:app="http://schemas.android.com/apk/res-auto" - xmlns:tools="http://schemas.android.com/tools" - style="@style/Widget.Info.Item" - android:orientation="horizontal"> - - <LinearLayout - android:layout_width="0dip" - android:layout_height="wrap_content" - android:layout_weight="1" - android:orientation="vertical"> - - <TextView - android:id="@+id/ip" - style="@style/Widget.Info.Item.Content" - android:textIsSelectable="true" - tools:text="51.15.1.223" /> - - <TextView - android:id="@+id/version" - style="@style/Widget.Info.Item.Description" - android:textIsSelectable="true" - tools:text="Quasseldroid v0.4.0-218-g0e6e562c" /> - - <TextView - android:id="@+id/uptime" - style="@style/Widget.Info.Item.Description" - android:textIsSelectable="true" - tools:text="Connected since 08.06.18 01:39" /> - - <TextView - android:id="@+id/location" - style="@style/Widget.Info.Item.Description" - android:textIsSelectable="true" - tools:text="Kiel, Germany" /> - - <com.google.android.material.button.MaterialButton - android:id="@+id/disconnect" - style="@style/Widget.Button.Borderless.Colored" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:text="@string/label_disconnect" /> - </LinearLayout> - - <androidx.appcompat.widget.AppCompatImageView - android:id="@+id/secure_icon" - android:layout_width="24dp" - android:layout_height="24dp" - android:layout_gravity="top" - android:layout_marginStart="16dp" - app:srcCompat="@drawable/ic_lock" /> -</LinearLayout> diff --git a/app/src/main/res/layout/widget_contributor.xml b/app/src/main/res/layout/widget_contributor.xml deleted file mode 100644 index 8e21bca26ba213db44491fa20e97fa88f26b3575..0000000000000000000000000000000000000000 --- a/app/src/main/res/layout/widget_contributor.xml +++ /dev/null @@ -1,65 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" - xmlns:tools="http://schemas.android.com/tools" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:background="?android:attr/selectableItemBackground" - android:gravity="center_vertical" - android:minHeight="?android:attr/listPreferredItemHeightSmall" - android:paddingStart="?android:attr/listPreferredItemPaddingLeft" - android:paddingEnd="?android:attr/listPreferredItemPaddingRight" - tools:showIn="@layout/preferences_about"> - - <LinearLayout - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:orientation="vertical" - android:paddingTop="16dp" - android:paddingBottom="16dp"> - - <TextView - android:id="@+id/name" - style="@style/Widget.RtlConformTextView" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:textColor="?colorTextPrimary" - android:textSize="16sp" - tools:text="@sample/contributors.json/data/name" /> - - <TextView - android:id="@+id/nickname" - style="@style/Widget.RtlConformTextView" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:textAppearance="?android:attr/textAppearanceSmall" - android:textColor="?colorTextSecondary" - tools:text="@sample/contributors.json/data/nickname" /> - - <TextView - android:id="@+id/description" - style="@style/Widget.RtlConformTextView" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:textAppearance="?android:attr/textAppearanceSmall" - android:textColor="?colorTextSecondary" - tools:text="@sample/contributors.json/data/description" /> - </LinearLayout> -</LinearLayout> diff --git a/app/src/main/res/layout/widget_core_account.xml b/app/src/main/res/layout/widget_core_account.xml deleted file mode 100644 index 5b23e203b054c93a5154ce525aa1303a17908821..0000000000000000000000000000000000000000 --- a/app/src/main/res/layout/widget_core_account.xml +++ /dev/null @@ -1,90 +0,0 @@ -<!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" - xmlns:app="http://schemas.android.com/apk/res-auto" - xmlns:tools="http://schemas.android.com/tools" - android:layout_width="match_parent" - android:layout_height="72dp" - android:background="?attr/selectableItemBackground" - android:clickable="true" - android:focusable="true" - android:focusableInTouchMode="false" - android:orientation="horizontal" - android:paddingLeft="16dp" - android:paddingRight="16dp"> - - <LinearLayout - android:layout_width="48dp" - android:layout_height="match_parent"> - - <androidx.appcompat.widget.AppCompatRadioButton - android:id="@+id/account_select" - android:layout_width="48dp" - android:layout_height="48dp" - android:layout_gravity="center_vertical" - android:background="@null" - android:clickable="false" /> - - </LinearLayout> - - <LinearLayout - android:layout_width="0dip" - android:layout_height="match_parent" - android:layout_margin="8dp" - android:layout_weight="1" - android:gravity="center_vertical|start" - android:orientation="vertical"> - - <TextView - android:id="@+id/account_name" - style="@style/Widget.RtlConformTextView" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:fontFamily="sans-serif-medium" - android:gravity="center_vertical|start" - android:lines="1" - android:singleLine="true" - android:textSize="14sp" - tools:text="Remote" /> - - <TextView - android:id="@+id/account_description" - style="@style/Widget.RtlConformTextView" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:fontFamily="sans-serif" - android:gravity="center_vertical|start" - android:lines="1" - android:singleLine="true" - android:textSize="14sp" - tools:text="testUser on localhost" /> - </LinearLayout> - - <androidx.appcompat.widget.AppCompatImageButton - android:id="@+id/account_edit" - style="?attr/buttonStyleSmall" - android:layout_width="48dp" - android:layout_height="48dp" - android:layout_gravity="center_vertical" - android:background="?attr/selectableItemBackgroundBorderless" - android:contentDescription="@string/label_edit_core" - android:tint="#757575" - app:srcCompat="@drawable/ic_pencil" /> -</LinearLayout> diff --git a/app/src/main/res/layout/widget_core_account_add.xml b/app/src/main/res/layout/widget_core_account_add.xml deleted file mode 100644 index 4762aab26dd98c78899fe5872b9654df1417d5fa..0000000000000000000000000000000000000000 --- a/app/src/main/res/layout/widget_core_account_add.xml +++ /dev/null @@ -1,55 +0,0 @@ -<!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" - xmlns:app="http://schemas.android.com/apk/res-auto" - xmlns:tools="http://schemas.android.com/tools" - android:layout_width="match_parent" - android:layout_height="72dp" - android:background="?attr/selectableItemBackground" - android:clickable="true" - android:focusable="true" - android:focusableInTouchMode="false" - android:orientation="horizontal" - android:paddingLeft="16dp" - android:paddingRight="16dp"> - - <ImageView - android:layout_width="32dp" - android:layout_height="32dp" - android:layout_gravity="center_vertical" - android:layout_marginEnd="16dp" - android:tint="#727272" - app:srcCompat="@drawable/ic_add" - tools:ignore="ContentDescription" /> - - <TextView - android:id="@+id/account_name" - style="@style/Widget.RtlConformTextView" - android:layout_width="0dip" - android:layout_height="wrap_content" - android:layout_gravity="center_vertical|start" - android:layout_margin="8dp" - android:layout_weight="1" - android:fontFamily="sans-serif-medium" - android:lines="1" - android:singleLine="true" - android:text="@string/label_new_account" - android:textSize="14sp" /> -</LinearLayout> diff --git a/app/src/main/res/layout/widget_core_backend.xml b/app/src/main/res/layout/widget_core_backend.xml deleted file mode 100644 index 93fe7deacbe9adfb5a3de705956b51d9a55459e1..0000000000000000000000000000000000000000 --- a/app/src/main/res/layout/widget_core_backend.xml +++ /dev/null @@ -1,79 +0,0 @@ -<!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" - xmlns:tools="http://schemas.android.com/tools" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:background="?attr/selectableItemBackground" - android:baselineAligned="false" - android:clickable="true" - android:focusable="true" - android:focusableInTouchMode="false" - android:minHeight="72dp" - android:orientation="horizontal" - android:paddingLeft="16dp" - android:paddingRight="16dp"> - - <LinearLayout - android:layout_width="48dp" - android:layout_height="72dp"> - - <androidx.appcompat.widget.AppCompatRadioButton - android:id="@+id/backend_select" - android:layout_width="48dp" - android:layout_height="48dp" - android:layout_gravity="center_vertical" - android:background="@null" - android:clickable="false" /> - - </LinearLayout> - - <LinearLayout - android:layout_width="0dip" - android:layout_height="wrap_content" - android:layout_margin="8dp" - android:layout_weight="1" - android:gravity="center_vertical|start" - android:minHeight="72dp" - android:orientation="vertical"> - - <TextView - android:id="@+id/backend_name" - style="@style/Widget.RtlConformTextView" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:fontFamily="sans-serif-medium" - android:gravity="center_vertical|start" - android:lines="1" - android:singleLine="true" - android:textSize="14sp" - tools:text="Remote" /> - - <TextView - android:id="@+id/backend_description" - style="@style/Widget.RtlConformTextView" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:fontFamily="sans-serif" - android:gravity="center_vertical|start" - android:textSize="14sp" - tools:text="testUser on localhost" /> - </LinearLayout> -</LinearLayout> diff --git a/app/src/main/res/layout/widget_crash.xml b/app/src/main/res/layout/widget_crash.xml deleted file mode 100644 index e6b502158cd2fa235fc834051059d1a3466f820b..0000000000000000000000000000000000000000 --- a/app/src/main/res/layout/widget_crash.xml +++ /dev/null @@ -1,63 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:background="?android:attr/selectableItemBackground" - android:focusable="true" - android:gravity="center_vertical" - android:minHeight="?android:attr/listPreferredItemHeightSmall" - android:paddingStart="?android:attr/listPreferredItemPaddingLeft" - android:paddingEnd="?android:attr/listPreferredItemPaddingRight"> - - <LinearLayout - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:orientation="vertical" - android:paddingTop="16dp" - android:paddingBottom="16dp"> - - <TextView - android:id="@+id/crash_time" - style="@style/Widget.RtlConformTextView" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:ellipsize="marquee" - android:singleLine="true" - android:textColor="?colorTextPrimary" - android:textSize="16sp" /> - - <TextView - android:id="@+id/version_name" - style="@style/Widget.RtlConformTextView" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:textAppearance="?android:attr/textAppearanceSmall" - android:textColor="?colorTextPrimary" /> - - <TextView - android:id="@+id/error" - style="@style/Widget.RtlConformTextView" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:textAppearance="?android:attr/textAppearanceSmall" - android:textColor="?colorTextSecondary" /> - </LinearLayout> -</LinearLayout> diff --git a/app/src/main/res/layout/widget_emoji.xml b/app/src/main/res/layout/widget_emoji.xml deleted file mode 100644 index 8b261e4eb44997ade64014756f0b968f80c87cf5..0000000000000000000000000000000000000000 --- a/app/src/main/res/layout/widget_emoji.xml +++ /dev/null @@ -1,54 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" - xmlns:tools="http://schemas.android.com/tools" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:background="?attr/backgroundMenuItem" - android:minHeight="48dp" - android:paddingLeft="16dp" - android:paddingTop="8dp" - android:paddingRight="16dp" - android:paddingBottom="8dp"> - - <TextView - android:id="@+id/emoji" - android:layout_width="32dp" - android:layout_height="32dp" - android:layout_gravity="center_vertical|start" - android:layout_marginEnd="16dp" - android:fontFamily="sans-serif-medium" - android:gravity="center_vertical|start" - android:singleLine="true" - android:textColor="?attr/colorTextPrimary" - android:textSize="24dp" - tools:ignore="SpUsage" - tools:text="♥" /> - - <TextView - android:id="@+id/shortCode" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_gravity="center_vertical|start" - android:singleLine="true" - android:textColor="?attr/colorTextSecondary" - android:textSize="12sp" - tools:text=":heart:" /> -</LinearLayout> diff --git a/app/src/main/res/layout/widget_formatting.xml b/app/src/main/res/layout/widget_formatting.xml deleted file mode 100644 index 95e5940396d20532de65eaf4545bf94017f9cf2b..0000000000000000000000000000000000000000 --- a/app/src/main/res/layout/widget_formatting.xml +++ /dev/null @@ -1,148 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<HorizontalScrollView xmlns:android="http://schemas.android.com/apk/res/android" - xmlns:app="http://schemas.android.com/apk/res-auto" - android:layout_width="match_parent" - android:layout_height="match_parent"> - - <LinearLayout - android:layout_width="wrap_content" - android:layout_height="match_parent" - android:padding="2dp"> - - <androidx.appcompat.widget.AppCompatImageButton - android:id="@+id/action_format_bold" - style="@style/Widget.Button.Format" - android:contentDescription="@string/label_bold" - app:srcCompat="@drawable/ic_format_bold" - app:tint="?colorControlNormal" /> - - <Space - android:layout_width="2dp" - android:layout_height="match_parent" /> - - <androidx.appcompat.widget.AppCompatImageButton - android:id="@+id/action_format_italic" - style="@style/Widget.Button.Format" - android:contentDescription="@string/label_italic" - app:srcCompat="@drawable/ic_format_italic" - app:tint="?colorControlNormal" /> - - <Space - android:layout_width="2dp" - android:layout_height="match_parent" /> - - <androidx.appcompat.widget.AppCompatImageButton - android:id="@+id/action_format_underline" - style="@style/Widget.Button.Format" - android:contentDescription="@string/label_underline" - app:srcCompat="@drawable/ic_format_underline" - app:tint="?colorControlNormal" /> - - <Space - android:layout_width="2dp" - android:layout_height="match_parent" /> - - <androidx.appcompat.widget.AppCompatImageButton - android:id="@+id/action_format_strikethrough" - style="@style/Widget.Button.Format" - android:contentDescription="@string/label_strikethrough" - app:srcCompat="@drawable/ic_format_strikethrough" - app:tint="?colorControlNormal" /> - - <Space - android:layout_width="2dp" - android:layout_height="match_parent" /> - - <androidx.appcompat.widget.AppCompatImageButton - android:id="@+id/action_format_monospace" - style="@style/Widget.Button.Format" - android:contentDescription="@string/label_monospace" - app:srcCompat="@drawable/ic_format_monospace" - app:tint="?colorControlNormal" /> - - <Space - android:layout_width="2dp" - android:layout_height="match_parent" /> - - <FrameLayout - android:layout_width="48dp" - android:layout_height="48dp" - android:layout_gravity="center"> - - <androidx.appcompat.widget.AppCompatImageButton - android:id="@+id/action_format_foreground" - style="@style/Widget.Button.Format" - android:layout_width="match_parent" - android:layout_height="match_parent" - android:contentDescription="@string/label_foreground" - android:paddingBottom="4dp" - app:srcCompat="@drawable/ic_format_foreground" - app:tint="?colorControlNormal" /> - - <View - android:id="@+id/action_format_foreground_preview" - android:layout_width="match_parent" - android:layout_height="4dp" - android:layout_gravity="center_horizontal|bottom" - android:layout_margin="8dp" - android:background="?colorForeground" /> - </FrameLayout> - - <Space - android:layout_width="2dp" - android:layout_height="match_parent" /> - - <FrameLayout - android:layout_width="48dp" - android:layout_height="48dp" - android:layout_gravity="center"> - - <androidx.appcompat.widget.AppCompatImageButton - android:id="@+id/action_format_background" - style="@style/Widget.Button.Format" - android:layout_width="match_parent" - android:layout_height="match_parent" - android:contentDescription="@string/label_background" - android:paddingBottom="4dp" - app:srcCompat="@drawable/ic_format_background" - app:tint="?colorControlNormal" /> - - <View - android:id="@+id/action_format_background_preview" - android:layout_width="match_parent" - android:layout_height="4dp" - android:layout_gravity="center_horizontal|bottom" - android:layout_margin="8dp" - android:background="?colorBackground" /> - </FrameLayout> - - <Space - android:layout_width="2dp" - android:layout_height="match_parent" /> - - <androidx.appcompat.widget.AppCompatImageButton - android:id="@+id/action_format_clear" - style="@style/Widget.Button.Format" - android:contentDescription="@string/label_clear_formatting" - app:srcCompat="@drawable/ic_format_clear" - app:tint="?colorControlNormal" /> - </LinearLayout> -</HorizontalScrollView> diff --git a/app/src/main/res/layout/widget_header.xml b/app/src/main/res/layout/widget_header.xml deleted file mode 100644 index 278389b036e7f88654bc7a20a4930747fac2f501..0000000000000000000000000000000000000000 --- a/app/src/main/res/layout/widget_header.xml +++ /dev/null @@ -1,46 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" - xmlns:app="http://schemas.android.com/apk/res-auto" - xmlns:tools="http://schemas.android.com/tools" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:orientation="vertical"> - - <LinearLayout style="@style/Widget.CoreSettings.PrimaryItemGroupHeader"> - - <androidx.appcompat.widget.AppCompatImageView - style="@style/Widget.CoreSettings.PrimaryItemIcon" - app:srcCompat="@drawable/ic_clock" /> - - <TextView - android:id="@+id/title" - style="@style/Widget.CoreSettings.PrimaryItemSwitch" - tools:text="@string/label_temporarily_archived" /> - </LinearLayout> - - <TextView - android:id="@+id/content" - style="@style/Widget.CoreSettings.TextView" - android:layout_marginStart="72dp" - android:layout_marginEnd="16dp" - tools:text="@string/label_temporarily_archived_long" /> - -</LinearLayout> diff --git a/app/src/main/res/layout/widget_history_message.xml b/app/src/main/res/layout/widget_history_message.xml deleted file mode 100644 index ab0203958cde01a6a8b982b2434f1886efb87c38..0000000000000000000000000000000000000000 --- a/app/src/main/res/layout/widget_history_message.xml +++ /dev/null @@ -1,37 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<TextView xmlns:android="http://schemas.android.com/apk/res/android" - xmlns:tools="http://schemas.android.com/tools" - android:id="@+id/content" - style="@style/Widget.RtlConformTextView" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:layout_gravity="center" - android:background="?attr/backgroundMenuItem" - android:fontFamily="sans-serif-medium" - android:gravity="center_vertical" - android:minHeight="48dp" - android:paddingLeft="16dp" - android:paddingTop="8dp" - android:paddingRight="16dp" - android:paddingBottom="8dp" - android:textColor="?attr/colorTextPrimary" - android:textSize="13sp" - tools:text="@sample/recent_messages.json/data/message" /> diff --git a/app/src/main/res/layout/widget_inline_snackbar.xml b/app/src/main/res/layout/widget_inline_snackbar.xml deleted file mode 100644 index 64776b65bae075e0e93ce870e611693bd926074a..0000000000000000000000000000000000000000 --- a/app/src/main/res/layout/widget_inline_snackbar.xml +++ /dev/null @@ -1,57 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<com.google.android.material.card.MaterialCardView xmlns:android="http://schemas.android.com/apk/res/android" - xmlns:app="http://schemas.android.com/apk/res-auto" - xmlns:tools="http://schemas.android.com/tools" - android:layout_width="match_parent" - android:layout_height="wrap_content" - app:cardBackgroundColor="?colorBackgroundSnackbar"> - - <LinearLayout - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:minHeight="48dp" - android:orientation="horizontal"> - - <TextView - android:id="@+id/text" - android:layout_width="0dip" - android:layout_height="wrap_content" - android:layout_gravity="center_vertical" - android:layout_marginStart="16dp" - android:layout_weight="1" - android:textColor="?colorOnPrimary" - tools:text="This server supports SASL" /> - - <com.google.android.material.button.MaterialButton - android:id="@+id/button" - style="@style/Widget.MaterialComponents.Button.TextButton.Snackbar" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_gravity="center_vertical" - android:layout_marginLeft="8dp" - android:layout_marginTop="6dp" - android:layout_marginRight="8dp" - android:layout_marginBottom="6dp" - android:textColor="?colorOnPrimary" - tools:text="Upgrade" /> - </LinearLayout> - -</com.google.android.material.card.MaterialCardView> diff --git a/app/src/main/res/layout/widget_library.xml b/app/src/main/res/layout/widget_library.xml deleted file mode 100644 index b2ee94ae4b635769f21c87c23035c77a8e6cdd69..0000000000000000000000000000000000000000 --- a/app/src/main/res/layout/widget_library.xml +++ /dev/null @@ -1,66 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" - xmlns:tools="http://schemas.android.com/tools" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:background="?android:attr/selectableItemBackground" - android:focusable="true" - android:gravity="center_vertical" - android:minHeight="?android:attr/listPreferredItemHeightSmall" - android:paddingStart="?android:attr/listPreferredItemPaddingLeft" - android:paddingEnd="?android:attr/listPreferredItemPaddingRight" - tools:showIn="@layout/preferences_about"> - - <LinearLayout - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:orientation="vertical" - android:paddingTop="16dp" - android:paddingBottom="16dp"> - - <TextView - android:id="@+id/name" - style="@style/Widget.RtlConformTextView" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:textColor="?colorTextPrimary" - android:textSize="16sp" - tools:text="@sample/libraries.json/data/name" /> - - <TextView - android:id="@+id/version" - style="@style/Widget.RtlConformTextView" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:textAppearance="?android:attr/textAppearanceSmall" - android:textColor="?colorTextSecondary" - tools:text="@sample/libraries.json/data/version" /> - - <TextView - android:id="@+id/license" - style="@style/Widget.RtlConformTextView" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:textAppearance="?android:attr/textAppearanceSmall" - android:textColor="?colorTextSecondary" - tools:text="@sample/libraries.json/data/license/short_name" /> - </LinearLayout> -</LinearLayout> diff --git a/app/src/main/res/layout/widget_missing_feature.xml b/app/src/main/res/layout/widget_missing_feature.xml deleted file mode 100644 index d56b3e7eef5e2d7665bd8e394acb02f1f4e93b6d..0000000000000000000000000000000000000000 --- a/app/src/main/res/layout/widget_missing_feature.xml +++ /dev/null @@ -1,57 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" - xmlns:tools="http://schemas.android.com/tools" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:background="?android:attr/selectableItemBackground" - android:focusable="true" - android:gravity="center_vertical" - android:minHeight="?android:attr/listPreferredItemHeightSmall" - android:paddingStart="?android:attr/listPreferredItemPaddingLeft" - android:paddingEnd="?android:attr/listPreferredItemPaddingRight" - tools:showIn="@layout/dialog_missing_features"> - - <LinearLayout - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:orientation="vertical" - android:paddingTop="16dp" - android:paddingBottom="16dp"> - - <TextView - android:id="@+id/name" - style="@style/Widget.RtlConformTextView" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:textColor="?colorTextPrimary" - android:textSize="16sp" - tools:text="@sample/features.json/data/name" /> - - <TextView - android:id="@+id/description" - style="@style/Widget.RtlConformTextView" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:textAppearance="?android:attr/textAppearanceSmall" - android:textColor="?colorTextSecondary" - tools:text="@sample/features.json/data/description" /> - </LinearLayout> -</LinearLayout> diff --git a/app/src/main/res/layout/widget_network.xml b/app/src/main/res/layout/widget_network.xml deleted file mode 100644 index 7179f858c1c004b9885ebe248b8982b81d541ffd..0000000000000000000000000000000000000000 --- a/app/src/main/res/layout/widget_network.xml +++ /dev/null @@ -1,71 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" - xmlns:app="http://schemas.android.com/apk/res-auto" - xmlns:tools="http://schemas.android.com/tools" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:background="?attr/backgroundMenuItem" - android:orientation="vertical"> - - <View - android:layout_width="match_parent" - android:layout_height="1dp" - android:background="?attr/colorDivider" /> - - <LinearLayout - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:minHeight="48dp"> - - <TextView - android:id="@+id/name" - style="@style/Widget.RtlConformTextView" - android:layout_width="0dip" - android:layout_height="wrap_content" - android:layout_gravity="center" - android:layout_marginLeft="16dp" - android:layout_marginTop="8dp" - android:layout_marginRight="16dp" - android:layout_marginBottom="8dp" - android:layout_weight="1" - android:fontFamily="sans-serif-medium" - android:singleLine="true" - android:textColor="?attr/colorTextSecondary" - android:textSize="14sp" - tools:text="Freenode" /> - - <androidx.appcompat.widget.AppCompatImageView - android:id="@+id/status" - android:layout_width="wrap_content" - android:layout_height="match_parent" - android:background="?attr/selectableItemBackgroundBorderless" - android:clickable="true" - android:focusable="true" - android:minWidth="72dp" - android:paddingStart="16dp" - android:paddingTop="12dp" - android:paddingEnd="16dp" - android:paddingBottom="12dp" - android:scaleType="fitEnd" - app:srcCompat="@drawable/ic_chevron_down" - app:tint="?attr/colorTextSecondary" /> - </LinearLayout> -</LinearLayout> diff --git a/app/src/main/res/layout/widget_nick.xml b/app/src/main/res/layout/widget_nick.xml deleted file mode 100644 index e9fb1894619f96e92c30e5dc1aebbc2afa95c070..0000000000000000000000000000000000000000 --- a/app/src/main/res/layout/widget_nick.xml +++ /dev/null @@ -1,71 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" - xmlns:tools="http://schemas.android.com/tools" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:background="?attr/backgroundMenuItem" - android:orientation="horizontal" - android:paddingLeft="16dp" - android:paddingTop="4dp" - android:paddingRight="16dp" - android:paddingBottom="4dp" - android:textAppearance="?android:attr/textAppearanceListItemSmall" - tools:showIn="@layout/chat_nicklist"> - - <ImageView - android:id="@+id/avatar" - android:layout_width="@dimen/avatar_size" - android:layout_height="@dimen/avatar_size" - android:layout_gravity="center_vertical" - android:layout_marginEnd="16dp" - android:contentDescription="@string/label_avatar" - tools:src="@tools:sample/avatars" /> - - <LinearLayout - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:layout_gravity="center_vertical" - android:orientation="vertical"> - - <TextView - android:id="@+id/nick" - style="@style/Widget.RtlConformTextView" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:ellipsize="marquee" - android:singleLine="true" - android:textColor="?attr/colorTextPrimary" - android:textSize="13sp" - tools:text="@sample/messages.json/data/sender" /> - - <TextView - android:id="@+id/realname" - style="@style/Widget.RtlConformTextView" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:ellipsize="marquee" - android:singleLine="true" - android:textColor="?attr/colorTextSecondary" - android:textSize="12sp" - tools:text="@sample/messages.json/data/sender" - tools:visibility="visible" /> - </LinearLayout> -</LinearLayout> diff --git a/app/src/main/res/layout/widget_nick_away.xml b/app/src/main/res/layout/widget_nick_away.xml deleted file mode 100644 index b03ec2064db81a86e1d0c92a64d76436afe46da7..0000000000000000000000000000000000000000 --- a/app/src/main/res/layout/widget_nick_away.xml +++ /dev/null @@ -1,83 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" - xmlns:app="http://schemas.android.com/apk/res-auto" - xmlns:tools="http://schemas.android.com/tools" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:background="?attr/backgroundMenuItem" - android:orientation="horizontal" - android:paddingLeft="16dp" - android:paddingTop="4dp" - android:paddingRight="16dp" - android:paddingBottom="4dp" - android:textAppearance="?android:attr/textAppearanceListItemSmall"> - - <ImageView - android:id="@+id/avatar" - android:layout_width="@dimen/avatar_size" - android:layout_height="@dimen/avatar_size" - android:layout_gravity="center_vertical" - android:layout_marginEnd="16dp" - android:contentDescription="@string/label_avatar" - tools:src="@tools:sample/avatars" /> - - <LinearLayout - android:layout_width="0dip" - android:layout_height="wrap_content" - android:layout_gravity="center_vertical" - android:layout_weight="1" - android:orientation="vertical"> - - <TextView - android:id="@+id/nick" - style="@style/Widget.RtlConformTextView" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:ellipsize="marquee" - android:singleLine="true" - android:textColor="?attr/colorTextSecondary" - android:textSize="13sp" - android:textStyle="italic" - tools:text="@sample/messages.json/data/sender" /> - - <TextView - android:id="@+id/realname" - style="@style/Widget.RtlConformTextView" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:ellipsize="marquee" - android:singleLine="true" - android:textColor="?attr/colorTextSecondary" - android:textSize="12sp" - android:textStyle="italic" - tools:text="@sample/messages.json/data/sender" - tools:visibility="visible" /> - </LinearLayout> - - <androidx.appcompat.widget.AppCompatImageView - android:layout_width="24dp" - android:layout_height="24dp" - android:layout_gravity="center_vertical" - android:layout_marginStart="16dp" - android:contentDescription="@string/label_user_away" - app:srcCompat="@drawable/ic_clock" - app:tint="?colorTextSecondary" /> -</LinearLayout> diff --git a/app/src/main/res/layout/widget_preference_divider.xml b/app/src/main/res/layout/widget_preference_divider.xml deleted file mode 100644 index 0fdd3777d6fea6f546380fa21047113a3dc6bf89..0000000000000000000000000000000000000000 --- a/app/src/main/res/layout/widget_preference_divider.xml +++ /dev/null @@ -1,23 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<View xmlns:android="http://schemas.android.com/apk/res/android" - android:layout_width="match_parent" - android:layout_height="1dp" - android:background="?colorDivider" /> diff --git a/app/src/main/res/layout/widget_quassel_setup_entry.xml b/app/src/main/res/layout/widget_quassel_setup_entry.xml deleted file mode 100644 index 490edab8c9dfbdfa6f2a33c2681fdee8fb0a198c..0000000000000000000000000000000000000000 --- a/app/src/main/res/layout/widget_quassel_setup_entry.xml +++ /dev/null @@ -1,34 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<com.google.android.material.textfield.TextInputLayout xmlns:android="http://schemas.android.com/apk/res/android" - xmlns:app="http://schemas.android.com/apk/res-auto" - xmlns:tools="http://schemas.android.com/tools" - android:id="@+id/wrapper" - style="@style/Widget.CustomTextInput" - android:layout_width="match_parent" - android:layout_height="wrap_content" - tools:ignore="LabelFor"> - - <com.google.android.material.textfield.TextInputEditText - android:id="@+id/field" - android:layout_width="match_parent" - android:layout_height="wrap_content" - app:errorEnabled="true" /> -</com.google.android.material.textfield.TextInputLayout> diff --git a/app/src/main/res/layout/widget_search.xml b/app/src/main/res/layout/widget_search.xml deleted file mode 100644 index 2857e9de4d99c79fcda16b48eb33aa55be3a61d6..0000000000000000000000000000000000000000 --- a/app/src/main/res/layout/widget_search.xml +++ /dev/null @@ -1,70 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" - xmlns:app="http://schemas.android.com/apk/res-auto" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:background="?colorBackgroundSnackbar"> - - <androidx.cardview.widget.CardView - android:id="@+id/buffer_search_container" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:layout_margin="6dp" - app:cardBackgroundColor="?colorBackgroundSearch" - app:cardElevation="2dp"> - - <LinearLayout - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:orientation="horizontal"> - - <EditText - android:id="@+id/buffer_search" - android:layout_width="0dip" - android:layout_height="wrap_content" - android:layout_weight="1" - android:background="@android:color/transparent" - android:hint="@string/label_search_buffer" - android:imeOptions="actionSearch" - android:importantForAutofill="no" - android:inputType="textNoSuggestions" - android:lines="1" - android:minHeight="40dp" - android:paddingLeft="8dp" - android:paddingRight="8dp" - android:textColor="?colorTextSearch" - android:textColorHint="?colorTextSearchSecondary" - android:textSize="16sp" /> - - <androidx.appcompat.widget.AppCompatImageButton - android:id="@+id/buffer_search_clear" - android:layout_width="40dp" - android:layout_height="match_parent" - android:background="?selectableItemBackgroundBorderless" - android:contentDescription="@string/label_clear_search" - app:srcCompat="@drawable/ic_close" - app:tint="?colorTextSearchSecondary" /> - - </LinearLayout> - - </androidx.cardview.widget.CardView> - -</LinearLayout> diff --git a/app/src/main/res/layout/widget_spinner_item_material.xml b/app/src/main/res/layout/widget_spinner_item_material.xml deleted file mode 100644 index f1f39ee83222137df27dc87704c5b600972b0dba..0000000000000000000000000000000000000000 --- a/app/src/main/res/layout/widget_spinner_item_material.xml +++ /dev/null @@ -1,29 +0,0 @@ -<!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<TextView xmlns:android="http://schemas.android.com/apk/res/android" - xmlns:tools="http://schemas.android.com/tools" - android:id="@android:id/text1" - style="@style/Widget.MaterialSpinner.OutlinedBox" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:gravity="center_vertical" - android:minHeight="?attr/listPreferredItemHeightSmall" - android:textAppearance="?android:attr/textAppearanceListItemSmall" - tools:text="All Chats" /> diff --git a/app/src/main/res/layout/widget_spinner_item_toolbar.xml b/app/src/main/res/layout/widget_spinner_item_toolbar.xml deleted file mode 100644 index 4b9dd5d22dc8f6a8c822473711a865b452be1b67..0000000000000000000000000000000000000000 --- a/app/src/main/res/layout/widget_spinner_item_toolbar.xml +++ /dev/null @@ -1,31 +0,0 @@ -<!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<TextView xmlns:android="http://schemas.android.com/apk/res/android" - xmlns:tools="http://schemas.android.com/tools" - android:id="@android:id/text1" - style="@style/Widget.RtlConformTextView" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:gravity="center_vertical" - android:minHeight="?attr/actionBarSize" - android:paddingLeft="16dp" - android:paddingRight="16dp" - android:textAppearance="?android:attr/textAppearanceListItemSmall" - tools:text="All Chats" /> diff --git a/app/src/main/res/layout/widget_translator.xml b/app/src/main/res/layout/widget_translator.xml deleted file mode 100644 index 7fdc18a820c2e25a913a878522512a785feec6a7..0000000000000000000000000000000000000000 --- a/app/src/main/res/layout/widget_translator.xml +++ /dev/null @@ -1,56 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" - xmlns:tools="http://schemas.android.com/tools" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:background="?android:attr/selectableItemBackground" - android:gravity="center_vertical" - android:minHeight="?android:attr/listPreferredItemHeightSmall" - android:paddingStart="?android:attr/listPreferredItemPaddingLeft" - android:paddingEnd="?android:attr/listPreferredItemPaddingRight" - tools:showIn="@layout/preferences_about"> - - <LinearLayout - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:orientation="vertical" - android:paddingTop="16dp" - android:paddingBottom="16dp"> - - <TextView - android:id="@+id/name" - style="@style/Widget.RtlConformTextView" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:textColor="?colorTextPrimary" - android:textSize="16sp" - tools:text="@sample/contributors.json/data/name" /> - - <TextView - android:id="@+id/language" - style="@style/Widget.RtlConformTextView" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:textAppearance="?android:attr/textAppearanceSmall" - android:textColor="?colorTextSecondary" - tools:text="@sample/contributors.json/data/description" /> - </LinearLayout> -</LinearLayout> diff --git a/app/src/main/res/layout/widget_warning_bar.xml b/app/src/main/res/layout/widget_warning_bar.xml deleted file mode 100644 index d06303b337b44dca0b23aa2201175c9b99d70bd8..0000000000000000000000000000000000000000 --- a/app/src/main/res/layout/widget_warning_bar.xml +++ /dev/null @@ -1,56 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" - xmlns:app="http://schemas.android.com/apk/res-auto" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:background="?colorBackgroundSnackbar" - android:minHeight="32dp" - android:paddingLeft="16dp" - android:paddingTop="6dp" - android:paddingRight="16dp" - android:paddingBottom="6dp" - android:theme="?attr/actionBarTheme"> - - <androidx.appcompat.widget.AppCompatImageView - android:id="@+id/icon" - android:layout_width="20dp" - android:layout_height="20dp" - android:layout_gravity="center_vertical" - android:visibility="gone" - app:tint="?android:textColorPrimary" /> - - <me.zhanghai.android.materialprogressbar.MaterialProgressBar - android:id="@+id/progress" - style="@style/Widget.MaterialProgressBar.ProgressBar" - android:layout_width="20dp" - android:layout_height="20dp" - android:indeterminate="true" - android:visibility="gone" - app:mpb_indeterminateTint="?android:textColorPrimary" /> - - <TextView - android:id="@+id/text" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_marginStart="16dp" - android:textColor="?android:textColorPrimary" /> - -</LinearLayout> diff --git a/app/src/main/res/menu/activity_channellist.xml b/app/src/main/res/menu/activity_channellist.xml deleted file mode 100644 index 2a78883293c32da8d069b36c713322dfeca19c35..0000000000000000000000000000000000000000 --- a/app/src/main/res/menu/activity_channellist.xml +++ /dev/null @@ -1,66 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<menu xmlns:android="http://schemas.android.com/apk/res/android" - xmlns:app="http://schemas.android.com/apk/res-auto"> - <item - android:id="@+id/action_sort" - android:icon="@drawable/ic_sort" - android:title="@string/label_sort" - app:showAsAction="always"> - <menu> - <item - android:id="@+id/channel_name" - android:title="@string/label_channel_name"> - <menu> - <item - android:id="@+id/channel_name_asc" - android:title="@string/label_ascending" /> - <item - android:id="@+id/channel_name_desc" - android:title="@string/label_descending" /> - </menu> - </item> - <item - android:id="@+id/user_count" - android:title="@string/label_user_count"> - <menu> - <item - android:id="@+id/user_count_asc" - android:title="@string/label_ascending" /> - <item - android:id="@+id/user_count_desc" - android:title="@string/label_descending" /> - </menu> - </item> - <item - android:id="@+id/topic" - android:title="@string/label_topic"> - <menu> - <item - android:id="@+id/topic_asc" - android:title="@string/label_ascending" /> - <item - android:id="@+id/topic_desc" - android:title="@string/label_descending" /> - </menu> - </item> - </menu> - </item> -</menu> diff --git a/app/src/main/res/menu/activity_crashes.xml b/app/src/main/res/menu/activity_crashes.xml deleted file mode 100644 index 77e4aa020a7239c3c3d834a0fb18a1c9b13c0245..0000000000000000000000000000000000000000 --- a/app/src/main/res/menu/activity_crashes.xml +++ /dev/null @@ -1,27 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<menu xmlns:android="http://schemas.android.com/apk/res/android"> - <item - android:id="@+id/action_generate_crash_report" - android:title="@string/label_generate_crash_report" /> - <item - android:id="@+id/action_delete_all" - android:title="@string/label_delete_all" /> -</menu> diff --git a/app/src/main/res/menu/activity_main.xml b/app/src/main/res/menu/activity_main.xml deleted file mode 100644 index 0acff0c56bce79712f0aff831ae4248bf0ee4686..0000000000000000000000000000000000000000 --- a/app/src/main/res/menu/activity_main.xml +++ /dev/null @@ -1,42 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<menu xmlns:android="http://schemas.android.com/apk/res/android" - xmlns:app="http://schemas.android.com/apk/res-auto"> - <item - android:id="@+id/action_nicklist" - android:icon="@drawable/ic_account_multiple" - android:title="@string/label_nicklist" - app:showAsAction="always" /> - <item - android:id="@+id/action_filter_messages" - android:title="@string/label_filter_messages" /> - <item - android:id="@+id/action_core_settings" - android:title="@string/label_settings_core" /> - <item - android:id="@+id/action_client_settings" - android:title="@string/label_settings_client" /> - <item - android:id="@+id/action_about" - android:title="@string/label_about" /> - <item - android:id="@+id/action_disconnect" - android:title="@string/label_disconnect" /> -</menu> diff --git a/app/src/main/res/menu/activity_settings.xml b/app/src/main/res/menu/activity_settings.xml deleted file mode 100644 index 3420044d97c0cf068c687577c6eed7b99c594024..0000000000000000000000000000000000000000 --- a/app/src/main/res/menu/activity_settings.xml +++ /dev/null @@ -1,30 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<menu xmlns:android="http://schemas.android.com/apk/res/android"> - <item - android:id="@+id/action_certificates" - android:title="@string/label_certificates" /> - <item - android:id="@+id/action_crashes" - android:title="@string/label_crashes" /> - <item - android:id="@+id/action_about" - android:title="@string/label_about" /> -</menu> diff --git a/app/src/main/res/menu/activity_setup.xml b/app/src/main/res/menu/activity_setup.xml deleted file mode 100644 index c4d256964df22f584acca9795fa64263653a00f2..0000000000000000000000000000000000000000 --- a/app/src/main/res/menu/activity_setup.xml +++ /dev/null @@ -1,33 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<menu xmlns:android="http://schemas.android.com/apk/res/android"> - <item - android:id="@+id/action_client_settings" - android:title="@string/label_settings_client" /> - <item - android:id="@+id/action_certificates" - android:title="@string/label_certificates" /> - <item - android:id="@+id/action_crashes" - android:title="@string/label_crashes" /> - <item - android:id="@+id/action_about" - android:title="@string/label_about" /> -</menu> diff --git a/app/src/main/res/menu/context_buffer.xml b/app/src/main/res/menu/context_buffer.xml deleted file mode 100644 index b0e95ab5872d8257400ec4f4f8aa1ff7f1664ba5..0000000000000000000000000000000000000000 --- a/app/src/main/res/menu/context_buffer.xml +++ /dev/null @@ -1,54 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<menu xmlns:android="http://schemas.android.com/apk/res/android" - xmlns:app="http://schemas.android.com/apk/res-auto"> - <item - android:id="@+id/action_channellist" - android:title="@string/label_info_channellist" /> - <item - android:id="@+id/action_configure" - android:title="@string/label_configure" /> - <item - android:id="@+id/action_connect" - android:title="@string/label_connect" /> - <item - android:id="@+id/action_disconnect" - android:title="@string/label_disconnect" /> - <item - android:id="@+id/action_join" - android:title="@string/label_join" /> - <item - android:id="@+id/action_part" - android:title="@string/label_part" /> - <item - android:id="@+id/action_delete" - android:title="@string/label_delete" /> - <item - android:id="@+id/action_rename" - android:title="@string/label_rename" /> - <item - android:id="@+id/action_unhide" - android:title="@string/label_unhide" - app:showAsAction="never" /> - <item - android:id="@+id/action_archive" - android:title="@string/label_archive" - app:showAsAction="never" /> -</menu> diff --git a/app/src/main/res/menu/context_bufferlist.xml b/app/src/main/res/menu/context_bufferlist.xml deleted file mode 100644 index d6b934e9b65210417dc8a5850636c406c143420f..0000000000000000000000000000000000000000 --- a/app/src/main/res/menu/context_bufferlist.xml +++ /dev/null @@ -1,28 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<menu xmlns:android="http://schemas.android.com/apk/res/android"> - <item - android:id="@+id/action_archived_chats" - android:title="@string/label_archived_chats" /> - <item - android:id="@+id/action_search" - android:checkable="true" - android:title="@string/label_search_buffer" /> -</menu> diff --git a/app/src/main/res/menu/context_ignore.xml b/app/src/main/res/menu/context_ignore.xml deleted file mode 100644 index 74f86f8956e6ce1dadf4237ee8de93d0aa973ef1..0000000000000000000000000000000000000000 --- a/app/src/main/res/menu/context_ignore.xml +++ /dev/null @@ -1,27 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<menu xmlns:android="http://schemas.android.com/apk/res/android"> - <item - android:id="@+id/action_create" - android:title="@string/label_new_ignore_rule" /> - <item - android:id="@+id/action_show" - android:title="@string/settings_ignorelist_title" /> -</menu> diff --git a/app/src/main/res/menu/context_link.xml b/app/src/main/res/menu/context_link.xml deleted file mode 100644 index a5b99372b42d19d88bee7805ff7b5da64540f812..0000000000000000000000000000000000000000 --- a/app/src/main/res/menu/context_link.xml +++ /dev/null @@ -1,29 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<menu xmlns:android="http://schemas.android.com/apk/res/android"> - <item - android:id="@+id/action_copy" - android:icon="@drawable/ic_copy" - android:title="@string/label_copy" /> - <item - android:id="@+id/action_share" - android:icon="@drawable/ic_share" - android:title="@string/label_share" /> -</menu> diff --git a/app/src/main/res/menu/context_messages.xml b/app/src/main/res/menu/context_messages.xml deleted file mode 100644 index 0455bd114b82918bd5f1d5e31418bb9b9c36a84e..0000000000000000000000000000000000000000 --- a/app/src/main/res/menu/context_messages.xml +++ /dev/null @@ -1,33 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<menu xmlns:android="http://schemas.android.com/apk/res/android"> - <item - android:id="@+id/action_user_info" - android:icon="@drawable/ic_account" - android:title="@string/label_info_user" /> - <item - android:id="@+id/action_copy" - android:icon="@drawable/ic_copy" - android:title="@string/label_copy" /> - <item - android:id="@+id/action_share" - android:icon="@drawable/ic_share" - android:title="@string/label_share" /> -</menu> diff --git a/app/src/main/res/menu/context_setting.xml b/app/src/main/res/menu/context_setting.xml deleted file mode 100644 index 830c2adecc2cfe169d7895cc3e56c3ecae008d87..0000000000000000000000000000000000000000 --- a/app/src/main/res/menu/context_setting.xml +++ /dev/null @@ -1,29 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<menu xmlns:android="http://schemas.android.com/apk/res/android" - xmlns:app="http://schemas.android.com/apk/res-auto"> - <item - android:id="@+id/action_save" - android:title="@string/label_save" - app:showAsAction="ifRoom" /> - <item - android:id="@+id/action_delete" - android:title="@string/label_delete" /> -</menu> diff --git a/app/src/main/res/menu/editor.xml b/app/src/main/res/menu/editor.xml deleted file mode 100644 index bd6dc2ce4a81f6166aaa60c7028de1f3891db245..0000000000000000000000000000000000000000 --- a/app/src/main/res/menu/editor.xml +++ /dev/null @@ -1,27 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<menu xmlns:android="http://schemas.android.com/apk/res/android" - xmlns:app="http://schemas.android.com/apk/res-auto"> - <item - android:id="@+id/action_input_history" - android:icon="@drawable/ic_history" - android:title="@string/label_input_history" - app:showAsAction="always" /> -</menu> diff --git a/app/src/main/res/menu/setup_edit_account.xml b/app/src/main/res/menu/setup_edit_account.xml deleted file mode 100644 index 6244c695a5796bf67ccd73b6cc957075a9195766..0000000000000000000000000000000000000000 --- a/app/src/main/res/menu/setup_edit_account.xml +++ /dev/null @@ -1,32 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<menu xmlns:android="http://schemas.android.com/apk/res/android" - xmlns:app="http://schemas.android.com/apk/res-auto"> - <item - android:id="@+id/action_save" - android:title="@string/label_save" - app:showAsAction="ifRoom" /> - <item - android:id="@+id/action_delete" - android:icon="@drawable/ic_delete" - android:title="@string/label_delete" - app:iconTint="#fff" - app:showAsAction="never" /> -</menu> diff --git a/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml b/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml new file mode 100644 index 0000000000000000000000000000000000000000..eca70cfe52eac1ba66ba280a68ca7be8fcf88a16 --- /dev/null +++ b/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml @@ -0,0 +1,5 @@ +<?xml version="1.0" encoding="utf-8"?> +<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android"> + <background android:drawable="@drawable/ic_launcher_background" /> + <foreground android:drawable="@drawable/ic_launcher_foreground" /> +</adaptive-icon> \ No newline at end of file diff --git a/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml b/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml new file mode 100644 index 0000000000000000000000000000000000000000..eca70cfe52eac1ba66ba280a68ca7be8fcf88a16 --- /dev/null +++ b/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml @@ -0,0 +1,5 @@ +<?xml version="1.0" encoding="utf-8"?> +<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android"> + <background android:drawable="@drawable/ic_launcher_background" /> + <foreground android:drawable="@drawable/ic_launcher_foreground" /> +</adaptive-icon> \ No newline at end of file diff --git a/app/src/main/res/mipmap-hdpi/ic_launcher.webp b/app/src/main/res/mipmap-hdpi/ic_launcher.webp new file mode 100644 index 0000000000000000000000000000000000000000..c209e78ecd372343283f4157dcfd918ec5165bb3 Binary files /dev/null and b/app/src/main/res/mipmap-hdpi/ic_launcher.webp differ diff --git a/app/src/main/res/mipmap-hdpi/ic_launcher_legacy.png b/app/src/main/res/mipmap-hdpi/ic_launcher_legacy.png deleted file mode 100644 index 8d5a414da51e9443df573dec0d93cf2731d2b028..0000000000000000000000000000000000000000 Binary files a/app/src/main/res/mipmap-hdpi/ic_launcher_legacy.png and /dev/null differ diff --git a/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp b/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp new file mode 100644 index 0000000000000000000000000000000000000000..b2dfe3d1ba5cf3ee31b3ecc1ced89044a1f3b7a9 Binary files /dev/null and b/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp differ diff --git a/app/src/main/res/mipmap-hdpi/ic_logo.png b/app/src/main/res/mipmap-hdpi/ic_logo.png deleted file mode 100644 index 0804110bfef5d9db1f711b3e7da021f061508bbe..0000000000000000000000000000000000000000 Binary files a/app/src/main/res/mipmap-hdpi/ic_logo.png and /dev/null differ diff --git a/app/src/main/res/mipmap-mdpi/ic_launcher.webp b/app/src/main/res/mipmap-mdpi/ic_launcher.webp new file mode 100644 index 0000000000000000000000000000000000000000..4f0f1d64e58ba64d180ce43ee13bf9a17835fbca Binary files /dev/null and b/app/src/main/res/mipmap-mdpi/ic_launcher.webp differ diff --git a/app/src/main/res/mipmap-mdpi/ic_launcher_legacy.png b/app/src/main/res/mipmap-mdpi/ic_launcher_legacy.png deleted file mode 100644 index 7317e659227c70c50880bc68d3bbece921a5b5c9..0000000000000000000000000000000000000000 Binary files a/app/src/main/res/mipmap-mdpi/ic_launcher_legacy.png and /dev/null differ diff --git a/app/src/main/res/mipmap-mdpi/ic_launcher_round.webp b/app/src/main/res/mipmap-mdpi/ic_launcher_round.webp new file mode 100644 index 0000000000000000000000000000000000000000..62b611da081676d42f6c3f78a2c91e7bcedddedb Binary files /dev/null and b/app/src/main/res/mipmap-mdpi/ic_launcher_round.webp differ diff --git a/app/src/main/res/mipmap-mdpi/ic_logo.png b/app/src/main/res/mipmap-mdpi/ic_logo.png deleted file mode 100644 index 9c1150ee74015b8bc0c73bd10dce7ab729878933..0000000000000000000000000000000000000000 Binary files a/app/src/main/res/mipmap-mdpi/ic_logo.png and /dev/null differ diff --git a/app/src/main/res/mipmap-nodpi/ic_launcher_foreground.png b/app/src/main/res/mipmap-nodpi/ic_launcher_foreground.png deleted file mode 100644 index c01a33781617789788086c3269383c094230bae9..0000000000000000000000000000000000000000 Binary files a/app/src/main/res/mipmap-nodpi/ic_launcher_foreground.png and /dev/null differ diff --git a/app/src/main/res/mipmap-nodpi/ic_launcher_recents.png b/app/src/main/res/mipmap-nodpi/ic_launcher_recents.png deleted file mode 100644 index 8719a83a8bfcc74daef1a5ffe7156367c3d155ca..0000000000000000000000000000000000000000 Binary files a/app/src/main/res/mipmap-nodpi/ic_launcher_recents.png and /dev/null differ diff --git a/app/src/main/res/mipmap-v26/ic_launcher.xml b/app/src/main/res/mipmap-v26/ic_launcher.xml deleted file mode 100644 index 102979fec863ecb7857a936ed4a4a75992eb13b3..0000000000000000000000000000000000000000 --- a/app/src/main/res/mipmap-v26/ic_launcher.xml +++ /dev/null @@ -1,23 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android"> - <background android:drawable="@drawable/ic_launcher_background" /> - <foreground android:drawable="@mipmap/ic_launcher_foreground" /> -</adaptive-icon> diff --git a/app/src/main/res/mipmap-xhdpi/ic_launcher.webp b/app/src/main/res/mipmap-xhdpi/ic_launcher.webp new file mode 100644 index 0000000000000000000000000000000000000000..948a3070fe34c611c42c0d3ad3013a0dce358be0 Binary files /dev/null and b/app/src/main/res/mipmap-xhdpi/ic_launcher.webp differ diff --git a/app/src/main/res/mipmap-xhdpi/ic_launcher_legacy.png b/app/src/main/res/mipmap-xhdpi/ic_launcher_legacy.png deleted file mode 100644 index 4aaad0b9549b64ff4fe9d0a61c4f19d4bae2f3ec..0000000000000000000000000000000000000000 Binary files a/app/src/main/res/mipmap-xhdpi/ic_launcher_legacy.png and /dev/null differ diff --git a/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp b/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp new file mode 100644 index 0000000000000000000000000000000000000000..1b9a6956b3acdc11f40ce2bb3f6efbd845cc243f Binary files /dev/null and b/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp differ diff --git a/app/src/main/res/mipmap-xhdpi/ic_logo.png b/app/src/main/res/mipmap-xhdpi/ic_logo.png deleted file mode 100644 index 1009ed2db17c4b8092048dca461aab1c38c44913..0000000000000000000000000000000000000000 Binary files a/app/src/main/res/mipmap-xhdpi/ic_logo.png and /dev/null differ diff --git a/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp b/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp new file mode 100644 index 0000000000000000000000000000000000000000..28d4b77f9f036a47549d47db79c16788749dca10 Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp differ diff --git a/app/src/main/res/mipmap-xxhdpi/ic_launcher_legacy.png b/app/src/main/res/mipmap-xxhdpi/ic_launcher_legacy.png deleted file mode 100644 index c1196016eea2aaad13c67cbd6fe87a18cda0ad20..0000000000000000000000000000000000000000 Binary files a/app/src/main/res/mipmap-xxhdpi/ic_launcher_legacy.png and /dev/null differ diff --git a/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp b/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp new file mode 100644 index 0000000000000000000000000000000000000000..9287f5083623b375139afb391af71cc533a7dd37 Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp differ diff --git a/app/src/main/res/mipmap-xxhdpi/ic_logo.png b/app/src/main/res/mipmap-xxhdpi/ic_logo.png deleted file mode 100644 index c19d713c35f9f1ed05c8a6cdf7765374f5db7fc3..0000000000000000000000000000000000000000 Binary files a/app/src/main/res/mipmap-xxhdpi/ic_logo.png and /dev/null differ diff --git a/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp b/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp new file mode 100644 index 0000000000000000000000000000000000000000..aa7d6427e6fa1074b79ccd52ef67ac15c5637e85 Binary files /dev/null and b/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp differ diff --git a/app/src/main/res/mipmap-xxxhdpi/ic_launcher_legacy.png b/app/src/main/res/mipmap-xxxhdpi/ic_launcher_legacy.png deleted file mode 100644 index 71f99b9a56e9e3e5d2b5266220642b5f101dbbc5..0000000000000000000000000000000000000000 Binary files a/app/src/main/res/mipmap-xxxhdpi/ic_launcher_legacy.png and /dev/null differ diff --git a/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp b/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp new file mode 100644 index 0000000000000000000000000000000000000000..9126ae37cbc3587421d6889eadd1d91fbf1994d4 Binary files /dev/null and b/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp differ diff --git a/app/src/main/res/mipmap-xxxhdpi/ic_logo.png b/app/src/main/res/mipmap-xxxhdpi/ic_logo.png deleted file mode 100644 index bb3dd1d3a0afb3bebae8076a7f58d1cb39baf2de..0000000000000000000000000000000000000000 Binary files a/app/src/main/res/mipmap-xxxhdpi/ic_logo.png and /dev/null differ diff --git a/app/src/main/res/raw/license_apache_2.html b/app/src/main/res/raw/license_apache_2.html deleted file mode 100644 index e4f0c6b299e0cff7dabe933118387e8e567de4e2..0000000000000000000000000000000000000000 --- a/app/src/main/res/raw/license_apache_2.html +++ /dev/null @@ -1,160 +0,0 @@ -<!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<h2>Apache License</h2> -<p>Version 2.0, January 2004 - <br /> - <br /> - <a href="http://www.apache.org/licenses/">http://www.apache.org/licenses/</a> -</p> -<p>TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION</p> -<p><strong>1. Definitions</strong>. -</p> -<p>"License" shall mean the terms and conditions for use, reproduction, and distribution as defined - by Sections 1 through 9 of this document. -</p> -<p>"Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is - granting the License. -</p> -<p>"Legal Entity" shall mean the union of the acting entity and all other entities that control, are - controlled by, or are under common control with that entity. For the purposes of this - definition, "control" means (i) the power, direct or indirect, to cause the direction or - management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent - (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. -</p> -<p>"You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this - License. -</p> -<p>"Source" form shall mean the preferred form for making modifications, including but not limited - to software source code, documentation source, and configuration files. -</p> -<p>"Object" form shall mean any form resulting from mechanical transformation or translation of a - Source form, including but not limited to compiled object code, generated documentation, and - conversions to other media types. -</p> -<p>"Work" shall mean the work of authorship, whether in Source or Object form, made available under - the License, as indicated by a copyright notice that is included in or attached to the work (an - example is provided in the Appendix below). -</p> -<p>"Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or - derived from) the Work and for which the editorial revisions, annotations, elaborations, or - other modifications represent, as a whole, an original work of authorship. For the purposes of - this License, Derivative Works shall not include works that remain separable from, or merely - link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. -</p> -<p>"Contribution" shall mean any work of authorship, including the original version of the Work and - any modifications or additions to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or - Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this - definition, "submitted" means any form of electronic, verbal, or written communication sent to - the Licensor or its representatives, including but not limited to communication on electronic - mailing lists, source code control systems, and issue tracking systems that are managed by, or - on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding - communication that is conspicuously marked or otherwise designated in writing by the copyright - owner as "Not a Contribution." -</p> -<p>"Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a - Contribution has been received by Licensor and subsequently incorporated within the Work. -</p> -<p><strong>2. Grant of Copyright License</strong>. Subject to the terms and conditions of this - License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, - royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly - display, publicly perform, sublicense, and distribute the Work and such Derivative Works in - Source or Object form. -</p> -<p><strong>3. Grant of Patent License</strong>. Subject to the terms and conditions of this License, - each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, - royalty-free, irrevocable (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies - only to those patent claims licensable by such Contributor that are necessarily infringed by - their Contribution(s) alone or by combination of their Contribution(s) with the Work to which - such Contribution(s) was submitted. If You institute patent litigation against any entity - (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution - incorporated within the Work constitutes direct or contributory patent infringement, then any - patent licenses granted to You under this License for that Work shall terminate as of the date - such litigation is filed. -</p> -<p><strong>4. Redistribution</strong>. You may reproduce and distribute copies of the Work or - Derivative Works thereof in any medium, with or without modifications, and in Source or Object - form, provided that You meet the following conditions: -</p> -<p>a. You must give any other recipients of the Work or Derivative Works a copy of this License; - and -</p> -<p>b. You must cause any modified files to carry prominent notices stating that You changed the - files; and -</p> -<p>c. You must retain, in the Source form of any Derivative Works that You distribute, all - copyright, patent, trademark, and attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of the Derivative Works; and -</p> -<p>d. If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative - Works that You distribute must include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not pertain to any part of the - Derivative Works, in at least one of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or documentation, if provided along with - the Derivative Works; or, within a display generated by the Derivative Works, if and wherever - such third-party notices normally appear. The contents of the NOTICE file are for informational - purposes only and do not modify the License. You may add Your own attribution notices within - Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the - Work, provided that such additional attribution notices cannot be construed as modifying the - License. - <br /> - <br /> - You may add Your own copyright statement to Your modifications and may provide additional or - different license terms and conditions for use, reproduction, or distribution of Your - modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and - distribution of the Work otherwise complies with the conditions stated in this License. -</p> -<p><strong>5. Submission of Contributions</strong>. Unless You explicitly state otherwise, any - Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be - under the terms and conditions of this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate - license agreement you may have executed with Licensor regarding such Contributions. -</p> -<p><strong>6. Trademarks</strong>. This License does not grant permission to use the trade names, - trademarks, service marks, or product names of the Licensor, except as required for reasonable - and customary use in describing the origin of the Work and reproducing the content of the NOTICE - file. -</p> -<p><strong>7. Disclaimer of Warranty</strong>. Unless required by applicable law or agreed to in - writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS - IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, - without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or - FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness - of using or redistributing the Work and assume any risks associated with Your exercise of - permissions under this License. -</p> -<p><strong>8. Limitation of Liability</strong>. In no event and under no legal theory, whether in - tort (including negligence), contract, or otherwise, unless required by applicable law (such as - deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable - to You for damages, including any direct, indirect, special, incidental, or consequential - damages of any character arising as a result of this License or out of the use or inability to - use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer - failure or malfunction, or any and all other commercial damages or losses), even if such - Contributor has been advised of the possibility of such damages. -</p> -<p><strong>9. Accepting Warranty or Additional Liability</strong>. While redistributing the Work or - Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, - warranty, indemnity, or other liability obligations and/or rights consistent with this License. - However, in accepting such obligations, You may act only on Your own behalf and on Your sole - responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability incurred by, or claims asserted - against, such Contributor by reason of your accepting any such warranty or additional liability. -</p> diff --git a/app/src/main/res/raw/license_cc_0.html b/app/src/main/res/raw/license_cc_0.html deleted file mode 100644 index 04e5688435daae5aff0a6cc8e9ef59def3872e82..0000000000000000000000000000000000000000 --- a/app/src/main/res/raw/license_cc_0.html +++ /dev/null @@ -1,117 +0,0 @@ -<!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<h2>Creative Commons</h2> -<h2>CC0 1.0 Universal</h2> -<h3> - <em>Statement of Purpose</em> -</h3> -<p>The laws of most jurisdictions throughout the world automatically confer exclusive Copyright and - Related Rights (defined below) upon the creator and subsequent owner(s) (each and all, an - "owner") of an original work of authorship and/or a database (each, a "Work"). -</p> -<p>Certain owners wish to permanently relinquish those rights to a Work for the purpose of - contributing to a commons of creative, cultural and scientific works ("Commons") that the public - can reliably and without fear of later claims of infringement build upon, modify, incorporate in - other works, reuse and redistribute as freely as possible in any form whatsoever and for any - purposes, including without limitation commercial purposes. These owners may contribute to the - Commons to promote the ideal of a free culture and the further production of creative, cultural - and scientific works, or to gain reputation or greater distribution for their Work in part - through the use and efforts of others. -</p> -<p>For these and/or other purposes and motivations, and without any expectation of additional - consideration or compensation, the person associating CC0 with a Work (the "Affirmer"), to the - extent that he or she is an owner of Copyright and Related Rights in the Work, voluntarily - elects to apply CC0 to the Work and publicly distribute the Work under its terms, with knowledge - of his or her Copyright and Related Rights in the Work and the meaning and intended legal effect - of CC0 on those rights. -</p> -<p><strong>1. Copyright and Related Rights.</strong>A Work made available under CC0 may be protected - by copyright and related or neighboring rights ("Copyright and Related Rights"). Copyright and - Related Rights include, but are not limited to, the following: -</p> -<p>i. the right to reproduce, adapt, distribute, perform, display, communicate, and translate a - Work; -</p> -<p>ii. moral rights retained by the original author(s) and/or performer(s);</p> -<p>iii. publicity and privacy rights pertaining to a person's image or likeness depicted in a - Work; -</p> -<p>iv. rights protecting against unfair competition in regards to a Work, subject to the limitations - in paragraph 4(a), below; -</p> -<p>v. rights protecting the extraction, dissemination, use and reuse of data in a Work;</p> -<p>vi. database rights (such as those arising under Directive 96/9/EC of the European Parliament and - of the Council of 11 March 1996 on the legal protection of databases, and under any national - implementation thereof, including any amended or successor version of such directive); and -</p> -<p>vii. other similar, equivalent or corresponding rights throughout the world based on applicable - law or treaty, and any national implementations thereof. -</p> -<p><strong>2. Waiver.</strong>To the greatest extent permitted by, but not in contravention of, - applicable law, Affirmer hereby overtly, fully, permanently, irrevocably and unconditionally - waives, abandons, and surrenders all of Affirmer's Copyright and Related Rights and - associated claims and causes of action, whether now known or unknown (including existing as well - as future claims and causes of action), in the Work (i) in all territories worldwide, (ii) for - the maximum duration provided by applicable law or treaty (including future time extensions), - (iii) in any current or future medium and for any number of copies, and (iv) for any purpose - whatsoever, including without limitation commercial, advertising or promotional purposes (the - "Waiver"). Affirmer makes the Waiver for the benefit of each member of the public at large and - to the detriment of Affirmer's heirs and successors, fully intending that such Waiver shall - not be subject to revocation, rescission, cancellation, termination, or any other legal or - equitable action to disrupt the quiet enjoyment of the Work by the public as contemplated by - Affirmer's express Statement of Purpose. -</p> -<p><strong>3. Public License Fallback.</strong>Should any part of the Waiver for any reason be - judged legally invalid or ineffective under applicable law, then the Waiver shall be preserved - to the maximum extent permitted taking into account Affirmer's express Statement of - Purpose. In addition, to the extent the Waiver is so judged Affirmer hereby grants to each - affected person a royalty-free, non transferable, non sublicensable, non exclusive, irrevocable - and unconditional license to exercise Affirmer's Copyright and Related Rights in the Work - (i) in all territories worldwide, (ii) for the maximum duration provided by applicable law or - treaty (including future time extensions), (iii) in any current or future medium and for any - number of copies, and (iv) for any purpose whatsoever, including without limitation commercial, - advertising or promotional purposes (the "License"). The License shall be deemed effective as of - the date CC0 was applied by Affirmer to the Work. Should any part of the License for any reason - be judged legally invalid or ineffective under applicable law, such partial invalidity or - ineffectiveness shall not invalidate the remainder of the License, and in such case Affirmer - hereby affirms that he or she will not (i) exercise any of his or her remaining Copyright and - Related Rights in the Work or (ii) assert any associated claims and causes of action with - respect to the Work, in either case contrary to Affirmer's express Statement of Purpose. -</p> -<p> - <strong>4. Limitations and Disclaimers.</strong> -</p> -<p>a. No trademark or patent rights held by Affirmer are waived, abandoned, surrendered, licensed or - otherwise affected by this document. -</p> -<p>b. Affirmer offers the Work as-is and makes no representations or warranties of any kind - concerning the Work, express, implied, statutory or otherwise, including without limitation - warranties of title, merchantability, fitness for a particular purpose, non infringement, or the - absence of latent or other defects, accuracy, or the present or absence of errors, whether or - not discoverable, all to the greatest extent permissible under applicable law. -</p> -<p>c. Affirmer disclaims responsibility for clearing rights of other persons that may apply to the - Work or any use thereof, including without limitation any person's Copyright and Related - Rights in the Work. Further, Affirmer disclaims responsibility for obtaining any necessary - consents, permissions or other rights required for any use of the Work. -</p> -<p>d. Affirmer understands and acknowledges that Creative Commons is not a party to this document - and has no duty or obligation with respect to this CC0 or use of the Work. -</p> diff --git a/app/src/main/res/raw/license_cc_by_sa_3_0.html b/app/src/main/res/raw/license_cc_by_sa_3_0.html deleted file mode 100644 index d74c7dade329809ee49ae1d1376155dc421747f9..0000000000000000000000000000000000000000 --- a/app/src/main/res/raw/license_cc_by_sa_3_0.html +++ /dev/null @@ -1,299 +0,0 @@ -<!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<h2>Creative Commons</h2> -<h2>Attribution-ShareAlike 3.0 Unported</h2> -<h3> - <em>License</em> -</h3> -<p>THE WORK (AS DEFINED BELOW) IS PROVIDED UNDER THE TERMS OF THIS CREATIVE COMMONS PUBLIC LICENSE - ("CCPL" OR "LICENSE"). THE WORK IS PROTECTED BY COPYRIGHT AND/OR OTHER APPLICABLE LAW. ANY USE - OF THE WORK OTHER THAN AS AUTHORIZED UNDER THIS LICENSE OR COPYRIGHT LAW IS PROHIBITED. -</p> -<p>BY EXERCISING ANY RIGHTS TO THE WORK PROVIDED HERE, YOU ACCEPT AND AGREE TO BE BOUND BY THE TERMS - OF THIS LICENSE. TO THE EXTENT THIS LICENSE MAY BE CONSIDERED TO BE A CONTRACT, THE LICENSOR - GRANTS YOU THE RIGHTS CONTAINED HERE IN CONSIDERATION OF YOUR ACCEPTANCE OF SUCH TERMS AND - CONDITIONS. -</p> -<p> - <strong>1. Definitions</strong> -</p> -<p>a.<strong>"Adaptation"</strong>means a work based upon the Work, or upon the Work and other - pre-existing works, such as a translation, adaptation, derivative work, arrangement of music or - other alterations of a literary or artistic work, or phonogram or performance and includes - cinematographic adaptations or any other form in which the Work may be recast, transformed, or - adapted including in any form recognizably derived from the original, except that a work that - constitutes a Collection will not be considered an Adaptation for the purpose of this License. - For the avoidance of doubt, where the Work is a musical work, performance or phonogram, the - synchronization of the Work in timed-relation with a moving image ("synching") will be - considered an Adaptation for the purpose of this License. -</p> -<p>b.<strong>"Collection"</strong>means a collection of literary or artistic works, such as - encyclopedias and anthologies, or performances, phonograms or broadcasts, or other works or - subject matter other than works listed in Section 1(f) below, which, by reason of the selection - and arrangement of their contents, constitute intellectual creations, in which the Work is - included in its entirety in unmodified form along with one or more other contributions, each - constituting separate and independent works in themselves, which together are assembled into a - collective whole. A work that constitutes a Collection will not be considered an Adaptation (as - defined below) for the purposes of this License. -</p> -<p>c.<strong>"Creative Commons Compatible License"</strong>means a license that is listed at - https://creativecommons.org/compatiblelicenses that has been approved by Creative Commons as - being essentially equivalent to this License, including, at a minimum, because that license: (i) - contains terms that have the same purpose, meaning and effect as the License Elements of this - License; and, (ii) explicitly permits the relicensing of adaptations of works made available - under that license under this License or a Creative Commons jurisdiction license with the same - License Elements as this License. -</p> -<p>d.<strong>"Distribute"</strong>means to make available to the public the original and copies of - the Work or Adaptation, as appropriate, through sale or other transfer of ownership. -</p> -<p>e.<strong>"License Elements"</strong>means the following high-level license attributes as - selected by Licensor and indicated in the title of this License: Attribution, ShareAlike. -</p> -<p>f.<strong>"Licensor"</strong>means the individual, individuals, entity or entities that offer(s) - the Work under the terms of this License. -</p> -<p>g.<strong>"Original Author"</strong>means, in the case of a literary or artistic work, the - individual, individuals, entity or entities who created the Work or if no individual or entity - can be identified, the publisher; and in addition (i) in the case of a performance the actors, - singers, musicians, dancers, and other persons who act, sing, deliver, declaim, play in, - interpret or otherwise perform literary or artistic works or expressions of folklore; (ii) in - the case of a phonogram the producer being the person or legal entity who first fixes the sounds - of a performance or other sounds; and, (iii) in the case of broadcasts, the organization that - transmits the broadcast. -</p> -<p>h.<strong>"Work"</strong>means the literary and/or artistic work offered under the terms of this - License including without limitation any production in the literary, scientific and artistic - domain, whatever may be the mode or form of its expression including digital form, such as a - book, pamphlet and other writing; a lecture, address, sermon or other work of the same nature; a - dramatic or dramatico-musical work; a choreographic work or entertainment in dumb show; a - musical composition with or without words; a cinematographic work to which are assimilated works - expressed by a process analogous to cinematography; a work of drawing, painting, architecture, - sculpture, engraving or lithography; a photographic work to which are assimilated works - expressed by a process analogous to photography; a work of applied art; an illustration, map, - plan, sketch or three-dimensional work relative to geography, topography, architecture or - science; a performance; a broadcast; a phonogram; a compilation of data to the extent it is - protected as a copyrightable work; or a work performed by a variety or circus performer to the - extent it is not otherwise considered a literary or artistic work. -</p> -<p>i.<strong>"You"</strong>means an individual or entity exercising rights under this License who - has not previously violated the terms of this License with respect to the Work, or who has - received express permission from the Licensor to exercise rights under this License despite a - previous violation. -</p> -<p>j.<strong>"Publicly Perform"</strong>means to perform public recitations of the Work and to - communicate to the public those public recitations, by any means or process, including by wire - or wireless means or public digital performances; to make available to the public Works in such - a way that members of the public may access these Works from a place and at a place individually - chosen by them; to perform the Work to the public by any means or process and the communication - to the public of the performances of the Work, including by public digital performance; to - broadcast and rebroadcast the Work by any means including signs, sounds or images. -</p> -<p>k.<strong>"Reproduce"</strong>means to make copies of the Work by any means including without - limitation by sound or visual recordings and the right of fixation and reproducing fixations of - the Work, including storage of a protected performance or phonogram in digital form or other - electronic medium. -</p> -<p><strong>2. Fair Dealing Rights.</strong>Nothing in this License is intended to reduce, limit, or - restrict any uses free from copyright or rights arising from limitations or exceptions that are - provided for in connection with the copyright protection under copyright law or other applicable - laws. -</p> -<p><strong>3. License Grant.</strong>Subject to the terms and conditions of this License, Licensor - hereby grants You a worldwide, royalty-free, non-exclusive, perpetual (for the duration of the - applicable copyright) license to exercise the rights in the Work as stated below: -</p> -<p>a. to Reproduce the Work, to incorporate the Work into one or more Collections, and to Reproduce - the Work as incorporated in the Collections; -</p> -<p>b. to create and Reproduce Adaptations provided that any such Adaptation, including any - translation in any medium, takes reasonable steps to clearly label, demarcate or otherwise - identify that changes were made to the original Work. For example, a translation could be marked - "The original work was translated from English to Spanish," or a modification could indicate - "The original work has been modified."; -</p> -<p>c. to Distribute and Publicly Perform the Work including as incorporated in Collections; and,</p> -<p>d. to Distribute and Publicly Perform Adaptations.</p> -<p>e. For the avoidance of doubt:</p> -<p>i.<strong>Non-waivable Compulsory License Schemes</strong>. In those jurisdictions in which the - right to collect royalties through any statutory or compulsory licensing scheme cannot be - waived, the Licensor reserves the exclusive right to collect such royalties for any exercise by - You of the rights granted under this License; -</p> -<p>ii.<strong>Waivable Compulsory License Schemes</strong>. In those jurisdictions in which the - right to collect royalties through any statutory or compulsory licensing scheme can be waived, - the Licensor waives the exclusive right to collect such royalties for any exercise by You of the - rights granted under this License; and, -</p> -<p>iii.<strong>Voluntary License Schemes</strong>. The Licensor waives the right to collect - royalties, whether individually or, in the event that the Licensor is a member of a collecting - society that administers voluntary licensing schemes, via that society, from any exercise by You - of the rights granted under this License. -</p> -<p>The above rights may be exercised in all media and formats whether now known or hereafter - devised. The above rights include the right to make such modifications as are technically - necessary to exercise the rights in other media and formats. Subject to Section 8(f), all rights - not expressly granted by Licensor are hereby reserved. -</p> -<p><strong>4. Restrictions.</strong>The license granted in Section 3 above is expressly made subject - to and limited by the following restrictions: -</p> -<p>a. You may Distribute or Publicly Perform the Work only under the terms of this License. You must - include a copy of, or the Uniform Resource Identifier (URI) for, this License with every copy of - the Work You Distribute or Publicly Perform. You may not offer or impose any terms on the Work - that restrict the terms of this License or the ability of the recipient of the Work to exercise - the rights granted to that recipient under the terms of the License. You may not sublicense the - Work. You must keep intact all notices that refer to this License and to the disclaimer of - warranties with every copy of the Work You Distribute or Publicly Perform. When You Distribute - or Publicly Perform the Work, You may not impose any effective technological measures on the - Work that restrict the ability of a recipient of the Work from You to exercise the rights - granted to that recipient under the terms of the License. This Section 4(a) applies to the Work - as incorporated in a Collection, but this does not require the Collection apart from the Work - itself to be made subject to the terms of this License. If You create a Collection, upon notice - from any Licensor You must, to the extent practicable, remove from the Collection any credit as - required by Section 4(c), as requested. If You create an Adaptation, upon notice from any - Licensor You must, to the extent practicable, remove from the Adaptation any credit as required - by Section 4(c), as requested. -</p> -<p>b. You may Distribute or Publicly Perform an Adaptation only under the terms of: (i) this - License; (ii) a later version of this License with the same License Elements as this License; - (iii) a Creative Commons jurisdiction license (either this or a later license version) that - contains the same License Elements as this License (e.g., Attribution-ShareAlike 3.0 US)); (iv) - a Creative Commons Compatible License. If you license the Adaptation under one of the licenses - mentioned in (iv), you must comply with the terms of that license. If you license the Adaptation - under the terms of any of the licenses mentioned in (i), (ii) or (iii) (the "Applicable - License"), you must comply with the terms of the Applicable License generally and the following - provisions: (I) You must include a copy of, or the URI for, the Applicable License with every - copy of each Adaptation You Distribute or Publicly Perform; (II) You may not offer or impose any - terms on the Adaptation that restrict the terms of the Applicable License or the ability of the - recipient of the Adaptation to exercise the rights granted to that recipient under the terms of - the Applicable License; (III) You must keep intact all notices that refer to the Applicable - License and to the disclaimer of warranties with every copy of the Work as included in the - Adaptation You Distribute or Publicly Perform; (IV) when You Distribute or Publicly Perform the - Adaptation, You may not impose any effective technological measures on the Adaptation that - restrict the ability of a recipient of the Adaptation from You to exercise the rights granted to - that recipient under the terms of the Applicable License. This Section 4(b) applies to the - Adaptation as incorporated in a Collection, but this does not require the Collection apart from - the Adaptation itself to be made subject to the terms of the Applicable License. -</p> -<p>c. If You Distribute, or Publicly Perform the Work or any Adaptations or Collections, You must, - unless a request has been made pursuant to Section 4(a), keep intact all copyright notices for - the Work and provide, reasonable to the medium or means You are utilizing: (i) the name of the - Original Author (or pseudonym, if applicable) if supplied, and/or if the Original Author and/or - Licensor designate another party or parties (e.g., a sponsor institute, publishing entity, - journal) for attribution ("Attribution Parties") in Licensor\'s copyright notice, terms of - service or by other reasonable means, the name of such party or parties; (ii) the title of the - Work if supplied; (iii) to the extent reasonably practicable, the URI, if any, that Licensor - specifies to be associated with the Work, unless such URI does not refer to the copyright notice - or licensing information for the Work; and (iv) , consistent with Ssection 3(b), in the case of - an Adaptation, a credit identifying the use of the Work in the Adaptation (e.g., "French - translation of the Work by Original Author," or "Screenplay based on original Work by Original - Author"). The credit required by this Section 4(c) may be implemented in any reasonable manner; - provided, however, that in the case of a Adaptation or Collection, at a minimum such credit will - appear, if a credit for all contributing authors of the Adaptation or Collection appears, then - as part of these credits and in a manner at least as prominent as the credits for the other - contributing authors. For the avoidance of doubt, You may only use the credit required by this - Section for the purpose of attribution in the manner set out above and, by exercising Your - rights under this License, You may not implicitly or explicitly assert or imply any connection - with, sponsorship or endorsement by the Original Author, Licensor and/or Attribution Parties, as - appropriate, of You or Your use of the Work, without the separate, express prior written - permission of the Original Author, Licensor and/or Attribution Parties. -</p> -<p>d. Except as otherwise agreed in writing by the Licensor or as may be otherwise permitted by - applicable law, if You Reproduce, Distribute or Publicly Perform the Work either by itself or as - part of any Adaptations or Collections, You must not distort, mutilate, modify or take other - derogatory action in relation to the Work which would be prejudicial to the Original Author\'s - honor or reputation. Licensor agrees that in those jurisdictions (e.g. Japan), in which any - exercise of the right granted in Section 3(b) of this License (the right to make Adaptations) - would be deemed to be a distortion, mutilation, modification or other derogatory action - prejudicial to the Original Author\'s honor and reputation, the Licensor will waive or not - assert, as appropriate, this Section, to the fullest extent permitted by the applicable national - law, to enable You to reasonably exercise Your right under Section 3(b) of this License (right - to make Adaptations) but not otherwise. -</p> -<p> - <strong>5. Representations, Warranties and Disclaimer</strong> -</p> -<p>UNLESS OTHERWISE MUTUALLY AGREED TO BY THE PARTIES IN WRITING, LICENSOR OFFERS THE WORK AS-IS AND - MAKES NO REPRESENTATIONS OR WARRANTIES OF ANY KIND CONCERNING THE WORK, EXPRESS, IMPLIED, - STATUTORY OR OTHERWISE, INCLUDING, WITHOUT LIMITATION, WARRANTIES OF TITLE, MERCHANTIBILITY, - FITNESS FOR A PARTICULAR PURPOSE, NONINFRINGEMENT, OR THE ABSENCE OF LATENT OR OTHER DEFECTS, - ACCURACY, OR THE PRESENCE OF ABSENCE OF ERRORS, WHETHER OR NOT DISCOVERABLE. SOME JURISDICTIONS - DO NOT ALLOW THE EXCLUSION OF IMPLIED WARRANTIES, SO SUCH EXCLUSION MAY NOT APPLY TO YOU. -</p> -<p><strong>6. Limitation on Liability.</strong>EXCEPT TO THE EXTENT REQUIRED BY APPLICABLE LAW, IN - NO EVENT WILL LICENSOR BE LIABLE TO YOU ON ANY LEGAL THEORY FOR ANY SPECIAL, INCIDENTAL, - CONSEQUENTIAL, PUNITIVE OR EXEMPLARY DAMAGES ARISING OUT OF THIS LICENSE OR THE USE OF THE WORK, - EVEN IF LICENSOR HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. -</p> -<p> - <strong>7. Termination</strong> -</p> -<p>a. This License and the rights granted hereunder will terminate automatically upon any breach by - You of the terms of this License. Individuals or entities who have received Adaptations or - Collections from You under this License, however, will not have their licenses terminated - provided such individuals or entities remain in full compliance with those licenses. Sections 1, - 2, 5, 6, 7, and 8 will survive any termination of this License. -</p> -<p>b. Subject to the above terms and conditions, the license granted here is perpetual (for the - duration of the applicable copyright in the Work). Notwithstanding the above, Licensor reserves - the right to release the Work under different license terms or to stop distributing the Work at - any time; provided, however that any such election will not serve to withdraw this License (or - any other license that has been, or is required to be, granted under the terms of this License), - and this License will continue in full force and effect unless terminated as stated above. -</p> -<p> - <strong>8. Miscellaneous</strong> -</p> -<p>a. Each time You Distribute or Publicly Perform the Work or a Collection, the Licensor offers to - the recipient a license to the Work on the same terms and conditions as the license granted to - You under this License. -</p> -<p>b. Each time You Distribute or Publicly Perform an Adaptation, Licensor offers to the recipient a - license to the original Work on the same terms and conditions as the license granted to You - under this License. -</p> -<p>c. If any provision of this License is invalid or unenforceable under applicable law, it shall - not affect the validity or enforceability of the remainder of the terms of this License, and - without further action by the parties to this agreement, such provision shall be reformed to the - minimum extent necessary to make such provision valid and enforceable. -</p> -<p>d. No term or provision of this License shall be deemed waived and no breach consented to unless - such waiver or consent shall be in writing and signed by the party to be charged with such - waiver or consent. -</p> -<p>e. This License constitutes the entire agreement between the parties with respect to the Work - licensed here. There are no understandings, agreements or representations with respect to the - Work not specified here. Licensor shall not be bound by any additional provisions that may - appear in any communication from You. This License may not be modified without the mutual - written agreement of the Licensor and You. -</p> -<p>f. The rights granted under, and the subject matter referenced, in this License were drafted - utilizing the terminology of the Berne Convention for the Protection of Literary and Artistic - Works (as amended on September 28, 1979), the Rome Convention of 1961, the WIPO Copyright Treaty - of 1996, the WIPO Performances and Phonograms Treaty of 1996 and the Universal Copyright - Convention (as revised on July 24, 1971). These rights and subject matter take effect in the - relevant jurisdiction in which the License terms are sought to be enforced according to the - corresponding provisions of the implementation of those treaty provisions in the applicable - national law. If the standard suite of rights granted under applicable copyright law includes - additional rights not granted under this License, such additional rights are deemed to be - included in the License; this License is not intended to restrict the license of any rights - under applicable law. -</p> diff --git a/app/src/main/res/raw/license_dracula.html b/app/src/main/res/raw/license_dracula.html deleted file mode 100644 index 68eea128fd7c7544ec97ee316d806acb2c41b9ea..0000000000000000000000000000000000000000 --- a/app/src/main/res/raw/license_dracula.html +++ /dev/null @@ -1,36 +0,0 @@ -<!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<h2>The MIT License (MIT)</h2> -<p>Copyright (c) 2016 Dracula Theme</p> -<p>Permission is hereby granted, free of charge, to any person obtaining a copy of this software and - associated documentation files (the "Software"), to deal in the Software without restriction, - including without limitation the rights to use, copy, modify, merge, publish, distribute, - sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is - furnished to do so, subject to the following conditions: -</p> -<p>The above copyright notice and this permission notice shall be included in all copies or - substantial portions of the Software. -</p> -<p>THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT - NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, - DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -</p> diff --git a/app/src/main/res/raw/license_emojijava.html b/app/src/main/res/raw/license_emojijava.html deleted file mode 100644 index f71b217933b9974deda5eb75fd51590024fb53a3..0000000000000000000000000000000000000000 --- a/app/src/main/res/raw/license_emojijava.html +++ /dev/null @@ -1,36 +0,0 @@ -<!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<h2>The MIT License (MIT)</h2> -<p>Copyright (c) 2014-present Vincent DURMONT vdurmont@gmail.com</p> -<p>Permission is hereby granted, free of charge, to any person obtaining a copy of this software and - associated documentation files (the "Software"), to deal in the Software without restriction, - including without limitation the rights to use, copy, modify, merge, publish, distribute, - sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is - furnished to do so, subject to the following conditions: -</p> -<p>The above copyright notice and this permission notice shall be included in all copies or - substantial portions of the Software. -</p> -<p>THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT - NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, - DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -</p> diff --git a/app/src/main/res/raw/license_gpl_v3.html b/app/src/main/res/raw/license_gpl_v3.html deleted file mode 100644 index f9dddcdce286863ee4f1123a99331d2781cc3496..0000000000000000000000000000000000000000 --- a/app/src/main/res/raw/license_gpl_v3.html +++ /dev/null @@ -1,498 +0,0 @@ -<!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<h2>GNU GENERAL PUBLIC LICENSE</h2> -<h2>Version 3, 29 June 2007</h2> -<p>Copyright © 2007 Free Software Foundation, Inc. <<a href="https://fsf.org/"> - https://fsf.org/</a>> -</p> -<p>Everyone is permitted to copy and distribute verbatim copies of this license document, but - changing it is not allowed. -</p> -<h3>Preamble</h3> -<p>The GNU General Public License is a free, copyleft license for software and other kinds of - works. -</p> -<p>The licenses for most software and other practical works are designed to take away your freedom - to share and change the works. By contrast, the GNU General Public License is intended to - guarantee your freedom to share and change all versions of a program--to make sure it remains - free software for all its users. We, the Free Software Foundation, use the GNU General Public - License for most of our software; it applies also to any other work released this way by its - authors. You can apply it to your programs, too. -</p> -<p>When we speak of free software, we are referring to freedom, not price. Our General Public - Licenses are designed to make sure that you have the freedom to distribute copies of free - software (and charge for them if you wish), that you receive source code or can get it if you - want it, that you can change the software or use pieces of it in new free programs, and that you - know you can do these things. -</p> -<p>To protect your rights, we need to prevent others from denying you these rights or asking you to - surrender the rights. Therefore, you have certain responsibilities if you distribute copies of - the software, or if you modify it: responsibilities to respect the freedom of others. -</p> -<p>For example, if you distribute copies of such a program, whether gratis or for a fee, you must - pass on to the recipients the same freedoms that you received. You must make sure that they, - too, receive or can get the source code. And you must show them these terms so they know their - rights. -</p> -<p>Developers that use the GNU GPL protect your rights with two steps: (1) assert copyright on the - software, and (2) offer you this License giving you legal permission to copy, distribute and/or - modify it. -</p> -<p>For the developers' and authors' protection, the GPL clearly explains that there is no - warranty for this free software. For both users' and authors' sake, the GPL requires - that modified versions be marked as changed, so that their problems will not be attributed - erroneously to authors of previous versions. -</p> -<p>Some devices are designed to deny users access to install or run modified versions of the - software inside them, although the manufacturer can do so. This is fundamentally incompatible - with the aim of protecting users' freedom to change the software. The systematic pattern of - such abuse occurs in the area of products for individuals to use, which is precisely where it is - most unacceptable. Therefore, we have designed this version of the GPL to prohibit the practice - for those products. If such problems arise substantially in other domains, we stand ready to - extend this provision to those domains in future versions of the GPL, as needed to protect the - freedom of users. -</p> -<p>Finally, every program is threatened constantly by software patents. States should not allow - patents to restrict development and use of software on general-purpose computers, but in those - that do, we wish to avoid the special danger that patents applied to a free program could make - it effectively proprietary. To prevent this, the GPL assures that patents cannot be used to - render the program non-free. -</p> -<p>The precise terms and conditions for copying, distribution and modification follow.</p> -<h3>TERMS AND CONDITIONS</h3> -<h4>0. Definitions.</h4> -<p>“This License” refers to version 3 of the GNU General Public License.</p> -<p>“Copyright” also means copyright-like laws that apply to other kinds of works, such as - semiconductor masks. -</p> -<p>“The Program” refers to any copyrightable work licensed under this License. Each licensee is - addressed as “you”. “Licensees” and “recipients” may be individuals or organizations. -</p> -<p>To “modify” a work means to copy from or adapt all or part of the work in a fashion requiring - copyright permission, other than the making of an exact copy. The resulting work is called a - “modified version” of the earlier work or a work “based on” the earlier work. -</p> -<p>A “covered work” means either the unmodified Program or a work based on the Program.</p> -<p>To “propagate” a work means to do anything with it that, without permission, would make you - directly or secondarily liable for infringement under applicable copyright law, except executing - it on a computer or modifying a private copy. Propagation includes copying, distribution (with - or without modification), making available to the public, and in some countries other activities - as well. -</p> -<p>To “convey” a work means any kind of propagation that enables other parties to make or receive - copies. Mere interaction with a user through a computer network, with no transfer of a copy, is - not conveying. -</p> -<p>An interactive user interface displays “Appropriate Legal Notices” to the extent that it includes - a convenient and prominently visible feature that (1) displays an appropriate copyright notice, - and (2) tells the user that there is no warranty for the work (except to the extent that - warranties are provided), that licensees may convey the work under this License, and how to view - a copy of this License. If the interface presents a list of user commands or options, such as a - menu, a prominent item in the list meets this criterion. -</p> -<h4>1. Source Code.</h4> -<p>The “source code” for a work means the preferred form of the work for making modifications to it. - “Object code” means any non-source form of a work. -</p> -<p>A “Standard Interface” means an interface that either is an official standard defined by a - recognized standards body, or, in the case of interfaces specified for a particular programming - language, one that is widely used among developers working in that language. -</p> -<p>The “System Libraries” of an executable work include anything, other than the work as a whole, - that (a) is included in the normal form of packaging a Major Component, but which is not part of - that Major Component, and (b) serves only to enable use of the work with that Major Component, - or to implement a Standard Interface for which an implementation is available to the public in - source code form. A “Major Component”, in this context, means a major essential component - (kernel, window system, and so on) of the specific operating system (if any) on which the - executable work runs, or a compiler used to produce the work, or an object code interpreter used - to run it. -</p> -<p>The “Corresponding Source” for a work in object code form means all the source code needed to - generate, install, and (for an executable work) run the object code and to modify the work, - including scripts to control those activities. However, it does not include the work's - System Libraries, or general-purpose tools or generally available free programs which are used - unmodified in performing those activities but which are not part of the work. For example, - Corresponding Source includes interface definition files associated with source files for the - work, and the source code for shared libraries and dynamically linked subprograms that the work - is specifically designed to require, such as by intimate data communication or control flow - between those subprograms and other parts of the work. -</p> -<p>The Corresponding Source need not include anything that users can regenerate automatically from - other parts of the Corresponding Source. -</p> -<p>The Corresponding Source for a work in source code form is that same work.</p> -<h4>2. Basic Permissions.</h4> -<p>All rights granted under this License are granted for the term of copyright on the Program, and - are irrevocable provided the stated conditions are met. This License explicitly affirms your - unlimited permission to run the unmodified Program. The output from running a covered work is - covered by this License only if the output, given its content, constitutes a covered work. This - License acknowledges your rights of fair use or other equivalent, as provided by copyright law. -</p> -<p>You may make, run and propagate covered works that you do not convey, without conditions so long - as your license otherwise remains in force. You may convey covered works to others for the sole - purpose of having them make modifications exclusively for you, or provide you with facilities - for running those works, provided that you comply with the terms of this License in conveying - all material for which you do not control copyright. Those thus making or running the covered - works for you must do so exclusively on your behalf, under your direction and control, on terms - that prohibit them from making any copies of your copyrighted material outside their - relationship with you. -</p> -<p>Conveying under any other circumstances is permitted solely under the conditions stated below. - Sublicensing is not allowed; section 10 makes it unnecessary. -</p> -<h4>3. Protecting Users' Legal Rights From Anti-Circumvention Law.</h4> -<p>No covered work shall be deemed part of an effective technological measure under any applicable - law fulfilling obligations under article 11 of the WIPO copyright treaty adopted on 20 December - 1996, or similar laws prohibiting or restricting circumvention of such measures. -</p> -<p>When you convey a covered work, you waive any legal power to forbid circumvention of - technological measures to the extent such circumvention is effected by exercising rights under - this License with respect to the covered work, and you disclaim any intention to limit operation - or modification of the work as a means of enforcing, against the work's users, your or - third parties' legal rights to forbid circumvention of technological measures. -</p> -<h4>4. Conveying Verbatim Copies.</h4> -<p>You may convey verbatim copies of the Program's source code as you receive it, in any - medium, provided that you conspicuously and appropriately publish on each copy an appropriate - copyright notice; keep intact all notices stating that this License and any non-permissive terms - added in accord with section 7 apply to the code; keep intact all notices of the absence of any - warranty; and give all recipients a copy of this License along with the Program. -</p> -<p>You may charge any price or no price for each copy that you convey, and you may offer support or - warranty protection for a fee. -</p> -<h4>5. Conveying Modified Source Versions.</h4> -<p>You may convey a work based on the Program, or the modifications to produce it from the Program, - in the form of source code under the terms of section 4, provided that you also meet all of - these conditions: -</p> -<p>a) The work must carry prominent notices stating that you modified it, and giving a relevant - date. -</p> -<p>b) The work must carry prominent notices stating that it is released under this License and any - conditions added under section 7. This requirement modifies the requirement in section 4 to - “keep intact all notices”. -</p> -<p>c) You must license the entire work, as a whole, under this License to anyone who comes into - possession of a copy. This License will therefore apply, along with any applicable section 7 - additional terms, to the whole of the work, and all its parts, regardless of how they are - packaged. This License gives no permission to license the work in any other way, but it does not - invalidate such permission if you have separately received it. -</p> -<p>d) If the work has interactive user interfaces, each must display Appropriate Legal Notices; - however, if the Program has interactive interfaces that do not display Appropriate Legal - Notices, your work need not make them do so. -</p> -<p>A compilation of a covered work with other separate and independent works, which are not by their - nature extensions of the covered work, and which are not combined with it such as to form a - larger program, in or on a volume of a storage or distribution medium, is called an “aggregate” - if the compilation and its resulting copyright are not used to limit the access or legal rights - of the compilation's users beyond what the individual works permit. Inclusion of a covered - work in an aggregate does not cause this License to apply to the other parts of the aggregate. -</p> -<h4>6. Conveying Non-Source Forms.</h4> -<p>You may convey a covered work in object code form under the terms of sections 4 and 5, provided - that you also convey the machine-readable Corresponding Source under the terms of this License, - in one of these ways: -</p> -<p>a) Convey the object code in, or embodied in, a physical product (including a physical - distribution medium), accompanied by the Corresponding Source fixed on a durable physical medium - customarily used for software interchange. -</p> -<p>b) Convey the object code in, or embodied in, a physical product (including a physical - distribution medium), accompanied by a written offer, valid for at least three years and valid - for as long as you offer spare parts or customer support for that product model, to give anyone - who possesses the object code either (1) a copy of the Corresponding Source for all the software - in the product that is covered by this License, on a durable physical medium customarily used - for software interchange, for a price no more than your reasonable cost of physically performing - this conveying of source, or (2) access to copy the Corresponding Source from a network server - at no charge. -</p> -<p>c) Convey individual copies of the object code with a copy of the written offer to provide the - Corresponding Source. This alternative is allowed only occasionally and noncommercially, and - only if you received the object code with such an offer, in accord with subsection 6b. -</p> -<p>d) Convey the object code by offering access from a designated place (gratis or for a charge), - and offer equivalent access to the Corresponding Source in the same way through the same place - at no further charge. You need not require recipients to copy the Corresponding Source along - with the object code. If the place to copy the object code is a network server, the - Corresponding Source may be on a different server (operated by you or a third party) that - supports equivalent copying facilities, provided you maintain clear directions next to the - object code saying where to find the Corresponding Source. Regardless of what server hosts the - Corresponding Source, you remain obligated to ensure that it is available for as long as needed - to satisfy these requirements. -</p> -<p>e) Convey the object code using peer-to-peer transmission, provided you inform other peers where - the object code and Corresponding Source of the work are being offered to the general public at - no charge under subsection 6d. -</p> -<p>A separable portion of the object code, whose source code is excluded from the Corresponding - Source as a System Library, need not be included in conveying the object code work. -</p> -<p>A “User Product” is either (1) a “consumer product”, which means any tangible personal property - which is normally used for personal, family, or household purposes, or (2) anything designed or - sold for incorporation into a dwelling. In determining whether a product is a consumer product, - doubtful cases shall be resolved in favor of coverage. For a particular product received by a - particular user, “normally used” refers to a typical or common use of that class of product, - regardless of the status of the particular user or of the way in which the particular user - actually uses, or expects or is expected to use, the product. A product is a consumer product - regardless of whether the product has substantial commercial, industrial or non-consumer uses, - unless such uses represent the only significant mode of use of the product. -</p> -<p>“Installation Information” for a User Product means any methods, procedures, authorization keys, - or other information required to install and execute modified versions of a covered work in that - User Product from a modified version of its Corresponding Source. The information must suffice - to ensure that the continued functioning of the modified object code is in no case prevented or - interfered with solely because modification has been made. -</p> -<p>If you convey an object code work under this section in, or with, or specifically for use in, a - User Product, and the conveying occurs as part of a transaction in which the right of possession - and use of the User Product is transferred to the recipient in perpetuity or for a fixed term - (regardless of how the transaction is characterized), the Corresponding Source conveyed under - this section must be accompanied by the Installation Information. But this requirement does not - apply if neither you nor any third party retains the ability to install modified object code on - the User Product (for example, the work has been installed in ROM). -</p> -<p>The requirement to provide Installation Information does not include a requirement to continue to - provide support service, warranty, or updates for a work that has been modified or installed by - the recipient, or for the User Product in which it has been modified or installed. Access to a - network may be denied when the modification itself materially and adversely affects the - operation of the network or violates the rules and protocols for communication across the - network. -</p> -<p>Corresponding Source conveyed, and Installation Information provided, in accord with this section - must be in a format that is publicly documented (and with an implementation available to the - public in source code form), and must require no special password or key for unpacking, reading - or copying. -</p> -<h4>7. Additional Terms.</h4> -<p>“Additional permissions” are terms that supplement the terms of this License by making exceptions - from one or more of its conditions. Additional permissions that are applicable to the entire - Program shall be treated as though they were included in this License, to the extent that they - are valid under applicable law. If additional permissions apply only to part of the Program, - that part may be used separately under those permissions, but the entire Program remains - governed by this License without regard to the additional permissions. -</p> -<p>When you convey a copy of a covered work, you may at your option remove any additional - permissions from that copy, or from any part of it. (Additional permissions may be written to - require their own removal in certain cases when you modify the work.) You may place additional - permissions on material, added by you to a covered work, for which you have or can give - appropriate copyright permission. -</p> -<p>Notwithstanding any other provision of this License, for material you add to a covered work, you - may (if authorized by the copyright holders of that material) supplement the terms of this - License with terms: -</p> -<p>a) Disclaiming warranty or limiting liability differently from the terms of sections 15 and 16 of - this License; or -</p> -<p>b) Requiring preservation of specified reasonable legal notices or author attributions in that - material or in the Appropriate Legal Notices displayed by works containing it; or -</p> -<p>c) Prohibiting misrepresentation of the origin of that material, or requiring that modified - versions of such material be marked in reasonable ways as different from the original version; - or -</p> -<p>d) Limiting the use for publicity purposes of names of licensors or authors of the material; or -</p> -<p>e) Declining to grant rights under trademark law for use of some trade names, trademarks, or - service marks; or -</p> -<p>f) Requiring indemnification of licensors and authors of that material by anyone who conveys the - material (or modified versions of it) with contractual assumptions of liability to the - recipient, for any liability that these contractual assumptions directly impose on those - licensors and authors. -</p> -<p>All other non-permissive additional terms are considered “further restrictions” within the - meaning of section 10. If the Program as you received it, or any part of it, contains a notice - stating that it is governed by this License along with a term that is a further restriction, you - may remove that term. If a license document contains a further restriction but permits - relicensing or conveying under this License, you may add to a covered work material governed by - the terms of that license document, provided that the further restriction does not survive such - relicensing or conveying. -</p> -<p>If you add terms to a covered work in accord with this section, you must place, in the relevant - source files, a statement of the additional terms that apply to those files, or a notice - indicating where to find the applicable terms. -</p> -<p>Additional terms, permissive or non-permissive, may be stated in the form of a separately written - license, or stated as exceptions; the above requirements apply either way. -</p> -<h4>8. Termination.</h4> -<p>You may not propagate or modify a covered work except as expressly provided under this License. - Any attempt otherwise to propagate or modify it is void, and will automatically terminate your - rights under this License (including any patent licenses granted under the third paragraph of - section 11). -</p> -<p>However, if you cease all violation of this License, then your license from a particular - copyright holder is reinstated (a) provisionally, unless and until the copyright holder - explicitly and finally terminates your license, and (b) permanently, if the copyright holder - fails to notify you of the violation by some reasonable means prior to 60 days after the - cessation. -</p> -<p>Moreover, your license from a particular copyright holder is reinstated permanently if the - copyright holder notifies you of the violation by some reasonable means, this is the first time - you have received notice of violation of this License (for any work) from that copyright holder, - and you cure the violation prior to 30 days after your receipt of the notice. -</p> -<p>Termination of your rights under this section does not terminate the licenses of parties who have - received copies or rights from you under this License. If your rights have been terminated and - not permanently reinstated, you do not qualify to receive new licenses for the same material - under section 10. -</p> -<h4>9. Acceptance Not Required for Having Copies.</h4> -<p>You are not required to accept this License in order to receive or run a copy of the Program. - Ancillary propagation of a covered work occurring solely as a consequence of using peer-to-peer - transmission to receive a copy likewise does not require acceptance. However, nothing other than - this License grants you permission to propagate or modify any covered work. These actions - infringe copyright if you do not accept this License. Therefore, by modifying or propagating a - covered work, you indicate your acceptance of this License to do so. -</p> -<h4>10. Automatic Licensing of Downstream Recipients.</h4> -<p>Each time you convey a covered work, the recipient automatically receives a license from the - original licensors, to run, modify and propagate that work, subject to this License. You are not - responsible for enforcing compliance by third parties with this License. -</p> -<p>An “entity transaction” is a transaction transferring control of an organization, or - substantially all assets of one, or subdividing an organization, or merging organizations. If - propagation of a covered work results from an entity transaction, each party to that transaction - who receives a copy of the work also receives whatever licenses to the work the party's - predecessor in interest had or could give under the previous paragraph, plus a right to - possession of the Corresponding Source of the work from the predecessor in interest, if the - predecessor has it or can get it with reasonable efforts. -</p> -<p>You may not impose any further restrictions on the exercise of the rights granted or affirmed - under this License. For example, you may not impose a license fee, royalty, or other charge for - exercise of rights granted under this License, and you may not initiate litigation (including a - cross-claim or counterclaim in a lawsuit) alleging that any patent claim is infringed by making, - using, selling, offering for sale, or importing the Program or any portion of it. -</p> -<h4>11. Patents.</h4> -<p>A “contributor” is a copyright holder who authorizes use under this License of the Program or a - work on which the Program is based. The work thus licensed is called the contributor's - “contributor version”. -</p> -<p>A contributor's “essential patent claims” are all patent claims owned or controlled by the - contributor, whether already acquired or hereafter acquired, that would be infringed by some - manner, permitted by this License, of making, using, or selling its contributor version, but do - not include claims that would be infringed only as a consequence of further modification of the - contributor version. For purposes of this definition, “control” includes the right to grant - patent sublicenses in a manner consistent with the requirements of this License. -</p> -<p>Each contributor grants you a non-exclusive, worldwide, royalty-free patent license under the - contributor's essential patent claims, to make, use, sell, offer for sale, import and - otherwise run, modify and propagate the contents of its contributor version. -</p> -<p>In the following three paragraphs, a “patent license” is any express agreement or commitment, - however denominated, not to enforce a patent (such as an express permission to practice a patent - or covenant not to sue for patent infringement). To “grant” such a patent license to a party - means to make such an agreement or commitment not to enforce a patent against the party. -</p> -<p>If you convey a covered work, knowingly relying on a patent license, and the Corresponding Source - of the work is not available for anyone to copy, free of charge and under the terms of this - License, through a publicly available network server or other readily accessible means, then you - must either (1) cause the Corresponding Source to be so available, or (2) arrange to deprive - yourself of the benefit of the patent license for this particular work, or (3) arrange, in a - manner consistent with the requirements of this License, to extend the patent license to - downstream recipients. “Knowingly relying” means you have actual knowledge that, but for the - patent license, your conveying the covered work in a country, or your recipient's use of - the covered work in a country, would infringe one or more identifiable patents in that country - that you have reason to believe are valid. -</p> -<p>If, pursuant to or in connection with a single transaction or arrangement, you convey, or - propagate by procuring conveyance of, a covered work, and grant a patent license to some of the - parties receiving the covered work authorizing them to use, propagate, modify or convey a - specific copy of the covered work, then the patent license you grant is automatically extended - to all recipients of the covered work and works based on it. -</p> -<p>A patent license is “discriminatory” if it does not include within the scope of its coverage, - prohibits the exercise of, or is conditioned on the non-exercise of one or more of the rights - that are specifically granted under this License. You may not convey a covered work if you are a - party to an arrangement with a third party that is in the business of distributing software, - under which you make payment to the third party based on the extent of your activity of - conveying the work, and under which the third party grants, to any of the parties who would - receive the covered work from you, a discriminatory patent license (a) in connection with copies - of the covered work conveyed by you (or copies made from those copies), or (b) primarily for and - in connection with specific products or compilations that contain the covered work, unless you - entered into that arrangement, or that patent license was granted, prior to 28 March 2007. -</p> -<p>Nothing in this License shall be construed as excluding or limiting any implied license or other - defenses to infringement that may otherwise be available to you under applicable patent law. -</p> -<h4>12. No Surrender of Others' Freedom.</h4> -<p>If conditions are imposed on you (whether by court order, agreement or otherwise) that contradict - the conditions of this License, they do not excuse you from the conditions of this License. If - you cannot convey a covered work so as to satisfy simultaneously your obligations under this - License and any other pertinent obligations, then as a consequence you may not convey it at all. - For example, if you agree to terms that obligate you to collect a royalty for further conveying - from those to whom you convey the Program, the only way you could satisfy both those terms and - this License would be to refrain entirely from conveying the Program. -</p> -<h4>13. Use with the GNU Affero General Public License.</h4> -<p>Notwithstanding any other provision of this License, you have permission to link or combine any - covered work with a work licensed under version 3 of the GNU Affero General Public License into - a single combined work, and to convey the resulting work. The terms of this License will - continue to apply to the part which is the covered work, but the special requirements of the GNU - Affero General Public License, section 13, concerning interaction through a network will apply - to the combination as such. -</p> -<h4>14. Revised Versions of this License.</h4> -<p>The Free Software Foundation may publish revised and/or new versions of the GNU General Public - License from time to time. Such new versions will be similar in spirit to the present version, - but may differ in detail to address new problems or concerns. -</p> -<p>Each version is given a distinguishing version number. If the Program specifies that a certain - numbered version of the GNU General Public License “or any later version” applies to it, you - have the option of following the terms and conditions either of that numbered version or of any - later version published by the Free Software Foundation. If the Program does not specify a - version number of the GNU General Public License, you may choose any version ever published by - the Free Software Foundation. -</p> -<p>If the Program specifies that a proxy can decide which future versions of the GNU General Public - License can be used, that proxy's public statement of acceptance of a version permanently - authorizes you to choose that version for the Program. -</p> -<p>Later license versions may give you additional or different permissions. However, no additional - obligations are imposed on any author or copyright holder as a result of your choosing to follow - a later version. -</p> -<h4>15. Disclaimer of Warranty.</h4> -<p>THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN - OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM “AS - IS” WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, - THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK - AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE - DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. -</p> -<h4>16. Limitation of Liability.</h4> -<p>IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, - OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU - FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF - THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING - RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO - OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE - POSSIBILITY OF SUCH DAMAGES. -</p> -<h4>17. Interpretation of Sections 15 and 16.</h4> -<p>If the disclaimer of warranty and limitation of liability provided above cannot be given local - legal effect according to their terms, reviewing courts shall apply local law that most closely - approximates an absolute waiver of all civil liability in connection with the Program, unless a - warranty or assumption of liability accompanies a copy of the Program in return for a fee. -</p> diff --git a/app/src/main/res/raw/license_gruvbox.html b/app/src/main/res/raw/license_gruvbox.html deleted file mode 100644 index 613ad039a4cd091403df15ed88df375453fc5556..0000000000000000000000000000000000000000 --- a/app/src/main/res/raw/license_gruvbox.html +++ /dev/null @@ -1,35 +0,0 @@ -<!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<h2>The MIT License (MIT)</h2> -<p>Permission is hereby granted, free of charge, to any person obtaining a copy of this software and - associated documentation files (the "Software"), to deal in the Software without restriction, - including without limitation the rights to use, copy, modify, merge, publish, distribute, - sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is - furnished to do so, subject to the following conditions: -</p> -<p>The above copyright notice and this permission notice shall be included in all copies or - substantial portions of the Software. -</p> -<p>THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT - NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, - DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -</p> diff --git a/app/src/main/res/raw/license_materialdesignicons.html b/app/src/main/res/raw/license_materialdesignicons.html deleted file mode 100644 index ddf0184517fb7848d2d801374f0e202476aff525..0000000000000000000000000000000000000000 --- a/app/src/main/res/raw/license_materialdesignicons.html +++ /dev/null @@ -1,100 +0,0 @@ -<!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<p>Copyright (c) 2014, Austin Andrews (<a href="http://materialdesignicons.com/"> - http://materialdesignicons.com/</a>), with Reserved Font Name Material Design Icons. -</p> -<p>Copyright (c) 2014, Google (<a href="http://www.google.com/design/"> - http://www.google.com/design/</a>) uses the license at - <a href="https://github.com/google/material-design-icons/blob/master/LICENSE"> - https://github.com/google/material-design-icons/blob/master/LICENSE - </a> -</p> -<p>This Font Software is licensed under the SIL Open Font License, Version 1.1.</p> -<p>This license is copied below, and is also available with a FAQ at: - <a href="http://scripts.sil.org/OFL">http://scripts.sil.org/OFL</a> -</p> -<h2>SIL OPEN FONT LICENSE</h2> -<p>Version 1.1 - 26 February 2007</p> -<h3>PREAMBLE</h3> -<p>The goals of the Open Font License (OFL) are to stimulate worldwide development of collaborative - font projects, to support the font creation efforts of academic and linguistic communities, and - to provide a free and open framework in which fonts may be shared and improved in partnership - with others. -</p> -<p>The OFL allows the licensed fonts to be used, studied, modified and redistributed freely as long - as they are not sold by themselves. The fonts, including any derivative works, can be bundled, - embedded, redistributed and/or sold with any software provided that any reserved names are not - used by derivative works. The fonts and derivatives, however, cannot be released under any other - type of license. The requirement for fonts to remain under this license does not apply to any - document created using the fonts or their derivatives. -</p> -<h3>DEFINITIONS</h3> -<p>"Font Software" refers to the set of files released by the Copyright Holder(s) under this license - and clearly marked as such. This may include source files, build scripts and documentation. -</p> -<p>"Reserved Font Name" refers to any names specified as such after the copyright statement(s).</p> -<p>"Original Version" refers to the collection of Font Software components as distributed by the - Copyright Holder(s). -</p> -<p>"Modified Version" refers to any derivative made by adding to, deleting, or substituting — in - part or in whole — any of the components of the Original Version, by changing formats or by - porting the Font Software to a new environment. -</p> -<p>"Author" refers to any designer, engineer, programmer, technical writer or other person who - contributed to the Font Software. -</p> -<h3>PERMISSION & CONDITIONS</h3> -<p>Permission is hereby granted, free of charge, to any person obtaining a copy of the Font - Software, to use, study, copy, merge, embed, modify, redistribute, and sell modified and - unmodified copies of the Font Software, subject to the following conditions: -</p> -<p>1) Neither the Font Software nor any of its individual components, in Original or Modified - Versions, may be sold by itself. -</p> -<p>2) Original or Modified Versions of the Font Software may be bundled, redistributed and/or sold - with any software, provided that each copy contains the above copyright notice and this license. - These can be included either as stand-alone text files, human-readable headers or in the - appropriate machine-readable metadata fields within text or binary files as long as those fields - can be easily viewed by the user. -</p> -<p>3) No Modified Version of the Font Software may use the Reserved Font Name(s) unless explicit - written permission is granted by the corresponding Copyright Holder. This restriction only - applies to the primary font name as presented to the users. -</p> -<p>4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font Software shall not be used - to promote, endorse or advertise any Modified Version, except to acknowledge the contribution(s) - of the Copyright Holder(s) and the Author(s) or with their explicit written permission. -</p> -<p>5) The Font Software, modified or unmodified, in part or in whole, must be distributed entirely - under this license, and must not be distributed under any other license. The requirement for - fonts to remain under this license does not apply to any document created using the Font - Software. -</p> -<h3>TERMINATION</h3> -<p>This license becomes null and void if any of the above conditions are not met.</p> -<h3>DISCLAIMER</h3> -<p>THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, - INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE - AND NONINFRINGEMENT OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE - COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING ANY GENERAL, - SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT - OR OTHERWISE, ARISING FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM OTHER - DEALINGS IN THE FONT SOFTWARE. -</p> diff --git a/app/src/main/res/raw/license_materialdialogs.html b/app/src/main/res/raw/license_materialdialogs.html deleted file mode 100644 index ea3470adf8318cfe1c124cc56bbef0d10c4f034e..0000000000000000000000000000000000000000 --- a/app/src/main/res/raw/license_materialdialogs.html +++ /dev/null @@ -1,36 +0,0 @@ -<!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<h2>The MIT License (MIT)</h2> -<p>Copyright (c) 2014-2016 Aidan Michael Follestad</p> -<p>Permission is hereby granted, free of charge, to any person obtaining a copy of this software and - associated documentation files (the "Software"), to deal in the Software without restriction, - including without limitation the rights to use, copy, modify, merge, publish, distribute, - sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is - furnished to do so, subject to the following conditions: -</p> -<p>The above copyright notice and this permission notice shall be included in all copies or - substantial portions of the Software. -</p> -<p>THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT - NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, - DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -</p> diff --git a/app/src/main/res/raw/license_solarized.html b/app/src/main/res/raw/license_solarized.html deleted file mode 100644 index e1d2daecb592cdd0f5da346a3c7c0cec84e64598..0000000000000000000000000000000000000000 --- a/app/src/main/res/raw/license_solarized.html +++ /dev/null @@ -1,36 +0,0 @@ -<!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<h2>The MIT License (MIT)</h2> -<p>Copyright (c) 2011 Ethan Schoonover</p> -<p>Permission is hereby granted, free of charge, to any person obtaining a copy of this software and - associated documentation files (the "Software"), to deal in the Software without restriction, - including without limitation the rights to use, copy, modify, merge, publish, distribute, - sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is - furnished to do so, subject to the following conditions: -</p> -<p>The above copyright notice and this permission notice shall be included in all copies or - substantial portions of the Software. -</p> -<p>THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT - NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, - DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -</p> diff --git a/app/src/main/res/raw/license_threetenbp.html b/app/src/main/res/raw/license_threetenbp.html deleted file mode 100644 index e77188458c2ca5ad5f0f0cb824921e1ed7c0dc60..0000000000000000000000000000000000000000 --- a/app/src/main/res/raw/license_threetenbp.html +++ /dev/null @@ -1,45 +0,0 @@ -<!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<h2>The 3-Clause BSD License</h2> -<p>Copyright (c) 2007-present, Stephen Colebourne & Michael Nascimento Santos</p> -<p>All rights reserved.</p> -<p>Redistribution and use in source and binary forms, with or without modification, are permitted - provided that the following conditions are met: -</p> -<p>1. Redistributions of source code must retain the above copyright notice, this list of conditions - and the following disclaimer. -</p> -<p>2. Redistributions in binary form must reproduce the above copyright notice, this list of - conditions and the following disclaimer in the documentation and/or other materials provided - with the distribution. -</p> -<p>3. Neither the name of JSR-310 nor the names of its contributors may be used to endorse or - promote products derived from this software without specific prior written permission. -</p> -<p>THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND - FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR - CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. -</p> diff --git a/app/src/main/res/values-de/strings.xml b/app/src/main/res/values-de/strings.xml deleted file mode 100644 index a66f3f457d91ede62bbd7bee230058d20ae86158..0000000000000000000000000000000000000000 --- a/app/src/main/res/values-de/strings.xml +++ /dev/null @@ -1,204 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<resources xmlns:tools="http://schemas.android.com/tools"> - <plurals name="label_user_count"> - <item quantity="one">%1$d Benutzer</item> - <item quantity="other">%1$d Benutzer</item> - </plurals> - <string name="app_name">Quasseldroid</string> - <string name="app_description">Ein Android-Client für das dezentralen Quassel IRC Client.</string> - - <string name="app_description_long">Quassel ist ein dezentraler IRC client, entwickelt in C++ mit Qt. Quasseldroid ist ein Kotlin-basierter Client für den Quassel Core, der es ermöglicht, Quassel auch auf Android™-Telefonen zu nutzen.</string> - <string name="connection_service_title">Verbindungsdienst</string> - - <string name="connection_service_description">Hält eine Verbindung zum Core, um Benachrichtigungen und die Übertragung von Nachrichten zu ermöglichen</string> - <string name="label_about">Über</string> - <string name="label_accept">Akzeptieren</string> - <string name="label_acknowledgements">Danksagungen</string> - <string name="label_archive">Archivieren</string> - <string name="label_archive_chat">Chat Archivieren</string> - <string name="label_archived_chats">Archivierte Chats</string> - <string name="label_ascending">Aufsteigend</string> - <string name="label_authors">Autoren</string> - <string name="label_autocomplete">Autovervollständigung</string> - <string name="label_avatar">Avatar</string> - <string name="label_back">Zurück</string> - <string name="label_buffer_name">Chatname</string> - <string name="label_cancel">Abbrechen</string> - <string name="label_certificates">Zertifikate</string> - <string name="label_channel_name">Kanalname</string> - <string name="label_clear_search">Eingabe löschen</string> - <string name="label_close">Schließen</string> - <string name="label_colors_custom">Anpassen</string> - <string name="label_colors_mirc">mIRC</string> - <string name="label_configure">Konfigurieren</string> - <string name="label_connect">Verbinden</string> - <string name="label_copy">Kopieren</string> - <string name="label_crashes">Absturzberichte</string> - <string name="label_crashes_empty">Keine Absturzberichte gefunden</string> - <string name="label_create_channel">Channel erstellen</string> - <string name="label_delete">Löschen</string> - <string name="label_delete_all">Alle Löschen</string> - <string name="label_descending">Absteigend</string> - <string name="label_disconnect">Verbindung trennen</string> - <string name="label_edit_core">Account bearbeiten</string> - <string name="label_edit_nick">Spitznamen bearbeiten</string> - <string name="label_edit_topic">Thema ändern</string> - <string name="label_edit_topic_long">Open dialog to change the channel topic</string> - <string name="label_filter_messages">Nachrichten filtern</string> - <string name="label_finish">Fertig</string> - <string name="label_generate_crash_report">Crash Report erzeugen</string> - <string name="label_ignore">Ignorieren</string> - <string name="label_ignore_long">Add/remove user to/from ignore list</string> - <string name="label_info">Info</string> - <string name="label_info_certificate">Zertifikat</string> - <string name="label_info_channel">Kanalinformationen</string> - <string name="label_info_channellist">Kanalliste</string> - <string name="label_info_core">Core-Details</string> - <string name="label_info_user">Benutzerinformationen</string> - <string name="label_input_history">Eingabeverlauf</string> - <string name="label_join">Betreten</string> - <string name="label_join_long">Kanal Betreten</string> - <string name="label_libraries">Bibliotheken</string> - <string name="label_license">Lizenz</string> - <string name="label_mark_read">Gelesen</string> - <string name="label_match_all">Betrifft alle Nachrichten</string> - <string name="label_mention">Erwähnen</string> - <string name="label_mention_long">Kopiert den Nutzernamen in die Eingabezeile</string> - <string name="label_network">Netzwerk</string> - <string name="label_new_account">Account hinzufügen</string> - <string name="label_new_chatlist">Chatliste hinzufügen</string> - <string name="label_new_highlight_ignore_rule">Neue Hervorhebungsignorierregel</string> - <string name="label_new_highlight_rule">Neue Hervorhebungsregel</string> - <string name="label_new_identity">Identität hinzufügen</string> - <string name="label_new_ignore_rule">Neue Ignorierregel</string> - <string name="label_new_network">Netzwerk hinzufügen</string> - <string name="label_new_nick">Spitzname hinzufügen</string> - <string name="label_new_server">Server hinzufügen</string> - <string name="label_next">Weiter</string> - <string name="label_nick">Spitzname</string> - <string name="label_nicklist">Benutzerliste</string> - <string name="label_no">Nein</string> - <string name="label_no_away_message">Kein Abwesenheitsgrund verfügbar</string> - <string name="label_no_sound">Ohne</string> - <string name="label_open">Öffnen</string> - <string name="label_part">Verlassen</string> - <string name="label_part_long">Kanal verlassen</string> - <string name="label_password_change">Passwort ändern</string> - <string name="label_password_error_nomatch">Passwörter stimmen nicht überein</string> - <string name="label_password_error_wrong">Falsches Passwort</string> - <string name="label_password_new">Neues Passwort</string> - <string name="label_password_old">Altes Passwort</string> - <string name="label_password_repeat">Passwort wiederholen</string> - <string name="label_permanently_archived">Dauerhaft Archiviert</string> - <string name="label_permanently_archived_empty">Keine permanent archivierten Chats vorhanden</string> - <string name="label_permanently_archived_long">Dauerhaft archivierte Chats werden erst wieder angezeigt, wenn du sie manuell wieder aktivierst.</string> - <string name="label_placeholder_message">Nachricht schreiben…</string> - <string name="label_placeholder_topic">Beschreib das Thema des Kanals…</string> - <string name="label_privacy_policy">Datenschutzerklärung</string> - <string name="label_query">Dialog</string> - <string name="label_query_long">Öffnet einen privaten Chat</string> - <string name="label_query_medium">Privaten Chat öffnen</string> - <string name="label_rename">Umbenennen</string> - <string name="label_reorder">Sortieren</string> - <string name="label_reply">Antworten</string> - <string name="label_reset">Zurücksetzen</string> - <string name="label_save">Speichern</string> - <string name="label_saving">Speichern…</string> - <string name="label_search">Suchen…</string> - <string name="label_search_buffer">Chats suchen</string> - <string name="label_search_channels">Kanäle suchen</string> - <string name="label_select">Auswählen</string> - <string name="label_send">Senden</string> - <string name="label_service_connection_failed">Verbindung konnte nicht hergestellt werden, prüfe die Batterie-Spar-Einstellungen. Mehr Info findest du auf dontkillmyapp.com.</string> - <string name="label_set_default">Als Standard setzen</string> - <string name="label_settings">Einstellungen</string> - <string name="label_settings_client">Client-Einstellungen</string> - <string name="label_settings_core">Core-Einstellungen</string> - <string name="label_share">Teilen</string> - <string name="label_share_crashreport">Absturzbericht Teilen</string> - <string name="label_shortcut">Verknüpfung</string> - <string name="label_shortcut_long">Erstellt eine Verknüpfung auf dem Startbildschirm</string> - <string name="label_sort">Sortieren</string> - <string name="label_source">Quellcode</string> - <string name="label_temporarily_archived">Temporär Archiviert</string> - <string name="label_temporarily_archived_empty">Keine temporär archivierten Chats vorhanden</string> - <string name="label_temporarily_archived_long">Chats die nur temporär archiviert wurden werden wieder angezeigt, sobald sie eine neue Nachricht haben</string> - <string name="label_topic">Kanal-Thema</string> - <string name="label_translators">Übersetzer</string> - <string name="label_unhide">Nicht mehr ausblenden</string> - <string name="label_unknown_sender"><Unbekannt></string> - <string name="label_update_user_password">Benutzernamen/Passwort ändern</string> - <string name="label_use_default">Standardwerte benutzen</string> - <string name="label_user_count">Anzahl Nutzer</string> - <string name="label_website">Webseite</string> - <string name="label_whitelist">Ignorieren</string> - <string name="label_whitelist_certificates">Zertifikate</string> - <string name="label_whitelist_certificates_empty">Keine Zertifikate auf der Whitelist</string> - <string name="label_whitelist_hostnames">Hosts</string> - <string name="label_whitelist_hostnames_empty">Keine Hostnamen auf der Whitelist</string> - <string name="label_whitelist_ignore_date">Verfallsdatum wird ignoriert für dieses Zertifikat</string> - <string name="label_who">Who</string> - <string name="label_who_long">Informationen aller Nutzer aktualisieren</string> - <string name="label_whois">Whois</string> - <string name="label_whois_long">Nutzerinformationen aktualisieren</string> - - <string name="label_yes">Ja</string> - - <string name="label_feature_synchronizedmarkerline">Benötigt um die vorherige Position in Chats zu synchronisieren</string> - <string name="label_feature_saslauthentication">Benötigt für SASL</string> - <string name="label_feature_saslexternal">Benötigt für SASL mit Zertifikaten</string> - <string name="label_feature_hideinactivenetworks">Benötigt um inaktive Netzwerke aus Chatlisten auszublenden</string> - <string name="label_feature_passwordchange">Benötigt um Passwörter zu ändern.</string> - <string name="label_feature_capnegotiation">Benötigt für IRCv3-Features</string> - <string name="label_feature_verifyserverssl">Benötigt um das SSL-Zertifikat von IRC-Netzwerken zu verifizieren</string> - <string name="label_feature_customratelimits">Benötigt um benutzerdefinierte Grenzwerte für IRC-Netzwerke festzulegen</string> - <string name="label_feature_awayformattimestamp">Benötigt um benutzerdefinierte Zeitformate in Abwesenheitsnachrichten zu verwenden</string> - <string name="label_feature_bufferactivitysync">Benötigt um die Aktivität von Chats in Chatlisten zu sehen</string> - <string name="label_feature_coresidehighlights">Benötigt für Hervorhebungen</string> - <string name="label_feature_senderprefixes">Benötigt um die Präfixe (+, @) von Nutzern in Nachrichten zu sehen</string> - <string name="label_feature_remotedisconnect">Benötigt um die Verbindung eigener Clients aus der Ferne zu trennen</string> - <string name="label_feature_richmessages">Benötigt um Echtnamen oder IRCv3 oder Gravatar-Avatare in Nachrichten zu sehen.</string> - <string name="label_feature_backlogfiltertype">Benötigt um vergangene Benachrichtigungen nach dem Verbinden zu erhalten</string> - - <string name="label_feature_context_bufferactivitysync">Quasseldroid kann ungelesene Chats nicht hervorheben. Update deinen Core auf Quassel v0.13 um dies zu beheben.</string> - <string name="label_feature_context_coresidehighlights">Quasseldroid kann Highlights nicht konfigurieren. Update deinen Core auf Quassel v0.13 um dies zu beheben.</string> - <string name="label_feature_context_missing">Deinem Core fehlen Features die benötigt werden, damit Quasseldroid korrekt funktionieren kann.</string> - <string name="label_feature_context_missing_button">Details</string> - - <string name="notification_channel_connection_title">Verbindung</string> - <string name="notification_channel_highlight_title">Benachrichtigungen</string> - <string name="notification_channel_old_highlight_title">Alte Benachrichtigungen</string> - - <string name="label_missing_features">Fehlende Features</string> - <string name="info_missing_features" tools:ignore="StringFormatCount">Deinem Core fehlen bestimmte Features die benötigt werden damit Quasseldroid korrekt funktionieren kann. Du solltest deinen Quassel Core auf Version %1$s oder neuer <a href="https://quassel-irc.org>updaten</a>.</string> - - <string name="buffer_delete_confirmation">Bist du sicher, dass du diesen Chat auf ewig löschen möchtest? </string> - <string name="buffer_archive_confirmation">Willst du diesen Chat archivieren?</string> - <string name="buffer_archive_temporarily">Chat wieder anzeigen, sobald er neue Nachrichten hat</string> - - <string name="delete_confirmation">Bist du sicher, dass du dies auf ewig löschen möchtest? Dies kann nicht Rückgängig gemacht werden.</string> - <string name="cancel_confirmation">Du hast nicht gespeicherte Änderungen. Möchtest du sie verwerfen?</string> - - <string name="info_copied_version">Version in die Zwischenablage kopiert</string> - - <string name="advertisement_support_patreon">Bitte hilf uns, indem du die Entwicklung dieser App auf Patreon unterstützt</string> - <string name="advertisement_support_button">Entwicklung Unterstützen</string> -</resources> diff --git a/app/src/main/res/values-de/strings_certificates.xml b/app/src/main/res/values-de/strings_certificates.xml deleted file mode 100644 index d49e1dff3ac1a150dfee619acde7f36d4fa985b4..0000000000000000000000000000000000000000 --- a/app/src/main/res/values-de/strings_certificates.xml +++ /dev/null @@ -1,39 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<resources> - <string name="certificate_subject">Ausgestellt für</string> - <string name="certificate_issuer">Ausgestellt von</string> - - <string name="certificate_common_name">Allgemeiner Name (CN)</string> - <string name="certificate_organization">Organisation (O)</string> - <string name="certificate_organizational_unit">Organisationseinheit (OU)</string> - - <string name="certificate_hostnames">Hostnamen</string> - - <string name="certificate_validity">Gültigkeitsdauer</string> - - <string name="certificate_not_before">Beginnt mit</string> - <string name="certificate_not_after">Gültig bis</string> - - <string name="certificate_fingerprints">Fingerabdrücke</string> - - <string name="certificate_fingerprint_sha256">SHA-256 Fingerabdruck</string> - <string name="certificate_fingerprint_sha1">SHA-1 Fingerabdruck</string> -</resources> diff --git a/app/src/main/res/values-de/strings_contributors.xml b/app/src/main/res/values-de/strings_contributors.xml deleted file mode 100644 index dbb30431af43d75357922293d7ef10c37b1efb35..0000000000000000000000000000000000000000 --- a/app/src/main/res/values-de/strings_contributors.xml +++ /dev/null @@ -1,26 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<resources> - <string name="contributor_description_freqmod">Ursprüngliche qdatastream Deserialisierungsversuche</string> - <string name="contributor_description_sandsmark">Historische Protokollimplementierung, (De-)Serialisierer, Projekt (De-)Moralisierer</string> - <string name="contributor_description_magnuf">Historisches UI</string> - <string name="contributor_description_kenji">Historisches UI</string> - <string name="contributor_description_justjanne">Rewrite, UI, Annotation Processors, Backend</string> -</resources> diff --git a/app/src/main/res/values-de/strings_defaults.xml b/app/src/main/res/values-de/strings_defaults.xml deleted file mode 100644 index 861bad71318897736c84f20ded55ac89dcbbc06c..0000000000000000000000000000000000000000 --- a/app/src/main/res/values-de/strings_defaults.xml +++ /dev/null @@ -1,31 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<resources> - <string name="default_bufferviewconfig_name">Alle Chats</string> - - <string name="default_identity_identity_name">Standardidentität</string> - <string name="default_identity_realname">Quassel-IRC-Benutzer</string> - <string name="default_identity_awayreason">Mit\'m Fahrrad Sahne holen.</string> - <string name="default_identity_autoawayreason">Nicht da. Nein, ehrlich. Nicht da!</string> - <string name="default_identity_detachawayreason">Alle Quassel-Clients sind vom Erdboden verschwunden…</string> - <string name="default_identity_kickreason">Der Kindergarten ist woanders!</string> - <string name="default_identity_partreason">https://quassel-irc.org - Chat comfortably. Anywhere.</string> - <string name="default_identity_quitreason">https://quassel-irc.org - Chat comfortably. Anywhere.</string> -</resources> diff --git a/app/src/main/res/values-de/strings_error.xml b/app/src/main/res/values-de/strings_error.xml deleted file mode 100644 index c18d9bf468716ee564d3250b7634f65bc18e6bf0..0000000000000000000000000000000000000000 --- a/app/src/main/res/values-de/strings_error.xml +++ /dev/null @@ -1,49 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<resources> - <string name="label_error_login">Loginfehler</string> - <string name="label_error_setup">Einrichtungsfehler</string> - <string name="label_error_init">Verbindungsfehler</string> - <string name="label_error_ssl">SSL-Fehler</string> - <string name="label_error_ssl_required_unavailable">SSL wird für diese Verbindung benötigt, der Core unterstützt es aber nicht.</string> - <string name="label_error_certificate">Zertifikatsfehler</string> - <string name="label_error_certificate_no_certificate">Kein Zertifikat verfügbar</string> - <string name="label_error_certificate_no_hostname">Kein Rechnername verfügbar</string> - <string name="label_error_certificate_invalid"><![CDATA[ - <p>Das Zertifikat mit Fingerabdruck<br/> - <code>%1$s</code><br/> - ist nur gültig im Zeitraum von %2$s bis %3$s</p> - ]]></string> - <string name="label_error_certificate_untrusted"><![CDATA[ - <p>Das Zertifikat mit Fingerabdruck<br/> - <code>%1$s</code><br/> - ist nicht vertrauenswürdig.</p> - ]]></string> - <string name="label_error_certificate_no_match"><![CDATA[ - <p>Das Zertifikat mit Fingerabdruck<br/> - <code>%1$s</code><br/> - ist nicht gültig für %2$s.</p> - ]]></string> - - <string name="label_error_unknown_host">Host nicht gefunden: %1$s</string> - <string name="label_error_invalid_protocol_version">Unbekanntes Protokoll: %1$d</string> - <string name="label_error_connection">Fehler beim Herstellen der Verbindung: %1$s (%2$s)</string> - <string name="label_error_connection_closed">Fehler: Verbindung wurde unerwartet getrennt</string> -</resources> diff --git a/app/src/main/res/values-de/strings_format.xml b/app/src/main/res/values-de/strings_format.xml deleted file mode 100644 index 4747d897831467ce39b5d30dd343602823bd0ecf..0000000000000000000000000000000000000000 --- a/app/src/main/res/values-de/strings_format.xml +++ /dev/null @@ -1,29 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<resources> - <string name="label_bold">Fettgedruckt</string> - <string name="label_italic">Kursiv</string> - <string name="label_strikethrough">Durchgestrichen</string> - <string name="label_underline">Unterstrichen</string> - <string name="label_monospace">Monospace</string> - <string name="label_foreground">Vordergrundfarbe</string> - <string name="label_background">Hintergrundfarbe</string> - <string name="label_clear_formatting">Formatierung entfernen</string> -</resources> diff --git a/app/src/main/res/values-de/strings_info.xml b/app/src/main/res/values-de/strings_info.xml deleted file mode 100644 index 090b794424e82d6c89d4f3d69b394f4dbf306fdc..0000000000000000000000000000000000000000 --- a/app/src/main/res/values-de/strings_info.xml +++ /dev/null @@ -1,47 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<resources> - <string name="label_user_away">Abwesend</string> - <string name="label_user_away_reason">Grund</string> - <string name="label_user_identity">Identität</string> - <string name="label_user_account">Account</string> - <string name="label_user_ident">Ident</string> - <string name="label_user_host">Host</string> - <string name="label_user_server">Server</string> - <string name="label_user_common_channels">Gemeinsame Channels</string> - - <string name="label_core_version">Version</string> - <string name="label_core_uptime">Betriebsdauer</string> - <string name="label_core_security">Verschlüsselung</string> - <string name="label_core_clients">Clients</string> - <string name="label_core_online_since">Online seit %1$s</string> - <string name="label_core_connected_since">Verbunden seit %1$s</string> - <string name="label_core_connection_verified_by">Verbindung verifiziert von %1$s</string> - <string name="label_core_connection_protocol">Die Verbindung verwendet %1$s</string> - <string name="label_core_connection_ciphersuite">Die Verbindung ist mit %1$s verschlüsselt und authentifiziert und verwendet %2$s als Mechanismus für den Schlüsselaustausch</string> - <string name="label_core_connection_ciphersuite_13">Die Verbindung ist mit %1$s verschlüsselt und authentifiziert</string> - <string name="label_core_connection_verified_by_unknown">Unbekannt</string> - <string name="label_core_connection_insecure">Unsichere Verbindung</string> - - <string name="property_group_ircchannel_channel">Kanal</string> - <string name="property_ircchannel_topic">Thema</string> - <string name="property_ircchannel_topic_action_edit">Thema ändern</string> - <string name="property_ircchannel_topic_default">Kein Thema gesetzt</string> -</resources> diff --git a/app/src/main/res/values-de/strings_messages.xml b/app/src/main/res/values-de/strings_messages.xml deleted file mode 100644 index 7cb1f08af0220d60acb0fa14f7522ef513b8694c..0000000000000000000000000000000000000000 --- a/app/src/main/res/values-de/strings_messages.xml +++ /dev/null @@ -1,52 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<resources> - <plurals name="message_netsplit_join"> - <item quantity="one">Netsplit zwischen %1$s und %2$s beendet: %3$d Nutzer war betroffen: %4$s</item> - <item quantity="other">Netsplit zwischen %1$s und %2$s beendet: %3$d Nutzer waren betroffen: %4$s</item> - </plurals> - <plurals name="message_netsplit_quit"> - <item quantity="one">Netsplit zwischen %1$s und %2$s: %3$d Nutzer ist betroffen: %4$s</item> - <item quantity="other">Netsplit zwischen %1$s und %2$s: %3$d Nutzer sind betroffen: %4$s</item> - </plurals> - <string name="message_type_join">Join-Meldungen</string> - <string name="message_type_part">Part-Meldungen</string> - <string name="message_type_quit">Quit-Meldungen</string> - <string name="message_type_nick">Benutzernamensänderungen</string> - <string name="message_type_mode">Modiänderungen</string> - <string name="message_type_topic">Themenänderungen</string> - - <string name="message_format_copy">[%1$s] %2$s</string> - <string name="message_format_copy_complex">[%1$s] <%2$s> %3$s</string> - <string name="message_format_action">— %1$s%2$s %3$s</string> - <string name="message_format_notice">[%1$s%2$s] %3$s</string> - <string name="message_format_nick">%1$s%2$s heißt jetzt %3$s%4$s</string> - <string name="message_format_nick_self">Du heißt jetzt %1$s%2$s</string> - <string name="message_format_mode">Modus %1$s durch %2$s%3$s</string> - <string name="message_format_join">%1$s%2$s hat %3$s betreten</string> - <string name="message_format_part_1">%1$s%2$s hat den Kanal verlassen</string> - <string name="message_format_part_2">%1$s%2$s hat den Kanal verlassen (%3$s)</string> - <string name="message_format_quit_1">%1$s%2$s hat das Netzwerk verlassen</string> - <string name="message_format_quit_2">%1$s%2$s hat das Netzwerk verlassen (%3$s)</string> - <string name="message_format_kick_1">%1$s wurde von %2$s%3$s aus dem Chat geworfen</string> - <string name="message_format_kick_2">%1$s wurde von %2$s%3$s aus dem Chat geworfen (%4$s)</string> - <string name="message_format_kill_1">%1$s wurde von %2$s%3$s aus dem Netzwerk geworfen</string> - <string name="message_format_kill_2">%1$s wurde von %2$s%3$s aus dem Netzwerk geworfen (%4$s)</string> -</resources> diff --git a/app/src/main/res/values-de/strings_preferences.xml b/app/src/main/res/values-de/strings_preferences.xml deleted file mode 100644 index c7d08544fe67e2d5155d1d8a6ebacf1c2cc39736..0000000000000000000000000000000000000000 --- a/app/src/main/res/values-de/strings_preferences.xml +++ /dev/null @@ -1,189 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<resources> - <string name="preference_appearance_title">Aussehen</string> - - <string name="preference_theme_title">Farbschema</string> - <string name="preference_theme_entry_material_daynight">Material (Auto)</string> - <string name="preference_theme_entry_material_light">Material (Hell)</string> - <string name="preference_theme_entry_material_dark">Material (Dunkel)</string> - <string name="preference_theme_entry_quassel_daynight">Quassel (Auto)</string> - <string name="preference_theme_entry_quassel_light">Quassel (Hell)</string> - <string name="preference_theme_entry_quassel_dark">Quassel (Dunkel)</string> - <string name="preference_theme_entry_amoled">AMOLED</string> - <string name="preference_theme_entry_solarized_daynight">Solarized (Auto)</string> - <string name="preference_theme_entry_solarized_light">Solarized (Hell)</string> - <string name="preference_theme_entry_solarized_dark">Solarized (Dunkel)</string> - <string name="preference_theme_entry_gruvbox_daynight">Gruvbox (Auto)</string> - <string name="preference_theme_entry_gruvbox_light">Gruvbox (Hell)</string> - <string name="preference_theme_entry_gruvbox_dark">Gruvbox (Dunkel)</string> - <string name="preference_theme_entry_dracula">Dracula</string> - <string name="preference_input_enter_title">Eingabetaste auf Tastatur</string> - <string name="preference_input_enter_entry_emoji">Emoji-Auswahl</string> - <string name="preference_input_enter_entry_send">Senden</string> - <string name="preference_input_enter_entry_newline">Neue Zeile</string> - <string name="preference_show_lag_title">Latenz anzeigen</string> - <string name="preference_show_lag_summary">Zeigt die Gerät-Core-Latenz in der Statusleiste</string> - - <string name="preference_keep_screen_on_title">Bildschirm aktiv halten</string> - <string name="preference_keep_screen_on_summary">Verhindert, dass das Gerät in den Schlafmodus wechselt während die App im Vordergrund ist</string> - - <string name="preference_language_title">Sprache</string> - <string name="preference_language_entry_auto">System-Standardsprache</string> - <string name="preference_redirection_title">Nachrichtenumleitung</string> - - <string name="preference_redirection_user_notices_title">Benutzernotizen umleiten</string> - <string name="preference_redirection_user_notices_summary">Zeigt Benutzernotizen im momentan geöffneten Chat an</string> - - <string name="preference_redirection_server_notices_title">Servernotizen umleiten</string> - <string name="preference_redirection_server_notices_summary">Zeigt Servernotizen im momentan geöffneten Chat an</string> - - <string name="preference_redirection_errors_title">Fehler umleiten</string> - <string name="preference_redirection_errors_summary">Zeigt Fehler im momentan geöffneten Chat an</string> - - - <string name="preference_notifications_title">Benachrichtigungen</string> - - <string name="preference_notification_query_title">Direktnachrichten</string> - - <string name="preference_notification_channel_title">Räume</string> - - <string name="preference_notification_other_title">Andere Nachrichten</string> - - <string name="preference_notification_sound_title">Benachrichtigungston</string> - - <string name="preference_notification_vibration_title">Vibration</string> - - <string name="preference_notification_light_title">LED</string> - - <string name="preference_notification_mark_read_on_swipe_title">Wegwischen einer Benachrichtigung markiert den Channel als gelesen</string> - <string name="preference_notification_mark_read_on_swipe_summary">Markiert alle Nachrichten in einem Channel als gelesen wenn eine Benachrichtigung für den Channel weggewischt wird</string> - - <string name="preference_notification_network_name_in_notification_title_title">Netzwerknamen in Benachrichtigungstitel anzeigen</string> - - <string name="preference_notification_show_all_activities_in_toolbar_title">Alle Aktivitäten in Toolbar markieren</string> - <string name="preference_notification_show_all_activities_in_toolbar_summary">Zeigt eine farbige Meldung für alle Aktivitäten in der Toolbar</string> - - <string name="preference_notification_configure_title">Benachrichtigungen konfigurieren</string> - - <string name="preference_notifications_level_all">Alle Nachrichten</string> - <string name="preference_notifications_level_highlight">Erwähnungen</string> - <string name="preference_notifications_level_none">Niemals</string> - <string name="preference_messages_title">Nachrichten</string> - - <string name="preference_monospace_title">Monospace-Schrift verwenden</string> - - <string name="preference_textsize_title">Schriftgröße</string> - - <string name="preference_show_seconds_title">Sekunden anzeigen</string> - - <string name="preference_use_24h_clock_title">24h-Format verwenden</string> - - <string name="preference_colorize_mirc_title">mIRC-Farben verwenden</string> - <string name="preference_colorize_mirc_summaryon">Zeigt Farben und Formatierungen in Nachrichten an</string> - <string name="preference_colorize_mirc_summaryoff">Farben und Formatierungen werden aus Nachrichten entfernt</string> - - <string name="preference_colorize_nicknames_title">Benutzernamen farblich hervorheben</string> - <string name="preference_colorize_nicknames_entry_all">Alle Benutzernamen</string> - <string name="preference_colorize_nicknames_entry_all_but_mine">Alle außer Eigenem</string> - <string name="preference_colorize_nicknames_entry_none">Keine</string> - <string name="preference_show_prefix_title">Sendermodi anzeigen</string> - <string name="preference_show_prefix_entry_all">Alle Modi</string> - <string name="preference_show_prefix_entry_highest">Höchsten Modus</string> - <string name="preference_show_prefix_entry_none">Keine</string> - <string name="preference_hostmask_actions_title">Hostmaske in Aktionen</string> - <string name="preference_hostmask_actions_summary">Zeigt Ident und Host in Betreten/Verlassen-Nachrichten</string> - - <string name="preference_nicks_on_new_line_title">Separate Spitznamen</string> - <string name="preference_nicks_on_new_line_summary">Zeigt Spitznamen in einer eigenen Zeile an</string> - - <string name="preference_show_realnames_title">Echtnamen anzeigen</string> - - <string name="preference_show_avatars_title">Avatare anzeigen</string> - - <string name="preference_square_avatars_title">Quadratische Avatare</string> - - <string name="preference_show_irccloud_avatars_title">IRCCloud Avatare anzeigen</string> - <string name="preference_show_irccloud_avatars_summary">Zeigt für Nutzer ohne Avatare den IRCCloud-Avatar an, falls verfügbar</string> - - <string name="preference_show_gravatar_avatars_title">Gravatar Avatare anzeigen</string> - <string name="preference_show_gravatar_avatars_summary">Zeigt für Nutzer ohne Avatare den Gravatar-Avatar an, falls verfügbar</string> - - <string name="preference_show_matrix_avatars_title">Matrix Avatare anzeigen</string> - <string name="preference_show_matrix_avatars_summary">Zeigt für Nutzer ohne Avatare den Matrix-Avatar an, falls verfügbar</string> - - <string name="preference_time_at_end_title">Rechts-Ausgerichtete Zeit</string> - <string name="preference_time_at_end_summary">Zeigt die Zeit rechts in Nachrichten an</string> - - <string name="preference_larger_emoji_title">Große Reaktionen</string> - <string name="preference_larger_emoji_summary">Zeigt Nachrichten, die nur Emoji enthalten, größer an</string> - - <string name="preference_highlight_own_messages_title">Eigene Nachrichten hervorheben</string> - <string name="preference_highlight_own_messages_summary">Hebt eigene Nachrichten besser sichtbar hervor</string> - - <string name="preference_replace_emoji_title">Emoji Shortcodes ersetzen</string> - <string name="preference_replace_emoji_summary">Ersetzt Shortcodes wie :+1: oder :like: durch Emoji</string> - - - <string name="preference_autocomplete_title">Autovervollständigung</string> - - <string name="preference_autocomplete_sender_doubleclick_title">Sender-Autovervollständigung</string> - <string name="preference_autocomplete_sender_doubleclick_summary">Vervollständigt den Sender einer Nachricht, wenn auf diese doppelgeklickt wird</string> - - <string name="preference_autocomplete_button_title">Autovervollständigungsknopf</string> - <string name="preference_autocomplete_button_summary">Zeigt einen Knopf um Namen und Chats zu vervollständigen</string> - - <string name="preference_autocomplete_doubletap_title">Doppelclick-Autocomplete</string> - <string name="preference_autocomplete_doubletap_summary">Vervollständigt Namen und Chats automatisch, wenn auf das Eingabefeld doppelgeklickt wird</string> - - <string name="preference_autocomplete_auto_title">Automatisch anzeigen</string> - <string name="preference_autocomplete_auto_summary">Vervollständigt Namen und Chats automatischen nach den ersten 3 Buchstaben</string> - - <string name="preference_autocomplete_prefix_title">Nach Präfix anzeigen</string> - <string name="preference_autocomplete_prefix_summary">Vervollständigt Namen und Chats automatisch nach einem @ oder #</string> - - <string name="preference_autocomplete_nicks_title">Autovervollständigung für Spitznamen</string> - - <string name="preference_autocomplete_buffers_title">Autovervollständigung für Chats</string> - - <string name="preference_autocomplete_aliases_title">Autovervollständigung für Aliase</string> - - <string name="preference_autocomplete_emoji_title">Autovervollständigung für Emoji</string> - - - <string name="preference_backlog_title">Verlauf</string> - - <string name="preference_page_size_title">Seitengröße</string> - <string name="preference_page_size_summary">Anzahl an Nachrichten die pro Mal geladen und im Speicher gehalten werden</string> - - <string name="preference_initial_amount_title">Anfängliche Verlaufsgröße</string> - <string name="preference_initial_amount_summary">Anzahl an Nachrichten die beim ersten Öffnen eines Chats geladen werden</string> - - <string name="preference_clear_cache_title">Nachrichten-Cache leeren</string> - - <string name="preference_connection_title">Verbindung</string> - - <string name="preference_show_notification_title">Benachrichtigung anzeigen</string> - <string name="preference_show_notification_summary">Zeigt eine permanente Benachrichtigung an, damit Quasseldroid durchgehend verbunden bleiben kann</string> - - <string name="preference_ignore_network_changes_title">Netzwerkänderung ignorieren</string> - <string name="preference_ignore_network_changes_summary">Hindert Quasseldroid daran, bei Netzwerkänderungen automatisch die Verbindung neu herzustellen</string> - -</resources> diff --git a/app/src/main/res/values-de/strings_settings.xml b/app/src/main/res/values-de/strings_settings.xml deleted file mode 100644 index 44bfc40347da9bd3e879c2edf0b3c942c151a759..0000000000000000000000000000000000000000 --- a/app/src/main/res/values-de/strings_settings.xml +++ /dev/null @@ -1,158 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<resources> - <string name="settings_networks_title">Netzwerke</string> - <string name="settings_network_title">Netzwerk</string> - <string name="settings_network_network_name">Netzwerkname</string> - <string name="settings_network_identity">Identität</string> - <string name="settings_network_sasl_enabled">SASL</string> - <string name="settings_network_sasl_account">Kontoname</string> - <string name="settings_network_sasl_password">Passwort</string> - <string name="settings_network_sasl_supported">Netzwerk unterstützt SASL</string> - <string name="settings_network_sasl_upgrade">Aktivieren</string> - <string name="settings_network_autoidentify_enabled">Auto-Identifizieren</string> - <string name="settings_network_autoidentify_service">Service</string> - <string name="settings_network_autoidentify_password">Passwort</string> - <string name="settings_network_connection">Verbindung</string> - <string name="settings_network_perform">Befehle</string> - <string name="settings_network_rejoin_channels">Beim Verbinden Kanäle wieder betreten</string> - <string name="settings_network_autoreconnect_enabled">Automatisches Wiederverbinden</string> - <string name="settings_network_autoreconnect_interval">Intervall</string> - <string name="settings_network_autoreconnect_interval_unit">Sekunden</string> - <string name="settings_network_autoreconnect_attempts">Maximale Anzahl an Verbindungsversuchen</string> - <string name="settings_network_autoreconnect_unlimited">Unbegrenzt</string> - <string name="settings_network_customratelimits_enabled">Benutzerdefinierte Nachrichtenrate</string> - <string name="settings_network_customratelimits_burstsize">Anzahl Nachrichten pro Übertragung</string> - <string name="settings_network_customratelimits_unlimited">Unbegrenzt</string> - <string name="settings_network_customratelimits_delay">Verzögerung</string> - <string name="settings_network_customratelimits_interval_unit">Sekunden</string> - - <string name="settings_networkserver_title">Netzwerk-Server</string> - <string name="settings_networkserver_connection">Verbindung</string> - <string name="settings_networkserver_host">Adresse</string> - <string name="settings_networkserver_port">Port</string> - <string name="settings_networkserver_ssl_enabled">SSL verwenden</string> - <string name="settings_networkserver_ssl_verify">SSL verifizieren</string> - <string name="settings_networkserver_password">Passwort</string> - <string name="settings_networkserver_proxy_enabled">Proxy verwenden</string> - <string name="settings_networkserver_proxy_type">Typ</string> - <string name="settings_networkserver_proxy_type_http">HTTP</string> - <string name="settings_networkserver_proxy_type_socks5">SOCKS 5</string> - <string name="settings_networkserver_proxy_host">Adresse</string> - <string name="settings_networkserver_proxy_port">Port</string> - <string name="settings_networkserver_proxy_user">Benutzername</string> - <string name="settings_networkserver_proxy_pass">Passwort</string> - - <string name="settings_identities_title">Identitäten</string> - <string name="settings_identity_title">Identität</string> - <string name="settings_identity_names">Namen</string> - <string name="settings_identity_identity_name">Identitätsname</string> - <string name="settings_identity_real_name">Realname</string> - <string name="settings_identity_ident">Ident</string> - <string name="settings_identity_nick">Spitzname</string> - <string name="settings_identity_nicks">Spitznamen</string> - <string name="settings_identity_messages">Meldungen</string> - <string name="settings_identity_kick_reason">Rauswurfgrund</string> - <string name="settings_identity_part_reason">Part-Grund</string> - <string name="settings_identity_quit_reason">Beendigungsgrund</string> - <string name="settings_identity_away">Abwesenheitsmeldungen</string> - <string name="settings_identity_away_reason">Abwesenheitsgrund</string> - <string name="settings_identity_detach_away">Abwesend wenn nicht verbunden</string> - <string name="settings_identity_detach_away_reason">Abwesenheitsgrund</string> - - <string name="settings_chatlists_title">Chat-Listen</string> - <string name="settings_chatlist_title">Chat-Liste</string> - <string name="settings_chatlist_ui">Benutzerinterface</string> - <string name="settings_chatlist_buffer_view_name">Name</string> - <string name="settings_chatlist_show_search">Suche anzeigen</string> - <string name="settings_chatlist_sort_alphabetically">Alphabetisch Sortieren</string> - <string name="settings_chatlist_add_new_buffers_automatically">Neue Chats automatisch hinzufügen</string> - <string name="settings_chatlist_network">Netzwerk</string> - <string name="settings_chatlist_network_all">Alle Netzwerke</string> - <string name="settings_chatlist_network_create">Netzwerk erstellen…</string> - <string name="settings_chatlist_show_status_buffer">Status-Fenster anzeigen</string> - <string name="settings_chatlist_types">Chat-Typen</string> - <string name="settings_chatlist_show_channels">Kanäle anzeigen</string> - <string name="settings_chatlist_show_queries">Dialoge anzeigen</string> - <string name="settings_chatlist_activity">Aktivität</string> - <string name="settings_chatlist_minimum_activity_no_activity">Keine Aktivität</string> - <string name="settings_chatlist_minimum_activity_other_activity">Andere Aktivität</string> - <string name="settings_chatlist_minimum_activity_new_message">Neue Nachricht</string> - <string name="settings_chatlist_minimum_activity_highlight">Hervorhebung</string> - <string name="settings_chatlist_hide_inactive_buffers">Inaktive Chats verstecken</string> - <string name="settings_chatlist_hide_inactive_networks">Inaktive Netzwerke verstecken</string> - - <string name="settings_ignorelist_title">Ignorieren-Liste</string> - - <string name="settings_ignoreitem_title">Ignorieren-Regel</string> - <string name="settings_ignoreitem_enabled">Aktiviert</string> - <string name="settings_ignoreitem_ignorerule">Ignorier-Regel</string> - <string name="settings_ignoreitem_isregex">Regulärer Ausdruck</string> - <string name="settings_ignoreitem_type">Regeltyp</string> - <string name="settings_ignoreitem_type_sender">Absender</string> - <string name="settings_ignoreitem_type_message">Mitteilung</string> - <string name="settings_ignoreitem_type_ctcp">CTCP</string> - <string name="settings_ignoreitem_strictness">Striktheit</string> - <string name="settings_ignoreitem_strictness_soft">Dynamisch</string> - <string name="settings_ignoreitem_strictness_hard">Permanent</string> - <string name="settings_ignoreitem_scope">Gültigkeitsbereich</string> - <string name="settings_ignoreitem_scope_global">Global</string> - <string name="settings_ignoreitem_scope_network">Netzwerk</string> - <string name="settings_ignoreitem_scope_channel">Raum</string> - <string name="settings_ignoreitem_scoperule">Gültigkeitsregel</string> - - <string name="settings_highlightlist_title">Hervorhebungen</string> - <string name="settings_highlightlist_highlight_nick">Hervorgehobene Spitznamen</string> - <string name="settings_highlightlist_highlight_nick_all_nicks">Alle Spitznamen aus Identität</string> - <string name="settings_highlightlist_highlight_nick_current_nick">Aktueller Spitzname</string> - <string name="settings_highlightlist_highlight_nick_none">Keine</string> - <string name="settings_highlightlist_nicks_case_sensitive">Groß-/Kleinschreibung beachten</string> - <string name="settings_highlightlist_rules">Hervorhebungsregeln</string> - <string name="settings_highlightlist_ignore_rules">Hervorhebungsignorierregeln</string> - - <string name="settings_highlightrule_title">Hervorhebungsregel</string> - <string name="settings_highlightrule_enabled">Aktiviert</string> - <string name="settings_highlightrule_name">Name</string> - <string name="settings_highlightrule_regular_expression">Regulärer Ausdruck</string> - <string name="settings_highlightrule_case_sensitive">Groß-/Kleinschreibung beachten</string> - <string name="settings_highlightrule_sender">Absender</string> - <string name="settings_highlightrule_channel">Raum</string> - - <string name="settings_aliaslist_title">Aliase</string> - - <string name="settings_aliasitem_title">Alias</string> - <string name="settings_aliasitem_name">Name</string> - <string name="settings_aliasitem_expansion">Ersetzungstext</string> - - <string name="settings_networkconfig_title">IRC Konfiguration</string> - <string name="settings_networkconfig_ping_timeout">Erkennung von Ping-Zeitüberschreitungen</string> - <string name="settings_networkconfig_ping_interval">Ping-Intervall</string> - <string name="settings_networkconfig_ping_interval_unit">Sekunden</string> - <string name="settings_networkconfig_max_ping_count">Verbindungstrennung nach</string> - <string name="settings_networkconfig_max_ping_count_unit">verpassten Pings</string> - <string name="settings_networkconfig_auto_who">Automatische Suche nach Nutzerinformationen</string> - <string name="settings_networkconfig_auto_who_interval">Aktualisierungs-Intervall</string> - <string name="settings_networkconfig_auto_who_interval_unit">Sekunden</string> - <string name="settings_networkconfig_auto_who_nick_limit">Ignoriere Chats mit mehr als</string> - <string name="settings_networkconfig_auto_who_nick_limit_unit">Nutzern</string> - <string name="settings_networkconfig_auto_who_delay">Mindestabstand zwischen zwei Abfragen</string> - <string name="settings_networkconfig_auto_who_delay_unit">Sekunden</string> - <string name="settings_networkconfig_standard_ctcp">Standardkonformes CTCP-Verhalten aktivieren</string> -</resources> diff --git a/app/src/main/res/values-de/strings_setup.xml b/app/src/main/res/values-de/strings_setup.xml deleted file mode 100644 index 1cd650683a1b3b3d85d475d1144d4b0f342165d4..0000000000000000000000000000000000000000 --- a/app/src/main/res/values-de/strings_setup.xml +++ /dev/null @@ -1,101 +0,0 @@ -<!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<resources> - <!-- Account Selection --> - <string name="slide_account_select_title">Account Auswählen</string> - <string name="slide_account_select_description">Wähle einen Account aus oder erstelle einen neuen</string> - <string name="label_user_on_host">%1$s auf %2$s:%3$d</string> - - <!-- Account Setup --> - - <!-- Account Connection --> - <string name="slide_account_connection_title">Verbindung</string> - <string name="slide_account_connection_description">Bitte gebe die Adresse des Servers an, auf dem dein Core läuft</string> - - <string name="label_connection_host">Hostname</string> - <string name="label_connection_port">Port</string> - <string name="label_connection_ssl">SSL erzwingen</string> - - <string name="hint_invalid_host">Ungültiger Hostname</string> - <string name="hint_invalid_port">Ungültiger Port</string> - - <!-- Account User --> - <string name="slide_account_user_title">Dein Account</string> - <string name="slide_account_user_description">Bitte gib Benutzernamen und Passwort für deinen Account ein. Falls du noch keinen hast, wird dieser für dich erstellt.</string> - - <string name="label_account_user">Benutzername</string> - <string name="label_account_pass">Passwort</string> - - <string name="hint_invalid_user">Benutzername darf nicht leer sein</string> - - <!-- Account Name --> - <string name="slide_account_name_title">Account Anpassen</string> - <string name="slide_account_name_description">Benenne diesen Account</string> - - <string name="label_account_name">Accountname</string> - - <string name="hint_invalid_name">Name darf nicht leer sein</string> - - <!-- Core Setup --> - - <string name="setup_core_title">Core Einrichten</string> - - <!-- Core Authenticator Select --> - <string name="slide_core_authenticator_select_title">Authentifizierungsbackend auswählen</string> - <string name="slide_core_authenticator_select_description">Bitte wähle aus, welches Authentifizierungsbackend der Quassel Core verwenden soll</string> - - <!-- Core Backend Select --> - <string name="slide_core_backend_select_title">Datenbank auswählen</string> - <string name="slide_core_backend_select_description">Bitte wähle aus, in welchem Datenbankbackend der Quassel Core Nachrichten und andere Daten speichern soll</string> - - <string name="label_backend">Backend</string> - - <!-- Core Backend Config --> - <string name="slide_core_backend_setup_title">Datenbank konfigurieren</string> - <string name="slide_core_backend_setup_description">Bitte konfiguriere das ausgewählte Datenbankbackend</string> - - <string name="setup_core_backend_no_options">Dieses Backend hat keine Einstellungsmöglichkeiten, du kannst also direkt mit dem nächsten Schritt fortfahren.</string> - - <!-- User Setup --> - - <string name="setup_user_title">Nutzer einrichten</string> - - <!-- User Identity --> - <string name="slide_user_identity_title">Identität Einrichten</string> - <string name="slide_user_identity_description">Bitte wähle einen Spitznamen.</string> - - <string name="hint_invalid_nick">Kein valider Spitzname</string> - - <!-- User Network --> - <string name="slide_user_network_title">Netzwerk einrichten</string> - <string name="slide_user_network_description">Wähle ein Netzwerk aus, zu dem du dich verbinden möchtest.</string> - - <string name="label_network_custom">Benutzerdefiniertes Netzwerk…</string> - - <!-- User Channels --> - <string name="slide_user_channels_title">Räume einrichten</string> - <string name="slide_user_channels_description">Wähle aus, welche Räume du betreten möchtest.</string> - - <string name="label_channels">Räume</string> - - <!-- Network Setup --> - - <string name="setup_network_title">Netzwerk einrichten</string> -</resources> diff --git a/app/src/main/res/values-de/strings_status.xml b/app/src/main/res/values-de/strings_status.xml deleted file mode 100644 index c0457cdc89ca4e8640203ea5c5c9687d240efefa..0000000000000000000000000000000000000000 --- a/app/src/main/res/values-de/strings_status.xml +++ /dev/null @@ -1,27 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<resources> - <string name="label_status_disconnected">Nicht verbunden</string> - <string name="label_status_connecting">Verbindung wird hergestellt</string> - <string name="label_status_handshake">Protokoll wird ausgehandelt</string> - <string name="label_status_init">Initialisiere Daten</string> - <string name="label_status_connected">Verbunden</string> - <string name="label_status_closed">Verbindung getrennt</string> -</resources> diff --git a/app/src/main/res/values-en-rGB/strings.xml b/app/src/main/res/values-en-rGB/strings.xml deleted file mode 100644 index 6b3a96e483bcade364b497d4ef9c16747fa46dd2..0000000000000000000000000000000000000000 --- a/app/src/main/res/values-en-rGB/strings.xml +++ /dev/null @@ -1,25 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<resources> - <string name="app_description">An Android-based client for the decentralised Quassel IRC client.</string> - <string name="app_description_long">Quassel is a distributed, decentralised IRC client, written using C++ and Qt. Quasseldroid is a pure-kotlin client for the Quassel core, allowing you to connect to your Quassel core using your Android™ phone.</string> - - <string name="label_feature_synchronizedmarkerline">Required for synchronising the last position in channels</string> -</resources> diff --git a/app/src/main/res/values-en-rGB/strings_certificates.xml b/app/src/main/res/values-en-rGB/strings_certificates.xml deleted file mode 100644 index 0bcb2ec50cb690f7a15ebedc54b94ac99e05047b..0000000000000000000000000000000000000000 --- a/app/src/main/res/values-en-rGB/strings_certificates.xml +++ /dev/null @@ -1,24 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<resources> - <string name="certificate_organization">Organisation (O)</string> - <string name="certificate_organizational_unit">Organisational Unit (OU)</string> - -</resources> diff --git a/app/src/main/res/values-en-rGB/strings_contributors.xml b/app/src/main/res/values-en-rGB/strings_contributors.xml deleted file mode 100644 index 915ce93c4c712d11d0bad5184a808b2d5883c528..0000000000000000000000000000000000000000 --- a/app/src/main/res/values-en-rGB/strings_contributors.xml +++ /dev/null @@ -1,23 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<resources> - <string name="contributor_description_freqmod">Initial qdatastream deserialisation attempts</string> - <string name="contributor_description_sandsmark">Legacy protocol implementation, (de)serialisers, project (de)moraliser</string> -</resources> diff --git a/app/src/main/res/values-en-rGB/strings_defaults.xml b/app/src/main/res/values-en-rGB/strings_defaults.xml deleted file mode 100644 index 0811da74ca6f0075af03cac11e3034ad27241b41..0000000000000000000000000000000000000000 --- a/app/src/main/res/values-en-rGB/strings_defaults.xml +++ /dev/null @@ -1,20 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<resources></resources> diff --git a/app/src/main/res/values-en-rGB/strings_error.xml b/app/src/main/res/values-en-rGB/strings_error.xml deleted file mode 100644 index 8dd7d377467c042e001568c8d47116c1e10e8c3f..0000000000000000000000000000000000000000 --- a/app/src/main/res/values-en-rGB/strings_error.xml +++ /dev/null @@ -1,20 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<resources></resources> diff --git a/app/src/main/res/values-en-rGB/strings_format.xml b/app/src/main/res/values-en-rGB/strings_format.xml deleted file mode 100644 index c78097ae655886328c2c94fec3a76e9a44c0daac..0000000000000000000000000000000000000000 --- a/app/src/main/res/values-en-rGB/strings_format.xml +++ /dev/null @@ -1,23 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<resources> - <string name="label_foreground">Foreground Colour</string> - <string name="label_background">Background Colour</string> -</resources> diff --git a/app/src/main/res/values-en-rGB/strings_info.xml b/app/src/main/res/values-en-rGB/strings_info.xml deleted file mode 100644 index 8dd7d377467c042e001568c8d47116c1e10e8c3f..0000000000000000000000000000000000000000 --- a/app/src/main/res/values-en-rGB/strings_info.xml +++ /dev/null @@ -1,20 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<resources></resources> diff --git a/app/src/main/res/values-en-rGB/strings_messages.xml b/app/src/main/res/values-en-rGB/strings_messages.xml deleted file mode 100644 index 8dd7d377467c042e001568c8d47116c1e10e8c3f..0000000000000000000000000000000000000000 --- a/app/src/main/res/values-en-rGB/strings_messages.xml +++ /dev/null @@ -1,20 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<resources></resources> diff --git a/app/src/main/res/values-en-rGB/strings_preferences.xml b/app/src/main/res/values-en-rGB/strings_preferences.xml deleted file mode 100644 index cf3aca7da096994954c1c154e9f0c2f501db7ee6..0000000000000000000000000000000000000000 --- a/app/src/main/res/values-en-rGB/strings_preferences.xml +++ /dev/null @@ -1,28 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<resources> - <string name="preference_notification_show_all_activities_in_toolbar_summary">Displays a coloured bubble in the toolbar for all chat activities</string> - - <string name="preference_colorize_mirc_title">Use mIRC Colours</string> - <string name="preference_colorize_mirc_summaryon">Show mIRC colours in messages</string> - <string name="preference_colorize_mirc_summaryoff">Strip mIRC colours from messages</string> - - <string name="preference_colorize_nicknames_title">Colourise nicknames</string> -</resources> diff --git a/app/src/main/res/values-en-rGB/strings_settings.xml b/app/src/main/res/values-en-rGB/strings_settings.xml deleted file mode 100644 index 8dd7d377467c042e001568c8d47116c1e10e8c3f..0000000000000000000000000000000000000000 --- a/app/src/main/res/values-en-rGB/strings_settings.xml +++ /dev/null @@ -1,20 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<resources></resources> diff --git a/app/src/main/res/values-en-rGB/strings_setup.xml b/app/src/main/res/values-en-rGB/strings_setup.xml deleted file mode 100644 index 45865e8ec29aa1fbf44562af62b8e495dd971095..0000000000000000000000000000000000000000 --- a/app/src/main/res/values-en-rGB/strings_setup.xml +++ /dev/null @@ -1,20 +0,0 @@ -<!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<resources></resources> diff --git a/app/src/main/res/values-en-rGB/strings_status.xml b/app/src/main/res/values-en-rGB/strings_status.xml deleted file mode 100644 index 8dd7d377467c042e001568c8d47116c1e10e8c3f..0000000000000000000000000000000000000000 --- a/app/src/main/res/values-en-rGB/strings_status.xml +++ /dev/null @@ -1,20 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<resources></resources> diff --git a/app/src/main/res/values-fr-rCA/strings.xml b/app/src/main/res/values-fr-rCA/strings.xml deleted file mode 100644 index 76036c9f0c078afef22c04c1f671ab6ea0c15857..0000000000000000000000000000000000000000 --- a/app/src/main/res/values-fr-rCA/strings.xml +++ /dev/null @@ -1,132 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<resources> - <string name="app_name">Quasseldroid</string> - <string name="app_description">Un client Android pour Quassel, un client IRC décentralisé.</string> - <string name="app_description_long">Quassel est un client IRC distribué et décentralisé, écrit en C++ et en Qt. Quasseldroid est un client pour le Quassel Core écrit purement en Kotlin, vous offrant la possibilité de vous connecter à un Quassel Core avec votre téléphone Android™.</string> - - <string name="connection_service_title">Service de Connection</string> - <string name="connection_service_description">Maintient une connection a un Core pour recevoir des notifications et transmettre des messages.</string> - - <string name="label_about">À Propos</string> - <string name="label_accept">Accepter</string> - <string name="label_avatar">Avatar</string> - <string name="label_back">Retour</string> - <string name="label_cancel">Annuler</string> - <string name="label_certificates">Certificats</string> - <string name="label_close">Fermer</string> - <string name="label_colors_custom">Personnalisé</string> - <string name="label_colors_mirc">mIRC</string> - <string name="label_configure">Configurer</string> - <string name="label_connect">Connecter</string> - <string name="label_copy">Copier</string> - <string name="label_crashes">Crashes</string> - <string name="label_delete">Supprimer</string> - <string name="label_delete_all">Supprimer Tout</string> - <string name="label_disconnect">Déconnecter</string> - <string name="label_edit_topic">Changer le Topique</string> - <string name="label_edit_topic_long">Ouvrir un dialogue pour changer le topique de la chaîne</string> - <string name="label_filter_messages">Filtrer les Messages</string> - <string name="label_ignore">Ignorer</string> - <string name="label_ignore_long">Ajouter ou Supprimer des utilisateurs de la liste des utilisateurs ignorés</string> - <string name="label_info_channel">Détails de la Chaîne</string> - <string name="label_info_core">Détails du Core</string> - <string name="label_info_user">Détails des Utilisateurs</string> - <string name="label_input_history">Historique des Entrées</string> - <string name="label_join">Joindre</string> - <string name="label_join_long">Joindre la Chaîne</string> - <string name="label_libraries">Librairies</string> - <string name="label_license">Licence</string> - <string name="label_mark_read">Marquer Comme Lu</string> - <string name="label_mention">Mentionner</string> - <string name="label_mention_long">Copier le nom d\'utilisateur dans la zone de texte</string> - <string name="label_new_account">Nouveau Compte</string> - <string name="label_new_chatlist">Nouvelle Liste de Tchats</string> - <string name="label_new_highlight_ignore_rule">Nouvelle Règle de Highlight à Ignorer</string> - <string name="label_new_highlight_rule">Nouvelle Règle de Highlight</string> - <string name="label_new_identity">Nouvelle Identité</string> - <string name="label_new_network">Nouveau Réseau</string> - <string name="label_new_nick">Nouveau Nom d\'Utilisateur</string> - <string name="label_new_server">Nouveau Serveur</string> - <string name="label_nick">Nom d\'Utilisateur</string> - <string name="label_nicklist">Liste de Noms</string> - <string name="label_no">Non</string> - <string name="label_no_away_message">Aucuns Messages d\'Absence Disponibles</string> - <string name="label_no_sound">Aucun</string> - <string name="label_open">Ouvrir</string> - <string name="label_part">Partir</string> - <string name="label_part_long">Partir de la Chaîne</string> - <string name="label_placeholder_message">Inscrivez un message…</string> - <string name="label_placeholder_topic">Inscrivez le Topique de la Chaîne…</string> - <string name="label_privacy_policy">Politique de Confidentialité</string> - <string name="label_query">Requêter</string> - <string name="label_query_long">Ouvrir une session privée avec cet utilisateur</string> - <string name="label_rename">Renommer</string> - <string name="label_reply">Répondre</string> - <string name="label_reset">Réinitialiser</string> - <string name="label_save">Enregistrer</string> - <string name="label_select">Sélectionner</string> - <string name="label_set_default">Définir par défaut</string> - <string name="label_settings">Paramètres</string> - <string name="label_settings_client">Paramètres du Client</string> - <string name="label_settings_core">Paramètres du Core</string> - <string name="label_share">Partager</string> - <string name="label_share_crashreport">Partager le Rapport du Crash</string> - <string name="label_topic">Topique de la Chaîne</string> - <string name="label_translators">Traducteurs</string> - <string name="label_unhide">Rendre Visible</string> - <string name="label_unknown_sender"><Inconnu></string> - <string name="label_update_user_password">Mettre à Jour l\'Utilisateur ou le Mot de Passe</string> - <string name="label_use_default">Utiliser les paramètres par défaut</string> - <string name="label_website">Site Web</string> - <string name="label_whitelist">Ignorer</string> - <string name="label_whitelist_certificates">Certificats</string> - <string name="label_whitelist_hostnames">Hosts</string> - <string name="label_whitelist_ignore_date">La date d\'expiration est ignorée pour ce certificat</string> - <string name="label_who">Who</string> - <string name="label_who_long">Mettre à jour les informations sur tous les utilisateurs</string> - <string name="label_whois">Whois</string> - <string name="label_whois_long">Mettre à jour les informations sur l\'utilisateur</string> - <string name="label_yes">Oui</string> - - <string name="label_feature_synchronizedmarkerline">Requis pour synchroniser la dernière position du tchat dans les chaînes</string> - <string name="label_feature_saslauthentication">Requis pour le protocole SASL</string> - <string name="label_feature_saslexternal">Requis pour le protocole SASL avec certificats</string> - <string name="label_feature_hideinactivenetworks">Requis pour cacher les réseaux inactifs de la liste de tchats</string> - <string name="label_feature_passwordchange">Requis pour changer les mots de passe à partir du client</string> - <string name="label_feature_capnegotiation">Requis pour les capacités IRCv3</string> - <string name="label_feature_verifyserverssl">Requis pour vérifier les certificats SSL des réseaux IRC durant la connection</string> - <string name="label_feature_customratelimits">Requis pour spécifier des limites de fréquence personnalisées aux réseaux IRC</string> - <string name="label_feature_awayformattimestamp">Requis pour les marqueurs de temps personnalisés dans les messages d\'absence</string> - <string name="label_feature_bufferactivitysync">Requis pour voir l\'activité des tchats dans la liste de tchats</string> - <string name="label_feature_coresidehighlights">Requis pour les highlights</string> - <string name="label_feature_senderprefixes">Requis pour voir les préfixes de modes (+, @) des utilisateurs dans les messages</string> - <string name="label_feature_remotedisconnect">Requis pour déconnecter vos propres clients à distance</string> - <string name="label_feature_richmessages">Requis pour voir les vrais noms ou les avatars IRCv3 ou Gravatar dans les messages</string> - <string name="label_feature_backlogfiltertype">Requis pour recevoir des notifications antérieures après la connection</string> - - <string name="notification_channel_connection_title">Connection</string> - <string name="label_missing_features">Fonctionnalités Manquantes</string> - <string name="delete_confirmation">Êtes-vous surs que vous voulez supprimer ceci en permanence? Cette action ne peut pas être réparée.</string> - <string name="cancel_confirmation">Vous avez des changements non-sauvegardés. Voulez-vous les abandonner?</string> - - <string name="info_copied_version">Version copiée au clipboard</string> - -</resources> diff --git a/app/src/main/res/values-fr-rCA/strings_certificates.xml b/app/src/main/res/values-fr-rCA/strings_certificates.xml deleted file mode 100644 index 8dd7d377467c042e001568c8d47116c1e10e8c3f..0000000000000000000000000000000000000000 --- a/app/src/main/res/values-fr-rCA/strings_certificates.xml +++ /dev/null @@ -1,20 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<resources></resources> diff --git a/app/src/main/res/values-fr-rCA/strings_contributors.xml b/app/src/main/res/values-fr-rCA/strings_contributors.xml deleted file mode 100644 index 8f9a4af48389d1a8bb8e605779625e07cadf2bca..0000000000000000000000000000000000000000 --- a/app/src/main/res/values-fr-rCA/strings_contributors.xml +++ /dev/null @@ -1,26 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<resources> - <string name="contributor_description_freqmod">Attentats de deserialization initiale du QDataStream</string> - <string name="contributor_description_sandsmark">Implementation du vieux protocole, (dé)sérialiseurs, (dé)moralisateur du projet</string> - <string name="contributor_description_magnuf">Vieille Interface</string> - <string name="contributor_description_kenji">Vieille Interface</string> - <string name="contributor_description_justjanne">Réécriture, Interface, Processeurs d\'Annotations, Backend</string> -</resources> diff --git a/app/src/main/res/values-fr-rCA/strings_defaults.xml b/app/src/main/res/values-fr-rCA/strings_defaults.xml deleted file mode 100644 index 26160626a878f3705c74a8fab1b748c8c376195b..0000000000000000000000000000000000000000 --- a/app/src/main/res/values-fr-rCA/strings_defaults.xml +++ /dev/null @@ -1,31 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<resources> - <string name="default_bufferviewconfig_name">Tous les Tchats</string> - - <string name="default_identity_identity_name">Identité par Défaut</string> - <string name="default_identity_realname">Utilisateur IRC Quassel</string> - <string name="default_identity_awayreason">Parti pêcher.</string> - <string name="default_identity_autoawayreason">Pas ici. Non, vraiment. Pas ici!</string> - <string name="default_identity_detachawayreason">Tous les clients Quassel ont disparu de la surface de la Terre…</string> - <string name="default_identity_kickreason">La garderie est loin d\'ici!</string> - <string name="default_identity_partreason">https://quassel-irc.org - Tchattez confortablement. N\'importe-où.</string> - <string name="default_identity_quitreason">https://quassel-irc.org - Tchattez confortablement. N\'importe-où.</string> -</resources> diff --git a/app/src/main/res/values-fr-rCA/strings_error.xml b/app/src/main/res/values-fr-rCA/strings_error.xml deleted file mode 100644 index 949b5d654ba9bbe5f5e5e105a775a696bd8ecc27..0000000000000000000000000000000000000000 --- a/app/src/main/res/values-fr-rCA/strings_error.xml +++ /dev/null @@ -1,43 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<resources> - <string name="label_error_login">Erreur d\'Authentication</string> - <string name="label_error_setup">Erreur d\'Initalisation</string> - <string name="label_error_init">Erreur de Connection</string> - <string name="label_error_certificate">Erreur de Certificat</string> - <string name="label_error_certificate_no_certificate">Aucuns certificats disponibles</string> - <string name="label_error_certificate_no_hostname">Aucuns hostnames disponibles</string> - <string name="label_error_certificate_invalid"><![CDATA[ - <p>Le certificat avec l\'emprunte <br/> - <code>%1$s</code><br/> - est seulement valide de %2$sà %3$s</p> -]]></string> - <string name="label_error_certificate_untrusted"><![CDATA[ - <p>Le certificat avec l\'emprunte<br/> - <code>%1$s</code><br/> - n\'est pas fiable.</p> -]]></string> - <string name="label_error_certificate_no_match"><![CDATA[ - <p>Le certificat avec l\'emprunte<br/> - <code>%1$s</code><br/> - n\'est pas valide pour %2$s.</p> -]]></string> - -</resources> diff --git a/app/src/main/res/values-fr-rCA/strings_format.xml b/app/src/main/res/values-fr-rCA/strings_format.xml deleted file mode 100644 index e103231277956e290c9b9aefa709c25fc9de94a5..0000000000000000000000000000000000000000 --- a/app/src/main/res/values-fr-rCA/strings_format.xml +++ /dev/null @@ -1,29 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<resources> - <string name="label_bold">Gras</string> - <string name="label_italic">Italique</string> - <string name="label_strikethrough">Biffé</string> - <string name="label_underline">Souligné</string> - <string name="label_monospace">Monospace</string> - <string name="label_foreground">Couleur de l\'Avant-Plan</string> - <string name="label_background">Couleur de l\'Arrière-Plan</string> - <string name="label_clear_formatting">Restaurer les Formats par Défaut</string> -</resources> diff --git a/app/src/main/res/values-fr-rCA/strings_info.xml b/app/src/main/res/values-fr-rCA/strings_info.xml deleted file mode 100644 index f1f8314a2ff5f30287eb7c163715b5960f85b014..0000000000000000000000000000000000000000 --- a/app/src/main/res/values-fr-rCA/strings_info.xml +++ /dev/null @@ -1,42 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<resources> - <string name="label_user_away">Absent</string> - <string name="label_user_away_reason">Raison</string> - <string name="label_user_identity">Identité</string> - <string name="label_user_account">Compte</string> - <string name="label_user_ident">Identité</string> - <string name="label_user_host">Hôte</string> - <string name="label_user_server">Serveur</string> - <string name="label_core_version">Version</string> - <string name="label_core_uptime">Durée de Fonctionnement</string> - <string name="label_core_security">Sécurité</string> - <string name="label_core_clients">Clients</string> - <string name="label_core_online_since">En ligne depuis %1$s</string> - <string name="label_core_connected_since">Connecté depuis %1$s</string> - <string name="label_core_connection_verified_by">Connection vérifiée par %1$s</string> - <string name="label_core_connection_verified_by_unknown">Inconnu</string> - <string name="label_core_connection_insecure">Connection Non-Sécurisée</string> - - <string name="property_group_ircchannel_channel">Chaîne</string> - <string name="property_ircchannel_topic">Topique</string> - <string name="property_ircchannel_topic_action_edit">Changer le Topique</string> - <string name="property_ircchannel_topic_default">Aucun Topique</string> -</resources> diff --git a/app/src/main/res/values-fr-rCA/strings_messages.xml b/app/src/main/res/values-fr-rCA/strings_messages.xml deleted file mode 100644 index a7419f730faaea9ef23fb00d69d2a579aa7dc151..0000000000000000000000000000000000000000 --- a/app/src/main/res/values-fr-rCA/strings_messages.xml +++ /dev/null @@ -1,52 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<resources> - <plurals name="message_netsplit_join"> - <item quantity="one">Netsplit entre %1$s et %2$s est terminé: %3$d nouvel utilisateur: %4$s</item> - <item quantity="other">Netsplit entre %1$s et %2$s est terminé: %3$d nouveaux utilisateurs: %4$s</item> - </plurals> - <plurals name="message_netsplit_quit"> - <item quantity="one">Netsplit entre %1$s et %2$s: %3$d utilisateur a quitté: %4$s</item> - <item quantity="other">Netsplit entre %1$s et %2$s: %3$d utilisateurs ont quittés: %4$s</item> - </plurals> - <string name="message_type_join">Joindre</string> - <string name="message_type_part">Partir</string> - <string name="message_type_quit">Quitter</string> - <string name="message_type_nick">Nom</string> - <string name="message_type_mode">Mode</string> - <string name="message_type_topic">Topique</string> - - <string name="message_format_copy">[%1$s] %2$s</string> - <string name="message_format_copy_complex">[%1$s] < %2$s> %3$s</string> - <string name="message_format_action">— %1$s%2$s %3$s</string> - <string name="message_format_notice">[%1$s%2$s] %3$s</string> - <string name="message_format_nick">%1$s%2$s est maintenant connu selon: %3$s%4$s</string> - <string name="message_format_nick_self">Vous êtes maintenant connus selon: %1$s%2$s</string> - <string name="message_format_mode">Mode %1$s par %2$s%3$s</string> - <string name="message_format_join">%1$s%2$s a joint %3$s</string> - <string name="message_format_part_1">%1$s%2$s est parti</string> - <string name="message_format_part_2">%1$s%2$s est parti (%3$s)</string> - <string name="message_format_quit_1">%1$s%2$s a quitté</string> - <string name="message_format_quit_2">%1$s%2$s a quitté (%3$s)</string> - <string name="message_format_kick_1">%1$s a été expulsé %2$s%3$s</string> - <string name="message_format_kick_2">%1$s a été expulsé par %2$s%3$s (%4$s)</string> - <string name="message_format_kill_1">%1$s a été supprimé %2$s%3$s</string> - <string name="message_format_kill_2">%1$s a été supprimé par %2$s%3$s (%4$s)</string> -</resources> diff --git a/app/src/main/res/values-fr-rCA/strings_preferences.xml b/app/src/main/res/values-fr-rCA/strings_preferences.xml deleted file mode 100644 index ecd5d9c387c649a5898a5098f56a4d6ecd647d70..0000000000000000000000000000000000000000 --- a/app/src/main/res/values-fr-rCA/strings_preferences.xml +++ /dev/null @@ -1,149 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<resources> - <string name="preference_appearance_title">Apparences</string> - - <string name="preference_theme_title">Thèmes</string> - <string name="preference_theme_entry_material_light">Material (Clair)</string> - <string name="preference_theme_entry_material_dark">Material (Sombre)</string> - <string name="preference_theme_entry_quassel_light">Quassel (Clair)</string> - <string name="preference_theme_entry_quassel_dark">Quassel (Sombre)</string> - <string name="preference_theme_entry_amoled">AMOLED</string> - <string name="preference_theme_entry_solarized_light">Solarized (Clair)</string> - <string name="preference_theme_entry_solarized_dark">Solarized (Sombre)</string> - <string name="preference_theme_entry_gruvbox_light">Gruvbox (Clair)</string> - <string name="preference_theme_entry_gruvbox_dark">Gruvbox (Sombre)</string> - <string name="preference_theme_entry_dracula">Dracula</string> - <string name="preference_input_enter_title">Entrez une clef à partir du clavier</string> - <string name="preference_input_enter_entry_emoji">Emoji</string> - <string name="preference_input_enter_entry_send">Envoyer</string> - <string name="preference_show_lag_title">Montrer le lag</string> - <string name="preference_show_lag_summary">Montrer le lag entre le Client et le Core dans la barre d\'action</string> - - <string name="preference_keep_screen_on_title">Garder l\'Écran Actif</string> - <string name="preference_keep_screen_on_summary">Prévenir l\'appareil de se mettre en veille pendant que l\'application est dans l\'avant-plan</string> - - <string name="preference_language_title">Langue</string> - <string name="preference_language_entry_auto">Défauts du Système</string> - <string name="preference_notifications_title">Notifications</string> - - <string name="preference_notification_query_title">Messages Privés</string> - - <string name="preference_notification_channel_title">Messages de la Chaîne</string> - - <string name="preference_notification_other_title">Autres Messages</string> - - <string name="preference_notification_sound_title">Son de Notifications</string> - - <string name="preference_notification_vibration_title">Vibration</string> - - <string name="preference_notification_light_title">LED</string> - - <string name="preference_notification_configure_title">Configurer les Notifications</string> - - <string name="preference_notifications_level_all">Tous les Messages</string> - <string name="preference_notifications_level_highlight">Mentions</string> - <string name="preference_notifications_level_none">Jamais</string> - <string name="preference_messages_title">Messages</string> - - <string name="preference_monospace_title">Utiliser une Police Monospace</string> - - <string name="preference_textsize_title">Grosseur du Texte</string> - - <string name="preference_show_seconds_title">Montrer les Secondes</string> - - <string name="preference_use_24h_clock_title">Utiliser une Horloge 24h</string> - - <string name="preference_colorize_mirc_title">Utiliser les Couleurs mIRC</string> - <string name="preference_colorize_mirc_summaryon">Montrer les couleurs de style mIRC dans les messages</string> - <string name="preference_colorize_mirc_summaryoff">Enlever les couleurs de style mIRC des messages</string> - - <string name="preference_colorize_nicknames_title">Colorier les noms d\'utilisateur</string> - <string name="preference_colorize_nicknames_entry_all">Tous les noms</string> - <string name="preference_colorize_nicknames_entry_all_but_mine">Tous les noms sauf le mien</string> - <string name="preference_colorize_nicknames_entry_none">Aucuns noms</string> - <string name="preference_show_prefix_title">Montrer les modes en préfixe</string> - <string name="preference_show_prefix_entry_all">Tous les modes</string> - <string name="preference_show_prefix_entry_highest">Seulement le plus haut mode</string> - <string name="preference_show_prefix_entry_none">Aucuns modes</string> - <string name="preference_hostmask_actions_title">Montrer le Hostmask dans les actions</string> - <string name="preference_hostmask_actions_summary">Montrer le nom!identité@hôte complet dans les messages de style join/part/quit</string> - - <string name="preference_nicks_on_new_line_title">Séparer les noms d\'utilisateur</string> - <string name="preference_nicks_on_new_line_summary">Montrer les noms d\'utilisateur sur une ligne séparée</string> - - <string name="preference_show_realnames_title">Montrer les Noms Réels</string> - - <string name="preference_show_avatars_title">Montrer les Avatars</string> - - <string name="preference_square_avatars_title">Avatars Carrés</string> - - <string name="preference_show_irccloud_avatars_title">Montrer les Avatars IRCCloud</string> - <string name="preference_show_irccloud_avatars_summary">Montrer, pour les utilisateurs sans avatars, leur avatar IRCCloud si possible</string> - - <string name="preference_show_gravatar_avatars_title">Montrer les Avatars Gravatar</string> - <string name="preference_show_gravatar_avatars_summary">Montrer, pour les utilisateurs sans avatar, leur Gravatar si possible</string> - - <string name="preference_show_matrix_avatars_title">Montrer les Avatars Matrix</string> - <string name="preference_show_matrix_avatars_summary">Montrer, pour les utilisateurs sans avatars, leur avatar Matrix si possible.</string> - - <string name="preference_time_at_end_title">Marqueurs de temps alignés à droite</string> - <string name="preference_time_at_end_summary">Aligner les marqueurs de temps à la fin de chaque message</string> - - <string name="preference_larger_emoji_title">Réactions Plus Grosses</string> - <string name="preference_larger_emoji_summary">Grossir les emoji si le message ne contient que des emojis</string> - - <string name="preference_autocomplete_title">Auto-Complétion</string> - - <string name="preference_autocomplete_sender_doubleclick_title">Auto-Complétion de l\'expéditeur</string> - <string name="preference_autocomplete_sender_doubleclick_summary">Double-cliquer sur un message pour auto-compléter à partir de son expéditeur</string> - - <string name="preference_autocomplete_button_title">Bouton d\'Auto-Complétion</string> - <string name="preference_autocomplete_button_summary">Montrer un bouton à gauche de la zone de texte qui initie la complétion</string> - - <string name="preference_autocomplete_doubletap_title">Tapez deux fois pour auto-compléter</string> - <string name="preference_autocomplete_doubletap_summary">Suggérer des noms et des chaînes après un clique double dans la zone de texte</string> - - <string name="preference_autocomplete_auto_title">Montrer automatiquement</string> - <string name="preference_autocomplete_auto_summary">Suggérer des noms et des chaînes après avoir entré les 3 premiers caractères</string> - - <string name="preference_autocomplete_prefix_title">Montrer après le préfixe</string> - <string name="preference_autocomplete_prefix_summary">Suggérer des noms et des chaînes après @ ou #</string> - - <string name="preference_autocomplete_nicks_title">Auto-Compléter les Noms d\'Utilisateurs</string> - - <string name="preference_autocomplete_buffers_title">Auto-Compléter les Tchats</string> - - <string name="preference_autocomplete_aliases_title">Auto-Compléter les Commandes</string> - - <string name="preference_backlog_title">Messages Antérieurs Affichés</string> - - <string name="preference_page_size_title">Taille de la Page</string> - <string name="preference_page_size_summary">Le nombre de messages affichés et gardés en mémoire en un temps donné</string> - - <string name="preference_initial_amount_title">Montant Initial</string> - <string name="preference_initial_amount_summary">Nombre de messages à montrer quand le tchat est initialement ouvert</string> - - <string name="preference_connection_title">Connection</string> - - <string name="preference_show_notification_title">Montrer la notification</string> - <string name="preference_show_notification_summary">Garde Quasseldroid connecté en permanence en montrant une notification persistante</string> - -</resources> diff --git a/app/src/main/res/values-fr-rCA/strings_settings.xml b/app/src/main/res/values-fr-rCA/strings_settings.xml deleted file mode 100644 index 43c1470d88ce77b359a8a77711ebeaa16f45cb91..0000000000000000000000000000000000000000 --- a/app/src/main/res/values-fr-rCA/strings_settings.xml +++ /dev/null @@ -1,154 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<resources> - <string name="settings_networks_title">Réseaux</string> - <string name="settings_network_title">Réseaux</string> - <string name="settings_network_network_name">Noms de Réseaux</string> - <string name="settings_network_identity">Identités</string> - <string name="settings_network_sasl_enabled">SASL</string> - <string name="settings_network_sasl_account">Compte</string> - <string name="settings_network_sasl_password">Mot de Passe</string> - <string name="settings_network_autoidentify_enabled">S\'Identifier Automatiquement</string> - <string name="settings_network_autoidentify_service">Service</string> - <string name="settings_network_autoidentify_password">Mot de Passe</string> - <string name="settings_network_connection">Connection</string> - <string name="settings_network_perform">Performer</string> - <string name="settings_network_rejoin_channels">Rejoindre les Chaînes</string> - <string name="settings_network_autoreconnect_enabled">Reconnection Automatique</string> - <string name="settings_network_autoreconnect_interval">Intervalle</string> - <string name="settings_network_autoreconnect_interval_unit">secondes</string> - <string name="settings_network_autoreconnect_attempts">Attentats Maximales</string> - <string name="settings_network_autoreconnect_unlimited">Attentats Illimités</string> - <string name="settings_network_customratelimits_enabled">Limite de Fréquence Personnalisée</string> - <string name="settings_network_customratelimits_burstsize">Grosseur des Rafales</string> - <string name="settings_network_customratelimits_unlimited">Illimité</string> - <string name="settings_network_customratelimits_delay">Délais</string> - <string name="settings_network_customratelimits_interval_unit">secondes</string> - - <string name="settings_networkserver_title">Serveur du Réseau</string> - <string name="settings_networkserver_connection">Connection</string> - <string name="settings_networkserver_host">Hôte</string> - <string name="settings_networkserver_port">Port</string> - <string name="settings_networkserver_ssl_enabled">Utiliser SSL</string> - <string name="settings_networkserver_ssl_verify">Vérifier SSL</string> - <string name="settings_networkserver_password">Mot de Passe</string> - <string name="settings_networkserver_proxy_enabled">Utiliser un Proxy</string> - <string name="settings_networkserver_proxy_type">Type</string> - <string name="settings_networkserver_proxy_type_http">HTTP</string> - <string name="settings_networkserver_proxy_type_socks5">SOCKS 5</string> - <string name="settings_networkserver_proxy_host">Hôte</string> - <string name="settings_networkserver_proxy_port">Port</string> - <string name="settings_networkserver_proxy_user">Nom d\'Utilisateur</string> - <string name="settings_networkserver_proxy_pass">Mot de Passe</string> - - <string name="settings_identities_title">Identités</string> - <string name="settings_identity_title">Identité</string> - <string name="settings_identity_names">Noms</string> - <string name="settings_identity_identity_name">Nom d\'Identité</string> - <string name="settings_identity_real_name">Nom Réel</string> - <string name="settings_identity_ident">Identité</string> - <string name="settings_identity_nick">Nom d\'Utilisateur</string> - <string name="settings_identity_nicks">Noms d\'Utilisateur</string> - <string name="settings_identity_messages">Messages</string> - <string name="settings_identity_kick_reason">Raison d\'Expulsion</string> - <string name="settings_identity_part_reason">Raison de Départure</string> - <string name="settings_identity_quit_reason">Raison de Déconnection</string> - <string name="settings_identity_away">Messages d\'Absence</string> - <string name="settings_identity_away_reason">Message d\'Absence</string> - <string name="settings_identity_detach_away">Absent si Détaché</string> - <string name="settings_identity_detach_away_reason">Message d\'Absence Quand Détaché</string> - - <string name="settings_chatlists_title">Listes de Tchats</string> - <string name="settings_chatlist_title">Liste de Tchats</string> - <string name="settings_chatlist_ui">Interface Usagé</string> - <string name="settings_chatlist_buffer_view_name">Nom</string> - <string name="settings_chatlist_show_search">Montrer la Recherche</string> - <string name="settings_chatlist_sort_alphabetically">Trier Par Ordre Alphabétique</string> - <string name="settings_chatlist_add_new_buffers_automatically">Ajouter les nouveaux tchats automatiquement</string> - <string name="settings_chatlist_network">Réseau</string> - <string name="settings_chatlist_show_status_buffer">Montrer le Status</string> - <string name="settings_chatlist_types">Types de Tchats</string> - <string name="settings_chatlist_show_channels">Montrer les Chaînes</string> - <string name="settings_chatlist_show_queries">Montrer les Requêtes</string> - <string name="settings_chatlist_activity">Activité</string> - <string name="settings_chatlist_minimum_activity_no_activity">Aucune Activité</string> - <string name="settings_chatlist_minimum_activity_other_activity">Autre Activité</string> - <string name="settings_chatlist_minimum_activity_new_message">Nouveau Message</string> - <string name="settings_chatlist_minimum_activity_highlight">Highlight</string> - <string name="settings_chatlist_hide_inactive_buffers">Cacher les Tchats Inactifs</string> - <string name="settings_chatlist_hide_inactive_networks">Cacher les Réseaux Inactifs</string> - - <string name="settings_ignorelist_title">Liste d\'Utilisateurs Ignorés</string> - - <string name="settings_ignoreitem_title">Règle à Ignorer</string> - <string name="settings_ignoreitem_enabled">Activé</string> - <string name="settings_ignoreitem_ignorerule">Règle à Ignorer</string> - <string name="settings_ignoreitem_isregex">Expression Régulière</string> - <string name="settings_ignoreitem_type">Type</string> - <string name="settings_ignoreitem_type_sender">Expéditeur</string> - <string name="settings_ignoreitem_type_message">Message</string> - <string name="settings_ignoreitem_type_ctcp">Ctcp</string> - <string name="settings_ignoreitem_strictness">Rigueur</string> - <string name="settings_ignoreitem_strictness_soft">Dynamique</string> - <string name="settings_ignoreitem_strictness_hard">Permanente</string> - <string name="settings_ignoreitem_scope">Périmètre</string> - <string name="settings_ignoreitem_scope_global">Global</string> - <string name="settings_ignoreitem_scope_network">Seulement sur le Réseau</string> - <string name="settings_ignoreitem_scope_channel">Seulement sur la Chaîne</string> - <string name="settings_ignoreitem_scoperule">Règle de Périmètre</string> - - <string name="settings_highlightlist_title">Highlights</string> - <string name="settings_highlightlist_highlight_nick">Highlights de Nom</string> - <string name="settings_highlightlist_highlight_nick_all_nicks">Tous les Noms de l\'Identité</string> - <string name="settings_highlightlist_highlight_nick_current_nick">Nom Utilisé</string> - <string name="settings_highlightlist_highlight_nick_none">Aucun</string> - <string name="settings_highlightlist_nicks_case_sensitive">Sensible à la Casse</string> - <string name="settings_highlightlist_rules">Règles de Highlights</string> - <string name="settings_highlightlist_ignore_rules">Règles de Highlights Ignorés</string> - - <string name="settings_highlightrule_title">Règle de Highlight</string> - <string name="settings_highlightrule_enabled">Activé</string> - <string name="settings_highlightrule_name">Nom</string> - <string name="settings_highlightrule_regular_expression">Expression Régulière</string> - <string name="settings_highlightrule_case_sensitive">Sensible à la Casse</string> - <string name="settings_highlightrule_sender">Expéditeur</string> - <string name="settings_highlightrule_channel">Chaîne</string> - - <string name="settings_aliaslist_title">Pseudonymes</string> - - <string name="settings_aliasitem_title">Pseudonyme</string> - <string name="settings_aliasitem_name">Nom</string> - <string name="settings_aliasitem_expansion">Expansion</string> - - <string name="settings_networkconfig_title">Configuration IRC</string> - <string name="settings_networkconfig_ping_timeout">Détection de Timeout du Ping</string> - <string name="settings_networkconfig_ping_interval">Intervalle de Ping</string> - <string name="settings_networkconfig_ping_interval_unit">secondes</string> - <string name="settings_networkconfig_max_ping_count">Déconnecter après</string> - <string name="settings_networkconfig_max_ping_count_unit">pings manqués</string> - <string name="settings_networkconfig_auto_who">Requête d\'Informations Automatique sur Utilisateurs</string> - <string name="settings_networkconfig_auto_who_interval">Intervalle de Mise à Jour</string> - <string name="settings_networkconfig_auto_who_interval_unit">secondes</string> - <string name="settings_networkconfig_auto_who_nick_limit">Ignorer les chaînes avec plus de</string> - <string name="settings_networkconfig_auto_who_nick_limit_unit">utilisateurs</string> - <string name="settings_networkconfig_auto_who_delay">Délais minimum entre requêtes</string> - <string name="settings_networkconfig_auto_who_delay_unit">secondes</string> - <string name="settings_networkconfig_standard_ctcp">CTCP conforme aux standards</string> -</resources> diff --git a/app/src/main/res/values-fr-rCA/strings_setup.xml b/app/src/main/res/values-fr-rCA/strings_setup.xml deleted file mode 100644 index ec4a7d84052a5bd449fe393f3a629a14451408b4..0000000000000000000000000000000000000000 --- a/app/src/main/res/values-fr-rCA/strings_setup.xml +++ /dev/null @@ -1,84 +0,0 @@ -<!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<resources> - <!-- Account Selection --> - <string name="slide_account_select_title">Sélectionner un Compte</string> - <string name="slide_account_select_description">Veuillez sélectionner un compte à partir de la liste, ou en ajouter un</string> - <string name="label_user_on_host">%1$s sur %2$s:%3$d</string> - - <!-- Account Setup --> - - <!-- Account Connection --> - <string name="slide_account_connection_title">Connection</string> - <string name="slide_account_connection_description">Premièrement, choisissez le serveur où votre Core est hébergé.</string> - - <string name="label_connection_host">Hôte</string> - <string name="label_connection_port">Port</string> - <string name="hint_invalid_host">Pas un nom d\'hôte valide</string> - <string name="hint_invalid_port">Pas un port valide</string> - - <!-- Account User --> - <string name="slide_account_user_title">Votre Compte</string> - <string name="slide_account_user_description">Maintenant, veuillez entrer le nom d\'utilisateur et le mot de passe pour votre compte sur le Core. Si vous venez de créer ce core, nous allons le créer pour vous.</string> - - <string name="label_account_user">Nom d\'Utilisateur</string> - <string name="label_account_pass">Mot de Passe</string> - - <string name="hint_invalid_user">Le nom d\'utilisateur ne peut pas être vide</string> - - <!-- Account Name --> - <string name="slide_account_name_title">Personnaliser le nom du compte</string> - <string name="slide_account_name_description">Donnez un nom à ce compte</string> - - <string name="label_account_name">Nom de compte</string> - - <string name="hint_invalid_name">Le nom ne peut pas être vide</string> - - <!-- Core Authenticator Select --> - <string name="slide_core_authenticator_select_title">Sélectionnez un protocole d\'authentication</string> - <string name="slide_core_authenticator_select_description">Veuillez sélectionner un protocole d\'authentication pour le Core Quassel, utiliser pour authentiquer les utilisateurs.</string> - - <!-- Core Backend Select --> - <string name="slide_core_backend_select_title">Sélectionner le protocole de gestion des données</string> - <string name="slide_core_backend_select_description">Veuillez sélectionner une base de donnée que le Core utilisera pour entreposer les messages reçus et autres données.</string> - - <!-- Core Backend Config --> - <string name="slide_core_backend_setup_title">Configurer le protocole de gestion des données</string> - <string name="slide_core_backend_setup_description">Veuillez configurer la base de donnée sélectionnée.</string> - - <!-- User Identity --> - <string name="slide_user_identity_title">Configurer l\'Identité</string> - <string name="slide_user_identity_description">Veuillez choisir un nom d\'utilisateur</string> - - <string name="hint_invalid_nick">Pas un nom valide</string> - - <!-- User Network --> - <string name="slide_user_network_title">Configuration du Réseau IRC</string> - <string name="slide_user_network_description">Sélectionner un réseau IRC où vous connecter.</string> - - <string name="label_network_custom">Autre Réseau…</string> - - <!-- User Channels --> - <string name="slide_user_channels_title">Configuration des Chaînes</string> - <string name="slide_user_channels_description">Sélectionnez les chaînes que vous voulez joindre.</string> - - <string name="label_channels">Chaînes</string> - -</resources> diff --git a/app/src/main/res/values-fr-rCA/strings_status.xml b/app/src/main/res/values-fr-rCA/strings_status.xml deleted file mode 100644 index 77eefe873faa3fd45be540637472b3fb4cce38dc..0000000000000000000000000000000000000000 --- a/app/src/main/res/values-fr-rCA/strings_status.xml +++ /dev/null @@ -1,27 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<resources> - <string name="label_status_disconnected">Déconnecté</string> - <string name="label_status_connecting">Connection en Cours</string> - <string name="label_status_handshake">Négotiation SSL/TLS</string> - <string name="label_status_init">Initialization</string> - <string name="label_status_connected">Connecté</string> - <string name="label_status_closed">Connection Perdue</string> -</resources> diff --git a/app/src/main/res/values-fr/strings.xml b/app/src/main/res/values-fr/strings.xml deleted file mode 100644 index 4def8cf5cfdc981086731605a5be012afb783752..0000000000000000000000000000000000000000 --- a/app/src/main/res/values-fr/strings.xml +++ /dev/null @@ -1,77 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<resources> - <string name="app_name">Quasseldroid</string> - <string name="app_description">Un client basé sur Android pour décentraliser le client Quassel IRC.</string> - <string name="app_description_long">Quassel est un client IRC distribué et décentralisé, écrit en C++ et en Qt. Quasseldroid est un client pour Quassel core en pure kotlin, vous permettant de vous connecter à votre Quassel core en utilisant votre téléphone Android™.</string> - - <string name="connection_service_title">Service de connexion</string> - <string name="connection_service_description">Garder une connexion au core pour permettre les notifications et transmettre des messages.</string> - - <string name="label_about">À propos</string> - <string name="label_accept">Accepter</string> - <string name="label_acknowledgements">Remerciements</string> - <string name="label_archive">Archive</string> - <string name="label_archive_chat">Archiver la discussion</string> - <string name="label_archived_chats">Discussions archivées</string> - <string name="label_ascending">Croissant</string> - <string name="label_authors">Auteurs</string> - <string name="label_autocomplete">Autocomplétion</string> - <string name="label_avatar">Avatar</string> - <string name="label_back">Retour</string> - <string name="label_buffer_name">Nom de la discussion</string> - <string name="label_cancel">Annuler</string> - <string name="label_certificates">Certificats</string> - <string name="label_channel_name">Nom du salon</string> - <string name="label_clear_search">Effacer la recherche</string> - <string name="label_close">Fermer</string> - <string name="label_colors_custom">Modifier</string> - <string name="label_colors_mirc">mIRC</string> - <string name="label_configure">Configuration</string> - <string name="label_connect">Connecter</string> - <string name="label_copy">Copier</string> - <string name="label_crashes">Crashs</string> - <string name="label_crashes_empty">Pas de rapports de crash trouvés</string> - <string name="label_create_channel">Créer un salon</string> - <string name="label_delete">Supprimer</string> - <string name="label_delete_all">Tout supprimer</string> - <string name="label_descending">Décroissant</string> - <string name="label_disconnect">Déconnecter</string> - <string name="label_edit_core">Éditer le compte</string> - <string name="label_edit_nick">Éditer le pseudo</string> - <string name="label_edit_topic">Éditer le topic</string> - <string name="label_edit_topic_long">Ouvrir le dialogue pour changer le topic du salon</string> - <string name="label_filter_messages">Filtrer les messages</string> - <string name="label_finish">Finir</string> - <string name="label_generate_crash_report">Générer un rapport de crash</string> - <string name="label_ignore">Ignorer</string> - <string name="label_ignore_long">Ajouter/Retirer un utilisateur dans/de la liste des ignorés</string> - <string name="label_info">Détails</string> - <string name="label_info_certificate">Certificates</string> - <string name="label_info_channel">Détails des salons</string> - <string name="label_info_channellist">Liste des salons</string> - <string name="label_info_core">Détails du core</string> - <string name="label_info_user">Détails de l\'utilisateur</string> - <string name="label_input_history">Historique des entrées</string> - <string name="label_join">Joindre</string> - <string name="label_join_long">Joindre le salon</string> - <string name="label_libraries">Librairies</string> - <string name="label_license">Licence</string> -</resources> diff --git a/app/src/main/res/values-fr/strings_certificates.xml b/app/src/main/res/values-fr/strings_certificates.xml deleted file mode 100644 index 8dd7d377467c042e001568c8d47116c1e10e8c3f..0000000000000000000000000000000000000000 --- a/app/src/main/res/values-fr/strings_certificates.xml +++ /dev/null @@ -1,20 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<resources></resources> diff --git a/app/src/main/res/values-fr/strings_contributors.xml b/app/src/main/res/values-fr/strings_contributors.xml deleted file mode 100644 index 8dd7d377467c042e001568c8d47116c1e10e8c3f..0000000000000000000000000000000000000000 --- a/app/src/main/res/values-fr/strings_contributors.xml +++ /dev/null @@ -1,20 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<resources></resources> diff --git a/app/src/main/res/values-fr/strings_defaults.xml b/app/src/main/res/values-fr/strings_defaults.xml deleted file mode 100644 index 0811da74ca6f0075af03cac11e3034ad27241b41..0000000000000000000000000000000000000000 --- a/app/src/main/res/values-fr/strings_defaults.xml +++ /dev/null @@ -1,20 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<resources></resources> diff --git a/app/src/main/res/values-fr/strings_error.xml b/app/src/main/res/values-fr/strings_error.xml deleted file mode 100644 index 8dd7d377467c042e001568c8d47116c1e10e8c3f..0000000000000000000000000000000000000000 --- a/app/src/main/res/values-fr/strings_error.xml +++ /dev/null @@ -1,20 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<resources></resources> diff --git a/app/src/main/res/values-fr/strings_format.xml b/app/src/main/res/values-fr/strings_format.xml deleted file mode 100644 index 8dd7d377467c042e001568c8d47116c1e10e8c3f..0000000000000000000000000000000000000000 --- a/app/src/main/res/values-fr/strings_format.xml +++ /dev/null @@ -1,20 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<resources></resources> diff --git a/app/src/main/res/values-fr/strings_info.xml b/app/src/main/res/values-fr/strings_info.xml deleted file mode 100644 index 8dd7d377467c042e001568c8d47116c1e10e8c3f..0000000000000000000000000000000000000000 --- a/app/src/main/res/values-fr/strings_info.xml +++ /dev/null @@ -1,20 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<resources></resources> diff --git a/app/src/main/res/values-fr/strings_messages.xml b/app/src/main/res/values-fr/strings_messages.xml deleted file mode 100644 index 8dd7d377467c042e001568c8d47116c1e10e8c3f..0000000000000000000000000000000000000000 --- a/app/src/main/res/values-fr/strings_messages.xml +++ /dev/null @@ -1,20 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<resources></resources> diff --git a/app/src/main/res/values-fr/strings_preferences.xml b/app/src/main/res/values-fr/strings_preferences.xml deleted file mode 100644 index 8dd7d377467c042e001568c8d47116c1e10e8c3f..0000000000000000000000000000000000000000 --- a/app/src/main/res/values-fr/strings_preferences.xml +++ /dev/null @@ -1,20 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<resources></resources> diff --git a/app/src/main/res/values-fr/strings_settings.xml b/app/src/main/res/values-fr/strings_settings.xml deleted file mode 100644 index 8dd7d377467c042e001568c8d47116c1e10e8c3f..0000000000000000000000000000000000000000 --- a/app/src/main/res/values-fr/strings_settings.xml +++ /dev/null @@ -1,20 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<resources></resources> diff --git a/app/src/main/res/values-fr/strings_setup.xml b/app/src/main/res/values-fr/strings_setup.xml deleted file mode 100644 index 45865e8ec29aa1fbf44562af62b8e495dd971095..0000000000000000000000000000000000000000 --- a/app/src/main/res/values-fr/strings_setup.xml +++ /dev/null @@ -1,20 +0,0 @@ -<!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<resources></resources> diff --git a/app/src/main/res/values-fr/strings_status.xml b/app/src/main/res/values-fr/strings_status.xml deleted file mode 100644 index 8dd7d377467c042e001568c8d47116c1e10e8c3f..0000000000000000000000000000000000000000 --- a/app/src/main/res/values-fr/strings_status.xml +++ /dev/null @@ -1,20 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<resources></resources> diff --git a/app/src/main/res/values-it/strings.xml b/app/src/main/res/values-it/strings.xml deleted file mode 100644 index d9dfed1ea745b60fe470a988b5b15da1791d3343..0000000000000000000000000000000000000000 --- a/app/src/main/res/values-it/strings.xml +++ /dev/null @@ -1,204 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<resources xmlns:tools="http://schemas.android.com/tools"> - <plurals name="label_user_count"> - <item quantity="one">%1$d utente</item> - <item quantity="other">%1$d utenti</item> - </plurals> - <string name="app_name">Quasseldroid</string> - <string name="app_description">Un client Android per utilizzare IRC in modo decentralizzato con Quassel.</string> - - <string name="app_description_long">Quassel è un client IRC distribuito e decentralizzato, scritto in C++ e Qt. Quasseldroid è un client per il core Quassel scritto interamente in Kotlin che ti offre la possibilità di connetterti ad un core Quassel con il tuo telefono Android™.</string> - <string name="connection_service_title">Servizio di connessione</string> - - <string name="connection_service_description">Mantiene la connessione al core per ricevere notifiche e trasmettere messaggi.</string> - <string name="label_about">Informazioni</string> - <string name="label_accept">Accetta</string> - <string name="label_acknowledgements">Ringraziamenti</string> - <string name="label_archive">Archivia</string> - <string name="label_archive_chat">Archivia chat</string> - <string name="label_archived_chats">Chat archiviate</string> - <string name="label_ascending">Ascendente</string> - <string name="label_authors">Autori</string> - <string name="label_autocomplete">Completamento automatico</string> - <string name="label_avatar">Avatar</string> - <string name="label_back">Indietro</string> - <string name="label_buffer_name">Nome chat</string> - <string name="label_cancel">Annulla</string> - <string name="label_certificates">Certificati</string> - <string name="label_channel_name">Nome del canale</string> - <string name="label_clear_search">Pulisci cerca</string> - <string name="label_close">Chiudi</string> - <string name="label_colors_custom">Personalizzato</string> - <string name="label_colors_mirc">mIRC</string> - <string name="label_configure">Configura</string> - <string name="label_connect">Connetti</string> - <string name="label_copy">Copia</string> - <string name="label_crashes">Arresti anomali</string> - <string name="label_crashes_empty">Nessun rapporto d’arresto anomalo trovato</string> - <string name="label_create_channel">Crea canale</string> - <string name="label_delete">Elimina</string> - <string name="label_delete_all">Elimina tutto</string> - <string name="label_descending">Discendente</string> - <string name="label_disconnect">Disconnetti</string> - <string name="label_edit_core">Modifica account</string> - <string name="label_edit_nick">Modifica nick</string> - <string name="label_edit_topic">Modifica argomento</string> - <string name="label_edit_topic_long">Apri finestra di dialogo per cambiare l’argomento del canale</string> - <string name="label_filter_messages">Filtro messaggi</string> - <string name="label_finish">Finito</string> - <string name="label_generate_crash_report">Genera rapporto d’arresto anomalo</string> - <string name="label_ignore">Ignora</string> - <string name="label_ignore_long">Aggiungi o rimuovi un utente dalla lista ignorati</string> - <string name="label_info">Dettagli</string> - <string name="label_info_certificate">Certificato</string> - <string name="label_info_channel">Dettagli del canale</string> - <string name="label_info_channellist">Elenco dei canali</string> - <string name="label_info_core">Dettagli del core</string> - <string name="label_info_user">Dettagli dell’utente</string> - <string name="label_input_history">Storico dei messaggi</string> - <string name="label_join">Entra</string> - <string name="label_join_long">Entra nel canale</string> - <string name="label_libraries">Librerie</string> - <string name="label_license">Licenza</string> - <string name="label_mark_read">Segna come letto</string> - <string name="label_match_all">Corrisponde a tutti i messaggi</string> - <string name="label_mention">Menzionare</string> - <string name="label_mention_long">Copia il nome utente nella casella di digitazione</string> - <string name="label_network">Rete</string> - <string name="label_new_account">Nuovo account</string> - <string name="label_new_chatlist">Nuovo elenco chat</string> - <string name="label_new_highlight_ignore_rule">Nuova regola per ignorare menzione</string> - <string name="label_new_highlight_rule">Nuova regola per menzione</string> - <string name="label_new_identity">Nuova identità</string> - <string name="label_new_ignore_rule">Nuova regola per ignorare</string> - <string name="label_new_network">Nuova rete</string> - <string name="label_new_nick">Nuovo nick</string> - <string name="label_new_server">Nuovo server</string> - <string name="label_next">Successivo</string> - <string name="label_nick">Nick</string> - <string name="label_nicklist">Elenco nick</string> - <string name="label_no">No</string> - <string name="label_no_away_message">Nessun messaggio d’assenza disponibile</string> - <string name="label_no_sound">Nessuno</string> - <string name="label_open">Apri</string> - <string name="label_part">Esci</string> - <string name="label_part_long">Esci dal canale</string> - <string name="label_password_change">Cambia password</string> - <string name="label_password_error_nomatch">La password non corrisponde</string> - <string name="label_password_error_wrong">Password sbagliata</string> - <string name="label_password_new">Nuova password</string> - <string name="label_password_old">Vecchia password</string> - <string name="label_password_repeat">Ripeti password</string> - <string name="label_permanently_archived">Archiviate permanentemente</string> - <string name="label_permanently_archived_empty">Non hai chat archiviate in modo permanente</string> - <string name="label_permanently_archived_long">Le chat che sono state archiviate permanentemente rimarranno nascoste finché non si provvederà manualmente a toglierle da questo stato.</string> - <string name="label_placeholder_message">Scrivi un messaggio…</string> - <string name="label_placeholder_topic">Descrivi l’argomento del canale…</string> - <string name="label_privacy_policy">Informativa privacy</string> - <string name="label_query">Privato</string> - <string name="label_query_long">Apri conversazione privata con l’utente</string> - <string name="label_query_medium">Apri conversazione privata</string> - <string name="label_rename">Rinomina</string> - <string name="label_reorder">Riordina</string> - <string name="label_reply">Rispondi</string> - <string name="label_reset">Reimposta</string> - <string name="label_save">Salva</string> - <string name="label_saving">Salvataggio…</string> - <string name="label_search">Cerca…</string> - <string name="label_search_buffer">Cerca chat</string> - <string name="label_search_channels">Cerca canali</string> - <string name="label_select">Seleziona</string> - <string name="label_send">Invia</string> - <string name="label_service_connection_failed">Impossibile stabilire la connessione, controlla le impostazioni di risparmio della batteria. Consulta dontkillmyapp.com per maggiori informazioni.</string> - <string name="label_set_default">Imposta come predefinito</string> - <string name="label_settings">Impostazioni</string> - <string name="label_settings_client">Impostazioni del client</string> - <string name="label_settings_core">Impostazioni del core</string> - <string name="label_share">Condividi</string> - <string name="label_share_crashreport">Condividi rapporto d’arresto anomalo</string> - <string name="label_shortcut">Scorciatoia</string> - <string name="label_shortcut_long">Crea scorciatoia nella schermata Home</string> - <string name="label_sort">Ordina</string> - <string name="label_source">Sorgente</string> - <string name="label_temporarily_archived">Archiviate temporaneamente</string> - <string name="label_temporarily_archived_empty">Non hai chat archiviate in modo temporaneo</string> - <string name="label_temporarily_archived_long">Le chat che sono state archiviate temporaneamente torneranno visibili alla ricezione di un nuovo messaggio.</string> - <string name="label_topic">Argomento del canale</string> - <string name="label_translators">Traduttori</string> - <string name="label_unhide">Rendi visibile</string> - <string name="label_unknown_sender"><Sconosciuto></string> - <string name="label_update_user_password">Aggiorna il nome utente e la password</string> - <string name="label_use_default">Utilizza i valori predefiniti</string> - <string name="label_user_count">Numero di utenti</string> - <string name="label_website">Sito web</string> - <string name="label_whitelist">Ignora</string> - <string name="label_whitelist_certificates">Certificati</string> - <string name="label_whitelist_certificates_empty">Nessun certificato consentito</string> - <string name="label_whitelist_hostnames">Host</string> - <string name="label_whitelist_hostnames_empty">Nessun host consentito</string> - <string name="label_whitelist_ignore_date">La data di scadenza viene ignorata per questo certificato</string> - <string name="label_who">Who</string> - <string name="label_who_long">Aggiorna le informazioni per tutti gli utenti</string> - <string name="label_whois">Whois</string> - <string name="label_whois_long">Aggiorna le informazioni dell’utente</string> - - <string name="label_yes">Sì</string> - - <string name="label_feature_synchronizedmarkerline">Necessario per sincronizzare l’ultima posizione nei canali</string> - <string name="label_feature_saslauthentication">Necessario per SASL</string> - <string name="label_feature_saslexternal">Necessario per SASL con certificati</string> - <string name="label_feature_hideinactivenetworks">Necessario per nascondere le reti inattive nell’elenco delle chat</string> - <string name="label_feature_passwordchange">Necessario per cambiare la password dal client</string> - <string name="label_feature_capnegotiation">Necessario per le funzionalità IRCv3</string> - <string name="label_feature_verifyserverssl">Necessario per verificare il certificato SSL della rete IRC in fase di connessione</string> - <string name="label_feature_customratelimits">Necessario per specificare limiti di frequenza personalizzati per le reti IRC</string> - <string name="label_feature_awayformattimestamp">Necessario per la formattazione personalizzata della data e dell’ora nei messaggi d’assenza</string> - <string name="label_feature_bufferactivitysync">Necessario per visualizzare l’attività delle chat nell’elenco delle chat</string> - <string name="label_feature_coresidehighlights">Necessario per le menzioni</string> - <string name="label_feature_senderprefixes">Necessario per visualizzare i prefissi dei modi (+, @) degli utenti nei messaggi</string> - <string name="label_feature_remotedisconnect">Necessario per la disconnessione da remoto dei tuoi client</string> - <string name="label_feature_richmessages">Necessario per visualizzare i nomi reali oppure gli avatar di IRCv3 o di Gravatar nei messaggi</string> - <string name="label_feature_backlogfiltertype">Necessario per ricevere le notifiche precedenti alla connessione</string> - - <string name="label_feature_context_bufferactivitysync">Quasseldroid non può evidenziare le chat non lette. Aggiorna il tuo core a Quassel v0.13 per risolvere.</string> - <string name="label_feature_context_coresidehighlights">Quasseldroid non può configurare le menzioni. Aggiorna il tuo core a Quassel v0.13 per risolvere.</string> - <string name="label_feature_context_missing">Il tuo core non ha le funzionalità richieste da Quasseldroid per funzionare correttamente.</string> - <string name="label_feature_context_missing_button">Dettagli</string> - - <string name="notification_channel_connection_title">Connessione</string> - <string name="notification_channel_highlight_title">Menzioni</string> - <string name="notification_channel_old_highlight_title">Menzioni precedenti</string> - - <string name="label_missing_features">Funzionalità assenti</string> - <string name="info_missing_features" tools:ignore="StringFormatCount">Il tuo core non ha le funzionalità richieste da Quasseldroid per funzionare correttamente. Dovresti <a href=\"https://quassel-irc.org\">aggiornare</a> il tuo core Quassel a %1$s o superiore.</string> - - <string name="buffer_delete_confirmation">Vuoi eliminare questa chat per sempre?</string> - <string name="buffer_archive_confirmation">Vuoi archiviare questa chat?</string> - <string name="buffer_archive_temporarily">Fai riapparire automaticamente questa chat all’arrivo di nuovi messaggi</string> - - <string name="delete_confirmation">Sei sicuro di voler eliminare questa chat per sempre? L’operazione è irreversibile.</string> - <string name="cancel_confirmation">Ci sono delle modifiche non salvate. Sei sicuro di voler continuare senza salvarle?</string> - - <string name="info_copied_version">La versione è stato copiata negli appunti</string> - - <string name="advertisement_support_patreon">Per favore supporta lo sviluppo di questa app su Patreon</string> - <string name="advertisement_support_button">Supporta lo sviluppo</string> -</resources> diff --git a/app/src/main/res/values-it/strings_certificates.xml b/app/src/main/res/values-it/strings_certificates.xml deleted file mode 100644 index 915f4a775876e592bcb2a684f7618c4d1a5f75ba..0000000000000000000000000000000000000000 --- a/app/src/main/res/values-it/strings_certificates.xml +++ /dev/null @@ -1,39 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<resources> - <string name="certificate_subject">Rilasciato a</string> - <string name="certificate_issuer">Rilasciato da</string> - - <string name="certificate_common_name">Nome comune (CN)</string> - <string name="certificate_organization">Organizzazione (O)</string> - <string name="certificate_organizational_unit">Unità organizzativa (OU)</string> - - <string name="certificate_hostnames">Nomi host</string> - - <string name="certificate_validity">Periodo di validità</string> - - <string name="certificate_not_before">Valido da</string> - <string name="certificate_not_after">Valido fino a</string> - - <string name="certificate_fingerprints">Firme elettroniche</string> - - <string name="certificate_fingerprint_sha256">Firma elettronica SHA-256</string> - <string name="certificate_fingerprint_sha1">Firma elettronica SHA-1</string> -</resources> diff --git a/app/src/main/res/values-it/strings_contributors.xml b/app/src/main/res/values-it/strings_contributors.xml deleted file mode 100644 index 4d2a4c3a9bebae32631e218b0322b8b9241bf535..0000000000000000000000000000000000000000 --- a/app/src/main/res/values-it/strings_contributors.xml +++ /dev/null @@ -1,26 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<resources> - <string name="contributor_description_freqmod">Tentativi di deserializzazione iniziale del QDataStream</string> - <string name="contributor_description_sandsmark">Implementazione del protocollo precedente, (de)serializzazioni, (de)moralizzatore del progetto</string> - <string name="contributor_description_magnuf">Interfaccia precedente</string> - <string name="contributor_description_kenji">Interfaccia precedente</string> - <string name="contributor_description_justjanne">Riscrittura, interfaccia, processori di annotazione, motore</string> -</resources> diff --git a/app/src/main/res/values-it/strings_defaults.xml b/app/src/main/res/values-it/strings_defaults.xml deleted file mode 100644 index 9e1aac79e6132c201a561680f9ba2c2bcfc64f60..0000000000000000000000000000000000000000 --- a/app/src/main/res/values-it/strings_defaults.xml +++ /dev/null @@ -1,31 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<resources> - <string name="default_bufferviewconfig_name">Tutte le chat</string> - - <string name="default_identity_identity_name">Identità predefinita</string> - <string name="default_identity_realname">Utente Quassel IRC</string> - <string name="default_identity_awayreason">Sono andato a pescare.</string> - <string name="default_identity_autoawayreason">Non sono qui. No, davvero. Non sono qui!</string> - <string name="default_identity_detachawayreason">Tutti i client Quassel sono spariti dalla faccia della Terra…</string> - <string name="default_identity_kickreason">Non siamo all’asilo!</string> - <string name="default_identity_partreason">https://quassel-irc.org - La chat diventa comoda. Ovunque.</string> - <string name="default_identity_quitreason">https://quassel-irc.org - La chat diventa comoda. Ovunque.</string> -</resources> diff --git a/app/src/main/res/values-it/strings_error.xml b/app/src/main/res/values-it/strings_error.xml deleted file mode 100644 index 8bcd8f1a0b2f7b2c3ef2df210e6a8b0e2dca0ba3..0000000000000000000000000000000000000000 --- a/app/src/main/res/values-it/strings_error.xml +++ /dev/null @@ -1,49 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<resources> - <string name="label_error_login">Errore d’autenticazione</string> - <string name="label_error_setup">Errore di configurazione</string> - <string name="label_error_init">Errore di connessione</string> - <string name="label_error_ssl">Errore SSL</string> - <string name="label_error_ssl_required_unavailable">Per stabilire la connessione è richiesto SSL ma il core non lo supporta.</string> - <string name="label_error_certificate">Errore del certificato</string> - <string name="label_error_certificate_no_certificate">Nessun certificato disponibile</string> - <string name="label_error_certificate_no_hostname">Nessun nome host disponibile</string> - <string name="label_error_certificate_invalid"><![CDATA[ - <p>Il certificato con l’impronta<br/> - <code>%1$s</code><br/> - è valido esclusivamente dal %2$s al %3$s</p> - ]]></string> - <string name="label_error_certificate_untrusted"><![CDATA[ - <p>Il certificato con l’impronta<br/> - <code>%1$s</code><br/> - non è affidabile.</p> - ]]></string> - <string name="label_error_certificate_no_match"><![CDATA[ - <p>Il certificato con l’impronta<br/> - <code>%1$s</code><br/> - non è valido per %2$s.</p> - ]]></string> - - <string name="label_error_unknown_host">Host non trovato: %1$s</string> - <string name="label_error_invalid_protocol_version">Protocollo non valido: %1$d</string> - <string name="label_error_connection">Errore riscontrato durante la connessione: %1$s (%2$s)</string> - <string name="label_error_connection_closed">Errore: la connessione è stata chiusa in modo imprevisto</string> -</resources> diff --git a/app/src/main/res/values-it/strings_format.xml b/app/src/main/res/values-it/strings_format.xml deleted file mode 100644 index 6cf0291d3b614c3054fe1b9e0a18ac2491af4014..0000000000000000000000000000000000000000 --- a/app/src/main/res/values-it/strings_format.xml +++ /dev/null @@ -1,29 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<resources> - <string name="label_bold">Grassetto</string> - <string name="label_italic">Corsivo</string> - <string name="label_strikethrough">Barrato</string> - <string name="label_underline">Sottolineato</string> - <string name="label_monospace">Spaziatura fissa</string> - <string name="label_foreground">Colore di primo piano</string> - <string name="label_background">Colore di sfondo</string> - <string name="label_clear_formatting">Cancella formattazione</string> -</resources> diff --git a/app/src/main/res/values-it/strings_info.xml b/app/src/main/res/values-it/strings_info.xml deleted file mode 100644 index bf26b3df8bee582da413e1ee50c47a298e7f80a0..0000000000000000000000000000000000000000 --- a/app/src/main/res/values-it/strings_info.xml +++ /dev/null @@ -1,47 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<resources> - <string name="label_user_away">Assente</string> - <string name="label_user_away_reason">Motivo</string> - <string name="label_user_identity">Identità</string> - <string name="label_user_account">Account</string> - <string name="label_user_ident">Ident</string> - <string name="label_user_host">Host</string> - <string name="label_user_server">Server</string> - <string name="label_user_common_channels">Canali in comune</string> - - <string name="label_core_version">Versione</string> - <string name="label_core_uptime">Tempo di attività</string> - <string name="label_core_security">Sicurezza</string> - <string name="label_core_clients">Client</string> - <string name="label_core_online_since">In linea da %1$s</string> - <string name="label_core_connected_since">Connesso da %1$s</string> - <string name="label_core_connection_verified_by">Connessione verificata da %1$s</string> - <string name="label_core_connection_protocol">La connessione utilizza %1$s</string> - <string name="label_core_connection_ciphersuite">La connessione è crittografata ed autenticata con %1$s ed utilizza %2$s come meccanismo di scambio delle chiavi</string> - <string name="label_core_connection_ciphersuite_13">La connessione è crittografata ed autenticata con %1$s</string> - <string name="label_core_connection_verified_by_unknown">Sconosciuto</string> - <string name="label_core_connection_insecure">Connessione insicura</string> - - <string name="property_group_ircchannel_channel">Canale</string> - <string name="property_ircchannel_topic">Argomento</string> - <string name="property_ircchannel_topic_action_edit">Modifica argomento</string> - <string name="property_ircchannel_topic_default">Nessun argomento specificato</string> -</resources> diff --git a/app/src/main/res/values-it/strings_messages.xml b/app/src/main/res/values-it/strings_messages.xml deleted file mode 100644 index 5a6daa9ff0c870e543bc25e11a90d8a13b2e1e22..0000000000000000000000000000000000000000 --- a/app/src/main/res/values-it/strings_messages.xml +++ /dev/null @@ -1,52 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<resources> - <plurals name="message_netsplit_join"> - <item quantity="one">Netsplit tra %1$s e %2$s terminato: %3$d utente entrato: %4$s</item> - <item quantity="other">Netsplit tra %1$s e %2$s terminato: %3$d utenti entrati: %4$s</item> - </plurals> - <plurals name="message_netsplit_quit"> - <item quantity="one">Netsplit tra %1$s e %2$s: %3$d utente disconnesso: %4$s</item> - <item quantity="other">Netsplit tra %1$s e %2$s: %3$d utenti disconnessi: %4$s</item> - </plurals> - <string name="message_type_join">Entrato</string> - <string name="message_type_part">Uscito</string> - <string name="message_type_quit">Disconnesso</string> - <string name="message_type_nick">Nick</string> - <string name="message_type_mode">Modo</string> - <string name="message_type_topic">Argomento</string> - - <string name="message_format_copy">[%1$s] %2$s</string> - <string name="message_format_copy_complex">[%1$s] <%2$s> %3$s</string> - <string name="message_format_action">— %1$s%2$s %3$s</string> - <string name="message_format_notice">[%1$s%2$s] %3$s</string> - <string name="message_format_nick">%1$s%2$s è ora conosciuto come %3$s%4$s</string> - <string name="message_format_nick_self">Sei ora conosciuto come %1$s%2$s</string> - <string name="message_format_mode">Modo %1$s ad opera di %2$s%3$s</string> - <string name="message_format_join">%1$s%2$s è entrato in %3$s</string> - <string name="message_format_part_1">%1$s%2$s è uscito</string> - <string name="message_format_part_2">%1$s%2$s è uscito (%3$s)</string> - <string name="message_format_quit_1">%1$s%2$s si è disconnesso</string> - <string name="message_format_quit_2">%1$s%2$s si è disconnesso (%3$s)</string> - <string name="message_format_kick_1">%1$s è stato espulso da %2$s%3$s</string> - <string name="message_format_kick_2">%1$s è stato espulso da %2$s%3$s (%4$s)</string> - <string name="message_format_kill_1">%1$s è stato disconnesso forzatamente da %2$s%3$s</string> - <string name="message_format_kill_2">%1$s è stato disconnesso forzatamente da %2$s%3$s (%4$s)</string> -</resources> diff --git a/app/src/main/res/values-it/strings_preferences.xml b/app/src/main/res/values-it/strings_preferences.xml deleted file mode 100644 index ec5ee329daf05aca2b7e43313b98c5963e233513..0000000000000000000000000000000000000000 --- a/app/src/main/res/values-it/strings_preferences.xml +++ /dev/null @@ -1,189 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<resources> - <string name="preference_appearance_title">Aspetto</string> - - <string name="preference_theme_title">Tema</string> - <string name="preference_theme_entry_material_daynight">Material (Auto)</string> - <string name="preference_theme_entry_material_light">Material (Chiaro)</string> - <string name="preference_theme_entry_material_dark">Material (Scuro)</string> - <string name="preference_theme_entry_quassel_daynight">Quassel (Auto)</string> - <string name="preference_theme_entry_quassel_light">Quassel (Chiaro)</string> - <string name="preference_theme_entry_quassel_dark">Quassel (Scuro)</string> - <string name="preference_theme_entry_amoled">AMOLED</string> - <string name="preference_theme_entry_solarized_daynight">Solarized (Auto)</string> - <string name="preference_theme_entry_solarized_light">Solarized (Chiaro)</string> - <string name="preference_theme_entry_solarized_dark">Solarized (Scuro)</string> - <string name="preference_theme_entry_gruvbox_daynight">Gruvbox (Auto)</string> - <string name="preference_theme_entry_gruvbox_light">Gruvbox (Chiaro)</string> - <string name="preference_theme_entry_gruvbox_dark">Gruvbox (Scuro)</string> - <string name="preference_theme_entry_dracula">Dracula</string> - <string name="preference_input_enter_title">Tasto invio della tastiera</string> - <string name="preference_input_enter_entry_emoji">Emoji</string> - <string name="preference_input_enter_entry_send">Invio</string> - <string name="preference_input_enter_entry_newline">A capo</string> - <string name="preference_show_lag_title">Mostra latenza</string> - <string name="preference_show_lag_summary">Mostra il ritardo tra il client ed il core nella barra delle azioni</string> - - <string name="preference_keep_screen_on_title">Mantieni schermo attivo</string> - <string name="preference_keep_screen_on_summary">Impedisce al dispositivo di entrare in sospensione mentre l’app è in primo piano</string> - - <string name="preference_language_title">Lingua</string> - <string name="preference_language_entry_auto">Predefinita di sistema</string> - <string name="preference_redirection_title">Reindirizzamento messaggi</string> - - <string name="preference_redirection_user_notices_title">Reindirizzare avvisi utente</string> - <string name="preference_redirection_user_notices_summary">Mostra gli avvisi utente nel canale in uso</string> - - <string name="preference_redirection_server_notices_title">Reindirizzare avvisi server</string> - <string name="preference_redirection_server_notices_summary">Mostra gli avvisi del server nel canale in uso</string> - - <string name="preference_redirection_errors_title">Reindirizzare errori</string> - <string name="preference_redirection_errors_summary">Mostra gli errori nel canale in uso</string> - - - <string name="preference_notifications_title">Notifiche</string> - - <string name="preference_notification_query_title">Messaggi privati</string> - - <string name="preference_notification_channel_title">Messaggi del canale</string> - - <string name="preference_notification_other_title">Altri messaggi</string> - - <string name="preference_notification_sound_title">Suono di notifica</string> - - <string name="preference_notification_vibration_title">Vibrazione</string> - - <string name="preference_notification_light_title">LED</string> - - <string name="preference_notification_mark_read_on_swipe_title">Considera canale letto allo swipe sulle notifiche</string> - <string name="preference_notification_mark_read_on_swipe_summary">Imposta tutti i messaggi del canale come letti allo swipe della notifica per il canale</string> - - <string name="preference_notification_network_name_in_notification_title_title">Mostra il nome della rete nel titolo delle notifiche</string> - - <string name="preference_notification_show_all_activities_in_toolbar_title">Segna tutte le attività nella barra degli strumenti</string> - <string name="preference_notification_show_all_activities_in_toolbar_summary">Mostra una bolla colorata nella barra degli strumenti per l’attività di qualunque chat</string> - - <string name="preference_notification_configure_title">Configura notifiche</string> - - <string name="preference_notifications_level_all">Tutti i messaggi</string> - <string name="preference_notifications_level_highlight">Solo se menzionato</string> - <string name="preference_notifications_level_none">Mai</string> - <string name="preference_messages_title">Messaggi</string> - - <string name="preference_monospace_title">Usa carattere a spaziatura fissa</string> - - <string name="preference_textsize_title">Dimensione del testo</string> - - <string name="preference_show_seconds_title">Mostra secondi</string> - - <string name="preference_use_24h_clock_title">Usa orologio 24 ore</string> - - <string name="preference_colorize_mirc_title">Usa colori di mIRC</string> - <string name="preference_colorize_mirc_summaryon">Mostra i colori di mIRC nei messaggi</string> - <string name="preference_colorize_mirc_summaryoff">Rimuovi i colori di mIRC dai messaggi</string> - - <string name="preference_colorize_nicknames_title">Nick colorati</string> - <string name="preference_colorize_nicknames_entry_all">Tutti i nick</string> - <string name="preference_colorize_nicknames_entry_all_but_mine">Tutti tranne il proprio nick</string> - <string name="preference_colorize_nicknames_entry_none">Nessun nick</string> - <string name="preference_show_prefix_title">Mostra modi utente come prefisso</string> - <string name="preference_show_prefix_entry_all">Tutti i modi utente</string> - <string name="preference_show_prefix_entry_highest">Solo il modo più alto</string> - <string name="preference_show_prefix_entry_none">Nessun modo</string> - <string name="preference_hostmask_actions_title">Mostra identità completa nelle azioni</string> - <string name="preference_hostmask_actions_summary">Mostra nick!ident@host nei messaggi di entrata, uscita e disconnessione</string> - - <string name="preference_nicks_on_new_line_title">Separa nick degli utenti</string> - <string name="preference_nicks_on_new_line_summary">Mostra nick degli utenti su una riga separata</string> - - <string name="preference_show_realnames_title">Mostra nomi reali</string> - - <string name="preference_show_avatars_title">Mostra avatar</string> - - <string name="preference_square_avatars_title">Avatar quadrati</string> - - <string name="preference_show_irccloud_avatars_title">Mostra avatar di IRCCloud</string> - <string name="preference_show_irccloud_avatars_summary">Per gli utenti privi di avatar mostra quello di IRCCloud, se disponibile</string> - - <string name="preference_show_gravatar_avatars_title">Mostra avatar di Gravatar</string> - <string name="preference_show_gravatar_avatars_summary">Per gli utenti privi di avatar mostra quello di Gravatar, se disponibile</string> - - <string name="preference_show_matrix_avatars_title">Mostra avatar di Matrix</string> - <string name="preference_show_matrix_avatars_summary">Per gli utenti privi di avatar mostra quello di Matrix, se disponibile</string> - - <string name="preference_time_at_end_title">Ora dei messaggi allineata a destra</string> - <string name="preference_time_at_end_summary">Allinea l’ora dei messaggi alla fine di ogni messaggio</string> - - <string name="preference_larger_emoji_title">Reazioni più grandi</string> - <string name="preference_larger_emoji_summary">Incrementa la dimensioni dei messaggi contenenti unicamente emoji</string> - - <string name="preference_highlight_own_messages_title">Evidenzia i miei messaggi</string> - <string name="preference_highlight_own_messages_summary">Mostra i miei messaggi in modo più evidente</string> - - <string name="preference_replace_emoji_title">Sostitiuisci abbreviazioni con emoji</string> - <string name="preference_replace_emoji_summary">Sostituisci automaticamente le abbreviazioni come :+1: o :like: con emoji</string> - - - <string name="preference_autocomplete_title">Completamento automatico</string> - - <string name="preference_autocomplete_sender_doubleclick_title">Completa automaticamente il mittente</string> - <string name="preference_autocomplete_sender_doubleclick_summary">Fai doppio clic su un messaggio per completare automaticamente il mittente</string> - - <string name="preference_autocomplete_button_title">Pulsante di completamento automatico</string> - <string name="preference_autocomplete_button_summary">Mostra un pulsante a sinistra della riga di input per attivare il completamento</string> - - <string name="preference_autocomplete_doubletap_title">Doppio tocco per completare automaticamente</string> - <string name="preference_autocomplete_doubletap_summary">Suggerisci nick e canali dopo al doppio clic del campo di input</string> - - <string name="preference_autocomplete_auto_title">Mostra automaticamente</string> - <string name="preference_autocomplete_auto_summary">Suggerisci nick e canali dopo aver inserito i primi 3 caratteri</string> - - <string name="preference_autocomplete_prefix_title">Mostra dopo il prefisso</string> - <string name="preference_autocomplete_prefix_summary">Suggerisci nick e canali dopo aver scritto @ o #</string> - - <string name="preference_autocomplete_nicks_title">Completa nick automaticamente</string> - - <string name="preference_autocomplete_buffers_title">Completa automaticamente chat</string> - - <string name="preference_autocomplete_aliases_title">Completa automaticamente comandi</string> - - <string name="preference_autocomplete_emoji_title">Completa automaticamente emoji</string> - - - <string name="preference_backlog_title">Registro storico</string> - - <string name="preference_page_size_title">Dimensioni della pagina</string> - <string name="preference_page_size_summary">Il numero di messaggi caricati e conservati in memoria contemporaneamente</string> - - <string name="preference_initial_amount_title">Quantità iniziale</string> - <string name="preference_initial_amount_summary">Numero di messaggi da caricare all’apertura di una chat la prima volta</string> - - <string name="preference_clear_cache_title">Cancella cache registro storico</string> - - <string name="preference_connection_title">Connessione</string> - - <string name="preference_show_notification_title">Mostra notifica</string> - <string name="preference_show_notification_summary">Mantiene Quasseldroid sempre collegato mostrando una notifica permanente</string> - - <string name="preference_ignore_network_changes_title">Ignora cambi di rete</string> - <string name="preference_ignore_network_changes_summary">Interrompi la riconnessione automatica di Quasseldroid se la rete cambia</string> - -</resources> diff --git a/app/src/main/res/values-it/strings_settings.xml b/app/src/main/res/values-it/strings_settings.xml deleted file mode 100644 index 99f63cb161445be9661294222dd2cf0228d359d6..0000000000000000000000000000000000000000 --- a/app/src/main/res/values-it/strings_settings.xml +++ /dev/null @@ -1,158 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<resources> - <string name="settings_networks_title">Reti</string> - <string name="settings_network_title">Rete</string> - <string name="settings_network_network_name">Nome della rete</string> - <string name="settings_network_identity">Identità</string> - <string name="settings_network_sasl_enabled">SASL</string> - <string name="settings_network_sasl_account">Account</string> - <string name="settings_network_sasl_password">Password</string> - <string name="settings_network_sasl_supported">Questa rete supporta SASL</string> - <string name="settings_network_sasl_upgrade">Usa SASL</string> - <string name="settings_network_autoidentify_enabled">Identificazione automatica</string> - <string name="settings_network_autoidentify_service">Servizio</string> - <string name="settings_network_autoidentify_password">Password</string> - <string name="settings_network_connection">Connessione</string> - <string name="settings_network_perform">Comandi da eseguire alla connessione</string> - <string name="settings_network_rejoin_channels">Rientra nei canali</string> - <string name="settings_network_autoreconnect_enabled">Riconessione automatica</string> - <string name="settings_network_autoreconnect_interval">Intervallo</string> - <string name="settings_network_autoreconnect_interval_unit">secondi</string> - <string name="settings_network_autoreconnect_attempts">Massimo di tentativi</string> - <string name="settings_network_autoreconnect_unlimited">Tentativi illimitati</string> - <string name="settings_network_customratelimits_enabled">Limite di velocità personalizzato</string> - <string name="settings_network_customratelimits_burstsize">Dimensione del burst</string> - <string name="settings_network_customratelimits_unlimited">Illimitato</string> - <string name="settings_network_customratelimits_delay">Ritardo</string> - <string name="settings_network_customratelimits_interval_unit">secondi</string> - - <string name="settings_networkserver_title">Server della rete</string> - <string name="settings_networkserver_connection">Connessione</string> - <string name="settings_networkserver_host">Host</string> - <string name="settings_networkserver_port">Porta</string> - <string name="settings_networkserver_ssl_enabled">Utilizza SSL</string> - <string name="settings_networkserver_ssl_verify">Verifica SSL</string> - <string name="settings_networkserver_password">Password</string> - <string name="settings_networkserver_proxy_enabled">Utilizza proxy</string> - <string name="settings_networkserver_proxy_type">Tipo</string> - <string name="settings_networkserver_proxy_type_http">HTTP</string> - <string name="settings_networkserver_proxy_type_socks5">SOCKS 5</string> - <string name="settings_networkserver_proxy_host">Host</string> - <string name="settings_networkserver_proxy_port">Porta</string> - <string name="settings_networkserver_proxy_user">Nome utente</string> - <string name="settings_networkserver_proxy_pass">Password</string> - - <string name="settings_identities_title">Identità</string> - <string name="settings_identity_title">Identità</string> - <string name="settings_identity_names">Nomi</string> - <string name="settings_identity_identity_name">Nome identità</string> - <string name="settings_identity_real_name">Nome reale</string> - <string name="settings_identity_ident">Ident</string> - <string name="settings_identity_nick">Nick</string> - <string name="settings_identity_nicks">Nick</string> - <string name="settings_identity_messages">Messaggi</string> - <string name="settings_identity_kick_reason">Motivo dell’espulsione</string> - <string name="settings_identity_part_reason">Motivo dell’uscita</string> - <string name="settings_identity_quit_reason">Motivo della disconnessione</string> - <string name="settings_identity_away">Messaggi d’assenza</string> - <string name="settings_identity_away_reason">Motivo dell’assenza</string> - <string name="settings_identity_detach_away">Assente se scollegato</string> - <string name="settings_identity_detach_away_reason">Motivo dell’assenza se scollegato</string> - - <string name="settings_chatlists_title">Lista delle chat</string> - <string name="settings_chatlist_title">Lista della chat</string> - <string name="settings_chatlist_ui">Interfaccia utente</string> - <string name="settings_chatlist_buffer_view_name">Nome</string> - <string name="settings_chatlist_show_search">Mostra ricerca</string> - <string name="settings_chatlist_sort_alphabetically">Ordina alfabeticamente</string> - <string name="settings_chatlist_add_new_buffers_automatically">Aggiungi nuove chat automaticamente</string> - <string name="settings_chatlist_network">Rete</string> - <string name="settings_chatlist_network_all">Tutte le reti</string> - <string name="settings_chatlist_network_create">Crea rete…</string> - <string name="settings_chatlist_show_status_buffer">Mostra finestra di stato</string> - <string name="settings_chatlist_types">Tipi di chat</string> - <string name="settings_chatlist_show_channels">Mostra canali</string> - <string name="settings_chatlist_show_queries">Mostra messaggi privati</string> - <string name="settings_chatlist_activity">Attività</string> - <string name="settings_chatlist_minimum_activity_no_activity">Nessuna attività</string> - <string name="settings_chatlist_minimum_activity_other_activity">Altra attività</string> - <string name="settings_chatlist_minimum_activity_new_message">Nuovo messaggio</string> - <string name="settings_chatlist_minimum_activity_highlight">Menzione</string> - <string name="settings_chatlist_hide_inactive_buffers">Nascondi le chat inattive</string> - <string name="settings_chatlist_hide_inactive_networks">Nascondi le reti inattive</string> - - <string name="settings_ignorelist_title">Elenco degli utenti ignorati</string> - - <string name="settings_ignoreitem_title">Regola per ignorare</string> - <string name="settings_ignoreitem_enabled">Attivata</string> - <string name="settings_ignoreitem_ignorerule">Regola per ignorare</string> - <string name="settings_ignoreitem_isregex">Espressione regolare</string> - <string name="settings_ignoreitem_type">Tipo</string> - <string name="settings_ignoreitem_type_sender">Mittente</string> - <string name="settings_ignoreitem_type_message">Messaggio</string> - <string name="settings_ignoreitem_type_ctcp">Ctcp</string> - <string name="settings_ignoreitem_strictness">Severità</string> - <string name="settings_ignoreitem_strictness_soft">Dinamica</string> - <string name="settings_ignoreitem_strictness_hard">Permanente</string> - <string name="settings_ignoreitem_scope">Ambito</string> - <string name="settings_ignoreitem_scope_global">Globale</string> - <string name="settings_ignoreitem_scope_network">Soltanto sulla rete</string> - <string name="settings_ignoreitem_scope_channel">Soltanto sul canale</string> - <string name="settings_ignoreitem_scoperule">Regola per ambito</string> - - <string name="settings_highlightlist_title">Menzioni</string> - <string name="settings_highlightlist_highlight_nick">Menzione del nick</string> - <string name="settings_highlightlist_highlight_nick_all_nicks">Tutti i nick da identità</string> - <string name="settings_highlightlist_highlight_nick_current_nick">Nick in uso</string> - <string name="settings_highlightlist_highlight_nick_none">Nessuno</string> - <string name="settings_highlightlist_nicks_case_sensitive">Distingui tra maiuscole e minuscole</string> - <string name="settings_highlightlist_rules">Regole per le menzioni</string> - <string name="settings_highlightlist_ignore_rules">Regole per ignorare le menzioni</string> - - <string name="settings_highlightrule_title">Regola menzione</string> - <string name="settings_highlightrule_enabled">Attiva</string> - <string name="settings_highlightrule_name">Nome</string> - <string name="settings_highlightrule_regular_expression">Espressione regolare</string> - <string name="settings_highlightrule_case_sensitive">Distingui tra maiuscole e minuscole</string> - <string name="settings_highlightrule_sender">Mittente</string> - <string name="settings_highlightrule_channel">Canale</string> - - <string name="settings_aliaslist_title">Alias</string> - - <string name="settings_aliasitem_title">Alias</string> - <string name="settings_aliasitem_name">Nome</string> - <string name="settings_aliasitem_expansion">Espansione</string> - - <string name="settings_networkconfig_title">Configurazione IRC</string> - <string name="settings_networkconfig_ping_timeout">Rilevamento della scadenza del ping</string> - <string name="settings_networkconfig_ping_interval">Intervallo del ping</string> - <string name="settings_networkconfig_ping_interval_unit">secondi</string> - <string name="settings_networkconfig_max_ping_count">Disconnetti dopo</string> - <string name="settings_networkconfig_max_ping_count_unit">ping persi</string> - <string name="settings_networkconfig_auto_who">Ricerca automatica informazioni utente</string> - <string name="settings_networkconfig_auto_who_interval">Intervallo di aggiornamento</string> - <string name="settings_networkconfig_auto_who_interval_unit">secondi</string> - <string name="settings_networkconfig_auto_who_nick_limit">Ignora canali con più di</string> - <string name="settings_networkconfig_auto_who_nick_limit_unit">utenti</string> - <string name="settings_networkconfig_auto_who_delay">Tempo minimo tra le richieste</string> - <string name="settings_networkconfig_auto_who_delay_unit">secondi</string> - <string name="settings_networkconfig_standard_ctcp">Comportamento CTCP conforme allo standard</string> -</resources> diff --git a/app/src/main/res/values-it/strings_setup.xml b/app/src/main/res/values-it/strings_setup.xml deleted file mode 100644 index 908aee43f13dc8fc950079fae94c766b01dcdd2c..0000000000000000000000000000000000000000 --- a/app/src/main/res/values-it/strings_setup.xml +++ /dev/null @@ -1,101 +0,0 @@ -<!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<resources> - <!-- Account Selection --> - <string name="slide_account_select_title">Scegli account</string> - <string name="slide_account_select_description">Seleziona un account dall’elenco o aggiungine uno</string> - <string name="label_user_on_host">%1$s su %2$s:%3$d</string> - - <!-- Account Setup --> - - <!-- Account Connection --> - <string name="slide_account_connection_title">Connessione</string> - <string name="slide_account_connection_description">Innanzitutto, scegli su quale server è ospitato il tuo core.</string> - - <string name="label_connection_host">Host</string> - <string name="label_connection_port">Porta</string> - <string name="label_connection_ssl">Richiedi SSL</string> - - <string name="hint_invalid_host">Non è un nome host valido</string> - <string name="hint_invalid_port">Non è una porta valida</string> - - <!-- Account User --> - <string name="slide_account_user_title">Il tuo account</string> - <string name="slide_account_user_description">Adesso, inserisci il nome utente e la password per il tuo account sul core. Se hai appena creato il core, andremo ad eseguire la configurazione per te</string> - - <string name="label_account_user">Nome utente</string> - <string name="label_account_pass">Password</string> - - <string name="hint_invalid_user">Il nome utente non può essere vuoto</string> - - <!-- Account Name --> - <string name="slide_account_name_title">Personalizza account</string> - <string name="slide_account_name_description">Dai un nome a questo account</string> - - <string name="label_account_name">Nome account</string> - - <string name="hint_invalid_name">Il nome non può essere vuoto</string> - - <!-- Core Setup --> - - <string name="setup_core_title">Configura core</string> - - <!-- Core Authenticator Select --> - <string name="slide_core_authenticator_select_title">Scegli motore di autenticazione</string> - <string name="slide_core_authenticator_select_description">Per favore scegli quale motore di autenticazione deve utilizzare il core Quassel per l’autenticazione degli utenti.</string> - - <!-- Core Backend Select --> - <string name="slide_core_backend_select_title">Scegli motore di archivazione</string> - <string name="slide_core_backend_select_description">Per favore scegli quale motore per il database deve utilizzare il core Quassel per archiviare il registro storico e gli altri dati.</string> - - <string name="label_backend">Motore</string> - - <!-- Core Backend Config --> - <string name="slide_core_backend_setup_title">Configura motore di archiviazione</string> - <string name="slide_core_backend_setup_description">Per favore configura il motore scelto per il database.</string> - - <string name="setup_core_backend_no_options">Il motore non ha altre opzioni da configurare, hai finito qui!</string> - - <!-- User Setup --> - - <string name="setup_user_title">Configura utente</string> - - <!-- User Identity --> - <string name="slide_user_identity_title">Configura identità</string> - <string name="slide_user_identity_description">Per favore scegli un nick</string> - - <string name="hint_invalid_nick">Non è un nick valido</string> - - <!-- User Network --> - <string name="slide_user_network_title">Configura rete</string> - <string name="slide_user_network_description">Scegli una rete alla quale connetterti.</string> - - <string name="label_network_custom">Altra rete…</string> - - <!-- User Channels --> - <string name="slide_user_channels_title">Configura canali</string> - <string name="slide_user_channels_description">Scegli in quali canali entrare.</string> - - <string name="label_channels">Canali</string> - - <!-- Network Setup --> - - <string name="setup_network_title">Configura rete</string> -</resources> diff --git a/app/src/main/res/values-it/strings_status.xml b/app/src/main/res/values-it/strings_status.xml deleted file mode 100644 index 026c64a13bf653a7df57e59dffef4edfb2898df7..0000000000000000000000000000000000000000 --- a/app/src/main/res/values-it/strings_status.xml +++ /dev/null @@ -1,27 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<resources> - <string name="label_status_disconnected">Disconnesso</string> - <string name="label_status_connecting">Connessione in corso</string> - <string name="label_status_handshake">Negoziazione</string> - <string name="label_status_init">Inizializzazione</string> - <string name="label_status_connected">Connesso</string> - <string name="label_status_closed">Connessione caduta</string> -</resources> diff --git a/app/src/main/res/values-large/dimens.xml b/app/src/main/res/values-large/dimens.xml deleted file mode 100644 index 37441a2cf3944ebf3f14c610fcc55d914bf8ec01..0000000000000000000000000000000000000000 --- a/app/src/main/res/values-large/dimens.xml +++ /dev/null @@ -1,22 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<resources> - <dimen name="colorchooser_circlesize">64dp</dimen> -</resources> diff --git a/app/src/main/res/values-lt/strings.xml b/app/src/main/res/values-lt/strings.xml deleted file mode 100644 index 06a98b5d085fb83c297a1fceffa00dab7d78653b..0000000000000000000000000000000000000000 --- a/app/src/main/res/values-lt/strings.xml +++ /dev/null @@ -1,203 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<resources xmlns:tools="http://schemas.android.com/tools"> - <plurals name="label_user_count" tools:ignore="UnusedQuantity"> - <item quantity="one">%1$d vartotojas</item> - <item quantity="few">%1$d vartotojai</item> - <item quantity="many">%1$d vartotojų</item> - <item quantity="other">%1$d vartotojų</item> - </plurals> - <string name="app_name">Quasseldroid</string> - <string name="app_description">Android klientas decentralizuotam Quassel IRC klientui.</string> - - <string name="app_description_long">Quassel yra išskirstytas, decentralizuotas IRC klientas, parašytas C++ ir Qt kalbomis. Quasseldroid yra klientas Quassel branduoliui, leidžiantis jums prisijungti prie Quassel branduolio naudojantis jūsų Android™ įrenginiu.</string> - <string name="connection_service_title">Ryšio tarnyba</string> - - <string name="connection_service_description">Palaiko ryšį su jūsų branduoliu, jog būtų galima siųsti žinutes ir gauti pranešimus.</string> - <string name="label_about">Apie</string> - <string name="label_accept">Priimti</string> - <string name="label_acknowledgements">Padėkos</string> - <string name="label_archive">Archyvas</string> - <string name="label_archive_chat">Archyvuoti pokalbį</string> - <string name="label_archived_chats">Archyvuoti pokalbiai</string> - <string name="label_ascending">Didėjančia tvarka</string> - <string name="label_authors">Autoriai</string> - <string name="label_autocomplete">Automatinis užbaigimas</string> - <string name="label_avatar">Avataras</string> - <string name="label_back">Atgal</string> - <string name="label_buffer_name">Pokalbio pavadinimas</string> - <string name="label_cancel">Nutraukti</string> - <string name="label_certificates">Sertifikatai</string> - <string name="label_channel_name">Kanalo pavadinimas</string> - <string name="label_clear_search">Išvalyti paiešką</string> - <string name="label_close">Uždaryti</string> - <string name="label_colors_custom">Rinktis</string> - <string name="label_colors_mirc">mIRC</string> - <string name="label_configure">Konfigūruoti</string> - <string name="label_connect">Prisijungti</string> - <string name="label_copy">Kopijuoti</string> - <string name="label_crashes">Klaidos</string> - <string name="label_crashes_empty">Nerasta klaidų ataskaitų</string> - <string name="label_create_channel">Sukurti kanalą</string> - <string name="label_delete">Ištrinti</string> - <string name="label_delete_all">Ištrinti viską</string> - <string name="label_descending">Mažėjančia tvarka</string> - <string name="label_disconnect">Atsijungti</string> - <string name="label_edit_core">Redaguoti paskyrą</string> - <string name="label_edit_nick">Keisti slapyvardį</string> - <string name="label_edit_topic">Keisti temą</string> - <string name="label_edit_topic_long">Atverti kanalo temos keitimo dialogą</string> - <string name="label_filter_messages">Filtruoti žinutes</string> - <string name="label_finish">Užbaigti</string> - <string name="label_generate_crash_report">Sugeneruoti klaidos ataskaitą</string> - <string name="label_ignore">Ignoruoti</string> - <string name="label_ignore_long">Pridėti/panaiktinti vartotoją į/iš ignoruojamų sarašo</string> - <string name="label_info">Plačiau</string> - <string name="label_info_certificate">Sertifikatas</string> - <string name="label_info_channel">Kanalo aprašas</string> - <string name="label_info_channellist">Kanalų sąrašas</string> - <string name="label_info_core">Branduolio aprašas</string> - <string name="label_info_user">Vartotojo aprašas</string> - <string name="label_input_history">Įvesties istorija</string> - <string name="label_join">Prisijungti</string> - <string name="label_join_long">Prisijungti į kanalą</string> - <string name="label_libraries">Bibliotekos</string> - <string name="label_license">Licencija</string> - <string name="label_mark_read">Pažymėti kaip skaitytą</string> - <string name="label_match_all">Atitinka visas žinutes</string> - <string name="label_mention">Paminėti</string> - <string name="label_mention_long">Kopijuoti slapyvardį į įvedimo eilutę</string> - <string name="label_network">Tinklas</string> - <string name="label_new_account">Nauja paskyra</string> - <string name="label_new_chatlist">Naujas pokalbių sąrašas</string> - <string name="label_new_highlight_ignore_rule">Nauja nežymėjimo taisyklė</string> - <string name="label_new_highlight_rule">Nauja žymėjimo taisyklė</string> - <string name="label_new_identity">Nauja tapatybė</string> - <string name="label_new_ignore_rule">Nauja ignoravimo taisyklė</string> - <string name="label_new_network">Naujas tinklas</string> - <string name="label_new_nick">Naujas slapyvardis</string> - <string name="label_new_server">Naujas serveris</string> - <string name="label_next">Toliau</string> - <string name="label_nick">Slapyvardis</string> - <string name="label_nicklist">Slapyvardžių sąrašas</string> - <string name="label_no">Ne</string> - <string name="label_no_away_message">Nėra pasišalinimo žinutės</string> - <string name="label_no_sound">Nėra</string> - <string name="label_open">Atidaryti</string> - <string name="label_part">Išeiti</string> - <string name="label_part_long">Palikti kanalą</string> - <string name="label_password_change">Pakeisti slaptažodį</string> - <string name="label_password_error_nomatch">Slaptažodžiai neatitinka</string> - <string name="label_password_error_wrong">Neteisingas slaptažodis</string> - <string name="label_password_new">Naujas slaptažodis</string> - <string name="label_password_old">Senas slaptažodis</string> - <string name="label_password_repeat">Pakartokite slaptažodį</string> - <string name="label_permanently_archived">Archyvuoti visam laikui</string> - <string name="label_permanently_archived_long">Pokalbiai archyvuoti visam laikui nebus rodomi iki tol, kol jų vėl nebearchyvuosite.</string> - <string name="label_placeholder_message">Parašykite žinutę…</string> - <string name="label_placeholder_topic">Apibūdinkite kanalo temą…</string> - <string name="label_privacy_policy">Privatumo politika</string> - <string name="label_query">Užklausa</string> - <string name="label_query_long">Atverti privatų pokalbį su vartotoju</string> - <string name="label_query_medium">Atidaryti privatų pokalbį</string> - <string name="label_rename">Pervardinti</string> - <string name="label_reorder">Pakeisti rykiavimą</string> - <string name="label_reply">Atsakyti</string> - <string name="label_reset">Atstatyti</string> - <string name="label_save">Išsaugoti</string> - <string name="label_saving">Išsaugoma…</string> - <string name="label_search">Paieška…</string> - <string name="label_search_buffer">Ieškoti pokalbių</string> - <string name="label_search_channels">Ieškoti kanalų</string> - <string name="label_select">Pasirinkti</string> - <string name="label_send">Siųsti</string> - <string name="label_service_connection_failed">Nepavyko užmegzti ryšio, patikrinkite baterijos taupymo nustatymus. Daugiau informacijos - dontkillmyapp.com</string> - <string name="label_set_default">Nustatyti numatytą</string> - <string name="label_settings">Nustatymai</string> - <string name="label_settings_client">Kliento nustatymai</string> - <string name="label_settings_core">Branduolio nustatymai</string> - <string name="label_share">Dalintis</string> - <string name="label_share_crashreport">Dalintis klaidos ataskaita</string> - <string name="label_shortcut">Nuoroda</string> - <string name="label_shortcut_long">Sukurti nuorodą pagrindiniame ekrane</string> - <string name="label_sort">Rūšiuoti</string> - <string name="label_source">Šaltinis</string> - <string name="label_temporarily_archived">Archyvuoti trumpam</string> - <string name="label_temporarily_archived_long">Pokalbiai kurie yra archyvuoti trumpam bus vėl rodomi, kai juose atsiras nauja žinutė.</string> - <string name="label_topic">Kanalo tema</string> - <string name="label_translators">Vertėjai</string> - <string name="label_unhide">Rodyti</string> - <string name="label_unknown_sender"><Nežinoma></string> - <string name="label_update_user_password">Atnaujinti Vartotoją/Slaptažodį</string> - <string name="label_use_default">Naudoti numatytas parinktis</string> - <string name="label_user_count">Vartotojų skaičius</string> - <string name="label_website">Tinklalapis</string> - <string name="label_whitelist">Ignoruoti</string> - <string name="label_whitelist_certificates">Sertifikatai</string> - <string name="label_whitelist_certificates_empty">Nėra patvirtintų sertifikatų</string> - <string name="label_whitelist_hostnames">Host sąrašas</string> - <string name="label_whitelist_hostnames_empty">Nėra leistinų Host</string> - <string name="label_whitelist_ignore_date">Galiojimo data yra ignoruojama šiam sertifikatui</string> - <string name="label_who">Who</string> - <string name="label_who_long">Atnaujinti visų vartotojų informaciją</string> - <string name="label_whois">Whois</string> - <string name="label_whois_long">Atnaujinti vartotojo informaciją</string> - - <string name="label_yes">Taip</string> - - <string name="label_feature_synchronizedmarkerline">Reikalinga norint sinchronizuoti poziciją kanaluose</string> - <string name="label_feature_saslauthentication">Reikalinga SASL</string> - <string name="label_feature_saslexternal">Reikalinga SASL su sertifikatais</string> - <string name="label_feature_hideinactivenetworks">Reikalinga norint paslėpti neaktyvius tinklus iš pokalbių sarašų</string> - <string name="label_feature_passwordchange">Reikalinga norint keisti slaptažodžius per klientą</string> - <string name="label_feature_capnegotiation">Reikalinga norint turėti IRCv3 funkcionalumą</string> - <string name="label_feature_verifyserverssl">Reikalinga norint patvirtinti IRC tinklų, prie kurių jūs prisijungėte, SSL sertifikatą</string> - <string name="label_feature_customratelimits">Reikalinga norint nustatyti suasmenintus siuntimo limitus IRC tinklams</string> - <string name="label_feature_awayformattimestamp">Reikalinga suasmeninto formato laiko žymėms neaktyvumo žinutėse</string> - <string name="label_feature_bufferactivitysync">Reikalinga norint matyti pokalbių aktyvumą jų saraše</string> - <string name="label_feature_coresidehighlights">Reikalinga paryškinimams</string> - <string name="label_feature_senderprefixes">Reikalinga norint matyti naudotoju priešdėlių rėžimus (+, @) žinutėse</string> - <string name="label_feature_remotedisconnect">Reikalinga jūsų klientų nuotoliniam atsijungimui</string> - <string name="label_feature_richmessages">Reikalinga norint matyti tikruosius vardus ar IRCv3/Gravatar Avatarus žinutėse</string> - <string name="label_feature_backlogfiltertype">Reikalinga norint gauti senus pranešimus po prisijungimo</string> - - <string name="label_feature_context_bufferactivitysync">Quasseldroid negali pažymėti neskaitytų pokalbių. Atnaujinkite branduolį į Quassel v0.13, jog tai ištaisytumėte.</string> - <string name="label_feature_context_coresidehighlights">Quasseldroid negali konfigūruoti žymėjimo. Atnaujinkite branduolį į Quassel v0.13, jog tai ištaisytumėte.</string> - <string name="label_feature_context_missing">Jūsų branduolyje trūksta funkcijų, reikalingų Quasseldroid veikimui užtikrinti.</string> - <string name="label_feature_context_missing_button">Plačiau</string> - - <string name="notification_channel_connection_title">Ryšys</string> - <string name="notification_channel_highlight_title">Žymėjimai</string> - <string name="notification_channel_old_highlight_title">Seni žymėjimai</string> - - <string name="label_missing_features">Trūkstamos funkcijos</string> - <string name="info_missing_features" tools:ignore="StringFormatCount">Jūsų branduolyje trūksta funkcijų, kurių reikia norint užtikrinti, jog Quasseldroid veiktų sklandžiai. <a href="https://quassel-irc.org>Atnaujinkite</a> savo Quassel branduolį į %1$s ar naujesnį.</string> - - <string name="buffer_delete_confirmation">Ar tikrai norite visam laikui ištrinti šį pokalbį?</string> - <string name="buffer_archive_confirmation">Ar norite archyvuoti šį pokalbį?</string> - <string name="buffer_archive_temporarily">Automatiškai rodyti šį pokalbį kai jame atsiranda naujų žinučių</string> - - <string name="delete_confirmation">Ar tikrai norite ištrinti visam laikui? Šio veiksmo anuliuoti negalima.</string> - <string name="cancel_confirmation">Yra neišsaugotų pakeitimų. Ar norite juos panaikinti?</string> - - <string name="info_copied_version">Versija nukopijuota į atmintinę</string> - - <string name="advertisement_support_patreon">Padėkite mums toliau plėtoti šią programėlę prisidėdami per Patreon</string> -</resources> diff --git a/app/src/main/res/values-lt/strings_certificates.xml b/app/src/main/res/values-lt/strings_certificates.xml deleted file mode 100644 index 51f91f5b0916994dfd1efba5d3fa231fcb209565..0000000000000000000000000000000000000000 --- a/app/src/main/res/values-lt/strings_certificates.xml +++ /dev/null @@ -1,39 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<resources> - <string name="certificate_subject">Kam išduotas</string> - <string name="certificate_issuer">Kas išdavė</string> - - <string name="certificate_common_name">Pavadinimas (CN)</string> - <string name="certificate_organization">Organizacija (O)</string> - <string name="certificate_organizational_unit">Organizacijos padalinys (OU)</string> - - <string name="certificate_hostnames">Hostname sąrašas</string> - - <string name="certificate_validity">Galiojimo periodas</string> - - <string name="certificate_not_before">Ne anksčiau</string> - <string name="certificate_not_after">Ne vėliau</string> - - <string name="certificate_fingerprints">Kontroliniai kodai</string> - - <string name="certificate_fingerprint_sha256">SHA-256 kontrolinis kodas</string> - <string name="certificate_fingerprint_sha1">SHA-1 kontrolinis kodas</string> -</resources> diff --git a/app/src/main/res/values-lt/strings_contributors.xml b/app/src/main/res/values-lt/strings_contributors.xml deleted file mode 100644 index 7cd14e9cc722855811dd626f3a69ac3096183c4b..0000000000000000000000000000000000000000 --- a/app/src/main/res/values-lt/strings_contributors.xml +++ /dev/null @@ -1,26 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<resources> - <string name="contributor_description_freqmod">Pradiniai qdatastream deserijalizacijos bandymai</string> - <string name="contributor_description_sandsmark">Senų protokolų implementacija, (de)serijalizuotojas, projekto (de)moralizuotojas</string> - <string name="contributor_description_magnuf">Sena Vartotojo Sąsaja</string> - <string name="contributor_description_kenji">Sena Vartotojo Sąsaja</string> - <string name="contributor_description_justjanne">Perrašymas, Vartotojo Sąsaja, Anotacijų Procesoriai, Backend</string> -</resources> diff --git a/app/src/main/res/values-lt/strings_defaults.xml b/app/src/main/res/values-lt/strings_defaults.xml deleted file mode 100644 index b1e4fe5989302658984ad6fea4a22ba38cb7d3ac..0000000000000000000000000000000000000000 --- a/app/src/main/res/values-lt/strings_defaults.xml +++ /dev/null @@ -1,31 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<resources> - <string name="default_bufferviewconfig_name">Visi pokalbiai</string> - - <string name="default_identity_identity_name">Numatyta tapatybė</string> - <string name="default_identity_realname">Quassel IRC vartotojas</string> - <string name="default_identity_awayreason">Išėjau žvejoti.</string> - <string name="default_identity_autoawayreason">Manęs nėra. Prižadu!</string> - <string name="default_identity_detachawayreason">Visi Quassel klientai išnyko nuo žemės paviršiaus…</string> - <string name="default_identity_kickreason">Čia ne vaikų darželis!</string> - <string name="default_identity_partreason">https://quassel-irc.org - Bendrauk patogiai. Bet kur.</string> - <string name="default_identity_quitreason">https://quassel-irc.org - Bendrauk patogiai. Bet kur.</string> -</resources> diff --git a/app/src/main/res/values-lt/strings_error.xml b/app/src/main/res/values-lt/strings_error.xml deleted file mode 100644 index ef50720ca0f7fd6ea77b69d36f7d78fcf9423deb..0000000000000000000000000000000000000000 --- a/app/src/main/res/values-lt/strings_error.xml +++ /dev/null @@ -1,49 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<resources> - <string name="label_error_login">Prisijungimo Klaida</string> - <string name="label_error_setup">Sąrankos klaida</string> - <string name="label_error_init">Ryšio klaida</string> - <string name="label_error_ssl">SSL Klaida</string> - <string name="label_error_ssl_required_unavailable">Šiam ryšiui yra reikalingas SSL, bet branduolys jo nepalaiko.</string> - <string name="label_error_certificate">Sertifikato Klaida</string> - <string name="label_error_certificate_no_certificate">Nėra sertifikatų</string> - <string name="label_error_certificate_no_hostname">Nėra tinkamo hostname</string> - <string name="label_error_certificate_invalid"><![CDATA[ - <p>Sertifikatas su atspaudu<br/> - <code>%1$s</code><br/> - galioja tik nuo %2$s iki %3$s</p> - ]]></string> - <string name="label_error_certificate_untrusted"><![CDATA[ - <p>Sertifikatas su atspaudu<br/> - <code>%1$s</code><br/> - yra nepatikimas.</p> - ]]></string> - <string name="label_error_certificate_no_match"><![CDATA[ - <p>Sertifikatas su atspaudu<br/> - <code>%1$s</code><br/> - negalioja %2$s.</p> - ]]></string> - - <string name="label_error_unknown_host">Nerastas Host: %1$s</string> - <string name="label_error_invalid_protocol_version">Netinkamas protokolas: %1$d</string> - <string name="label_error_connection">Bandant jungtis įvyko klaida: %1$s (%2$s)</string> - <string name="label_error_connection_closed">Klaida: Ryšys netikėtai nutrūko</string> -</resources> diff --git a/app/src/main/res/values-lt/strings_format.xml b/app/src/main/res/values-lt/strings_format.xml deleted file mode 100644 index 600cdf732f62f20f5f4ffe6f22506124d692d76d..0000000000000000000000000000000000000000 --- a/app/src/main/res/values-lt/strings_format.xml +++ /dev/null @@ -1,29 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<resources> - <string name="label_bold">Paryškintas</string> - <string name="label_italic">Pasvirasis</string> - <string name="label_strikethrough">Perbrauktas</string> - <string name="label_underline">Pabrauktas</string> - <string name="label_monospace">Monospace</string> - <string name="label_foreground">Teksto spalva</string> - <string name="label_background">Fono spalva</string> - <string name="label_clear_formatting">Išvalyti formatavimą</string> -</resources> diff --git a/app/src/main/res/values-lt/strings_info.xml b/app/src/main/res/values-lt/strings_info.xml deleted file mode 100644 index 54ae9fa0dc139e3094e2dd7941532ed9611aa37e..0000000000000000000000000000000000000000 --- a/app/src/main/res/values-lt/strings_info.xml +++ /dev/null @@ -1,47 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<resources> - <string name="label_user_away">Neaktyvus</string> - <string name="label_user_away_reason">Priežastis</string> - <string name="label_user_identity">Tapatybė</string> - <string name="label_user_account">Paskyra</string> - <string name="label_user_ident">Ident</string> - <string name="label_user_host">Host</string> - <string name="label_user_server">Serveris</string> - <string name="label_user_common_channels">Bendri kanalai</string> - - <string name="label_core_version">Versija</string> - <string name="label_core_uptime">Veikimo laikas</string> - <string name="label_core_security">Saugumas</string> - <string name="label_core_clients">Klientai</string> - <string name="label_core_online_since">Serveris veikia nuo %1$s</string> - <string name="label_core_connected_since">Klientas prisijungęs nuo %1$s</string> - <string name="label_core_connection_verified_by">Ryšys patvirtintas %1$s</string> - <string name="label_core_connection_protocol">Šis ryšys naudoja %1$s</string> - <string name="label_core_connection_ciphersuite">Šis ryšys yra užkoduotas ir autentifikuotas naudojant %1$s, ir naudoja %2$s raktų apsikeitimui</string> - <string name="label_core_connection_ciphersuite_13">Šis ryšys yra užkoduotas ir autentifikuotas naudojant %1$s</string> - <string name="label_core_connection_verified_by_unknown">Nežinoma</string> - <string name="label_core_connection_insecure">Nesaugus ryšys</string> - - <string name="property_group_ircchannel_channel">Kanalas</string> - <string name="property_ircchannel_topic">Tema</string> - <string name="property_ircchannel_topic_action_edit">Keisti temą</string> - <string name="property_ircchannel_topic_default">Tema Nenustatyta</string> -</resources> diff --git a/app/src/main/res/values-lt/strings_messages.xml b/app/src/main/res/values-lt/strings_messages.xml deleted file mode 100644 index fc749d470bcd5f77ceec36ba40b5b6883ea82bdb..0000000000000000000000000000000000000000 --- a/app/src/main/res/values-lt/strings_messages.xml +++ /dev/null @@ -1,57 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<resources xmlns:tools="http://schemas.android.com/tools"> - <plurals name="message_netsplit_join" tools:ignore="UnusedQuantity"> - <item quantity="one">Netsplit tarp %1$s ir %2$s baigėsi: %3$d vartotojas prisijungė: %4$s</item> - <item quantity="few">Netsplit tarp %1$s ir %2$s baigėsi: %3$d vartotojai prisijungė: %4$s</item> - <item quantity="many">Netsplit tarp %1$s ir %2$s baigėsi: %3$d vartotojų prisijungė: %4$s</item> - <item quantity="other">Netsplit tarp %1$s ir %2$s baigėsi: %3$d vartotojų prisijungė: %4$s</item> - </plurals> - <plurals name="message_netsplit_quit" tools:ignore="UnusedQuantity"> - <item quantity="one">Netsplit tarp %1$s ir %2$s: %3$d vartotojas išėjo: %4$s</item> - <item quantity="few">Netsplit tarp %1$s ir %2$s: %3$d vartotojai išėjo: %4$s</item> - <item quantity="many">Netsplit tarp %1$s ir %2$s: %3$d vartotojų išėjo: %4$s</item> - <item quantity="other">Netsplit tarp %1$s ir %2$s: %3$d vartotojų išėjo: %4$s</item> - </plurals> - <string name="message_type_join">Prisijungimas</string> - <string name="message_type_part">Atsijungimas</string> - <string name="message_type_quit">Išėjimas</string> - <string name="message_type_nick">Slapyvardis</string> - <string name="message_type_mode">Rėžimas</string> - <string name="message_type_topic">Tema</string> - - <string name="message_format_copy">[%1$s] %2$s</string> - <string name="message_format_copy_complex">[%1$s] <%2$s> %3$s</string> - <string name="message_format_action">— %1$s%2$s %3$s</string> - <string name="message_format_notice">[%1$s%2$s] %3$s</string> - <string name="message_format_nick">%1$s%2$s dabar žinomas kaip %3$s%4$s</string> - <string name="message_format_nick_self">Jūs dabar žinomas kaip %1$s%2$s</string> - <string name="message_format_mode">Naujas rėžimas %1$s parinktas %2$s%3$s</string> - <string name="message_format_join">%1$s%2$s prisijungė į %3$s</string> - <string name="message_format_part_1">%1$s%2$s paliko kanalą</string> - <string name="message_format_part_2">%1$s%2$s paliko (%3$s)</string> - <string name="message_format_quit_1">%1$s%2$s išėjo</string> - <string name="message_format_quit_2">%1$s%2$s išėjo (%3$s)</string> - <string name="message_format_kick_1">%1$s buvo išspirtas %2$s%3$s</string> - <string name="message_format_kick_2">%1$s buvo išspirtas %2$s%3$s (%4$s)</string> - <!-- Transifex’ quantity handling is different from Android’s. Issue opened on 2018-05-18 --> - <string name="message_format_kill_1">%1$s buvo nužudytas %2$s%3$s</string> - <string name="message_format_kill_2">%1$s buvo nužudytas %2$s%3$s (%4$s)</string> -</resources> diff --git a/app/src/main/res/values-lt/strings_preferences.xml b/app/src/main/res/values-lt/strings_preferences.xml deleted file mode 100644 index 5648607f8cd4dbf73cdc4b8bf065b3ec2a2686d1..0000000000000000000000000000000000000000 --- a/app/src/main/res/values-lt/strings_preferences.xml +++ /dev/null @@ -1,174 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<resources> - <string name="preference_appearance_title">Išvaizda</string> - - <string name="preference_theme_title">Tema</string> - <string name="preference_theme_entry_material_daynight">Material (Auto)</string> - <string name="preference_theme_entry_material_light">Material (Šviesi)</string> - <string name="preference_theme_entry_material_dark">Material (Tamsi)</string> - <string name="preference_theme_entry_quassel_daynight">Quassel (Auto)</string> - <string name="preference_theme_entry_quassel_light">Quassel (Šviesi)</string> - <string name="preference_theme_entry_quassel_dark">Quassel (Tamsi)</string> - <string name="preference_theme_entry_amoled">AMOLED</string> - <string name="preference_theme_entry_solarized_daynight">Solarized (Auto)</string> - <string name="preference_theme_entry_solarized_light">Solarized (Šviesi)</string> - <string name="preference_theme_entry_solarized_dark">Solarized (Tamsi)</string> - <string name="preference_theme_entry_gruvbox_daynight">Gruvbox (Auto)</string> - <string name="preference_theme_entry_gruvbox_light">Gruvbox (Šviesi)</string> - <string name="preference_theme_entry_gruvbox_dark">Gruvbox (Tamsi)</string> - <string name="preference_theme_entry_dracula">Dracula</string> - <string name="preference_input_enter_title">Enter mygtuko elgsena</string> - <string name="preference_input_enter_entry_emoji">Emoji pasirinkimas</string> - <string name="preference_input_enter_entry_send">Siųsti žinutę</string> - <string name="preference_input_enter_entry_newline">Nauja eilutė</string> - <string name="preference_show_lag_title">Rodyti delsimą</string> - <string name="preference_show_lag_summary">Veiksmų juostoje matysite kiek klijentas atsilieka nuo branduolio</string> - - <string name="preference_keep_screen_on_title">Laikyti ekraną įjungtą</string> - <string name="preference_keep_screen_on_summary">Neleidžia prietaisui užmigti kol programėlė aktyvi</string> - - <string name="preference_language_title">Kalba</string> - <string name="preference_language_entry_auto">Sistemos numatyta</string> - <string name="preference_notifications_title">Pranešimai</string> - - <string name="preference_notification_query_title">Tiesioginės žinutės</string> - - <string name="preference_notification_channel_title">Kanalo žinutės</string> - - <string name="preference_notification_other_title">Kitos žinutės</string> - - <string name="preference_notification_sound_title">Pranešimo garsas</string> - - <string name="preference_notification_vibration_title">Vibracija</string> - - <string name="preference_notification_light_title">LED Lemputė</string> - - <string name="preference_notification_mark_read_on_swipe_title">Pažymėti kaip perskaitytą nubraukus pranešimus</string> - <string name="preference_notification_mark_read_on_swipe_summary">Pažymi visas kanalo žinutes kaip perskaitytas, kai yra nubraukiamas pranešimas iš kanalo</string> - - <string name="preference_notification_network_name_in_notification_title_title">Rodyti tinklo pavadinimą pranešimų antraštėje</string> - - <string name="preference_notification_show_all_activities_in_toolbar_title">Pažymėti visas veiklas įrankių juostoje</string> - <string name="preference_notification_show_all_activities_in_toolbar_summary">Pokalbyje atsiradus bet kokiai veiklai, rodys spalvotą burbulą įrankių juostoje</string> - - <string name="preference_notification_configure_title">Pranešimų nustatymai</string> - - <string name="preference_notifications_level_all">Visos žinutės</string> - <string name="preference_notifications_level_highlight">Paminėjimai</string> - <string name="preference_notifications_level_none">Niekada</string> - <string name="preference_messages_title">Žinutės</string> - - <string name="preference_monospace_title">Naudoti Monospace šriftą</string> - - <string name="preference_textsize_title">Teksto dydis</string> - - <string name="preference_show_seconds_title">Rodyti sekundes</string> - - <string name="preference_use_24h_clock_title">Naudoti 24h formatą</string> - - <string name="preference_colorize_mirc_title">Naudoti mIRC spalvas</string> - <string name="preference_colorize_mirc_summaryon">Rodyti mIRC spalvas žinutėse</string> - <string name="preference_colorize_mirc_summaryoff">Naikinti mIRC spalvas iš žinučių</string> - - <string name="preference_colorize_nicknames_title">Spalvoti slapyvardžiai</string> - <string name="preference_colorize_nicknames_entry_all">Visus</string> - <string name="preference_colorize_nicknames_entry_all_but_mine">Visus, išskyrus savo</string> - <string name="preference_colorize_nicknames_entry_none">Nei vieno</string> - <string name="preference_show_prefix_title">Rodyti Sendermodes</string> - <string name="preference_show_prefix_entry_all">Visus</string> - <string name="preference_show_prefix_entry_highest">Aukščiausią</string> - <string name="preference_show_prefix_entry_none">Nei vieno</string> - <string name="preference_hostmask_actions_title">Rodyti Hostmask veiksmuose</string> - <string name="preference_hostmask_actions_summary">Rodyti nick!ident@host prisijungimo/atsijungimo/išėjimo žinutėse</string> - - <string name="preference_nicks_on_new_line_title">Išskirti slapyvardžius</string> - <string name="preference_nicks_on_new_line_summary">Rodyti slapyvardžius atskiroje eilutėje</string> - - <string name="preference_show_realnames_title">Rodyti tikrus vardus</string> - - <string name="preference_show_avatars_title">Rodyti Avatarus</string> - - <string name="preference_square_avatars_title">Neapvalinti Avatarų</string> - - <string name="preference_show_irccloud_avatars_title">Rodyti IRCCloud Avatarus</string> - <string name="preference_show_irccloud_avatars_summary">Jei galima, vartotojams be Avataro rodys jų IRCCloud alternatyvą</string> - - <string name="preference_show_gravatar_avatars_title">Rodyti Gravatar Avatarus</string> - <string name="preference_show_gravatar_avatars_summary">Jei galima, vartotojams be Avataro rodys jų Gravatar alternatyvą</string> - - <string name="preference_show_matrix_avatars_title">Rodyti Matrix Avatarus</string> - <string name="preference_show_matrix_avatars_summary">Jei galima, vartotojams be Avataro rodys jų Matrix alternatyvą</string> - - <string name="preference_time_at_end_title">Laiko žymes lygiuoti dešinėje</string> - <string name="preference_time_at_end_summary">Lygiuoja laiko žymes kiekvienos žinutės pabaigoje</string> - - <string name="preference_larger_emoji_title">Didesni Emoji</string> - <string name="preference_larger_emoji_summary">Padidinti Emoji žinutes</string> - - <string name="preference_highlight_own_messages_title">Žymėti savo žinutes</string> - <string name="preference_highlight_own_messages_summary">Lengviau atskirsite savo išsiųstas žinutes</string> - - <string name="preference_replace_emoji_title">Pakeisti Emoji trumpuosius kodus</string> - <string name="preference_replace_emoji_summary">Automatiškai pakeičia trumpuosius kodus, tokius kaip :+1: ar :like: į Emoji</string> - - - <string name="preference_autocomplete_title">Automatinis užbaigimas</string> - - <string name="preference_autocomplete_sender_doubleclick_title">Siuntėjo auto-įvedimas</string> - <string name="preference_autocomplete_sender_doubleclick_summary">Du kart paspauskite ant žinutės jog būtų automatiškai įvestas jos siuntėjas</string> - - <string name="preference_autocomplete_button_title">Auto-užbaigimo mygtukas</string> - <string name="preference_autocomplete_button_summary">Eilutės kairėje rodys įvedimo mygtuką, kuris automatiškai užbaigia žodį</string> - - <string name="preference_autocomplete_doubletap_title">Automatiškai užbaigti po dvigubo paspaudimo</string> - <string name="preference_autocomplete_doubletap_summary">Pasiūlyti slapyvardžius ir kanalus du kart paspaudus ant įvedimo laukelio</string> - - <string name="preference_autocomplete_auto_title">Siūlyti automatiškai</string> - <string name="preference_autocomplete_auto_summary">Siūlyti slapyvardžius ir kanalus įvedus pirmas 3 raides</string> - - <string name="preference_autocomplete_prefix_title">Siūlyti po simbolio</string> - <string name="preference_autocomplete_prefix_summary">Siūlyti slapyvardžius ir kanalus įvedus @ arba #</string> - - <string name="preference_autocomplete_nicks_title">Auto-užbaigti slapyvardžius</string> - - <string name="preference_autocomplete_buffers_title">Auto-užbaigti pokalbius</string> - - <string name="preference_autocomplete_aliases_title">Auto-užbaigti komandas</string> - - <string name="preference_autocomplete_emoji_title">Automatiškai užbaigti Emoji</string> - - - <string name="preference_backlog_title">Žinučių žurnalas</string> - - <string name="preference_page_size_title">Atminties dydis</string> - <string name="preference_page_size_summary">Žinučių kiekis, kuris bus užkrautas ir laikomas atmintyje</string> - - <string name="preference_initial_amount_title">Pradinis dydis</string> - <string name="preference_initial_amount_summary">Žinučių kiekis, kuris bus užkraunamas pirmą kartą atvėrus buferį</string> - - <string name="preference_clear_cache_title">Išvalyti senų pokalbių talpyklą</string> - - <string name="preference_connection_title">Ryšys</string> - - <string name="preference_show_notification_title">Rodyti aktyvųjį pranešimą</string> - <string name="preference_show_notification_summary">Išlaikys Quasseldroid įjungtą, rodant pastovų pranešimą</string> - -</resources> diff --git a/app/src/main/res/values-lt/strings_settings.xml b/app/src/main/res/values-lt/strings_settings.xml deleted file mode 100644 index 34d752568386276bf0909ca9fa176e4489f80323..0000000000000000000000000000000000000000 --- a/app/src/main/res/values-lt/strings_settings.xml +++ /dev/null @@ -1,158 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<resources> - <string name="settings_networks_title">Tinklai</string> - <string name="settings_network_title">Tinklas</string> - <string name="settings_network_network_name">Tinklo pavadinimas</string> - <string name="settings_network_identity">Tapatybė</string> - <string name="settings_network_sasl_enabled">SASL</string> - <string name="settings_network_sasl_account">Paskyra</string> - <string name="settings_network_sasl_password">Slaptažodis</string> - <string name="settings_network_sasl_supported">Šis tinklas palaiko SASL</string> - <string name="settings_network_sasl_upgrade">Naudoti SASL</string> - <string name="settings_network_autoidentify_enabled">Automatiškai atpažinti</string> - <string name="settings_network_autoidentify_service">Paslauga</string> - <string name="settings_network_autoidentify_password">Slaptažodis</string> - <string name="settings_network_connection">Ryšys</string> - <string name="settings_network_perform">Perform</string> - <string name="settings_network_rejoin_channels">Bandyti grįžti į kanalą</string> - <string name="settings_network_autoreconnect_enabled">Automatinis prisijungimas</string> - <string name="settings_network_autoreconnect_interval">Intervalas</string> - <string name="settings_network_autoreconnect_interval_unit">sekundės</string> - <string name="settings_network_autoreconnect_attempts">Bandymų kiekis</string> - <string name="settings_network_autoreconnect_unlimited">Neriboti bandymų</string> - <string name="settings_network_customratelimits_enabled">Siuntimo limitai</string> - <string name="settings_network_customratelimits_burstsize">Žinučių grupės dydis</string> - <string name="settings_network_customratelimits_unlimited">Neribotas</string> - <string name="settings_network_customratelimits_delay">Uždelsimas</string> - <string name="settings_network_customratelimits_interval_unit">sekundės</string> - - <string name="settings_networkserver_title">Tinklo serveris</string> - <string name="settings_networkserver_connection">Ryšys</string> - <string name="settings_networkserver_host">Host</string> - <string name="settings_networkserver_port">Port</string> - <string name="settings_networkserver_ssl_enabled">Naudoti SSL</string> - <string name="settings_networkserver_ssl_verify">Verifikuoti SSL</string> - <string name="settings_networkserver_password">Slaptažodis</string> - <string name="settings_networkserver_proxy_enabled">Naudoti Proxy</string> - <string name="settings_networkserver_proxy_type">Tipas</string> - <string name="settings_networkserver_proxy_type_http">HTTP</string> - <string name="settings_networkserver_proxy_type_socks5">SOCKS 5</string> - <string name="settings_networkserver_proxy_host">Host</string> - <string name="settings_networkserver_proxy_port">Port</string> - <string name="settings_networkserver_proxy_user">Vartotojo vardas</string> - <string name="settings_networkserver_proxy_pass">Slaptažodis</string> - - <string name="settings_identities_title">Tapatybės</string> - <string name="settings_identity_title">Tapatybė</string> - <string name="settings_identity_names">Vardai</string> - <string name="settings_identity_identity_name">Tapatybės pavadinimas</string> - <string name="settings_identity_real_name">Tikrasis vardas</string> - <string name="settings_identity_ident">Ident</string> - <string name="settings_identity_nick">Slapyvardis</string> - <string name="settings_identity_nicks">Slapyvardžiai</string> - <string name="settings_identity_messages">Žinutės</string> - <string name="settings_identity_kick_reason">Išspyrimo priežastis</string> - <string name="settings_identity_part_reason">Kanalo palikimo priežastis</string> - <string name="settings_identity_quit_reason">Išėjimo priežastis</string> - <string name="settings_identity_away">Neaktyvumo žinutės</string> - <string name="settings_identity_away_reason">Neaktyvumo priežastis</string> - <string name="settings_identity_detach_away">Neaktyvus dėl atsijungimo</string> - <string name="settings_identity_detach_away_reason">Neaktyvumo dėl atsijungimo priežastis</string> - - <string name="settings_chatlists_title">Pokalbių sąrašai</string> - <string name="settings_chatlist_title">Pokalbių sąrašas</string> - <string name="settings_chatlist_ui">Vartotojo sąsaja</string> - <string name="settings_chatlist_buffer_view_name">Pavadinimas</string> - <string name="settings_chatlist_show_search">Rodyti paiešką</string> - <string name="settings_chatlist_sort_alphabetically">Rikiuoti pagal abėcėlę</string> - <string name="settings_chatlist_add_new_buffers_automatically">Automatiškai pridėti naujus pokalbius</string> - <string name="settings_chatlist_network">Tinklas</string> - <string name="settings_chatlist_network_all">Visi tinklai</string> - <string name="settings_chatlist_network_create">Sukurti tinklą…</string> - <string name="settings_chatlist_show_status_buffer">Rodyti būsenos buferį</string> - <string name="settings_chatlist_types">Pokalbių tipai</string> - <string name="settings_chatlist_show_channels">Rodyti kanalus</string> - <string name="settings_chatlist_show_queries">Rodyti užklausas</string> - <string name="settings_chatlist_activity">Veikla</string> - <string name="settings_chatlist_minimum_activity_no_activity">Veiklos nėra</string> - <string name="settings_chatlist_minimum_activity_other_activity">Kita veikla</string> - <string name="settings_chatlist_minimum_activity_new_message">Nauja žinutė</string> - <string name="settings_chatlist_minimum_activity_highlight">Pažymėjimas</string> - <string name="settings_chatlist_hide_inactive_buffers">Slėpti neaktyvius pokalbius</string> - <string name="settings_chatlist_hide_inactive_networks">Slėpti neaktyvius tinklus</string> - - <string name="settings_ignorelist_title">Ignoruojamų sąrašas</string> - - <string name="settings_ignoreitem_title">Ignoravimas</string> - <string name="settings_ignoreitem_enabled">Įjungtas</string> - <string name="settings_ignoreitem_ignorerule">Ignoravimo taisyklė</string> - <string name="settings_ignoreitem_isregex">Paprastoji išraiška</string> - <string name="settings_ignoreitem_type">Tipas</string> - <string name="settings_ignoreitem_type_sender">Siuntėjas</string> - <string name="settings_ignoreitem_type_message">Žinutė</string> - <string name="settings_ignoreitem_type_ctcp">Ctcp</string> - <string name="settings_ignoreitem_strictness">Griežtumas</string> - <string name="settings_ignoreitem_strictness_soft">Dinaminis</string> - <string name="settings_ignoreitem_strictness_hard">Visam laikui</string> - <string name="settings_ignoreitem_scope">Apimtis</string> - <string name="settings_ignoreitem_scope_global">Globali apimtis</string> - <string name="settings_ignoreitem_scope_network">Tinklo apimtis</string> - <string name="settings_ignoreitem_scope_channel">Kanalo apimtis</string> - <string name="settings_ignoreitem_scoperule">Apimties taisyklė</string> - - <string name="settings_highlightlist_title">Žymėjimas</string> - <string name="settings_highlightlist_highlight_nick">Žymėti slapyvardį</string> - <string name="settings_highlightlist_highlight_nick_all_nicks">Visus tapatybės slapyvardžius</string> - <string name="settings_highlightlist_highlight_nick_current_nick">Dabartinį slapyvardį</string> - <string name="settings_highlightlist_highlight_nick_none">Nei vieno</string> - <string name="settings_highlightlist_nicks_case_sensitive">Skirti raidžių dydį</string> - <string name="settings_highlightlist_rules">Žymėjimo taisyklės</string> - <string name="settings_highlightlist_ignore_rules">Nežymėjimo taisyklės</string> - - <string name="settings_highlightrule_title">Žymėjimo taisyklė</string> - <string name="settings_highlightrule_enabled">Įjungta</string> - <string name="settings_highlightrule_name">Pavadinimas</string> - <string name="settings_highlightrule_regular_expression">Paprastoji išraiška</string> - <string name="settings_highlightrule_case_sensitive">Skirti raidžių dydį</string> - <string name="settings_highlightrule_sender">Siuntėjas</string> - <string name="settings_highlightrule_channel">Kanalas</string> - - <string name="settings_aliaslist_title">Alias nustatymai</string> - - <string name="settings_aliasitem_title">Alias</string> - <string name="settings_aliasitem_name">Pavadinimas</string> - <string name="settings_aliasitem_expansion">Plėtinys</string> - - <string name="settings_networkconfig_title">IRC Konfigūracija</string> - <string name="settings_networkconfig_ping_timeout">Ping vėlavimo aptikimas</string> - <string name="settings_networkconfig_ping_interval">Ping intervalas</string> - <string name="settings_networkconfig_ping_interval_unit">sekundės</string> - <string name="settings_networkconfig_max_ping_count">Atsijungti po</string> - <string name="settings_networkconfig_max_ping_count_unit">praleistų ping</string> - <string name="settings_networkconfig_auto_who">Automatinė vartotojo informacijos paieška</string> - <string name="settings_networkconfig_auto_who_interval">Atnaujinimo intervalas</string> - <string name="settings_networkconfig_auto_who_interval_unit">sekundės</string> - <string name="settings_networkconfig_auto_who_nick_limit">Ignoruoti kanalus su daugiau nei</string> - <string name="settings_networkconfig_auto_who_nick_limit_unit">vartotojų</string> - <string name="settings_networkconfig_auto_who_delay">Mažiausias uždelsimas tarp prašymų</string> - <string name="settings_networkconfig_auto_who_delay_unit">sekundės</string> - <string name="settings_networkconfig_standard_ctcp">Standartinė-Tinkama CTCP elgsena</string> -</resources> diff --git a/app/src/main/res/values-lt/strings_setup.xml b/app/src/main/res/values-lt/strings_setup.xml deleted file mode 100644 index 5fb836a8a63b1d77071e849f26acc7084f2b1d13..0000000000000000000000000000000000000000 --- a/app/src/main/res/values-lt/strings_setup.xml +++ /dev/null @@ -1,101 +0,0 @@ -<!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<resources> - <!-- Account Selection --> - <string name="slide_account_select_title">Pasirinkite paskyrą</string> - <string name="slide_account_select_description">Pasirinkite paskyrą iš sąrašo arba pridėkite naują</string> - <string name="label_user_on_host">%1$s ant %2$s:%3$d</string> - - <!-- Account Setup --> - - <!-- Account Connection --> - <string name="slide_account_connection_title">Ryšys</string> - <string name="slide_account_connection_description">Pirma, pasirinkite kuriame serveryje yra jūsų branduolys.</string> - - <string name="label_connection_host">Host</string> - <string name="label_connection_port">Port</string> - <string name="label_connection_ssl">Reikalauti SSL</string> - - <string name="hint_invalid_host">Netinkamas Hostname</string> - <string name="hint_invalid_port">Netinkamas Port</string> - - <!-- Account User --> - <string name="slide_account_user_title">Jūsų paskyra</string> - <string name="slide_account_user_description">Įveskite jūsų branduolio vartotojo vardą ir slaptažodį. Jeigu kątik sukūrėte branduolį, mes jums padėsime sutvarkyti paskyrą</string> - - <string name="label_account_user">Vartotojo vardas</string> - <string name="label_account_pass">Slaptažodis</string> - - <string name="hint_invalid_user">Vartotojo vardas negali būti tuščias</string> - - <!-- Account Name --> - <string name="slide_account_name_title">Paskyros nustatymai</string> - <string name="slide_account_name_description">Suteikite šiai paskyrai pavadinimą</string> - - <string name="label_account_name">Paskyros pavadinimas</string> - - <string name="hint_invalid_name">Pavadinimas negali būti tuščias</string> - - <!-- Core Setup --> - - <string name="setup_core_title">Branduolio sąranka</string> - - <!-- Core Authenticator Select --> - <string name="slide_core_authenticator_select_title">Pasirinkite autentifikacijos Backend</string> - <string name="slide_core_authenticator_select_description">Pasirinkite autentifikacijos backend Quassel Branduoliui naudoti autentifikuojant vartotojus.</string> - - <!-- Core Backend Select --> - <string name="slide_core_backend_select_title">Pasirinkite talpyklos Backend</string> - <string name="slide_core_backend_select_description">Pasirinkite duomenų bazės backend Quassel Branduolio talpyklai laikyti senas žinutes ir kitus duomenis.</string> - - <string name="label_backend">Backend</string> - - <!-- Core Backend Config --> - <string name="slide_core_backend_setup_title">Konfigūruoti talpyklos Backend</string> - <string name="slide_core_backend_setup_description">Sukonfigūruokite pasirinktos duomenų bazės backend.</string> - - <string name="setup_core_backend_no_options">Šis Backend neturi konfigūravimo pasirinkimų, daugiau nieko atlikti nereikia!</string> - - <!-- User Setup --> - - <string name="setup_user_title">Vartotojo sąranka</string> - - <!-- User Identity --> - <string name="slide_user_identity_title">Tapatybės sąranka</string> - <string name="slide_user_identity_description">Pasirinkite slapyvardį</string> - - <string name="hint_invalid_nick">Netinkamas slapyvardis</string> - - <!-- User Network --> - <string name="slide_user_network_title">Tinklo sąranka</string> - <string name="slide_user_network_description">Pasirinkite tinklą prie kurio bus jungiamasi.</string> - - <string name="label_network_custom">Kitas tinklas…</string> - - <!-- User Channels --> - <string name="slide_user_channels_title">Kanalų sąranka</string> - <string name="slide_user_channels_description">Pasirinkite į kuriuos kanalus jungtis.</string> - - <string name="label_channels">Kanalai</string> - - <!-- Network Setup --> - - <string name="setup_network_title">Tinklo sąranka</string> -</resources> diff --git a/app/src/main/res/values-lt/strings_status.xml b/app/src/main/res/values-lt/strings_status.xml deleted file mode 100644 index c14b3d217ab1f974f535ab248dd59e4f623fb2b2..0000000000000000000000000000000000000000 --- a/app/src/main/res/values-lt/strings_status.xml +++ /dev/null @@ -1,27 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<resources> - <string name="label_status_disconnected">Neprisijungta</string> - <string name="label_status_connecting">Jungiamasi</string> - <string name="label_status_handshake">Patvirtinama</string> - <string name="label_status_init">Inicializuojama</string> - <string name="label_status_connected">Prisijungta</string> - <string name="label_status_closed">Ryšys Prarastas</string> -</resources> diff --git a/app/src/main/res/values-night/themes.xml b/app/src/main/res/values-night/themes.xml new file mode 100644 index 0000000000000000000000000000000000000000..b62f69e5806cfa7ad1cbe7a8b6c7cd11323cb3c5 --- /dev/null +++ b/app/src/main/res/values-night/themes.xml @@ -0,0 +1,16 @@ +<resources xmlns:tools="http://schemas.android.com/tools"> + <!-- Base application theme. --> + <style name="Theme.Quasseldroid" parent="Theme.MaterialComponents.DayNight.DarkActionBar"> + <!-- Primary brand color. --> + <item name="colorPrimary">@color/purple_200</item> + <item name="colorPrimaryVariant">@color/purple_700</item> + <item name="colorOnPrimary">@color/black</item> + <!-- Secondary brand color. --> + <item name="colorSecondary">@color/teal_200</item> + <item name="colorSecondaryVariant">@color/teal_200</item> + <item name="colorOnSecondary">@color/black</item> + <!-- Status bar color. --> + <item name="android:statusBarColor" tools:targetApi="l">?attr/colorPrimaryVariant</item> + <!-- Customize your theme here. --> + </style> +</resources> \ No newline at end of file diff --git a/app/src/main/res/values-night/themes_daynight.xml b/app/src/main/res/values-night/themes_daynight.xml deleted file mode 100644 index b873caacca20543d6d6c77ba494410b851e39092..0000000000000000000000000000000000000000 --- a/app/src/main/res/values-night/themes_daynight.xml +++ /dev/null @@ -1,29 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<resources> - - <style name="Theme.ChatTheme.Material_DayNight" parent="Theme.ChatTheme.Material_Dark" /> - - <style name="Theme.ChatTheme.Quassel_DayNight" parent="Theme.ChatTheme.Quassel_Dark" /> - - <style name="Theme.ChatTheme.Solarized_DayNight" parent="Theme.ChatTheme.Solarized_Dark" /> - - <style name="Theme.ChatTheme.Gruvbox_DayNight" parent="Theme.ChatTheme.Gruvbox_Dark" /> -</resources> diff --git a/app/src/main/res/values-nl/strings.xml b/app/src/main/res/values-nl/strings.xml deleted file mode 100644 index 8320e40ff1cc7acee6fd1c5be5b2b2d6857eb9f1..0000000000000000000000000000000000000000 --- a/app/src/main/res/values-nl/strings.xml +++ /dev/null @@ -1,81 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<resources> - <string name="app_name">Quasseldroid</string> - <string name="connection_service_description">Houdt een verbinding met je core om meldingen mogelijk te maken en berichten te verzenden. </string> - - <string name="label_about">Over</string> - <string name="label_ascending">Oplopend</string> - <string name="label_authors">Auteurs</string> - <string name="label_autocomplete">Autoaanvullen</string> - <string name="label_avatar">Avatar</string> - <string name="label_back">Terug</string> - <string name="label_certificates">Certificaten</string> - <string name="label_channel_name">Kanaalnaam</string> - <string name="label_close">Sluiten</string> - <string name="label_colors_mirc">mIRC</string> - <string name="label_configure">Configureren</string> - <string name="label_connect">Verbinden</string> - <string name="label_copy">Kopiëren</string> - <string name="label_crashes">Crashes</string> - <string name="label_crashes_empty">Geen crash rapporten gevonden</string> - <string name="label_delete">Verwijder</string> - <string name="label_delete_all">Alles Verwijderen</string> - <string name="label_descending">Aflopend</string> - <string name="label_edit_core">Account Aanpassen</string> - <string name="label_finish">Voltooien</string> - <string name="label_ignore">Negeren</string> - <string name="label_info">Details</string> - <string name="label_info_channellist">Kanaal Lijst</string> - <string name="label_license">Licentie</string> - <string name="label_mark_read">Markeer als gelezen</string> - <string name="label_new_identity">Nieuwe Identiteit</string> - <string name="label_new_network">Nieuw Netwerk</string> - <string name="label_new_server">Nieuwe Server</string> - <string name="label_next">Volgende</string> - <string name="label_no">Nee</string> - <string name="label_no_sound">Geen</string> - <string name="label_open">Open</string> - <string name="label_part">Verlaten</string> - <string name="label_part_long">Kanaal verlaten</string> - <string name="label_password_change">Wachtwoord Aanpassen</string> - <string name="label_password_error_nomatch">Wachtwoorden komen niet overeen</string> - <string name="label_password_error_wrong">Verkeerd Wachtwoord</string> - <string name="label_password_new">Nieuw Wachtwoord</string> - <string name="label_password_old">Voormalig Wachtwoord</string> - <string name="label_password_repeat">Herhaal Wachtwoord</string> - <string name="label_placeholder_message">Schrijf een bericht…</string> - <string name="label_placeholder_topic">Omschrijf het kanaalonderwerp…</string> - <string name="label_privacy_policy">Privacybeleid</string> - <string name="label_rename">Hernoem</string> - <string name="label_reply">Beantwoorden</string> - <string name="label_save">Opslaan</string> - <string name="label_saving">Opslaan…</string> - <string name="label_search">Zoek…</string> - <string name="label_search_channels">Doorzoek kanalen</string> - <string name="label_select">Selecteer</string> - <string name="label_settings">Instellingen</string> - <string name="label_sort">Sorteren</string> - <string name="label_source">Bron</string> - <string name="label_topic">Kanaalonderwerp</string> - <string name="label_translators">Vertalers</string> - <string name="label_yes">Ja</string> - -</resources> diff --git a/app/src/main/res/values-nl/strings_certificates.xml b/app/src/main/res/values-nl/strings_certificates.xml deleted file mode 100644 index 8dd7d377467c042e001568c8d47116c1e10e8c3f..0000000000000000000000000000000000000000 --- a/app/src/main/res/values-nl/strings_certificates.xml +++ /dev/null @@ -1,20 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<resources></resources> diff --git a/app/src/main/res/values-nl/strings_contributors.xml b/app/src/main/res/values-nl/strings_contributors.xml deleted file mode 100644 index 8dd7d377467c042e001568c8d47116c1e10e8c3f..0000000000000000000000000000000000000000 --- a/app/src/main/res/values-nl/strings_contributors.xml +++ /dev/null @@ -1,20 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<resources></resources> diff --git a/app/src/main/res/values-nl/strings_defaults.xml b/app/src/main/res/values-nl/strings_defaults.xml deleted file mode 100644 index 0811da74ca6f0075af03cac11e3034ad27241b41..0000000000000000000000000000000000000000 --- a/app/src/main/res/values-nl/strings_defaults.xml +++ /dev/null @@ -1,20 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<resources></resources> diff --git a/app/src/main/res/values-nl/strings_error.xml b/app/src/main/res/values-nl/strings_error.xml deleted file mode 100644 index 8dd7d377467c042e001568c8d47116c1e10e8c3f..0000000000000000000000000000000000000000 --- a/app/src/main/res/values-nl/strings_error.xml +++ /dev/null @@ -1,20 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<resources></resources> diff --git a/app/src/main/res/values-nl/strings_format.xml b/app/src/main/res/values-nl/strings_format.xml deleted file mode 100644 index c80c4f3ce266962b1ac1e540bc750c4aed7d28e8..0000000000000000000000000000000000000000 --- a/app/src/main/res/values-nl/strings_format.xml +++ /dev/null @@ -1,28 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<resources> - <string name="label_bold">Vet</string> - <string name="label_italic">Cursief</string> - <string name="label_strikethrough">Doorhalen</string> - <string name="label_underline">Onderstrepen</string> - <string name="label_foreground">Voorgrondkleur</string> - <string name="label_background">Achtergrondkleur</string> - <string name="label_clear_formatting">Opmaak wissen</string> -</resources> diff --git a/app/src/main/res/values-nl/strings_info.xml b/app/src/main/res/values-nl/strings_info.xml deleted file mode 100644 index 8dd7d377467c042e001568c8d47116c1e10e8c3f..0000000000000000000000000000000000000000 --- a/app/src/main/res/values-nl/strings_info.xml +++ /dev/null @@ -1,20 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<resources></resources> diff --git a/app/src/main/res/values-nl/strings_messages.xml b/app/src/main/res/values-nl/strings_messages.xml deleted file mode 100644 index 8dd7d377467c042e001568c8d47116c1e10e8c3f..0000000000000000000000000000000000000000 --- a/app/src/main/res/values-nl/strings_messages.xml +++ /dev/null @@ -1,20 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<resources></resources> diff --git a/app/src/main/res/values-nl/strings_preferences.xml b/app/src/main/res/values-nl/strings_preferences.xml deleted file mode 100644 index 8dd7d377467c042e001568c8d47116c1e10e8c3f..0000000000000000000000000000000000000000 --- a/app/src/main/res/values-nl/strings_preferences.xml +++ /dev/null @@ -1,20 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<resources></resources> diff --git a/app/src/main/res/values-nl/strings_settings.xml b/app/src/main/res/values-nl/strings_settings.xml deleted file mode 100644 index 8dd7d377467c042e001568c8d47116c1e10e8c3f..0000000000000000000000000000000000000000 --- a/app/src/main/res/values-nl/strings_settings.xml +++ /dev/null @@ -1,20 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<resources></resources> diff --git a/app/src/main/res/values-nl/strings_setup.xml b/app/src/main/res/values-nl/strings_setup.xml deleted file mode 100644 index e51ee5f7817fa049578dcdb7b2765bc03dd80473..0000000000000000000000000000000000000000 --- a/app/src/main/res/values-nl/strings_setup.xml +++ /dev/null @@ -1,46 +0,0 @@ -<!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<resources> - <!-- Account Selection --> - <string name="slide_account_select_title">Selecteer Account</string> - <string name="slide_account_select_description">Selecteer een account uit de lijst of voeg een toe</string> - <!-- Account Setup --> - - <!-- Account Connection --> - <string name="slide_account_connection_title">Verbinding</string> - <string name="slide_account_connection_description">Kies eerst op welke server je core gehost wordt.</string> - - <string name="label_connection_host">Host</string> - <string name="label_connection_port">Poort</string> - <string name="hint_invalid_host">Ongeldige hostnaam</string> - <string name="hint_invalid_port">Ongeldige poort</string> - - <!-- Account User --> - <string name="slide_account_user_title">Jouw Account</string> - <string name="label_account_user">Gebruikersnaam</string> - <string name="label_account_pass">Wachtwoord</string> - - <string name="hint_invalid_user">De gebruikersnaam mag niet leeg zijn</string> - - <!-- Account Name --> - <string name="slide_account_name_title">Account aanpassen</string> - <string name="hint_invalid_name">De naam mag niet leeg zijn</string> - -</resources> diff --git a/app/src/main/res/values-nl/strings_status.xml b/app/src/main/res/values-nl/strings_status.xml deleted file mode 100644 index 8dd7d377467c042e001568c8d47116c1e10e8c3f..0000000000000000000000000000000000000000 --- a/app/src/main/res/values-nl/strings_status.xml +++ /dev/null @@ -1,20 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<resources></resources> diff --git a/app/src/main/res/values-pt/strings.xml b/app/src/main/res/values-pt/strings.xml deleted file mode 100644 index a201091700e00b3eaa904d56bdad14cd5b6caa8e..0000000000000000000000000000000000000000 --- a/app/src/main/res/values-pt/strings.xml +++ /dev/null @@ -1,201 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<resources xmlns:tools="http://schemas.android.com/tools"> - <plurals name="label_user_count"> - <item quantity="one">%1$d utilizadores</item> - <item quantity="other">%1$d utilizadores</item> - </plurals> - <string name="app_name">Quasseldroid</string> - <string name="app_description">Um cliente baseado no Android para o cliente de IRC Quassel descentralizado.</string> - - <string name="app_description_long">Quassel é um cliente IRC distribuído e descentralizado, escrito usando C++ e Qt. O Quasseldroid é um cliente escrito puramente em kotlin para o núcleo Quassel, permitindo que você se ligue ao seu núcleo Quassel usando o seu telemóvel Android™.</string> - <string name="connection_service_title">Serviço de Ligação</string> - - <string name="connection_service_description">Mantém uma ligação com o seu núcleo para permitir notificações e transmissão de mensagens.</string> - <string name="label_about">Sobre</string> - <string name="label_accept">Aceitar</string> - <string name="label_acknowledgements">Agradecimentos</string> - <string name="label_archive">Arquivar</string> - <string name="label_archive_chat">Arquivar Chat</string> - <string name="label_archived_chats">Chats Arquivados</string> - <string name="label_ascending">Ascendente</string> - <string name="label_authors">Autores</string> - <string name="label_autocomplete">Auto completar</string> - <string name="label_avatar">Avatar</string> - <string name="label_back">Voltar</string> - <string name="label_buffer_name">Nome do Chat</string> - <string name="label_cancel">Cancelar</string> - <string name="label_certificates">Certificados</string> - <string name="label_channel_name">Nome do Canal</string> - <string name="label_clear_search">Limpar Pesquisa</string> - <string name="label_close">Fechar</string> - <string name="label_colors_custom">Personalizado</string> - <string name="label_colors_mirc">mIRC</string> - <string name="label_configure">Configurar</string> - <string name="label_connect">Ligar</string> - <string name="label_copy">Copiar</string> - <string name="label_crashes">Crashes</string> - <string name="label_crashes_empty">Nenhum relatório de erros foi encontrado</string> - <string name="label_create_channel">Criar Canal</string> - <string name="label_delete">Apagar</string> - <string name="label_delete_all">Apagar Todos</string> - <string name="label_descending">Descendente</string> - <string name="label_disconnect">Desligar</string> - <string name="label_edit_core">Editar Conta</string> - <string name="label_edit_nick">Editar Nick</string> - <string name="label_edit_topic">Editar Tópico</string> - <string name="label_edit_topic_long">Abre a caixa de diálogo para alterar o tópico do canal</string> - <string name="label_filter_messages">Filtrar Mensagens</string> - <string name="label_finish">Terminar</string> - <string name="label_generate_crash_report">Criar relatório de erros. </string> - <string name="label_ignore">Ignorar</string> - <string name="label_ignore_long">Adiciona/remove o utilizador na/da lista de ignorados</string> - <string name="label_info">Detalhes</string> - <string name="label_info_certificate">Certificado</string> - <string name="label_info_channel">Detalhes do Canal</string> - <string name="label_info_channellist">Lista de Canais</string> - <string name="label_info_core">Detalhes do nucleo</string> - <string name="label_info_user">Detalhes do Utilizador</string> - <string name="label_input_history">Histórico de Mensagens</string> - <string name="label_join">Entrar</string> - <string name="label_join_long">Entrar no Canal</string> - <string name="label_libraries">Bibliotecas</string> - <string name="label_license">Licença</string> - <string name="label_mark_read">Marcar como lida</string> - <string name="label_match_all">Corresponde a todas as mensagens</string> - <string name="label_mention">Mencionar</string> - <string name="label_mention_long">Copia o nome de utilizador para a caixa de digitação</string> - <string name="label_network">Rede</string> - <string name="label_new_account">Adicionar Conta</string> - <string name="label_new_chatlist">Adicionar Lista de Chats</string> - <string name="label_new_highlight_ignore_rule">Nova Regra para Ignorar Menções</string> - <string name="label_new_highlight_rule">Nova Regra de Menções</string> - <string name="label_new_identity">Adicionar Identidade</string> - <string name="label_new_ignore_rule">Nova Regra de Ignore</string> - <string name="label_new_network">Adicionar Rede</string> - <string name="label_new_nick">Adicionar Nick</string> - <string name="label_new_server">Adicionar Servidor</string> - <string name="label_next">Próximo</string> - <string name="label_nick">Nick</string> - <string name="label_nicklist">Lista de Nicks</string> - <string name="label_no">Não</string> - <string name="label_no_away_message">Sem mensagem de ausência disponível</string> - <string name="label_no_sound">Nenhum</string> - <string name="label_open">Abrir</string> - <string name="label_part">Sair</string> - <string name="label_part_long">Sair do Canal</string> - <string name="label_password_change">Alterar palavra-passe</string> - <string name="label_password_error_nomatch">As palavras-passe não correspondem</string> - <string name="label_password_error_wrong">Palavra-passe errada</string> - <string name="label_password_new">Nova palavra-passe</string> - <string name="label_password_old">Antiga palavra-passe</string> - <string name="label_password_repeat">Confirme a palavra-passe</string> - <string name="label_permanently_archived">Arquivado Permanentemente</string> - <string name="label_permanently_archived_long"> Chats permanentemente arquivados ficam escondidos até que escolha desarquiva-los manualmente.</string> - <string name="label_placeholder_message">Escrever uma mensagem…</string> - <string name="label_placeholder_topic">Descreva o tópico do canal…</string> - <string name="label_privacy_policy">Política de Privacidade</string> - <string name="label_query">Abrir conversa privada</string> - <string name="label_query_long">Abrir conversa privada com o utilizador</string> - <string name="label_query_medium">Abrir chat privado</string> - <string name="label_rename">Renomear</string> - <string name="label_reorder">Reordenar</string> - <string name="label_reply">Responder</string> - <string name="label_reset">Restabelecer</string> - <string name="label_save">Guardar</string> - <string name="label_saving">Salvando…</string> - <string name="label_search">Pesquisa…</string> - <string name="label_search_buffer">Pesquisar Chats</string> - <string name="label_search_channels">Pesquisar Canais</string> - <string name="label_select">Selecionar</string> - <string name="label_send">Enviar</string> - <string name="label_service_connection_failed">Não foi possível criar a ligação, verifique as opções de economia de bateria. Visite dontkillmyapp.com para mais informação.</string> - <string name="label_set_default">Definir Como Padrão</string> - <string name="label_settings">Configurações</string> - <string name="label_settings_client">Configurações do Cliente</string> - <string name="label_settings_core">Configurações do Núcleo</string> - <string name="label_share">Partilhar</string> - <string name="label_share_crashreport">Partilhar Relatório de Crash</string> - <string name="label_shortcut">Atalho</string> - <string name="label_shortcut_long">Criar atalho no ecrã principal</string> - <string name="label_sort">Ordenar</string> - <string name="label_source">Fonte</string> - <string name="label_temporarily_archived">Arquivado temporariamente</string> - <string name="label_temporarily_archived_long"> Chats arquivados temporariamente serão mostrados novamente assim que tenham uma mensagem nova.</string> - <string name="label_topic">Tópico do Canal</string> - <string name="label_translators">Tradutores</string> - <string name="label_unhide">Tornar Visível</string> - <string name="label_unknown_sender"><Desconhecido></string> - <string name="label_update_user_password">Actualizar Utilizador/Senha</string> - <string name="label_use_default">Utilizar Padrão</string> - <string name="label_user_count">Contagem de utilizadores</string> - <string name="label_website">Site</string> - <string name="label_whitelist">Ignorar</string> - <string name="label_whitelist_certificates">Certificados</string> - <string name="label_whitelist_certificates_empty">Nenhum certificado permitido</string> - <string name="label_whitelist_hostnames">Anfitriões</string> - <string name="label_whitelist_hostnames_empty">Nenhum anfitrião permitido</string> - <string name="label_whitelist_ignore_date">A data de caducidade é ignorada para este certificado</string> - <string name="label_who">Who</string> - <string name="label_who_long">Atualizar as informações de utilizador de todos os utilizadores</string> - <string name="label_whois">Whois</string> - <string name="label_whois_long">Atualizar informações de utilizador</string> - - <string name="label_yes">Sim</string> - - <string name="label_feature_synchronizedmarkerline">Necessário para sincronizar a última posição nos canais</string> - <string name="label_feature_saslauthentication">Necessario para SASL</string> - <string name="label_feature_saslexternal">Necessário para SASL com certificados</string> - <string name="label_feature_hideinactivenetworks">Obrigatório para ocultar redes inativas das listas de chats</string> - <string name="label_feature_passwordchange">Necessário para alterar senhas a partir do cliente</string> - <string name="label_feature_capnegotiation">Necessário para recursos do IRCv3</string> - <string name="label_feature_verifyserverssl">Necessário para verificar o certificado SSL das redes de IRC às quais você se conecta</string> - <string name="label_feature_customratelimits">Necessário para limites personalizados para redes de IRC</string> - <string name="label_feature_awayformattimestamp">Necessário para personalização de data/hora em mensagens de ausência</string> - <string name="label_feature_bufferactivitysync">Obrigatório para ver a atividade de chats na lista de chats</string> - <string name="label_feature_coresidehighlights">Obrigatório para menções</string> - <string name="label_feature_senderprefixes">Necessário para ver os modos de prefixo (+, @) dos utilizadores nas mensagens</string> - <string name="label_feature_remotedisconnect">Necessário para desconexões remotas de seus próprios clientes</string> - <string name="label_feature_richmessages">Necessário para ver nomes reais ou avatares do IRCV3 ou do Gravatar em mensagens</string> - <string name="label_feature_backlogfiltertype">Obrigatório para receber notificações passadas após a conexão</string> - - <string name="label_feature_context_bufferactivitysync">O Quasseldroid não pode destacar mensagens não lidas. Actualize seu núcleo para o Quassel v0.13 para resolver isso.</string> - <string name="label_feature_context_coresidehighlights">O Quasseldroid não pode configurar menções. Actualize seu núcleo para o Quassel v0.13 para resolver isso.</string> - <string name="label_feature_context_missing">Faltam algumas funcionalidades no seu núcleo para o Quasseldroid funcionar correctamente.</string> - <string name="label_feature_context_missing_button">Detalhes</string> - - <string name="notification_channel_connection_title">Ligação</string> - <string name="notification_channel_highlight_title">Menções</string> - <string name="notification_channel_old_highlight_title">Menções Antigas</string> - - <string name="label_missing_features">Funcionalidades Ausentes</string> - <string name="info_missing_features" tools:ignore="StringFormatCount">O seu núcleo tem em falta algumas funcionalidades que são necessárias para o Quasseldroid funcionar corretamente. Deve <a href=\"https://quassel-irc.org>upgrade</a> o seu núcleo Quassel para a versão %1$s ou superior.</string> - - <string name="buffer_delete_confirmation">Deseja eliminar este chat permanentemente?</string> - <string name="buffer_archive_confirmation">Deseja arquivar este chat?</string> - <string name="buffer_archive_temporarily">Mostrar este chat automaticamente assim que tenha mensagens novas</string> - - <string name="delete_confirmation">Tem certeza de que deseja excluir isto permanentemente? Isto não pode ser revertido.</string> - <string name="cancel_confirmation">Você tem alterações não guardadas. Você deseja descartá-las?</string> - - <string name="info_copied_version">Versão copiada para a área de transferência</string> - - <string name="advertisement_support_patreon">Por favor, ajudem a apoiar o desenvolvimento deste aplicativo através de Patreon</string> -</resources> diff --git a/app/src/main/res/values-pt/strings_certificates.xml b/app/src/main/res/values-pt/strings_certificates.xml deleted file mode 100644 index eb57fd00065d6e3b29ccd6c5f487ed108b386eac..0000000000000000000000000000000000000000 --- a/app/src/main/res/values-pt/strings_certificates.xml +++ /dev/null @@ -1,39 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<resources> - <string name="certificate_subject">Emitido Para</string> - <string name="certificate_issuer">Emitido Por</string> - - <string name="certificate_common_name">Nome comum (CN)</string> - <string name="certificate_organization">Organização (O)</string> - <string name="certificate_organizational_unit">Unidade Organizacional (OU)</string> - - <string name="certificate_hostnames">Hostnames</string> - - <string name="certificate_validity">Período de Validade</string> - - <string name="certificate_not_before">Não Antes</string> - <string name="certificate_not_after">Não Depois</string> - - <string name="certificate_fingerprints">Impressões digitais</string> - - <string name="certificate_fingerprint_sha256">Impressão digital SHA-256</string> - <string name="certificate_fingerprint_sha1">Impressão digital SHA-1</string> -</resources> diff --git a/app/src/main/res/values-pt/strings_contributors.xml b/app/src/main/res/values-pt/strings_contributors.xml deleted file mode 100644 index 543efff44915a28555ca3da2cf8654436fabdaac..0000000000000000000000000000000000000000 --- a/app/src/main/res/values-pt/strings_contributors.xml +++ /dev/null @@ -1,26 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<resources> - <string name="contributor_description_freqmod">Tentativas iniciais de desserialização do qdatastream</string> - <string name="contributor_description_sandsmark">Implementação do protocolo legado, (des)serializadores, (des)moralizador do projecto</string> - <string name="contributor_description_magnuf">UI Legada</string> - <string name="contributor_description_kenji">UI Legada</string> - <string name="contributor_description_justjanne">Reestruturação, UI, Processadores de Anotações, Back-end</string> -</resources> diff --git a/app/src/main/res/values-pt/strings_defaults.xml b/app/src/main/res/values-pt/strings_defaults.xml deleted file mode 100644 index 17030fbfdb1b4a5f7b3c158703658f7d9d9e6de0..0000000000000000000000000000000000000000 --- a/app/src/main/res/values-pt/strings_defaults.xml +++ /dev/null @@ -1,31 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<resources> - <string name="default_bufferviewconfig_name">Todos os Chats</string> - - <string name="default_identity_identity_name">Identidade Padrão</string> - <string name="default_identity_realname">Utilizador Quassel IRC</string> - <string name="default_identity_awayreason">Fui pescar.</string> - <string name="default_identity_autoawayreason">Não estou aqui. Não, a sério. Não estou aqui!</string> - <string name="default_identity_detachawayreason">Todos os clientes Quassel desapareceram da face da terra…</string> - <string name="default_identity_kickreason">O Jardim de Infância é noutro lugar!</string> - <string name="default_identity_partreason">https://quassel-irc.org - Converse confortavelmente. Em qualquer lugar.</string> - <string name="default_identity_quitreason">https://quassel-irc.org - Converse confortavelmente. Em qualquer lugar.</string> -</resources> diff --git a/app/src/main/res/values-pt/strings_error.xml b/app/src/main/res/values-pt/strings_error.xml deleted file mode 100644 index faa44f4aaf6b8db4969bb36342094ba628954f0c..0000000000000000000000000000000000000000 --- a/app/src/main/res/values-pt/strings_error.xml +++ /dev/null @@ -1,49 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<resources> - <string name="label_error_login">Falha de Autenticação</string> - <string name="label_error_setup">Erro de Configuração</string> - <string name="label_error_init">Erro de Ligação</string> - <string name="label_error_ssl">Erro de SSL</string> - <string name="label_error_ssl_required_unavailable">SSL é requerido para esta ligação mas o núcleo não tem suporte a essa função</string> - <string name="label_error_certificate">Erro de Certificado</string> - <string name="label_error_certificate_no_certificate">Sem certificado disponível</string> - <string name="label_error_certificate_no_hostname">Nenhum hostname disponível</string> - <string name="label_error_certificate_invalid"><![CDATA[ - <p>O certificado com impressão digital<br/> - <code>%1$s</code><br/> - só é válido a partir de %2$s até %3$s</p> - ]]></string> - <string name="label_error_certificate_untrusted"><![CDATA[ - <p>O certificado com impressão digital<br/> - <code>%1$s</code><br/> - não é confiável.</p> - ]]></string> - <string name="label_error_certificate_no_match"><![CDATA[ - <p>O certificado com impressão digital<br/> - <code>%1$s</code><br/> - não é válido para %2$s.</p> - ]]></string> - - <string name="label_error_unknown_host">Anfitrião não encontrado: %1$s</string> - <string name="label_error_invalid_protocol_version">Protocolo inválido: %1$d</string> - <string name="label_error_connection">Erro encontrado durante a conexão: %1$s (%2$s)</string> - <string name="label_error_connection_closed">Erro: a conexão foi fechada inesperadamente</string> -</resources> diff --git a/app/src/main/res/values-pt/strings_format.xml b/app/src/main/res/values-pt/strings_format.xml deleted file mode 100644 index 91d5b3b13cb90accec5766f2d3d24f86e918cdcf..0000000000000000000000000000000000000000 --- a/app/src/main/res/values-pt/strings_format.xml +++ /dev/null @@ -1,29 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<resources> - <string name="label_bold">Negrito</string> - <string name="label_italic">Itálico</string> - <string name="label_strikethrough">Rasurado</string> - <string name="label_underline">Sublinhado</string> - <string name="label_monospace">Monospace</string> - <string name="label_foreground">Cor do Texto</string> - <string name="label_background">Cor de Fundo</string> - <string name="label_clear_formatting">Limpar Formatação</string> -</resources> diff --git a/app/src/main/res/values-pt/strings_info.xml b/app/src/main/res/values-pt/strings_info.xml deleted file mode 100644 index 1e377ba156cf5797ee4fecca6bfc04e8fc8c2f76..0000000000000000000000000000000000000000 --- a/app/src/main/res/values-pt/strings_info.xml +++ /dev/null @@ -1,47 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<resources> - <string name="label_user_away">Ausente</string> - <string name="label_user_away_reason">Razão</string> - <string name="label_user_identity">Identidade</string> - <string name="label_user_account">Conta</string> - <string name="label_user_ident">Identidade</string> - <string name="label_user_host">Anfitrião</string> - <string name="label_user_server">Servidor</string> - <string name="label_user_common_channels">Canais em comum</string> - - <string name="label_core_version">Versão</string> - <string name="label_core_uptime">Tempo de atividade</string> - <string name="label_core_security">Segurança</string> - <string name="label_core_clients">Clientes</string> - <string name="label_core_online_since">Online desde %1$s</string> - <string name="label_core_connected_since">Ligado desde %1$s</string> - <string name="label_core_connection_verified_by">Ligação verificada por %1$s</string> - <string name="label_core_connection_protocol">A ligação utiliza %1$s</string> - <string name="label_core_connection_ciphersuite">A ligação é encriptada e autenticada utilizando %1$s e usa %2$s como mecanismo de troca de chaves</string> - <string name="label_core_connection_ciphersuite_13">A ligação é encriptada e autenticada utilizando %1$s</string> - <string name="label_core_connection_verified_by_unknown">Desconhecido</string> - <string name="label_core_connection_insecure">Ligação insegura</string> - - <string name="property_group_ircchannel_channel">Canal</string> - <string name="property_ircchannel_topic">Tópico</string> - <string name="property_ircchannel_topic_action_edit">Editar Tópico</string> - <string name="property_ircchannel_topic_default">Sem Tópico Disponível</string> -</resources> diff --git a/app/src/main/res/values-pt/strings_messages.xml b/app/src/main/res/values-pt/strings_messages.xml deleted file mode 100644 index 8ed0c3164ac8e055880ff5e028a9c414d4421561..0000000000000000000000000000000000000000 --- a/app/src/main/res/values-pt/strings_messages.xml +++ /dev/null @@ -1,52 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<resources> - <plurals name="message_netsplit_join"> - <item quantity="one">Netsplit entre %1$s e %2$s terminou: %3$d utilizadores entraram: %4$s</item> - <item quantity="other">Netsplit entre %1$s e %2$s terminou: %3$d utilizadores entraram: %4$s</item> - </plurals> - <plurals name="message_netsplit_quit"> - <item quantity="one">Netsplit entre %1$s and %2$s: %3$d user qui: %4$s</item> - <item quantity="other">Netsplit entre %1$s e %2$s: %3$d utilizadores saíram: %4$s</item> - </plurals> - <string name="message_type_join">Entrar</string> - <string name="message_type_part">Sair</string> - <string name="message_type_quit">Desligar</string> - <string name="message_type_nick">Nick</string> - <string name="message_type_mode">Modo</string> - <string name="message_type_topic">Tópico</string> - - <string name="message_format_copy">[%1$s] %2$s</string> - <string name="message_format_copy_complex">[%1$s] <%2$s> %3$s</string> - <string name="message_format_action">— %1$s%2$s %3$s</string> - <string name="message_format_notice">[%1$s%2$s] %3$s</string> - <string name="message_format_nick">%1$s%2$s é agora conhecido/a como %3$s%4$s</string> - <string name="message_format_nick_self">És agora conhecido/a como %1$s%2$s</string> - <string name="message_format_mode">Modo %1$s por %2$s%3$s</string> - <string name="message_format_join">%1$s%2$s entrou no %3$s</string> - <string name="message_format_part_1">%1$s%2$s saiu</string> - <string name="message_format_part_2">%1$s%2$s saiu (%3$s)</string> - <string name="message_format_quit_1">%1$s%2$s desligou</string> - <string name="message_format_quit_2">%1$s%2$s desligou (%3$s)</string> - <string name="message_format_kick_1">%1$s foi kickado por %2$s%3$s</string> - <string name="message_format_kick_2">%1$s foi kickado por %2$s%3$s (%4$s)</string> - <string name="message_format_kill_1">%1$s foi killado por %2$s%3$s</string> - <string name="message_format_kill_2">%1$s foi killado por %2$s%3$s (%4$s)</string> -</resources> diff --git a/app/src/main/res/values-pt/strings_preferences.xml b/app/src/main/res/values-pt/strings_preferences.xml deleted file mode 100644 index c6d2e2cd9b047d865f1190ba47b0251b24027e92..0000000000000000000000000000000000000000 --- a/app/src/main/res/values-pt/strings_preferences.xml +++ /dev/null @@ -1,166 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<resources> - <string name="preference_appearance_title">Aparência</string> - - <string name="preference_theme_title">Tema</string> - <string name="preference_theme_entry_material_daynight">Material (Auto)</string> - <string name="preference_theme_entry_material_light">Material (Claro)</string> - <string name="preference_theme_entry_material_dark">Material (Escuro)</string> - <string name="preference_theme_entry_quassel_daynight">Quassel (Auto)</string> - <string name="preference_theme_entry_quassel_light">Quassel (Claro)</string> - <string name="preference_theme_entry_quassel_dark">Quassel (Escuro)</string> - <string name="preference_theme_entry_amoled">AMOLED</string> - <string name="preference_theme_entry_solarized_daynight">Solarized (Auto)</string> - <string name="preference_theme_entry_solarized_light">Solarized (Claro)</string> - <string name="preference_theme_entry_solarized_dark">Solarized (Escuro)</string> - <string name="preference_theme_entry_gruvbox_daynight">Gruvbox (Auto)</string> - <string name="preference_theme_entry_gruvbox_light">Gruvbox (Claro)</string> - <string name="preference_theme_entry_gruvbox_dark">Gruvbox (Escuro)</string> - <string name="preference_theme_entry_dracula">Dracula</string> - <string name="preference_input_enter_title">Tecla enter no teclado</string> - <string name="preference_input_enter_entry_emoji">Emoji</string> - <string name="preference_input_enter_entry_send">Enviar</string> - <string name="preference_show_lag_title">Mostrar atraso</string> - <string name="preference_show_lag_summary">Exibe o atraso entre o cliente e o núcleo na barra de ação</string> - - <string name="preference_keep_screen_on_title">Manter Ecrã Activo</string> - <string name="preference_keep_screen_on_summary">Impede que o dispositivo entre em suspensão enquanto o aplicativo está em primeiro plano</string> - - <string name="preference_language_title">Idioma</string> - <string name="preference_language_entry_auto">Padrão do Sistema</string> - <string name="preference_notifications_title">Notificações</string> - - <string name="preference_notification_query_title">Mensagens Privadas</string> - - <string name="preference_notification_channel_title">Mensagens de Canal</string> - - <string name="preference_notification_other_title">Outras Mensagens</string> - - <string name="preference_notification_sound_title">Som de Notificaçao</string> - - <string name="preference_notification_vibration_title">Vibraçao</string> - - <string name="preference_notification_light_title">LED</string> - - <string name="preference_notification_mark_read_on_swipe_title">Marcar canal como lido ao desmarcar notificações</string> - <string name="preference_notification_mark_read_on_swipe_summary">Marca todas as mensagens como lidas quando uma notificação do canal é desmarcada</string> - - <string name="preference_notification_network_name_in_notification_title_title">Mostra o nome da rede nas notificações</string> - - <string name="preference_notification_show_all_activities_in_toolbar_title">Mostra toda a actividade na barra de tarefas</string> - <string name="preference_notification_show_all_activities_in_toolbar_summary">Mostra uma bolha colorida na barra de ferramentas para todas as actividades de chat</string> - - <string name="preference_notification_configure_title">Configurar Notificações</string> - - <string name="preference_notifications_level_all">Todas as Mensagens</string> - <string name="preference_notifications_level_highlight">Menções</string> - <string name="preference_notifications_level_none">Nunca</string> - <string name="preference_messages_title">Mensagens</string> - - <string name="preference_monospace_title">Usar Fonte Monospace</string> - - <string name="preference_textsize_title">Tamanho do Texto</string> - - <string name="preference_show_seconds_title">Mostrar Segundos</string> - - <string name="preference_use_24h_clock_title">Usar Relógio de 24h</string> - - <string name="preference_colorize_mirc_title">Usar Cores do mIRC</string> - <string name="preference_colorize_mirc_summaryon">Mostrar cores do mIRC nas mensagens</string> - <string name="preference_colorize_mirc_summaryoff">Remover as cores do mIRC das mensagens</string> - - <string name="preference_colorize_nicknames_title">Colorir nicknames</string> - <string name="preference_colorize_nicknames_entry_all">Todos os nicks</string> - <string name="preference_colorize_nicknames_entry_all_but_mine">Todos menos o próprio nick</string> - <string name="preference_colorize_nicknames_entry_none">Nenhum nick</string> - <string name="preference_show_prefix_title">Mostrar modos de utilizador</string> - <string name="preference_show_prefix_entry_all">Todos os modos</string> - <string name="preference_show_prefix_entry_highest">Modo mais alto</string> - <string name="preference_show_prefix_entry_none">Nenhum modo</string> - <string name="preference_hostmask_actions_title">Mostrar Máscara de anfitrião em ações</string> - <string name="preference_hostmask_actions_summary">Mostra nick!ident@hostname em mensagens de entrada/saída/desconexão</string> - - <string name="preference_nicks_on_new_line_title">Separar Nicknames</string> - <string name="preference_nicks_on_new_line_summary">Mostrar nicknames numa linha separada</string> - - <string name="preference_show_realnames_title">Mostrar Nomes Reais</string> - - <string name="preference_show_avatars_title">Mostrar Avatares</string> - - <string name="preference_square_avatars_title">Avatares Quadrados</string> - - <string name="preference_show_irccloud_avatars_title">Mostrar Avatares IRCCloud</string> - <string name="preference_show_irccloud_avatars_summary">Mostra a utilizadores sem avatar, o avatar IRCCloud correspondente, se disponível</string> - - <string name="preference_show_gravatar_avatars_title">Mostrar Avatares Gravatar</string> - <string name="preference_show_gravatar_avatars_summary">Mostra a utilizadores sem avatar, o avatar Gravatar correspondente, se disponível</string> - - <string name="preference_show_matrix_avatars_title">Mostrar Avatares Matrix</string> - <string name="preference_show_matrix_avatars_summary">Mostra a utilizadores sem avatar, o avatar Matrix correspondente, se disponível</string> - - <string name="preference_time_at_end_title">Hora Alinhada à Direita</string> - <string name="preference_time_at_end_summary">Alinha a hora no final de cada mensagem</string> - - <string name="preference_larger_emoji_title">Reações Maiores</string> - <string name="preference_larger_emoji_summary">Aumenta o tamanho das mensagens contendo apenas emojis</string> - - <string name="preference_highlight_own_messages_title">Marcar próprias mensagens</string> - <string name="preference_highlight_own_messages_summary">Mostra as suas mensagens de forma mais proeminente</string> - - <string name="preference_autocomplete_title">Autocompletar</string> - - <string name="preference_autocomplete_sender_doubleclick_title">Preenchimento Automático do Remetente</string> - <string name="preference_autocomplete_sender_doubleclick_summary">Clique duas vezes numa mensagem para preencher automaticamente o remetente</string> - - <string name="preference_autocomplete_button_title">Botão Auto-completação</string> - <string name="preference_autocomplete_button_summary">Mostra um botão à esquerda da caixa de digitação que aciona auto-completação</string> - - <string name="preference_autocomplete_doubletap_title">Tocar para autocompletar</string> - <string name="preference_autocomplete_doubletap_summary">Sugere nicks e canais após clicar duas vezes na caixa de digitação</string> - - <string name="preference_autocomplete_auto_title">Mostrar automaticamente</string> - <string name="preference_autocomplete_auto_summary">Sugere nicks e canais depois de inserir os 3 primeiros caracteres</string> - - <string name="preference_autocomplete_prefix_title">Mostrar após prefixo</string> - <string name="preference_autocomplete_prefix_summary">Sugere nicks e canais depois de inserir @ ou #</string> - - <string name="preference_autocomplete_nicks_title">Preenchimento Automático de Nicknames</string> - - <string name="preference_autocomplete_buffers_title">Preenchimento Automático de Chats</string> - - <string name="preference_autocomplete_aliases_title">Preenchimento Automático de Comandos</string> - - <string name="preference_backlog_title">Histórico</string> - - <string name="preference_page_size_title">Tamanho da página</string> - <string name="preference_page_size_summary">O número de mensagens carregadas e mantidas na memória de cada vez</string> - - <string name="preference_initial_amount_title">Quantidade inicial</string> - <string name="preference_initial_amount_summary">Número de mensagens para carregar ao abrir uma janela pela primeira vez</string> - - <string name="preference_clear_cache_title">Limpar Cache do Historico</string> - - <string name="preference_connection_title">Ligação</string> - - <string name="preference_show_notification_title">Mostrar notificação</string> - <string name="preference_show_notification_summary">Mantém o Quasseldroid sempre conectado, mostrando uma notificação persistente</string> - -</resources> diff --git a/app/src/main/res/values-pt/strings_settings.xml b/app/src/main/res/values-pt/strings_settings.xml deleted file mode 100644 index 8c0d36ca4079aec12ff8a3c39b5da9d087d2856c..0000000000000000000000000000000000000000 --- a/app/src/main/res/values-pt/strings_settings.xml +++ /dev/null @@ -1,158 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<resources> - <string name="settings_networks_title">Redes</string> - <string name="settings_network_title">Rede</string> - <string name="settings_network_network_name">Nome da Rede</string> - <string name="settings_network_identity">Identidade</string> - <string name="settings_network_sasl_enabled">SASL</string> - <string name="settings_network_sasl_account">Conta</string> - <string name="settings_network_sasl_password">Senha</string> - <string name="settings_network_sasl_supported">Esta rede suporta SASL</string> - <string name="settings_network_sasl_upgrade">Utilizar SASL</string> - <string name="settings_network_autoidentify_enabled">Identificação Automática</string> - <string name="settings_network_autoidentify_service">Serviço</string> - <string name="settings_network_autoidentify_password">Senha</string> - <string name="settings_network_connection">Ligação</string> - <string name="settings_network_perform">Comandos executados na ligação</string> - <string name="settings_network_rejoin_channels">Reentrar nos Canais</string> - <string name="settings_network_autoreconnect_enabled">Reconexão automática</string> - <string name="settings_network_autoreconnect_interval">Intervalo</string> - <string name="settings_network_autoreconnect_interval_unit">segundos</string> - <string name="settings_network_autoreconnect_attempts">Máximo de Tentativas</string> - <string name="settings_network_autoreconnect_unlimited">Tentativas Ilimitadas</string> - <string name="settings_network_customratelimits_enabled">Limites Personalizados</string> - <string name="settings_network_customratelimits_burstsize">Tamanho do Burst</string> - <string name="settings_network_customratelimits_unlimited">Ilimitado</string> - <string name="settings_network_customratelimits_delay">Atraso</string> - <string name="settings_network_customratelimits_interval_unit">segundos</string> - - <string name="settings_networkserver_title">Servidor da Rede</string> - <string name="settings_networkserver_connection">Ligação</string> - <string name="settings_networkserver_host">Anfitrião</string> - <string name="settings_networkserver_port">Porta</string> - <string name="settings_networkserver_ssl_enabled">Utilizar SSL/TLS</string> - <string name="settings_networkserver_ssl_verify">Verificar SSL/TLS</string> - <string name="settings_networkserver_password">Senha</string> - <string name="settings_networkserver_proxy_enabled">Utilizar Proxy</string> - <string name="settings_networkserver_proxy_type">Tipo</string> - <string name="settings_networkserver_proxy_type_http">HTPP</string> - <string name="settings_networkserver_proxy_type_socks5">SOCKS 5</string> - <string name="settings_networkserver_proxy_host">Anfitrião</string> - <string name="settings_networkserver_proxy_port">Porta</string> - <string name="settings_networkserver_proxy_user">Nome de Utilizador</string> - <string name="settings_networkserver_proxy_pass">Senha</string> - - <string name="settings_identities_title">Identidades</string> - <string name="settings_identity_title">Identidade</string> - <string name="settings_identity_names">Nomes</string> - <string name="settings_identity_identity_name">Nome da identidade</string> - <string name="settings_identity_real_name">Nome Real</string> - <string name="settings_identity_ident">Identidade</string> - <string name="settings_identity_nick">Nickname</string> - <string name="settings_identity_nicks">Nicknames</string> - <string name="settings_identity_messages">Mensagens</string> - <string name="settings_identity_kick_reason">Razão de Kick</string> - <string name="settings_identity_part_reason">Razão de Saída</string> - <string name="settings_identity_quit_reason">Razão de Desconexão</string> - <string name="settings_identity_away">Mensagens de Ausência</string> - <string name="settings_identity_away_reason">Razão de Ausência</string> - <string name="settings_identity_detach_away">Ausente ao desligar</string> - <string name="settings_identity_detach_away_reason">Razão de Ausência ao Desligar</string> - - <string name="settings_chatlists_title">Listas de Chats</string> - <string name="settings_chatlist_title">Lista de Chats</string> - <string name="settings_chatlist_ui">Interface de Utilizador</string> - <string name="settings_chatlist_buffer_view_name">Nome</string> - <string name="settings_chatlist_show_search">Mostrar Pesquisar</string> - <string name="settings_chatlist_sort_alphabetically">Ordenar Alfabeticamente</string> - <string name="settings_chatlist_add_new_buffers_automatically">Adicionar novos chats automaticamente</string> - <string name="settings_chatlist_network">Rede</string> - <string name="settings_chatlist_network_all">Todas as redes</string> - <string name="settings_chatlist_network_create">Criar rede…</string> - <string name="settings_chatlist_show_status_buffer">Mostrar Janela de Servidor</string> - <string name="settings_chatlist_types">Tipos de Chats</string> - <string name="settings_chatlist_show_channels">Mostrar Canais</string> - <string name="settings_chatlist_show_queries">Mostrar Mensagens Privadas</string> - <string name="settings_chatlist_activity">Actividade</string> - <string name="settings_chatlist_minimum_activity_no_activity">Sem Actividade</string> - <string name="settings_chatlist_minimum_activity_other_activity">Outra Actividade</string> - <string name="settings_chatlist_minimum_activity_new_message">Nova Mensagem</string> - <string name="settings_chatlist_minimum_activity_highlight">Menção</string> - <string name="settings_chatlist_hide_inactive_buffers">Ocultar Chats Inactivos</string> - <string name="settings_chatlist_hide_inactive_networks">Ocultar Redes Inactivas</string> - - <string name="settings_ignorelist_title">Lista de Ignorados</string> - - <string name="settings_ignoreitem_title">Regra para Ignorar</string> - <string name="settings_ignoreitem_enabled">Activado</string> - <string name="settings_ignoreitem_ignorerule">Regra para Ignorar</string> - <string name="settings_ignoreitem_isregex">Expressão Regular</string> - <string name="settings_ignoreitem_type">Tipo</string> - <string name="settings_ignoreitem_type_sender">Remetente</string> - <string name="settings_ignoreitem_type_message">Mensagem</string> - <string name="settings_ignoreitem_type_ctcp">Ctcp</string> - <string name="settings_ignoreitem_strictness">Rigor</string> - <string name="settings_ignoreitem_strictness_soft">Dinâmico</string> - <string name="settings_ignoreitem_strictness_hard">Permanente</string> - <string name="settings_ignoreitem_scope">Tipo</string> - <string name="settings_ignoreitem_scope_global">Ignorar Global</string> - <string name="settings_ignoreitem_scope_network">Ignorar na Rede</string> - <string name="settings_ignoreitem_scope_channel">Ignorar em Canal</string> - <string name="settings_ignoreitem_scoperule">Tipo de Ignore</string> - - <string name="settings_highlightlist_title">Menções</string> - <string name="settings_highlightlist_highlight_nick">Menções de Nick</string> - <string name="settings_highlightlist_highlight_nick_all_nicks">Todos os Nicks da Identidade</string> - <string name="settings_highlightlist_highlight_nick_current_nick">Nick Actual</string> - <string name="settings_highlightlist_highlight_nick_none">Nenhum</string> - <string name="settings_highlightlist_nicks_case_sensitive">Sensível a Maiúsculas e Minúsculas</string> - <string name="settings_highlightlist_rules">Regras de Menções</string> - <string name="settings_highlightlist_ignore_rules">Regras para Ignorar Menções</string> - - <string name="settings_highlightrule_title">Regra de Menção</string> - <string name="settings_highlightrule_enabled">Activado</string> - <string name="settings_highlightrule_name">Nome</string> - <string name="settings_highlightrule_regular_expression">Expressão Regular</string> - <string name="settings_highlightrule_case_sensitive">Sensível a Maiúsculas e Minúsculas</string> - <string name="settings_highlightrule_sender">Remetente</string> - <string name="settings_highlightrule_channel">Canal</string> - - <string name="settings_aliaslist_title">Aliases</string> - - <string name="settings_aliasitem_title">Alias</string> - <string name="settings_aliasitem_name">Nome</string> - <string name="settings_aliasitem_expansion">Expansão</string> - - <string name="settings_networkconfig_title">Configuração IRC</string> - <string name="settings_networkconfig_ping_timeout">Detecção Ping Timeout</string> - <string name="settings_networkconfig_ping_interval">Intervalo de Ping</string> - <string name="settings_networkconfig_ping_interval_unit">segundos</string> - <string name="settings_networkconfig_max_ping_count">Desligar após</string> - <string name="settings_networkconfig_max_ping_count_unit">pings perdidos</string> - <string name="settings_networkconfig_auto_who">Pesquisa Automática Informações Utilizador</string> - <string name="settings_networkconfig_auto_who_interval">Intervalo de atualização</string> - <string name="settings_networkconfig_auto_who_interval_unit">segundos</string> - <string name="settings_networkconfig_auto_who_nick_limit">Ignorar canais com mais de</string> - <string name="settings_networkconfig_auto_who_nick_limit_unit">utilizadores</string> - <string name="settings_networkconfig_auto_who_delay">Tempo mínimo entre pedidos</string> - <string name="settings_networkconfig_auto_who_delay_unit">segundos</string> - <string name="settings_networkconfig_standard_ctcp">Comportamento CTCP Compatível Padrão</string> -</resources> diff --git a/app/src/main/res/values-pt/strings_setup.xml b/app/src/main/res/values-pt/strings_setup.xml deleted file mode 100644 index 1e27dc1963e419997467880f100389ba261ccacd..0000000000000000000000000000000000000000 --- a/app/src/main/res/values-pt/strings_setup.xml +++ /dev/null @@ -1,101 +0,0 @@ -<!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<resources> - <!-- Account Selection --> - <string name="slide_account_select_title">Selecione Conta</string> - <string name="slide_account_select_description">Por favor, selecione uma conta da lista ou adicione uma</string> - <string name="label_user_on_host">%1$s em %2$s:%3$d</string> - - <!-- Account Setup --> - - <!-- Account Connection --> - <string name="slide_account_connection_title">Ligação</string> - <string name="slide_account_connection_description">Primeiro, escolha o servidor no qual o seu núcleo está alojado.</string> - - <string name="label_connection_host">Anfitrião</string> - <string name="label_connection_port">Porta</string> - <string name="label_connection_ssl">Requer SSL</string> - - <string name="hint_invalid_host">Não é um anfitrião válido</string> - <string name="hint_invalid_port">Não é uma porta válida</string> - - <!-- Account User --> - <string name="slide_account_user_title">Sua Conta</string> - <string name="slide_account_user_description">Agora, digite o nome de utilizador e a senha da sua conta no núcleo. Se acabou de criar esse núcleo, configuraremos essa conta para si</string> - - <string name="label_account_user">Nome de Utilizador</string> - <string name="label_account_pass">Senha</string> - - <string name="hint_invalid_user">O nome de utilizador não pode estar vazio</string> - - <!-- Account Name --> - <string name="slide_account_name_title">Personalizar Conta</string> - <string name="slide_account_name_description">Dê um nome a esta conta</string> - - <string name="label_account_name">Nome da Conta</string> - - <string name="hint_invalid_name">O nome não pode estar vazio</string> - - <!-- Core Setup --> - - <string name="setup_core_title">Configurar Núcleo</string> - - <!-- Core Authenticator Select --> - <string name="slide_core_authenticator_select_title">Selecione o tipo de autenticação</string> - <string name="slide_core_authenticator_select_description">Selecione um tipo de autenticação para o núcleo Quassel utilizar para autenticar usuários.</string> - - <!-- Core Backend Select --> - <string name="slide_core_backend_select_title">Selecione o Tipo de Armazenamento</string> - <string name="slide_core_backend_select_description">Selecione um um tipo de base de dados para o núcleo do Quassel armazenar o histórico e outros dados.</string> - - <string name="label_backend">Backend</string> - - <!-- Core Backend Config --> - <string name="slide_core_backend_setup_title">Configurar Tipo de Armazenamento</string> - <string name="slide_core_backend_setup_description">Por favor, configure o tipo de base de dados selecionado.</string> - - <string name="setup_core_backend_no_options">Este backend não tem opções de configuração, você terminou aqui!</string> - - <!-- User Setup --> - - <string name="setup_user_title">Configurar Utilizador</string> - - <!-- User Identity --> - <string name="slide_user_identity_title">Configurar Identidade</string> - <string name="slide_user_identity_description">Por favor escolha um nickname</string> - - <string name="hint_invalid_nick">Não é um nick válido</string> - - <!-- User Network --> - <string name="slide_user_network_title">Configurar Rede</string> - <string name="slide_user_network_description">Selecione uma rede para se ligar.</string> - - <string name="label_network_custom">Rede Personalizada…</string> - - <!-- User Channels --> - <string name="slide_user_channels_title">Configurar Canais</string> - <string name="slide_user_channels_description">Escolha os canais para entrar.</string> - - <string name="label_channels">Canais</string> - - <!-- Network Setup --> - - <string name="setup_network_title">Configurar Rede</string> -</resources> diff --git a/app/src/main/res/values-pt/strings_status.xml b/app/src/main/res/values-pt/strings_status.xml deleted file mode 100644 index f87db802f3b3b3eb92675c8713490e85cf50abed..0000000000000000000000000000000000000000 --- a/app/src/main/res/values-pt/strings_status.xml +++ /dev/null @@ -1,27 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<resources> - <string name="label_status_disconnected">Desligado</string> - <string name="label_status_connecting">Ligando</string> - <string name="label_status_handshake">Handshake</string> - <string name="label_status_init">Inicializando</string> - <string name="label_status_connected">Ligado</string> - <string name="label_status_closed">Ligação Perdida</string> -</resources> diff --git a/app/src/main/res/values-sr/strings.xml b/app/src/main/res/values-sr/strings.xml deleted file mode 100644 index a1a888dbbdfa75edec6e913053fdd38459e370f9..0000000000000000000000000000000000000000 --- a/app/src/main/res/values-sr/strings.xml +++ /dev/null @@ -1,148 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<resources xmlns:tools="http://schemas.android.com/tools"> - <string name="app_name">Quasseldroid</string> - <string name="app_description">Android baziran klijent za decentralizovani Quassel IRC klijent.</string> - <string name="app_description_long">Quassel je distribuirani, decentralizovani IRC klijent, napisan koristeći C++ i Qt. Quasseldroid je klijent za Quassel jezgro napisan u Kotlinu, koji vam omogućava povezivanje na Quassel jezgro koristeći svoj Android™ telefon.</string> - - <string name="connection_service_title">Usluga Povezivanja</string> - <string name="connection_service_description">Održava vezu sa vašim jezgrom što omogućava dobijanje obaveštenja i slanje poruka.</string> - - <string name="label_about">O aplikaciji</string> - <string name="label_accept">Prihvati</string> - <string name="label_autocomplete">Automatsko dovršavanje</string> - <string name="label_avatar">Avatar</string> - <string name="label_back">Nazad</string> - <string name="label_cancel">Otkaži</string> - <string name="label_certificates">Sertifikati</string> - <string name="label_close">Zatvori</string> - <string name="label_colors_custom">Prilagođeno</string> - <string name="label_colors_mirc">mIRC</string> - <string name="label_configure">Podesi</string> - <string name="label_connect">Poveži se</string> - <string name="label_copy">Kopiraj</string> - <string name="label_crashes">Padovi aplikacije</string> - <string name="label_delete">Obriši</string> - <string name="label_delete_all">Obriši sve</string> - <string name="label_disconnect">Prekini vezu</string> - <string name="label_edit_topic">Izmeni temu</string> - <string name="label_edit_topic_long">Otvori dijalog za mijenjanje teme kanala</string> - <string name="label_filter_messages">Filtriraj poruke</string> - <string name="label_ignore">Ignoriši</string> - <string name="label_ignore_long">Dodaj/ukloni korisnika iz liste ignorisanih</string> - <string name="label_info">Detalji</string> - <string name="label_info_channel">Podaci o kanalu</string> - <string name="label_info_core">Podaci o jezgru</string> - <string name="label_info_user">Podaci o korisniku</string> - <string name="label_input_history">Istorija Unošenja</string> - <string name="label_join">Pridruži se</string> - <string name="label_join_long">Pridruži se kanalu</string> - <string name="label_libraries">Biblioteke</string> - <string name="label_license">Licenca</string> - <string name="label_mark_read">Označi pročitanim</string> - <string name="label_match_all">Podudaranje sa svim porukama</string> - <string name="label_mention">Spomeni</string> - <string name="label_mention_long">Kopiraj korisničko ime u polje za unos</string> - <string name="label_new_account">Novi nalog</string> - <string name="label_new_chatlist">Nova lista razgovora</string> - <string name="label_new_highlight_ignore_rule">Novo Pravilo Ignorisanja Isticanja</string> - <string name="label_new_highlight_rule">Novo Pravilo Isticanja</string> - <string name="label_new_identity">Novi identitet</string> - <string name="label_new_network">Nova mreža</string> - <string name="label_new_nick">Novi nadimak</string> - <string name="label_new_server">Novi server</string> - <string name="label_nick">Nadimak</string> - <string name="label_nicklist">Lista nadimaka</string> - <string name="label_no">Ne</string> - <string name="label_no_away_message">Poruka iz odsustva nije dostupna</string> - <string name="label_no_sound">Nijedno</string> - <string name="label_open">Otvori</string> - <string name="label_part">Napusti</string> - <string name="label_part_long">Napusti kanal</string> - <string name="label_placeholder_message">Napiši poruku…</string> - <string name="label_placeholder_topic">Opiši temu kanala…</string> - <string name="label_privacy_policy">Politika privatnosti</string> - <string name="label_query">Upit</string> - <string name="label_query_long">Otvori privatni razgovor sa korisnikom</string> - <string name="label_rename">Preimenuj</string> - <string name="label_reply">Odgovori</string> - <string name="label_reset">Resetuj</string> - <string name="label_save">Sačuvaj</string> - <string name="label_select">Odaberi</string> - <string name="label_send">Pošalji</string> - <string name="label_set_default">Podesi podrazumevane parametre</string> - <string name="label_settings">Podešavanje</string> - <string name="label_settings_client">Podešavanje klijenta</string> - <string name="label_settings_core">Podešavanje jezgra</string> - <string name="label_share">Podijeli</string> - <string name="label_share_crashreport">Podeli izveštaj o padu aplikacije</string> - <string name="label_source">Izvor</string> - <string name="label_topic">Tema kanala</string> - <string name="label_translators">Prevodioci</string> - <string name="label_unhide">Učini vidljivim</string> - <string name="label_unknown_sender"><Nepoznato></string> - <string name="label_update_user_password">Ažuriraj korisnika/lozinku</string> - <string name="label_use_default">Koristi podrazumevane parametre</string> - <string name="label_website">Veb stranica</string> - <string name="label_whitelist">Ignoriši</string> - <string name="label_whitelist_certificates">Sertifikati</string> - <string name="label_whitelist_certificates_empty">Nema sertifikata u listi dozvoljenih</string> - <string name="label_whitelist_hostnames">Hostovi</string> - <string name="label_whitelist_hostnames_empty">Nema hostova u listi dozvoljenih</string> - <string name="label_whitelist_ignore_date">Datum isteka je ignorisan za ovaj sertifikat</string> - <string name="label_who">Who</string> - <string name="label_who_long">Ažuriraj korisničke informacije svakog korisnika</string> - <string name="label_whois">Whois</string> - <string name="label_whois_long">Ažuriraj korisničke informacije</string> - <string name="label_yes">Da</string> - - <string name="label_feature_synchronizedmarkerline">Potrebno za sinhronizovanje poslednje pozicije u kanalima</string> - <string name="label_feature_saslauthentication">Potrebno za SASL</string> - <string name="label_feature_saslexternal">Potrebno za SASL sa sertifikatima</string> - <string name="label_feature_hideinactivenetworks">Potrebno za sakrivanje neaktivnih mreža u listama razgovora</string> - <string name="label_feature_passwordchange">Potrebno za menjanje lozinke iz klijenta</string> - <string name="label_feature_capnegotiation">Potrebno za IRCv3 funkcije</string> - <string name="label_feature_verifyserverssl">Potrebno za verifikaciju SSL sertifikata IRC mreža na koje ste povezani</string> - <string name="label_feature_customratelimits">Potrebno za prilagođena ograničenja brzina IRC mreža</string> - <string name="label_feature_awayformattimestamp">Potrebno za prilagođavanje formatiranja vremenskih oznaka u porukama iz odsustva.</string> - <string name="label_feature_bufferactivitysync">Potrebno za uvid u aktivnost razgovora u listi razgovora</string> - <string name="label_feature_coresidehighlights">Potrebno za isticanje</string> - <string name="label_feature_senderprefixes">Potrebno za vidljivost prefiksa modova (+, @) korisnika u porukama</string> - <string name="label_feature_remotedisconnect">Potrebno za daljinsko prekidanje veze sopstvenih klijenata</string> - <string name="label_feature_richmessages">Potrebno za vidljivost pravih imena ili IRCv3 ili Gravatar avatara u porukama</string> - <string name="label_feature_backlogfiltertype">Potrebno za primanje prošlih obaveštenja posle povezivanja</string> - - <string name="label_feature_context_missing">Vašem jezgru nedostaju funkcije potrebne za pravilno funkcionisanje Quasseldroid-a.</string> - <string name="label_feature_context_missing_button">Detalji</string> - - <string name="notification_channel_connection_title">Veza</string> - <string name="notification_channel_highlight_title">Isticanja</string> - <string name="notification_channel_old_highlight_title">Stara Isticanja</string> - - <string name="label_missing_features">Funkcije koje nedostaju</string> - <string name="info_missing_features" tools:ignore="StringFormatCount">Vašem jezgru nedostaju funkcije potrebne za ispravan rad Quasseldroida. Trebalo bi da <a href=\"https://quassel-irc.org>ažurirate</a> svoje Quassel jezgro na %1$s ili noviju verziju.</string> - - <string name="delete_confirmation">Da li ste sigurni da želite ovo trajno obrisati? Ovaj postupak se kasnije ne može poništiti.</string> - <string name="cancel_confirmation">Imate nesačuvane promene. Da li ih želite odbaciti?</string> - - <string name="info_copied_version">Verzija kopirana u klipbord</string> - - <string name="advertisement_support_patreon">Molimo Vas da podržite razvoj ove aplikacije na Patreonu</string> -</resources> diff --git a/app/src/main/res/values-sr/strings_certificates.xml b/app/src/main/res/values-sr/strings_certificates.xml deleted file mode 100644 index 8dd7d377467c042e001568c8d47116c1e10e8c3f..0000000000000000000000000000000000000000 --- a/app/src/main/res/values-sr/strings_certificates.xml +++ /dev/null @@ -1,20 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<resources></resources> diff --git a/app/src/main/res/values-sr/strings_contributors.xml b/app/src/main/res/values-sr/strings_contributors.xml deleted file mode 100644 index bc251eeff48c7922eb5f1c44ef352649cb780d4f..0000000000000000000000000000000000000000 --- a/app/src/main/res/values-sr/strings_contributors.xml +++ /dev/null @@ -1,26 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<resources> - <string name="contributor_description_freqmod">Inicijalni pokušaji deserijalizacije qdatastream-a</string> - <string name="contributor_description_sandsmark">Stari tip implementacije protokola, (de)serijalizacija, (de)moralizator projekta</string> - <string name="contributor_description_magnuf">Stari tip korisničkog interfejsa</string> - <string name="contributor_description_kenji">Stari tip korisničkog interfejsa</string> - <string name="contributor_description_justjanne">Prepiši, Korisnički interfejs, Obrađivači obavještenja, Pozadinski mehanizam</string> -</resources> diff --git a/app/src/main/res/values-sr/strings_defaults.xml b/app/src/main/res/values-sr/strings_defaults.xml deleted file mode 100644 index e6199fe6efa463453c87166ebcf322eab07c4da5..0000000000000000000000000000000000000000 --- a/app/src/main/res/values-sr/strings_defaults.xml +++ /dev/null @@ -1,31 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<resources> - <string name="default_bufferviewconfig_name">Svi razgovori</string> - - <string name="default_identity_identity_name">Podrazumevani identitet</string> - <string name="default_identity_realname">Quassel IRC korisnik</string> - <string name="default_identity_awayreason">Otišli pecati.</string> - <string name="default_identity_autoawayreason">Ne ovde. Ne, stvarno. ne ovde!</string> - <string name="default_identity_detachawayreason">Svi Quassel klijenti su nestali sa lica zemlje…</string> - <string name="default_identity_kickreason">Vrtić je negdje drugo!</string> - <string name="default_identity_partreason">https://quassel-irc.org - Ćaskaj lagodno. Bilo gdje.</string> - <string name="default_identity_quitreason">https://quassel-irc.org - Ćaskaj lagodno. Bilo gdje.</string> -</resources> diff --git a/app/src/main/res/values-sr/strings_error.xml b/app/src/main/res/values-sr/strings_error.xml deleted file mode 100644 index d47c21ff23143c43260ccdde77cc492ed0780cb2..0000000000000000000000000000000000000000 --- a/app/src/main/res/values-sr/strings_error.xml +++ /dev/null @@ -1,47 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<resources> - <string name="label_error_login">Greška pri prijavi</string> - <string name="label_error_setup">Greška pri postavci</string> - <string name="label_error_init">Greška pri povezivanju</string> - <string name="label_error_certificate">Greška u sertifikatu</string> - <string name="label_error_certificate_no_certificate">Sertifikat nije dostupan</string> - <string name="label_error_certificate_no_hostname">Hostname nije dostupno</string> - <string name="label_error_certificate_invalid"><![CDATA[ - <p>Sertifikat sa otiskom<br/> - <code>%1$s</code><br/> - je važeći od %2$s do %3$s</p> - ]]></string> - <string name="label_error_certificate_untrusted"><![CDATA[ - <p>Sertifikat sa otiskom<br/> - <code>%1$s</code><br/> - nije pouzdan.</p> - ]]></string> - <string name="label_error_certificate_no_match"><![CDATA[ - <p>Sertifikat sa otiskom<br/> - <code>%1$s</code><br/> - nije važeći za %2$s.</p> - ]]></string> - - <string name="label_error_unknown_host">Host nije pronađen: %1$s</string> - <string name="label_error_invalid_protocol_version">Neispravan protokol: %1$d</string> - <string name="label_error_connection">Došlo je do greške u vezi: %1$s (%2$s)</string> - <string name="label_error_connection_closed">Greška: Došlo je do neočekivanog prekida veze</string> -</resources> diff --git a/app/src/main/res/values-sr/strings_format.xml b/app/src/main/res/values-sr/strings_format.xml deleted file mode 100644 index 4d3624208d0cec96010b65b37102e285a7cd6efb..0000000000000000000000000000000000000000 --- a/app/src/main/res/values-sr/strings_format.xml +++ /dev/null @@ -1,29 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<resources> - <string name="label_bold">Podebljano</string> - <string name="label_italic">Italik</string> - <string name="label_strikethrough">Precrtano</string> - <string name="label_underline">Podvučeno</string> - <string name="label_monospace">Monospace</string> - <string name="label_foreground">Boja prednjeg plana</string> - <string name="label_background">Boja pozadine</string> - <string name="label_clear_formatting">Ukloni formatiranje</string> -</resources> diff --git a/app/src/main/res/values-sr/strings_info.xml b/app/src/main/res/values-sr/strings_info.xml deleted file mode 100644 index 55b58b61bf09f3bbb51363bba0f46a206c88409f..0000000000000000000000000000000000000000 --- a/app/src/main/res/values-sr/strings_info.xml +++ /dev/null @@ -1,42 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<resources> - <string name="label_user_away">Odsutni</string> - <string name="label_user_away_reason">Razlog</string> - <string name="label_user_identity">Identitet</string> - <string name="label_user_account">Nalog</string> - <string name="label_user_ident">Ident</string> - <string name="label_user_host">Host</string> - <string name="label_user_server">Server</string> - <string name="label_core_version">Verzija</string> - <string name="label_core_uptime">Uptime</string> - <string name="label_core_security">Bezbednost</string> - <string name="label_core_clients">Klijenti</string> - <string name="label_core_online_since">Na mreži od %1$s</string> - <string name="label_core_connected_since">Povezan od %1$s</string> - <string name="label_core_connection_verified_by">Veza verifikovana od strane %1$s</string> - <string name="label_core_connection_verified_by_unknown">Nepoznato</string> - <string name="label_core_connection_insecure">Nebezbedna mreža</string> - - <string name="property_group_ircchannel_channel">Kanal</string> - <string name="property_ircchannel_topic">Tema</string> - <string name="property_ircchannel_topic_action_edit">Izmeni temu</string> - <string name="property_ircchannel_topic_default">Tema nije postavljena</string> -</resources> diff --git a/app/src/main/res/values-sr/strings_messages.xml b/app/src/main/res/values-sr/strings_messages.xml deleted file mode 100644 index e72e3182e3b92c33d1a60766d9c798fa1131ba3d..0000000000000000000000000000000000000000 --- a/app/src/main/res/values-sr/strings_messages.xml +++ /dev/null @@ -1,54 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<resources> - <plurals name="message_netsplit_join"> - <item quantity="one">Netsplit između %1$s i %2$s se završio: %3$d se pridružio/la: %4$s</item> - <item quantity="few">Netsplit između %1$s i %2$s se završio: %3$d su se pridružili: %4$s</item> - <item quantity="other">Netsplit između %1$s i %2$s se završio: %3$d korisnika se pridružilo: %4$s</item> - </plurals> - <plurals name="message_netsplit_quit"> - <item quantity="one">Netsplit između %1$s i %2$s: %3$d je napustio/la: %4$s</item> - <item quantity="few">Netsplit između %1$s i %2$s: %3$d su napustili: %4$s</item> - <item quantity="other">Netsplit između %1$s i %2$s: %3$d korisnika je prekinulo vezu: %4$s</item> - </plurals> - <string name="message_type_join">Pridruži se</string> - <string name="message_type_part">Napusti</string> - <string name="message_type_quit">Izađi</string> - <string name="message_type_nick">Nadimak</string> - <string name="message_type_mode">Mod</string> - <string name="message_type_topic">Tema</string> - - <string name="message_format_copy">[%1$s] %2$s</string> - <string name="message_format_copy_complex">[%1$s] <%2$s> %3$s</string> - <string name="message_format_action">— %1$s%2$s %3$s</string> - <string name="message_format_notice">[%1$s%2$s] %3$s</string> - <string name="message_format_nick">%1$s%2$s je sada poznat/a kao %3$s%4$s</string> - <string name="message_format_nick_self">Vi ste sada poznati kao %1$s%2$s</string> - <string name="message_format_mode">Mod %1$s od %2$s%3$s</string> - <string name="message_format_join">%1$s%2$s se pridružio/la %3$s</string> - <string name="message_format_part_1">%1$s%2$s je napustio/la kanal</string> - <string name="message_format_part_2">%1$s%2$s je napustio/la kanal (%3$s)</string> - <string name="message_format_quit_1">%1$s%2$s je prekinuo/la vezu</string> - <string name="message_format_quit_2">%1$s%2$s je prekinuo/la vezu (%3$s)</string> - <string name="message_format_kick_1">%1$s je izbačen od %2$s%3$s</string> - <string name="message_format_kick_2">%1$s je izbačen od %2$s%3$s (%4$s)</string> - <string name="message_format_kill_1">%1$s je ubijen/na od %2$s%3$s</string> - <string name="message_format_kill_2">%1$s je ubijen/na od %2$s%3$s (%4$s)</string> -</resources> diff --git a/app/src/main/res/values-sr/strings_preferences.xml b/app/src/main/res/values-sr/strings_preferences.xml deleted file mode 100644 index f5da5691118b85a43139c346cb12c2e640e4d214..0000000000000000000000000000000000000000 --- a/app/src/main/res/values-sr/strings_preferences.xml +++ /dev/null @@ -1,159 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<resources> - <string name="preference_appearance_title">Izgled</string> - - <string name="preference_theme_title">Tema</string> - <string name="preference_theme_entry_material_daynight">Material (Auto)</string> - <string name="preference_theme_entry_material_light">Material (Svijetlo)</string> - <string name="preference_theme_entry_material_dark">Material (Tamno)</string> - <string name="preference_theme_entry_quassel_daynight">Quassel (Auto)</string> - <string name="preference_theme_entry_quassel_light">Quassel (Svijetlo)</string> - <string name="preference_theme_entry_quassel_dark">Quassel (Tamno)</string> - <string name="preference_theme_entry_amoled">AMOLED</string> - <string name="preference_theme_entry_solarized_daynight">Solarized (Auto)</string> - <string name="preference_theme_entry_solarized_light">Solarized (Svijetlo)</string> - <string name="preference_theme_entry_solarized_dark">Solarized (Tamno)</string> - <string name="preference_theme_entry_gruvbox_daynight">Gruvbox (Auto)</string> - <string name="preference_theme_entry_gruvbox_light">Gruvbox (Svijetlo)</string> - <string name="preference_theme_entry_gruvbox_dark">Gruvbox (Tamno)</string> - <string name="preference_theme_entry_dracula">Drakula</string> - <string name="preference_input_enter_title">Funkcija \"Enter\" dugmeta na tastaturi</string> - <string name="preference_input_enter_entry_emoji">Emoji</string> - <string name="preference_input_enter_entry_send">Pošalji</string> - <string name="preference_show_lag_title">Prikazuj kašnjenje</string> - <string name="preference_show_lag_summary">Prikazuje kašnjenje između klijenta i jezgra u komandnoj traci</string> - - <string name="preference_keep_screen_on_title">Održavaj uključen ekran</string> - <string name="preference_keep_screen_on_summary">Sprečava ulaženje uređaja u režim slabije potrošnje dok je aplikacija u prvom planu</string> - - <string name="preference_language_title">Jezik</string> - <string name="preference_language_entry_auto">Sistemski zadato</string> - <string name="preference_notifications_title">Obavještenja</string> - - <string name="preference_notification_query_title">Direktne poruke</string> - - <string name="preference_notification_channel_title">Poruke kanala</string> - - <string name="preference_notification_other_title">Druge poruke</string> - - <string name="preference_notification_sound_title">Zvuk obaveštenja</string> - - <string name="preference_notification_vibration_title">Vibracija</string> - - <string name="preference_notification_light_title">LED</string> - - <string name="preference_notification_mark_read_on_swipe_title">Označi kanal pročitanim pri uklanjanju notifikacija</string> - <string name="preference_notification_mark_read_on_swipe_summary">Označava sve poruke u kanalu pročitanim kada je notifikacija vezana za kanal uklonjena</string> - - <string name="preference_notification_configure_title">Podesi obavještenja</string> - - <string name="preference_notifications_level_all">Sve poruke</string> - <string name="preference_notifications_level_highlight">Spominjanja</string> - <string name="preference_notifications_level_none">Nikad</string> - <string name="preference_messages_title">Poruke</string> - - <string name="preference_monospace_title">Koristi monospace font</string> - - <string name="preference_textsize_title">Veličina teksta</string> - - <string name="preference_show_seconds_title">Prikazuj sekunde</string> - - <string name="preference_use_24h_clock_title">Koristi 24-časovni sat</string> - - <string name="preference_colorize_mirc_title">Koristi mIRC boje</string> - <string name="preference_colorize_mirc_summaryon">Prikazuj mIRC boje u porukama</string> - <string name="preference_colorize_mirc_summaryoff">Ukloni mIRC boje sa poruka</string> - - <string name="preference_colorize_nicknames_title">Oboji nadimke</string> - <string name="preference_colorize_nicknames_entry_all">Svi nadimci</string> - <string name="preference_colorize_nicknames_entry_all_but_mine">Svi sem sopstvenog nadimka</string> - <string name="preference_colorize_nicknames_entry_none">Nijedan nadimak</string> - <string name="preference_show_prefix_title">Prikazuj mod pošiljaoca</string> - <string name="preference_show_prefix_entry_all">Svi modovi</string> - <string name="preference_show_prefix_entry_highest">Najviši mod</string> - <string name="preference_show_prefix_entry_none">Nijedan mod</string> - <string name="preference_hostmask_actions_title">Prikazuj Hostmask u komandama</string> - <string name="preference_hostmask_actions_summary">Prikaži čitav nick!ident@host u join/part/quit porukama</string> - - <string name="preference_nicks_on_new_line_title">Razdvoji nadimke</string> - <string name="preference_nicks_on_new_line_summary">Prikazuje nadimke na odvojenoj liniji</string> - - <string name="preference_show_realnames_title">Prikazuj Realname</string> - - <string name="preference_show_avatars_title">Prikazuj avatare</string> - - <string name="preference_square_avatars_title">Kvadratni avatari</string> - - <string name="preference_show_irccloud_avatars_title">Prikazuj IRCCloud avatare</string> - <string name="preference_show_irccloud_avatars_summary">Prikazuje korisnicima bez avatara njihov IRCCloud avatar, ako je dostupan</string> - - <string name="preference_show_gravatar_avatars_title">Prikazuj Gravatar avatare</string> - <string name="preference_show_gravatar_avatars_summary">Prikazuje korisnicima bez avatara njihov Gravatar, ako je dostupan</string> - - <string name="preference_show_matrix_avatars_title">Prikazuj Matrix avatare</string> - <string name="preference_show_matrix_avatars_summary">Prikazuje korisnicima bez avatara njihov Matrix avatar, ako je dostupan</string> - - <string name="preference_time_at_end_title">Desno poravnata vremenska oznaka</string> - <string name="preference_time_at_end_summary">Poravnava vremenske oznake na kraju svake poruke</string> - - <string name="preference_larger_emoji_title">Veće reakcije</string> - <string name="preference_larger_emoji_summary">Povećaj veličinu poruka koje sadrže samo emoji</string> - - <string name="preference_highlight_own_messages_title">Istakni sopstvene poruke</string> - <string name="preference_highlight_own_messages_summary">Prikazuje vaše poruke upadljivije</string> - - <string name="preference_autocomplete_title">Automatsko dovršavanje</string> - - <string name="preference_autocomplete_sender_doubleclick_title">Automatsko dovršavanje pošiljaoca</string> - <string name="preference_autocomplete_sender_doubleclick_summary">Dupli dodir na poruku za automatsko dovršavanje njenog pošaljioca</string> - - <string name="preference_autocomplete_button_title">Dugme za automatsko dovršavanje</string> - <string name="preference_autocomplete_button_summary">Prikazuje dugme sa leve strane polja unos koje pokreće automatsko dovršavanje</string> - - <string name="preference_autocomplete_doubletap_title">Dupli dodir za automatsko dovršavanje</string> - <string name="preference_autocomplete_doubletap_summary">Predloži nadimke i kanale posle duplog dodira na polje za unos</string> - - <string name="preference_autocomplete_auto_title">Prikazuj automatski</string> - <string name="preference_autocomplete_auto_summary">Predloži nadimke i kanale posle unosa prva 3 znaka</string> - - <string name="preference_autocomplete_prefix_title">Prikaži posle prefiksa</string> - <string name="preference_autocomplete_prefix_summary">Predloži nadimke i kanale posle unosa @ ili #</string> - - <string name="preference_autocomplete_nicks_title">Automatski dovrši nadimke</string> - - <string name="preference_autocomplete_buffers_title">Automatski dovrši razgovore</string> - - <string name="preference_autocomplete_aliases_title">Automatski dovrši komande</string> - - <string name="preference_backlog_title">Zaostale poruke</string> - - <string name="preference_page_size_title">Veličina stranice</string> - <string name="preference_page_size_summary">Broj poruka učitanih i zadržanih u memoriji</string> - - <string name="preference_initial_amount_title">Početna količina</string> - <string name="preference_initial_amount_summary">Broj poruka koje će biti učitane pri prvom otvaranju bafera</string> - - <string name="preference_connection_title">Veza</string> - - <string name="preference_show_notification_title">Prikazuj obavještenja</string> - <string name="preference_show_notification_summary">Održava Quasseldroid povezanim koristeći trajno obaveštenje</string> - -</resources> diff --git a/app/src/main/res/values-sr/strings_settings.xml b/app/src/main/res/values-sr/strings_settings.xml deleted file mode 100644 index 0e1b6fd8d3bfe27b3e1f423427ed837c54cb6b48..0000000000000000000000000000000000000000 --- a/app/src/main/res/values-sr/strings_settings.xml +++ /dev/null @@ -1,155 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<resources> - <string name="settings_networks_title">Mreže</string> - <string name="settings_network_title">Mreža</string> - <string name="settings_network_network_name">Ime mreže</string> - <string name="settings_network_identity">Identitet</string> - <string name="settings_network_sasl_enabled">SASL</string> - <string name="settings_network_sasl_account">Nalog</string> - <string name="settings_network_sasl_password">Lozinka</string> - <string name="settings_network_autoidentify_enabled">Automatski Identifikuj</string> - <string name="settings_network_autoidentify_service">Servis</string> - <string name="settings_network_autoidentify_password">Lozinka</string> - <string name="settings_network_connection">Veza</string> - <string name="settings_network_perform">Izvrši</string> - <string name="settings_network_rejoin_channels">Ponovo se pridruži kanalima</string> - <string name="settings_network_autoreconnect_enabled">Automatsko ponovno povezivanje</string> - <string name="settings_network_autoreconnect_interval">Interval</string> - <string name="settings_network_autoreconnect_interval_unit">sekundi</string> - <string name="settings_network_autoreconnect_attempts">Maksimalan broj pokušaja</string> - <string name="settings_network_autoreconnect_unlimited">Neograničen broj pokušaja</string> - <string name="settings_network_customratelimits_enabled">Limiti Posebne Rate</string> - <string name="settings_network_customratelimits_burstsize">Broj Uzastopnih Poruka</string> - <string name="settings_network_customratelimits_unlimited">Neograničeno</string> - <string name="settings_network_customratelimits_delay">Odlaganje</string> - <string name="settings_network_customratelimits_interval_unit">sekundi</string> - - <string name="settings_networkserver_title">Server Mreže</string> - <string name="settings_networkserver_connection">Veza</string> - <string name="settings_networkserver_host">Host</string> - <string name="settings_networkserver_port">Port</string> - <string name="settings_networkserver_ssl_enabled">Koristi SSL</string> - <string name="settings_networkserver_ssl_verify">Verifikuj SSL</string> - <string name="settings_networkserver_password">Lozinka</string> - <string name="settings_networkserver_proxy_enabled">Koristi proxy</string> - <string name="settings_networkserver_proxy_type">Tip</string> - <string name="settings_networkserver_proxy_type_http">HTTP</string> - <string name="settings_networkserver_proxy_type_socks5">SOCKS 5</string> - <string name="settings_networkserver_proxy_host">Host</string> - <string name="settings_networkserver_proxy_port">Port</string> - <string name="settings_networkserver_proxy_user">Korisničko ime</string> - <string name="settings_networkserver_proxy_pass">Lozinka</string> - - <string name="settings_identities_title">Identiteti</string> - <string name="settings_identity_title">Identitet</string> - <string name="settings_identity_names">Imena</string> - <string name="settings_identity_identity_name">Ime identiteta</string> - <string name="settings_identity_real_name">Pravo ime</string> - <string name="settings_identity_ident">Ident</string> - <string name="settings_identity_nick">Nadimak</string> - <string name="settings_identity_nicks">Nadimci</string> - <string name="settings_identity_messages">Poruke</string> - <string name="settings_identity_kick_reason">Razlog izbacivanja</string> - <string name="settings_identity_part_reason">Razlog Part-a</string> - <string name="settings_identity_quit_reason">Razlog prekida veze</string> - <string name="settings_identity_away">Poruke iz odsustva</string> - <string name="settings_identity_away_reason">Razlog odsustva</string> - <string name="settings_identity_detach_away">Odsutan Na Razdvajanju</string> - <string name="settings_identity_detach_away_reason">Razlog Odsutnosti Na Razdvajanju</string> - - <string name="settings_chatlists_title">Liste razgovora</string> - <string name="settings_chatlist_title">Lista razgovora</string> - <string name="settings_chatlist_ui">Korisnički interfejs</string> - <string name="settings_chatlist_buffer_view_name">Ime</string> - <string name="settings_chatlist_show_search">Prikaži pretragu</string> - <string name="settings_chatlist_sort_alphabetically">Sortiraj abecedno</string> - <string name="settings_chatlist_add_new_buffers_automatically">Dodaj nove razgovore automatski</string> - <string name="settings_chatlist_network">Mreža</string> - <string name="settings_chatlist_network_all">Sve mreže</string> - <string name="settings_chatlist_show_status_buffer">Prikazuj statusni bafer</string> - <string name="settings_chatlist_types">Tipovi razgovora</string> - <string name="settings_chatlist_show_channels">Prikaži kanale</string> - <string name="settings_chatlist_show_queries">Prikaži upite</string> - <string name="settings_chatlist_activity">Aktivnost</string> - <string name="settings_chatlist_minimum_activity_no_activity">Bez aktivnosti</string> - <string name="settings_chatlist_minimum_activity_other_activity">Druge aktivnosti</string> - <string name="settings_chatlist_minimum_activity_new_message">Nove poruke</string> - <string name="settings_chatlist_minimum_activity_highlight">Isticanje</string> - <string name="settings_chatlist_hide_inactive_buffers">Sakrij neaktivne razgovore</string> - <string name="settings_chatlist_hide_inactive_networks">Sakrij neaktivne mreže</string> - - <string name="settings_ignorelist_title">Lista ignorisanih</string> - - <string name="settings_ignoreitem_title">Pravilo za ignorisanje</string> - <string name="settings_ignoreitem_enabled">Uključeno</string> - <string name="settings_ignoreitem_ignorerule">Pravilo za ignorisanje</string> - <string name="settings_ignoreitem_isregex">Regularni izraz</string> - <string name="settings_ignoreitem_type">Tip</string> - <string name="settings_ignoreitem_type_sender">Pošiljalac</string> - <string name="settings_ignoreitem_type_message">Poruka</string> - <string name="settings_ignoreitem_type_ctcp">CTCP</string> - <string name="settings_ignoreitem_strictness">Striktnost</string> - <string name="settings_ignoreitem_strictness_soft">Dinamično</string> - <string name="settings_ignoreitem_strictness_hard">Trajno</string> - <string name="settings_ignoreitem_scope">Doseg</string> - <string name="settings_ignoreitem_scope_global">Globalni doseg</string> - <string name="settings_ignoreitem_scope_network">Doseg u mreži</string> - <string name="settings_ignoreitem_scope_channel">Doseg u kanalu</string> - <string name="settings_ignoreitem_scoperule">Pravilo dosega</string> - - <string name="settings_highlightlist_title">Isticanja</string> - <string name="settings_highlightlist_highlight_nick">Ističi Nadimak</string> - <string name="settings_highlightlist_highlight_nick_all_nicks">Sve Nadimke od Identiteta</string> - <string name="settings_highlightlist_highlight_nick_current_nick">Trenutni nadimak</string> - <string name="settings_highlightlist_highlight_nick_none">Nijedno</string> - <string name="settings_highlightlist_nicks_case_sensitive">Zavisno od razlikovanja velikih i malih slova</string> - <string name="settings_highlightlist_rules">Pravila Isticanja</string> - <string name="settings_highlightlist_ignore_rules">Pravila za Ignorisanje Isticanja</string> - - <string name="settings_highlightrule_title">Pravilo Isticanja</string> - <string name="settings_highlightrule_enabled">Uključeno</string> - <string name="settings_highlightrule_name">Ime</string> - <string name="settings_highlightrule_regular_expression">Regularni izraz</string> - <string name="settings_highlightrule_case_sensitive">Zavisno od razlikovanja velikih i malih slova</string> - <string name="settings_highlightrule_sender">Pošiljalac</string> - <string name="settings_highlightrule_channel">Kanal</string> - - <string name="settings_aliaslist_title">Alijasi</string> - - <string name="settings_aliasitem_title">Alijas</string> - <string name="settings_aliasitem_name">Ime </string> - <string name="settings_aliasitem_expansion">Ekspanzija</string> - - <string name="settings_networkconfig_title">IRC Podešavanja</string> - <string name="settings_networkconfig_ping_timeout">Detekcija ping tajm-auta</string> - <string name="settings_networkconfig_ping_interval">Ping interval</string> - <string name="settings_networkconfig_ping_interval_unit">sekundi</string> - <string name="settings_networkconfig_max_ping_count">Prekini vezu posle</string> - <string name="settings_networkconfig_max_ping_count_unit">propuštenih pingova</string> - <string name="settings_networkconfig_auto_who">Automatsko traženje korisničkih informacija</string> - <string name="settings_networkconfig_auto_who_interval">Interval osvježavanja</string> - <string name="settings_networkconfig_auto_who_interval_unit">sekundi</string> - <string name="settings_networkconfig_auto_who_nick_limit">Ignoriši kanale sa više od</string> - <string name="settings_networkconfig_auto_who_nick_limit_unit">korisnika</string> - <string name="settings_networkconfig_auto_who_delay">Minimum čekanja između zahtjeva</string> - <string name="settings_networkconfig_auto_who_delay_unit">sekundi</string> - <string name="settings_networkconfig_standard_ctcp">CTCP ponašanje koje poštuje standard</string> -</resources> diff --git a/app/src/main/res/values-sr/strings_setup.xml b/app/src/main/res/values-sr/strings_setup.xml deleted file mode 100644 index d36a8f0d8b7bc16c939e9651d25c2fab31f4a85c..0000000000000000000000000000000000000000 --- a/app/src/main/res/values-sr/strings_setup.xml +++ /dev/null @@ -1,84 +0,0 @@ -<!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<resources> - <!-- Account Selection --> - <string name="slide_account_select_title">Odaberi nalog</string> - <string name="slide_account_select_description">Odaberi nalog iz liste ili dodaj novi</string> - <string name="label_user_on_host">%1$s na %2$s:%3$d</string> - - <!-- Account Setup --> - - <!-- Account Connection --> - <string name="slide_account_connection_title">Veza</string> - <string name="slide_account_connection_description">Prvo, molimo odaberite server na kom je vaš Core hostovan.</string> - - <string name="label_connection_host">Host</string> - <string name="label_connection_port">Port</string> - <string name="hint_invalid_host">Neispravan hostname</string> - <string name="hint_invalid_port">Port nije validan</string> - - <!-- Account User --> - <string name="slide_account_user_title">Vaš nalog</string> - <string name="slide_account_user_description">Sada, molimo unesite korisničko ime i lozinku za vaš nalog na jezgru. Ako ste upravo postavili to jezgro, mi ćemo podesiti ovaj nalog za vas.</string> - - <string name="label_account_user">Korisničko ime</string> - <string name="label_account_pass">Lozinka</string> - - <string name="hint_invalid_user">Korisničko ime ne može biti prazno</string> - - <!-- Account Name --> - <string name="slide_account_name_title">Prilagodi nalog</string> - <string name="slide_account_name_description">Imenujte ovaj nalog</string> - - <string name="label_account_name">Ime naloga</string> - - <string name="hint_invalid_name">Ime ne može biti prazno</string> - - <!-- Core Authenticator Select --> - <string name="slide_core_authenticator_select_title">Odaberi backend za proveru identiteta</string> - <string name="slide_core_authenticator_select_description">Molimo odaberite backend za proveru identiteta koji će Quassel Core koristiti za identifikovanje korisnika.</string> - - <!-- Core Backend Select --> - <string name="slide_core_backend_select_title">Odaberi backend za skladištenje podataka</string> - <string name="slide_core_backend_select_description">Molimo odaberite backend za bazu podataka koji će Quassel Core koristiti za skladištenje zaostalih poruka i ostalih podataka.</string> - - <!-- Core Backend Config --> - <string name="slide_core_backend_setup_title">Podesi backend za skladištenje podataka</string> - <string name="slide_core_backend_setup_description">Molimo podesite odabrani backend baze podataka.</string> - - <!-- User Identity --> - <string name="slide_user_identity_title">Postavka identiteta</string> - <string name="slide_user_identity_description">Molimo odaberite nadimak</string> - - <string name="hint_invalid_nick">Nadimak nije važeći</string> - - <!-- User Network --> - <string name="slide_user_network_title">Podesi mrežu</string> - <string name="slide_user_network_description">Odaberi mrežu za povezivanje.</string> - - <string name="label_network_custom">Prilagođena mreža…</string> - - <!-- User Channels --> - <string name="slide_user_channels_title">Podesi kanale</string> - <string name="slide_user_channels_description">Odaberite kojim kanalima želite da se pridružite.</string> - - <string name="label_channels">Kanali</string> - -</resources> diff --git a/app/src/main/res/values-sr/strings_status.xml b/app/src/main/res/values-sr/strings_status.xml deleted file mode 100644 index df85dbda9e7e8fdc56adf3f5d571b0fce1a6aa12..0000000000000000000000000000000000000000 --- a/app/src/main/res/values-sr/strings_status.xml +++ /dev/null @@ -1,27 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<resources> - <string name="label_status_disconnected">Odvojeni</string> - <string name="label_status_connecting">Povezivanje</string> - <string name="label_status_handshake">Handshake</string> - <string name="label_status_init">Inicijalizacija</string> - <string name="label_status_connected">Povezano</string> - <string name="label_status_closed">Veza izgubljena</string> -</resources> diff --git a/app/src/main/res/values-sw600dp/dimens.xml b/app/src/main/res/values-sw600dp/dimens.xml deleted file mode 100644 index 87ee16d629b10d6e0f7d75ca5464c94b06af0f9c..0000000000000000000000000000000000000000 --- a/app/src/main/res/values-sw600dp/dimens.xml +++ /dev/null @@ -1,24 +0,0 @@ -<!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<resources> - <dimen name="navigation_drawer_max_width">400dp</dimen> - - <dimen name="max_content_width">600dp</dimen> -</resources> diff --git a/app/src/main/res/values-sw600dp/themes_base.xml b/app/src/main/res/values-sw600dp/themes_base.xml deleted file mode 100644 index ec3a5c60e19cb6c171fb75a49c767d6530cc9a8a..0000000000000000000000000000000000000000 --- a/app/src/main/res/values-sw600dp/themes_base.xml +++ /dev/null @@ -1,42 +0,0 @@ -<!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<resources> - - <style name="Theme.SetupTheme" parent="Theme.AppTheme.Light"> - <item name="windowActionBar">false</item> - <item name="windowNoTitle">true</item> - - <item name="actionBarPopupTheme">@style/Widget.PopupOverlay.Setup</item> - - <item name="colorTextPrimary">#de000000</item> - <item name="colorTextPrimaryInverse">#ffffffff</item> - <item name="colorTextSecondary">#8a000000</item> - <item name="colorTextSecondaryInverse">#b3ffffff</item> - <item name="colorDivider">#1F000000</item> - - <item name="android:textColor">?colorTextPrimary</item> - <item name="android:textColorPrimary">?colorTextPrimary</item> - <item name="android:textColorSecondary">?colorTextSecondary</item> - <item name="colorControlNormal">?colorTextPrimary</item> - - <item name="android:windowBackground">?attr/colorPrimary</item> - <item name="colorBackground">#FAFAFA</item> - </style> -</resources> diff --git a/app/src/main/res/values-sw720dp-land/bools.xml b/app/src/main/res/values-sw720dp-land/bools.xml deleted file mode 100644 index af4b5f963b17f12ffd9a47a327e277e0e1c1a454..0000000000000000000000000000000000000000 --- a/app/src/main/res/values-sw720dp-land/bools.xml +++ /dev/null @@ -1,22 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<resources> - <bool name="buffer_drawer_exists">false</bool> -</resources> diff --git a/app/src/main/res/values-v21/themes_base.xml b/app/src/main/res/values-v21/themes_base.xml deleted file mode 100644 index a03970453035ad03d1c689abc2ac6b68f2338738..0000000000000000000000000000000000000000 --- a/app/src/main/res/values-v21/themes_base.xml +++ /dev/null @@ -1,45 +0,0 @@ -<!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<resources> - - <style name="Theme.AppTheme.NoActionBar" parent="Theme.MaterialComponents.NoActionBar.Bridge"> - <item name="colorPrimary">@color/colorPrimary</item> - <item name="colorPrimaryDark">@color/colorPrimaryDark</item> - <item name="colorAccent">@color/colorAccent</item> - <item name="android:windowDrawsSystemBarBackgrounds">true</item> - <item name="android:statusBarColor">?attr/colorPrimaryDark</item> - </style> - - <style name="Theme.AppTheme.Light.NoActionBar" parent="Theme.MaterialComponents.Light.NoActionBar.Bridge"> - <item name="colorPrimary">@color/colorPrimary</item> - <item name="colorPrimaryDark">@color/colorPrimaryDark</item> - <item name="colorAccent">@color/colorAccent</item> - <item name="android:windowDrawsSystemBarBackgrounds">true</item> - <item name="android:statusBarColor">?attr/colorPrimaryDark</item> - </style> - - <style name="Base.ChatTheme" parent="Theme.AppTheme.NoActionBar"> - <item name="android:statusBarColor">#0000</item> - </style> - - <style name="Base.ChatTheme.Light" parent="Theme.AppTheme.Light.NoActionBar"> - <item name="android:statusBarColor">#0000</item> - </style> -</resources> diff --git a/app/src/main/res/values-v28/strings_preferences.xml b/app/src/main/res/values-v28/strings_preferences.xml deleted file mode 100644 index 172bed79ea2d1cb5ae7a1c105852aebe8e2ad0cf..0000000000000000000000000000000000000000 --- a/app/src/main/res/values-v28/strings_preferences.xml +++ /dev/null @@ -1,55 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<resources> - <!-- - <string-array name="preference_theme_entries" translatable="false"> - <item>@string/preference_theme_entry_material_daynight</item> - <item>@string/preference_theme_entry_material_light</item> - <item>@string/preference_theme_entry_material_dark</item> - <item>@string/preference_theme_entry_quassel_daynight</item> - <item>@string/preference_theme_entry_quassel_light</item> - <item>@string/preference_theme_entry_quassel_dark</item> - <item>@string/preference_theme_entry_amoled</item> - <item>@string/preference_theme_entry_solarized_daynight</item> - <item>@string/preference_theme_entry_solarized_light</item> - <item>@string/preference_theme_entry_solarized_dark</item> - <item>@string/preference_theme_entry_gruvbox_daynight</item> - <item>@string/preference_theme_entry_gruvbox_light</item> - <item>@string/preference_theme_entry_gruvbox_dark</item> - <item>@string/preference_theme_entry_dracula</item> - </string-array> - <string-array name="preference_theme_entryvalues" translatable="false"> - <item>MATERIAL_DAYNIGHT</item> - <item>MATERIAL_LIGHT</item> - <item>MATERIAL_DARK</item> - <item>QUASSEL_DAYNIGHT</item> - <item>QUASSEL_LIGHT</item> - <item>QUASSEL_DARK</item> - <item>AMOLED</item> - <item>SOLARIZED_DAYNIGHT</item> - <item>SOLARIZED_LIGHT</item> - <item>SOLARIZED_DARK</item> - <item>GRUVBOX_DAYNIGHT</item> - <item>GRUVBOX_LIGHT</item> - <item>GRUVBOX_DARK</item> - <item>DRACULA</item> - </string-array> - --> -</resources> diff --git a/app/src/main/res/values/attrs.xml b/app/src/main/res/values/attrs.xml deleted file mode 100644 index 87f8fc4c9179d15c7d70ae2bd35e274714ac8fff..0000000000000000000000000000000000000000 --- a/app/src/main/res/values/attrs.xml +++ /dev/null @@ -1,145 +0,0 @@ -<!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<resources> - <!-- sender colors --> - <attr name="senderColor0" format="color" /> - <attr name="senderColor1" format="color" /> - <attr name="senderColor2" format="color" /> - <attr name="senderColor3" format="color" /> - <attr name="senderColor4" format="color" /> - <attr name="senderColor5" format="color" /> - <attr name="senderColor6" format="color" /> - <attr name="senderColor7" format="color" /> - <attr name="senderColor8" format="color" /> - <attr name="senderColor9" format="color" /> - <attr name="senderColorA" format="color" /> - <attr name="senderColorB" format="color" /> - <attr name="senderColorC" format="color" /> - <attr name="senderColorD" format="color" /> - <attr name="senderColorE" format="color" /> - <attr name="senderColorF" format="color" /> - - <!-- Background and foreground colors for UI --> - <attr name="colorForeground" format="color" /> - <attr name="colorForegroundHighlight" format="color" /> - <attr name="colorForegroundHighlightSecondary" format="color" /> - <attr name="colorForegroundSecondary" format="color" /> - <attr name="colorForegroundNotice" format="color" /> - <attr name="colorForegroundAction" format="color" /> - <attr name="colorForegroundError" format="color" /> - - <attr name="colorForegroundHighlightMonochrome" format="boolean" /> - - <attr name="colorForegroundMirc" format="integer" /> - - <attr name="colorTextPrimary" format="color" /> - <attr name="colorTextPrimaryInverse" format="color" /> - <attr name="colorTextSecondary" format="color" /> - <attr name="colorTextSecondaryInverse" format="color" /> - <attr name="colorTextSearch" format="color" /> - <attr name="colorTextSearchSecondary" format="color" /> - <attr name="colorDivider" format="color" /> - - <attr name="colorBackground" format="color" /> - <attr name="colorBackgroundAlpha" format="color" /> - <attr name="colorBackgroundHighlight" format="color" /> - <attr name="colorBackgroundSecondary" format="color" /> - <attr name="colorBackgroundCard" format="color" /> - <attr name="colorBackgroundSearch" format="color" /> - <attr name="colorBackgroundDialog" format="color" /> - <attr name="colorBackgroundSnackbar" format="color" /> - - <attr name="colorMarkerLine" format="color" /> - - <!-- Tint colors for drawer --> - <attr name="colorTintActivity" format="color" /> - <attr name="colorTintMessage" format="color" /> - <attr name="colorTintHighlight" format="color" /> - <attr name="colorTintNotification" format="color" /> - - <!-- Icons --> - <attr name="colorOffline" format="color" /> - <attr name="colorAway" format="color" /> - <attr name="colorFill" format="color" /> - - <attr name="formatBarTheme" format="reference" /> - <attr name="buttonTheme" format="reference" /> - <attr name="buttonThemeColored" format="reference" /> - <attr name="cardStyle" format="reference" /> - - <attr name="colorTintSecure" format="color" /> - <attr name="colorTintPartiallySecure" format="color" /> - <attr name="colorTintInsecure" format="color" /> - - <!-- Menu Items --> - <attr name="backgroundMenuItem" format="reference" /> - <attr name="backgroundMenuItemRounded" format="reference" /> - - <!-- InsetLayouts --> - <attr name="insetBackground" format="color|reference" /> - - <!-- DrawerRecyclerView --> - <declare-styleable name="DrawerRecyclerView"> - <attr name="insetBackground" /> - </declare-styleable> - - <!-- ShadowView --> - <declare-styleable name="ShadowView"> - <attr name="android:gravity" /> - </declare-styleable> - - <!-- RingtonePreference --> - <declare-styleable name="RingtonePreference"> - <!-- Which ringtone type(s) to show in the picker. --> - <attr name="ringtoneType"> - <!-- Ringtones. --> - <flag name="ringtone" value="1" /> - <!-- Notification sounds. --> - <flag name="notification" value="2" /> - <!-- Alarm sounds. --> - <flag name="alarm" value="4" /> - <!-- All available ringtone sounds. --> - <flag name="all" value="7" /> - </attr> - <!-- Whether to show an item for a default sound. --> - <attr name="showDefault" format="boolean" /> - <!-- Whether to show an item for 'Silent'. --> - <attr name="showSilent" format="boolean" /> - </declare-styleable> - - <!-- FastScroll RecyclerView --> - <declare-styleable name="FastScrollRecyclerView"> - <attr name="fastScrollThumbColor" format="reference|color" /> - <attr name="fastScrollThumbInactiveColor" format="reference|color" /> - <attr name="fastScrollTrackColor" format="reference|color" /> - <attr name="fastScrollPopupBgColor" format="reference|color" /> - <attr name="fastScrollPopupTextColor" format="reference|color" /> - <attr name="fastScrollPopupTextSize" format="reference|dimension" /> - <attr name="fastScrollPopupBackgroundSize" format="reference|dimension" /> - <attr name="fastScrollPopupPosition" format="enum"> - <enum name="adjacent" value="0" /> - <enum name="center" value="1" /> - </attr> - <attr name="fastScrollAutoHide" format="reference|boolean" /> - <attr name="fastScrollAutoHideDelay" format="reference|integer" /> - <attr name="fastScrollEnableThumbInactiveColor" format="reference|boolean" /> - <attr name="fastScrollThumbEnabled" format="reference|boolean" /> - </declare-styleable> -</resources> diff --git a/app/src/main/res/values/bools.xml b/app/src/main/res/values/bools.xml deleted file mode 100644 index a6ff579153e7164948127ef500c895ba4bcf95c7..0000000000000000000000000000000000000000 --- a/app/src/main/res/values/bools.xml +++ /dev/null @@ -1,22 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<resources> - <bool name="buffer_drawer_exists">true</bool> -</resources> diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml index d6db0182e195cae938b8f830a3321e68df1603e7..f8c6127d327620c93d2b2d00342a68e97b98a48d 100644 --- a/app/src/main/res/values/colors.xml +++ b/app/src/main/res/values/colors.xml @@ -1,153 +1,10 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - +<?xml version="1.0" encoding="utf-8"?> <resources> - <color name="colorPrimary">#0a70c0</color> - <color name="colorPrimaryDark">#105a94</color> - <color name="colorAccent">#ffaf3b</color> - - <color name="colorIconLight">#0291e7</color> - <color name="colorIconDark">#124e99</color> - - <color name="colorFillLight">#757575</color> - <color name="colorFillDark">#ffffff</color> - - <color name="colorOfflineLight">#757575</color> - <color name="colorOfflineDark">#B3B3B3</color> - - <color name="colorAwayLight">#959595</color> - <color name="colorAwayDark">#939393</color> - - <color name="ripple_dark">#33ffffff</color> - <color name="ripple_light">#1f000000</color> - - <!-- mirc colors --> - <color name="mircColor00">#ffffff</color> - <color name="mircColor01">#000000</color> - <color name="mircColor02">#000080</color> - <color name="mircColor03">#008000</color> - <color name="mircColor04">#ff0000</color> - <color name="mircColor05">#800000</color> - <color name="mircColor06">#800080</color> - <color name="mircColor07">#ffa500</color> - <color name="mircColor08">#ffff00</color> - <color name="mircColor09">#00ff00</color> - <color name="mircColor10">#008080</color> - <color name="mircColor11">#00ffff</color> - <color name="mircColor12">#4169e1</color> - <color name="mircColor13">#ff00ff</color> - <color name="mircColor14">#808080</color> - <color name="mircColor15">#c0c0c0</color> - - <color name="mircColor16">#470000</color> - <color name="mircColor28">#740000</color> - <color name="mircColor40">#b50000</color> - <color name="mircColor52">#ff0000</color> - <color name="mircColor64">#ff5959</color> - <color name="mircColor76">#ff9c9c</color> - - <color name="mircColor17">#472100</color> - <color name="mircColor29">#743a00</color> - <color name="mircColor41">#b56300</color> - <color name="mircColor53">#ff8c00</color> - <color name="mircColor65">#ffb459</color> - <color name="mircColor77">#ffd39c</color> - - <color name="mircColor18">#474700</color> - <color name="mircColor30">#747400</color> - <color name="mircColor42">#b5b500</color> - <color name="mircColor54">#ffff00</color> - <color name="mircColor66">#ffff71</color> - <color name="mircColor78">#ffff9c</color> - - <color name="mircColor19">#324700</color> - <color name="mircColor31">#517400</color> - <color name="mircColor43">#7db500</color> - <color name="mircColor55">#b2ff00</color> - <color name="mircColor67">#cfff60</color> - <color name="mircColor79">#e2ff9c</color> - - <color name="mircColor20">#004700</color> - <color name="mircColor32">#007400</color> - <color name="mircColor44">#00b500</color> - <color name="mircColor56">#00ff00</color> - <color name="mircColor68">#6fff6f</color> - <color name="mircColor80">#9cff9c</color> - - <color name="mircColor21">#00472c</color> - <color name="mircColor33">#007449</color> - <color name="mircColor45">#00b571</color> - <color name="mircColor57">#00ffa0</color> - <color name="mircColor69">#65ffc9</color> - <color name="mircColor81">#9cffdb</color> - - <color name="mircColor22">#004747</color> - <color name="mircColor34">#007474</color> - <color name="mircColor46">#00b5b5</color> - <color name="mircColor58">#00ffff</color> - <color name="mircColor70">#6dffff</color> - <color name="mircColor82">#9cffff</color> - - <color name="mircColor23">#002747</color> - <color name="mircColor35">#004074</color> - <color name="mircColor47">#0063b5</color> - <color name="mircColor59">#008cff</color> - <color name="mircColor71">#59b4ff</color> - <color name="mircColor83">#9cd3ff</color> - - <color name="mircColor24">#000047</color> - <color name="mircColor36">#000074</color> - <color name="mircColor48">#0000b5</color> - <color name="mircColor60">#0000ff</color> - <color name="mircColor72">#5959ff</color> - <color name="mircColor84">#9c9cff</color> - - <color name="mircColor25">#2e0047</color> - <color name="mircColor37">#4b0074</color> - <color name="mircColor49">#7500b5</color> - <color name="mircColor61">#a500ff</color> - <color name="mircColor73">#c459ff</color> - <color name="mircColor85">#dc9cff</color> - - <color name="mircColor26">#470047</color> - <color name="mircColor38">#740074</color> - <color name="mircColor50">#b500b5</color> - <color name="mircColor62">#ff00ff</color> - <color name="mircColor74">#ff66ff</color> - <color name="mircColor86">#ff9cff</color> - - <color name="mircColor27">#47002a</color> - <color name="mircColor39">#740045</color> - <color name="mircColor51">#b5006b</color> - <color name="mircColor63">#ff0098</color> - <color name="mircColor75">#ff59bc</color> - <color name="mircColor87">#ff94d3</color> - - <color name="mircColor88">#000000</color> - <color name="mircColor89">#131313</color> - <color name="mircColor90">#282828</color> - <color name="mircColor91">#363636</color> - <color name="mircColor92">#4d4d4d</color> - <color name="mircColor93">#656565</color> - <color name="mircColor94">#818181</color> - <color name="mircColor95">#9f9f9f</color> - <color name="mircColor96">#bcbcbc</color> - <color name="mircColor97">#e2e2e2</color> - <color name="mircColor98">#ffffff</color> -</resources> + <color name="purple_200">#FFBB86FC</color> + <color name="purple_500">#FF6200EE</color> + <color name="purple_700">#FF3700B3</color> + <color name="teal_200">#FF03DAC5</color> + <color name="teal_700">#FF018786</color> + <color name="black">#FF000000</color> + <color name="white">#FFFFFFFF</color> +</resources> \ No newline at end of file diff --git a/app/src/main/res/values/defaults.xml b/app/src/main/res/values/defaults.xml deleted file mode 100644 index 03a7c43e33eefc46f7e7ae614741900ac70a86f2..0000000000000000000000000000000000000000 --- a/app/src/main/res/values/defaults.xml +++ /dev/null @@ -1,22 +0,0 @@ -<!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<resources> - <string name="defaultConnectionPort" translatable="false">4242</string> -</resources> diff --git a/app/src/main/res/values/dimens.xml b/app/src/main/res/values/dimens.xml deleted file mode 100644 index f3d8e17d8817222e7f2cc294063c3013beb08d43..0000000000000000000000000000000000000000 --- a/app/src/main/res/values/dimens.xml +++ /dev/null @@ -1,52 +0,0 @@ -<!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<resources> - <dimen name="navigation_drawer_max_width">320dp</dimen> - - <dimen name="message_horizontal">8dp</dimen> - <dimen name="message_vertical">2dp</dimen> - <dimen name="message_vertical_daychange">8dp</dimen> - - <dimen name="markerline_height">1dp</dimen> - - <dimen name="autocomplete_max_height">96dp</dimen> - - <dimen name="max_content_width">480dp</dimen> - - <dimen name="button_corner_radius">2dp</dimen> - - <dimen name="shadow_height">4dp</dimen> - - <dimen name="colorchooser_circlesize">56dp</dimen> - <dimen name="avatar_size">35sp</dimen> - <dimen name="avatar_size_action">20sp</dimen> - <dimen name="avatar_size_buffer">32dp</dimen> - - <dimen name="avatar_radius">2dp</dimen> - - <dimen name="notification_avatar_width">64dp</dimen> - <dimen name="notification_avatar_height">64dp</dimen> - <dimen name="size_nick_count">24dp</dimen> - - <dimen name="drawer_toggle_size">24dp</dimen> - <dimen name="drawer_toggle_thickness">2dp</dimen> - - <dimen name="hint_text_size">12sp</dimen> -</resources> diff --git a/app/src/main/res/values/ids.xml b/app/src/main/res/values/ids.xml deleted file mode 100644 index c1400a4d826b427fb5e8dade2aac80ad9167985b..0000000000000000000000000000000000000000 --- a/app/src/main/res/values/ids.xml +++ /dev/null @@ -1,30 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<resources> - <item name="tag_daychange" type="id" /> - <item name="tag_daychange_layout" type="id" /> - <item name="tag_daychange_content" type="id" /> - - <item name="tag_markerline" type="id" /> - - <item name="fab_query" type="id" /> - <item name="fab_join" type="id" /> - <item name="fab_create" type="id" /> -</resources> diff --git a/app/src/main/res/values/ints.xml b/app/src/main/res/values/ints.xml deleted file mode 100644 index 98e199b176b4a6e5d88531c27c862ed70b42335d..0000000000000000000000000000000000000000 --- a/app/src/main/res/values/ints.xml +++ /dev/null @@ -1,22 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<resources> - <integer name="shortcut_image_size">432</integer> -</resources> diff --git a/app/src/main/res/values/mipmap.xml b/app/src/main/res/values/mipmap.xml deleted file mode 100644 index e24090516ec76357f208a8f720d03b9d3f6d19b5..0000000000000000000000000000000000000000 --- a/app/src/main/res/values/mipmap.xml +++ /dev/null @@ -1,22 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<resources> - <item name="ic_launcher" type="mipmap">@mipmap/ic_launcher_legacy</item> -</resources> diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index cbde82b7ea3326f5f933ae838fa95d401ef8c80e..26c8176cf4bc43f6a84b40fc0fc32e72a0bd67bf 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -1,204 +1,3 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<resources xmlns:tools="http://schemas.android.com/tools"> - <plurals name="label_user_count"> - <item quantity="one">%1$d user</item> - <item quantity="other">%1$d users</item> - </plurals> - <string name="app_name">Quasseldroid</string> - <string name="app_description">An Android-based client for the decentralized Quassel IRC client.</string> - - <string name="app_description_long">Quassel is a distributed, decentralized IRC client, written using C++ and Qt. Quasseldroid is a pure-kotlin client for the Quassel core, allowing you to connect to your Quassel core using your Android™ phone.</string> - <string name="connection_service_title">Connection Service</string> - - <string name="connection_service_description">Keeps a connection to your core to allow for notifications, and to transmit messages.</string> - <string name="label_about">About</string> - <string name="label_accept">Accept</string> - <string name="label_acknowledgements">Acknowledgements</string> - <string name="label_archive">Archive</string> - <string name="label_archive_chat">Archive Chat</string> - <string name="label_archived_chats">Archived Chats</string> - <string name="label_ascending">Ascending</string> - <string name="label_authors">Authors</string> - <string name="label_autocomplete">Autocomplete</string> - <string name="label_avatar">Avatar</string> - <string name="label_back">Back</string> - <string name="label_buffer_name">Chat Name</string> - <string name="label_cancel">Cancel</string> - <string name="label_certificates">Certificates</string> - <string name="label_channel_name">Channel Name</string> - <string name="label_clear_search">Clear Search</string> - <string name="label_close">Close</string> - <string name="label_colors_custom">Custom</string> - <string name="label_colors_mirc">mIRC</string> - <string name="label_configure">Configure</string> - <string name="label_connect">Connect</string> - <string name="label_copy">Copy</string> - <string name="label_crashes">Crashes</string> - <string name="label_crashes_empty">No crash reports found</string> - <string name="label_create_channel">Create Channel</string> - <string name="label_delete">Delete</string> - <string name="label_delete_all">Delete All</string> - <string name="label_descending">Descending</string> - <string name="label_disconnect">Disconnect</string> - <string name="label_edit_core">Edit Account</string> - <string name="label_edit_nick">Edit Nickname</string> - <string name="label_edit_topic">Edit Topic</string> - <string name="label_edit_topic_long">Open dialog to change the channel topic</string> - <string name="label_filter_messages">Filter Messages</string> - <string name="label_finish">Finish</string> - <string name="label_generate_crash_report">Generate Crash Report</string> - <string name="label_ignore">Ignore</string> - <string name="label_ignore_long">Add/remove user to/from ignore list</string> - <string name="label_info">Details</string> - <string name="label_info_certificate">Certificate</string> - <string name="label_info_channel">Channel Details</string> - <string name="label_info_channellist">Channel List</string> - <string name="label_info_core">Core Details</string> - <string name="label_info_user">User Details</string> - <string name="label_input_history">Input History</string> - <string name="label_join">Join</string> - <string name="label_join_long">Join Channel</string> - <string name="label_libraries">Libraries</string> - <string name="label_license">License</string> - <string name="label_mark_read">Mark Read</string> - <string name="label_match_all">Matches all messages</string> - <string name="label_mention">Mention</string> - <string name="label_mention_long">Copy username into input line</string> - <string name="label_network">Network</string> - <string name="label_new_account">New Account</string> - <string name="label_new_chatlist">New Chatlist</string> - <string name="label_new_highlight_ignore_rule">New Highlight Ignore Rule</string> - <string name="label_new_highlight_rule">New Highlight Rule</string> - <string name="label_new_identity">New Identity</string> - <string name="label_new_ignore_rule">New Ignore Rule</string> - <string name="label_new_network">New Network</string> - <string name="label_new_nick">New Nick</string> - <string name="label_new_server">New Server</string> - <string name="label_next">Next</string> - <string name="label_nick">Nick</string> - <string name="label_nicklist">Nick List</string> - <string name="label_no">No</string> - <string name="label_no_away_message">No away message available</string> - <string name="label_no_sound">None</string> - <string name="label_open">Open</string> - <string name="label_part">Leave</string> - <string name="label_part_long">Leave Channel</string> - <string name="label_password_change">Change Password</string> - <string name="label_password_error_nomatch">Passwords do not match</string> - <string name="label_password_error_wrong">Wrong Password</string> - <string name="label_password_new">New Password</string> - <string name="label_password_old">Old Password</string> - <string name="label_password_repeat">Repeat Password</string> - <string name="label_permanently_archived">Permanently Archived</string> - <string name="label_permanently_archived_empty">You have no permanently archived chats</string> - <string name="label_permanently_archived_long">Permanently archived chats stay hidden until you manually choose to un-archive them.</string> - <string name="label_placeholder_message">Write a message…</string> - <string name="label_placeholder_topic">Describe the channel topic…</string> - <string name="label_privacy_policy">Privacy Policy</string> - <string name="label_query">Query</string> - <string name="label_query_long">Open private chat with user</string> - <string name="label_query_medium">Open private chat</string> - <string name="label_rename">Rename</string> - <string name="label_reorder">Reorder</string> - <string name="label_reply">Reply</string> - <string name="label_reset">Reset</string> - <string name="label_save">Save</string> - <string name="label_saving">Saving…</string> - <string name="label_search">Search…</string> - <string name="label_search_buffer">Search Chats</string> - <string name="label_search_channels">Search Channels</string> - <string name="label_select">Select</string> - <string name="label_send">Send</string> - <string name="label_service_connection_failed">Could not create connection, check battery saving settings. See dontkillmyapp.com for more info.</string> - <string name="label_set_default">Set Default</string> - <string name="label_settings">Settings</string> - <string name="label_settings_client">Client Settings</string> - <string name="label_settings_core">Core Settings</string> - <string name="label_share">Share</string> - <string name="label_share_crashreport">Share Crash Report</string> - <string name="label_shortcut">Shortcut</string> - <string name="label_shortcut_long">Create Shortcut on Homescreen</string> - <string name="label_sort">Sort</string> - <string name="label_source">Source</string> - <string name="label_temporarily_archived">Temporarily Archived</string> - <string name="label_temporarily_archived_empty">You have no temporarily archived chats</string> - <string name="label_temporarily_archived_long">Chats which are temporarily archived will be shown again once they get a new message.</string> - <string name="label_topic">Channel Topic</string> - <string name="label_translators">Translators</string> - <string name="label_unhide">Make Visible</string> - <string name="label_unknown_sender"><Unknown></string> - <string name="label_update_user_password">Update User/Password</string> - <string name="label_use_default">Use Default</string> - <string name="label_user_count">User Count</string> - <string name="label_website">Website</string> - <string name="label_whitelist">Ignore</string> - <string name="label_whitelist_certificates">Certificates</string> - <string name="label_whitelist_certificates_empty">No certificates whitelisted</string> - <string name="label_whitelist_hostnames">Hosts</string> - <string name="label_whitelist_hostnames_empty">No hosts whitelisted</string> - <string name="label_whitelist_ignore_date">Expiration date is ignored for this certificate</string> - <string name="label_who">Who</string> - <string name="label_who_long">Update user information of all users</string> - <string name="label_whois">Whois</string> - <string name="label_whois_long">Update user information</string> - - <string name="label_yes">Yes</string> - - <string name="label_feature_synchronizedmarkerline">Required for synchronizing the last position in channels</string> - <string name="label_feature_saslauthentication">Required for SASL</string> - <string name="label_feature_saslexternal">Required for SASL with certificates</string> - <string name="label_feature_hideinactivenetworks">Required for hiding inactive networks from chat lists</string> - <string name="label_feature_passwordchange">Required for changing passwords from the client</string> - <string name="label_feature_capnegotiation">Required for IRCv3 capabilities</string> - <string name="label_feature_verifyserverssl">Required for verifying the SSL certificate of IRC networks you connect to</string> - <string name="label_feature_customratelimits">Required for custom rate limits for IRC networks</string> - <string name="label_feature_awayformattimestamp">Required for custom formatted timestamps in away messages</string> - <string name="label_feature_bufferactivitysync">Required for seeing activity of chats in the chat list</string> - <string name="label_feature_coresidehighlights">Required for highlights</string> - <string name="label_feature_senderprefixes">Required for seeing prefix modes (+, @) of users in messages</string> - <string name="label_feature_remotedisconnect">Required for remote disconnects of your own clients</string> - <string name="label_feature_richmessages">Required for seeing real names or IRCv3 or Gravatar avatars in messages</string> - <string name="label_feature_backlogfiltertype">Required for receiving past notifications after connecting</string> - - <string name="label_feature_context_bufferactivitysync">Quasseldroid cannot highlight unread chats. Upgrade your core to Quassel v0.13 to resolve this.</string> - <string name="label_feature_context_coresidehighlights">Quasseldroid cannot configure highlights. Upgrade your core to Quassel v0.13 to resolve this.</string> - <string name="label_feature_context_missing">Your core is missing features that are required for Quasseldroid to work correctly.</string> - <string name="label_feature_context_missing_button">Details</string> - - <string name="notification_channel_connection_title">Connection</string> - <string name="notification_channel_highlight_title">Highlights</string> - <string name="notification_channel_old_highlight_title">Old Highlights</string> - - <string name="label_missing_features">Missing Features</string> - <string name="info_missing_features" tools:ignore="StringFormatCount">Your core is missing features that are required for Quasseldroid to work correctly. You should <a href="https://quassel-irc.org>upgrade</a> your Quassel core to %1$s or newer.</string> - - <string name="buffer_delete_confirmation">Do you want to delete this chat permanently?</string> - <string name="buffer_archive_confirmation">Do you want to archive this chat?</string> - <string name="buffer_archive_temporarily">Automatically unhide this chat once it has new messages</string> - - <string name="delete_confirmation">Are you sure you want to delete this permanently? This can not be undone.</string> - <string name="cancel_confirmation">You have unsaved changes. Do you wish to discard them?</string> - - <string name="info_copied_version">Version copied to clipboard</string> - - <string name="advertisement_support_patreon">Please help support the development of this app on Patreon</string> - <string name="advertisement_support_button">Support development</string> -</resources> +<resources> + <string name="app_name">Quasseldroid</string> +</resources> \ No newline at end of file diff --git a/app/src/main/res/values/strings_addchat.xml b/app/src/main/res/values/strings_addchat.xml deleted file mode 100644 index f295058cf5515e83854a1c98780048a214ad26e8..0000000000000000000000000000000000000000 --- a/app/src/main/res/values/strings_addchat.xml +++ /dev/null @@ -1,27 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<resources> - <string name="addchat_channel_hidden">Hidden</string> - - <string name="addchat_channel_invite_only">Invite Only</string> - - <string name="addchat_channel_password_protected">Password Protected</string> - <string name="addchat_channel_password">Password</string> -</resources> diff --git a/app/src/main/res/values/strings_certificates.xml b/app/src/main/res/values/strings_certificates.xml deleted file mode 100644 index 67173455a7a0f1ac553c179d755d8629693875a6..0000000000000000000000000000000000000000 --- a/app/src/main/res/values/strings_certificates.xml +++ /dev/null @@ -1,39 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<resources> - <string name="certificate_subject">Issued To</string> - <string name="certificate_issuer">Issued By</string> - - <string name="certificate_common_name">Common Name (CN)</string> - <string name="certificate_organization">Organization (O)</string> - <string name="certificate_organizational_unit">Organizational Unit (OU)</string> - - <string name="certificate_hostnames">Hostnames</string> - - <string name="certificate_validity">Period of Validity</string> - - <string name="certificate_not_before">Not Before</string> - <string name="certificate_not_after">Not After</string> - - <string name="certificate_fingerprints">Fingerprints</string> - - <string name="certificate_fingerprint_sha256">SHA-256 Fingerprint</string> - <string name="certificate_fingerprint_sha1">SHA-1 Fingerprint</string> -</resources> diff --git a/app/src/main/res/values/strings_constants.xml b/app/src/main/res/values/strings_constants.xml deleted file mode 100644 index a3e9f58b53012a3a9b9b11209b0a47bfd4b8bf73..0000000000000000000000000000000000000000 --- a/app/src/main/res/values/strings_constants.xml +++ /dev/null @@ -1,28 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<resources> - <string name="package_name" translatable="false">com.iskrembilen.quasseldroid</string> - - <string name="notification_channel_background" translatable="false">background</string> - <string name="notification_channel_highlight" translatable="false">highlight</string> - <string name="notification_channel_old_highlight" translatable="false">old_highlight</string> - - <string name="drag_intercept_bottom_sheet_behavior" translatable="false">de.kuschku.quasseldroid.util.ui.DragInterceptBottomSheetBehavior</string> -</resources> diff --git a/app/src/main/res/values/strings_contributors.xml b/app/src/main/res/values/strings_contributors.xml deleted file mode 100644 index f67b2fcf1488df3b29f8e0fe41fe28848a5113c6..0000000000000000000000000000000000000000 --- a/app/src/main/res/values/strings_contributors.xml +++ /dev/null @@ -1,26 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<resources> - <string name="contributor_description_freqmod">Initial qdatastream deserialization attempts</string> - <string name="contributor_description_sandsmark">Legacy protocol implementation, (de)serializers, project (de)moralizer</string> - <string name="contributor_description_magnuf">Legacy UI</string> - <string name="contributor_description_kenji">Legacy UI</string> - <string name="contributor_description_justjanne">Rewrite, UI, Annotation Processors, Backend</string> -</resources> diff --git a/app/src/main/res/values/strings_defaults.xml b/app/src/main/res/values/strings_defaults.xml deleted file mode 100644 index bbd899585ddac9c99469453b4f1ef00051b7f8e4..0000000000000000000000000000000000000000 --- a/app/src/main/res/values/strings_defaults.xml +++ /dev/null @@ -1,34 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<resources> - <string name="default_bufferviewconfig_name">All Chats</string> - - <string name="default_identity_identity_name">Default Identity</string> - <string name="default_identity_name" translatable="false"><empty></string> - <string name="default_identity_realname">Quassel IRC User</string> - <string name="default_identity_nick" translatable="false">quassel%1$d</string> - <string name="default_identity_ident" translatable="false">quassel</string> - <string name="default_identity_awayreason">Gone fishing.</string> - <string name="default_identity_autoawayreason">Not here. No, really. not here!</string> - <string name="default_identity_detachawayreason">All Quassel clients vanished from the face of the earth…</string> - <string name="default_identity_kickreason">Kindergarten is elsewhere!</string> - <string name="default_identity_partreason">https://quassel-irc.org - Chat comfortably. Anywhere.</string> - <string name="default_identity_quitreason">https://quassel-irc.org - Chat comfortably. Anywhere.</string> -</resources> diff --git a/app/src/main/res/values/strings_error.xml b/app/src/main/res/values/strings_error.xml deleted file mode 100644 index c42da2a06087a0490af7c44ddef7802c8b7f459c..0000000000000000000000000000000000000000 --- a/app/src/main/res/values/strings_error.xml +++ /dev/null @@ -1,49 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<resources> - <string name="label_error_login">Login Error</string> - <string name="label_error_setup">Setup Error</string> - <string name="label_error_init">Connection Error</string> - <string name="label_error_ssl">SSL Error</string> - <string name="label_error_ssl_required_unavailable">SSL is required for this connection but the core does not support it.</string> - <string name="label_error_certificate">Certificate Error</string> - <string name="label_error_certificate_no_certificate">No certificate available</string> - <string name="label_error_certificate_no_hostname">No hostname available</string> - <string name="label_error_certificate_invalid"><![CDATA[ - <p>The certificate with fingerprint<br/> - <code>%1$s</code><br/> - is only valid from %2$s to %3$s</p> - ]]></string> - <string name="label_error_certificate_untrusted"><![CDATA[ - <p>The certificate with fingerprint<br/> - <code>%1$s</code><br/> - is not trusted.</p> - ]]></string> - <string name="label_error_certificate_no_match"><![CDATA[ - <p>The certificate with fingerprint<br/> - <code>%1$s</code><br/> - is not valid for %2$s.</p> - ]]></string> - - <string name="label_error_unknown_host">Host not found: %1$s</string> - <string name="label_error_invalid_protocol_version">Invalid protocol: %1$d</string> - <string name="label_error_connection">Error encountered during connection: %1$s (%2$s)</string> - <string name="label_error_connection_closed">Error: Connection was unexpectedly closed</string> -</resources> diff --git a/app/src/main/res/values/strings_format.xml b/app/src/main/res/values/strings_format.xml deleted file mode 100644 index a363b457ceacae21c73eb55b8bcdf7ccae410ef6..0000000000000000000000000000000000000000 --- a/app/src/main/res/values/strings_format.xml +++ /dev/null @@ -1,29 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<resources> - <string name="label_bold">Bold</string> - <string name="label_italic">Italic</string> - <string name="label_strikethrough">Strikethrough</string> - <string name="label_underline">Underline</string> - <string name="label_monospace">Monospace</string> - <string name="label_foreground">Foreground Color</string> - <string name="label_background">Background Color</string> - <string name="label_clear_formatting">Clear Formatting</string> -</resources> diff --git a/app/src/main/res/values/strings_info.xml b/app/src/main/res/values/strings_info.xml deleted file mode 100644 index 827ec1560b3dbbfc9d03fa0d018bfd5f00007141..0000000000000000000000000000000000000000 --- a/app/src/main/res/values/strings_info.xml +++ /dev/null @@ -1,47 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<resources> - <string name="label_user_away">Away</string> - <string name="label_user_away_reason">Reason</string> - <string name="label_user_identity">Identity</string> - <string name="label_user_account">Account</string> - <string name="label_user_ident">Ident</string> - <string name="label_user_host">Host</string> - <string name="label_user_server">Server</string> - <string name="label_user_common_channels">Common Channels</string> - - <string name="label_core_version">Version</string> - <string name="label_core_uptime">Uptime</string> - <string name="label_core_security">Security</string> - <string name="label_core_clients">Clients</string> - <string name="label_core_online_since">Online since %1$s</string> - <string name="label_core_connected_since">Connected since %1$s</string> - <string name="label_core_connection_verified_by">Connection verified by %1$s</string> - <string name="label_core_connection_protocol">The connection uses %1$s</string> - <string name="label_core_connection_ciphersuite">The connection is encrypted and authenticated using %1$s and uses %2$s as the key exchange mechanism</string> - <string name="label_core_connection_ciphersuite_13">The connection is encrypted and authenticated using %1$s</string> - <string name="label_core_connection_verified_by_unknown">Unknown</string> - <string name="label_core_connection_insecure">Insecure Connection</string> - - <string name="property_group_ircchannel_channel">Channel</string> - <string name="property_ircchannel_topic">Topic</string> - <string name="property_ircchannel_topic_action_edit">Edit Topic</string> - <string name="property_ircchannel_topic_default">No Topic Set</string> -</resources> diff --git a/app/src/main/res/values/strings_messages.xml b/app/src/main/res/values/strings_messages.xml deleted file mode 100644 index 6153889e71433b117b513e9966f378aee263c8f0..0000000000000000000000000000000000000000 --- a/app/src/main/res/values/strings_messages.xml +++ /dev/null @@ -1,61 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<resources> - <plurals name="message_netsplit_join"> - <item quantity="one">Netsplit between %1$s and %2$s ended: %3$d user joined: %4$s</item> - <item quantity="other">Netsplit between %1$s and %2$s ended: %3$d users joined: %4$s</item> - </plurals> - <plurals name="message_netsplit_quit"> - <item quantity="one">Netsplit between %1$s and %2$s: %3$d user quit: %4$s</item> - <item quantity="other">Netsplit between %1$s and %2$s: %3$d users quit: %4$s</item> - </plurals> - <string name="message_type_join">Join</string> - <string name="message_type_part">Part</string> - <string name="message_type_quit">Quit</string> - <string name="message_type_nick">Nick</string> - <string name="message_type_mode">Mode</string> - - <string name="message_type_topic">Topic</string> - <string name="message_format_copy">[%1$s] %2$s</string> - - <string name="message_format_copy_complex">[%1$s] <%2$s> %3$s</string> - <string name="message_format_action">— %1$s%2$s %3$s</string> - <string name="message_format_notice">[%1$s%2$s] %3$s</string> - <string name="message_format_nick">%1$s%2$s is now known as %3$s%4$s</string> - <string name="message_format_nick_self">You are now known as %1$s%2$s</string> - <string name="message_format_mode">Mode %1$s by %2$s%3$s</string> - <string name="message_format_join">%1$s%2$s joined %3$s</string> - <string name="message_format_part_1">%1$s%2$s left</string> - <string name="message_format_part_2">%1$s%2$s left (%3$s)</string> - <string name="message_format_quit_1">%1$s%2$s quit</string> - <string name="message_format_quit_2">%1$s%2$s quit (%3$s)</string> - <string name="message_format_kick_1">%1$s was kicked by %2$s%3$s</string> - <string name="message_format_kick_2">%1$s was kicked by %2$s%3$s (%4$s)</string> - <string name="message_format_kill_1">%1$s was killed by %2$s%3$s</string> - <string name="message_format_kill_2">%1$s was killed by %2$s%3$s (%4$s)</string> - <string-array name="message_filter_types" translatable="false"> - <item>@string/message_type_join</item> - <item>@string/message_type_part</item> - <item>@string/message_type_quit</item> - <item>@string/message_type_nick</item> - <item>@string/message_type_mode</item> - <item>@string/message_type_topic</item> - </string-array> -</resources> diff --git a/app/src/main/res/values/strings_preferences.xml b/app/src/main/res/values/strings_preferences.xml deleted file mode 100644 index 1105843140ddadf109238bd6a209d1686aa54f60..0000000000000000000000000000000000000000 --- a/app/src/main/res/values/strings_preferences.xml +++ /dev/null @@ -1,347 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<resources> - <string name="preference_appearance_title">Appearance</string> - - <string name="preference_theme_key" translatable="false">theme</string> - <string name="preference_theme_title">Theme</string> - <string name="preference_theme_entry_material_daynight">Material (Auto)</string> - <string name="preference_theme_entry_material_light">Material (Light)</string> - <string name="preference_theme_entry_material_dark">Material (Dark)</string> - <string name="preference_theme_entry_quassel_daynight">Quassel (Auto)</string> - <string name="preference_theme_entry_quassel_light">Quassel (Light)</string> - <string name="preference_theme_entry_quassel_dark">Quassel (Dark)</string> - <string name="preference_theme_entry_amoled">AMOLED</string> - <string name="preference_theme_entry_solarized_daynight">Solarized (Auto)</string> - <string name="preference_theme_entry_solarized_light">Solarized (Light)</string> - <string name="preference_theme_entry_solarized_dark">Solarized (Dark)</string> - <string name="preference_theme_entry_gruvbox_daynight">Gruvbox (Auto)</string> - <string name="preference_theme_entry_gruvbox_light">Gruvbox (Light)</string> - <string name="preference_theme_entry_gruvbox_dark">Gruvbox (Dark)</string> - <string name="preference_theme_entry_dracula">Dracula</string> - <string name="preference_input_enter_key" translatable="false">input_enter</string> - <string name="preference_input_enter_title">Enter key on keyboard</string> - - <string name="preference_input_enter_entry_emoji">Emoji</string> - <string name="preference_input_enter_entry_send">Send</string> - <string name="preference_input_enter_entry_newline">New Line</string> - <string name="preference_show_lag_key" translatable="false">show_lag</string> - <string name="preference_show_lag_title">Show Lag</string> - <string name="preference_show_lag_summary">Displays the lag between client and core in the action bar</string> - <string name="preference_keep_screen_on_key" translatable="false">keep_screen_on</string> - - <string name="preference_keep_screen_on_title">Keep Screen Active</string> - <string name="preference_keep_screen_on_summary">Prevents the device from going to sleep while the app is in foreground</string> - <string name="preference_language_key" translatable="false">language</string> - - <string name="preference_language_title">Language</string> - <string name="preference_language_entry_auto">System Default</string> - <string name="preference_language_entry_en" translatable="false">English</string> - - <string name="preference_language_entry_en_gb" translatable="false">English (Great Britain)</string> - <string name="preference_language_entry_de" translatable="false">Deutsch</string> - <string name="preference_language_entry_fr" translatable="false">Français</string> - <string name="preference_language_entry_fr_ca" translatable="false">Français (Canadien)</string> - <string name="preference_language_entry_it" translatable="false">Italiano</string> - <string name="preference_language_entry_lt" translatable="false">Lietuvių</string> - <string name="preference_language_entry_nl" translatable="false">Nederlands</string> - <string name="preference_language_entry_pt" translatable="false">Português</string> - <string name="preference_language_entry_sr" translatable="false">Srpski (latinica)</string> - <string name="preference_redirection_title">Message Redirection</string> - <string name="preference_redirection_user_notices_key" translatable="false">redirection_user_notices</string> - <string name="preference_redirection_user_notices_title">Redirect User Notices</string> - <string name="preference_redirection_user_notices_summary">Displays user notices in the currently open channel</string> - <string name="preference_redirection_server_notices_key" translatable="false">redirection_user_notices</string> - <string name="preference_redirection_server_notices_title">Redirect Server Notices</string> - - - <string name="preference_redirection_server_notices_summary">Displays server notices in the currently open channel</string> - - <string name="preference_redirection_errors_key" translatable="false">redirection_errors</string> - <string name="preference_redirection_errors_title">Redirect Errors</string> - <string name="preference_redirection_errors_summary">Displays errors in the currently open channel</string> - - <string name="preference_notifications_title">Notifications</string> - <string name="preference_notification_query_key" translatable="false">notification_query</string> - <string name="preference_notification_query_title">Direct Messages</string> - - <string name="preference_notification_channel_key" translatable="false">notification_channel</string> - <string name="preference_notification_channel_title">Channel Messages</string> - <string name="preference_notification_other_key" translatable="false">notification_other</string> - - - <string name="preference_notification_other_title">Other Messages</string> - - <string name="preference_notification_sound_key" translatable="false">notification_sound</string> - <string name="preference_notification_sound_title">Notification Sound</string> - - <string name="preference_notification_vibration_key" translatable="false">notification_vibration</string> - <string name="preference_notification_vibration_title">Vibration</string> - - <string name="preference_notification_light_key" translatable="false">notification_light</string> - <string name="preference_notification_light_title">LED</string> - - <string name="preference_notification_mark_read_on_swipe_key" translatable="false">mark_read_on_swipe</string> - <string name="preference_notification_mark_read_on_swipe_title">Mark channel read when swiping notifications</string> - - <string name="preference_notification_mark_read_on_swipe_summary">Marks all messages in a channel as read when a notification for the channel is swiped away</string> - <string name="preference_notification_network_name_in_notification_title_key" translatable="false">network_name_in_notification_title</string> - - <string name="preference_notification_network_name_in_notification_title_title">Show network name in notifications title</string> - <string name="preference_notification_show_all_activities_in_toolbar_key" translatable="false">show_all_activities_in_toolbar</string> - - <string name="preference_notification_show_all_activities_in_toolbar_title">Mark all activities in toolbar</string> - <string name="preference_notification_show_all_activities_in_toolbar_summary">Displays a colored bubble in the toolbar for all chat activities</string> - <string name="preference_notification_configure_key" translatable="false">notification_configure</string> - - <string name="preference_notification_configure_title">Configure Notifications</string> - <string name="preference_notifications_level_all">All Messages</string> - - <string name="preference_notifications_level_highlight">Mentions</string> - <string name="preference_notifications_level_none">Never</string> - <string name="preference_messages_title">Messages</string> - - <string name="preference_monospace_key" translatable="false">monospace</string> - <string name="preference_monospace_title">Use Monospace Font</string> - - <string name="preference_textsize_key" translatable="false">fontsize</string> - <string name="preference_textsize_title">Text Size</string> - <string name="preference_show_seconds_key" translatable="false">show_seconds</string> - <string name="preference_show_seconds_title">Show Seconds</string> - <string name="preference_use_24h_clock_key" translatable="false">use_24h_clock</string> - - - <string name="preference_use_24h_clock_title">Use 24h Clock</string> - - <string name="preference_colorize_mirc_key" translatable="false">colorize_mirc</string> - <string name="preference_colorize_mirc_title">Use mIRC Colors</string> - - <string name="preference_colorize_mirc_summaryon">Show mIRC colors in messages</string> - <string name="preference_colorize_mirc_summaryoff">Strip mIRC colors from messages</string> - - <string name="preference_colorize_nicknames_key" translatable="false">colorize_nicknames</string> - <string name="preference_colorize_nicknames_title">Colorize nicknames</string> - - <string name="preference_colorize_nicknames_entry_all">All nicks</string> - <string name="preference_colorize_nicknames_entry_all_but_mine">All but own nick</string> - - <string name="preference_colorize_nicknames_entry_none">No nicks</string> - <string name="preference_show_prefix_key" translatable="false">show_prefix</string> - <string name="preference_show_prefix_title">Show sendermodes</string> - <string name="preference_show_prefix_entry_all">All modes</string> - - <string name="preference_show_prefix_entry_highest">Highest mode</string> - <string name="preference_show_prefix_entry_none">No modes</string> - <string name="preference_hostmask_actions_key" translatable="false">hostmask_actions</string> - <string name="preference_hostmask_actions_title">Show Hostmask in actions</string> - <string name="preference_hostmask_actions_summary">Display the full nick!ident@host in join/part/quit messages</string> - <string name="preference_nicks_on_new_line_key" translatable="false">nicks_on_new_line</string> - <string name="preference_nicks_on_new_line_title">Separate Nicknames</string> - - <string name="preference_nicks_on_new_line_summary">Shows nicknames on a separate line</string> - <string name="preference_show_realnames_key" translatable="false">show_realnames</string> - <string name="preference_show_realnames_title">Show Realnames</string> - <string name="preference_show_avatars_key" translatable="false">show_avatars</string> - <string name="preference_show_avatars_title">Show Avatars</string> - <string name="preference_square_avatars_key" translatable="false">square_avatars</string> - <string name="preference_square_avatars_title">Square Avatars</string> - - <string name="preference_show_irccloud_avatars_key" translatable="false">show_irccloud_avatars</string> - <string name="preference_show_irccloud_avatars_title">Show IRCCloud Avatars</string> - <string name="preference_show_irccloud_avatars_summary">Shows for users without avatar their IRCCloud fallback, if available</string> - - <string name="preference_show_gravatar_avatars_key" translatable="false">show_gravatar_avatars</string> - <string name="preference_show_gravatar_avatars_title">Show Gravatar Avatars</string> - <string name="preference_show_gravatar_avatars_summary">Shows for users without avatar their Gravatar fallback, if available</string> - - <string name="preference_show_matrix_avatars_key" translatable="false">show_matrix_avatars</string> - <string name="preference_show_matrix_avatars_title">Show Matrix Avatars</string> - - <string name="preference_show_matrix_avatars_summary">Shows for users without avatar their Matrix fallback, if available</string> - <string name="preference_time_at_end_key" translatable="false">time_at_end</string> - - <string name="preference_time_at_end_title">Right-Aligned Timestamps</string> - <string name="preference_time_at_end_summary">Aligns timestamps at the end of each message</string> - - <string name="preference_larger_emoji_key" translatable="false">larger_emoji</string> - <string name="preference_larger_emoji_title">Larger Reactions</string> - <string name="preference_larger_emoji_summary">Increase the size of emoji-only messages</string> - - <string name="preference_highlight_own_messages_key" translatable="false">highlight_own_messages</string> - <string name="preference_highlight_own_messages_title">Highlight own messages</string> - <string name="preference_highlight_own_messages_summary">Shows your own messages more prominently</string> - - <string name="preference_replace_emoji_key" translatable="false">replace_emoji</string> - <string name="preference_replace_emoji_title">Replace Emoji Shortcodes</string> - <string name="preference_replace_emoji_summary">Automatically replaces shortcodes such as :+1: or :like: with emoji</string> - - <string name="preference_autocomplete_title">Autocomplete</string> - <string name="preference_autocomplete_sender_doubleclick_key" translatable="false">autocomplete_sender_doubleclick</string> - <string name="preference_autocomplete_sender_doubleclick_title">Sender Autocomplete</string> - - <string name="preference_autocomplete_sender_doubleclick_summary">Doubleclick on a message to autocomplete its sender</string> - <string name="preference_autocomplete_button_key" translatable="false">autocomplete_button</string> - <string name="preference_autocomplete_button_title">Autocomplete Button</string> - - <string name="preference_autocomplete_button_summary">Shows a button on the left of the input line that triggers tabcomplete</string> - <string name="preference_autocomplete_doubletap_key" translatable="false">autocomplete_doubletap</string> - <string name="preference_autocomplete_doubletap_title">Double tap to autocomplete</string> - - <string name="preference_autocomplete_doubletap_summary">Suggest nicks and channels after doubleclicking on the input field</string> - <string name="preference_autocomplete_auto_key" translatable="false">autocomplete_auto</string> - <string name="preference_autocomplete_auto_title">Show automatically</string> - - - <string name="preference_autocomplete_auto_summary">Suggest nicks and channels after entering the first 3 characters</string> - - <string name="preference_autocomplete_prefix_key" translatable="false">autocomplete_prefix</string> - <string name="preference_autocomplete_prefix_title">Show after prefix</string> - <string name="preference_autocomplete_prefix_summary">Suggest nicks and channels after entering @ or #</string> - - <string name="preference_autocomplete_nicks_key" translatable="false">autocomplete_nicks</string> - <string name="preference_autocomplete_nicks_title">Autocomplete Nicknames</string> - <string name="preference_autocomplete_buffers_key" translatable="false">autocomplete_buffers</string> - - <string name="preference_autocomplete_buffers_title">Autocomplete Chats</string> - <string name="preference_autocomplete_aliases_key" translatable="false">autocomplete_aliases</string> - <string name="preference_autocomplete_aliases_title">Autocomplete Commands</string> - - <string name="preference_autocomplete_emoji_key" translatable="false">autocomplete_emoji</string> - <string name="preference_autocomplete_emoji_title">Autocomplete Emoji</string> - <string name="preference_backlog_title">Backlog</string> - - <string name="preference_page_size_key" translatable="false">page_size</string> - <string name="preference_page_size_title">Page Size</string> - <string name="preference_page_size_summary">The number of messages loaded and kept in memory at a time</string> - - <string name="preference_initial_amount_key" translatable="false">initial_amount</string> - <string name="preference_initial_amount_title">Initial Amount</string> - - <string name="preference_initial_amount_summary">Number of messages to load when opening a buffer for the first time</string> - <string name="preference_clear_cache_key" translatable="false">clear_cache_key</string> - - <string name="preference_clear_cache_title">Clear Backlog Cache</string> - <string name="preference_connection_title">Connection</string> - - <string name="preference_show_notification_key" translatable="false">show_notification</string> - <string name="preference_show_notification_title">Show notification</string> - - - <string name="preference_show_notification_summary">Keeps Quasseldroid always connected by showing a persistent notification</string> - - <string name="preference_ignore_network_changes_key" translatable="false">ignore_network_changes</string> - <string name="preference_ignore_network_changes_title">Ignore network changes</string> - <string name="preference_ignore_network_changes_summary">Stops Quasseldroid from reconnecting automatically if the network changes</string> - - <string name="preference_notification_id_key" translatable="false">notification_id</string> - <string-array name="preference_theme_entries" translatable="false"> - <item>@string/preference_theme_entry_material_light</item> - <item>@string/preference_theme_entry_material_dark</item> - <item>@string/preference_theme_entry_quassel_light</item> - <item>@string/preference_theme_entry_quassel_dark</item> - <item>@string/preference_theme_entry_amoled</item> - <item>@string/preference_theme_entry_solarized_light</item> - <item>@string/preference_theme_entry_solarized_dark</item> - <item>@string/preference_theme_entry_gruvbox_light</item> - <item>@string/preference_theme_entry_gruvbox_dark</item> - <item>@string/preference_theme_entry_dracula</item> - </string-array> - <string-array name="preference_theme_entryvalues" translatable="false"> - <item>MATERIAL_LIGHT</item> - <item>MATERIAL_DARK</item> - <item>QUASSEL_LIGHT</item> - <item>QUASSEL_DARK</item> - <item>AMOLED</item> - <item>SOLARIZED_LIGHT</item> - <item>SOLARIZED_DARK</item> - <item>GRUVBOX_LIGHT</item> - <item>GRUVBOX_DARK</item> - <item>DRACULA</item> - </string-array> - - <string-array name="preference_input_enter_entries" translatable="false"> - <item>@string/preference_input_enter_entry_emoji</item> - <item>@string/preference_input_enter_entry_send</item> - <item>@string/preference_input_enter_entry_newline</item> - </string-array> - <string-array name="preference_input_enter_entryvalues" translatable="false"> - <item>EMOJI</item> - <item>SEND</item> - <item>NEWLINE</item> - </string-array> - - <string-array name="preference_language_entries" translatable="false"> - <item>@string/preference_language_entry_auto</item> - <item>@string/preference_language_entry_en</item> - <item>@string/preference_language_entry_en_gb</item> - <item>@string/preference_language_entry_de</item> - <item>@string/preference_language_entry_fr</item> - <item>@string/preference_language_entry_fr_ca</item> - <item>@string/preference_language_entry_it</item> - <item>@string/preference_language_entry_lt</item> - <item>@string/preference_language_entry_pt</item> - <item>@string/preference_language_entry_sr</item> - </string-array> - - <string-array name="preference_language_entryvalues" translatable="false"> - <item /> - <item>en</item> - <item>en_gb</item> - <item>de</item> - <item>fr</item> - <item>fr-CA</item> - <item>it</item> - <item>lt</item> - <item>pt</item> - <item>sr</item> - </string-array> - <string-array name="preference_notifications_level_entries" translatable="false"> - <item>@string/preference_notifications_level_all</item> - <item>@string/preference_notifications_level_highlight</item> - <item>@string/preference_notifications_level_none</item> - </string-array> - <string-array name="preference_notifications_level_entryvalues" translatable="false"> - <item>ALL</item> - <item>HIGHLIGHT</item> - <item>NONE</item> - </string-array> - - <string-array name="preference_colorize_nicknames_entries" translatable="false"> - <item>@string/preference_colorize_nicknames_entry_all</item> - <item>@string/preference_colorize_nicknames_entry_all_but_mine</item> - <item>@string/preference_colorize_nicknames_entry_none</item> - </string-array> - <string-array name="preference_colorize_nicknames_entryvalues" translatable="false"> - <item>ALL</item> - <item>ALL_BUT_MINE</item> - <item>NONE</item> - </string-array> - <string-array name="preference_show_prefix_entries" translatable="false"> - <item>@string/preference_show_prefix_entry_all</item> - <item>@string/preference_show_prefix_entry_highest</item> - <item>@string/preference_show_prefix_entry_none</item> - </string-array> - - <string-array name="preference_show_prefix_entryvalues" translatable="false"> - <item>ALL</item> - <item>HIGHEST</item> - <item>NONE</item> - </string-array> -</resources> diff --git a/app/src/main/res/values/strings_settings.xml b/app/src/main/res/values/strings_settings.xml deleted file mode 100644 index a3cbf96b0fe4823ffbf2392db909582e193ad727..0000000000000000000000000000000000000000 --- a/app/src/main/res/values/strings_settings.xml +++ /dev/null @@ -1,158 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<resources> - <string name="settings_networks_title">Networks</string> - <string name="settings_network_title">Network</string> - <string name="settings_network_network_name">Network Name</string> - <string name="settings_network_identity">Identity</string> - <string name="settings_network_sasl_enabled">SASL</string> - <string name="settings_network_sasl_account">Account</string> - <string name="settings_network_sasl_password">Password</string> - <string name="settings_network_sasl_supported">This network supports SASL</string> - <string name="settings_network_sasl_upgrade">Use SASL</string> - <string name="settings_network_autoidentify_enabled">Auto Identify</string> - <string name="settings_network_autoidentify_service">Service</string> - <string name="settings_network_autoidentify_password">Password</string> - <string name="settings_network_connection">Connection</string> - <string name="settings_network_perform">Perform</string> - <string name="settings_network_rejoin_channels">Rejoin Channels</string> - <string name="settings_network_autoreconnect_enabled">Autoreconnect</string> - <string name="settings_network_autoreconnect_interval">Interval</string> - <string name="settings_network_autoreconnect_interval_unit">seconds</string> - <string name="settings_network_autoreconnect_attempts">Maximum Attempts</string> - <string name="settings_network_autoreconnect_unlimited">Unlimited Attempts</string> - <string name="settings_network_customratelimits_enabled">Custom Rate Limits</string> - <string name="settings_network_customratelimits_burstsize">Burst Size</string> - <string name="settings_network_customratelimits_unlimited">Unlimited</string> - <string name="settings_network_customratelimits_delay">Delay</string> - <string name="settings_network_customratelimits_interval_unit">seconds</string> - - <string name="settings_networkserver_title">Network Server</string> - <string name="settings_networkserver_connection">Connection</string> - <string name="settings_networkserver_host">Host</string> - <string name="settings_networkserver_port">Port</string> - <string name="settings_networkserver_ssl_enabled">Use SSL</string> - <string name="settings_networkserver_ssl_verify">Verify SSL</string> - <string name="settings_networkserver_password">Password</string> - <string name="settings_networkserver_proxy_enabled">Use Proxy</string> - <string name="settings_networkserver_proxy_type">Type</string> - <string name="settings_networkserver_proxy_type_http">HTTP</string> - <string name="settings_networkserver_proxy_type_socks5">SOCKS 5</string> - <string name="settings_networkserver_proxy_host">Host</string> - <string name="settings_networkserver_proxy_port">Port</string> - <string name="settings_networkserver_proxy_user">Username</string> - <string name="settings_networkserver_proxy_pass">Password</string> - - <string name="settings_identities_title">Identities</string> - <string name="settings_identity_title">Identity</string> - <string name="settings_identity_names">Names</string> - <string name="settings_identity_identity_name">Identity name</string> - <string name="settings_identity_real_name">Real Name</string> - <string name="settings_identity_ident">Ident</string> - <string name="settings_identity_nick">Nickname</string> - <string name="settings_identity_nicks">Nicknames</string> - <string name="settings_identity_messages">Messages</string> - <string name="settings_identity_kick_reason">Kick Reason</string> - <string name="settings_identity_part_reason">Part Reason</string> - <string name="settings_identity_quit_reason">Quit Reason</string> - <string name="settings_identity_away">Away Messages</string> - <string name="settings_identity_away_reason">Away Reason</string> - <string name="settings_identity_detach_away">Away on Detach</string> - <string name="settings_identity_detach_away_reason">Away on Detach Reason</string> - - <string name="settings_chatlists_title">Chatlists</string> - <string name="settings_chatlist_title">Chatlist</string> - <string name="settings_chatlist_ui">User Interface</string> - <string name="settings_chatlist_buffer_view_name">Name</string> - <string name="settings_chatlist_show_search">Show Search</string> - <string name="settings_chatlist_sort_alphabetically">Sort Alphabetically</string> - <string name="settings_chatlist_add_new_buffers_automatically">Add new chats automatically</string> - <string name="settings_chatlist_network">Network</string> - <string name="settings_chatlist_network_all">All Networks</string> - <string name="settings_chatlist_network_create">Create Network…</string> - <string name="settings_chatlist_show_status_buffer">Show Status Buffer</string> - <string name="settings_chatlist_types">Chat Types</string> - <string name="settings_chatlist_show_channels">Show Channels</string> - <string name="settings_chatlist_show_queries">Show Queries</string> - <string name="settings_chatlist_activity">Activity</string> - <string name="settings_chatlist_minimum_activity_no_activity">No Activity</string> - <string name="settings_chatlist_minimum_activity_other_activity">Other Activity</string> - <string name="settings_chatlist_minimum_activity_new_message">New Message</string> - <string name="settings_chatlist_minimum_activity_highlight">Highlight</string> - <string name="settings_chatlist_hide_inactive_buffers">Hide Inactive Chats</string> - <string name="settings_chatlist_hide_inactive_networks">Hide Inactive Networks</string> - - <string name="settings_ignorelist_title">Ignore List</string> - - <string name="settings_ignoreitem_title">Ignore Rule</string> - <string name="settings_ignoreitem_enabled">Enabled</string> - <string name="settings_ignoreitem_ignorerule">Ignore Rule</string> - <string name="settings_ignoreitem_isregex">Regular Expression</string> - <string name="settings_ignoreitem_type">Type</string> - <string name="settings_ignoreitem_type_sender">Sender</string> - <string name="settings_ignoreitem_type_message">Message</string> - <string name="settings_ignoreitem_type_ctcp">Ctcp</string> - <string name="settings_ignoreitem_strictness">Strictness</string> - <string name="settings_ignoreitem_strictness_soft">Dynamic</string> - <string name="settings_ignoreitem_strictness_hard">Permanent</string> - <string name="settings_ignoreitem_scope">Scope</string> - <string name="settings_ignoreitem_scope_global">Global Scope</string> - <string name="settings_ignoreitem_scope_network">Network Scope</string> - <string name="settings_ignoreitem_scope_channel">Channel Scope</string> - <string name="settings_ignoreitem_scoperule">Scope Rule</string> - - <string name="settings_highlightlist_title">Highlights</string> - <string name="settings_highlightlist_highlight_nick">Highlight Nick</string> - <string name="settings_highlightlist_highlight_nick_all_nicks">All Nicks from Identity</string> - <string name="settings_highlightlist_highlight_nick_current_nick">Current Nick</string> - <string name="settings_highlightlist_highlight_nick_none">None</string> - <string name="settings_highlightlist_nicks_case_sensitive">Case Sensitive</string> - <string name="settings_highlightlist_rules">Highlight Rules</string> - <string name="settings_highlightlist_ignore_rules">Highlight Ignore Rules</string> - - <string name="settings_highlightrule_title">Highlight Rule</string> - <string name="settings_highlightrule_enabled">Enabled</string> - <string name="settings_highlightrule_name">Name</string> - <string name="settings_highlightrule_regular_expression">Regular Expression</string> - <string name="settings_highlightrule_case_sensitive">Case Sensitive</string> - <string name="settings_highlightrule_sender">Sender</string> - <string name="settings_highlightrule_channel">Channel</string> - - <string name="settings_aliaslist_title">Aliases</string> - - <string name="settings_aliasitem_title">Alias</string> - <string name="settings_aliasitem_name">Name</string> - <string name="settings_aliasitem_expansion">Expansion</string> - - <string name="settings_networkconfig_title">IRC Config</string> - <string name="settings_networkconfig_ping_timeout">Ping Timeout Detection</string> - <string name="settings_networkconfig_ping_interval">Ping Interval</string> - <string name="settings_networkconfig_ping_interval_unit">seconds</string> - <string name="settings_networkconfig_max_ping_count">Disconnect after</string> - <string name="settings_networkconfig_max_ping_count_unit">missed pings</string> - <string name="settings_networkconfig_auto_who">Automatic User Info Lookup</string> - <string name="settings_networkconfig_auto_who_interval">Update interval</string> - <string name="settings_networkconfig_auto_who_interval_unit">seconds</string> - <string name="settings_networkconfig_auto_who_nick_limit">Ignore channels with more than</string> - <string name="settings_networkconfig_auto_who_nick_limit_unit">users</string> - <string name="settings_networkconfig_auto_who_delay">Minimum delay between requests</string> - <string name="settings_networkconfig_auto_who_delay_unit">seconds</string> - <string name="settings_networkconfig_standard_ctcp">Standard-Compliant CTCP behavior</string> -</resources> diff --git a/app/src/main/res/values/strings_setup.xml b/app/src/main/res/values/strings_setup.xml deleted file mode 100644 index 3e1d4aabd8376b2b458d90e3daef8e229977daf7..0000000000000000000000000000000000000000 --- a/app/src/main/res/values/strings_setup.xml +++ /dev/null @@ -1,101 +0,0 @@ -<!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<resources> - <!-- Account Selection --> - <string name="slide_account_select_title">Select Account</string> - <string name="slide_account_select_description">Please select an account from the list or add one</string> - <string name="label_user_on_host">%1$s on %2$s:%3$d</string> - - <!-- Account Setup --> - - <!-- Account Connection --> - <string name="slide_account_connection_title">Connection</string> - <string name="slide_account_connection_description">First, please choose which server your core is hosted on.</string> - - <string name="label_connection_host">Host</string> - <string name="label_connection_port">Port</string> - <string name="label_connection_ssl">Require SSL</string> - - <string name="hint_invalid_host">Not a valid hostname</string> - <string name="hint_invalid_port">Not a valid port</string> - - <!-- Account User --> - <string name="slide_account_user_title">Your Account</string> - <string name="slide_account_user_description">Now, please enter the username and password for your account on the core. If you just created that core, we’ll set up this account for you</string> - - <string name="label_account_user">Username</string> - <string name="label_account_pass">Password</string> - - <string name="hint_invalid_user">Username can not be empty</string> - - <!-- Account Name --> - <string name="slide_account_name_title">Customize Account</string> - <string name="slide_account_name_description">Give this account a name</string> - - <string name="label_account_name">Account name</string> - - <string name="hint_invalid_name">Name can not be empty</string> - - <!-- Core Setup --> - - <string name="setup_core_title">Setup Core</string> - - <!-- Core Authenticator Select --> - <string name="slide_core_authenticator_select_title">Select Authentication Backend</string> - <string name="slide_core_authenticator_select_description">Please select an authentication backend for the Quassel Core to use for authenticating users.</string> - - <!-- Core Backend Select --> - <string name="slide_core_backend_select_title">Select Storage Backend</string> - <string name="slide_core_backend_select_description">Please select a database backend for the Quassel Core storage to store the backlog and other data in.</string> - - <string name="label_backend">Backend</string> - - <!-- Core Backend Config --> - <string name="slide_core_backend_setup_title">Configure Storage Backend</string> - <string name="slide_core_backend_setup_description">Please configure the selected database backend.</string> - - <string name="setup_core_backend_no_options">This backend has no configuration options, you’re done here!</string> - - <!-- User Setup --> - - <string name="setup_user_title">Setup User</string> - - <!-- User Identity --> - <string name="slide_user_identity_title">Setup Identity</string> - <string name="slide_user_identity_description">Please choose a nickname</string> - - <string name="hint_invalid_nick">Not a valid nick</string> - - <!-- User Network --> - <string name="slide_user_network_title">Setup Network</string> - <string name="slide_user_network_description">Select a network to connect to.</string> - - <string name="label_network_custom">Custom Network…</string> - - <!-- User Channels --> - <string name="slide_user_channels_title">Setup Channels</string> - <string name="slide_user_channels_description">Select what channels to join.</string> - - <string name="label_channels">Channels</string> - - <!-- Network Setup --> - - <string name="setup_network_title">Setup Network</string> -</resources> diff --git a/app/src/main/res/values/strings_status.xml b/app/src/main/res/values/strings_status.xml deleted file mode 100644 index d45510176943ab0973e8cb1118b6c751dc1a8636..0000000000000000000000000000000000000000 --- a/app/src/main/res/values/strings_status.xml +++ /dev/null @@ -1,27 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<resources> - <string name="label_status_disconnected">Disconnected</string> - <string name="label_status_connecting">Connecting</string> - <string name="label_status_handshake">Handshake</string> - <string name="label_status_init">Init</string> - <string name="label_status_connected">Connected</string> - <string name="label_status_closed">Connection Lost</string> -</resources> diff --git a/app/src/main/res/values/styles_widgets.xml b/app/src/main/res/values/styles_widgets.xml deleted file mode 100644 index 93db80380ca6a1f1e89d0efe4226c80115c56899..0000000000000000000000000000000000000000 --- a/app/src/main/res/values/styles_widgets.xml +++ /dev/null @@ -1,433 +0,0 @@ -<!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<resources> - - <style name="Widget" /> - - <style name="Widget.RtlConformTextView" parent=""> - <item name="android:textAlignment">gravity</item> - <item name="android:textDirection">locale</item> - </style> - - <style name="Widget.Button.Borderless" parent="Widget.MaterialComponents.Button.TextButton"> - <item name="android:textColor">?attr/colorTextPrimary</item> - </style> - - <style name="Widget.Button.Borderless.Colored" parent="Widget.MaterialComponents.Button.TextButton"> - <item name="android:textColor">?attr/colorAccent</item> - </style> - - <style name="Widget.Button" parent="Widget.MaterialComponents.Button"> - <item name="backgroundTint">?attr/colorBackgroundCard</item> - <item name="android:textColor">?attr/colorTextPrimary</item> - </style> - - <style name="Widget.Button.Colored" parent="Widget.MaterialComponents.Button"> - <item name="android:textColor">?attr/colorOnPrimary</item> - <item name="backgroundTint">?attr/colorPrimary</item> - </style> - - <style name="Widget.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar"> - <item name="drawerArrowStyle">@style/Widget.DrawerArrowToggle</item> - </style> - - <style name="Widget.AppBarOverlay.Auto" parent="Widget.AppBarOverlay"> - <item name="drawerArrowStyle">@style/Widget.DrawerArrowToggle</item> - <item name="colorControlNormal">?colorTextPrimary</item> - <item name="android:textColorPrimary">?colorTextPrimary</item> - <item name="android:textColorSecondary">?colorTextSecondary</item> - <item name="android:actionModeBackground">?colorPrimary</item> - </style> - - <style name="Widget.AppBarOverlay.Light" parent="ThemeOverlay.AppCompat.ActionBar"> - <item name="drawerArrowStyle">@style/Widget.DrawerArrowToggle.Light</item> - </style> - - <style name="Widget.AppBarOverlay.Light.Auto" parent="Widget.AppBarOverlay.Light"> - <item name="colorControlNormal">?colorTextPrimary</item> - <item name="android:textColor">?colorTextPrimary</item> - <item name="android:textColorPrimary">?colorTextPrimary</item> - <item name="android:textColorSecondary">?colorTextSecondary</item> - </style> - - <style name="Widget.AppBarOverlay.Light.DarkHead" parent="Widget.AppBarOverlay.Light"> - <item name="colorControlNormal">?colorTextPrimaryInverse</item> - <item name="android:textColor">?colorTextPrimaryInverse</item> - <item name="android:textColorPrimary">?colorTextPrimaryInverse</item> - <item name="android:textColorSecondary">?colorTextSecondaryInverse</item> - <item name="android:actionModeBackground">?colorPrimary</item> - </style> - - <style name="Widget.TabLayout.Auto" parent="Widget.Design.TabLayout"> - <item name="tabIndicatorColor">?colorAccent</item> - <item name="tabIndicatorHeight">3dp</item> - <item name="tabBackground">?backgroundMenuItem</item> - <item name="tabSelectedTextColor">?colorAccent</item> - <item name="android:textColor">?colorTextPrimary</item> - </style> - - <style name="Widget.DrawerArrowToggle" parent="Widget.AppCompat.DrawerArrowToggle"> - <item name="color">?attr/colorControlNormal</item> - </style> - - <style name="Widget.DrawerArrowToggle.Light" parent="Widget.AppCompat.DrawerArrowToggle"> - <item name="color">?attr/colorControlNormal</item> - </style> - - <style name="Widget.PopupOverlay" parent="ThemeOverlay.AppCompat" /> - - <style name="Widget.PopupOverlay.Auto" parent="Widget.PopupOverlay"> - <item name="android:colorBackground">?colorBackgroundCard</item> - </style> - - <style name="Widget.PopupOverlay.Light" parent="ThemeOverlay.AppCompat.Light" /> - - <style name="Widget.PopupOverlay.Light.Auto" parent="Widget.PopupOverlay.Light"> - <item name="android:textColor">?colorTextPrimary</item> - <item name="android:colorBackground">?colorBackgroundCard</item> - </style> - - <style name="Widget.DialogTheme" parent="Theme.AppCompat.Dialog.Alert" /> - - <style name="Widget.DialogTheme.Light" parent="Theme.AppCompat.Light.Dialog.Alert" /> - - <style name="Widget.Button.Format" parent=""> - <item name="android:layout_width">48dp</item> - <item name="android:layout_height">48dp</item> - <item name="android:layout_gravity">center</item> - <item name="android:background">?backgroundMenuItemRounded</item> - </style> - - <style name="Widget.MaterialSpinner" parent="Widget.AppCompat.Spinner"> - <item name="android:popupBackground">?colorBackground</item> - <item name="android:padding">0dip</item> - </style> - - <style name="Widget.FullWidthSpinner" parent=""> - <item name="android:layout_width">match_parent</item> - <item name="android:layout_height">wrap_content</item> - <item name="android:paddingLeft">0dip</item> - <item name="android:paddingRight">0dip</item> - <item name="android:popupBackground">?colorBackground</item> - </style> - - <style name="Widget.CustomSpinnerLayout" parent="Widget.MaterialSpinnerLayout.OutlinedBox"> - <item name="android:textColorHint">?colorTextSecondary</item> - <item name="md_hintTextColor">?colorAccent</item> - <item name="md_boxStrokeColor">@color/color_outlined_stroke</item> - </style> - - <style name="Widget.CustomTextInput" parent="Widget.MaterialComponents.TextInputLayout.OutlinedBox"> - <item name="android:textColorHint">?colorTextSecondary</item> - <item name="hintTextColor">?colorAccent</item> - <item name="boxStrokeColor">@color/color_outlined_stroke</item> - <item name="passwordToggleTint">@color/color_icons</item> - </style> - - <style name="Widget.CoreSettings.Wrapper" parent=""> - <item name="android:layout_width">match_parent</item> - <item name="android:layout_height">wrap_content</item> - <item name="android:orientation">vertical</item> - <item name="android:paddingStart">?listPreferredItemPaddingLeft</item> - <item name="android:paddingLeft">?listPreferredItemPaddingLeft</item> - <item name="android:paddingEnd">?listPreferredItemPaddingRight</item> - <item name="android:paddingRight">?listPreferredItemPaddingRight</item> - <item name="android:paddingTop">8dp</item> - <item name="android:paddingBottom">8dp</item> - </style> - - <style name="Widget.CoreSettings.PrimaryItemGroupHeader" parent=""> - <item name="android:layout_width">match_parent</item> - <item name="android:layout_height">wrap_content</item> - <item name="android:background">?selectableItemBackground</item> - <item name="android:gravity">center_vertical</item> - <item name="android:minHeight">?listPreferredItemHeightSmall</item> - <item name="android:paddingEnd">?listPreferredItemPaddingRight</item> - <item name="android:paddingLeft">?listPreferredItemPaddingLeft</item> - <item name="android:paddingRight">?listPreferredItemPaddingRight</item> - <item name="android:paddingStart">?listPreferredItemPaddingLeft</item> - </style> - - <style name="Widget.CoreSettings.PrimaryItemGroup" parent=""> - <item name="android:layout_width">match_parent</item> - <item name="android:layout_height">wrap_content</item> - <item name="android:layout_marginLeft">72dp</item> - <item name="android:layout_marginStart">72dp</item> - <item name="android:orientation">vertical</item> - </style> - - <style name="Widget.CoreSettings.PrimaryItem" parent=""> - <item name="android:layout_width">match_parent</item> - <item name="android:layout_height">wrap_content</item> - <item name="android:orientation">vertical</item> - <item name="android:visibility">gone</item> - <item name="android:layout_marginLeft">56dp</item> - </style> - - <style name="Widget.CoreSettings.PrimaryItemSwitch" parent="Widget.RtlConformTextView"> - <item name="android:layout_width">match_parent</item> - <item name="android:layout_height">wrap_content</item> - <item name="android:layout_gravity">center_vertical</item> - <item name="android:paddingTop">10dp</item> - <item name="android:paddingBottom">10dp</item> - <item name="android:gravity">center_vertical</item> - <item name="android:textAppearance">?android:textAppearanceMedium</item> - <item name="android:textSize">16sp</item> - <item name="android:textColor">?colorTextPrimary</item> - </style> - - <style name="Widget.CoreSettings.PrimaryItemIcon" parent=""> - <item name="android:layout_width">24dp</item> - <item name="android:layout_height">24dp</item> - <item name="android:layout_gravity">center_vertical</item> - <item name="android:layout_marginRight">32dp</item> - <item name="android:layout_marginEnd">32dp</item> - <item name="tint">?colorTextSecondary</item> - </style> - - <style name="Widget.CoreSettings.DependentGroup" parent=""> - <item name="android:layout_width">match_parent</item> - <item name="android:layout_height">wrap_content</item> - <item name="android:orientation">vertical</item> - <item name="android:visibility">gone</item> - <item name="android:layout_marginLeft">56dp</item> - <item name="android:layout_marginStart">56dp</item> - </style> - - <style name="Widget.CoreSettings.EditText" parent="Widget.RtlConformTextView"> - <item name="android:layout_width">match_parent</item> - <item name="android:layout_height">wrap_content</item> - <item name="android:textColor">?colorTextPrimary</item> - </style> - - <style name="Widget.CoreSettings.EditTextSuffix" parent="Widget.RtlConformTextView"> - <item name="android:layout_width">wrap_content</item> - <item name="android:layout_height">wrap_content</item> - <item name="android:layout_gravity">bottom|end</item> - <item name="android:layout_marginBottom">12dp</item> - <item name="android:layout_marginEnd">8dp</item> - <item name="android:layout_marginRight">8dp</item> - <item name="android:textColor">?colorTextSecondary</item> - </style> - - <style name="Widget.CoreSettings.EditTextHeader" parent="Widget.RtlConformTextView"> - <item name="android:layout_width">match_parent</item> - <item name="android:layout_height">wrap_content</item> - <item name="android:paddingBottom">8dp</item> - <item name="android:paddingLeft">3dp</item> - <item name="android:paddingRight">3dp</item> - <item name="android:textSize">12sp</item> - </style> - - <style name="Widget.CoreSettings.SubHeader" parent="Widget.RtlConformTextView"> - <item name="android:layout_width">match_parent</item> - <item name="android:layout_height">wrap_content</item> - <item name="android:layout_gravity">center_vertical</item> - <item name="android:paddingTop">10dp</item> - <item name="android:paddingBottom">10dp</item> - <item name="android:paddingRight">16dp</item> - <item name="android:paddingEnd">16dp</item> - <item name="android:gravity">center_vertical</item> - <item name="android:textAppearance">?android:textAppearanceMedium</item> - <item name="android:textSize">14sp</item> - <item name="android:textColor">?colorTextPrimary</item> - <item name="android:textStyle">bold</item> - </style> - - <style name="Widget.CoreSettings.TextView" parent="Widget.RtlConformTextView"> - <item name="android:layout_width">match_parent</item> - <item name="android:layout_height">wrap_content</item> - <item name="android:layout_gravity">center_vertical</item> - <item name="android:paddingTop">10dp</item> - <item name="android:paddingBottom">10dp</item> - <item name="android:paddingRight">16dp</item> - <item name="android:paddingEnd">16dp</item> - <item name="android:gravity">center_vertical</item> - <item name="android:textAppearance">?android:textAppearanceMedium</item> - <item name="android:textSize">14sp</item> - <item name="android:textColor">?colorTextSecondary</item> - </style> - - <style name="Widget.CoreSettings.SelectableTextView" parent="Widget.CoreSettings.TextView"> - <item name="android:textIsSelectable">true</item> - </style> - - <style name="Widget.Info.Header" parent=""> - <item name="android:layout_width">match_parent</item> - <item name="android:layout_height">wrap_content</item> - <item name="android:gravity">center_vertical</item> - <item name="android:minHeight">?listPreferredItemHeight</item> - <item name="android:orientation">vertical</item> - <item name="android:paddingBottom">8dp</item> - <item name="android:paddingEnd">?android:attr/listPreferredItemPaddingRight</item> - <item name="android:paddingLeft">?android:attr/listPreferredItemPaddingLeft</item> - <item name="android:paddingRight">?android:attr/listPreferredItemPaddingRight</item> - <item name="android:paddingStart">?android:attr/listPreferredItemPaddingLeft</item> - <item name="android:paddingTop">8dp</item> - </style> - - <style name="Widget.Info.Header.Name" parent="Widget.RtlConformTextView"> - <item name="android:layout_width">match_parent</item> - <item name="android:layout_height">wrap_content</item> - <item name="android:textAppearance">@style/TextAppearance.AppCompat.Headline</item> - <item name="android:animateLayoutChanges">true</item> - </style> - - <style name="Widget.Info.Header.Description" parent="Widget.RtlConformTextView"> - <item name="android:layout_width">match_parent</item> - <item name="android:layout_height">wrap_content</item> - <item name="android:textAppearance">@style/TextAppearance.AppCompat.Medium</item> - <item name="android:animateLayoutChanges">true</item> - </style> - - <style name="Widget.Info.ActionButton" parent=""> - <item name="android:layout_width">wrap_content</item> - <item name="android:layout_height">wrap_content</item> - <item name="android:background">?backgroundMenuItem</item> - <item name="android:drawablePadding">4dp</item> - <item name="android:fontFamily">sans-serif</item> - <item name="android:minWidth">80dp</item> - <item name="android:paddingBottom">12dp</item> - <item name="android:paddingLeft">10dp</item> - <item name="android:paddingRight">10dp</item> - <item name="android:paddingTop">12dp</item> - <item name="android:textAllCaps">false</item> - <item name="android:textColor">?colorTextSecondary</item> - <item name="android:textStyle">normal</item> - </style> - - <style name="Widget.Info.Section" parent="Widget.RtlConformTextView"> - <item name="android:layout_width">wrap_content</item> - <item name="android:layout_height">wrap_content</item> - <item name="android:gravity">center_vertical</item> - <item name="android:minHeight">48dp</item> - <item name="android:paddingBottom">8dp</item> - <item name="android:paddingEnd">?android:attr/listPreferredItemPaddingRight</item> - <item name="android:paddingLeft">?android:attr/listPreferredItemPaddingLeft</item> - <item name="android:paddingRight">?android:attr/listPreferredItemPaddingRight</item> - <item name="android:paddingStart">?android:attr/listPreferredItemPaddingLeft</item> - <item name="android:paddingTop">8dp</item> - <item name="android:textColor">?colorTextPrimary</item> - <item name="android:textStyle">bold</item> - </style> - - <style name="Widget.Info.Item" parent=""> - <item name="android:layout_width">match_parent</item> - <item name="android:layout_height">wrap_content</item> - <item name="android:gravity">center_vertical</item> - <item name="android:minHeight">?android:attr/listPreferredItemHeightSmall</item> - <item name="android:orientation">vertical</item> - <item name="android:paddingBottom">16dp</item> - <item name="android:paddingEnd">?android:attr/listPreferredItemPaddingRight</item> - <item name="android:paddingLeft">?android:attr/listPreferredItemPaddingLeft</item> - <item name="android:paddingRight">?android:attr/listPreferredItemPaddingRight</item> - <item name="android:paddingStart">?android:attr/listPreferredItemPaddingLeft</item> - <item name="android:paddingTop">16dp</item> - </style> - - <style name="Widget.Info.Item.Content" parent="Widget.RtlConformTextView"> - <item name="android:layout_width">wrap_content</item> - <item name="android:layout_height">wrap_content</item> - <item name="android:textColor">?colorTextPrimary</item> - <item name="android:textSize">16sp</item> - </style> - - <style name="Widget.Info.Item.Description" parent="Widget.RtlConformTextView"> - <item name="android:layout_width">wrap_content</item> - <item name="android:layout_height">wrap_content</item> - <item name="android:textAppearance">?android:attr/textAppearanceSmall</item> - <item name="android:textColor">?colorTextSecondary</item> - </style> - - <style name="Widget.RingtonePreference" parent=""> - <item name="android:layout">@layout/preference_vertical</item> - - <item name="ringtoneType">ringtone</item> - <item name="showSilent">true</item> - <item name="showDefault">true</item> - </style> - - <style name="Widget.Subhead" parent="Widget.RtlConformTextView"> - <item name="android:layout_width">match_parent</item> - <item name="android:layout_height">wrap_content</item> - <item name="android:gravity">center_vertical</item> - <item name="android:minHeight">?listPreferredItemHeightSmall</item> - <item name="android:paddingEnd">?listPreferredItemPaddingRight</item> - <item name="android:paddingLeft">?listPreferredItemPaddingLeft</item> - <item name="android:paddingRight">?listPreferredItemPaddingRight</item> - <item name="android:paddingStart">?listPreferredItemPaddingLeft</item> - <item name="android:textColor">?colorAccent</item> - <item name="android:textSize">14sp</item> - <item name="android:textStyle">bold</item> - </style> - - <style name="Widget.DrawerRecyclerView" parent=""> - <item name="insetBackground">#4000</item> - </style> - - <style name="Widget.FastScroller" parent=""> - <item name="fastScrollPopupBackgroundSize">62dp</item> - <item name="fastScrollPopupBgColor">?colorAccent</item> - <item name="fastScrollPopupTextColor">?colorTextPrimaryInverse</item> - <item name="fastScrollPopupTextSize">32dp</item> - <item name="fastScrollThumbColor">?colorAccent</item> - <item name="fastScrollThumbInactiveColor">?colorDivider</item> - <item name="fastScrollTrackColor">?colorDivider</item> - </style> - - <!-- NavigationDrawerLayout --> - <style name="Widget.NavigationDrawerLayout" parent=""> - <item name="insetBackground">#4000</item> - </style> - - <attr name="icon" format="reference" /> - - <attr name="text" format="string" /> - <attr name="mode"> - <enum name="none" value="0" /> - <enum name="text" value="1" /> - <enum name="icon" value="2" /> - <enum name="progress" value="3" /> - </attr> - <attr name="buttonText" format="string" /> - <declare-styleable name="NavigationDrawerLayout"> - <attr name="insetBackground" /> - </declare-styleable> - - <!-- WarningBarView --> - <declare-styleable name="WarningBarView"> - <attr name="icon" /> - <attr name="text" /> - <attr name="mode" /> - </declare-styleable> - - <!-- InlineSnackBar --> - <declare-styleable name="InlineSnackBar"> - <attr name="text" /> - <attr name="buttonText" /> - </declare-styleable> - - <!-- BannerView --> - <declare-styleable name="BannerView"> - <attr name="icon" /> - <attr name="text" /> - <attr name="buttonText" /> - </declare-styleable> -</resources> diff --git a/app/src/main/res/values/themes.xml b/app/src/main/res/values/themes.xml new file mode 100644 index 0000000000000000000000000000000000000000..80cb390147002bad3cc4125663a04d0c301d1490 --- /dev/null +++ b/app/src/main/res/values/themes.xml @@ -0,0 +1,25 @@ +<resources xmlns:tools="http://schemas.android.com/tools"> + <!-- Base application theme. --> + <style name="Theme.Quasseldroid" parent="Theme.MaterialComponents.DayNight.DarkActionBar"> + <!-- Primary brand color. --> + <item name="colorPrimary">@color/purple_500</item> + <item name="colorPrimaryVariant">@color/purple_700</item> + <item name="colorOnPrimary">@color/white</item> + <!-- Secondary brand color. --> + <item name="colorSecondary">@color/teal_200</item> + <item name="colorSecondaryVariant">@color/teal_700</item> + <item name="colorOnSecondary">@color/black</item> + <!-- Status bar color. --> + <item name="android:statusBarColor" tools:targetApi="l">?attr/colorPrimaryVariant</item> + <!-- Customize your theme here. --> + </style> + + <style name="Theme.Quasseldroid.NoActionBar"> + <item name="windowActionBar">false</item> + <item name="windowNoTitle">true</item> + </style> + + <style name="Theme.Quasseldroid.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar" /> + + <style name="Theme.Quasseldroid.PopupOverlay" parent="ThemeOverlay.AppCompat.Light" /> +</resources> \ No newline at end of file diff --git a/app/src/main/res/values/themes_amoled.xml b/app/src/main/res/values/themes_amoled.xml deleted file mode 100644 index 5c3b2adc68e4ad0015907854b5d95955fc88cf0f..0000000000000000000000000000000000000000 --- a/app/src/main/res/values/themes_amoled.xml +++ /dev/null @@ -1,85 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> - -<!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<resources> - - <style name="Theme.ChatTheme.Amoled" parent="Theme.ChatTheme.Auto"> - <item name="colorPrimary">#000</item> - <item name="colorPrimaryDark">#000</item> - <item name="colorAccent">@color/colorAccent</item> - - <item name="senderColor0">#e90d7f</item> - <item name="senderColor1">#8e55e9</item> - <item name="senderColor2">#b30e0e</item> - <item name="senderColor3">#17b339</item> - <item name="senderColor4">#58afb3</item> - <item name="senderColor5">#9d54b3</item> - <item name="senderColor6">#b39775</item> - <item name="senderColor7">#3176b3</item> - <item name="senderColor8">#e90d7f</item> - <item name="senderColor9">#8e55e9</item> - <item name="senderColorA">#b30e0e</item> - <item name="senderColorB">#17b339</item> - <item name="senderColorC">#58afb3</item> - <item name="senderColorD">#9d54b3</item> - <item name="senderColorE">#b39775</item> - <item name="senderColorF">#3176b3</item> - - <item name="colorTextPrimary">#ffffffff</item> - <item name="colorTextPrimaryInverse">#de000000</item> - <item name="colorTextSecondary">#b3ffffff</item> - <item name="colorTextSecondaryInverse">#8a000000</item> - <item name="colorTextSearch">#ffffffff</item> - <item name="colorTextSearchSecondary">#b3ffffff</item> - <item name="colorDivider">#1FFFFFFF</item> - - <item name="colorForeground">#FFFFFF</item> - <item name="colorForegroundHighlight">#FFFFFF</item> - <item name="colorForegroundHighlightSecondary">#B3FFFFFF</item> - <item name="colorForegroundSecondary">#B3FFFFFF</item> - <item name="colorForegroundAction">#7986cb</item> - <item name="colorForegroundNotice">#916409</item> - <item name="colorForegroundError">#800000</item> - - <item name="colorForegroundMirc">0x0</item> - - <item name="android:windowBackground">@color/amoled_background</item> - <item name="colorBackground">#000000</item> - <item name="colorBackgroundAlpha">#aa000000</item> - <item name="colorBackgroundHighlight">#40ffaf3b</item> - <item name="colorBackgroundSecondary">#10ffaf3b</item> - <item name="colorBackgroundCard">#000000</item> - <item name="colorBackgroundDialog">#000000</item> - - <item name="colorMarkerLine">#800000</item> - - <item name="colorTintActivity">#88cc33</item> - <item name="colorTintMessage">#2277dd</item> - <item name="colorTintHighlight">#ff8811</item> - <item name="colorTintNotification">#D32F2F</item> - - <item name="colorTintSecure">#88cc33</item> - <item name="colorTintPartiallySecure">#ffaf3b</item> - <item name="colorTintInsecure">#BB2222</item> - </style> - - <color name="amoled_background">#000000</color> -</resources> diff --git a/app/src/main/res/values/themes_base.xml b/app/src/main/res/values/themes_base.xml deleted file mode 100644 index 15d454569f5c2eb6ad3cfa72fc3573deda8f42f1..0000000000000000000000000000000000000000 --- a/app/src/main/res/values/themes_base.xml +++ /dev/null @@ -1,207 +0,0 @@ -<!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<resources> - - <style name="Theme.AppTheme" parent="Theme.MaterialComponents.Bridge"> - <item name="colorPrimary">@color/colorPrimary</item> - <item name="colorPrimaryDark">@color/colorPrimaryDark</item> - <item name="colorAccent">@color/colorAccent</item> - - <item name="backgroundMenuItem">@drawable/bg_menuitem_dark</item> - <item name="backgroundMenuItemRounded">@drawable/bg_menuitem_rounded_dark</item> - </style> - - <style name="Theme.AppTheme.Light" parent="Theme.MaterialComponents.Light.DarkActionBar.Bridge"> - <item name="colorPrimary">@color/colorPrimary</item> - <item name="colorPrimaryDark">@color/colorPrimaryDark</item> - <item name="colorAccent">@color/colorAccent</item> - - <item name="backgroundMenuItem">@drawable/bg_menuitem_light</item> - <item name="backgroundMenuItemRounded">@drawable/bg_menuitem_rounded_light</item> - </style> - - <style name="Theme.AppTheme.NoActionBar" parent="Theme.AppTheme"> - <item name="windowActionBar">false</item> - <item name="windowNoTitle">true</item> - - <item name="backgroundMenuItem">@drawable/bg_menuitem_dark</item> - <item name="backgroundMenuItemRounded">@drawable/bg_menuitem_rounded_dark</item> - </style> - - <style name="Theme.AppTheme.Light.NoActionBar" parent="Theme.AppTheme.Light"> - <item name="windowActionBar">false</item> - <item name="windowNoTitle">true</item> - - <item name="backgroundMenuItem">@drawable/bg_menuitem_light</item> - <item name="backgroundMenuItemRounded">@drawable/bg_menuitem_rounded_light</item> - </style> - - <style name="Theme.Base.ChatTheme" parent="Theme.AppTheme.NoActionBar" /> - - <style name="Theme.Base.ChatTheme.Light" parent="Theme.AppTheme.Light.NoActionBar" /> - - <style name="Theme.SetupTheme" parent="Theme.AppTheme.Light"> - <item name="windowActionBar">false</item> - <item name="windowNoTitle">true</item> - - <item name="actionBarPopupTheme">@style/Widget.PopupOverlay.Setup</item> - - <item name="colorTextPrimary">#de000000</item> - <item name="colorTextPrimaryInverse">#ffffffff</item> - <item name="colorTextSecondary">#8a000000</item> - <item name="colorTextSecondaryInverse">#b3ffffff</item> - <item name="colorDivider">#1F000000</item> - - <item name="android:textColorPrimary">?colorTextPrimary</item> - <item name="android:textColorSecondary">?colorTextSecondary</item> - <item name="colorControlNormal">?colorTextPrimary</item> - - <item name="android:windowBackground">@color/material_light_background</item> - <item name="colorBackground">#FAFAFA</item> - </style> - - <style name="Theme.SplashTheme" parent="Theme.AppTheme.Light.NoActionBar"> - <item name="android:windowBackground">@drawable/bg_splash</item> - </style> - - <style name="Theme.ChatTheme" parent="Base.ChatTheme"> - <item name="actionBarTheme">@style/Widget.AppBarOverlay</item> - <item name="formatBarTheme">@style/Widget.AppBarOverlay</item> - <item name="preferenceTheme">@style/PreferenceThemeOverlay.v14.Material</item> - <item name="actionBarPopupTheme">@style/Widget.PopupOverlay</item> - - <item name="android:ringtonePreferenceStyle">@style/Widget.RingtonePreference</item> - - <item name="backgroundMenuItem">@drawable/bg_menuitem_dark</item> - <item name="backgroundMenuItemRounded">@drawable/bg_menuitem_rounded_dark</item> - - <item name="windowActionModeOverlay">true</item> - - <item name="colorTextPrimary">#ffffffff</item> - <item name="colorTextPrimaryInverse">#de000000</item> - <item name="colorTextSecondary">#b3ffffff</item> - <item name="colorTextSecondaryInverse">#8a000000</item> - <item name="colorTextSearch">#de000000</item> - <item name="colorTextSearchSecondary">#8a000000</item> - <item name="colorDivider">#1FFFFFFF</item> - <item name="android:textColorHint">?colorTextSecondary</item> - - <item name="colorForegroundHighlightMonochrome">false</item> - - <item name="colorFill">@color/colorFillDark</item> - <item name="colorOffline">@color/colorOfflineDark</item> - <item name="colorAway">@color/colorAwayDark</item> - - <item name="cardStyle">@style/CardView.Dark</item> - </style> - - <style name="Theme.ChatTheme.Auto" parent="Theme.ChatTheme"> - <item name="actionBarTheme">@style/Widget.AppBarOverlay.Auto</item> - <item name="formatBarTheme">@style/Widget.AppBarOverlay.Auto</item> - <item name="actionBarPopupTheme">@style/Widget.PopupOverlay.Auto</item> - <item name="popupTheme">@style/Widget.PopupOverlay.Auto</item> - - <item name="android:textColor">?colorTextPrimary</item> - <item name="android:textColorSecondary">?colorTextSecondary</item> - <item name="colorControlNormal">?colorTextPrimary</item> - - <item name="colorSecondary">?colorAccent</item> - <item name="colorOnPrimary">?colorTextPrimary</item> - <item name="colorOnSecondary">?colorTextPrimaryInverse</item> - - <item name="colorBackgroundSnackbar">?colorPrimaryDark</item> - <item name="colorBackgroundSearch">?colorBackgroundCard</item> - </style> - - <style name="Theme.ChatTheme.Light" parent="Base.ChatTheme.Light"> - <item name="actionBarTheme">@style/Widget.AppBarOverlay</item> - <item name="formatBarTheme">@style/Widget.AppBarOverlay.Light</item> - <item name="preferenceTheme">@style/PreferenceThemeOverlay.v14.Material</item> - <item name="actionBarPopupTheme">@style/Widget.PopupOverlay.Light</item> - - <item name="android:ringtonePreferenceStyle">@style/Widget.RingtonePreference</item> - - <item name="backgroundMenuItem">@drawable/bg_menuitem_light</item> - <item name="backgroundMenuItemRounded">@drawable/bg_menuitem_rounded_light</item> - - <item name="windowActionModeOverlay">true</item> - <item name="colorTextPrimary">#de000000</item> - <item name="colorTextPrimaryInverse">#ffffffff</item> - <item name="colorTextSecondary">#8a000000</item> - <item name="colorTextSecondaryInverse">#b3ffffff</item> - <item name="colorTextSearch">#de000000</item> - <item name="colorTextSearchSecondary">#8a000000</item> - <item name="colorDivider">#1F000000</item> - <item name="android:textColorHint">?colorTextSecondary</item> - - <item name="colorForegroundHighlightMonochrome">false</item> - - <item name="colorFill">@color/colorFillLight</item> - <item name="colorOffline">@color/colorOfflineLight</item> - <item name="colorAway">@color/colorAwayLight</item> - - <item name="cardStyle">@style/CardView.Light</item> - </style> - - <style name="Theme.ChatTheme.Light.Auto" parent="Theme.ChatTheme.Light"> - <item name="actionBarTheme">@style/Widget.AppBarOverlay.Light.Auto</item> - <item name="formatBarTheme">@style/Widget.AppBarOverlay.Light.Auto</item> - <item name="actionBarPopupTheme">@style/Widget.PopupOverlay.Light.Auto</item> - <item name="popupTheme">@style/Widget.PopupOverlay.Light.Auto</item> - - <item name="android:textColor">?colorTextPrimary</item> - <item name="android:textColorPrimary">?colorTextPrimary</item> - <item name="android:textColorSecondary">?colorTextSecondary</item> - <item name="colorControlNormal">?colorTextPrimary</item> - - <item name="colorSecondary">?colorAccent</item> - <item name="colorOnPrimary">?colorTextPrimary</item> - <item name="colorOnSecondary">?colorTextPrimaryInverse</item> - - <item name="colorBackgroundSnackbar">?colorPrimary</item> - <item name="colorBackgroundSearch">?colorBackgroundCard</item> - </style> - - <style name="Theme.ChatTheme.Light.DarkHead" parent="Theme.ChatTheme.Light"> - <item name="actionBarTheme">@style/Widget.AppBarOverlay.Light.DarkHead</item> - <item name="formatBarTheme">@style/Widget.AppBarOverlay.Light.Auto</item> - <item name="actionBarPopupTheme">@style/Widget.PopupOverlay.Light.Auto</item> - <item name="popupTheme">@style/Widget.PopupOverlay.Light.Auto</item> - - <item name="android:textColor">?colorTextPrimary</item> - <item name="android:textColorPrimary">?colorTextPrimary</item> - <item name="android:textColorSecondary">?colorTextSecondary</item> - <item name="colorControlNormal">?colorTextPrimary</item> - - <item name="colorSecondary">?colorAccent</item> - <item name="colorOnPrimary">?colorTextPrimaryInverse</item> - <item name="colorOnSecondary">?colorTextPrimaryInverse</item> - - <item name="colorBackgroundSnackbar">?colorPrimaryDark</item> - <item name="colorBackgroundSearch">?colorBackgroundCard</item> - </style> - - <style name="Widget.PopupOverlay.Setup" parent="Widget.AppBarOverlay.Light"> - <item name="colorControlNormal">?colorTextPrimaryInverse</item> - <item name="android:textColorPrimary">?colorTextPrimary</item> - <item name="android:textColorSecondary">?colorTextSecondary</item> - <item name="android:actionModeBackground">?colorPrimary</item> - </style> -</resources> diff --git a/app/src/main/res/values/themes_daynight.xml b/app/src/main/res/values/themes_daynight.xml deleted file mode 100644 index 0f7241f7a71ed03258abe2c194a2ba776fead454..0000000000000000000000000000000000000000 --- a/app/src/main/res/values/themes_daynight.xml +++ /dev/null @@ -1,29 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<resources> - - <style name="Theme.ChatTheme.Material_DayNight" parent="Theme.ChatTheme.Material_Light" /> - - <style name="Theme.ChatTheme.Quassel_DayNight" parent="Theme.ChatTheme.Quassel_Light" /> - - <style name="Theme.ChatTheme.Solarized_DayNight" parent="Theme.ChatTheme.Solarized_Light" /> - - <style name="Theme.ChatTheme.Gruvbox_DayNight" parent="Theme.ChatTheme.Gruvbox_Light" /> -</resources> diff --git a/app/src/main/res/values/themes_dracula.xml b/app/src/main/res/values/themes_dracula.xml deleted file mode 100644 index 3d8c2f1755f3c2856357014fb64c4815ca6bb21d..0000000000000000000000000000000000000000 --- a/app/src/main/res/values/themes_dracula.xml +++ /dev/null @@ -1,88 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> - -<!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<resources> - <style name="Theme.ChatTheme.Dracula" parent="Theme.ChatTheme.Auto"> - <item name="colorPrimary">?attr/colorBackgroundCard</item> - <item name="colorPrimaryDark">?attr/colorBackground</item> - <item name="colorAccent">#ff79c6</item> - - <item name="senderColor0">#6272a4</item> - <item name="senderColor1">#8be9fd</item> - <item name="senderColor2">#50fa7b</item> - <item name="senderColor3">#ffb86c</item> - <item name="senderColor4">#ff79c6</item> - <item name="senderColor5">#bd93f9</item> - <item name="senderColor6">#ff5555</item> - <item name="senderColor7">#f1fa8c</item> - <item name="senderColor8">#6272a4</item> - <item name="senderColor9">#8be9fd</item> - <item name="senderColorA">#50fa7b</item> - <item name="senderColorB">#ffb86c</item> - <item name="senderColorC">#ff79c6</item> - <item name="senderColorD">#bd93f9</item> - <item name="senderColorE">#ff5555</item> - <item name="senderColorF">#f1fa8c</item> - - <item name="colorForeground">#f8f8f2</item> - <item name="colorForegroundHighlight">#f8f8f2</item> - <item name="colorForegroundHighlightSecondary">#6272a4</item> - <item name="colorForegroundSecondary">#6272a4</item> - <item name="colorForegroundAction">#50fa7b</item> - <item name="colorForegroundNotice">#44475a</item> - <item name="colorForegroundError">#ff5555</item> - - <item name="colorTextPrimary">#f8f8f2</item> - <item name="colorTextPrimaryInverse">#282a36</item> - <item name="colorTextSecondary">#6272a4</item> - <item name="colorTextSecondaryInverse">#586e75</item> - <item name="colorTextSearch">#f8f8f2</item> - <item name="colorTextSearchSecondary">#6272a4</item> - <item name="colorDivider">#19f8f8f2</item> - - <item name="colorForegroundMirc">0x0</item> - - <item name="android:windowBackground">@color/dracula_dark_background</item> - <item name="colorBackground">#282a36</item> - <item name="colorBackgroundAlpha">#aa282a36</item> - <item name="colorBackgroundHighlight">#20ff79c6</item> - <item name="colorBackgroundSecondary">#44475a</item> - <item name="colorBackgroundCard">#44475a</item> - <item name="colorBackgroundDialog">#282a36</item> - <item name="colorBackgroundSnackbar">#373949</item> - - <item name="colorOffline">#586e75</item> - <item name="colorAway">#586e75</item> - - <item name="colorMarkerLine">#586e75</item> - - <item name="colorTintActivity">#6272a4</item> - <item name="colorTintMessage">#acb2b7</item> - <item name="colorTintHighlight">#f8f8f2</item> - <item name="colorTintNotification">#ff5555</item> - - <item name="colorTintSecure">#50fa7b</item> - <item name="colorTintPartiallySecure">#ffb86c</item> - <item name="colorTintInsecure">#ff5555</item> - </style> - - <color name="dracula_dark_background">#282a36</color> -</resources> diff --git a/app/src/main/res/values/themes_gruvbox.xml b/app/src/main/res/values/themes_gruvbox.xml deleted file mode 100644 index 638b89c0b7495903ac4749dd6017627bda11b51c..0000000000000000000000000000000000000000 --- a/app/src/main/res/values/themes_gruvbox.xml +++ /dev/null @@ -1,152 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> - -<!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<resources> - <style name="Theme.ChatTheme.Gruvbox_Light" parent="Theme.ChatTheme.Light.Auto"> - <item name="colorPrimary">?attr/colorBackgroundCard</item> - <item name="colorPrimaryDark">#b6ae91</item> - <item name="colorAccent">#d65d0e</item> - - <item name="senderColor0">#d65d0e</item> - <item name="senderColor1">#cc241d</item> - <item name="senderColor2">#98971a</item> - <item name="senderColor3">#d79921</item> - <item name="senderColor4">#458588</item> - <item name="senderColor5">#b16286</item> - <item name="senderColor6">#689d6a</item> - <item name="senderColor7">#7c6f64</item> - <item name="senderColor8">#928374</item> - <item name="senderColor9">#9d0006</item> - <item name="senderColorA">#79740e</item> - <item name="senderColorB">#b57614</item> - <item name="senderColorC">#076678</item> - <item name="senderColorD">#8f3f71</item> - <item name="senderColorE">#427b58</item> - <item name="senderColorF">#af3a03</item> - - <item name="colorForeground">#3c3836</item> - <item name="colorForegroundHighlight">#3c3836</item> - <item name="colorForegroundHighlightSecondary">#665c54</item> - <item name="colorForegroundSecondary">#665c54</item> - <item name="colorForegroundAction">#076678</item> - <item name="colorForegroundNotice">#b57614</item> - <item name="colorForegroundError">#9d0006</item> - - <item name="colorTextPrimary">#3c3836</item> - <item name="colorTextPrimaryInverse">#fbf1c7</item> - <item name="colorTextSecondary">#665c54</item> - <item name="colorTextSecondaryInverse">#bdae93</item> - <item name="colorTextSearch">#3c3836</item> - <item name="colorTextSearchSecondary">#665c54</item> - <item name="colorDivider">#2d928374</item> - - <item name="colorForegroundMirc">0x1</item> - - <item name="android:windowBackground">@color/gruvbox_light_background</item> - <item name="colorBackground">#fbf1c7</item> - <item name="colorBackgroundAlpha">#aafbf1c7</item> - <item name="colorBackgroundHighlight">#40d65d0e</item> - <item name="colorBackgroundSecondary">#ebdbb2</item> - <item name="colorBackgroundCard">#ebdbb2</item> - <item name="colorBackgroundDialog">#f2d5bc</item> - - <item name="colorOffline">#665c54</item> - <item name="colorAway">#665c54</item> - - <item name="colorMarkerLine">#9d0006</item> - - <item name="colorTintActivity">#98971a</item> - <item name="colorTintMessage">#458588</item> - <item name="colorTintHighlight">#d65d0e</item> - <item name="colorTintNotification">#cc241d</item> - - <item name="colorTintSecure">#98971a</item> - <item name="colorTintPartiallySecure">#d79921</item> - <item name="colorTintInsecure">#9d0006</item> - </style> - - <style name="Theme.ChatTheme.Gruvbox_Dark" parent="Theme.ChatTheme.Auto"> - <item name="colorPrimary">?attr/colorBackgroundCard</item> - <item name="colorPrimaryDark">#3c3734</item> - <item name="colorAccent">#d65d0e</item> - - <item name="senderColor0">#d65d0e</item> - <item name="senderColor1">#cc241d</item> - <item name="senderColor2">#98971a</item> - <item name="senderColor3">#d79921</item> - <item name="senderColor4">#458588</item> - <item name="senderColor5">#b16286</item> - <item name="senderColor6">#689d6a</item> - <item name="senderColor7">#a89984</item> - <item name="senderColor8">#928374</item> - <item name="senderColor9">#fb4934</item> - <item name="senderColorA">#b8bb26</item> - <item name="senderColorB">#fabd2f</item> - <item name="senderColorC">#83a598</item> - <item name="senderColorD">#d3869b</item> - <item name="senderColorE">#8ec07c</item> - <item name="senderColorF">#fe8019</item> - - <item name="colorForeground">#dbdbb2</item> - <item name="colorForegroundHighlight">#dbdbb2</item> - <item name="colorForegroundHighlightSecondary">#bdae93</item> - <item name="colorForegroundSecondary">#bdae93</item> - <item name="colorForegroundAction">#458588</item> - <item name="colorForegroundNotice">#d79921</item> - <item name="colorForegroundError">#cc241d</item> - - <item name="colorTextPrimary">#dbdbb2</item> - <item name="colorTextPrimaryInverse">#282828</item> - <item name="colorTextSecondary">#bdae93</item> - <item name="colorTextSecondaryInverse">#665c54</item> - <item name="colorTextSearch">#dbdbb2</item> - <item name="colorTextSearchSecondary">#bdae93</item> - <item name="colorDivider">#33928374</item> - - <item name="colorForegroundMirc">0x0</item> - - <item name="android:windowBackground">@color/gruvbox_dark_background</item> - <item name="colorBackground">#282828</item> - <item name="colorBackgroundAlpha">#aa282828</item> - <item name="colorBackgroundHighlight">#40d65d0e</item> - <item name="colorBackgroundSecondary">#504945</item> - <item name="colorBackgroundCard">#504945</item> - <item name="colorBackgroundDialog">#3c3836</item> - - <item name="colorOffline">#bdae93</item> - <item name="colorAway">#bdae93</item> - - <item name="colorMarkerLine">#cc241d</item> - - <item name="colorTintActivity">#98971a</item> - <item name="colorTintMessage">#458588</item> - <item name="colorTintHighlight">#d65d0e</item> - <item name="colorTintNotification">#cc241d</item> - - <item name="colorTintSecure">#98971a</item> - <item name="colorTintPartiallySecure">#d79921</item> - <item name="colorTintInsecure">#cc241d</item> - </style> - - <color name="gruvbox_light_background">#fbf1c7</color> - - <color name="gruvbox_dark_background">#282828</color> -</resources> diff --git a/app/src/main/res/values/themes_material.xml b/app/src/main/res/values/themes_material.xml deleted file mode 100644 index 7207cf717c4af8ea35885098a04bfec9e3e9298f..0000000000000000000000000000000000000000 --- a/app/src/main/res/values/themes_material.xml +++ /dev/null @@ -1,135 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> - -<!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<resources> - <style name="Theme.ChatTheme.Material_Light" parent="Theme.ChatTheme.Light.DarkHead"> - <item name="senderColor0">#F44336</item> - <item name="senderColor1">#2196F3</item> - <item name="senderColor2">#7CB342</item> - <item name="senderColor3">#7B1FA2</item> - <item name="senderColor4">#DA8E00</item> - <item name="senderColor5">#4CAF50</item> - <item name="senderColor6">#3F51B5</item> - <item name="senderColor7">#E91E63</item> - <item name="senderColor8">#b94600</item> - <item name="senderColor9">#9E9D24</item> - <item name="senderColorA">#558B2F</item> - <item name="senderColorB">#009688</item> - <item name="senderColorC">#0277BD</item> - <item name="senderColorD">#00838F</item> - <item name="senderColorE">#9C27B0</item> - <item name="senderColorF">#C51162</item> - - <item name="colorTextPrimary">#de000000</item> - <item name="colorTextPrimaryInverse">#ffffffff</item> - <item name="colorTextSecondary">#8a000000</item> - <item name="colorTextSecondaryInverse">#b3ffffff</item> - <item name="colorDivider">#1F000000</item> - - <item name="colorForeground">#DE000000</item> - <item name="colorForegroundHighlight">#DE000000</item> - <item name="colorForegroundHighlightSecondary">#8A000000</item> - <item name="colorForegroundSecondary">#8A000000</item> - <item name="colorForegroundAction">#01579B</item> - <item name="colorForegroundNotice">#B56A00</item> - <item name="colorForegroundError">#B71C1C</item> - - <item name="colorForegroundMirc">0x1</item> - - <item name="android:windowBackground">@color/material_light_background</item> - <item name="colorBackground">#FAFAFA</item> - <item name="colorBackgroundAlpha">#aaFAFAFA</item> - <item name="colorBackgroundHighlight">#40ffaf3b</item> - <item name="colorBackgroundSecondary">#F0F0F0</item> - <item name="colorBackgroundCard">#FFFFFF</item> - <item name="colorBackgroundDialog">#FAFAFA</item> - - <item name="colorMarkerLine">#B71C1C</item> - - <item name="colorTintActivity">#AFB42B</item> - <item name="colorTintMessage">#1976D2</item> - <item name="colorTintHighlight">#FFAB00</item> - <item name="colorTintNotification">#D32F2F</item> - - <item name="colorTintSecure">#4CAF50</item> - <item name="colorTintPartiallySecure">#FFC107</item> - <item name="colorTintInsecure">#D32F2F</item> - </style> - - <style name="Theme.ChatTheme.Material_Dark" parent="Theme.ChatTheme.Auto"> - <item name="senderColor0">#F44336</item> - <item name="senderColor1">#2196F3</item> - <item name="senderColor2">#8BC34A</item> - <item name="senderColor3">#673AB7</item> - <item name="senderColor4">#FFC107</item> - <item name="senderColor5">#4CAF50</item> - <item name="senderColor6">#3F51B5</item> - <item name="senderColor7">#E91E63</item> - <item name="senderColor8">#b94600</item> - <item name="senderColor9">#CDDC39</item> - <item name="senderColorA">#558B2F</item> - <item name="senderColorB">#009688</item> - <item name="senderColorC">#0277BD</item> - <item name="senderColorD">#00838F</item> - <item name="senderColorE">#9C27B0</item> - <item name="senderColorF">#C51162</item> - - <item name="colorTextPrimary">#ffffffff</item> - <item name="colorTextPrimaryInverse">#de000000</item> - <item name="colorTextSecondary">#b3ffffff</item> - <item name="colorTextSecondaryInverse">#8a000000</item> - <item name="colorDivider">#1FFFFFFF</item> - - <item name="colorForeground">#FFFFFF</item> - <item name="colorForegroundHighlight">#FFFFFF</item> - <item name="colorForegroundHighlightSecondary">#B3FFFFFF</item> - <item name="colorForegroundSecondary">#B3FFFFFF</item> - <item name="colorForegroundAction">#448AFF</item> - <item name="colorForegroundNotice">#FFD740</item> - <item name="colorForegroundError">#FF5252</item> - - <item name="colorForegroundMirc">0x0</item> - - <item name="android:windowBackground">@color/material_dark_background</item> - <item name="colorBackground">#303030</item> - <item name="colorBackgroundAlpha">#aa303030</item> - <item name="colorBackgroundHighlight">#40ffaf3b</item> - <item name="colorBackgroundSecondary">#424242</item> - <item name="colorBackgroundCard">#424242</item> - <item name="colorBackgroundSearch">#FFFFFF</item> - <item name="colorBackgroundDialog">#303030</item> - - <item name="colorMarkerLine">#B71C1C</item> - - <item name="colorTintActivity">#AFB42B</item> - <item name="colorTintMessage">#42A5F5</item> - <item name="colorTintHighlight">#FFAB00</item> - <item name="colorTintNotification">#D32F2F</item> - - <item name="colorTintSecure">#4CAF50</item> - <item name="colorTintPartiallySecure">#FFC107</item> - <item name="colorTintInsecure">#D32F2F</item> - </style> - - <color name="material_light_background">#fafafa</color> - - <color name="material_dark_background">#303030</color> -</resources> diff --git a/app/src/main/res/values/themes_quassel.xml b/app/src/main/res/values/themes_quassel.xml deleted file mode 100644 index 38a9e4163ac71c0b354f74a2f556cb68124d2632..0000000000000000000000000000000000000000 --- a/app/src/main/res/values/themes_quassel.xml +++ /dev/null @@ -1,139 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> - -<!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<resources> - <style name="Theme.ChatTheme.Quassel_Light" parent="Theme.ChatTheme.Light.DarkHead"> - <item name="senderColor0">#cc0000</item> - <item name="senderColor1">#006cad</item> - <item name="senderColor2">#4d9900</item> - <item name="senderColor3">#6600cc</item> - <item name="senderColor4">#a67d00</item> - <item name="senderColor5">#009927</item> - <item name="senderColor6">#0030c0</item> - <item name="senderColor7">#cc009a</item> - <item name="senderColor8">#b94600</item> - <item name="senderColor9">#869900</item> - <item name="senderColorA">#149900</item> - <item name="senderColorB">#009960</item> - <item name="senderColorC">#006cad</item> - <item name="senderColorD">#0099cc</item> - <item name="senderColorE">#b300cc</item> - <item name="senderColorF">#cc004d</item> - - <item name="colorTextPrimary">#de000000</item> - <item name="colorTextPrimaryInverse">#ffffffff</item> - <item name="colorTextSecondary">#8a000000</item> - <item name="colorTextSecondaryInverse">#b3ffffff</item> - <item name="colorDivider">#1F000000</item> - - <item name="colorForeground">#DE000000</item> - <item name="colorForegroundHighlight">#DE000000</item> - <item name="colorForegroundHighlightSecondary">#8A000000</item> - <item name="colorForegroundSecondary">#8A000000</item> - <item name="colorForegroundAction">#1a237e</item> - <item name="colorForegroundNotice">#916409</item> - <item name="colorForegroundError">#800000</item> - - <item name="colorForegroundHighlightMonochrome">true</item> - - <item name="colorForegroundMirc">0x1</item> - - <item name="android:windowBackground">@color/quassel_light_background</item> - <item name="colorBackground">#FAFAFA</item> - <item name="colorBackgroundAlpha">#aaFAFAFA</item> - <item name="colorBackgroundHighlight">#ffaf3b</item> - <item name="colorBackgroundSecondary">#F0F0F0</item> - <item name="colorBackgroundCard">#FFFFFF</item> - <item name="colorBackgroundDialog">#FAFAFA</item> - - <item name="colorMarkerLine">#800000</item> - - <item name="colorTintActivity">#88cc33</item> - <item name="colorTintMessage">#2277dd</item> - <item name="colorTintHighlight">#ff8811</item> - <item name="colorTintNotification">#BB2222</item> - - <item name="colorTintSecure">#88cc33</item> - <item name="colorTintPartiallySecure">#ffaf3b</item> - <item name="colorTintInsecure">#BB2222</item> - </style> - - <style name="Theme.ChatTheme.Quassel_Dark" parent="Theme.ChatTheme.Auto"> - <item name="senderColor0">#cc0000</item> - <item name="senderColor1">#006cad</item> - <item name="senderColor2">#4d9900</item> - <item name="senderColor3">#6600cc</item> - <item name="senderColor4">#a67d00</item> - <item name="senderColor5">#009927</item> - <item name="senderColor6">#0030c0</item> - <item name="senderColor7">#cc009a</item> - <item name="senderColor8">#b94600</item> - <item name="senderColor9">#869900</item> - <item name="senderColorA">#149900</item> - <item name="senderColorB">#009960</item> - <item name="senderColorC">#006cad</item> - <item name="senderColorD">#0099cc</item> - <item name="senderColorE">#b300cc</item> - <item name="senderColorF">#cc004d</item> - - <item name="colorTextPrimary">#ffffffff</item> - <item name="colorTextPrimaryInverse">#de000000</item> - <item name="colorTextSecondary">#b3ffffff</item> - <item name="colorTextSecondaryInverse">#8a000000</item> - <item name="colorDivider">#1FFFFFFF</item> - - <item name="colorForeground">#FFFFFF</item> - <item name="colorForegroundHighlight">#DE000000</item> - <item name="colorForegroundHighlightSecondary">#8A000000</item> - <item name="colorForegroundSecondary">#B3FFFFFF</item> - <item name="colorForegroundAction">#7986cb</item> - <item name="colorForegroundNotice">#916409</item> - <item name="colorForegroundError">#800000</item> - - <item name="colorForegroundHighlightMonochrome">true</item> - - <item name="colorForegroundMirc">0x0</item> - - <item name="android:windowBackground">@color/quassel_dark_background</item> - <item name="colorBackground">#303030</item> - <item name="colorBackgroundAlpha">#aa303030</item> - <item name="colorBackgroundHighlight">#ffaf3b</item> - <item name="colorBackgroundSecondary">#424242</item> - <item name="colorBackgroundCard">#424242</item> - <item name="colorBackgroundSearch">#FFFFFF</item> - <item name="colorBackgroundDialog">#303030</item> - - <item name="colorMarkerLine">#800000</item> - - <item name="colorTintActivity">#88cc33</item> - <item name="colorTintMessage">#2277dd</item> - <item name="colorTintHighlight">#ff8811</item> - <item name="colorTintNotification">#BB2222</item> - - <item name="colorTintSecure">#88cc33</item> - <item name="colorTintPartiallySecure">#ffaf3b</item> - <item name="colorTintInsecure">#BB2222</item> - </style> - - <color name="quassel_light_background">#fafafa</color> - - <color name="quassel_dark_background">#303030</color> -</resources> diff --git a/app/src/main/res/values/themes_solarized.xml b/app/src/main/res/values/themes_solarized.xml deleted file mode 100644 index 4a4f38bcc6d9374d35fb1621a781b1abcf25d6da..0000000000000000000000000000000000000000 --- a/app/src/main/res/values/themes_solarized.xml +++ /dev/null @@ -1,153 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> - -<!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<resources> - <style name="Theme.ChatTheme.Solarized_Light" parent="Theme.ChatTheme.Light.Auto"> - <item name="colorPrimary">?attr/colorBackgroundCard</item> - <item name="colorPrimaryDark">#b0ac9e</item> - <item name="colorAccent">#B58900</item> - - <item name="senderColor0">#B58900</item> - <item name="senderColor1">#CB4B16</item> - <item name="senderColor2">#DC322f</item> - <item name="senderColor3">#D33682</item> - <item name="senderColor4">#6C71C4</item> - <item name="senderColor5">#268BD2</item> - <item name="senderColor6">#2AA198</item> - <item name="senderColor7">#859900</item> - <item name="senderColor8">#D5A920</item> - <item name="senderColor9">#EB6B36</item> - <item name="senderColorA">#FC524f</item> - <item name="senderColorB">#F356A2</item> - <item name="senderColorC">#8C91E4</item> - <item name="senderColorD">#46ABF2</item> - <item name="senderColorE">#4AC1B8</item> - <item name="senderColorF">#657900</item> - - <item name="colorForeground">#586e75</item> - <item name="colorForegroundHighlight">#586e75</item> - <item name="colorForegroundHighlightSecondary">#657b83</item> - <item name="colorForegroundSecondary">#657b83</item> - <item name="colorForegroundAction">#268BD2</item> - <item name="colorForegroundNotice">#B58900</item> - <item name="colorForegroundError">#B00000</item> - - <item name="colorTextPrimary">#586e75</item> - <item name="colorTextPrimaryInverse">#FDF6E3</item> - <item name="colorTextSecondary">#657b83</item> - <item name="colorTextSecondaryInverse">#839496</item> - <item name="colorTextSearch">#586e75</item> - <item name="colorTextSearchSecondary">#657b83</item> - <item name="colorDivider">#19586e75</item> - - <item name="colorForegroundMirc">0x1</item> - - <item name="android:windowBackground">@color/solarized_light_background</item> - <item name="colorBackground">#FDF6E3</item> - <item name="colorBackgroundAlpha">#aaFDF6E3</item> - <item name="colorBackgroundHighlight">#40B58900</item> - <item name="colorBackgroundSecondary">#EEE8D5</item> - <item name="colorBackgroundCard">#EEE8D5</item> - <item name="colorBackgroundDialog">#FDF6E3</item> - - <item name="colorOffline">#657b83</item> - <item name="colorAway">#657b83</item> - - <item name="colorMarkerLine">#CB4B16</item> - - <item name="colorTintActivity">#859900</item> - <item name="colorTintMessage">#268BD2</item> - <item name="colorTintHighlight">#EB6B36</item> - <item name="colorTintNotification">#DC322f</item> - - <item name="colorTintSecure">#859900</item> - <item name="colorTintPartiallySecure">#D5A920</item> - <item name="colorTintInsecure">#CB4B16</item> - </style> - - <style name="Theme.ChatTheme.Solarized_Dark" parent="Theme.ChatTheme.Auto"> - <item name="colorPrimary">?attr/colorBackgroundCard</item> - <item name="colorPrimaryDark">?attr/colorBackground</item> - <item name="colorAccent">#B58900</item> - - <item name="senderColor0">#B58900</item> - <item name="senderColor1">#CB4B16</item> - <item name="senderColor2">#DC322f</item> - <item name="senderColor3">#D33682</item> - <item name="senderColor4">#6C71C4</item> - <item name="senderColor5">#268BD2</item> - <item name="senderColor6">#2AA198</item> - <item name="senderColor7">#859900</item> - <item name="senderColor8">#D5A920</item> - <item name="senderColor9">#EB6B36</item> - <item name="senderColorA">#FC524f</item> - <item name="senderColorB">#F356A2</item> - <item name="senderColorC">#8C91E4</item> - <item name="senderColorD">#46ABF2</item> - <item name="senderColorE">#4AC1B8</item> - <item name="senderColorF">#657900</item> - - <item name="colorForeground">#93a1a1</item> - <item name="colorForegroundHighlight">#93a1a1</item> - <item name="colorForegroundHighlightSecondary">#839496</item> - <item name="colorForegroundSecondary">#839496</item> - <item name="colorForegroundAction">#268BD2</item> - <item name="colorForegroundNotice">#B58900</item> - <item name="colorForegroundError">#B00000</item> - - <item name="colorTextPrimary">#93a1a1</item> - <item name="colorTextPrimaryInverse">#002B36</item> - <item name="colorTextSecondary">#839496</item> - <item name="colorTextSecondaryInverse">#657b83</item> - <item name="colorTextSearch">#93a1a1</item> - <item name="colorTextSearchSecondary">#839496</item> - <item name="colorDivider">#1993a1a1</item> - - <item name="colorForegroundMirc">0x0</item> - - <item name="android:windowBackground">@color/solarized_dark_background</item> - <item name="colorBackground">#002B36</item> - <item name="colorBackgroundAlpha">#aa002B36</item> - <item name="colorBackgroundHighlight">#30268BD2</item> - <item name="colorBackgroundSecondary">#073642</item> - <item name="colorBackgroundCard">#073642</item> - <item name="colorBackgroundDialog">#002B36</item> - <item name="colorBackgroundSnackbar">#04313c</item> - - <item name="colorOffline">#839496</item> - <item name="colorAway">#839496</item> - - <item name="colorMarkerLine">#CB4B16</item> - - <item name="colorTintActivity">#859900</item> - <item name="colorTintMessage">#268BD2</item> - <item name="colorTintHighlight">#EB6B36</item> - <item name="colorTintNotification">#DC322f</item> - - <item name="colorTintSecure">#859900</item> - <item name="colorTintPartiallySecure">#B58900</item> - <item name="colorTintInsecure">#CB4B16</item> - </style> - - <color name="solarized_light_background">#FDF6E3</color> - - <color name="solarized_dark_background">#002B36</color> -</resources> diff --git a/app/src/main/res/xml/backup_content.xml b/app/src/main/res/xml/backup_content.xml deleted file mode 100644 index 8fcee1d027c3ad2586c91d030b3b0ec62a4cf62f..0000000000000000000000000000000000000000 --- a/app/src/main/res/xml/backup_content.xml +++ /dev/null @@ -1,24 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<full-backup-content> - <include - domain="sharedpref" - path="." /> -</full-backup-content> diff --git a/app/src/main/res/xml/backup_descriptor.xml b/app/src/main/res/xml/backup_descriptor.xml new file mode 100644 index 0000000000000000000000000000000000000000..6fd6103a4d93e4ef450dabdafd296f1cab15dac7 --- /dev/null +++ b/app/src/main/res/xml/backup_descriptor.xml @@ -0,0 +1,4 @@ +<?xml version="1.0" encoding="utf-8"?> +<full-backup-content> + <!-- Exclude specific shared preferences that contain GCM registration Id --> +</full-backup-content> diff --git a/app/src/main/res/xml/filepaths.xml b/app/src/main/res/xml/filepaths.xml deleted file mode 100644 index 65ff35e609a5936f9e9a3a55f19558791a964e23..0000000000000000000000000000000000000000 --- a/app/src/main/res/xml/filepaths.xml +++ /dev/null @@ -1,24 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<paths> - <cache-path - name="crashes" - path="crashes" /> -</paths> diff --git a/app/src/main/res/xml/network_security_config.xml b/app/src/main/res/xml/network_security_config.xml deleted file mode 100644 index ea464f8b2423f60e42f452fa0e1c1df2834a597b..0000000000000000000000000000000000000000 --- a/app/src/main/res/xml/network_security_config.xml +++ /dev/null @@ -1,31 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<network-security-config xmlns:tools="http://schemas.android.com/tools"> - <base-config> - <trust-anchors> - <!-- Trust preinstalled CAs --> - <certificates src="system" /> - <!-- Additionally trust user added CAs --> - <certificates - src="user" - tools:ignore="AcceptsUserCertificates" /> - </trust-anchors> - </base-config> -</network-security-config> diff --git a/app/src/main/res/xml/preferences.xml b/app/src/main/res/xml/preferences.xml deleted file mode 100644 index 6d5099edd1477edafa8242d2457cea3ff584e356..0000000000000000000000000000000000000000 --- a/app/src/main/res/xml/preferences.xml +++ /dev/null @@ -1,358 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2020 Janne Mareike Koschinski - Copyright (c) 2020 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android" - xmlns:app="http://schemas.android.com/apk/res-auto" - xmlns:robobunny="http://robobunny.com"> - - <PreferenceScreen android:layout="@layout/widget_advertisement_support_patreon"> - <intent - android:action="android.intent.action.VIEW" - android:data="https://www.patreon.com/justjanne" /> - </PreferenceScreen> - - <PreferenceCategory android:title="@string/preference_appearance_title"> - <ListPreference - android:defaultValue="MATERIAL_LIGHT" - android:entries="@array/preference_theme_entries" - android:entryValues="@array/preference_theme_entryvalues" - android:key="@string/preference_theme_key" - android:title="@string/preference_theme_title" /> - - <DropDownPreference - android:defaultValue="NEWLINE" - android:entries="@array/preference_input_enter_entries" - android:entryValues="@array/preference_input_enter_entryvalues" - android:key="@string/preference_input_enter_key" - android:title="@string/preference_input_enter_title" /> - - <SwitchPreference - android:defaultValue="false" - android:key="@string/preference_show_lag_key" - android:summary="@string/preference_show_lag_summary" - android:title="@string/preference_show_lag_title" /> - - <SwitchPreference - android:defaultValue="false" - android:key="@string/preference_keep_screen_on_key" - android:summary="@string/preference_keep_screen_on_summary" - android:title="@string/preference_keep_screen_on_title" /> - - <ListPreference - android:defaultValue="" - android:entries="@array/preference_language_entries" - android:entryValues="@array/preference_language_entryvalues" - android:key="@string/preference_language_key" - android:title="@string/preference_language_title" /> - </PreferenceCategory> - - <PreferenceCategory android:layout="@layout/widget_preference_divider" /> - - <PreferenceCategory android:title="@string/preference_redirection_title"> - <SwitchPreference - android:defaultValue="true" - android:key="@string/preference_redirection_user_notices_key" - android:summary="@string/preference_redirection_user_notices_summary" - android:title="@string/preference_redirection_user_notices_title" /> - <SwitchPreference - android:defaultValue="true" - android:key="@string/preference_redirection_server_notices_key" - android:summary="@string/preference_redirection_server_notices_summary" - android:title="@string/preference_redirection_server_notices_title" /> - <SwitchPreference - android:defaultValue="false" - android:key="@string/preference_redirection_errors_key" - android:summary="@string/preference_redirection_errors_summary" - android:title="@string/preference_redirection_errors_title" /> - </PreferenceCategory> - - <PreferenceCategory android:layout="@layout/widget_preference_divider" /> - - <PreferenceCategory android:title="@string/preference_notifications_title"> - <DropDownPreference - android:defaultValue="ALL" - android:entries="@array/preference_notifications_level_entries" - android:entryValues="@array/preference_notifications_level_entryvalues" - android:key="@string/preference_notification_query_key" - android:title="@string/preference_notification_query_title" /> - <DropDownPreference - android:defaultValue="HIGHLIGHT" - android:entries="@array/preference_notifications_level_entries" - android:entryValues="@array/preference_notifications_level_entryvalues" - android:key="@string/preference_notification_channel_key" - android:title="@string/preference_notification_channel_title" /> - <DropDownPreference - android:defaultValue="NONE" - android:entries="@array/preference_notifications_level_entries" - android:entryValues="@array/preference_notifications_level_entryvalues" - android:key="@string/preference_notification_other_key" - android:title="@string/preference_notification_other_title" /> - - <SwitchPreference - android:defaultValue="false" - android:key="@string/preference_notification_mark_read_on_swipe_key" - android:summary="@string/preference_notification_mark_read_on_swipe_summary" - android:title="@string/preference_notification_mark_read_on_swipe_title" /> - - <SwitchPreference - android:defaultValue="false" - android:key="@string/preference_notification_network_name_in_notification_title_key" - android:title="@string/preference_notification_network_name_in_notification_title_title" /> - - <SwitchPreference - android:defaultValue="false" - android:key="@string/preference_notification_show_all_activities_in_toolbar_key" - android:summary="@string/preference_notification_show_all_activities_in_toolbar_summary" - android:title="@string/preference_notification_show_all_activities_in_toolbar_title" /> - - <de.kuschku.quasseldroid.util.ui.settings.RingtonePreference - android:defaultValue="content://settings/system/notification_sound" - android:key="@string/preference_notification_sound_key" - android:title="@string/preference_notification_sound_title" - app:ringtoneType="notification" - app:showDefault="true" - app:showSilent="true" /> - - <SwitchPreference - android:defaultValue="true" - android:key="@string/preference_notification_vibration_key" - android:title="@string/preference_notification_vibration_title" /> - - <SwitchPreference - android:defaultValue="true" - android:key="@string/preference_notification_light_key" - android:title="@string/preference_notification_light_title" /> - - <PreferenceScreen - android:key="@string/preference_notification_configure_key" - android:title="@string/preference_notification_configure_title"> - <intent android:action="android.settings.APP_NOTIFICATION_SETTINGS"> - <extra - android:name="android.provider.extra.APP_PACKAGE" - android:value="@string/package_name" /> - </intent> - </PreferenceScreen> - </PreferenceCategory> - - <PreferenceCategory android:layout="@layout/widget_preference_divider" /> - - <PreferenceCategory android:title="@string/preference_messages_title"> - - <SwitchPreference - android:defaultValue="false" - android:key="@string/preference_monospace_key" - android:title="@string/preference_monospace_title" /> - - <de.kuschku.quasseldroid.util.ui.settings.SeekBarPreference - android:defaultValue="14" - android:key="@string/preference_textsize_key" - android:max="24" - android:title="@string/preference_textsize_title" - robobunny:min="6" /> - - <SwitchPreference - android:defaultValue="false" - android:key="@string/preference_show_seconds_key" - android:title="@string/preference_show_seconds_title" /> - - <SwitchPreference - android:defaultValue="true" - android:key="@string/preference_use_24h_clock_key" - android:title="@string/preference_use_24h_clock_title" /> - - <SwitchPreference - android:defaultValue="true" - android:key="@string/preference_colorize_mirc_key" - android:summaryOff="@string/preference_colorize_mirc_summaryoff" - android:summaryOn="@string/preference_colorize_mirc_summaryon" - android:title="@string/preference_colorize_mirc_title" /> - - <DropDownPreference - android:defaultValue="ALL_BUT_MINE" - android:entries="@array/preference_colorize_nicknames_entries" - android:entryValues="@array/preference_colorize_nicknames_entryvalues" - android:key="@string/preference_colorize_nicknames_key" - android:title="@string/preference_colorize_nicknames_title" /> - - <DropDownPreference - android:defaultValue="HIGHEST" - android:entries="@array/preference_show_prefix_entries" - android:entryValues="@array/preference_show_prefix_entryvalues" - android:key="@string/preference_show_prefix_key" - android:title="@string/preference_show_prefix_title" /> - - <SwitchPreference - android:defaultValue="true" - android:key="@string/preference_square_avatars_key" - android:title="@string/preference_square_avatars_title" /> - - <SwitchPreference - android:defaultValue="true" - android:key="@string/preference_show_avatars_key" - android:title="@string/preference_show_avatars_title" /> - - <SwitchPreference - android:defaultValue="false" - android:dependency="@string/preference_show_avatars_key" - android:key="@string/preference_show_irccloud_avatars_key" - android:title="@string/preference_show_irccloud_avatars_title" /> - - <SwitchPreference - android:defaultValue="false" - android:dependency="@string/preference_show_avatars_key" - android:key="@string/preference_show_gravatar_avatars_key" - android:title="@string/preference_show_gravatar_avatars_title" /> - - <SwitchPreference - android:defaultValue="false" - android:dependency="@string/preference_show_avatars_key" - android:key="@string/preference_show_matrix_avatars_key" - android:title="@string/preference_show_matrix_avatars_title" /> - - <SwitchPreference - android:defaultValue="true" - android:key="@string/preference_nicks_on_new_line_key" - android:summary="@string/preference_nicks_on_new_line_summary" - android:title="@string/preference_nicks_on_new_line_title" /> - - <SwitchPreference - android:defaultValue="true" - android:dependency="@string/preference_nicks_on_new_line_key" - android:key="@string/preference_show_realnames_key" - android:title="@string/preference_show_realnames_title" /> - - <SwitchPreference - android:defaultValue="false" - android:key="@string/preference_hostmask_actions_key" - android:summary="@string/preference_hostmask_actions_summary" - android:title="@string/preference_hostmask_actions_title" /> - - <SwitchPreference - android:defaultValue="true" - android:key="@string/preference_time_at_end_key" - android:summary="@string/preference_time_at_end_summary" - android:title="@string/preference_time_at_end_title" /> - <SwitchPreference - android:defaultValue="false" - android:dependency="@string/preference_nicks_on_new_line_key" - android:key="@string/preference_larger_emoji_key" - android:summary="@string/preference_larger_emoji_summary" - android:title="@string/preference_larger_emoji_title" /> - <SwitchPreference - android:defaultValue="false" - android:key="@string/preference_highlight_own_messages_key" - android:summary="@string/preference_highlight_own_messages_summary" - android:title="@string/preference_highlight_own_messages_title" /> - <SwitchPreference - android:defaultValue="true" - android:key="@string/preference_replace_emoji_key" - android:summary="@string/preference_replace_emoji_summary" - android:title="@string/preference_replace_emoji_title" /> - </PreferenceCategory> - - <PreferenceCategory android:layout="@layout/widget_preference_divider" /> - - <PreferenceCategory android:title="@string/preference_autocomplete_title"> - - <SwitchPreference - android:defaultValue="true" - android:key="@string/preference_autocomplete_sender_doubleclick_key" - android:summary="@string/preference_autocomplete_sender_doubleclick_summary" - android:title="@string/preference_autocomplete_sender_doubleclick_title" /> - - <SwitchPreference - android:defaultValue="false" - android:key="@string/preference_autocomplete_button_key" - android:summary="@string/preference_autocomplete_button_summary" - android:title="@string/preference_autocomplete_button_title" /> - - <SwitchPreference - android:defaultValue="true" - android:key="@string/preference_autocomplete_doubletap_key" - android:summary="@string/preference_autocomplete_doubletap_summary" - android:title="@string/preference_autocomplete_doubletap_title" /> - - <SwitchPreference - android:defaultValue="false" - android:key="@string/preference_autocomplete_auto_key" - android:summary="@string/preference_autocomplete_auto_summary" - android:title="@string/preference_autocomplete_auto_title" /> - - <SwitchPreference - android:defaultValue="true" - android:key="@string/preference_autocomplete_prefix_key" - android:summary="@string/preference_autocomplete_prefix_summary" - android:title="@string/preference_autocomplete_prefix_title" /> - - <SwitchPreference - android:defaultValue="true" - android:key="@string/preference_autocomplete_nicks_key" - android:title="@string/preference_autocomplete_nicks_title" /> - - <SwitchPreference - android:defaultValue="true" - android:key="@string/preference_autocomplete_buffers_key" - android:title="@string/preference_autocomplete_buffers_title" /> - - <SwitchPreference - android:defaultValue="true" - android:key="@string/preference_autocomplete_aliases_key" - android:title="@string/preference_autocomplete_aliases_title" /> - - <SwitchPreference - android:defaultValue="true" - android:key="@string/preference_autocomplete_emoji_key" - android:title="@string/preference_autocomplete_emoji_title" /> - </PreferenceCategory> - - <PreferenceCategory android:layout="@layout/widget_preference_divider" /> - - <PreferenceCategory android:title="@string/preference_backlog_title"> - <EditTextPreference - android:defaultValue="150" - android:inputType="number" - android:key="@string/preference_page_size_key" - android:summary="@string/preference_page_size_summary" - android:title="@string/preference_page_size_title" /> - <EditTextPreference - android:defaultValue="20" - android:inputType="number" - android:key="@string/preference_initial_amount_key" - android:summary="@string/preference_initial_amount_summary" - android:title="@string/preference_initial_amount_title" /> - <PreferenceScreen - android:key="@string/preference_clear_cache_key" - android:title="@string/preference_clear_cache_title" /> - </PreferenceCategory> - - <PreferenceCategory android:layout="@layout/widget_preference_divider" /> - - <PreferenceCategory android:title="@string/preference_connection_title"> - <SwitchPreference - android:defaultValue="true" - android:key="@string/preference_show_notification_key" - android:summary="@string/preference_show_notification_summary" - android:title="@string/preference_show_notification_title" /> - <SwitchPreference - android:defaultValue="false" - android:key="@string/preference_ignore_network_changes_key" - android:summary="@string/preference_ignore_network_changes_summary" - android:title="@string/preference_ignore_network_changes_title" /> - </PreferenceCategory> -</PreferenceScreen> diff --git a/app/src/test/java/de/kuschku/quasseldroid/ExampleUnitTest.kt b/app/src/test/java/de/kuschku/quasseldroid/ExampleUnitTest.kt new file mode 100644 index 0000000000000000000000000000000000000000..6e55bcd4a1780d19514b210b4e31025fa5ae10f8 --- /dev/null +++ b/app/src/test/java/de/kuschku/quasseldroid/ExampleUnitTest.kt @@ -0,0 +1,17 @@ +package de.kuschku.quasseldroid + +import org.junit.Test + +import org.junit.Assert.* + +/** + * Example local unit test, which will execute on the development machine (host). + * + * See [testing documentation](http://d.android.com/tools/testing). + */ +class ExampleUnitTest { + @Test + fun addition_isCorrect() { + assertEquals(4, 2 + 2) + } +} \ No newline at end of file diff --git a/app/src/test/java/de/kuschku/quasseldroid/QuasseldroidTest.kt b/app/src/test/java/de/kuschku/quasseldroid/QuasseldroidTest.kt deleted file mode 100644 index b60f85da95a6ee55196a4779d7977f792c47ea9d..0000000000000000000000000000000000000000 --- a/app/src/test/java/de/kuschku/quasseldroid/QuasseldroidTest.kt +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid - -import de.kuschku.quasseldroid.app.QuasseldroidTestDelegate - -class QuasseldroidTest : Quasseldroid() { - override val delegate = QuasseldroidTestDelegate() -} diff --git a/app/src/test/java/de/kuschku/quasseldroid/app/QuasseldroidTestDelegate.kt b/app/src/test/java/de/kuschku/quasseldroid/app/QuasseldroidTestDelegate.kt deleted file mode 100644 index b831a91d929a26588d3ad6c6503b7b7ff20dee92..0000000000000000000000000000000000000000 --- a/app/src/test/java/de/kuschku/quasseldroid/app/QuasseldroidTestDelegate.kt +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.app - -class QuasseldroidTestDelegate : AppDelegate { - override fun onAttachBaseContext() = Unit - override fun onPreInit() = Unit - override fun onInit() = Unit - override fun onPostInit() = Unit -} diff --git a/app/src/test/java/de/kuschku/quasseldroid/util/AvatarHelperTest.kt b/app/src/test/java/de/kuschku/quasseldroid/util/AvatarHelperTest.kt deleted file mode 100644 index 42931b86cc91cca55622ae57a3d98b37f42c5819..0000000000000000000000000000000000000000 --- a/app/src/test/java/de/kuschku/quasseldroid/util/AvatarHelperTest.kt +++ /dev/null @@ -1,156 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.util - -import de.kuschku.libquassel.protocol.* -import de.kuschku.quasseldroid.persistence.models.MessageData -import de.kuschku.quasseldroid.settings.MessageSettings -import de.kuschku.quasseldroid.util.avatars.AvatarHelper -import de.kuschku.quasseldroid.viewmodel.data.Avatar -import org.junit.Test -import org.threeten.bp.Instant - -class AvatarHelperTest { - @Test - fun testGravatarAvatars() { - val message = MessageData.of( - messageId = MsgId(1), - time = Instant.now(), - type = Message_Type.of(Message_Type.Plain), - flag = Message_Flag.of(), - bufferId = BufferId(0), - networkId = NetworkId(0), - currentBufferId = BufferId(0), - currentBufferType = Buffer_Type.of(), - sender = "justJanne", - senderPrefixes = "", - realName = "Janne Mareike Koschinski <janne@kuschku.de>", - avatarUrl = "", - content = "Lorem Ipsum I Dolor Sit Amet", - ignored = false - ) - - assert( - AvatarHelper.avatar( - MessageSettings( - showGravatarAvatars = true, - showIRCCloudAvatars = true - ), - message - ).contains( - Avatar.GravatarAvatar("https://www.gravatar.com/avatar/81128f11cae692bc486e3f88b854ddf1?d=404") - ) - ) - - assert( - AvatarHelper.avatar( - MessageSettings( - showGravatarAvatars = false, - showIRCCloudAvatars = false - ), - message - ).isEmpty() - ) - } - - @Test - fun testIrcCloudAvatars() { - val message = MessageData.of( - messageId = MsgId(1), - time = Instant.now(), - type = Message_Type.of(Message_Type.Plain), - flag = Message_Flag.of(), - bufferId = BufferId(0), - networkId = NetworkId(0), - currentBufferId = BufferId(0), - currentBufferType = Buffer_Type.of(), - sender = "jwheare!sid2@irccloud.com", - senderPrefixes = "", - realName = "James Wheare", - avatarUrl = "", - content = "Lorem Ipsum I Dolor Sit Amet", - ignored = false - ) - - assert( - AvatarHelper.avatar( - MessageSettings( - showGravatarAvatars = true, - showIRCCloudAvatars = true - ), - message - ).contains( - Avatar.IRCCloudAvatar("https://static.irccloud-cdn.com/avatar-redirect/2") - ) - ) - - assert( - AvatarHelper.avatar( - MessageSettings( - showGravatarAvatars = false, - showIRCCloudAvatars = false - ), - message - ).isEmpty() - ) - } - - @Test - fun testActualAvatars() { - val message = MessageData.of( - messageId = MsgId(1), - time = Instant.now(), - type = Message_Type.of(Message_Type.Plain), - flag = Message_Flag.of(), - bufferId = BufferId(0), - networkId = NetworkId(0), - currentBufferId = BufferId(0), - currentBufferType = Buffer_Type.of(), - sender = "jwheare!sid2@irccloud.com", - senderPrefixes = "", - realName = "James Wheare", - avatarUrl = "https://quasseldroid.info/favicon.png", - content = "Lorem Ipsum I Dolor Sit Amet", - ignored = false - ) - - assert( - AvatarHelper.avatar( - MessageSettings( - showGravatarAvatars = true, - showIRCCloudAvatars = true - ), - message - ).contains( - Avatar.NativeAvatar("https://quasseldroid.info/favicon.png") - ) - ) - - assert( - AvatarHelper.avatar( - MessageSettings( - showGravatarAvatars = false, - showIRCCloudAvatars = false - ), - message - ) == listOf(Avatar.NativeAvatar("https://quasseldroid.info/favicon.png")) - ) - } -} diff --git a/app/src/test/java/de/kuschku/quasseldroid/util/compatibility/AndroidCrashFixerTest.kt b/app/src/test/java/de/kuschku/quasseldroid/util/compatibility/AndroidCrashFixerTest.kt deleted file mode 100644 index 30e44f11abbaa63abdbae77dbd5bf748175f02e4..0000000000000000000000000000000000000000 --- a/app/src/test/java/de/kuschku/quasseldroid/util/compatibility/AndroidCrashFixerTest.kt +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.util.compatibility - -import org.junit.Assert.* -import org.junit.BeforeClass -import org.junit.Test - -class AndroidCrashFixerTest { - companion object { - lateinit var crashingText: String - lateinit var validText: String - - @JvmStatic - @BeforeClass - fun setUp() { - crashingText = AndroidCrashFixerTest::class.java.getResourceAsStream("/crashing_text.txt")?.bufferedReader()?.readText() - ?: "" - validText = AndroidCrashFixerTest::class.java.getResourceAsStream("/valid_text.txt")?.bufferedReader()?.readText() - ?: "" - } - } - - - @Test - fun testRemovesCrashableCharacters() { - val result = AndroidCrashFixer.removeCrashableCharacters(crashingText) - assertTrue(Regex("\u200F\\s*\u200E").containsMatchIn(crashingText)) - assertTrue(Regex("\u200E\\s*\u200F").containsMatchIn(crashingText)) - assertFalse(Regex("\u200F\\s*\u200E").containsMatchIn(result)) - assertFalse(Regex("\u200E\\s*\u200F").containsMatchIn(result)) - } - - @Test - fun testRetainsContent() { - assertEquals(validText, AndroidCrashFixer.removeCrashableCharacters(validText)) - } -} diff --git a/app/src/test/java/de/kuschku/quasseldroid/util/emoji/EmojiDataTest.kt b/app/src/test/java/de/kuschku/quasseldroid/util/emoji/EmojiDataTest.kt deleted file mode 100644 index 014cda5005100515ea8cb877144bf2fe3f61d79c..0000000000000000000000000000000000000000 --- a/app/src/test/java/de/kuschku/quasseldroid/util/emoji/EmojiDataTest.kt +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.util.emoji - -import android.os.Build -import android.text.SpannableStringBuilder -import de.kuschku.quasseldroid.QuasseldroidTest -import org.junit.Assert.assertEquals -import org.junit.Test -import org.junit.runner.RunWith -import org.robolectric.RobolectricTestRunner -import org.robolectric.annotation.Config - -@Config(application = QuasseldroidTest::class, sdk = [Build.VERSION_CODES.P]) -@RunWith(RobolectricTestRunner::class) -class EmojiDataTest { - @Test - fun replaceShortCodes() { - assertEquals("\ud83d\udc4d", replaceShortCodes(":like:")) - assertEquals("this\ud83d\udc4disa\ud83d\udc1e\ud83d\udc4dtest", - replaceShortCodes("this:like:isa:beetle::+1:test")) - } - - companion object { - private fun replaceShortCodes(text: String): String = - EmojiData.replaceShortCodes(SpannableStringBuilder(text)).toString() - } -} diff --git a/app/src/test/java/de/kuschku/quasseldroid/util/irc/format/IrcFormatDeserializerTest.kt b/app/src/test/java/de/kuschku/quasseldroid/util/irc/format/IrcFormatDeserializerTest.kt deleted file mode 100644 index 63c0ee68f320930614491ec27de945b200e09b5b..0000000000000000000000000000000000000000 --- a/app/src/test/java/de/kuschku/quasseldroid/util/irc/format/IrcFormatDeserializerTest.kt +++ /dev/null @@ -1,180 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.util.irc.format - -import android.os.Build -import de.kuschku.quasseldroid.QuasseldroidTest -import de.kuschku.quasseldroid.util.irc.format.model.FormatInfo -import de.kuschku.quasseldroid.util.irc.format.model.IrcFormat -import org.junit.Assert.assertEquals -import org.junit.Before -import org.junit.Test -import org.junit.runner.RunWith -import org.robolectric.RobolectricTestRunner -import org.robolectric.annotation.Config - -@Config(application = QuasseldroidTest::class, sdk = [Build.VERSION_CODES.P]) -@RunWith(RobolectricTestRunner::class) -class IrcFormatDeserializerTest { - private lateinit var deserializer: IrcFormatDeserializer - - @Before - fun setUp() { - deserializer = IrcFormatDeserializer(mircColors = colors) - } - - @Test - fun testMissingEndTag() { - val spans = mutableListOf<FormatInfo>() - val text = deserializer.formatString( - str = "\u000301,01weeeeeeeeee", - colorize = true, - output = spans - ) - assertEquals("weeeeeeeeee", text.toString()) - assertEquals( - listOf( - FormatInfo( - start = 0, - end = 11, - format = IrcFormat.Color(1, 1, colors) - ) - ), - spans - ) - } - - companion object { - val colors = intArrayOf( - 0x00ffffff, - 0x00000000, - 0x00000080, - 0x00008000, - 0x00ff0000, - 0x00800000, - 0x00800080, - 0x00ffa500, - 0x00ffff00, - 0x0000ff00, - 0x00008080, - 0x0000ffff, - 0x004169e1, - 0x00ff00ff, - 0x00808080, - 0x00c0c0c0, - - 0x00470000, - 0x00740000, - 0x00b50000, - 0x00ff0000, - 0x00ff5959, - 0x00ff9c9c, - - 0x00472100, - 0x00743a00, - 0x00b56300, - 0x00ff8c00, - 0x00ffb459, - 0x00ffd39c, - - 0x00474700, - 0x00747400, - 0x00b5b500, - 0x00ffff00, - 0x00ffff71, - 0x00ffff9c, - - 0x00324700, - 0x00517400, - 0x007db500, - 0x00b2ff00, - 0x00cfff60, - 0x00e2ff9c, - - 0x00004700, - 0x00007400, - 0x0000b500, - 0x0000ff00, - 0x006fff6f, - 0x009cff9c, - - 0x0000472c, - 0x00007449, - 0x0000b571, - 0x0000ffa0, - 0x0065ffc9, - 0x009cffdb, - - 0x00004747, - 0x00007474, - 0x0000b5b5, - 0x0000ffff, - 0x006dffff, - 0x009cffff, - - 0x00002747, - 0x00004074, - 0x000063b5, - 0x00008cff, - 0x0059b4ff, - 0x009cd3ff, - - 0x00000047, - 0x00000074, - 0x000000b5, - 0x000000ff, - 0x005959ff, - 0x009c9cff, - - 0x002e0047, - 0x004b0074, - 0x007500b5, - 0x00a500ff, - 0x00c459ff, - 0x00dc9cff, - - 0x00470047, - 0x00740074, - 0x00b500b5, - 0x00ff00ff, - 0x00ff66ff, - 0x00ff9cff, - - 0x0047002a, - 0x00740045, - 0x00b5006b, - 0x00ff0098, - 0x00ff59bc, - 0x00ff94d3, - - 0x00000000, - 0x00131313, - 0x00282828, - 0x00363636, - 0x004d4d4d, - 0x00656565, - 0x00818181, - 0x009f9f9f, - 0x00bcbcbc, - 0x00e2e2e2, - 0x00ffffff - ) - } -} diff --git a/app/src/test/java/de/kuschku/quasseldroid/util/ui/LocaleHelperTest.kt b/app/src/test/java/de/kuschku/quasseldroid/util/ui/LocaleHelperTest.kt deleted file mode 100644 index 89939bf45d646b5acb707f877df1784d2780492b..0000000000000000000000000000000000000000 --- a/app/src/test/java/de/kuschku/quasseldroid/util/ui/LocaleHelperTest.kt +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.util.ui - -import org.junit.Assert.assertEquals -import org.junit.Test - -class LocaleHelperTest { - @Test - fun testParseLanguageCode() { - LocaleHelper.parseLanguageCode("fr-CA").let { - assertEquals("CA", it.country) - assertEquals("", it.variant) - assertEquals("fr", it.language) - } - LocaleHelper.parseLanguageCode("zh-Hant-TW").let { - assertEquals("TW", it.country) - assertEquals("Hant", it.variant) - assertEquals("zh", it.language) - } - LocaleHelper.parseLanguageCode("zh").let { - assertEquals("", it.country) - assertEquals("", it.variant) - assertEquals("zh", it.language) - } - } -} diff --git a/app/src/test/resources/crashing_text.txt b/app/src/test/resources/crashing_text.txt deleted file mode 100644 index c37fc0960003d73ec534483cc632a9f399314cb2..0000000000000000000000000000000000000000 --- a/app/src/test/resources/crashing_text.txt +++ /dev/null @@ -1 +0,0 @@ -<⚫> 👈🏻 diff --git a/app/src/test/resources/robolectric.properties b/app/src/test/resources/robolectric.properties deleted file mode 100644 index 12c09de03df6ab5c1611d04d2882bb50b2e65899..0000000000000000000000000000000000000000 --- a/app/src/test/resources/robolectric.properties +++ /dev/null @@ -1,18 +0,0 @@ -# Quasseldroid - Quassel client for Android -# -# Copyright (c) 2020 Janne Mareike Koschinski -# Copyright (c) 2020 The Quassel Project -# -# This program is free software: you can redistribute it and/or modify it -# under the terms of the GNU General Public License version 3 as published -# by the Free Software Foundation. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License along -# with this program. If not, see <http://www.gnu.org/licenses/>. - -robolectric.dependency.repo.url=https://repo1.maven.org/maven2 diff --git a/app/src/test/resources/valid_text.txt b/app/src/test/resources/valid_text.txt deleted file mode 100644 index d35637bcb08d61741fc076bd790840d705eb7b62..0000000000000000000000000000000000000000 --- a/app/src/test/resources/valid_text.txt +++ /dev/null @@ -1 +0,0 @@ -ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞĀĂĄĆĈĊČĎĐĒĔĖĘĚĜĞĠĢĤĦĨĪĬĮİIJĴĶĹĻĽĿŁŃŅŇŊŌŎŐŒŔŖŘŚŜŞŠŢŤŦŨŪŬŮŰŲŴŶŸŹŻŽƁƂƄƆƇƉƊƋƎƏƐƑƓƔƖƗƘƜƝƟƠƢƤƦƧƩƬƮƯƱƲƳƵƷƸƼDŽDžLJLjNJNjǍǏǑǓǕǗǙǛǞǠǢǤǦǨǪǬǮDZDzǴǶǷǸǺǼǾȀȂȄȆȈȊȌȎȐȒȔȖȘȚȜȞȠȢȤȦȨȪȬȮȰȲȺȻȽȾɁɃɄɅɆɈɊɌɎͰͲͶͿΆΈΉΊΌΎΏΑΒΓΔΕΖΗΘΙΚΛΜΝΞΟΠΡΣΤΥΦΧΨΩΪΫϏϒϓϔϘϚϜϞϠϢϤϦϨϪϬϮϴϷϹϺϽϾϿЀЁЂЃЄЅІЇЈЉЊЋЌЍЎЏАБВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯѠѢѤѦѨѪѬѮѰѲѴѶѸѺѼѾҀҊҌҎҐҒҔҖҘҚҜҞҠҢҤҦҨҪҬҮҰҲҴҶҸҺҼҾӀӁӃӅӇӉӋӍӐӒӔӖӘӚӜӞӠӢӤӦӨӪӬӮӰӲӴӶӸӺӼӾԀԂԄԆԈԊԌԎԐԒԔԖԘԚԜԞԠԢԤԦԨԪԬԮԱԲԳԴԵԶԷԸԹԺԻԼԽԾԿՀՁՂՃՄՅՆՇՈՉՊՋՌՍՎՏՐՑՒՓՔՕՖႠႡႢႣႤႥႦႧႨႩႪႫႬႭႮႯႰႱႲႳႴႵႶႷႸႹႺႻႼႽႾႿჀჁჂჃჄჅჇჍᎠᎡᎢᎣᎤᎥᎦᎧᎨᎩᎪᎫᎬᎭᎮᎯᎰᎱᎲᎳᎴᎵᎶᎷᎸᎹᎺᎻᎼᎽᎾᎿᏀᏁᏂᏃᏄᏅᏆᏇᏈᏉᏊᏋᏌᏍᏎᏏᏐᏑᏒᏓᏔᏕᏖᏗᏘᏙᏚᏛᏜᏝᏞᏟᏠᏡᏢᏣᏤᏥᏦᏧᏨᏩᏪᏫᏬᏭᏮᏯᏰᏱᏲᏳᏴᏵḀḂḄḆḈḊḌḎḐḒḔḖḘḚḜḞḠḢḤḦḨḪḬḮḰḲḴḶḸḺḼḾṀṂṄṆṈṊṌṎṐṒṔṖṘṚṜṞṠṢṤṦṨṪṬṮṰṲṴṶṸṺṼṾẀẂẄẆẈẊẌẎẐẒẔẞẠẢẤẦẨẪẬẮẰẲẴẶẸẺẼẾỀỂỄỆỈỊỌỎỐỒỔỖỘỚỜỞỠỢỤỦỨỪỬỮỰỲỴỶỸỺỼỾἈἉἊἋἌἍἎἏἘἙἚἛἜἝἨἩἪἫἬἭἮἯἸἹἺἻἼἽἾἿὈὉὊὋὌὍὙὛὝὟὨὩὪὫὬὭὮὯᾈᾉᾊᾋᾌᾍᾎᾏᾘᾙᾚᾛᾜᾝᾞᾟᾨᾩᾪᾫᾬᾭᾮᾯᾸᾹᾺΆᾼῈΈῊΉῌῘῙῚΊῨῩῪΎῬῸΌῺΏῼℂℇℋℌℍℐℑℒℕℙℚℛℜℝℤΩℨKÅℬℭℰℱℲℳℾℿⅅⅠⅡⅢⅣⅤⅥⅦⅧⅨⅩⅪⅫⅬⅭⅮⅯↃⒶⒷⒸⒹⒺⒻⒼⒽⒾⒿⓀⓁⓂⓃⓄⓅⓆⓇⓈⓉⓊⓋⓌⓍⓎⓏⰀⰁⰂⰃⰄⰅⰆⰇⰈⰉⰊⰋⰌⰍⰎⰏⰐⰑⰒⰓⰔⰕⰖⰗⰘⰙⰚⰛⰜⰝⰞⰟⰠⰡⰢⰣⰤⰥⰦⰧⰨⰩⰪⰫⰬⰭⰮⱠⱢⱣⱤⱧⱩⱫⱭⱮⱯⱰⱲⱵⱾⱿⲀⲂⲄⲆⲈⲊⲌⲎⲐⲒⲔⲖⲘⲚⲜⲞⲠⲢⲤⲦⲨⲪⲬⲮⲰⲲⲴⲶⲸⲺⲼⲾⳀⳂⳄⳆⳈⳊⳌⳎⳐⳒⳔⳖⳘⳚⳜⳞⳠⳢⳫⳭⳲꙀꙂꙄꙆꙈꙊꙌꙎꙐꙒꙔꙖꙘꙚꙜꙞꙠꙢꙤꙦꙨꙪꙬꚀꚂꚄꚆꚈꚊꚌꚎꚐꚒꚔꚖꚘꚚꜢꜤꜦꜨꜪꜬꜮꜲꜴꜶꜸꜺꜼꜾꝀꝂꝄꝆꝈꝊꝌꝎꝐꝒꝔꝖꝘꝚꝜꝞꝠꝢꝤꝦꝨꝪꝬꝮꝹꝻꝽꝾꞀꞂꞄꞆꞋꞍꞐꞒꞖꞘꞚꞜꞞꞠꞢꞤꞦꞨꞪꞫꞬꞭꞮꞰꞱꞲꞳꞴꞶ𐐀𐐁𐐂𐐃𐐄𐐅𐐆𐐇𐐈𐐉𐐊𐐋𐐌𐐍𐐎𐐏𐐐𐐑𐐒𐐓𐐔𐐕𐐖𐐗𐐘𐐙𐐚𐐛𐐜𐐝𐐞𐐟𐐠𐐡𐐢𐐣𐐤𐐥𐐦𐐧𐒰𐒱𐒲𐒳𐒴𐒵𐒶𐒷𐒸𐒹𐒺𐒻𐒼𐒽𐒾𐒿𐓀𐓁𐓂𐓃𐓄𐓅𐓆𐓇𐓈𐓉𐓊𐓋𐓌𐓍𐓎𐓏𐓐𐓑𐓒𐓓𐲀𐲁𐲂𐲃𐲄𐲅𐲆𐲇𐲈𐲉𐲊𐲋𐲌𐲍𐲎𐲏𐲐𐲑𐲒𐲓𐲔𐲕𐲖𐲗𐲘𐲙𐲚𐲛𐲜𐲝𐲞𐲟𐲠𐲡𐲢𐲣𐲤𐲥𐲦𐲧𐲨𐲩𐲪𐲫𐲬𐲭𐲮𐲯𐲰𐲱𐲲𑢠𑢡𑢢𑢣𑢤𑢥𑢦𑢧𑢨𑢩𑢪𑢫𑢬𑢭𑢮𑢯𑢰𑢱𑢲𑢳𑢴𑢵𑢶𑢷𑢸𑢹𑢺𑢻𑢼𑢽𑢾𑢿𝐀𝐁𝐂𝐃𝐄𝐅𝐆𝐇𝐈𝐉𝐊𝐋𝐌𝐍𝐎𝐏𝐐𝐑𝐒𝐓𝐔𝐕𝐖𝐗𝐘𝐙𝐴𝐵𝐶𝐷𝐸𝐹𝐺𝐻𝐼𝐽𝐾𝐿𝑀𝑁𝑂𝑃𝑄𝑅𝑆𝑇𝑈𝑉𝑊𝑋𝑌𝑍𝑨𝑩𝑪𝑫𝑬𝑭𝑮𝑯𝑰𝑱𝑲𝑳𝑴𝑵𝑶𝑷𝑸𝑹𝑺𝑻𝑼𝑽𝑾𝑿𝒀𝒁𝒜𝒞𝒟𝒢𝒥𝒦𝒩𝒪𝒫𝒬𝒮𝒯𝒰𝒱𝒲𝒳𝒴𝒵𝓐𝓑𝓒𝓓𝓔𝓕𝓖𝓗𝓘𝓙𝓚𝓛𝓜𝓝𝓞𝓟𝓠𝓡𝓢𝓣𝓤𝓥𝓦𝓧𝓨𝓩𝔄𝔅𝔇𝔈𝔉𝔊𝔍𝔎𝔏𝔐𝔑𝔒𝔓𝔔𝔖𝔗𝔘𝔙𝔚𝔛𝔜𝔸𝔹𝔻𝔼𝔽𝔾𝕀𝕁𝕂𝕃𝕄𝕆𝕊𝕋𝕌𝕍𝕎𝕏𝕐𝕬𝕭𝕮𝕯𝕰𝕱𝕲𝕳𝕴𝕵𝕶𝕷𝕸𝕹𝕺𝕻𝕼𝕽𝕾𝕿𝖀𝖁𝖂𝖃𝖄𝖅𝖠𝖡𝖢𝖣𝖤𝖥𝖦𝖧𝖨𝖩𝖪𝖫𝖬𝖭𝖮𝖯𝖰𝖱𝖲𝖳𝖴𝖵𝖶𝖷𝖸𝖹𝗔𝗕𝗖𝗗𝗘𝗙𝗚𝗛𝗜𝗝𝗞𝗟𝗠𝗡𝗢𝗣𝗤𝗥𝗦𝗧𝗨𝗩𝗪𝗫𝗬𝗭𝘈𝘉𝘊𝘋𝘌𝘍𝘎𝘏𝘐𝘑𝘒𝘓𝘔𝘕𝘖𝘗𝘘𝘙𝘚𝘛𝘜𝘝𝘞𝘟𝘠𝘡𝘼𝘽𝘾𝘿𝙀𝙁𝙂𝙃𝙄𝙅𝙆𝙇𝙈𝙉𝙊𝙋𝙌𝙍𝙎𝙏𝙐𝙑𝙒𝙓𝙔𝙕𝙰𝙱𝙲𝙳𝙴𝙵𝙶𝙷𝙸𝙹𝙺𝙻𝙼𝙽𝙾𝙿𝚀𝚁𝚂𝚃𝚄𝚅𝚆𝚇𝚈𝚉𝚨𝚩𝚪𝚫𝚬𝚭𝚮𝚯𝚰𝚱𝚲𝚳𝚴𝚵𝚶𝚷𝚸𝚹𝚺𝚻𝚼𝚽𝚾𝚿𝛀𝛢𝛣𝛤𝛥𝛦𝛧𝛨𝛩𝛪𝛫𝛬𝛭𝛮𝛯𝛰𝛱𝛲𝛳𝛴𝛵𝛶𝛷𝛸𝛹𝛺𝜜𝜝𝜞𝜟𝜠𝜡𝜢𝜣𝜤𝜥𝜦𝜧𝜨𝜩𝜪𝜫𝜬𝜭𝜮𝜯𝜰𝜱𝜲𝜳𝜴𝝖𝝗𝝘𝝙𝝚𝝛𝝜𝝝𝝞𝝟𝝠𝝡𝝢𝝣𝝤𝝥𝝦𝝧𝝨𝝩𝝪𝝫𝝬𝝭𝝮𝞐𝞑𝞒𝞓𝞔𝞕𝞖𝞗𝞘𝞙𝞚𝞛𝞜𝞝𝞞𝞟𝞠𝞡𝞢𝞣𝞤𝞥𝞦𝞧𝞨𝟊𞤀𞤁𞤂𞤃𞤄𞤅𞤆𞤇𞤈𞤉𞤊𞤋𞤌𞤍𞤎𞤏𞤐𞤑𞤒𞤓𞤔𞤕𞤖𞤗𞤘𞤙𞤚𞤛𞤜𞤝𞤞𞤟𞤠𞤡🄰🄱🄲🄳🄴🄵🄶🄷🄸🄹🄺🄻🄼🄽🄾🄿🅀🅁🅂🅃🅄🅅🅆🅇🅈🅉🅐🅑🅒🅓🅔🅕🅖🅗🅘🅙🅚🅛🅜🅝🅞🅟🅠🅡🅢🅣🅤🅥🅦🅧🅨🅩🅰🅱🅲🅳🅴🅵🅶🅷🅸🅹🅺🅻🅼🅽🅾🅿🆀🆁🆂🆃🆄🆅🆆🆇🆈🆉ABCDEFGHIJKLMNOPQRSTUVWXYZ diff --git a/build.gradle b/build.gradle index 1847bb48970eb2b92f235a2bc82055b07931cfd6..bec9fa1f21c00e11a2d01b5cda2ee3cf60cd5c95 100644 --- a/build.gradle +++ b/build.gradle @@ -16,4 +16,3 @@ * You should have received a copy of the GNU General Public License along * with this program. If not, see <http://www.gnu.org/licenses/>. */ - diff --git a/build.gradle.kts b/build.gradle.kts index b43dc1edf38ce3e00a16d7c7ae40a6ab4aa3c409..8380a4335ae80d3f7cb7f72f6c6a8bbed1684387 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,10 +1,8 @@ -import org.jetbrains.kotlin.gradle.tasks.KotlinCompile - /* * Quasseldroid - Quassel client for Android * - * Copyright (c) 2018 Janne Mareike Koschinski - * Copyright (c) 2018 The Quassel Project + * Copyright (c) 2019 Janne Mareike Koschinski + * Copyright (c) 2019 The Quassel Project * * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU General Public License version 3 as published @@ -12,11 +10,11 @@ import org.jetbrains.kotlin.gradle.tasks.KotlinCompile * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. + * with this program. If not, see <http://www.gnu.org/licenses/>. */ buildscript { @@ -25,25 +23,15 @@ buildscript { jcenter() } dependencies { - classpath("com.android.tools.build:gradle:3.6.1") - classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.72") + classpath("com.android.tools.build:gradle:7.0.0-alpha05") + classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.4.21") } } allprojects { + extra["composeVersion"] = "1.0.0-alpha08" repositories { google() jcenter() - maven(url = "https://jitpack.io") - } - - tasks.withType<KotlinCompile>().configureEach { - kotlinOptions { - freeCompilerArgs += listOf( - "-XXLanguage:+InlineClasses", - "-Xuse-experimental=kotlin.ExperimentalUnsignedTypes" - ) - jvmTarget = "1.6" - } } } diff --git a/buildSrc/build.gradle.kts b/buildSrc/build.gradle.kts index 80933aafb5aab63e83111bdcefbdd1f7e1c8c4e5..0587ee4b027aad24964e854c7717a56234035651 100644 --- a/buildSrc/build.gradle.kts +++ b/buildSrc/build.gradle.kts @@ -26,5 +26,13 @@ kotlinDslPluginOptions { } repositories { + google() jcenter() } + +dependencies { + implementation("com.android.tools.build:gradle:7.0.0-alpha05") + implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:1.4.21") + implementation(gradleApi()) + implementation(localGroovy()) +} diff --git a/buildSrc/src/main/kotlin/VersionContext.kt b/buildSrc/src/main/kotlin/VersionContext.kt deleted file mode 100644 index ce67a764ffd28a67830b689954f299228f46e010..0000000000000000000000000000000000000000 --- a/buildSrc/src/main/kotlin/VersionContext.kt +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -data class VersionContext<T>(val version: T) - -inline fun <T> withVersion(version: T?, f: VersionContext<T>.() -> Unit) { - version?.let { - f.invoke(VersionContext(version)) - } -} diff --git a/buildSrc/src/main/kotlin/de/kuschku/justcode/JustCodePlugin.kt b/buildSrc/src/main/kotlin/de/kuschku/justcode/JustCodePlugin.kt new file mode 100644 index 0000000000000000000000000000000000000000..b0581bcc16d94aa9206f2ab100b7caf964a0cd62 --- /dev/null +++ b/buildSrc/src/main/kotlin/de/kuschku/justcode/JustCodePlugin.kt @@ -0,0 +1,52 @@ +package de.kuschku.justcode + +import com.android.build.gradle.internal.dsl.BaseAppModuleExtension +import org.gradle.api.JavaVersion +import org.gradle.api.Plugin +import org.gradle.api.Project +import org.gradle.kotlin.dsl.getByType + +class JustCodePlugin : Plugin<Project> { + override fun apply(project: Project) { + project.run { + this.extensions.getByType<BaseAppModuleExtension>().run { + setCompileSdkVersion(30) + buildToolsVersion = "30.0.3" + + signingConfigs { + signingData(project.rootProject.properties("signing.properties"))?.let { + create("default") { + storeFile = file(it.storeFile) + storePassword = it.storePassword + keyAlias = it.keyAlias + keyPassword = it.keyPassword + } + } + } + + defaultConfig { + versionCode = gitVersionCode() ?: 1 + versionName = gitVersionName() ?: "1.0.0" + + setBuildConfigField( + ::buildConfigField, + "GIT_HEAD", + gitHead() ?: "" + ) + setBuildConfigField( + ::buildConfigField, + "FANCY_VERSION_NAME", + fancyVersionName() ?: "1.0.0" + ) + setBuildConfigField( + ::buildConfigField, + "GIT_COMMIT_DATE", + gitCommitDate() + ) + + signingConfig = signingConfigs.findByName("default") + } + } + } + } +} diff --git a/buildSrc/src/main/kotlin/ProjectHelper.kt b/buildSrc/src/main/kotlin/de/kuschku/justcode/ProjectHelper.kt similarity index 66% rename from buildSrc/src/main/kotlin/ProjectHelper.kt rename to buildSrc/src/main/kotlin/de/kuschku/justcode/ProjectHelper.kt index 006272fb93e1d63bcbda1cfcd1926f2083714750..c000a6ce9f3b6185a95918a6fa6f38bbb45e58e2 100644 --- a/buildSrc/src/main/kotlin/ProjectHelper.kt +++ b/buildSrc/src/main/kotlin/de/kuschku/justcode/ProjectHelper.kt @@ -17,8 +17,11 @@ * with this program. If not, see <http://www.gnu.org/licenses/>. */ +package de.kuschku.justcode + import org.gradle.api.Project import java.io.ByteArrayOutputStream +import java.io.OutputStream import java.util.* fun Project.cmd(vararg command: String) = try { @@ -26,10 +29,10 @@ fun Project.cmd(vararg command: String) = try { exec { commandLine(*command) standardOutput = stdOut + errorOutput = OutputStream.nullOutputStream() } stdOut.toString(Charsets.UTF_8.name()).trim() } catch (e: Throwable) { - e.printStackTrace() null } @@ -42,22 +45,14 @@ fun Project.properties(fileName: String): Properties? { return props } -data class SigningData( - val storeFile: String, - val storePassword: String, - val keyAlias: String, - val keyPassword: String +inline fun <reified T> setBuildConfigField( + setter: (String, String, String) -> Unit, + name: String, + value: T ) { - companion object { - fun of(properties: Properties?): SigningData? { - if (properties == null) return null - - val storeFile = properties.getProperty("storeFile") ?: return null - val storePassword = properties.getProperty("storePassword") ?: return null - val keyAlias = properties.getProperty("keyAlias") ?: return null - val keyPassword = properties.getProperty("keyPassword") ?: return null - - return SigningData(storeFile, storePassword, keyAlias, keyPassword) - } + if (T::class == Long::class) { + setter("long", name, "${value?:0}L") + } else if (T::class == String::class) { + setter("String", name, "\"${value}\"") } } diff --git a/buildSrc/src/main/kotlin/de/kuschku/justcode/SigningData.kt b/buildSrc/src/main/kotlin/de/kuschku/justcode/SigningData.kt new file mode 100644 index 0000000000000000000000000000000000000000..5490d165c21d41086c8c0b5cff11ee68ed3602b5 --- /dev/null +++ b/buildSrc/src/main/kotlin/de/kuschku/justcode/SigningData.kt @@ -0,0 +1,21 @@ +package de.kuschku.justcode + +import java.util.* + +data class SigningData( + val storeFile: String, + val storePassword: String, + val keyAlias: String, + val keyPassword: String +) + +fun signingData(properties: Properties?): SigningData? { + if (properties == null) return null + + val storeFile = properties.getProperty("storeFile") ?: return null + val storePassword = properties.getProperty("storePassword") ?: return null + val keyAlias = properties.getProperty("keyAlias") ?: return null + val keyPassword = properties.getProperty("keyPassword") ?: return null + + return SigningData(storeFile, storePassword, keyAlias, keyPassword) +} diff --git a/buildSrc/src/main/kotlin/FancyVersionName.kt b/buildSrc/src/main/kotlin/de/kuschku/justcode/VersionHelper.kt similarity index 72% rename from buildSrc/src/main/kotlin/FancyVersionName.kt rename to buildSrc/src/main/kotlin/de/kuschku/justcode/VersionHelper.kt index 4ae7c2f12b8aca9463436df7e1eb4ba1ae4a1f71..09eba0327b6e083703edafb06931b49bff43d9fd 100644 --- a/buildSrc/src/main/kotlin/FancyVersionName.kt +++ b/buildSrc/src/main/kotlin/de/kuschku/justcode/VersionHelper.kt @@ -16,6 +16,7 @@ * You should have received a copy of the GNU General Public License along * with this program. If not, see <http://www.gnu.org/licenses/>. */ +package de.kuschku.justcode import org.gradle.api.Project @@ -26,3 +27,17 @@ fun Project.fancyVersionName(): String? { return if (commit != null && name != null) "<a href=\\\"https://git.kuschku.de/justJanne/QuasselDroid-ng/commit/$commit\\\">$name</a>" else name } + +fun Project.gitHead(): String? = + cmd("git", "rev-parse", "HEAD") + +fun Project.gitCommitDate(): Long? = + cmd("git", "show", "-s", "--format=%ct") + ?.toLongOrNull() + +fun Project.gitVersionCode(): Int? = + cmd("git", "rev-list", "--count", "HEAD") + ?.toIntOrNull() + +fun Project.gitVersionName(): String? = + cmd("git", "describe", "--always", "--tags", "HEAD") diff --git a/buildSrc/src/main/resources/META-INF/gradle-plugins/de.kuschku.justcode.properties b/buildSrc/src/main/resources/META-INF/gradle-plugins/de.kuschku.justcode.properties new file mode 100644 index 0000000000000000000000000000000000000000..d2e7b0006a988b0600a68f334cd979f88b42f038 --- /dev/null +++ b/buildSrc/src/main/resources/META-INF/gradle-plugins/de.kuschku.justcode.properties @@ -0,0 +1 @@ +implementation-class=de.kuschku.justcode.JustCodePlugin diff --git a/gradle.properties b/gradle.properties index db3189ac7f7975a1f83ac32de06d2656113eacce..b7d373b952193ba33704538bb972353b2278fb6b 100644 --- a/gradle.properties +++ b/gradle.properties @@ -27,12 +27,8 @@ org.gradle.jvmargs=-Xmx2048m # This option should only be used with decoupled projects. More details, visit # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects org.gradle.parallel=true -# Enable new Android D8 Dexer -android.enableD8=true # Enable gradle build cache org.gradle.caching=true -# Enable android build cache -android.enableBuildCache=true # Enable AndroidX android.useAndroidX=true android.enableJetifier=true diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index 4123b1525278d7b81af85fdd381fb3432273424f..f6b961fd5a86aa5fbfe90f707c3138408be7c718 100644 Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index c5052237fa3ea762db4ef9fb2e2f84f8732dd6e0..84fabb33b740fda8adf010d824389a99d03859e2 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,21 +1,6 @@ -# Quasseldroid - Quassel client for Android -# -# Copyright (c) 2019 Janne Mareike Koschinski -# Copyright (c) 2019 The Quassel Project -# -# This program is free software: you can redistribute it and/or modify it -# under the terms of the GNU General Public License version 3 as published -# by the Free Software Foundation. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License along -# with this program. If not, see <http://www.gnu.org/licenses/>. +#Wed Feb 03 14:43:23 CET 2021 distributionBase=GRADLE_USER_HOME +distributionUrl=https\://services.gradle.org/distributions/gradle-6.8-bin.zip distributionPath=wrapper/dists -zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https://services.gradle.org/distributions/gradle-5.6.4-all.zip +zipStoreBase=GRADLE_USER_HOME diff --git a/invokerannotations/build.gradle.kts b/invokerannotations/build.gradle.kts deleted file mode 100644 index d492f040b6335504aaf414c9a72ef06e9b93e671..0000000000000000000000000000000000000000 --- a/invokerannotations/build.gradle.kts +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2018 Janne Mareike Koschinski - * Copyright (c) 2018 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -plugins { - id("java") -} diff --git a/invokerannotations/src/main/java/de/kuschku/libquassel/annotations/Slot.java b/invokerannotations/src/main/java/de/kuschku/libquassel/annotations/Slot.java deleted file mode 100644 index 463e7c4944b920269fba78e9ed9e03d8c0d793b4..0000000000000000000000000000000000000000 --- a/invokerannotations/src/main/java/de/kuschku/libquassel/annotations/Slot.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.libquassel.annotations; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -@SuppressWarnings("WeakerAccess") -@Retention(RetentionPolicy.SOURCE) -@Target(value = ElementType.METHOD) -public @interface Slot { - String value() default ""; -} diff --git a/invokerannotations/src/main/java/de/kuschku/libquassel/annotations/Syncable.java b/invokerannotations/src/main/java/de/kuschku/libquassel/annotations/Syncable.java deleted file mode 100644 index e375ae5c1148948b2f08f7e403765ccd2505b2da..0000000000000000000000000000000000000000 --- a/invokerannotations/src/main/java/de/kuschku/libquassel/annotations/Syncable.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.libquassel.annotations; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -@SuppressWarnings("WeakerAccess") -@Retention(RetentionPolicy.RUNTIME) -@Target(value = ElementType.TYPE) -public @interface Syncable { - String name(); -} diff --git a/invokergenerator/build.gradle.kts b/invokergenerator/build.gradle.kts deleted file mode 100644 index 917fc331cc0bfcce4cea9992e506271e36d152ba..0000000000000000000000000000000000000000 --- a/invokergenerator/build.gradle.kts +++ /dev/null @@ -1,38 +0,0 @@ -import org.jetbrains.kotlin.gradle.tasks.KotlinCompile - -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2019 Janne Mareike Koschinski - * Copyright (c) 2019 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -plugins { - kotlin("jvm") - kotlin("kapt") -} - -tasks.withType<KotlinCompile> { - kotlinOptions.jvmTarget = "1.8" -} - -dependencies { - implementation(kotlin("stdlib", "1.3.72")) - implementation(project(":invokerannotations")) - implementation("org.jetbrains.kotlin", "kotlin-compiler-embeddable", "1.3.72") - implementation("com.squareup", "kotlinpoet", "1.3.0") - compileOnly("com.google.auto.service:auto-service:1.0-rc6") - kapt("com.google.auto.service:auto-service:1.0-rc6") -} diff --git a/invokergenerator/src/main/java/de/kuschku/libquassel/annotations/Context.kt b/invokergenerator/src/main/java/de/kuschku/libquassel/annotations/Context.kt deleted file mode 100644 index 882e2a6ae8ff4241e64ed0bf0d34336d15eba254..0000000000000000000000000000000000000000 --- a/invokergenerator/src/main/java/de/kuschku/libquassel/annotations/Context.kt +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.libquassel.annotations - -import javax.annotation.processing.ProcessingEnvironment - -data class Context( - val processingEnv: ProcessingEnvironment, - val targetPath: String? = processingEnv.options["kapt.kotlin.generated"], - val sourcePath: String? = targetPath?.replace("build/generated/source/kaptKotlin/", - "src/") + "/java" -) diff --git a/invokergenerator/src/main/java/de/kuschku/libquassel/annotations/Helpers.kt b/invokergenerator/src/main/java/de/kuschku/libquassel/annotations/Helpers.kt deleted file mode 100644 index 1154ebcbb9a32423e28a611b3b0831e9a719e73d..0000000000000000000000000000000000000000 --- a/invokergenerator/src/main/java/de/kuschku/libquassel/annotations/Helpers.kt +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.libquassel.annotations - -import org.jetbrains.kotlin.com.intellij.psi.PsiElement -import javax.annotation.processing.Messager -import javax.tools.Diagnostic - - -fun Any?.toIndentString(): String { - val notFancy = toString() - return buildString(notFancy.length) { - var indent = 0 - fun StringBuilder.line() { - appendln() - repeat(2 * indent) { append(' ') } - } - - for (char in notFancy) { - if (char == ' ') continue - - when (char) { - ')', ']' -> { - indent-- - line() - } - } - - if (char == '=') append(' ') - append(char) - if (char == '=') append(' ') - - when (char) { - '(', '[', ',' -> { - if (char != ',') indent++ - line() - } - } - } - } -} - -fun splitQualifiedName(qualifiedName: String): Pair<String, String> { - val index = qualifiedName.lastIndexOf('.') - return if (index >= 0 && index + 1 < qualifiedName.length) { - Pair(qualifiedName.substring(0, index), - qualifiedName.substring(index + 1)) - } else { - Pair("", qualifiedName) - } -} - -fun Messager.printAST(element: PsiElement, indent: String = "") { - printMessage(Diagnostic.Kind.NOTE, "$indent$element {") - for (child in element.children) { - printAST(child, "$indent ") - } - printMessage(Diagnostic.Kind.NOTE, "$indent}") -} diff --git a/invokergenerator/src/main/java/de/kuschku/libquassel/annotations/InvokerProcessor.kt b/invokergenerator/src/main/java/de/kuschku/libquassel/annotations/InvokerProcessor.kt deleted file mode 100644 index 1eac6ae156dfcd2e3a572e104521f4dccedf68e5..0000000000000000000000000000000000000000 --- a/invokergenerator/src/main/java/de/kuschku/libquassel/annotations/InvokerProcessor.kt +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.libquassel.annotations - -import com.google.auto.service.AutoService -import de.kuschku.libquassel.annotations.generator.Generator -import de.kuschku.libquassel.annotations.parser.ParserEnvironment -import javax.annotation.processing.* -import javax.lang.model.SourceVersion -import javax.lang.model.element.TypeElement - -@AutoService(Processor::class) -@SupportedSourceVersion(SourceVersion.RELEASE_8) -@SupportedAnnotationTypes("de.kuschku.libquassel.annotations.Syncable") -class InvokerProcessor : AbstractProcessor() { - lateinit var parserEnvironment: ParserEnvironment - lateinit var generator: Generator - - @Synchronized - override fun init(processingEnv: ProcessingEnvironment) { - val context = Context(processingEnv) - parserEnvironment = ParserEnvironment(context) - generator = Generator(context) - } - - override fun process(annotations: Set<TypeElement>, roundEnv: RoundEnvironment): Boolean { - parserEnvironment.use { parser -> - for (annotatedElement in roundEnv.getElementsAnnotatedWith(Syncable::class.java)) { - val parsedClass = parser.parse(annotatedElement) - if (parsedClass != null) { - generator.generate(parsedClass) - } - } - } - return true - } -} diff --git a/invokergenerator/src/main/java/de/kuschku/libquassel/annotations/data/ParsedClass.kt b/invokergenerator/src/main/java/de/kuschku/libquassel/annotations/data/ParsedClass.kt deleted file mode 100644 index 0221149908002c0ef273621fb6481f24485f1337..0000000000000000000000000000000000000000 --- a/invokergenerator/src/main/java/de/kuschku/libquassel/annotations/data/ParsedClass.kt +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.libquassel.annotations.data - -import com.squareup.kotlinpoet.ClassName - -data class ParsedClass( - val name: ClassName, - val quasselName: String, - val methods: List<ParsedMethod> -) diff --git a/invokergenerator/src/main/java/de/kuschku/libquassel/annotations/data/ParsedMethod.kt b/invokergenerator/src/main/java/de/kuschku/libquassel/annotations/data/ParsedMethod.kt deleted file mode 100644 index cb7384c70e629831b547d22352c476c209f4828b..0000000000000000000000000000000000000000 --- a/invokergenerator/src/main/java/de/kuschku/libquassel/annotations/data/ParsedMethod.kt +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.libquassel.annotations.data - -data class ParsedMethod( - val name: String?, - val quasselName: String, - val parameters: List<ParsedParameter> -) diff --git a/invokergenerator/src/main/java/de/kuschku/libquassel/annotations/data/ParsedParameter.kt b/invokergenerator/src/main/java/de/kuschku/libquassel/annotations/data/ParsedParameter.kt deleted file mode 100644 index 351b179bde3748d6c70326d04042db6f3e9921e6..0000000000000000000000000000000000000000 --- a/invokergenerator/src/main/java/de/kuschku/libquassel/annotations/data/ParsedParameter.kt +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.libquassel.annotations.data - -import com.squareup.kotlinpoet.TypeName - -data class ParsedParameter( - val name: String, - val type: TypeName -) diff --git a/invokergenerator/src/main/java/de/kuschku/libquassel/annotations/generator/Generator.kt b/invokergenerator/src/main/java/de/kuschku/libquassel/annotations/generator/Generator.kt deleted file mode 100644 index b9d8c86bf2a40a05a3f53c28a5052be1c7068179..0000000000000000000000000000000000000000 --- a/invokergenerator/src/main/java/de/kuschku/libquassel/annotations/generator/Generator.kt +++ /dev/null @@ -1,114 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.libquassel.annotations.generator - -import com.squareup.kotlinpoet.* -import com.squareup.kotlinpoet.ParameterizedTypeName.Companion.parameterizedBy -import de.kuschku.libquassel.annotations.Context -import de.kuschku.libquassel.annotations.data.ParsedClass -import java.io.File - -class Generator( - private val context: Context -) { - fun generate(parsedClass: ParsedClass) { - val file = FileSpec.builder( - parsedClass.name.packageName + ".invokers", - parsedClass.quasselName + "Invoker" - ).addType( - TypeSpec.objectBuilder(parsedClass.quasselName + "Invoker") - .addSuperinterface(TYPENAME_INVOKER.parameterizedBy(parsedClass.name)) - .addProperty( - PropertySpec.builder( - "className", - String::class.asTypeName(), - KModifier.OVERRIDE - ).initializer("\"${parsedClass.quasselName}\"").build() - ) - .addFunction( - FunSpec.builder("invoke") - .addModifiers(KModifier.OVERRIDE, KModifier.OPERATOR) - .addParameter( - ParameterSpec.builder( - "on", - ANY.copy(nullable = true) - ).build() - ).addParameter( - ParameterSpec.builder( - "method", - String::class.asTypeName() - ).build() - ).addParameter( - ParameterSpec.builder( - "params", - TYPENAME_QVARIANTLIST - ).build() - ) - .addCode( - buildCodeBlock { - beginControlFlow("if (on is %T)", parsedClass.name) - beginControlFlow("when (method)") - for (method in parsedClass.methods) { - beginControlFlow("%S ->", method.quasselName) - if (method.parameters.isEmpty()) { - addStatement("on.${method.name}()") - } else { - addStatement("on.${method.name}(") - indent() - val lastIndex = method.parameters.size - 1 - for ((i, parameter) in method.parameters.withIndex()) { - val suffix = if (i != lastIndex) "," else "" - addStatement("${parameter.name} = params[$i].data as %T$suffix", - parameter.type) - } - unindent() - addStatement(")") - } - endControlFlow() - } - endControlFlow() - nextControlFlow("else") - addStatement("throw %T(on, className)", TYPENAME_WRONG_OBJECT_TYPE_EXCEPTION) - endControlFlow() - } - ) - .build() - ) - .build() - ).build() - - file.writeTo(File(context.targetPath)) - } - - companion object { - private val TYPENAME_INVOKER = ClassName( - "de.kuschku.libquassel.quassel.syncables.interfaces.invokers", - "Invoker" - ) - private val TYPENAME_QVARIANTLIST = ClassName( - "de.kuschku.libquassel.protocol", - "QVariantList" - ) - private val TYPENAME_WRONG_OBJECT_TYPE_EXCEPTION = ClassName( - "de.kuschku.libquassel.quassel.exceptions", - "WrongObjectTypeException" - ) - } -} diff --git a/invokergenerator/src/main/java/de/kuschku/libquassel/annotations/parser/Parser.kt b/invokergenerator/src/main/java/de/kuschku/libquassel/annotations/parser/Parser.kt deleted file mode 100644 index 07f4bea38d63cac4d34337890385e5397566c5ee..0000000000000000000000000000000000000000 --- a/invokergenerator/src/main/java/de/kuschku/libquassel/annotations/parser/Parser.kt +++ /dev/null @@ -1,270 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.libquassel.annotations.parser - -import com.squareup.kotlinpoet.ClassName -import com.squareup.kotlinpoet.ParameterizedTypeName.Companion.parameterizedBy -import com.squareup.kotlinpoet.TypeName -import com.squareup.kotlinpoet.asClassName -import de.kuschku.libquassel.annotations.Context -import de.kuschku.libquassel.annotations.Slot -import de.kuschku.libquassel.annotations.Syncable -import de.kuschku.libquassel.annotations.data.ParsedClass -import de.kuschku.libquassel.annotations.data.ParsedMethod -import de.kuschku.libquassel.annotations.data.ParsedParameter -import de.kuschku.libquassel.annotations.splitQualifiedName -import org.jetbrains.kotlin.builtins.jvm.JavaToKotlinClassMap -import org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment -import org.jetbrains.kotlin.com.intellij.psi.PsiFileFactory -import org.jetbrains.kotlin.idea.KotlinLanguage -import org.jetbrains.kotlin.name.FqName -import org.jetbrains.kotlin.psi.* -import org.jetbrains.kotlin.psi.psiUtil.collectDescendantsOfType -import org.jetbrains.kotlin.psi.psiUtil.findDescendantOfType -import java.io.File -import java.net.JarURLConnection -import javax.lang.model.element.Element -import javax.lang.model.element.TypeElement - -class Parser( - private val context: Context, - private val environment: KotlinCoreEnvironment -) { - fun parse(element: Element): ParsedClass? { - val typeElement = element as TypeElement - - val sourcePath = typeElement.qualifiedName.toString().replace('.', '/') + ".kt" - val sourceFile = File(context.sourcePath, sourcePath) - - val source = sourceFile.readText(Charsets.UTF_8) - - val file = PsiFileFactory.getInstance(environment.project) - .createFileFromText(KotlinLanguage.INSTANCE, source) - - val importDirectives = file.collectDescendantsOfType<KtImportDirective>() - val imports = buildImports( - wildcard = importDirectives.filter { - it.importedName == null - }.mapNotNull { - it.importPath?.toString() - }, - named = importDirectives.mapNotNull { - val simpleName = it.alias?.toString() ?: it.importedName?.toString() - val qualifiedName = it.importPath?.toString() - if (simpleName != null && qualifiedName != null) { - Pair(simpleName, qualifiedName) - } else { - null - } - } - ) - - val clazz = file.collectDescendantsOfType<KtClass> { - it.isInterface() && it.annotationEntries.any { - it.shortName.toString() == Syncable::class.java.simpleName - } - }.first() - val body = clazz.findDescendantOfType<KtClassBody>() - - if (body != null) { - val methods = body.collectDescendantsOfType<KtFunction> { - it.annotationEntries.any { - it.shortName.toString() == Slot::class.java.simpleName - } - } - - val subclassImports = body.children.mapNotNull { - it as? KtClass - }.map { - Pair(it.name!!, typeElement.asClassName().canonicalName + "." + it.name) - }.toMap() - val importsWithSubclasses = imports + subclassImports - - return ParsedClass( - name = typeElement.asClassName(), - quasselName = clazz.parseAnnotations<Syncable>()["name"] - ?: clazz.name - ?: "", - methods = methods.map { method -> - parseMethod(method, importsWithSubclasses) - } - ) - } - return null - } - - private fun parseMethod(method: KtFunction, imports: Map<String, String>) = ParsedMethod( - name = method.name - ?: "", - quasselName = method.parseAnnotations<Slot>()["value"] - ?: method.name - ?: "", - parameters = method - .findDescendantOfType<KtParameterList>() - ?.collectDescendantsOfType<KtParameter>() - .orEmpty() - .map { - parseParameter(it, imports) - } - ) - - private fun parseTypeReference(typeReference: KtTypeReference?, - imports: Map<String, String>): TypeName { - val child = typeReference?.firstChild - return when (child) { - is KtUserType -> parseUserType(child, imports) - is KtNullableType -> parseNullableType(child, imports) - else -> throw IllegalArgumentException("Invalid Type") - } ?: throw IllegalArgumentException("Invalid Type") - } - - private fun parseUserType(type: KtUserType, imports: Map<String, String>): TypeName? { - val qualifiedName = resolveImport(imports, type.referencedName.toString()) - val typeArguments = type.children.mapNotNull { - it as? KtTypeArgumentList - }.firstOrNull()?.children.orEmpty().mapNotNull { - it as? KtTypeProjection - }.mapNotNull { - it.typeReference - }.map { - parseTypeReference(it, imports) - }.toTypedArray() - val (packageName, className) = splitQualifiedName(qualifiedName) - val typeName = ClassName(packageName, className) - return if (typeArguments.isEmpty()) { - typeName - } else { - typeName.parameterizedBy(*typeArguments) - } - } - - private fun parseNullableType(type: KtNullableType, imports: Map<String, String>) = - type.findDescendantOfType<KtUserType>()?.let { - parseUserType(it, imports) - }?.copy(nullable = true) - - private fun parseParameter(parameter: KtParameter, imports: Map<String, String>) = - ParsedParameter( - parameter.name!!, - parseTypeReference(parameter.findDescendantOfType(), imports) - ) - - private inline fun <reified T> KtAnnotated.parseAnnotations(): Map<String, String?> = - annotationEntries - .first { - it.shortName.toString() == T::class.java.simpleName - } - .findDescendantOfType<KtValueArgumentList>() - ?.collectDescendantsOfType<KtValueArgument>() - .orEmpty() - .map { - Pair( - it.findDescendantOfType<KtValueArgumentName>() - ?.findDescendantOfType<KtReferenceExpression>() - ?.text - ?: "value", - it.findDescendantOfType<KtLiteralStringTemplateEntry>()?.text - ) - } - .toMap() - - private fun resolveImport(imports: Map<String, String>, import: String): String { - val qualifiedName = imports.getOrDefault(import, import) - return JavaToKotlinClassMap.mapJavaToKotlin(FqName(qualifiedName))?.asSingleFqName()?.asString() - ?: qualifiedName - } - - private fun resolveWildcardImport(import: String): List<Pair<String, String>> { - val imports = mutableListOf<Pair<String, String>>() - - val packageName = import.removeSuffix(".*") - val packagePath = packageName.replace('.', '/') - val folder = File(context.sourcePath, packagePath) - val sourceFiles = folder.listFiles()?.filter { it.isFile } - if (sourceFiles == null) { - val jarURLConnection = Object::class.java.getResource("Object.class").openConnection() as JarURLConnection - val jdkFile = jarURLConnection.jarFile - for (classEntry in jdkFile.entries()) { - if (classEntry.name.endsWith(".class") && - classEntry.name.startsWith(packagePath) && - !classEntry.name.contains('$')) { - val qualifiedName = classEntry.name.removeSuffix(".class").replace('/', '.') - val (_, simpleName) = splitQualifiedName(qualifiedName) - imports.add(Pair(simpleName, qualifiedName)) - } - } - } else { - for (sourceFile in sourceFiles) { - val source = sourceFile.readText(Charsets.UTF_8) - val file = PsiFileFactory.getInstance(environment.project) - .createFileFromText(KotlinLanguage.INSTANCE, source) - - val foundPackageName = file.findDescendantOfType<KtPackageDirective>() - ?.qualifiedName - - val classes = file.findDescendantOfType<KtScript>()?.children?.mapNotNull { - it as? KtBlockExpression - }.orEmpty().flatMap { it.children.asIterable() }.mapNotNull { - it as? KtClass - } - for (clazz in classes) { - val className = clazz.name - if (className != null) { - imports.add( - Pair( - className, - listOfNotNull(foundPackageName, className).joinToString(".") - ) - ) - } - } - - val typeAliases = file.collectDescendantsOfType<KtTypeAlias>() - for (typeAlias in typeAliases) { - val className = typeAlias.name - if (className != null) { - imports.add(Pair( - className, - listOfNotNull(foundPackageName, className).joinToString("."))) - } - } - } - } - return imports - } - - private fun buildImports(wildcard: List<String>, named: List<Pair<String, String>>) = - ( - wildcard.flatMap(this::resolveWildcardImport) + - named + - listOf( - "Boolean", - "Byte", - "UByte", - "Short", - "UShort", - "Int", - "UInt", - "Long", - "ULong", - "Char" - ).map { Pair(it, "kotlin.$it") } - ).toMap() -} diff --git a/invokergenerator/src/main/java/de/kuschku/libquassel/annotations/parser/ParserEnvironment.kt b/invokergenerator/src/main/java/de/kuschku/libquassel/annotations/parser/ParserEnvironment.kt deleted file mode 100644 index 4826b9ce0f6e82557378cb30b0dbf6fc85837638..0000000000000000000000000000000000000000 --- a/invokergenerator/src/main/java/de/kuschku/libquassel/annotations/parser/ParserEnvironment.kt +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.libquassel.annotations.parser - -import de.kuschku.libquassel.annotations.Context -import org.jetbrains.kotlin.cli.common.config.addKotlinSourceRoot -import org.jetbrains.kotlin.cli.jvm.compiler.EnvironmentConfigFiles -import org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment -import org.jetbrains.kotlin.com.intellij.openapi.util.Disposer -import org.jetbrains.kotlin.config.CompilerConfiguration - -class ParserEnvironment( - private val context: Context -) { - fun <T> use(f: (Parser) -> T): T { - val rootDisposable = Disposer.newDisposable() - try { - val environment = KotlinCoreEnvironment.createForProduction( - rootDisposable, - CompilerConfiguration().apply { - context.sourcePath?.let { - addKotlinSourceRoot(it, isCommon = false) - } - }, - EnvironmentConfigFiles.JVM_CONFIG_FILES - ) - - val parser = Parser(context, environment) - - return f(parser) - } finally { - rootDisposable.dispose() - } - } -} diff --git a/invokergenerator/src/main/resources/META-INF/gradle/incremental.annotation.processors b/invokergenerator/src/main/resources/META-INF/gradle/incremental.annotation.processors deleted file mode 100644 index a3f015c513b38fd4dbe58b22114cf651a450c34a..0000000000000000000000000000000000000000 --- a/invokergenerator/src/main/resources/META-INF/gradle/incremental.annotation.processors +++ /dev/null @@ -1 +0,0 @@ -de.kuschku.libquassel.annotations.InvokerProcessor,isolating diff --git a/lib/build.gradle.kts b/lib/build.gradle.kts deleted file mode 100644 index bebf93e87459b934fe7c99d8e326d56bfb79c84a..0000000000000000000000000000000000000000 --- a/lib/build.gradle.kts +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2019 Janne Mareike Koschinski - * Copyright (c) 2019 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -plugins { - kotlin("jvm") - kotlin("kapt") -} - -dependencies { - implementation(kotlin("stdlib", "1.3.72")) - - implementation("androidx.annotation", "annotation", "1.1.0") - - implementation("org.threeten", "threetenbp", "1.4.0") - implementation("io.reactivex.rxjava2", "rxjava", "2.2.12") - - implementation(project(":invokerannotations")) - kapt(project(":invokergenerator")) - - testImplementation("junit", "junit", "4.12") -} diff --git a/lib/src/main/java/de/kuschku/libquassel/connection/ConnectionState.kt b/lib/src/main/java/de/kuschku/libquassel/connection/ConnectionState.kt deleted file mode 100644 index 92fc706d576df6207723ead413ac8456462a61b5..0000000000000000000000000000000000000000 --- a/lib/src/main/java/de/kuschku/libquassel/connection/ConnectionState.kt +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.libquassel.connection - -enum class ConnectionState { - DISCONNECTED, - CONNECTING, - HANDSHAKE, - INIT, - CONNECTED, - CLOSED -} diff --git a/lib/src/main/java/de/kuschku/libquassel/connection/CoreConnection.kt b/lib/src/main/java/de/kuschku/libquassel/connection/CoreConnection.kt deleted file mode 100644 index 26c84e6edc6f5e5a00a7325b7fbfa6cd1c6b85a8..0000000000000000000000000000000000000000 --- a/lib/src/main/java/de/kuschku/libquassel/connection/CoreConnection.kt +++ /dev/null @@ -1,318 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.libquassel.connection - -import de.kuschku.libquassel.protocol.ClientData -import de.kuschku.libquassel.protocol.message.HandshakeMessage -import de.kuschku.libquassel.protocol.message.SignalProxyMessage -import de.kuschku.libquassel.protocol.primitive.serializer.HandshakeVariantMapSerializer -import de.kuschku.libquassel.protocol.primitive.serializer.IntSerializer -import de.kuschku.libquassel.protocol.primitive.serializer.ProtocolInfoSerializer -import de.kuschku.libquassel.protocol.primitive.serializer.VariantListSerializer -import de.kuschku.libquassel.quassel.ProtocolFeature -import de.kuschku.libquassel.quassel.QuasselFeatures -import de.kuschku.libquassel.session.ProtocolHandler -import de.kuschku.libquassel.ssl.TrustManagers -import de.kuschku.libquassel.util.Optional -import de.kuschku.libquassel.util.compatibility.CompatibilityUtils -import de.kuschku.libquassel.util.compatibility.HandlerService -import de.kuschku.libquassel.util.compatibility.LoggingHandler.Companion.log -import de.kuschku.libquassel.util.compatibility.LoggingHandler.LogLevel.DEBUG -import de.kuschku.libquassel.util.compatibility.LoggingHandler.LogLevel.WARN -import de.kuschku.libquassel.util.compatibility.reference.JavaHandlerService -import de.kuschku.libquassel.util.flag.hasFlag -import de.kuschku.libquassel.util.helper.hexDump -import de.kuschku.libquassel.util.helper.safeValue -import de.kuschku.libquassel.util.helper.write -import de.kuschku.libquassel.util.nio.ChainedByteBuffer -import de.kuschku.libquassel.util.nio.WrappedChannel -import io.reactivex.subjects.BehaviorSubject -import java.io.Closeable -import java.lang.Thread.UncaughtExceptionHandler -import java.net.Socket -import java.net.SocketException -import java.nio.ByteBuffer -import javax.net.ssl.HostnameVerifier -import javax.net.ssl.HttpsURLConnection -import javax.net.ssl.SSLSession -import javax.net.ssl.X509TrustManager - -class CoreConnection( - private val address: SocketAddress, - private val clientData: ClientData = ClientData.DEFAULT, - private val requireSsl: Boolean = false, - private val features: Features = Features(clientData.clientFeatures, QuasselFeatures.empty()), - private val handlerService: HandlerService = JavaHandlerService(), - private val trustManager: X509TrustManager = TrustManagers.default(), - private val hostnameVerifier: HostnameVerifier = HttpsURLConnection.getDefaultHostnameVerifier() -) : Thread(), Closeable { - companion object { - private const val TAG = "CoreConnection" - } - - private var handler: ProtocolHandler? = null - private var securityExceptionCallback: ((QuasselSecurityException) -> Unit)? = null - private var exceptionCallback: ((Throwable) -> Unit)? = null - - fun setHandlers(handler: ProtocolHandler?, - securityExceptionCallback: ((QuasselSecurityException) -> Unit)?, - exceptionCallback: ((Throwable) -> Unit)?) { - this.handler = handler - this.securityExceptionCallback = securityExceptionCallback - this.exceptionCallback = exceptionCallback - } - - private val exceptionHandler = UncaughtExceptionHandler { thread, throwable -> - log(WARN, TAG, thread.name, throwable) - } - - private val sizeBuffer = ByteBuffer.allocateDirect(4) - private val chainedBuffer = ChainedByteBuffer(direct = true) - - val state: BehaviorSubject<ConnectionState> = BehaviorSubject.createDefault( - ConnectionState.DISCONNECTED - ) - - private var channel: WrappedChannel? = null - set(value) { - field = value - sslSession.onNext(Optional.ofNullable(value?.sslSession)) - } - - private fun connect() { - setState(ConnectionState.CONNECTING) - val socket = Socket() - if (CompatibilityUtils.supportsKeepAlive) - socket.keepAlive = true - socket.connect(address.data(), 10_000) - handlerService.exceptionHandler = exceptionHandler - channel = WrappedChannel.ofSocket(socket) - } - - fun setState(value: ConnectionState) { - val current = state.safeValue - if (current != ConnectionState.CLOSED) { - log(DEBUG, TAG, value.name) - state.onNext(value) - } else if (current != value) { - log(WARN, TAG, "Trying to set state while closed: $value", Throwable()) - } - } - - private fun sendHandshake() { - setState(ConnectionState.HANDSHAKE) - IntSerializer.serialize( - chainedBuffer, - 0x42b33f00 or clientData.protocolFeatures.toInt(), - features.negotiated - ) - for (supportedProtocol in clientData.supportedProtocols) { - IntSerializer.serialize(chainedBuffer, supportedProtocol.toInt(), features.negotiated) - } - IntSerializer.serialize(chainedBuffer, 1 shl 31, features.negotiated) - channel?.write(chainedBuffer) - channel?.flush() - } - - private fun readHandshake() { - sizeBuffer.clear() - channel?.read(sizeBuffer) - sizeBuffer.flip() - val protocol = ProtocolInfoSerializer.deserialize(sizeBuffer, features.negotiated) - - log(DEBUG, TAG, "Protocol negotiated $protocol") - - // Wrap socket in SSL context if ssl is enabled - if (protocol.flags.hasFlag(ProtocolFeature.TLS)) { - channel = channel?.withSSL(trustManager, hostnameVerifier, address) - } else if (requireSsl) { - securityExceptionCallback?.invoke(QuasselSecurityException.NoSsl) - close() - } - - // Wrap socket in deflater if compression is enabled - if (protocol.flags.hasFlag(ProtocolFeature.Compression)) { - channel = channel?.withCompression() - } - - // Initialize remote peer - when (protocol.version.toInt()) { - 0x02 -> { - // Send client clientData to core - dispatch( - HandshakeMessage.ClientInit( - clientVersion = clientData.identifier, - buildDate = clientData.buildDate.epochSecond.toString(), - clientFeatures = clientData.clientFeatures.toInt(), - featureList = clientData.clientFeatures.toStringList() - ) - ) - } - else -> { - throw ProtocolVersionException(protocol) - } - } - } - - override fun close() { - try { - setState(ConnectionState.CLOSED) - channel?.close() - } catch (e: Throwable) { - log(WARN, TAG, "Error encountered while closing connection: $e") - } - setHandlers(null, null, null) - interrupt() - } - - fun dispatch(message: HandshakeMessage) { - handlerService.serialize { - try { - val data = HandshakeMessage.serialize(message) - handlerService.write( - MessageRunnable( - data, HandshakeVariantMapSerializer, chainedBuffer, channel, - features.negotiated - ) - ) - } catch (e: Throwable) { - log(WARN, TAG, "Error encountered while serializing handshake message", e) - } - } - } - - fun dispatch(message: SignalProxyMessage) { - handlerService.serialize { - try { - val data = SignalProxyMessage.serialize(message) - handlerService.write( - MessageRunnable( - data, VariantListSerializer, chainedBuffer, channel, - features.negotiated - ) - ) - } catch (e: Throwable) { - log(WARN, TAG, "Error encountered while serializing sigproxy message", e) - } - } - } - - override fun run() { - try { - connect() - sendHandshake() - readHandshake() - while (!isInterrupted && state.safeValue != ConnectionState.CLOSED) { - sizeBuffer.clear() - if (channel?.read(sizeBuffer) == -1) - break - sizeBuffer.flip() - - val size = IntSerializer.deserialize(sizeBuffer, features.negotiated) - if (size > 64 * 1024 * 1024) - throw SocketException("Too large frame received: $size") - val dataBuffer = ByteBuffer.allocateDirect(size) - while (dataBuffer.position() < dataBuffer.limit() && channel?.read(dataBuffer) ?: -1 > 0) { - } - dataBuffer.flip() - - handlerService.deserialize { - when (state.safeValue) { - ConnectionState.CLOSED -> - // Connection closed, do nothing - Unit - ConnectionState.CONNECTING, - ConnectionState.HANDSHAKE -> - processHandshake(dataBuffer) - else -> - processSigProxy(dataBuffer) - } - } - } - channel?.close() - } catch (e: Throwable) { - val closed = state.safeValue == ConnectionState.CLOSED - - var cause: Throwable? = e - var exception: QuasselSecurityException? - do { - exception = cause as? QuasselSecurityException - cause = cause?.cause - } while (cause != null && exception == null) - if (exception != null) { - val securityExceptionCallback = this.securityExceptionCallback - close() - log(WARN, - TAG, - "Security error encountered in connection: ${exception::class.java.canonicalName}") - securityExceptionCallback?.invoke(exception) - } else { - if (!closed) { - log(WARN, TAG, "Error encountered in connection", e) - log(WARN, TAG, "Last sent message: ${MessageRunnable.lastSent.get()}") - exceptionCallback?.invoke(e) - } - close() - } - } - } - - private fun processSigProxy(dataBuffer: ByteBuffer) = handlerService.deserialize { - try { - val msg = SignalProxyMessage.deserialize( - VariantListSerializer.deserialize(dataBuffer, features.negotiated) - ) - handlerService.backend { - try { - handler?.handle(msg) - } catch (e: Throwable) { - log(WARN, TAG, "Error encountered while handling sigproxy message", e) - log(WARN, TAG, msg.toString()) - } - } - - } catch (e: Throwable) { - log(WARN, - TAG, "Error encountered while parsing sigproxy message", e) - dataBuffer.hexDump() - } - } - - private fun processHandshake(dataBuffer: ByteBuffer) = try { - val msg = HandshakeMessage.deserialize( - HandshakeVariantMapSerializer.deserialize(dataBuffer, features.negotiated) - ) - try { - handler?.handle(msg) - } catch (e: Throwable) { - log(WARN, - TAG, "Error encountered while handling handshake message", e) - log(WARN, TAG, msg.toString()) - } - } catch (e: Throwable) { - log( - WARN, - TAG, "Error encountered while parsing handshake message", e - ) - } - - - val sslSession: BehaviorSubject<Optional<SSLSession>> = BehaviorSubject.createDefault(Optional.empty()) -} diff --git a/lib/src/main/java/de/kuschku/libquassel/connection/Features.kt b/lib/src/main/java/de/kuschku/libquassel/connection/Features.kt deleted file mode 100644 index 2ff84676b057f71d964834dd67b3a3b2fab09610..0000000000000000000000000000000000000000 --- a/lib/src/main/java/de/kuschku/libquassel/connection/Features.kt +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.libquassel.connection - -import de.kuschku.libquassel.quassel.QuasselFeatures - -data class Features( - var client: QuasselFeatures, - var core: QuasselFeatures -) { - val negotiated: QuasselFeatures - get() = QuasselFeatures( - core.enabledFeatures intersect client.enabledFeatures, - core.unknownFeatures union client.unknownFeatures - ) - - companion object { - fun empty() = Features(QuasselFeatures.empty(), QuasselFeatures.empty()) - fun all() = Features(QuasselFeatures.all(), QuasselFeatures.all()) - } -} diff --git a/lib/src/main/java/de/kuschku/libquassel/connection/MessageRunnable.kt b/lib/src/main/java/de/kuschku/libquassel/connection/MessageRunnable.kt deleted file mode 100644 index af7dc53674d16936687a06abc20926ae3ab41eb9..0000000000000000000000000000000000000000 --- a/lib/src/main/java/de/kuschku/libquassel/connection/MessageRunnable.kt +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.libquassel.connection - -import de.kuschku.libquassel.protocol.primitive.serializer.Serializer -import de.kuschku.libquassel.quassel.QuasselFeatures -import de.kuschku.libquassel.util.compatibility.LoggingHandler.Companion.log -import de.kuschku.libquassel.util.compatibility.LoggingHandler.LogLevel.WARN -import de.kuschku.libquassel.util.helper.write -import de.kuschku.libquassel.util.nio.ChainedByteBuffer -import de.kuschku.libquassel.util.nio.WrappedChannel -import java.nio.ByteBuffer -import java.util.concurrent.atomic.AtomicReference - -class MessageRunnable<T>( - private val data: T, - private val serializer: Serializer<T>, - private val chainedBuffer: ChainedByteBuffer, - private val channel: WrappedChannel?, - private val features: QuasselFeatures -) : () -> Unit { - override fun invoke() { - try { - serializer.serialize(chainedBuffer, data, features) - val sizeBuffer = ByteBuffer.allocateDirect(4) - sizeBuffer.putInt(chainedBuffer.size) - sizeBuffer.flip() - channel?.write(sizeBuffer) - channel?.write(chainedBuffer) - channel?.flush() - lastSent.set(data) - } catch (e: Throwable) { - log(WARN, "MessageDispatching", e) - } - } - - companion object { - val lastSent = AtomicReference<Any>() - } -} diff --git a/lib/src/main/java/de/kuschku/libquassel/connection/ProtocolVersionException.kt b/lib/src/main/java/de/kuschku/libquassel/connection/ProtocolVersionException.kt deleted file mode 100644 index 145934a43a8baabd112022d5ef6cc62e3af5abe0..0000000000000000000000000000000000000000 --- a/lib/src/main/java/de/kuschku/libquassel/connection/ProtocolVersionException.kt +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.libquassel.connection - -import de.kuschku.libquassel.quassel.ProtocolInfo -import java.net.ConnectException - -class ProtocolVersionException(val protocol: ProtocolInfo) : ConnectException() { - override val message: String? - get() = "Invalid Protocol Version: $protocol" -} diff --git a/lib/src/main/java/de/kuschku/libquassel/connection/QuasselSecurityException.kt b/lib/src/main/java/de/kuschku/libquassel/connection/QuasselSecurityException.kt deleted file mode 100644 index 79aaeb8c1cdfe121a3e2218411cf338d254df526..0000000000000000000000000000000000000000 --- a/lib/src/main/java/de/kuschku/libquassel/connection/QuasselSecurityException.kt +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.libquassel.connection - -import java.security.GeneralSecurityException -import java.security.cert.X509Certificate - -sealed class QuasselSecurityException( - val certificateChain: Array<out X509Certificate>?, - cause: Throwable? -) : GeneralSecurityException(cause) { - class Certificate( - certificateChain: Array<out X509Certificate>?, - cause: Exception - ) : QuasselSecurityException(certificateChain, cause) - - class WrongHostname( - certificateChain: Array<out X509Certificate>?, - val address: SocketAddress - ) : QuasselSecurityException(certificateChain, null) - - class NoCertificate( - val address: SocketAddress - ) : QuasselSecurityException(emptyArray(), null) - - object NoSsl : QuasselSecurityException(emptyArray(), null) -} diff --git a/lib/src/main/java/de/kuschku/libquassel/connection/SocketAddress.kt b/lib/src/main/java/de/kuschku/libquassel/connection/SocketAddress.kt deleted file mode 100644 index 727bfa2d373e508c56cd51b33ac4e099645d9044..0000000000000000000000000000000000000000 --- a/lib/src/main/java/de/kuschku/libquassel/connection/SocketAddress.kt +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.libquassel.connection - -import java.net.InetSocketAddress - -data class SocketAddress(val host: String, val port: Int) { - fun data() = InetSocketAddress(host, port) -} diff --git a/lib/src/main/java/de/kuschku/libquassel/protocol/ClientData.kt b/lib/src/main/java/de/kuschku/libquassel/protocol/ClientData.kt deleted file mode 100644 index d852736c09fcdf5de293dfc3db555f4dbac3b739..0000000000000000000000000000000000000000 --- a/lib/src/main/java/de/kuschku/libquassel/protocol/ClientData.kt +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.libquassel.protocol - -import de.kuschku.libquassel.quassel.QuasselFeatures -import org.threeten.bp.Instant - -data class ClientData( - val identifier: String, - val buildDate: Instant, - val clientFeatures: QuasselFeatures, - val protocolFeatures: Protocol_Features, - val supportedProtocols: List<Protocol> -) { - companion object { - val DEFAULT = ClientData( - identifier = "libquassel-java", - buildDate = Instant.EPOCH, - clientFeatures = QuasselFeatures.all(), - protocolFeatures = Protocol_Features.of( - Protocol_Feature.Compression, - Protocol_Feature.TLS - ), - supportedProtocols = listOf(Protocol.Datastream) - ) - } -} diff --git a/lib/src/main/java/de/kuschku/libquassel/protocol/Message.kt b/lib/src/main/java/de/kuschku/libquassel/protocol/Message.kt deleted file mode 100644 index b09feeb4833c6a71ab1cb55cda8df97d2e62b159..0000000000000000000000000000000000000000 --- a/lib/src/main/java/de/kuschku/libquassel/protocol/Message.kt +++ /dev/null @@ -1,89 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.libquassel.protocol - -import de.kuschku.libquassel.quassel.BufferInfo -import de.kuschku.libquassel.util.flag.Flag -import de.kuschku.libquassel.util.flag.Flags -import org.threeten.bp.Instant - -data class Message( - val messageId: MsgId, - val time: Instant, - val type: Message_Types, - val flag: Message_Flags, - val bufferInfo: BufferInfo, - val sender: String, - val senderPrefixes: String, - val realName: String, - val avatarUrl: String, - val content: String -) { - enum class MessageType(override val bit: UInt) : Flag<MessageType> { - Plain(0x00001u), - Notice(0x00002u), - Action(0x00004u), - Nick(0x00008u), - Mode(0x00010u), - Join(0x00020u), - Part(0x00040u), - Quit(0x00080u), - Kick(0x00100u), - Kill(0x00200u), - Server(0x00400u), - Info(0x00800u), - Error(0x01000u), - DayChange(0x02000u), - Topic(0x04000u), - NetsplitJoin(0x08000u), - NetsplitQuit(0x10000u), - Invite(0x20000u), - Markerline(0x40000u); - - companion object : Flags.Factory<MessageType> { - override val NONE = MessageType.of() - override fun of(bit: Int) = Flags.of<MessageType>(bit) - override fun of(bit: UInt) = Flags.of<MessageType>(bit) - override fun of(vararg flags: MessageType) = Flags.of(*flags) - override fun of(flags: Iterable<MessageType>) = Flags.of(flags) - } - } - - enum class MessageFlag(override val bit: UInt) : Flag<MessageFlag> { - Self(0x01u), - Highlight(0x02u), - Redirected(0x04u), - ServerMsg(0x08u), - Backlog(0x80u); - - companion object : Flags.Factory<MessageFlag> { - override val NONE = MessageFlag.of() - override fun of(bit: Int) = Flags.of<MessageFlag>(bit) - override fun of(bit: UInt) = Flags.of<MessageFlag>(bit) - override fun of(vararg flags: MessageFlag) = Flags.of(*flags) - override fun of(flags: Iterable<MessageFlag>) = Flags.of(flags) - } - } - - - override fun toString(): String { - return "Message(messageId=$messageId, time=$time, type=$type, flag=$flag, bufferInfo=$bufferInfo, sender='$sender', senderPrefixes='$senderPrefixes', content='$content')" - } -} diff --git a/lib/src/main/java/de/kuschku/libquassel/protocol/NetworkLayerProtocol.kt b/lib/src/main/java/de/kuschku/libquassel/protocol/NetworkLayerProtocol.kt deleted file mode 100644 index bb14bd4de0d24f449b75cd3214488ff605991f66..0000000000000000000000000000000000000000 --- a/lib/src/main/java/de/kuschku/libquassel/protocol/NetworkLayerProtocol.kt +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.libquassel.protocol - -enum class NetworkLayerProtocol(val value: Byte) { - IPv4Protocol(0), - IPv6Protocol(1), - AnyIPProtocol(2), - UnknownNetworkLayerProtocol(-1); - - companion object { - private val byId = NetworkLayerProtocol.values().associateBy(NetworkLayerProtocol::value) - fun of(value: Byte) = byId[value] ?: NetworkLayerProtocol.UnknownNetworkLayerProtocol - } -} diff --git a/lib/src/main/java/de/kuschku/libquassel/protocol/Protocol.kt b/lib/src/main/java/de/kuschku/libquassel/protocol/Protocol.kt deleted file mode 100644 index 7b6bd0d1c26fe46d959f9745d46339bcdbd8e03f..0000000000000000000000000000000000000000 --- a/lib/src/main/java/de/kuschku/libquassel/protocol/Protocol.kt +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.libquassel.protocol - -enum class Protocol(private val value: UByte) { - Legacy(0x01u), - Datastream(0x02u); - - fun toByte() = value.toByte() - fun toChar() = value.toInt().toChar() - fun toDouble() = value.toInt().toDouble() - fun toFloat() = value.toInt().toFloat() - fun toInt() = value.toInt() - fun toLong() = value.toLong() - fun toShort() = value.toShort() - fun toUByte() = value.toUByte() - fun toUInt() = value.toUInt() - fun toULong() = value.toULong() - fun toUShort() = value.toUShort() -} diff --git a/lib/src/main/java/de/kuschku/libquassel/protocol/QType.kt b/lib/src/main/java/de/kuschku/libquassel/protocol/QType.kt deleted file mode 100644 index faf831fe3243b9261485c0fbe83cd52916b041a2..0000000000000000000000000000000000000000 --- a/lib/src/main/java/de/kuschku/libquassel/protocol/QType.kt +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.libquassel.protocol - -import de.kuschku.libquassel.protocol.primitive.serializer.* - -enum class QType(val typeName: String, val serializer: Serializer<*>, - val type: Type = Type.UserType) { - BufferId("BufferId", BufferIdSerializer), - BufferInfo("BufferInfo", BufferInfoSerializer), - DccConfig_IpDetectionMode("DccConfig::IpDetectionMode", DccConfig_IpDetectionModeSerializer), - DccConfig_PortSelectionMode("DccConfig::PortSelectionMode", - DccConfig_PortSelectionModeSerializer), - IrcUser("IrcUser", VariantMapSerializer), - IrcChannel("IrcChannel", VariantMapSerializer), - Identity("Identity", VariantMapSerializer), - IdentityId("IdentityId", IdentityIdSerializer), - Message("Message", MessageSerializer), - MsgId("MsgId", MsgIdSerializer), - NetworkId("NetworkId", NetworkIdSerializer), - NetworkInfo("NetworkInfo", VariantMapSerializer), - Network_Server("Network::Server", VariantMapSerializer), - QHostAddress("QHostAddress", HostAddressSerializer), - PeerPtr("PeerPtr", LongSerializer); - - override fun toString() = "QType($typeName, $type)" - - companion object { - private val map = values().associateBy(QType::typeName) - fun of(name: String) = map[name] - } -} diff --git a/lib/src/main/java/de/kuschku/libquassel/protocol/QTypes.kt b/lib/src/main/java/de/kuschku/libquassel/protocol/QTypes.kt deleted file mode 100644 index adde0617b8031fa849d663b524790ea75945a7d9..0000000000000000000000000000000000000000 --- a/lib/src/main/java/de/kuschku/libquassel/protocol/QTypes.kt +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ -@file:Suppress("NOTHING_TO_INLINE") - -package de.kuschku.libquassel.protocol - -import de.kuschku.libquassel.protocol.primitive.serializer.StringSerializer -import de.kuschku.libquassel.quassel.BufferInfo -import de.kuschku.libquassel.quassel.LegacyFeature -import de.kuschku.libquassel.quassel.ProtocolFeature -import de.kuschku.libquassel.quassel.syncables.interfaces.INetwork -import de.kuschku.libquassel.util.flag.Flags -import de.kuschku.libquassel.util.flag.ShortFlags -import de.kuschku.libquassel.util.helper.deserializeString -import java.nio.ByteBuffer - -typealias QStringList = List<String?> -typealias All_ = Any? -typealias QVariant_ = QVariant<*> -typealias QVariantMap = Map<String, QVariant_> -typealias QVariantList = List<QVariant_> - -typealias Message_Type = Message.MessageType -typealias Message_Types = Flags<Message_Type> - -typealias Message_Flag = Message.MessageFlag -typealias Message_Flags = Flags<Message_Flag> - -typealias Legacy_Feature = LegacyFeature -typealias Legacy_Features = Flags<Legacy_Feature> - -typealias Protocol_Feature = ProtocolFeature -typealias Protocol_Features = Flags<Protocol_Feature> - -typealias Network_ChannelModeType = INetwork.ChannelModeType -typealias Network_ChannelModeTypes = Flags<Network_ChannelModeType> - -typealias Buffer_Type = BufferInfo.Type -typealias Buffer_Types = ShortFlags<Buffer_Type> - -typealias Buffer_Activity = BufferInfo.Activity -typealias Buffer_Activities = Flags<Buffer_Activity> - -inline fun <T> ARG(data: T?, type: Type) = QVariant.of(data, type) -inline fun <T> ARG(data: T?, type: QType) = QVariant.of(data, type) - -fun QVariantList.toVariantMap(): QVariantMap { - val map = HashMap<String, QVariant_>() - var i = 0 - while (i < size) { - val key = get(i).value<ByteBuffer?>().deserializeString(StringSerializer.UTF8) ?: "" - val value = get(i + 1) - map[key] = value - i += 2 - } - return map -} - -fun <K, V> List<Map<K, V>>.transpose(): Map<K, List<V>> { - val result = mutableMapOf<K, MutableList<V>>() - forEach { map -> - map.entries.forEach { (key, value) -> - result.getOrPut(key, ::mutableListOf).add(value) - } - } - return result -} diff --git a/lib/src/main/java/de/kuschku/libquassel/protocol/QVariant.kt b/lib/src/main/java/de/kuschku/libquassel/protocol/QVariant.kt deleted file mode 100644 index ea4ab33a91aa582215fd3f273759a04f5d9435da..0000000000000000000000000000000000000000 --- a/lib/src/main/java/de/kuschku/libquassel/protocol/QVariant.kt +++ /dev/null @@ -1,91 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.libquassel.protocol - -import de.kuschku.libquassel.protocol.primitive.serializer.Serializer - -sealed class QVariant<T> constructor(val data: T?, val type: Type, val serializer: Serializer<T>) { - class Typed<T> internal constructor(data: T?, type: Type, serializer: Serializer<T>) : - QVariant<T>(data, type, serializer) { - override fun toString() = "QVariant.Typed(${type.serializableName}, $data)" - override fun equals(other: Any?): Boolean { - if (this === other) return true - if (other !is Typed<*>) return false - - if (data != other.data) return false - if (type != other.type) return false - - return true - } - - override fun hashCode(): Int { - var result = data?.hashCode() ?: 0 - result = 31 * result + type.hashCode() - return result - } - } - - class Custom<T> internal constructor(data: T?, val qtype: QType, serializer: Serializer<T>) : - QVariant<T>(data, qtype.type, serializer) { - override fun toString() = "QVariant.Custom($qtype, $data)" - override fun equals(other: Any?): Boolean { - if (this === other) return true - if (other !is Custom<*>) return false - - if (data != other.data) return false - if (qtype != other.qtype) return false - - return true - } - - override fun hashCode(): Int { - var result = data?.hashCode() ?: 0 - result = 31 * result + qtype.hashCode() - return result - } - } - - fun or(defValue: T): T { - return data ?: defValue - } - - companion object { - @Suppress("UNCHECKED_CAST") - fun <T> of(data: T?, type: Type): QVariant<T> { - return QVariant.Typed(data, type, type.serializer as Serializer<T>) - } - - @Suppress("UNCHECKED_CAST") - fun <T> of(data: T?, type: QType) = - QVariant.Custom(data, type, type.serializer as Serializer<T>) - } -} - -inline fun <reified U> QVariant_?.value(): U? = this?.value<U?>(null) - -inline fun <reified U> QVariant_?.value(defValue: U): U = this?.data as? U ?: defValue - -inline fun <reified U> QVariant_?.valueOr(f: () -> U): U = this?.data as? U ?: f() - -inline fun <reified U> QVariant_?.valueOrThrow(e: Throwable = NullPointerException()): U = - this?.data as? U ?: throw e - -inline fun <reified U> QVariant_?.valueOrThrow(e: () -> Throwable): U = - this?.data as? U ?: throw e() diff --git a/lib/src/main/java/de/kuschku/libquassel/protocol/SignedId.kt b/lib/src/main/java/de/kuschku/libquassel/protocol/SignedId.kt deleted file mode 100644 index 63885e745de273ec6fed71076629e4498cf99458..0000000000000000000000000000000000000000 --- a/lib/src/main/java/de/kuschku/libquassel/protocol/SignedId.kt +++ /dev/null @@ -1,90 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ -@file:Suppress("NOTHING_TO_INLINE") - -package de.kuschku.libquassel.protocol - -import java.io.Serializable - -typealias SignedId = Int -typealias SignedId64 = Long - -typealias MsgId_Type = SignedId64 - -inline class MsgId(val id: MsgId_Type) : Comparable<MsgId>, Serializable { - override fun compareTo(other: MsgId) = id.compareTo(other.id) - inline fun isValidId() = id > 0 - - override fun toString(): String { - return "MsgId($id)" - } - - companion object { - val MIN_VALUE = MsgId(MsgId_Type.MIN_VALUE) - val MAX_VALUE = MsgId(MsgId_Type.MAX_VALUE) - } -} - -typealias NetworkId_Type = SignedId - -inline class NetworkId(val id: NetworkId_Type) : Comparable<NetworkId>, Serializable { - override fun compareTo(other: NetworkId) = id.compareTo(other.id) - inline fun isValidId() = id > 0 - - override fun toString(): String { - return "NetworkId($id)" - } - - companion object { - val MIN_VALUE = NetworkId(NetworkId_Type.MIN_VALUE) - val MAX_VALUE = NetworkId(NetworkId_Type.MAX_VALUE) - } -} - -typealias BufferId_Type = SignedId - -inline class BufferId(val id: BufferId_Type) : Comparable<BufferId>, Serializable { - override fun compareTo(other: BufferId) = id.compareTo(other.id) - inline fun isValidId() = id > 0 - - override fun toString(): String { - return "BufferId($id)" - } - - companion object { - val MIN_VALUE = BufferId(BufferId_Type.MIN_VALUE) - val MAX_VALUE = BufferId(BufferId_Type.MAX_VALUE) - } -} - -typealias IdentityId_Type = SignedId - -inline class IdentityId(val id: IdentityId_Type) : Comparable<IdentityId>, Serializable { - override fun compareTo(other: IdentityId) = id.compareTo(other.id) - inline fun isValidId() = id > 0 - - override fun toString(): String { - return "IdentityId($id)" - } - - companion object { - val MIN_VALUE = IdentityId(IdentityId_Type.MIN_VALUE) - val MAX_VALUE = IdentityId(IdentityId_Type.MAX_VALUE) - } -} diff --git a/lib/src/main/java/de/kuschku/libquassel/protocol/Type.kt b/lib/src/main/java/de/kuschku/libquassel/protocol/Type.kt deleted file mode 100644 index c56681a637e7483bafaec63aca8124ef4a190ef4..0000000000000000000000000000000000000000 --- a/lib/src/main/java/de/kuschku/libquassel/protocol/Type.kt +++ /dev/null @@ -1,123 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.libquassel.protocol - -import de.kuschku.libquassel.protocol.primitive.serializer.* -import java.util.* - -enum class Type(val id: kotlin.Int, val serializer: Serializer<*>? = null) { - Void(0, VoidSerializer), - Bool(1, BoolSerializer), - Int(2, IntSerializer), - UInt(3, UIntSerializer), - LongLong(4), - ULongLong(5), - - Double(6), - QChar(7, CharSerializer), - QVariantMap(8, VariantMapSerializer), - QVariantList(9, VariantListSerializer), - - QString(10, StringSerializer.UTF16), - QStringList(11, StringListSerializer), - QByteArray(12, ByteArraySerializer), - - QBitArray(13), - QDate(14), - QTime(15, TimeSerializer), - QDateTime(16, DateTimeSerializer), - QUrl(17), - - QLocale(18), - QRect(19), - QRectF(20), - QSize(21), - QSizeF(22), - - QLine(23), - QLineF(24), - QPoint(25), - QPointF(26), - QRegExp(27), - - QVariantHash(28), - QEasingCurve(29), - - FirstGuiType(63), - - QFont(64), - QPixmap(65), - QBrush(66), - QColor(67), - QPalette(68), - - QIcon(69), - QImage(70), - QPolygon(71), - QRegion(72), - QBitmap(73), - - QCursor(74), - QSizePolicy(75), - QKeySequence(76), - QPen(77), - - QTextLength(78), - QTextFormat(79), - QMatrix(80), - QTransform(81), - - QMatrix4x4(82), - QVector2D(83), - QVector3D(84), - QVector4D(85), - - QQuaternion(86), - - VoidStar(128), - Long(129, LongSerializer), - Short(130, ShortSerializer), - Char(131, ByteSerializer), - ULong(132, ULongSerializer), - - UShort(133, UShortSerializer), - UChar(134, UByteSerializer), - Float(135), - QObjectStar(136), - QWidgetStar(137), - - QVariant(138, VariantSerializer), - - User(256), - UserType(127), - LastType(-1); - - val serializableName - get() = if (name.startsWith("Q")) { - name - } else { - name.toLowerCase(Locale.ENGLISH) - } - - companion object { - private val byId = Type.values().associateBy(Type::id) - fun of(type: kotlin.Int) = byId[type] - } -} diff --git a/lib/src/main/java/de/kuschku/libquassel/protocol/coresetup/CoreSetupBackend.kt b/lib/src/main/java/de/kuschku/libquassel/protocol/coresetup/CoreSetupBackend.kt deleted file mode 100644 index 7ce61d40734a61f664ff097d8736af2d06f15de8..0000000000000000000000000000000000000000 --- a/lib/src/main/java/de/kuschku/libquassel/protocol/coresetup/CoreSetupBackend.kt +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.libquassel.protocol.coresetup - -import de.kuschku.libquassel.protocol.* -import de.kuschku.libquassel.util.helper.getOr -import java.io.Serializable - -data class CoreSetupBackend( - val backendId: String, - val displayName: String, - val description: String, - val setupData: List<CoreSetupBackendConfigElement> -) : Serializable { - companion object { - fun of(props: QVariantMap): CoreSetupBackend { - val entries = if (!props.containsKey("SetupData")) { - val result = mutableListOf<CoreSetupBackendConfigElement>() - val setupDefaults = props["SetupDefaults"]?.value<QVariantMap>(emptyMap()).orEmpty() - for (key in props["SetupKeys"]?.value<QStringList>(emptyList()).orEmpty()) { - val default = setupDefaults.getOr(key ?: "", QVariant_.of("", Type.QString)) - result.add(CoreSetupBackendConfigElement(key ?: "", key ?: "", default)) - } - result - } else { - props["SetupData"]?.value<QVariantList>(emptyList()).orEmpty().chunked(3) { (key, displayName, defaultValue) -> - CoreSetupBackendConfigElement(key.value(""), displayName.value(""), defaultValue) - } - } - - val fallback = QVariant_.of("", Type.QString) - - return CoreSetupBackend( - displayName = props.getOr("DisplayName", fallback).value(""), - backendId = props.getOr("BackendId", props.getOr("DisplayName", fallback)).value(""), - description = props.getOr("Description", fallback).value(""), - setupData = entries - ) - } - } -} diff --git a/lib/src/main/java/de/kuschku/libquassel/protocol/coresetup/CoreSetupBackendConfigElement.kt b/lib/src/main/java/de/kuschku/libquassel/protocol/coresetup/CoreSetupBackendConfigElement.kt deleted file mode 100644 index e61255c414da6b734340f528944959bd5167c25a..0000000000000000000000000000000000000000 --- a/lib/src/main/java/de/kuschku/libquassel/protocol/coresetup/CoreSetupBackendConfigElement.kt +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.libquassel.protocol.coresetup - -import de.kuschku.libquassel.protocol.* -import java.io.Serializable - -class CoreSetupBackendConfigElement( - val key: String, - val displayName: String, - defaultValue: QVariant_ -) : Serializable { - private val typeId = defaultValue.type.id - private val customType = defaultValue.type.serializableName - private val rawDefaultValue = defaultValue.data as? Serializable - - val defaultValue: QVariant_ - get() { - val type = Type.of(typeId) - return if (type == Type.UserType) { - val name = customType - val qType = QType.of(name) ?: throw IllegalArgumentException("No such type: $name") - QVariant.of<All_>(rawDefaultValue, qType) - } else { - QVariant.of<All_>(rawDefaultValue, - type ?: throw IllegalArgumentException("No such type: $type")) - } - } - - override fun equals(other: Any?): Boolean { - if (this === other) return true - if (javaClass != other?.javaClass) return false - - other as CoreSetupBackendConfigElement - - if (key != other.key) return false - if (displayName != other.displayName) return false - if (typeId != other.typeId) return false - if (customType != other.customType) return false - if (rawDefaultValue != other.rawDefaultValue) return false - - return true - } - - override fun hashCode(): Int { - var result = key.hashCode() - result = 31 * result + displayName.hashCode() - result = 31 * result + typeId - result = 31 * result + customType.hashCode() - result = 31 * result + (rawDefaultValue?.hashCode() ?: 0) - return result - } - - override fun toString(): String { - return "CoreBackendSetupDataEntry(key='$key', displayName='$displayName', defaultValue='$defaultValue')" - } -} diff --git a/lib/src/main/java/de/kuschku/libquassel/protocol/coresetup/CoreSetupData.kt b/lib/src/main/java/de/kuschku/libquassel/protocol/coresetup/CoreSetupData.kt deleted file mode 100644 index 052b669cf0b389095a0ebc965a425ab4f10cc471..0000000000000000000000000000000000000000 --- a/lib/src/main/java/de/kuschku/libquassel/protocol/coresetup/CoreSetupData.kt +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.libquassel.protocol.coresetup - -import de.kuschku.libquassel.protocol.message.HandshakeMessage -import de.kuschku.libquassel.protocol.value -import de.kuschku.libquassel.quassel.QuasselFeatures -import java.io.Serializable - -data class CoreSetupData( - val backendInfo: List<CoreSetupBackend>, - val authenticatorInfo: List<CoreSetupBackend>, - val features: QuasselFeatures -) : Serializable { - companion object { - fun of(data: HandshakeMessage.ClientInitAck): CoreSetupData { - - return CoreSetupData( - backendInfo = data.backendInfo.orEmpty().map { - CoreSetupBackend.of(it.value(emptyMap())) - }, - authenticatorInfo = data.authenticatorInfo.orEmpty().map { - CoreSetupBackend.of(it.value(emptyMap())) - }, - features = QuasselFeatures(data.coreFeatures, data.featureList) - ) - } - } -} diff --git a/lib/src/main/java/de/kuschku/libquassel/protocol/message/ClientInitAckSerializer.kt b/lib/src/main/java/de/kuschku/libquassel/protocol/message/ClientInitAckSerializer.kt deleted file mode 100644 index 51698a0f811c5ef48881aac97632fbf6daf0bdd8..0000000000000000000000000000000000000000 --- a/lib/src/main/java/de/kuschku/libquassel/protocol/message/ClientInitAckSerializer.kt +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.libquassel.protocol.message - -import de.kuschku.libquassel.protocol.* -import de.kuschku.libquassel.util.flag.Flags - -object ClientInitAckSerializer : HandshakeMessageSerializer<HandshakeMessage.ClientInitAck> { - override fun serialize(data: HandshakeMessage.ClientInitAck) = mapOf( - "MsgType" to QVariant.of<All_>("ClientInitAck", Type.QString), - "CoreFeatures" to QVariant.of<All_>(data.coreFeatures?.toUInt(), Type.UInt), - "StorageBackends" to QVariant.of<All_>(data.backendInfo, Type.QVariantList), - "Authenticator" to QVariant.of<All_>(data.authenticatorInfo, Type.QVariantList), - "Configured" to QVariant.of<All_>(data.coreConfigured, Type.Bool), - "FeatureList" to QVariant.of<All_>(data.featureList, Type.QStringList) - ) - - override fun deserialize(data: QVariantMap) = HandshakeMessage.ClientInitAck( - coreFeatures = Flags.of(data["CoreFeatures"].value(0u)), - backendInfo = data["StorageBackends"].value(), - authenticatorInfo = data["Authenticators"].value(), - coreConfigured = data["Configured"].value(), - featureList = data["FeatureList"].value(emptyList()) - ) -} diff --git a/lib/src/main/java/de/kuschku/libquassel/protocol/message/ClientInitRejectSerializer.kt b/lib/src/main/java/de/kuschku/libquassel/protocol/message/ClientInitRejectSerializer.kt deleted file mode 100644 index bbde624581615db4b0d2b3c2ddba17a668c56332..0000000000000000000000000000000000000000 --- a/lib/src/main/java/de/kuschku/libquassel/protocol/message/ClientInitRejectSerializer.kt +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.libquassel.protocol.message - -import de.kuschku.libquassel.protocol.QVariant -import de.kuschku.libquassel.protocol.QVariantMap -import de.kuschku.libquassel.protocol.Type -import de.kuschku.libquassel.protocol.value - -object ClientInitRejectSerializer : HandshakeMessageSerializer<HandshakeMessage.ClientInitReject> { - override fun serialize(data: HandshakeMessage.ClientInitReject) = mapOf( - "MsgType" to QVariant.of("ClientInitReject", Type.QString), - "Error" to QVariant.of(data.errorString, Type.QString) - ) - - override fun deserialize(data: QVariantMap) = HandshakeMessage.ClientInitReject( - errorString = data["Error"].value() - ) -} diff --git a/lib/src/main/java/de/kuschku/libquassel/protocol/message/ClientInitSerializer.kt b/lib/src/main/java/de/kuschku/libquassel/protocol/message/ClientInitSerializer.kt deleted file mode 100644 index cec87feaf722c53e8c66e82c9ee8cc61bb06a819..0000000000000000000000000000000000000000 --- a/lib/src/main/java/de/kuschku/libquassel/protocol/message/ClientInitSerializer.kt +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.libquassel.protocol.message - -import de.kuschku.libquassel.protocol.QVariant -import de.kuschku.libquassel.protocol.QVariantMap -import de.kuschku.libquassel.protocol.Type -import de.kuschku.libquassel.protocol.value -import de.kuschku.libquassel.util.flag.Flags - -object ClientInitSerializer : HandshakeMessageSerializer<HandshakeMessage.ClientInit> { - override fun serialize(data: HandshakeMessage.ClientInit) = mapOf( - "MsgType" to QVariant.of("ClientInit", Type.QString), - "ClientVersion" to QVariant.of(data.clientVersion, Type.QString), - "ClientDate" to QVariant.of(data.buildDate, Type.QString), - "Features" to QVariant.of(data.clientFeatures?.toUInt(), Type.UInt), - "FeatureList" to QVariant.of(data.featureList, Type.QStringList) - ) - - override fun deserialize(data: QVariantMap) = HandshakeMessage.ClientInit( - clientVersion = data["ClientVersion"].value(), - buildDate = data["ClientDate"].value(), - clientFeatures = Flags.of(data["Features"].value(0u)), - featureList = data["FeatureList"].value(emptyList()) - ) -} diff --git a/lib/src/main/java/de/kuschku/libquassel/protocol/message/ClientLoginAckSerializer.kt b/lib/src/main/java/de/kuschku/libquassel/protocol/message/ClientLoginAckSerializer.kt deleted file mode 100644 index a7408a19f83ed20deef6418283aa3bfcfa278f2f..0000000000000000000000000000000000000000 --- a/lib/src/main/java/de/kuschku/libquassel/protocol/message/ClientLoginAckSerializer.kt +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.libquassel.protocol.message - -import de.kuschku.libquassel.protocol.QVariant -import de.kuschku.libquassel.protocol.QVariantMap -import de.kuschku.libquassel.protocol.Type - -object ClientLoginAckSerializer : HandshakeMessageSerializer<HandshakeMessage.ClientLoginAck> { - override fun serialize(data: HandshakeMessage.ClientLoginAck) = mapOf( - "MsgType" to QVariant.of("ClientLoginAck", Type.QString) - ) - - override fun deserialize(data: QVariantMap) = HandshakeMessage.ClientLoginAck() -} diff --git a/lib/src/main/java/de/kuschku/libquassel/protocol/message/ClientLoginRejectSerializer.kt b/lib/src/main/java/de/kuschku/libquassel/protocol/message/ClientLoginRejectSerializer.kt deleted file mode 100644 index 2755b0645813498cd365d6d675aee50541397418..0000000000000000000000000000000000000000 --- a/lib/src/main/java/de/kuschku/libquassel/protocol/message/ClientLoginRejectSerializer.kt +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.libquassel.protocol.message - -import de.kuschku.libquassel.protocol.QVariant -import de.kuschku.libquassel.protocol.QVariantMap -import de.kuschku.libquassel.protocol.Type -import de.kuschku.libquassel.protocol.value - -object ClientLoginRejectSerializer : - HandshakeMessageSerializer<HandshakeMessage.ClientLoginReject> { - override fun serialize(data: HandshakeMessage.ClientLoginReject) = mapOf( - "MsgType" to QVariant.of("ClientLoginReject", Type.QString), - "Error" to QVariant.of(data.errorString, Type.QString) - ) - - override fun deserialize(data: QVariantMap) = HandshakeMessage.ClientLoginReject( - errorString = data["Error"].value() - ) -} diff --git a/lib/src/main/java/de/kuschku/libquassel/protocol/message/ClientLoginSerializer.kt b/lib/src/main/java/de/kuschku/libquassel/protocol/message/ClientLoginSerializer.kt deleted file mode 100644 index 566d105a3e06b7aab6ffec8e3b99eee85fb3933d..0000000000000000000000000000000000000000 --- a/lib/src/main/java/de/kuschku/libquassel/protocol/message/ClientLoginSerializer.kt +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.libquassel.protocol.message - -import de.kuschku.libquassel.protocol.QVariant -import de.kuschku.libquassel.protocol.QVariantMap -import de.kuschku.libquassel.protocol.Type -import de.kuschku.libquassel.protocol.value - -object ClientLoginSerializer : HandshakeMessageSerializer<HandshakeMessage.ClientLogin> { - override fun serialize(data: HandshakeMessage.ClientLogin) = mapOf( - "MsgType" to QVariant.of("ClientLogin", Type.QString), - "User" to QVariant.of(data.user, Type.QString), - "Password" to QVariant.of(data.password, Type.QString) - ) - - override fun deserialize(data: QVariantMap) = HandshakeMessage.ClientLogin( - user = data["User"].value(), - password = data["Password"].value() - ) -} diff --git a/lib/src/main/java/de/kuschku/libquassel/protocol/message/CoreSetupAckSerializer.kt b/lib/src/main/java/de/kuschku/libquassel/protocol/message/CoreSetupAckSerializer.kt deleted file mode 100644 index f977ff2c964513aa51b704205eba19f736c43bbe..0000000000000000000000000000000000000000 --- a/lib/src/main/java/de/kuschku/libquassel/protocol/message/CoreSetupAckSerializer.kt +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.libquassel.protocol.message - -import de.kuschku.libquassel.protocol.QVariant -import de.kuschku.libquassel.protocol.QVariantMap -import de.kuschku.libquassel.protocol.Type - -object CoreSetupAckSerializer : HandshakeMessageSerializer<HandshakeMessage.CoreSetupAck> { - override fun serialize(data: HandshakeMessage.CoreSetupAck) = mapOf( - "MsgType" to QVariant.of("CoreSetupAck", Type.QString) - ) - - override fun deserialize(data: QVariantMap) = HandshakeMessage.CoreSetupAck() -} diff --git a/lib/src/main/java/de/kuschku/libquassel/protocol/message/CoreSetupDataSerializer.kt b/lib/src/main/java/de/kuschku/libquassel/protocol/message/CoreSetupDataSerializer.kt deleted file mode 100644 index 405f40e9ab107483749373b0bd571f8ea30760d4..0000000000000000000000000000000000000000 --- a/lib/src/main/java/de/kuschku/libquassel/protocol/message/CoreSetupDataSerializer.kt +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.libquassel.protocol.message - -import de.kuschku.libquassel.protocol.QVariant -import de.kuschku.libquassel.protocol.QVariantMap -import de.kuschku.libquassel.protocol.Type -import de.kuschku.libquassel.protocol.value - -object CoreSetupDataSerializer : HandshakeMessageSerializer<HandshakeMessage.CoreSetupData> { - override fun serialize(data: HandshakeMessage.CoreSetupData) = mapOf( - "MsgType" to QVariant.of("CoreSetupData", Type.QString), - "SetupData" to QVariant.of(mapOf( - "AdminUser" to QVariant.of(data.adminUser, Type.QString), - "AdminPasswd" to QVariant.of(data.adminPassword, Type.QString), - "Backend" to QVariant.of(data.backend, Type.QString), - "ConnectionProperties" to QVariant.of(data.setupData, Type.QVariantMap), - "Authenticator" to QVariant.of(data.authenticator, Type.QString), - "AuthProperties" to QVariant.of(data.authSetupData, Type.QVariantMap) - ), Type.QVariantMap - ) - ) - - override fun deserialize(data: QVariantMap): HandshakeMessage.CoreSetupData { - val setupData = data["SetupData"].value<QVariantMap?>() - return HandshakeMessage.CoreSetupData( - adminUser = setupData?.get("AdminUser").value(), - adminPassword = setupData?.get("AdminPasswd").value(), - backend = setupData?.get("Backend").value(), - setupData = setupData?.get("ConnectionProperties").value(), - authenticator = setupData?.get("Authenticator").value(), - authSetupData = setupData?.get("AuthProperties").value() - ) - } -} diff --git a/lib/src/main/java/de/kuschku/libquassel/protocol/message/CoreSetupRejectSerializer.kt b/lib/src/main/java/de/kuschku/libquassel/protocol/message/CoreSetupRejectSerializer.kt deleted file mode 100644 index 6e00a14ced860c6b4c4e539d0cf79e0b4b02c1cb..0000000000000000000000000000000000000000 --- a/lib/src/main/java/de/kuschku/libquassel/protocol/message/CoreSetupRejectSerializer.kt +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.libquassel.protocol.message - -import de.kuschku.libquassel.protocol.QVariant -import de.kuschku.libquassel.protocol.QVariantMap -import de.kuschku.libquassel.protocol.Type -import de.kuschku.libquassel.protocol.value - -object CoreSetupRejectSerializer : HandshakeMessageSerializer<HandshakeMessage.CoreSetupReject> { - override fun serialize(data: HandshakeMessage.CoreSetupReject) = mapOf( - "MsgType" to QVariant.of("CoreSetupReject", Type.QString), - "Error" to QVariant.of(data.errorString, Type.QString) - ) - - override fun deserialize(data: QVariantMap) = HandshakeMessage.CoreSetupReject( - errorString = data["Error"].value() - ) -} diff --git a/lib/src/main/java/de/kuschku/libquassel/protocol/message/HandshakeMessage.kt b/lib/src/main/java/de/kuschku/libquassel/protocol/message/HandshakeMessage.kt deleted file mode 100644 index fe5c56e539f603871e18dc84f1d63d1940009fa0..0000000000000000000000000000000000000000 --- a/lib/src/main/java/de/kuschku/libquassel/protocol/message/HandshakeMessage.kt +++ /dev/null @@ -1,135 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.libquassel.protocol.message - -import de.kuschku.libquassel.protocol.Legacy_Features -import de.kuschku.libquassel.protocol.QVariantList -import de.kuschku.libquassel.protocol.QVariantMap -import de.kuschku.libquassel.protocol.value -import java.io.Serializable - -sealed class HandshakeMessage : Serializable { - class ClientInit( - val clientVersion: String?, val buildDate: String?, - val clientFeatures: Legacy_Features?, val featureList: List<String> - ) : HandshakeMessage() { - override fun toString(): String { - return "ClientInit(clientVersion=$clientVersion, buildDate=$buildDate, clientFeatures=$clientFeatures, featureList=$featureList)" - } - } - - class ClientInitReject(val errorString: String?) : HandshakeMessage() { - override fun toString(): String { - return "ClientInitReject(errorString=$errorString)" - } - } - - class ClientInitAck( - val coreFeatures: Legacy_Features?, val coreConfigured: Boolean?, - val backendInfo: QVariantList?, val authenticatorInfo: QVariantList?, - val featureList: List<String> - ) : HandshakeMessage() { - override fun toString(): String { - return "ClientInitAck(coreFeatures=$coreFeatures, coreConfigured=$coreConfigured, backendInfo=$backendInfo, authenticatorInfo=$authenticatorInfo, featureList=$featureList)" - } - } - - class CoreSetupData(val adminUser: String?, val adminPassword: String?, val backend: String?, - val setupData: QVariantMap?, val authenticator: String?, - val authSetupData: QVariantMap?) : - HandshakeMessage() { - override fun toString(): String { - return "CoreSetupData(adminUser=$adminUser, adminPassword=$adminPassword, backend=$backend, setupData=$setupData, authenticator=$authenticator, authSetupData=$authSetupData)" - } - } - - class CoreSetupReject(val errorString: String?) : HandshakeMessage() { - override fun toString(): String { - return "CoreSetupReject(errorString=$errorString)" - } - } - - class CoreSetupAck : HandshakeMessage() { - override fun toString(): String { - return "CoreSetupAck" - } - } - - class ClientLogin(val user: String?, val password: String?) : HandshakeMessage() { - override fun toString(): String { - return "ClientLogin" - } - } - - class ClientLoginReject(val errorString: String?) : HandshakeMessage() { - override fun toString(): String { - return "ClientLoginReject(errorString=$errorString)" - } - } - - class ClientLoginAck : HandshakeMessage() { - override fun toString(): String { - return "ClientLoginAck" - } - } - - class SessionInit(val identities: QVariantList?, val bufferInfos: QVariantList?, - val networkIds: QVariantList?) : - HandshakeMessage() { - override fun toString(): String { - return "SessionInit" - } - } - - companion object : - HandshakeMessageSerializer<HandshakeMessage> { - override fun serialize(data: HandshakeMessage) = when (data) { - is ClientInit -> ClientInitSerializer.serialize(data) - is ClientInitReject -> ClientInitRejectSerializer.serialize(data) - is ClientInitAck -> ClientInitAckSerializer.serialize(data) - is CoreSetupData -> CoreSetupDataSerializer.serialize(data) - is CoreSetupReject -> CoreSetupRejectSerializer.serialize(data) - is CoreSetupAck -> CoreSetupAckSerializer.serialize(data) - is ClientLogin -> ClientLoginSerializer.serialize(data) - is ClientLoginReject -> ClientLoginRejectSerializer.serialize(data) - is ClientLoginAck -> ClientLoginAckSerializer.serialize(data) - is SessionInit -> SessionInitSerializer.serialize(data) - } - - override fun deserialize(data: QVariantMap): HandshakeMessage { - val msgType = data["MsgType"].value<String?>() - return when (msgType) { - "ClientInit" -> ClientInitSerializer.deserialize(data) - "ClientInitReject" -> ClientInitRejectSerializer.deserialize(data) - "ClientInitAck" -> ClientInitAckSerializer.deserialize(data) - "CoreSetupData" -> CoreSetupDataSerializer.deserialize(data) - "CoreSetupReject" -> CoreSetupRejectSerializer.deserialize(data) - "CoreSetupAck" -> CoreSetupAckSerializer.deserialize(data) - "ClientLogin" -> ClientLoginSerializer.deserialize(data) - "ClientLoginReject" -> ClientLoginRejectSerializer.deserialize(data) - "ClientLoginAck" -> ClientLoginAckSerializer.deserialize(data) - "SessionInit" -> SessionInitSerializer.deserialize(data) - else -> throw IllegalArgumentException( - "Invalid MsgType: $msgType" - ) - } - } - } -} diff --git a/lib/src/main/java/de/kuschku/libquassel/protocol/message/HandshakeMessageSerializer.kt b/lib/src/main/java/de/kuschku/libquassel/protocol/message/HandshakeMessageSerializer.kt deleted file mode 100644 index a25c2e7fa3c6a40bf940e28f0b113d9197ccd565..0000000000000000000000000000000000000000 --- a/lib/src/main/java/de/kuschku/libquassel/protocol/message/HandshakeMessageSerializer.kt +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.libquassel.protocol.message - -import de.kuschku.libquassel.protocol.QVariantMap - -interface HandshakeMessageSerializer<T : HandshakeMessage> { - fun serialize(data: T): QVariantMap - fun deserialize(data: QVariantMap): T -} diff --git a/lib/src/main/java/de/kuschku/libquassel/protocol/message/HeartBeatReplySerializer.kt b/lib/src/main/java/de/kuschku/libquassel/protocol/message/HeartBeatReplySerializer.kt deleted file mode 100644 index 94c49f8e61e6f0c1084e0daf32524919f6d16ea7..0000000000000000000000000000000000000000 --- a/lib/src/main/java/de/kuschku/libquassel/protocol/message/HeartBeatReplySerializer.kt +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.libquassel.protocol.message - -import de.kuschku.libquassel.protocol.QVariant -import de.kuschku.libquassel.protocol.QVariantList -import de.kuschku.libquassel.protocol.Type -import de.kuschku.libquassel.protocol.value -import org.threeten.bp.Instant - -object HeartBeatReplySerializer : SignalProxyMessageSerializer<SignalProxyMessage.HeartBeatReply> { - override fun serialize(data: SignalProxyMessage.HeartBeatReply) = listOf( - QVariant.of(RequestType.HeartBeatReply.value, Type.Int), - QVariant.of(data.timestamp, Type.QDateTime) - ) - - override fun deserialize(data: QVariantList) = SignalProxyMessage.HeartBeatReply( - data[0].value(Instant.EPOCH) - ) -} diff --git a/lib/src/main/java/de/kuschku/libquassel/protocol/message/HeartBeatSerializer.kt b/lib/src/main/java/de/kuschku/libquassel/protocol/message/HeartBeatSerializer.kt deleted file mode 100644 index 4da6bb76db7dde679b2c94539bd403b5c9f2a0cd..0000000000000000000000000000000000000000 --- a/lib/src/main/java/de/kuschku/libquassel/protocol/message/HeartBeatSerializer.kt +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.libquassel.protocol.message - -import de.kuschku.libquassel.protocol.QVariant -import de.kuschku.libquassel.protocol.QVariantList -import de.kuschku.libquassel.protocol.Type -import de.kuschku.libquassel.protocol.value -import org.threeten.bp.Instant - -object HeartBeatSerializer : SignalProxyMessageSerializer<SignalProxyMessage.HeartBeat> { - override fun serialize(data: SignalProxyMessage.HeartBeat) = listOf( - QVariant.of(RequestType.HeartBeat.value, Type.Int), - QVariant.of(data.timestamp, Type.QDateTime) - ) - - override fun deserialize(data: QVariantList) = SignalProxyMessage.HeartBeat( - data[0].value(Instant.EPOCH) - ) -} diff --git a/lib/src/main/java/de/kuschku/libquassel/protocol/message/InitDataSerializer.kt b/lib/src/main/java/de/kuschku/libquassel/protocol/message/InitDataSerializer.kt deleted file mode 100644 index 20769074c040bef5f0e663019bfd642ed770cc25..0000000000000000000000000000000000000000 --- a/lib/src/main/java/de/kuschku/libquassel/protocol/message/InitDataSerializer.kt +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.libquassel.protocol.message - -import de.kuschku.libquassel.protocol.* -import de.kuschku.libquassel.protocol.primitive.serializer.StringSerializer -import de.kuschku.libquassel.util.helper.deserializeString -import de.kuschku.libquassel.util.helper.serializeString -import java.nio.ByteBuffer - -object InitDataSerializer : SignalProxyMessageSerializer<SignalProxyMessage.InitData> { - override fun serialize(data: SignalProxyMessage.InitData) = listOf( - QVariant.of<Any>(RequestType.InitData.value, Type.Int), - QVariant.of<Any>(data.className.serializeString(StringSerializer.UTF8), Type.QByteArray), - QVariant.of<Any>(data.objectName.serializeString(StringSerializer.UTF8), Type.QByteArray), - QVariant.of<Any>(data.initData, Type.QVariantMap) - ) - - override fun deserialize(data: QVariantList) = SignalProxyMessage.InitData( - data[0].value<ByteBuffer?>().deserializeString(StringSerializer.UTF8) ?: "", - data[1].value<ByteBuffer?>().deserializeString(StringSerializer.UTF8) ?: "", - data.drop(2).toVariantMap() - ) -} diff --git a/lib/src/main/java/de/kuschku/libquassel/protocol/message/InitRequestSerializer.kt b/lib/src/main/java/de/kuschku/libquassel/protocol/message/InitRequestSerializer.kt deleted file mode 100644 index 4ce5964779d0b9366904217d0e133a81561868cc..0000000000000000000000000000000000000000 --- a/lib/src/main/java/de/kuschku/libquassel/protocol/message/InitRequestSerializer.kt +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.libquassel.protocol.message - -import de.kuschku.libquassel.protocol.QVariant -import de.kuschku.libquassel.protocol.QVariantList -import de.kuschku.libquassel.protocol.Type -import de.kuschku.libquassel.protocol.primitive.serializer.StringSerializer -import de.kuschku.libquassel.protocol.value -import de.kuschku.libquassel.util.helper.deserializeString -import de.kuschku.libquassel.util.helper.serializeString -import java.nio.ByteBuffer - -object InitRequestSerializer : SignalProxyMessageSerializer<SignalProxyMessage.InitRequest> { - override fun serialize(data: SignalProxyMessage.InitRequest) = listOf( - QVariant.of(RequestType.InitRequest.value, Type.Int), - QVariant.of(data.className.serializeString(StringSerializer.UTF8), Type.QByteArray), - QVariant.of(data.objectName.serializeString(StringSerializer.UTF8), Type.QByteArray) - ) - - override fun deserialize(data: QVariantList) = SignalProxyMessage.InitRequest( - data[0].value<ByteBuffer?>().deserializeString(StringSerializer.UTF8) ?: "", - data[1].value<ByteBuffer?>().deserializeString(StringSerializer.UTF8) ?: "" - ) -} diff --git a/lib/src/main/java/de/kuschku/libquassel/protocol/message/RequestType.kt b/lib/src/main/java/de/kuschku/libquassel/protocol/message/RequestType.kt deleted file mode 100644 index 79f902247e8ae4219a7375a0c2733a57bed688fa..0000000000000000000000000000000000000000 --- a/lib/src/main/java/de/kuschku/libquassel/protocol/message/RequestType.kt +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.libquassel.protocol.message - -enum class RequestType(val value: Int) { - Invalid(0), - Sync(1), - RpcCall(2), - InitRequest(3), - InitData(4), - HeartBeat(5), - HeartBeatReply(6); - - companion object { - private val byId = enumValues<RequestType>().associateBy( - RequestType::value - ) - - fun of(value: Int) = byId[value] ?: Invalid - } -} diff --git a/lib/src/main/java/de/kuschku/libquassel/protocol/message/RpcCallSerializer.kt b/lib/src/main/java/de/kuschku/libquassel/protocol/message/RpcCallSerializer.kt deleted file mode 100644 index 2df8b0af270643586c507ee5604c0aa056558e4b..0000000000000000000000000000000000000000 --- a/lib/src/main/java/de/kuschku/libquassel/protocol/message/RpcCallSerializer.kt +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.libquassel.protocol.message - -import de.kuschku.libquassel.protocol.QVariant -import de.kuschku.libquassel.protocol.QVariantList -import de.kuschku.libquassel.protocol.Type -import de.kuschku.libquassel.protocol.primitive.serializer.StringSerializer -import de.kuschku.libquassel.protocol.value -import de.kuschku.libquassel.util.helper.deserializeString -import de.kuschku.libquassel.util.helper.serializeString -import java.nio.ByteBuffer - -object RpcCallSerializer : SignalProxyMessageSerializer<SignalProxyMessage.RpcCall> { - override fun serialize(data: SignalProxyMessage.RpcCall) = listOf( - QVariant.of(RequestType.RpcCall.value, Type.Int), - QVariant.of(data.slotName.serializeString(StringSerializer.UTF8), Type.QByteArray), - *data.params.toTypedArray() - ) - - override fun deserialize(data: QVariantList) = SignalProxyMessage.RpcCall( - data[0].value<ByteBuffer?>().deserializeString(StringSerializer.UTF8) ?: "", - data.drop(1) - ) -} diff --git a/lib/src/main/java/de/kuschku/libquassel/protocol/message/SessionInitSerializer.kt b/lib/src/main/java/de/kuschku/libquassel/protocol/message/SessionInitSerializer.kt deleted file mode 100644 index 84bb08e245aa5d0b5d2c5dbe89b1999d7b264214..0000000000000000000000000000000000000000 --- a/lib/src/main/java/de/kuschku/libquassel/protocol/message/SessionInitSerializer.kt +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.libquassel.protocol.message - -import de.kuschku.libquassel.protocol.QVariant -import de.kuschku.libquassel.protocol.QVariantMap -import de.kuschku.libquassel.protocol.Type -import de.kuschku.libquassel.protocol.value - -object SessionInitSerializer : HandshakeMessageSerializer<HandshakeMessage.SessionInit> { - override fun serialize(data: HandshakeMessage.SessionInit) = mapOf( - "MsgType" to QVariant.of("SessionInit", Type.QString), - "SessionState" to QVariant.of(mapOf( - "BufferInfos" to QVariant.of(data.bufferInfos, Type.QVariantList), - "NetworkIds" to QVariant.of(data.networkIds, Type.QVariantList), - "Identities" to QVariant.of(data.identities, Type.QVariantList) - ), Type.QVariantMap - ) - ) - - override fun deserialize(data: QVariantMap): HandshakeMessage.SessionInit { - val setupData = data["SessionState"].value<QVariantMap?>() - return HandshakeMessage.SessionInit( - bufferInfos = setupData?.get("BufferInfos").value(), - networkIds = setupData?.get("NetworkIds").value(), - identities = setupData?.get("Identities").value() - ) - } -} diff --git a/lib/src/main/java/de/kuschku/libquassel/protocol/message/SignalProxyMessage.kt b/lib/src/main/java/de/kuschku/libquassel/protocol/message/SignalProxyMessage.kt deleted file mode 100644 index 46cf450d054fb16767056ee3fd6bd8cbeb6243a9..0000000000000000000000000000000000000000 --- a/lib/src/main/java/de/kuschku/libquassel/protocol/message/SignalProxyMessage.kt +++ /dev/null @@ -1,90 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.libquassel.protocol.message - -import de.kuschku.libquassel.protocol.QVariantList -import de.kuschku.libquassel.protocol.QVariantMap -import de.kuschku.libquassel.protocol.value -import org.threeten.bp.Instant - -sealed class SignalProxyMessage { - class SyncMessage(val className: String, val objectName: String, val slotName: String, - val params: QVariantList) : SignalProxyMessage() { - override fun toString(): String { - return "SyncMessage::$className:$objectName:$slotName" - } - } - - class RpcCall(val slotName: String, val params: QVariantList) : SignalProxyMessage() { - override fun toString(): String { - return "RpcCall::$slotName" - } - } - - class InitRequest(val className: String, val objectName: String) : SignalProxyMessage() { - override fun toString(): String { - return "InitRequest::$className:$objectName" - } - } - - class InitData(val className: String, val objectName: String, val initData: QVariantMap) : - SignalProxyMessage() { - override fun toString(): String { - return "InitData::$className:$objectName" - } - } - - class HeartBeat(val timestamp: Instant) : SignalProxyMessage() { - override fun toString(): String { - return "HeartBeat::$timestamp" - } - } - - class HeartBeatReply(val timestamp: Instant) : SignalProxyMessage() { - override fun toString(): String { - return "HeartBeatReply::$timestamp" - } - } - - companion object : - SignalProxyMessageSerializer<SignalProxyMessage> { - override fun serialize(data: SignalProxyMessage) = when (data) { - is SyncMessage -> SyncMessageSerializer.serialize(data) - is RpcCall -> RpcCallSerializer.serialize(data) - is InitRequest -> InitRequestSerializer.serialize(data) - is InitData -> InitDataSerializer.serialize(data) - is HeartBeat -> HeartBeatSerializer.serialize(data) - is HeartBeatReply -> HeartBeatReplySerializer.serialize(data) - } - - override fun deserialize(data: QVariantList): SignalProxyMessage { - val type = data.first().value(-1) - return when (RequestType.of(type)) { - RequestType.Sync -> SyncMessageSerializer.deserialize(data.drop(1)) - RequestType.RpcCall -> RpcCallSerializer.deserialize(data.drop(1)) - RequestType.InitRequest -> InitRequestSerializer.deserialize(data.drop(1)) - RequestType.InitData -> InitDataSerializer.deserialize(data.drop(1)) - RequestType.HeartBeat -> HeartBeatSerializer.deserialize(data.drop(1)) - RequestType.HeartBeatReply -> HeartBeatReplySerializer.deserialize(data.drop(1)) - else -> throw IllegalArgumentException("Invalid MsgType: $type") - } - } - } -} diff --git a/lib/src/main/java/de/kuschku/libquassel/protocol/message/SignalProxyMessageSerializer.kt b/lib/src/main/java/de/kuschku/libquassel/protocol/message/SignalProxyMessageSerializer.kt deleted file mode 100644 index 5e2b937d772e800ddfc69b47fc0eed2f521fd267..0000000000000000000000000000000000000000 --- a/lib/src/main/java/de/kuschku/libquassel/protocol/message/SignalProxyMessageSerializer.kt +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.libquassel.protocol.message - -import de.kuschku.libquassel.protocol.QVariantList - -interface SignalProxyMessageSerializer<T : SignalProxyMessage> { - fun serialize(data: T): QVariantList - fun deserialize(data: QVariantList): T -} diff --git a/lib/src/main/java/de/kuschku/libquassel/protocol/message/SyncMessageSerializer.kt b/lib/src/main/java/de/kuschku/libquassel/protocol/message/SyncMessageSerializer.kt deleted file mode 100644 index 60f6d51d4653e8aef364ec1920120a278f147987..0000000000000000000000000000000000000000 --- a/lib/src/main/java/de/kuschku/libquassel/protocol/message/SyncMessageSerializer.kt +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.libquassel.protocol.message - -import de.kuschku.libquassel.protocol.QVariant -import de.kuschku.libquassel.protocol.QVariantList -import de.kuschku.libquassel.protocol.Type -import de.kuschku.libquassel.protocol.primitive.serializer.StringSerializer -import de.kuschku.libquassel.protocol.value -import de.kuschku.libquassel.util.helper.deserializeString -import de.kuschku.libquassel.util.helper.serializeString -import java.nio.ByteBuffer - -object SyncMessageSerializer : SignalProxyMessageSerializer<SignalProxyMessage.SyncMessage> { - override fun serialize(data: SignalProxyMessage.SyncMessage): QVariantList = listOf( - QVariant.of(RequestType.Sync.value, Type.Int), - QVariant.of(data.className.serializeString(StringSerializer.UTF8), Type.QByteArray), - QVariant.of(data.objectName.serializeString(StringSerializer.UTF8), Type.QByteArray), - QVariant.of(data.slotName.serializeString(StringSerializer.UTF8), Type.QByteArray), - *data.params.toTypedArray() - ) - - override fun deserialize(data: QVariantList) = SignalProxyMessage.SyncMessage( - data[0].value<ByteBuffer?>().deserializeString(StringSerializer.UTF8) ?: "", - data[1].value<ByteBuffer?>().deserializeString(StringSerializer.UTF8) ?: "", - data[2].value<ByteBuffer?>().deserializeString(StringSerializer.UTF8) ?: "", - data.drop(3) - ) -} diff --git a/lib/src/main/java/de/kuschku/libquassel/protocol/primitive/serializer/BoolSerializer.kt b/lib/src/main/java/de/kuschku/libquassel/protocol/primitive/serializer/BoolSerializer.kt deleted file mode 100644 index 56f8c351cf61f744e7489eaf4e2ad870871ca6a3..0000000000000000000000000000000000000000 --- a/lib/src/main/java/de/kuschku/libquassel/protocol/primitive/serializer/BoolSerializer.kt +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.libquassel.protocol.primitive.serializer - -import de.kuschku.libquassel.quassel.QuasselFeatures -import de.kuschku.libquassel.util.nio.ChainedByteBuffer -import java.nio.ByteBuffer - -object BoolSerializer : Serializer<Boolean> { - override fun serialize(buffer: ChainedByteBuffer, data: Boolean, features: QuasselFeatures) = - buffer.put((if (data) 0x01 else 0x00).toByte()) - - override fun deserialize(buffer: ByteBuffer, features: QuasselFeatures) = - buffer.get() != 0x00.toByte() -} diff --git a/lib/src/main/java/de/kuschku/libquassel/protocol/primitive/serializer/BufferIdSerializer.kt b/lib/src/main/java/de/kuschku/libquassel/protocol/primitive/serializer/BufferIdSerializer.kt deleted file mode 100644 index bed557e263d1caeff4bdc5fe5dbc354c3274c358..0000000000000000000000000000000000000000 --- a/lib/src/main/java/de/kuschku/libquassel/protocol/primitive/serializer/BufferIdSerializer.kt +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.libquassel.protocol.primitive.serializer - -import de.kuschku.libquassel.protocol.BufferId -import de.kuschku.libquassel.quassel.QuasselFeatures -import de.kuschku.libquassel.util.nio.ChainedByteBuffer -import java.nio.ByteBuffer - -object BufferIdSerializer : Serializer<BufferId> { - override fun serialize(buffer: ChainedByteBuffer, data: BufferId, features: QuasselFeatures) { - SignedIdSerializer.serialize(buffer, data.id, features) - } - - override fun deserialize(buffer: ByteBuffer, features: QuasselFeatures): BufferId { - return BufferId(SignedIdSerializer.deserialize(buffer, features)) - } -} diff --git a/lib/src/main/java/de/kuschku/libquassel/protocol/primitive/serializer/BufferInfoSerializer.kt b/lib/src/main/java/de/kuschku/libquassel/protocol/primitive/serializer/BufferInfoSerializer.kt deleted file mode 100644 index d71fcf4415e5271c799e9b74fcb69bfe4d350c65..0000000000000000000000000000000000000000 --- a/lib/src/main/java/de/kuschku/libquassel/protocol/primitive/serializer/BufferInfoSerializer.kt +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.libquassel.protocol.primitive.serializer - -import de.kuschku.libquassel.protocol.Buffer_Type -import de.kuschku.libquassel.quassel.BufferInfo -import de.kuschku.libquassel.quassel.QuasselFeatures -import de.kuschku.libquassel.util.nio.ChainedByteBuffer -import java.nio.ByteBuffer - -object BufferInfoSerializer : Serializer<BufferInfo> { - override fun serialize(buffer: ChainedByteBuffer, data: BufferInfo, features: QuasselFeatures) { - BufferIdSerializer.serialize(buffer, data.bufferId, features) - NetworkIdSerializer.serialize(buffer, data.networkId, features) - ShortSerializer.serialize(buffer, data.type.toShort(), features) - IntSerializer.serialize(buffer, data.groupId, features) - StringSerializer.UTF8.serialize(buffer, data.bufferName, features) - } - - override fun deserialize(buffer: ByteBuffer, features: QuasselFeatures): BufferInfo { - val bufferId = BufferIdSerializer.deserialize(buffer, features) - val networkId = NetworkIdSerializer.deserialize(buffer, features) - val type = Buffer_Type.of(ShortSerializer.deserialize(buffer, features)) - val groupId = IntSerializer.deserialize(buffer, features) - val bufferName = StringSerializer.UTF8.deserialize(buffer, features) - return BufferInfo( - bufferId = bufferId, - networkId = networkId, - type = type, - groupId = groupId, - bufferName = bufferName - ) - } -} diff --git a/lib/src/main/java/de/kuschku/libquassel/protocol/primitive/serializer/ByteArraySerializer.kt b/lib/src/main/java/de/kuschku/libquassel/protocol/primitive/serializer/ByteArraySerializer.kt deleted file mode 100644 index 6f0bab6667af62beb032ba7ca03e7f110edfa75e..0000000000000000000000000000000000000000 --- a/lib/src/main/java/de/kuschku/libquassel/protocol/primitive/serializer/ByteArraySerializer.kt +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.libquassel.protocol.primitive.serializer - -import de.kuschku.libquassel.quassel.QuasselFeatures -import de.kuschku.libquassel.util.nio.ChainedByteBuffer -import java.nio.ByteBuffer - -object ByteArraySerializer : Serializer<ByteBuffer?> { - override fun serialize(buffer: ChainedByteBuffer, data: ByteBuffer?, features: QuasselFeatures) { - if (data == null) { - IntSerializer.serialize(buffer, -1, features) - } else { - IntSerializer.serialize(buffer, data.remaining(), features) - buffer.put(data) - } - } - - override fun deserialize(buffer: ByteBuffer, features: QuasselFeatures): ByteBuffer? { - val len = IntSerializer.deserialize(buffer, features) - return if (len == -1) { - null - } else { - val result = ByteBuffer.allocate(len) - while (result.hasRemaining()) - result.put(buffer.get()) - result.flip() - result - } - } -} diff --git a/lib/src/main/java/de/kuschku/libquassel/protocol/primitive/serializer/ByteSerializer.kt b/lib/src/main/java/de/kuschku/libquassel/protocol/primitive/serializer/ByteSerializer.kt deleted file mode 100644 index 3bc5e3ab477cfd4f74b4687e3d02dffe674dde25..0000000000000000000000000000000000000000 --- a/lib/src/main/java/de/kuschku/libquassel/protocol/primitive/serializer/ByteSerializer.kt +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.libquassel.protocol.primitive.serializer - -import de.kuschku.libquassel.quassel.QuasselFeatures -import de.kuschku.libquassel.util.nio.ChainedByteBuffer -import java.nio.ByteBuffer - -object ByteSerializer : Serializer<Byte> { - override fun serialize(buffer: ChainedByteBuffer, data: Byte, features: QuasselFeatures) { - buffer.put(data) - } - - override fun deserialize(buffer: ByteBuffer, features: QuasselFeatures): Byte { - return buffer.get() - } -} diff --git a/lib/src/main/java/de/kuschku/libquassel/protocol/primitive/serializer/CharSerializer.kt b/lib/src/main/java/de/kuschku/libquassel/protocol/primitive/serializer/CharSerializer.kt deleted file mode 100644 index cac62a57f35a84b45a2b9ddb830c78c13d008789..0000000000000000000000000000000000000000 --- a/lib/src/main/java/de/kuschku/libquassel/protocol/primitive/serializer/CharSerializer.kt +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.libquassel.protocol.primitive.serializer - -import de.kuschku.libquassel.quassel.QuasselFeatures -import de.kuschku.libquassel.util.nio.ChainedByteBuffer -import java.nio.ByteBuffer -import java.nio.CharBuffer - -object CharSerializer : Serializer<Char> { - private val byteBufferIn = ByteBuffer.allocateDirect(2) - private val byteBufferOut = ByteBuffer.allocateDirect(2) - private val charBufferIn = CharBuffer.allocate(1) - private val charBufferOut = CharBuffer.allocate(1) - private val encoder = Charsets.UTF_16BE.newEncoder() - private val decoder = Charsets.UTF_16BE.newDecoder() - override fun serialize(buffer: ChainedByteBuffer, data: Char, features: QuasselFeatures) { - charBufferIn.clear() - charBufferIn.put(data) - charBufferIn.flip() - byteBufferIn.clear() - encoder.encode(charBufferIn, byteBufferIn, true) - byteBufferIn.flip() - if (byteBufferIn.remaining() == 2) { - buffer.put(byteBufferIn) - } else { - buffer.putShort(0) - } - } - - override fun deserialize(buffer: ByteBuffer, features: QuasselFeatures): Char { - byteBufferOut.clear() - byteBufferOut.putShort(buffer.short) - byteBufferOut.flip() - charBufferOut.clear() - decoder.decode(byteBufferOut, charBufferOut, true) - charBufferOut.flip() - return if (charBufferOut.remaining() == 1) - charBufferOut.get() - else - '\u0000' - } -} diff --git a/lib/src/main/java/de/kuschku/libquassel/protocol/primitive/serializer/DateTimeSerializer.kt b/lib/src/main/java/de/kuschku/libquassel/protocol/primitive/serializer/DateTimeSerializer.kt deleted file mode 100644 index b589dcde187373a6b677f7d628bb0621606dbb0d..0000000000000000000000000000000000000000 --- a/lib/src/main/java/de/kuschku/libquassel/protocol/primitive/serializer/DateTimeSerializer.kt +++ /dev/null @@ -1,104 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.libquassel.protocol.primitive.serializer - -import de.kuschku.libquassel.quassel.QuasselFeatures -import de.kuschku.libquassel.util.nio.ChainedByteBuffer -import org.threeten.bp.* -import org.threeten.bp.temporal.ChronoField -import org.threeten.bp.temporal.JulianFields -import org.threeten.bp.temporal.Temporal -import java.nio.ByteBuffer - -object DateTimeSerializer : Serializer<Temporal> { - enum class TimeSpec(val value: Byte) { - LocalUnknown(-1), - LocalStandard(0), - LocalDST(1), - UTC(2), - OffsetFromUTC(3); - - companion object { - private val map = TimeSpec.values().associateBy(TimeSpec::value) - fun of(type: Byte) = map[type] - } - } - - override fun serialize(buffer: ChainedByteBuffer, data: Temporal, features: QuasselFeatures) { - when (data) { - is LocalDateTime -> { - IntSerializer.serialize(buffer, data.getLong(JulianFields.JULIAN_DAY).toInt(), features) - IntSerializer.serialize(buffer, data.getLong(ChronoField.MILLI_OF_DAY).toInt(), features) - ByteSerializer.serialize(buffer, TimeSpec.LocalUnknown.value, features) - } - is OffsetDateTime -> { - IntSerializer.serialize(buffer, data.getLong(JulianFields.JULIAN_DAY).toInt(), features) - IntSerializer.serialize(buffer, data.getLong(ChronoField.MILLI_OF_DAY).toInt(), features) - ByteSerializer.serialize(buffer, TimeSpec.OffsetFromUTC.value, features) - IntSerializer.serialize(buffer, data.offset.totalSeconds, features) - } - is ZonedDateTime -> { - IntSerializer.serialize(buffer, data.getLong(JulianFields.JULIAN_DAY).toInt(), features) - IntSerializer.serialize(buffer, data.getLong(ChronoField.MILLI_OF_DAY).toInt(), features) - ByteSerializer.serialize(buffer, TimeSpec.OffsetFromUTC.value, features) - IntSerializer.serialize(buffer, data.offset.totalSeconds, features) - } - is Instant -> { - val time = data.atOffset(ZoneOffset.UTC) - IntSerializer.serialize(buffer, time.getLong(JulianFields.JULIAN_DAY).toInt(), features) - IntSerializer.serialize(buffer, time.getLong(ChronoField.MILLI_OF_DAY).toInt(), features) - ByteSerializer.serialize(buffer, TimeSpec.UTC.value, features) - } - else -> - throw IllegalArgumentException( - "Unsupported Format: ${data::class.java.canonicalName}" - ) - } - } - - override fun deserialize(buffer: ByteBuffer, features: QuasselFeatures): Temporal { - val julianDay = IntSerializer.deserialize(buffer, features).toLong() - val milliOfDay = IntSerializer.deserialize(buffer, features).toLong() - val timeSpec = TimeSpec.of(ByteSerializer.deserialize(buffer, features)) - ?: TimeSpec.LocalUnknown - if (milliOfDay == -1L || julianDay == -1L) - return Instant.EPOCH - return when (timeSpec) { - TimeSpec.LocalStandard, - TimeSpec.LocalUnknown, - TimeSpec.LocalDST -> - Instant.EPOCH - .atZone(ZoneOffset.systemDefault()) - .with(JulianFields.JULIAN_DAY, julianDay) - .with(ChronoField.MILLI_OF_DAY, milliOfDay) - TimeSpec.OffsetFromUTC -> - Instant.EPOCH - .atOffset(ZoneOffset.ofTotalSeconds(IntSerializer.deserialize(buffer, features))) - .with(JulianFields.JULIAN_DAY, julianDay) - .with(ChronoField.MILLI_OF_DAY, milliOfDay) - TimeSpec.UTC -> - Instant.EPOCH - .atOffset(ZoneOffset.UTC) - .with(JulianFields.JULIAN_DAY, julianDay) - .with(ChronoField.MILLI_OF_DAY, milliOfDay) - .toInstant() - } - } -} diff --git a/lib/src/main/java/de/kuschku/libquassel/protocol/primitive/serializer/DccConfig_IpDetectionModeSerializer.kt b/lib/src/main/java/de/kuschku/libquassel/protocol/primitive/serializer/DccConfig_IpDetectionModeSerializer.kt deleted file mode 100644 index 9102a6e00e287a554bb136c4a173802a33609d74..0000000000000000000000000000000000000000 --- a/lib/src/main/java/de/kuschku/libquassel/protocol/primitive/serializer/DccConfig_IpDetectionModeSerializer.kt +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.libquassel.protocol.primitive.serializer - -import de.kuschku.libquassel.quassel.QuasselFeatures -import de.kuschku.libquassel.quassel.syncables.interfaces.IDccConfig -import de.kuschku.libquassel.util.nio.ChainedByteBuffer -import java.nio.ByteBuffer - -object DccConfig_IpDetectionModeSerializer : Serializer<IDccConfig.IpDetectionMode> { - override fun serialize(buffer: ChainedByteBuffer, data: IDccConfig.IpDetectionMode, - features: QuasselFeatures) { - UByteSerializer.serialize(buffer, data.value, features) - } - - override fun deserialize(buffer: ByteBuffer, - features: QuasselFeatures): IDccConfig.IpDetectionMode { - return IDccConfig.IpDetectionMode.of(UByteSerializer.deserialize(buffer, features)) - } -} diff --git a/lib/src/main/java/de/kuschku/libquassel/protocol/primitive/serializer/DccConfig_PortSelectionModeSerializer.kt b/lib/src/main/java/de/kuschku/libquassel/protocol/primitive/serializer/DccConfig_PortSelectionModeSerializer.kt deleted file mode 100644 index 65324910b4b4059ef9aac43a76fd06b780dcc789..0000000000000000000000000000000000000000 --- a/lib/src/main/java/de/kuschku/libquassel/protocol/primitive/serializer/DccConfig_PortSelectionModeSerializer.kt +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.libquassel.protocol.primitive.serializer - -import de.kuschku.libquassel.quassel.QuasselFeatures -import de.kuschku.libquassel.quassel.syncables.interfaces.IDccConfig -import de.kuschku.libquassel.util.nio.ChainedByteBuffer -import java.nio.ByteBuffer - -object DccConfig_PortSelectionModeSerializer : Serializer<IDccConfig.PortSelectionMode> { - override fun serialize(buffer: ChainedByteBuffer, data: IDccConfig.PortSelectionMode, - features: QuasselFeatures) { - UByteSerializer.serialize(buffer, data.value, features) - } - - override fun deserialize(buffer: ByteBuffer, - features: QuasselFeatures): IDccConfig.PortSelectionMode { - return IDccConfig.PortSelectionMode.of(UByteSerializer.deserialize(buffer, features)) - } -} diff --git a/lib/src/main/java/de/kuschku/libquassel/protocol/primitive/serializer/HandshakeVariantMapSerializer.kt b/lib/src/main/java/de/kuschku/libquassel/protocol/primitive/serializer/HandshakeVariantMapSerializer.kt deleted file mode 100644 index 64809c95f2bdfef6fb223b6e1019c67241a2f976..0000000000000000000000000000000000000000 --- a/lib/src/main/java/de/kuschku/libquassel/protocol/primitive/serializer/HandshakeVariantMapSerializer.kt +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.libquassel.protocol.primitive.serializer - -import de.kuschku.libquassel.protocol.QVariant -import de.kuschku.libquassel.protocol.QVariantMap -import de.kuschku.libquassel.protocol.Type -import de.kuschku.libquassel.protocol.value -import de.kuschku.libquassel.quassel.QuasselFeatures -import de.kuschku.libquassel.util.nio.ChainedByteBuffer -import java.nio.ByteBuffer - -object HandshakeVariantMapSerializer : Serializer<QVariantMap> { - override fun serialize(buffer: ChainedByteBuffer, data: QVariantMap, features: QuasselFeatures) { - IntSerializer.serialize(buffer, data.size * 2, features) - data.entries.forEach { (key, value) -> - VariantSerializer.serialize(buffer, QVariant.of(key, Type.QString), features) - VariantSerializer.serialize(buffer, value, features) - } - } - - override fun deserialize(buffer: ByteBuffer, features: QuasselFeatures): QVariantMap { - val range = 0 until IntSerializer.deserialize(buffer, features) / 2 - val pairs = range.map { - val keyRaw: ByteBuffer? = VariantSerializer.deserialize(buffer, features).value() - val key: String? = if (keyRaw != null) { - StringSerializer.UTF8.deserializeAll(keyRaw) - } else { - null - } - val value = VariantSerializer.deserialize(buffer, features) - Pair(key ?: "", value) - } - val pairArray = pairs.toTypedArray() - return mapOf(*pairArray) - } -} diff --git a/lib/src/main/java/de/kuschku/libquassel/protocol/primitive/serializer/HostAddressSerializer.kt b/lib/src/main/java/de/kuschku/libquassel/protocol/primitive/serializer/HostAddressSerializer.kt deleted file mode 100644 index a2591c7fc0c643f97a3772bc7e0c4e47cf84f1c0..0000000000000000000000000000000000000000 --- a/lib/src/main/java/de/kuschku/libquassel/protocol/primitive/serializer/HostAddressSerializer.kt +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.libquassel.protocol.primitive.serializer - -import de.kuschku.libquassel.protocol.NetworkLayerProtocol -import de.kuschku.libquassel.quassel.QuasselFeatures -import de.kuschku.libquassel.util.nio.ChainedByteBuffer -import java.net.Inet4Address -import java.net.Inet6Address -import java.net.InetAddress -import java.nio.ByteBuffer - -object HostAddressSerializer : Serializer<InetAddress> { - override fun serialize(buffer: ChainedByteBuffer, data: InetAddress, features: QuasselFeatures) { - when (data) { - is Inet4Address -> { - ByteSerializer.serialize(buffer, NetworkLayerProtocol.IPv4Protocol.value, features) - buffer.put(data.address) - } - is Inet6Address -> { - ByteSerializer.serialize(buffer, NetworkLayerProtocol.IPv6Protocol.value, features) - buffer.put(data.address) - } - else -> { - ByteSerializer.serialize( - buffer, NetworkLayerProtocol.UnknownNetworkLayerProtocol.value, - features - ) - throw IllegalArgumentException("Invalid network protocol ${data.javaClass.canonicalName}") - } - } - } - - override fun deserialize(buffer: ByteBuffer, features: QuasselFeatures): InetAddress { - val type = ByteSerializer.deserialize(buffer, features) - return when (NetworkLayerProtocol.of(type)) { - NetworkLayerProtocol.IPv4Protocol -> { - val buf = ByteArray(4) - buffer.get(buf) - Inet4Address.getByAddress(buf) - } - NetworkLayerProtocol.IPv6Protocol -> { - val buf = ByteArray(16) - buffer.get(buf) - Inet6Address.getByAddress(buf) - } - else -> { - throw IllegalArgumentException("Invalid network protocol $type") - } - } - } -} diff --git a/lib/src/main/java/de/kuschku/libquassel/protocol/primitive/serializer/IdentityIdSerializer.kt b/lib/src/main/java/de/kuschku/libquassel/protocol/primitive/serializer/IdentityIdSerializer.kt deleted file mode 100644 index 41bd05579011eb694165effbd9686699e0c7cfce..0000000000000000000000000000000000000000 --- a/lib/src/main/java/de/kuschku/libquassel/protocol/primitive/serializer/IdentityIdSerializer.kt +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.libquassel.protocol.primitive.serializer - -import de.kuschku.libquassel.protocol.IdentityId -import de.kuschku.libquassel.quassel.QuasselFeatures -import de.kuschku.libquassel.util.nio.ChainedByteBuffer -import java.nio.ByteBuffer - -object IdentityIdSerializer : Serializer<IdentityId> { - override fun serialize(buffer: ChainedByteBuffer, data: IdentityId, features: QuasselFeatures) { - SignedIdSerializer.serialize(buffer, data.id, features) - } - - override fun deserialize(buffer: ByteBuffer, features: QuasselFeatures): IdentityId { - return IdentityId(SignedIdSerializer.deserialize(buffer, features)) - } -} diff --git a/lib/src/main/java/de/kuschku/libquassel/protocol/primitive/serializer/IntSerializer.kt b/lib/src/main/java/de/kuschku/libquassel/protocol/primitive/serializer/IntSerializer.kt deleted file mode 100644 index 1cdd21d0af835ab97eb14694089b50ba48e904c8..0000000000000000000000000000000000000000 --- a/lib/src/main/java/de/kuschku/libquassel/protocol/primitive/serializer/IntSerializer.kt +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.libquassel.protocol.primitive.serializer - -import de.kuschku.libquassel.quassel.QuasselFeatures -import de.kuschku.libquassel.util.nio.ChainedByteBuffer -import java.nio.ByteBuffer - -object IntSerializer : Serializer<Int> { - override fun serialize(buffer: ChainedByteBuffer, data: Int, features: QuasselFeatures) { - buffer.putInt(data) - } - - override fun deserialize(buffer: ByteBuffer, features: QuasselFeatures): Int { - return buffer.int - } -} diff --git a/lib/src/main/java/de/kuschku/libquassel/protocol/primitive/serializer/LongSerializer.kt b/lib/src/main/java/de/kuschku/libquassel/protocol/primitive/serializer/LongSerializer.kt deleted file mode 100644 index ab48fd89f05d13da7212094f5ec47ba309c7b7b1..0000000000000000000000000000000000000000 --- a/lib/src/main/java/de/kuschku/libquassel/protocol/primitive/serializer/LongSerializer.kt +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.libquassel.protocol.primitive.serializer - -import de.kuschku.libquassel.quassel.QuasselFeatures -import de.kuschku.libquassel.util.nio.ChainedByteBuffer -import java.nio.ByteBuffer - -object LongSerializer : Serializer<Long> { - override fun serialize(buffer: ChainedByteBuffer, data: Long, features: QuasselFeatures) { - buffer.putLong(data) - } - - override fun deserialize(buffer: ByteBuffer, features: QuasselFeatures): Long { - return buffer.long - } -} diff --git a/lib/src/main/java/de/kuschku/libquassel/protocol/primitive/serializer/MessageSerializer.kt b/lib/src/main/java/de/kuschku/libquassel/protocol/primitive/serializer/MessageSerializer.kt deleted file mode 100644 index 11c35882e23300936d384c199455b0a57e412819..0000000000000000000000000000000000000000 --- a/lib/src/main/java/de/kuschku/libquassel/protocol/primitive/serializer/MessageSerializer.kt +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.libquassel.protocol.primitive.serializer - -import de.kuschku.libquassel.protocol.Message -import de.kuschku.libquassel.quassel.ExtendedFeature -import de.kuschku.libquassel.quassel.QuasselFeatures -import de.kuschku.libquassel.util.nio.ChainedByteBuffer -import org.threeten.bp.Instant -import java.nio.ByteBuffer - -object MessageSerializer : Serializer<Message> { - override fun serialize(buffer: ChainedByteBuffer, data: Message, features: QuasselFeatures) { - MsgIdSerializer.serialize(buffer, data.messageId, features) - if (features.hasFeature(ExtendedFeature.LongTime)) - LongSerializer.serialize(buffer, data.time.toEpochMilli(), features) - else - IntSerializer.serialize(buffer, data.time.epochSecond.toInt(), features) - IntSerializer.serialize(buffer, data.type.toInt(), features) - ByteSerializer.serialize(buffer, data.flag.toByte(), features) - BufferInfoSerializer.serialize(buffer, data.bufferInfo, features) - StringSerializer.UTF8.serialize(buffer, data.sender, features) - if (features.hasFeature(ExtendedFeature.SenderPrefixes)) - StringSerializer.UTF8.serialize(buffer, data.senderPrefixes, features) - if (features.hasFeature(ExtendedFeature.RichMessages)) - StringSerializer.UTF8.serialize(buffer, data.realName, features) - if (features.hasFeature(ExtendedFeature.RichMessages)) - StringSerializer.UTF8.serialize(buffer, data.avatarUrl, features) - StringSerializer.UTF8.serialize(buffer, data.content, features) - } - - override fun deserialize(buffer: ByteBuffer, features: QuasselFeatures): Message { - return Message( - messageId = MsgIdSerializer.deserialize(buffer, features), - time = if (features.hasFeature(ExtendedFeature.LongTime)) - Instant.ofEpochMilli(LongSerializer.deserialize(buffer, features)) - else - Instant.ofEpochSecond(IntSerializer.deserialize(buffer, features).toLong()), - type = Message.MessageType.of(IntSerializer.deserialize(buffer, features)), - flag = Message.MessageFlag.of( - ByteSerializer.deserialize(buffer, features).toInt() and 0xff - ), - bufferInfo = BufferInfoSerializer.deserialize(buffer, features), - sender = StringSerializer.UTF8.deserialize(buffer, features) ?: "", - senderPrefixes = if (features.hasFeature(ExtendedFeature.SenderPrefixes)) - StringSerializer.UTF8.deserialize(buffer, features) ?: "" else "", - realName = if (features.hasFeature(ExtendedFeature.RichMessages)) - StringSerializer.UTF8.deserialize(buffer, features) ?: "" else "", - avatarUrl = if (features.hasFeature(ExtendedFeature.RichMessages)) - StringSerializer.UTF8.deserialize(buffer, features) ?: "" else "", - content = StringSerializer.UTF8.deserialize(buffer, features) ?: "" - ) - } -} diff --git a/lib/src/main/java/de/kuschku/libquassel/protocol/primitive/serializer/MsgIdSerializer.kt b/lib/src/main/java/de/kuschku/libquassel/protocol/primitive/serializer/MsgIdSerializer.kt deleted file mode 100644 index 7dfc14622cb8e78f302f7a031e8aa516ff326c10..0000000000000000000000000000000000000000 --- a/lib/src/main/java/de/kuschku/libquassel/protocol/primitive/serializer/MsgIdSerializer.kt +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.libquassel.protocol.primitive.serializer - -import de.kuschku.libquassel.protocol.MsgId -import de.kuschku.libquassel.quassel.QuasselFeatures -import de.kuschku.libquassel.util.nio.ChainedByteBuffer -import java.nio.ByteBuffer - -object MsgIdSerializer : Serializer<MsgId> { - override fun serialize(buffer: ChainedByteBuffer, data: MsgId, features: QuasselFeatures) { - SignedId64Serializer.serialize(buffer, data.id, features) - } - - override fun deserialize(buffer: ByteBuffer, features: QuasselFeatures): MsgId { - return MsgId(SignedId64Serializer.deserialize(buffer, features)) - } -} diff --git a/lib/src/main/java/de/kuschku/libquassel/protocol/primitive/serializer/NetworkIdSerializer.kt b/lib/src/main/java/de/kuschku/libquassel/protocol/primitive/serializer/NetworkIdSerializer.kt deleted file mode 100644 index 3d0962f6d29f5d890f892e4ea8330bf5c002e810..0000000000000000000000000000000000000000 --- a/lib/src/main/java/de/kuschku/libquassel/protocol/primitive/serializer/NetworkIdSerializer.kt +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.libquassel.protocol.primitive.serializer - -import de.kuschku.libquassel.protocol.NetworkId -import de.kuschku.libquassel.quassel.QuasselFeatures -import de.kuschku.libquassel.util.nio.ChainedByteBuffer -import java.nio.ByteBuffer - -object NetworkIdSerializer : Serializer<NetworkId> { - override fun serialize(buffer: ChainedByteBuffer, data: NetworkId, features: QuasselFeatures) { - SignedIdSerializer.serialize(buffer, data.id, features) - } - - override fun deserialize(buffer: ByteBuffer, features: QuasselFeatures): NetworkId { - return NetworkId(SignedIdSerializer.deserialize(buffer, features)) - } -} diff --git a/lib/src/main/java/de/kuschku/libquassel/protocol/primitive/serializer/ProtocolInfoSerializer.kt b/lib/src/main/java/de/kuschku/libquassel/protocol/primitive/serializer/ProtocolInfoSerializer.kt deleted file mode 100644 index e85b240522362b74122ed566a08bdb3841bf2749..0000000000000000000000000000000000000000 --- a/lib/src/main/java/de/kuschku/libquassel/protocol/primitive/serializer/ProtocolInfoSerializer.kt +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.libquassel.protocol.primitive.serializer - -import de.kuschku.libquassel.protocol.Protocol_Features -import de.kuschku.libquassel.quassel.ProtocolInfo -import de.kuschku.libquassel.quassel.QuasselFeatures -import de.kuschku.libquassel.util.nio.ChainedByteBuffer -import java.nio.ByteBuffer - -object ProtocolInfoSerializer : Serializer<ProtocolInfo> { - override fun serialize(buffer: ChainedByteBuffer, data: ProtocolInfo, - features: QuasselFeatures) { - UByteSerializer.serialize(buffer, data.flags.toUByte(), features) - UShortSerializer.serialize(buffer, data.data, features) - UByteSerializer.serialize(buffer, data.version, features) - } - - override fun deserialize(buffer: ByteBuffer, features: QuasselFeatures): ProtocolInfo { - return ProtocolInfo( - Protocol_Features.of(UByteSerializer.deserialize(buffer, features).toUInt()), - UShortSerializer.deserialize(buffer, features), - UByteSerializer.deserialize(buffer, features) - ) - } -} diff --git a/lib/src/main/java/de/kuschku/libquassel/protocol/primitive/serializer/Serializer.kt b/lib/src/main/java/de/kuschku/libquassel/protocol/primitive/serializer/Serializer.kt deleted file mode 100644 index a968f940ddb0e08037a6c482866f87ce82d913ca..0000000000000000000000000000000000000000 --- a/lib/src/main/java/de/kuschku/libquassel/protocol/primitive/serializer/Serializer.kt +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright (C) 2017 Janne Mareike Koschinski - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the Free - * Software Foundation, either version 3 of the License, or (at your option) - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ -package de.kuschku.libquassel.protocol.primitive.serializer - -import de.kuschku.libquassel.quassel.QuasselFeatures -import de.kuschku.libquassel.util.nio.ChainedByteBuffer -import java.nio.ByteBuffer - -interface Serializer<T> { - fun serialize(buffer: ChainedByteBuffer, data: T, features: QuasselFeatures) - fun deserialize(buffer: ByteBuffer, features: QuasselFeatures): T -} diff --git a/lib/src/main/java/de/kuschku/libquassel/protocol/primitive/serializer/ShortSerializer.kt b/lib/src/main/java/de/kuschku/libquassel/protocol/primitive/serializer/ShortSerializer.kt deleted file mode 100644 index 3c8c4e3664877fa6361e72a2f5d8e39fb1348ed3..0000000000000000000000000000000000000000 --- a/lib/src/main/java/de/kuschku/libquassel/protocol/primitive/serializer/ShortSerializer.kt +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.libquassel.protocol.primitive.serializer - -import de.kuschku.libquassel.quassel.QuasselFeatures -import de.kuschku.libquassel.util.nio.ChainedByteBuffer -import java.nio.ByteBuffer - -object ShortSerializer : Serializer<Short> { - override fun serialize(buffer: ChainedByteBuffer, data: Short, features: QuasselFeatures) { - buffer.putShort(data) - } - - override fun deserialize(buffer: ByteBuffer, features: QuasselFeatures): Short { - return buffer.short - } -} diff --git a/lib/src/main/java/de/kuschku/libquassel/protocol/primitive/serializer/SignedId64Serializer.kt b/lib/src/main/java/de/kuschku/libquassel/protocol/primitive/serializer/SignedId64Serializer.kt deleted file mode 100644 index f0ab809d998630369f0e1faf8a4afc42c5719876..0000000000000000000000000000000000000000 --- a/lib/src/main/java/de/kuschku/libquassel/protocol/primitive/serializer/SignedId64Serializer.kt +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.libquassel.protocol.primitive.serializer - -import de.kuschku.libquassel.protocol.SignedId64 -import de.kuschku.libquassel.quassel.ExtendedFeature -import de.kuschku.libquassel.quassel.QuasselFeatures -import de.kuschku.libquassel.util.nio.ChainedByteBuffer -import java.nio.ByteBuffer - -object SignedId64Serializer : Serializer<SignedId64> { - override fun serialize(buffer: ChainedByteBuffer, data: SignedId64, features: QuasselFeatures) { - if (features.hasFeature(ExtendedFeature.LongMessageId)) - buffer.putLong(data) - else - buffer.putInt(data.toInt()) - } - - override fun deserialize(buffer: ByteBuffer, features: QuasselFeatures): SignedId64 { - return if (features.hasFeature(ExtendedFeature.LongMessageId)) - buffer.long - else - buffer.int.toLong() - } -} diff --git a/lib/src/main/java/de/kuschku/libquassel/protocol/primitive/serializer/SignedIdSerializer.kt b/lib/src/main/java/de/kuschku/libquassel/protocol/primitive/serializer/SignedIdSerializer.kt deleted file mode 100644 index 5389c6970fce3cee5b7a42012358f2cac4b6d25f..0000000000000000000000000000000000000000 --- a/lib/src/main/java/de/kuschku/libquassel/protocol/primitive/serializer/SignedIdSerializer.kt +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.libquassel.protocol.primitive.serializer - -import de.kuschku.libquassel.protocol.SignedId -import de.kuschku.libquassel.quassel.QuasselFeatures -import de.kuschku.libquassel.util.nio.ChainedByteBuffer -import java.nio.ByteBuffer - -object SignedIdSerializer : Serializer<SignedId> { - override fun serialize(buffer: ChainedByteBuffer, data: SignedId, features: QuasselFeatures) { - buffer.putInt(data) - } - - override fun deserialize(buffer: ByteBuffer, features: QuasselFeatures): SignedId { - return buffer.int - } -} diff --git a/lib/src/main/java/de/kuschku/libquassel/protocol/primitive/serializer/StringListSerializer.kt b/lib/src/main/java/de/kuschku/libquassel/protocol/primitive/serializer/StringListSerializer.kt deleted file mode 100644 index 558abdf0d5c93c62f5abcb57f3e25207d0ea9d9b..0000000000000000000000000000000000000000 --- a/lib/src/main/java/de/kuschku/libquassel/protocol/primitive/serializer/StringListSerializer.kt +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.libquassel.protocol.primitive.serializer - -import de.kuschku.libquassel.protocol.QStringList -import de.kuschku.libquassel.quassel.QuasselFeatures -import de.kuschku.libquassel.util.nio.ChainedByteBuffer -import java.nio.ByteBuffer - -object StringListSerializer : Serializer<QStringList?> { - override fun serialize(buffer: ChainedByteBuffer, data: QStringList?, - features: QuasselFeatures) { - IntSerializer.serialize(buffer, data?.size ?: 0, features) - data?.forEach { - StringSerializer.UTF16.serialize(buffer, it, features) - } - } - - override fun deserialize(buffer: ByteBuffer, features: QuasselFeatures): QStringList { - val size = IntSerializer.deserialize(buffer, features) - val res = ArrayList<String?>(size) - for (i in 0 until size) { - res.add(StringSerializer.UTF16.deserialize(buffer, features)) - } - return res - } -} diff --git a/lib/src/main/java/de/kuschku/libquassel/protocol/primitive/serializer/StringSerializer.kt b/lib/src/main/java/de/kuschku/libquassel/protocol/primitive/serializer/StringSerializer.kt deleted file mode 100644 index e55bea5233c09b00bd885ee91b6905ed440b1013..0000000000000000000000000000000000000000 --- a/lib/src/main/java/de/kuschku/libquassel/protocol/primitive/serializer/StringSerializer.kt +++ /dev/null @@ -1,140 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ -@file:Suppress("NOTHING_TO_INLINE") - -package de.kuschku.libquassel.protocol.primitive.serializer - -import de.kuschku.libquassel.quassel.QuasselFeatures -import de.kuschku.libquassel.util.helper.hexDump -import de.kuschku.libquassel.util.nio.ChainedByteBuffer -import java.nio.ByteBuffer -import java.nio.CharBuffer -import java.nio.charset.Charset -import java.nio.charset.CharsetDecoder -import java.nio.charset.CharsetEncoder -import kotlin.concurrent.getOrSet - -abstract class StringSerializer( - private val charset: Charset, - private val trailingNullBytes: Int -) : Serializer<String?> { - constructor(charset: Charset, trailingNullByte: Boolean = false) : - this(charset, if (trailingNullByte) 1 else 0) - - private val charBuffer = ThreadLocal<CharBuffer>() - private val encoder = ThreadLocal<CharsetEncoder>() - private val decoder = ThreadLocal<CharsetDecoder>() - - object UTF16 : StringSerializer(Charsets.UTF_16BE) - object UTF8 : StringSerializer(Charsets.UTF_8) - object C : StringSerializer(Charsets.ISO_8859_1, trailingNullByte = true) - - private inline fun charBuffer(len: Int): CharBuffer { - val charBuffer = charBuffer.getOrSet { - CharBuffer.allocate(1024) - } - - val buf = if (len >= 1024) - CharBuffer.allocate(len) - else - charBuffer - buf.clear() - buf.limit(len) - return buf - } - - private inline fun encoder() = encoder.getOrSet(charset::newEncoder) - private inline fun decoder() = decoder.getOrSet(charset::newDecoder) - - override fun serialize(buffer: ChainedByteBuffer, data: String?, features: QuasselFeatures) = - try { - if (data == null) { - IntSerializer.serialize(buffer, -1, features) - } else { - val charBuffer = charBuffer(data.length) - charBuffer.put(data) - charBuffer.flip() - val encoder = encoder() - encoder.reset() - val byteBuffer = encoder.encode(charBuffer) - IntSerializer.serialize(buffer, byteBuffer.remaining() + trailingNullBytes, features) - buffer.put(byteBuffer) - for (i in 0 until trailingNullBytes) - buffer.put(0) - } - } catch (e: Throwable) { - throw RuntimeException(data, e) - } - - fun serialize(data: String?): ByteBuffer = try { - if (data == null) { - ByteBuffer.allocate(0) - } else { - val charBuffer = charBuffer(data.length) - charBuffer.put(data) - charBuffer.flip() - val encoder = encoder() - encoder.reset() - encoder.encode(charBuffer) - } - } catch (e: Throwable) { - throw RuntimeException(data, e) - } - - fun deserializeAll(buffer: ByteBuffer): String? = try { - val len = buffer.remaining() - if (len == -1) { - null - } else { - val limit = buffer.limit() - buffer.limit(buffer.position() + len - trailingNullBytes) - val charBuffer = charBuffer(len) - val decoder = decoder() - decoder.reset() - decoder.decode(buffer, charBuffer, true) - buffer.limit(limit) - buffer.position(buffer.position() + trailingNullBytes) - charBuffer.flip() - charBuffer.toString() - } - } catch (e: Throwable) { - buffer.hexDump() - throw RuntimeException(e) - } - - override fun deserialize(buffer: ByteBuffer, features: QuasselFeatures): String? = try { - val len = IntSerializer.deserialize(buffer, features) - if (len == -1) { - null - } else { - val limit = buffer.limit() - buffer.limit(buffer.position() + Math.max(0, len - trailingNullBytes)) - val charBuffer = charBuffer(len) - val decoder = decoder() - decoder.decode(buffer, charBuffer, true) - buffer.limit(limit) - buffer.position(buffer.position() + trailingNullBytes) - charBuffer.flip() - charBuffer.toString() - } - } catch (e: Throwable) { - buffer.hexDump() - throw RuntimeException(e) - } -} diff --git a/lib/src/main/java/de/kuschku/libquassel/protocol/primitive/serializer/TimeSerializer.kt b/lib/src/main/java/de/kuschku/libquassel/protocol/primitive/serializer/TimeSerializer.kt deleted file mode 100644 index e07715a67241a3dbd937edfdb9aeedc7bade665d..0000000000000000000000000000000000000000 --- a/lib/src/main/java/de/kuschku/libquassel/protocol/primitive/serializer/TimeSerializer.kt +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.libquassel.protocol.primitive.serializer - -import de.kuschku.libquassel.quassel.QuasselFeatures -import de.kuschku.libquassel.util.nio.ChainedByteBuffer -import org.threeten.bp.LocalTime -import java.nio.ByteBuffer - -object TimeSerializer : Serializer<LocalTime> { - override fun serialize(buffer: ChainedByteBuffer, data: LocalTime, features: QuasselFeatures) { - IntSerializer.serialize(buffer, (data.toNanoOfDay() / 1000).toInt(), features) - } - - override fun deserialize(buffer: ByteBuffer, features: QuasselFeatures): LocalTime { - return LocalTime.ofNanoOfDay(IntSerializer.deserialize(buffer, features).toLong() * 1000) - } -} diff --git a/lib/src/main/java/de/kuschku/libquassel/protocol/primitive/serializer/UByteSerializer.kt b/lib/src/main/java/de/kuschku/libquassel/protocol/primitive/serializer/UByteSerializer.kt deleted file mode 100644 index e96903f9b5bc67fbc0247e28dae0a71db9df56de..0000000000000000000000000000000000000000 --- a/lib/src/main/java/de/kuschku/libquassel/protocol/primitive/serializer/UByteSerializer.kt +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.libquassel.protocol.primitive.serializer - -import de.kuschku.libquassel.quassel.QuasselFeatures -import de.kuschku.libquassel.util.nio.ChainedByteBuffer -import java.nio.ByteBuffer - -object UByteSerializer : Serializer<UByte> { - override fun serialize(buffer: ChainedByteBuffer, data: UByte, features: QuasselFeatures) { - buffer.put(data.toByte()) - } - - override fun deserialize(buffer: ByteBuffer, features: QuasselFeatures): UByte { - return buffer.get().toUByte() - } -} diff --git a/lib/src/main/java/de/kuschku/libquassel/protocol/primitive/serializer/UIntSerializer.kt b/lib/src/main/java/de/kuschku/libquassel/protocol/primitive/serializer/UIntSerializer.kt deleted file mode 100644 index 83c42cf3a6a4559ce6a7d3a71ada2eb49903b4d3..0000000000000000000000000000000000000000 --- a/lib/src/main/java/de/kuschku/libquassel/protocol/primitive/serializer/UIntSerializer.kt +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.libquassel.protocol.primitive.serializer - -import de.kuschku.libquassel.quassel.QuasselFeatures -import de.kuschku.libquassel.util.nio.ChainedByteBuffer -import java.nio.ByteBuffer - -object UIntSerializer : Serializer<UInt> { - override fun serialize(buffer: ChainedByteBuffer, data: UInt, features: QuasselFeatures) { - buffer.putInt(data.toInt()) - } - - override fun deserialize(buffer: ByteBuffer, features: QuasselFeatures): UInt { - return buffer.int.toUInt() - } -} diff --git a/lib/src/main/java/de/kuschku/libquassel/protocol/primitive/serializer/ULongSerializer.kt b/lib/src/main/java/de/kuschku/libquassel/protocol/primitive/serializer/ULongSerializer.kt deleted file mode 100644 index 16c7cfdb733fb4ee5b66d84e30150ae83c0a6f69..0000000000000000000000000000000000000000 --- a/lib/src/main/java/de/kuschku/libquassel/protocol/primitive/serializer/ULongSerializer.kt +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.libquassel.protocol.primitive.serializer - -import de.kuschku.libquassel.quassel.QuasselFeatures -import de.kuschku.libquassel.util.nio.ChainedByteBuffer -import java.nio.ByteBuffer - -object ULongSerializer : Serializer<ULong> { - override fun serialize(buffer: ChainedByteBuffer, data: ULong, features: QuasselFeatures) { - buffer.putLong(data.toLong()) - } - - override fun deserialize(buffer: ByteBuffer, features: QuasselFeatures): ULong { - return buffer.long.toULong() - } -} diff --git a/lib/src/main/java/de/kuschku/libquassel/protocol/primitive/serializer/UShortSerializer.kt b/lib/src/main/java/de/kuschku/libquassel/protocol/primitive/serializer/UShortSerializer.kt deleted file mode 100644 index a4c0d3140687c4b898201d38ab1ba36631b491e6..0000000000000000000000000000000000000000 --- a/lib/src/main/java/de/kuschku/libquassel/protocol/primitive/serializer/UShortSerializer.kt +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.libquassel.protocol.primitive.serializer - -import de.kuschku.libquassel.quassel.QuasselFeatures -import de.kuschku.libquassel.util.nio.ChainedByteBuffer -import java.nio.ByteBuffer - -object UShortSerializer : Serializer<UShort> { - override fun serialize(buffer: ChainedByteBuffer, data: UShort, features: QuasselFeatures) { - buffer.putShort(data.toShort()) - } - - override fun deserialize(buffer: ByteBuffer, features: QuasselFeatures): UShort { - return buffer.short.toUShort() - } -} diff --git a/lib/src/main/java/de/kuschku/libquassel/protocol/primitive/serializer/VariantListSerializer.kt b/lib/src/main/java/de/kuschku/libquassel/protocol/primitive/serializer/VariantListSerializer.kt deleted file mode 100644 index 79eb65ce025b7cd8f9e6a372f013283b3ac9c2c7..0000000000000000000000000000000000000000 --- a/lib/src/main/java/de/kuschku/libquassel/protocol/primitive/serializer/VariantListSerializer.kt +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.libquassel.protocol.primitive.serializer - -import de.kuschku.libquassel.protocol.QVariantList -import de.kuschku.libquassel.protocol.QVariant_ -import de.kuschku.libquassel.quassel.QuasselFeatures -import de.kuschku.libquassel.util.nio.ChainedByteBuffer -import java.nio.ByteBuffer - -object VariantListSerializer : Serializer<QVariantList> { - override fun serialize(buffer: ChainedByteBuffer, data: QVariantList, features: QuasselFeatures) { - IntSerializer.serialize(buffer, data.size, features) - data.forEach { - VariantSerializer.serialize(buffer, it, features) - } - } - - override fun deserialize(buffer: ByteBuffer, features: QuasselFeatures): QVariantList { - val length = IntSerializer.deserialize(buffer, features) - val result = mutableListOf<QVariant_>() - for (i in 0 until length) { - result.add(VariantSerializer.deserialize(buffer, features)) - } - return result - } -} diff --git a/lib/src/main/java/de/kuschku/libquassel/protocol/primitive/serializer/VariantMapSerializer.kt b/lib/src/main/java/de/kuschku/libquassel/protocol/primitive/serializer/VariantMapSerializer.kt deleted file mode 100644 index 40cffa0209d836115c5c431e9d325aee7f781182..0000000000000000000000000000000000000000 --- a/lib/src/main/java/de/kuschku/libquassel/protocol/primitive/serializer/VariantMapSerializer.kt +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.libquassel.protocol.primitive.serializer - -import de.kuschku.libquassel.protocol.QVariantMap -import de.kuschku.libquassel.quassel.QuasselFeatures -import de.kuschku.libquassel.util.nio.ChainedByteBuffer -import java.nio.ByteBuffer - -object VariantMapSerializer : Serializer<QVariantMap> { - override fun serialize(buffer: ChainedByteBuffer, data: QVariantMap, features: QuasselFeatures) { - IntSerializer.serialize(buffer, data.size, features) - data.entries.forEach { (key, value) -> - StringSerializer.UTF16.serialize(buffer, key, features) - VariantSerializer.serialize(buffer, value, features) - } - } - - override fun deserialize(buffer: ByteBuffer, features: QuasselFeatures): QVariantMap { - return mutableMapOf( - *(0 until IntSerializer.deserialize(buffer, features)).map { - Pair( - StringSerializer.UTF16.deserialize(buffer, features) ?: "", - VariantSerializer.deserialize(buffer, features) - ) - }.toTypedArray() - ) - } -} diff --git a/lib/src/main/java/de/kuschku/libquassel/protocol/primitive/serializer/VariantSerializer.kt b/lib/src/main/java/de/kuschku/libquassel/protocol/primitive/serializer/VariantSerializer.kt deleted file mode 100644 index b6d7b6b1c5ea4b8c9179c547ac5f178fbd0bc4f9..0000000000000000000000000000000000000000 --- a/lib/src/main/java/de/kuschku/libquassel/protocol/primitive/serializer/VariantSerializer.kt +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.libquassel.protocol.primitive.serializer - -import de.kuschku.libquassel.protocol.* -import de.kuschku.libquassel.quassel.QuasselFeatures -import de.kuschku.libquassel.util.nio.ChainedByteBuffer -import java.nio.ByteBuffer - -object VariantSerializer : Serializer<QVariant_> { - @Suppress("UNCHECKED_CAST") - override fun serialize(buffer: ChainedByteBuffer, data: QVariant_, features: QuasselFeatures) { - IntSerializer.serialize(buffer, data.type.id, features) - BoolSerializer.serialize(buffer, false, features) - if (data is QVariant.Custom && data.type == Type.UserType) { - StringSerializer.C.serialize(buffer, data.qtype.typeName, features) - } - (data.serializer as Serializer<Any?>).serialize(buffer, data.data, features) - } - - override fun deserialize(buffer: ByteBuffer, features: QuasselFeatures): QVariant_ { - val rawType = IntSerializer.deserialize(buffer, features) - val type = Type.of(rawType) - @Suppress("UNUSED_VARIABLE") - val isNull = BoolSerializer.deserialize(buffer, features) - - return if (type == Type.UserType) { - val name = StringSerializer.C.deserialize(buffer, features) - val qType = name?.let(QType.Companion::of) - ?: throw IllegalArgumentException("No such type: $name") - val value = qType.serializer.deserialize(buffer, features) - QVariant.of<All_>(value, qType) - } else { - val serializer = type?.serializer ?: throw IllegalArgumentException("No such type: $type") - val value = serializer.deserialize(buffer, features) - QVariant.of<All_>(value, type) - } - } -} diff --git a/lib/src/main/java/de/kuschku/libquassel/protocol/primitive/serializer/VoidSerializer.kt b/lib/src/main/java/de/kuschku/libquassel/protocol/primitive/serializer/VoidSerializer.kt deleted file mode 100644 index 4e9cc9aa89ede892c0019306821969b7e5e4b79f..0000000000000000000000000000000000000000 --- a/lib/src/main/java/de/kuschku/libquassel/protocol/primitive/serializer/VoidSerializer.kt +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.libquassel.protocol.primitive.serializer - -import de.kuschku.libquassel.quassel.QuasselFeatures -import de.kuschku.libquassel.util.nio.ChainedByteBuffer -import java.nio.ByteBuffer - -object VoidSerializer : Serializer<Any?> { - override fun serialize(buffer: ChainedByteBuffer, data: Any?, features: QuasselFeatures) { - } - - override fun deserialize(buffer: ByteBuffer, features: QuasselFeatures): Any? { - return null - } -} diff --git a/lib/src/main/java/de/kuschku/libquassel/quassel/BufferInfo.kt b/lib/src/main/java/de/kuschku/libquassel/quassel/BufferInfo.kt deleted file mode 100644 index d8aae5ea3a1496fdeadc5c38dda650231512797d..0000000000000000000000000000000000000000 --- a/lib/src/main/java/de/kuschku/libquassel/quassel/BufferInfo.kt +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.libquassel.quassel - -import de.kuschku.libquassel.protocol.BufferId -import de.kuschku.libquassel.protocol.Buffer_Type -import de.kuschku.libquassel.protocol.Buffer_Types -import de.kuschku.libquassel.protocol.NetworkId -import de.kuschku.libquassel.util.flag.Flag -import de.kuschku.libquassel.util.flag.Flags -import de.kuschku.libquassel.util.flag.ShortFlag -import de.kuschku.libquassel.util.flag.ShortFlags - -data class BufferInfo( - var bufferId: BufferId = BufferId(-1), - var networkId: NetworkId = NetworkId(-1), - var type: Buffer_Types = Buffer_Type.of(), - var groupId: Int = -1, - var bufferName: String? = null -) { - enum class Type(override val bit: UShort) : ShortFlag<Type> { - InvalidBuffer(0x00u), - StatusBuffer(0x01u), - ChannelBuffer(0x02u), - QueryBuffer(0x04u), - GroupBuffer(0x08u); - - companion object : ShortFlags.Factory<Type> { - override val NONE = Buffer_Type.of() - val validValues = values().filter { it.bit != 0u.toUShort() }.toTypedArray() - override fun of(bit: Short) = ShortFlags.of<Type>(bit) - override fun of(bit: UShort) = ShortFlags.of<Type>(bit) - override fun of(vararg flags: Type) = ShortFlags.of(*flags) - override fun of(flags: Iterable<Type>) = ShortFlags.of(flags) - } - } - - enum class Activity(override val bit: UInt) : Flag<Activity> { - NoActivity(0x00u), - OtherActivity(0x01u), - NewMessage(0x02u), - Highlight(0x04u); - - companion object : Flags.Factory<Activity> { - override val NONE = Activity.of() - override fun of(bit: Int) = Flags.of<Activity>(bit) - override fun of(bit: UInt) = Flags.of<Activity>(bit) - override fun of(vararg flags: Activity) = Flags.of(*flags) - override fun of(flags: Iterable<Activity>) = Flags.of(flags) - } - } -} diff --git a/lib/src/main/java/de/kuschku/libquassel/quassel/ExtendedFeature.kt b/lib/src/main/java/de/kuschku/libquassel/quassel/ExtendedFeature.kt deleted file mode 100644 index a5d22dc30c8d20180812f5b934947d8a8439ca11..0000000000000000000000000000000000000000 --- a/lib/src/main/java/de/kuschku/libquassel/quassel/ExtendedFeature.kt +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.libquassel.quassel - -enum class ExtendedFeature { - SynchronizedMarkerLine, - SaslAuthentication, - SaslExternal, - HideInactiveNetworks, - PasswordChange, - /** IRCv3 capability negotiation, account tracking */ - CapNegotiation, - /** IRC server SSL validation */ - VerifyServerSSL, - /** IRC server custom message rate limits */ - CustomRateLimits, - // Currently not supported - DccFileTransfer, - /** Timestamp formatting in away (e.g. %%hh:mm%%) */ - AwayFormatTimestamp, - /** Whether or not the core supports auth backends. */ - Authenticators, - /** Sync buffer activity status */ - BufferActivitySync, - /** Core-Side highlight configuration and matching */ - CoreSideHighlights, - /** Show prefixes for senders in backlog */ - SenderPrefixes, - /** Supports RPC call disconnectFromCore to remotely disconnect a client */ - RemoteDisconnect, - /** Transmit features as list of strings */ - ExtendedFeatures, - /** Serialize message time as 64-bit */ - LongTime, - /** Real Name and Avatar URL in backlog */ - RichMessages, - /** Backlogmanager supports filtering backlog by messagetype */ - BacklogFilterType, - /** ECDSA keys for CertFP in identities */ - EcdsaCertfpKeys, - /** 64-bit IDs for messages */ - LongMessageId, - /** CoreInfo dynamically updated using signals */ - SyncedCoreInfo, - /** Allow loading backlog in reverse */ - LoadBacklogForwards; - - companion object { - private val map = values().associateBy(ExtendedFeature::name) - fun of(name: String) = map[name] - } -} diff --git a/lib/src/main/java/de/kuschku/libquassel/quassel/LegacyFeature.kt b/lib/src/main/java/de/kuschku/libquassel/quassel/LegacyFeature.kt deleted file mode 100644 index 8d7314602b20eb247074c1bd9ac790663dc87d71..0000000000000000000000000000000000000000 --- a/lib/src/main/java/de/kuschku/libquassel/quassel/LegacyFeature.kt +++ /dev/null @@ -1,108 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.libquassel.quassel - -import de.kuschku.libquassel.util.flag.Flag -import de.kuschku.libquassel.util.flag.Flags - -/** - * A list of features that are optional in core and/or client, but need runtime checking - * - * Some features require an uptodate counterpart, but don't justify a protocol break. - * This is what we use this enum for. Add such features to it and check at runtime on the other - * side for their existence. - * - * This list should be cleaned up after every protocol break, as we can assume them to be present then. - */ -enum class LegacyFeature(override val bit: UInt) : Flag<LegacyFeature> { - SynchronizedMarkerLine(0x0001u), - SaslAuthentication(0x0002u), - SaslExternal(0x0004u), - HideInactiveNetworks(0x0008u), - PasswordChange(0x0010u), - /** IRCv3 capability negotiation, account tracking */ - CapNegotiation(0x0020u), - /** IRC server SSL validation */ - VerifyServerSSL(0x0040u), - /** IRC server custom message rate limits */ - CustomRateLimits(0x0080u), - DccFileTransfer(0x0100u), - /** Timestamp formatting in away (e.g. %%hh:mm%%) */ - AwayFormatTimestamp(0x0200u), - /** Whether or not the core supports auth backends. */ - Authenticators(0x0400u), - /** Sync buffer activity status */ - BufferActivitySync(0x0800u), - /** Core-Side highlight configuration and matching */ - CoreSideHighlights(0x1000u), - /** Show prefixes for senders in backlog */ - SenderPrefixes(0x2000u), - /** Supports RPC call disconnectFromCore to remotely disconnect a client */ - RemoteDisconnect(0x4000u), - /** Transmit features as list of strings */ - ExtendedFeatures(0x8000u); - - companion object : Flags.Factory<LegacyFeature> { - override val NONE: Flags<LegacyFeature> = LegacyFeature.of() - override fun of(bit: Int) = Flags.of<LegacyFeature>(bit) - override fun of(bit: UInt) = Flags.of<LegacyFeature>(bit) - override fun of(vararg flags: LegacyFeature) = Flags.of(*flags) - override fun of(flags: Iterable<LegacyFeature>) = Flags.of(flags) - - fun fromExtended(it: ExtendedFeature) = when (it) { - ExtendedFeature.SynchronizedMarkerLine -> LegacyFeature.SynchronizedMarkerLine - ExtendedFeature.SaslAuthentication -> LegacyFeature.SaslAuthentication - ExtendedFeature.SaslExternal -> LegacyFeature.SaslExternal - ExtendedFeature.HideInactiveNetworks -> LegacyFeature.HideInactiveNetworks - ExtendedFeature.PasswordChange -> LegacyFeature.PasswordChange - ExtendedFeature.CapNegotiation -> LegacyFeature.CapNegotiation - ExtendedFeature.VerifyServerSSL -> LegacyFeature.VerifyServerSSL - ExtendedFeature.CustomRateLimits -> LegacyFeature.CustomRateLimits - ExtendedFeature.DccFileTransfer -> LegacyFeature.DccFileTransfer - ExtendedFeature.AwayFormatTimestamp -> LegacyFeature.AwayFormatTimestamp - ExtendedFeature.Authenticators -> LegacyFeature.Authenticators - ExtendedFeature.BufferActivitySync -> LegacyFeature.BufferActivitySync - ExtendedFeature.CoreSideHighlights -> LegacyFeature.CoreSideHighlights - ExtendedFeature.SenderPrefixes -> LegacyFeature.SenderPrefixes - ExtendedFeature.RemoteDisconnect -> LegacyFeature.RemoteDisconnect - ExtendedFeature.ExtendedFeatures -> LegacyFeature.ExtendedFeatures - else -> null - } - } - - fun toExtended() = when (this) { - LegacyFeature.SynchronizedMarkerLine -> ExtendedFeature.SynchronizedMarkerLine - LegacyFeature.SaslAuthentication -> ExtendedFeature.SaslAuthentication - LegacyFeature.SaslExternal -> ExtendedFeature.SaslExternal - LegacyFeature.HideInactiveNetworks -> ExtendedFeature.HideInactiveNetworks - LegacyFeature.PasswordChange -> ExtendedFeature.PasswordChange - LegacyFeature.CapNegotiation -> ExtendedFeature.CapNegotiation - LegacyFeature.VerifyServerSSL -> ExtendedFeature.VerifyServerSSL - LegacyFeature.CustomRateLimits -> ExtendedFeature.CustomRateLimits - LegacyFeature.DccFileTransfer -> ExtendedFeature.DccFileTransfer - LegacyFeature.AwayFormatTimestamp -> ExtendedFeature.AwayFormatTimestamp - LegacyFeature.Authenticators -> ExtendedFeature.Authenticators - LegacyFeature.BufferActivitySync -> ExtendedFeature.BufferActivitySync - LegacyFeature.CoreSideHighlights -> ExtendedFeature.CoreSideHighlights - LegacyFeature.SenderPrefixes -> ExtendedFeature.SenderPrefixes - LegacyFeature.RemoteDisconnect -> ExtendedFeature.RemoteDisconnect - LegacyFeature.ExtendedFeatures -> ExtendedFeature.ExtendedFeatures - } -} diff --git a/lib/src/main/java/de/kuschku/libquassel/quassel/ProtocolFeature.kt b/lib/src/main/java/de/kuschku/libquassel/quassel/ProtocolFeature.kt deleted file mode 100644 index 316fcdc66d57e39f6403d2edf86f4804dbaab400..0000000000000000000000000000000000000000 --- a/lib/src/main/java/de/kuschku/libquassel/quassel/ProtocolFeature.kt +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.libquassel.quassel - -import de.kuschku.libquassel.util.flag.Flag -import de.kuschku.libquassel.util.flag.Flags - -enum class ProtocolFeature(override val bit: UInt) : - Flag<ProtocolFeature> { - None(0x00u), - TLS(0x01u), - Compression(0x02u); - - companion object : Flags.Factory<ProtocolFeature> { - override val NONE = ProtocolFeature.of() - override fun of(bit: Int) = Flags.of<ProtocolFeature>(bit) - override fun of(bit: UInt) = Flags.of<ProtocolFeature>(bit) - override fun of(vararg flags: ProtocolFeature) = Flags.of(*flags) - override fun of(flags: Iterable<ProtocolFeature>) = Flags.of(flags) - } -} diff --git a/lib/src/main/java/de/kuschku/libquassel/quassel/ProtocolInfo.kt b/lib/src/main/java/de/kuschku/libquassel/quassel/ProtocolInfo.kt deleted file mode 100644 index 61167d4908278c0b104831f83f8cac00e827e4ac..0000000000000000000000000000000000000000 --- a/lib/src/main/java/de/kuschku/libquassel/quassel/ProtocolInfo.kt +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.libquassel.quassel - -import de.kuschku.libquassel.protocol.Protocol_Features - -data class ProtocolInfo(val flags: Protocol_Features, val data: UShort, val version: UByte) diff --git a/lib/src/main/java/de/kuschku/libquassel/quassel/QuasselFeatures.kt b/lib/src/main/java/de/kuschku/libquassel/quassel/QuasselFeatures.kt deleted file mode 100644 index 816df8a661dbfb98c3d0d2db6478d8a235d3e022..0000000000000000000000000000000000000000 --- a/lib/src/main/java/de/kuschku/libquassel/quassel/QuasselFeatures.kt +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.libquassel.quassel - -import de.kuschku.libquassel.protocol.Legacy_Feature -import de.kuschku.libquassel.protocol.Legacy_Features -import java.io.Serializable - -class QuasselFeatures( - val enabledFeatures: Set<ExtendedFeature>, - val unknownFeatures: Set<String> = emptySet() -) : Serializable { - constructor(legacyFeatures: Legacy_Features?, extendedFeatures: Collection<String>) : this( - legacyFeatures?.enabledValues()?.map(Legacy_Feature::toExtended).orEmpty() union - extendedFeatures.mapNotNull(ExtendedFeature.Companion::of), - extendedFeatures.filter { ExtendedFeature.of(it) == null }.toSet() - ) - - fun toInt() = LegacyFeature.of(enabledFeatures.mapNotNull(LegacyFeature.Companion::fromExtended)) - - fun toStringList() = enabledFeatures.map(ExtendedFeature::name) - - infix fun hasFeature(feature: ExtendedFeature) = enabledFeatures.contains(feature) - - override fun toString(): String { - return "QuasselFeatures(enabledFeatures=$enabledFeatures, unknownFeatures=$unknownFeatures)" - } - - - companion object { - fun empty() = QuasselFeatures(emptySet(), emptySet()) - fun all() = QuasselFeatures( - // Dcc is disabled - ExtendedFeature.values().toSet() - ExtendedFeature.DccFileTransfer, - emptySet() - ) - } -} diff --git a/lib/src/main/java/de/kuschku/libquassel/quassel/exceptions/MessageHandlingException.kt b/lib/src/main/java/de/kuschku/libquassel/quassel/exceptions/MessageHandlingException.kt deleted file mode 100644 index 115b8ac9469abd9261d4fadd763778739b98b5fd..0000000000000000000000000000000000000000 --- a/lib/src/main/java/de/kuschku/libquassel/quassel/exceptions/MessageHandlingException.kt +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.libquassel.quassel.exceptions - -import de.kuschku.libquassel.protocol.message.HandshakeMessage -import de.kuschku.libquassel.protocol.message.SignalProxyMessage - -sealed class MessageHandlingException(cause: Throwable?) : Exception(cause) { - class SignalProxy( - val source: SignalProxyMessage, - cause: Throwable? - ) : MessageHandlingException(cause) - - class Handshake( - val source: HandshakeMessage, - cause: Throwable? - ) : MessageHandlingException(cause) -} diff --git a/lib/src/main/java/de/kuschku/libquassel/quassel/exceptions/ObjectNotFoundException.kt b/lib/src/main/java/de/kuschku/libquassel/quassel/exceptions/ObjectNotFoundException.kt deleted file mode 100644 index e3206bb8b50dd3e404435fffbed4214df6c2470c..0000000000000000000000000000000000000000 --- a/lib/src/main/java/de/kuschku/libquassel/quassel/exceptions/ObjectNotFoundException.kt +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.libquassel.quassel.exceptions - -data class ObjectNotFoundException(val className: String, val objectName: String) : - QuasselException() diff --git a/lib/src/main/java/de/kuschku/libquassel/quassel/exceptions/QuasselException.kt b/lib/src/main/java/de/kuschku/libquassel/quassel/exceptions/QuasselException.kt deleted file mode 100644 index 78d2d8543df963b6bccfcce73f4bad37791d6df5..0000000000000000000000000000000000000000 --- a/lib/src/main/java/de/kuschku/libquassel/quassel/exceptions/QuasselException.kt +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.libquassel.quassel.exceptions - -abstract class QuasselException : Exception() diff --git a/lib/src/main/java/de/kuschku/libquassel/quassel/exceptions/UnknownMethodException.kt b/lib/src/main/java/de/kuschku/libquassel/quassel/exceptions/UnknownMethodException.kt deleted file mode 100644 index 0798026b6fa45b34fc8784e2000f23557c1f7cc8..0000000000000000000000000000000000000000 --- a/lib/src/main/java/de/kuschku/libquassel/quassel/exceptions/UnknownMethodException.kt +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.libquassel.quassel.exceptions - -data class UnknownMethodException(val className: String, val methodName: String) : - QuasselException() diff --git a/lib/src/main/java/de/kuschku/libquassel/quassel/exceptions/WrongObjectTypeException.kt b/lib/src/main/java/de/kuschku/libquassel/quassel/exceptions/WrongObjectTypeException.kt deleted file mode 100644 index 0cb73227697ff4e8752f59ba125202754218c3d5..0000000000000000000000000000000000000000 --- a/lib/src/main/java/de/kuschku/libquassel/quassel/exceptions/WrongObjectTypeException.kt +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.libquassel.quassel.exceptions - -data class WrongObjectTypeException(val obj: Any?, val type: String) : QuasselException() diff --git a/lib/src/main/java/de/kuschku/libquassel/quassel/syncables/AliasManager.kt b/lib/src/main/java/de/kuschku/libquassel/quassel/syncables/AliasManager.kt deleted file mode 100644 index b95c0028c93815b22d5aebf991587c06cd713126..0000000000000000000000000000000000000000 --- a/lib/src/main/java/de/kuschku/libquassel/quassel/syncables/AliasManager.kt +++ /dev/null @@ -1,244 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.libquassel.quassel.syncables - -import de.kuschku.libquassel.protocol.QVariant -import de.kuschku.libquassel.protocol.QVariantMap -import de.kuschku.libquassel.protocol.Type -import de.kuschku.libquassel.protocol.valueOr -import de.kuschku.libquassel.quassel.BufferInfo -import de.kuschku.libquassel.quassel.syncables.interfaces.IAliasManager -import de.kuschku.libquassel.quassel.syncables.interfaces.IAliasManager.Alias -import de.kuschku.libquassel.quassel.syncables.interfaces.ISyncableObject -import de.kuschku.libquassel.session.SignalProxy -import io.reactivex.Observable -import io.reactivex.subjects.BehaviorSubject -import java.util.* - -class AliasManager constructor( - proxy: SignalProxy -) : SyncableObject(proxy, "AliasManager"), IAliasManager, ISyncableObject { - override fun toVariantMap(): QVariantMap = mapOf( - "Aliases" to QVariant.of(initAliases(), Type.QVariantMap) - ) - - override fun fromVariantMap(properties: QVariantMap) { - initSetAliases(properties["Aliases"].valueOr(::emptyMap)) - } - - override fun initAliases(): QVariantMap = mapOf( - "names" to QVariant.of(_aliases.map(Alias::name), Type.QStringList), - "expansions" to QVariant.of(_aliases.map(Alias::expansion), Type.QStringList) - ) - - override fun initSetAliases(aliases: QVariantMap) { - val names = aliases["names"].valueOr<List<String>>(::emptyList) - val expansions = aliases["expansions"].valueOr<List<String>>(::emptyList) - - if (names.size != expansions.size) - throw IllegalArgumentException( - "Sizes do not match: names=${names.size}, expansions=${expansions.size}" - ) - - _aliases = names.zip(expansions, ::Alias).toList() - } - - override fun addAlias(name: String?, expansion: String?) { - if (contains(name)) { - return - } - - _aliases += Alias(name, expansion) - - super.addAlias(name, expansion) - } - - fun indexOf(name: String?) = _aliases.map(Alias::name).indexOf(name) - - fun contains(name: String?) = _aliases.map(Alias::name).contains(name) - - fun aliasList() = _aliases.toList() - - fun setAliasList(list: List<Alias>) { - _aliases = list - } - - fun updates(): Observable<AliasManager> = live_updates.map { this } - - fun copy() = AliasManager(proxy).also { - it.fromVariantMap(toVariantMap()) - } - - fun processInput(info: BufferInfo, message: String): List<IAliasManager.Command> { - val result = mutableListOf<IAliasManager.Command>() - processInput(info, message, result) - return result - } - - fun processInput(info: BufferInfo, message: String, - previousCommands: MutableList<IAliasManager.Command>) { - var msg = message - - // leading slashes indicate there's a command to call unless there is another one in the first section (like a path /proc/cpuinfo) - // For those habitally tied to irssi, "/ " also makes the rest of the line a literal message - val secondSlashPos = msg.indexOf('/', 1) - val firstSpacePos = msg.indexOf(' ') - if (!msg.startsWith('/') || firstSpacePos == 1 || - (secondSlashPos != -1 && (secondSlashPos < firstSpacePos || firstSpacePos == -1))) { - if (msg.startsWith("//")) - msg = msg.substring(1) // "//asdf" is transformed to "/asdf" - else if (msg.startsWith("/ ")) - msg = msg.substring(2) // "/ /asdf" is transformed to "/asdf" - msg = "/SAY $msg" // make sure we only send proper commands to the core - } else { - // check for aliases - val split = msg.split(' ', ignoreCase = true, limit = 2) - val search: String? = split.firstOrNull()?.substring(1) - if (search != null) { - val found = _aliases.firstOrNull { it.name.equals(search, true) } - if (found != null) { - expand(found.expansion ?: "", info, split.getOrNull(1) ?: "", previousCommands) - return - } - } - } - - previousCommands.add(IAliasManager.Command(info, msg)) - } - - fun expand(expansion: String, bufferInfo: BufferInfo, msg: String, - previousCommands: MutableList<IAliasManager.Command>) { - val network = proxy.network(bufferInfo.networkId) - - val paramRange = Regex("""\$(\d+)\.\.(\d*)""") - val commands = expansion.split("; ?".toRegex()).dropLastWhile(String::isEmpty) - val params = msg.split(' ').dropLastWhile(String::isEmpty) - val expandedCommands = LinkedList<String>() - - for (i in commands.indices) { - var command = commands[i] - - if (params.isNotEmpty()) { - val commandBuffer = StringBuilder() - var index = 0 - for (match in paramRange.findAll(command)) { - val start = match.groups[1]?.value?.toIntOrNull() ?: 0 - val replacement: String - val end = match.groups[2]?.value?.toIntOrNull() ?: params.size - // $1.. would be "arg1 and all following" - replacement = if (end < start) { - "" - } else { - params.subList(start - 1, end).joinToString(" ") - } - - // Append text between last match and this match - commandBuffer.append(command.substring(index, match.range.start)) - - // Append new replacement text - commandBuffer.append(replacement) - - index = match.range.endInclusive + 1 - } - // Append remaining text - commandBuffer.append(command.substring(index, command.length)) - command = commandBuffer.toString() - } - - for (j in params.size downTo 1) { - val user = network?.ircUser(params[j - 1]) - // Hostname, or "*" if blank/nonexistent - command = command.replace("\$$j:hostname", user?.host() ?: "*") - // Identd - // Ident if verified, or "*" if blank/unknown/unverified (prefixed with "~") - // - // Most IRC daemons have the option to prefix an ident with "~" if it could not be - // verified via an identity daemon such as oidentd. In these cases, it can be handy to - // have a way to ban via ident if verified, or all idents if not verified. If the - // server does not verify idents, it usually won't add "~". - // - // Identd must be replaced before ident to avoid being treated as "$i:ident" + "d" - command = command.replace("\$$j:identd", (user?.user()).let { - when { - it == null || - it.startsWith(prefix = "~") -> "*" - else -> it - } - }) - // Ident, or "*" if blank/nonexistent - command = command.replace("\$$j:ident", user?.user() ?: "*") - // Account, or "*" if blank/nonexistent/logged out - command = command.replace("\$$j:account", user?.account() ?: "*") - // Nickname - // Must be replaced last to avoid interferring with more specific aliases - command = command.replace("\$$j", params[j - 1]) - } - command = command.replace("$0", msg) - command = command.replace("\$channelname", bufferInfo.bufferName ?: "") - command = command.replace("\$channel", bufferInfo.bufferName ?: "") - command = command.replace("\$currentnick", network?.myNick() ?: "") - command = command.replace("\$nick", network?.myNick() ?: "") - command = command.replace("\$network", network?.networkName() ?: "") - expandedCommands.add(command) - } - while (!expandedCommands.isEmpty()) { - val command: String - if (expandedCommands[0].trim().toLowerCase(Locale.US).startsWith("/wait ")) { - command = expandedCommands.joinToString("; ") - expandedCommands.clear() - } else { - command = expandedCommands.removeAt(0) - } - previousCommands.add(IAliasManager.Command(bufferInfo, command)) - } - } - - private val live_updates = BehaviorSubject.createDefault(Unit) - private var _aliases = listOf<IAliasManager.Alias>() - set(value) { - field = value - live_updates.onNext(Unit) - } - - fun isEqual(other: AliasManager): Boolean = - this.aliasList() == other.aliasList() - - override fun toString(): String { - return "AliasManager(_aliases=$_aliases)" - } - - companion object { - fun defaults() = listOf( - Alias("j", "/join $0"), - Alias("ns", "/msg nickserv $0"), - Alias("nickserv", "/msg nickserv $0"), - Alias("cs", "/msg chanserv $0"), - Alias("chanserv", "/msg chanserv $0"), - Alias("hs", "/msg hostserv $0"), - Alias("hostserv", "/msg hostserv $0"), - Alias("wii", "/whois $0 $0"), - Alias("back", "/quote away"), - - // let's add aliases for scripts that only run on linux - Alias("inxi", "/exec inxi $0"), - Alias("sysinfo", "/exec inxi -d") - ) - } -} diff --git a/lib/src/main/java/de/kuschku/libquassel/quassel/syncables/BacklogManager.kt b/lib/src/main/java/de/kuschku/libquassel/quassel/syncables/BacklogManager.kt deleted file mode 100644 index 1ddef1fc09fa2d4818dda29a45322977b4a15953..0000000000000000000000000000000000000000 --- a/lib/src/main/java/de/kuschku/libquassel/quassel/syncables/BacklogManager.kt +++ /dev/null @@ -1,138 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.libquassel.quassel.syncables - -import de.kuschku.libquassel.protocol.* -import de.kuschku.libquassel.quassel.syncables.interfaces.IBacklogManager -import de.kuschku.libquassel.session.BacklogStorage -import de.kuschku.libquassel.session.ISession -import de.kuschku.libquassel.util.compatibility.LoggingHandler.Companion.log -import de.kuschku.libquassel.util.compatibility.LoggingHandler.LogLevel.DEBUG - -class BacklogManager( - var session: ISession, - private val backlogStorage: BacklogStorage? = null -) : SyncableObject(session.proxy, "BacklogManager"), IBacklogManager { - private val loading = mutableMapOf<BufferId, (List<Message>) -> Boolean>() - private val loadingFiltered = mutableMapOf<BufferId, (List<Message>) -> Boolean>() - private val loadingForward = mutableMapOf<BufferId, (List<Message>) -> Boolean>() - - override fun deinit() { - super.deinit() - session = ISession.NULL - } - - init { - initialized = true - } - - fun updateIgnoreRules() = backlogStorage?.updateIgnoreRules(session) - - fun requestBacklog(bufferId: BufferId, first: MsgId = MsgId(-1), last: MsgId = MsgId(-1), - limit: Int = -1, additional: Int = 0, callback: (List<Message>) -> Boolean) { - if (loading.contains(bufferId)) return - loading[bufferId] = callback - requestBacklog(bufferId, first, last, limit, additional) - } - - fun requestBacklogFiltered(bufferId: BufferId, first: MsgId = MsgId(-1), - last: MsgId = MsgId(-1), limit: Int = -1, additional: Int = 0, - type: Int = -1, flags: Int = -1, - callback: (List<Message>) -> Boolean) { - if (loadingFiltered.contains(bufferId)) return - loadingFiltered[bufferId] = callback - requestBacklogFiltered(bufferId, first, last, limit, additional, type, flags) - } - - fun requestBacklogForward(bufferId: BufferId, first: MsgId = MsgId(-1), - last: MsgId = MsgId(-1), limit: Int = -1, - type: Int = 0, flags: Int = 0, - callback: (List<Message>) -> Boolean) { - if (loadingForward.contains(bufferId)) return - loadingForward[bufferId] = callback - requestBacklogForward(bufferId, first, last, limit, type, flags) - } - - fun requestBacklogAll(first: MsgId = MsgId(-1), last: MsgId = MsgId(-1), limit: Int = -1, - additional: Int = 0, callback: (List<Message>) -> Boolean) { - if (loading.contains(BufferId(-1))) return - loading[BufferId(-1)] = callback - requestBacklogAll(first, last, limit, additional) - } - - fun requestBacklogAllFiltered(first: MsgId = MsgId(-1), last: MsgId = MsgId(-1), - limit: Int = -1, additional: Int = 0, type: Int = -1, - flags: Int = -1, callback: (List<Message>) -> Boolean) { - if (loadingFiltered.contains(BufferId(-1))) return - loadingFiltered[BufferId(-1)] = callback - requestBacklogAllFiltered(first, last, limit, additional, type, flags) - } - - override fun receiveBacklog(bufferId: BufferId, first: MsgId, last: MsgId, limit: Int, - additional: Int, messages: QVariantList) { - val list = messages.mapNotNull<QVariant_, Message>(QVariant_::value) - if (loading.remove(bufferId)?.invoke(list) != false) { - log(DEBUG, "BacklogManager", "storeMessages(${list.size})") - backlogStorage?.storeMessages(session, list) - } - } - - override fun receiveBacklogAll(first: MsgId, last: MsgId, limit: Int, additional: Int, - messages: QVariantList) { - val list = messages.mapNotNull<QVariant_, Message>(QVariant_::value) - if (loading.remove(BufferId(-1))?.invoke(list) != false) { - log(DEBUG, "BacklogManager", "storeMessages(${list.size})") - backlogStorage?.storeMessages(session, list) - } - } - - override fun receiveBacklogFiltered(bufferId: BufferId, first: MsgId, last: MsgId, limit: Int, - additional: Int, type: Int, flags: Int, - messages: QVariantList) { - val list = messages.mapNotNull<QVariant_, Message>(QVariant_::value) - if (loadingFiltered.remove(bufferId)?.invoke(list) != false) { - log(DEBUG, "BacklogManager", "storeMessages(${list.size})") - backlogStorage?.storeMessages(session, list) - } - } - - override fun receiveBacklogForward(bufferId: BufferId, first: MsgId, last: MsgId, limit: Int, - type: Int, flags: Int, - messages: QVariantList) { - val list = messages.mapNotNull<QVariant_, Message>(QVariant_::value) - if (loadingForward.remove(bufferId)?.invoke(list) != false) { - log(DEBUG, "BacklogManager", "storeMessages(${list.size})") - backlogStorage?.storeMessages(session, list) - } - } - - override fun receiveBacklogAllFiltered(first: MsgId, last: MsgId, limit: Int, additional: Int, - type: Int, flags: Int, messages: QVariantList) { - val list = messages.mapNotNull<QVariant_, Message>(QVariant_::value) - if (loadingFiltered.remove(BufferId(-1))?.invoke(list) != false) { - log(DEBUG, "BacklogManager", "storeMessages(${list.size})") - backlogStorage?.storeMessages(session, list) - } - } - - fun removeBuffer(buffer: BufferId) { - backlogStorage?.clearMessages(buffer) - } -} diff --git a/lib/src/main/java/de/kuschku/libquassel/quassel/syncables/BufferSyncer.kt b/lib/src/main/java/de/kuschku/libquassel/quassel/syncables/BufferSyncer.kt deleted file mode 100644 index 3b6f69dcd59ccffc940e715e114baeed5fbc2fe3..0000000000000000000000000000000000000000 --- a/lib/src/main/java/de/kuschku/libquassel/quassel/syncables/BufferSyncer.kt +++ /dev/null @@ -1,377 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.libquassel.quassel.syncables - -import de.kuschku.libquassel.protocol.* -import de.kuschku.libquassel.protocol.Type -import de.kuschku.libquassel.quassel.BufferInfo -import de.kuschku.libquassel.quassel.syncables.interfaces.IBufferSyncer -import de.kuschku.libquassel.session.ISession -import de.kuschku.libquassel.session.NotificationManager -import de.kuschku.libquassel.util.Optional -import de.kuschku.libquassel.util.flag.minus -import de.kuschku.libquassel.util.irc.IrcCaseMappers -import io.reactivex.Observable -import io.reactivex.subjects.BehaviorSubject - -class BufferSyncer constructor( - var session: ISession, - private val notificationManager: NotificationManager? = null -) : SyncableObject(session.proxy, "BufferSyncer"), IBufferSyncer { - override fun deinit() { - super.deinit() - session = ISession.NULL - } - - fun lastSeenMsg(buffer: BufferId): MsgId = _lastSeenMsg[buffer] ?: MsgId(0) - fun liveLastSeenMsg(buffer: BufferId): Observable<MsgId> = live_lastSeenMsg.map { - markerLine(buffer) - }.distinctUntilChanged() - - fun liveLastSeenMsgs(): Observable<Map<BufferId, MsgId>> = - live_lastSeenMsg.map { _lastSeenMsg.toMap() } - - fun markerLine(buffer: BufferId): MsgId = _markerLines[buffer] ?: MsgId(0) - fun liveMarkerLine(buffer: BufferId): Observable<MsgId> = - live_markerLines.map { markerLine(buffer) }.distinctUntilChanged() - - fun liveMarkerLines(): Observable<Map<BufferId, MsgId>> = - live_markerLines.map { _markerLines.toMap() } - - fun activity(buffer: BufferId): Message_Types = - _bufferActivities[buffer] ?: Message_Types.of() - - fun liveActivity(buffer: BufferId): Observable<Message_Types> = - live_bufferActivities.map { activity(buffer) }.distinctUntilChanged() - - fun liveActivities(): Observable<Map<BufferId, Message_Types>> = - live_bufferActivities.map { _bufferActivities.toMap() } - - fun highlightCount(buffer: BufferId): Int = _highlightCounts[buffer] ?: 0 - fun liveHighlightCount(buffer: BufferId): Observable<Int> = - live_highlightCounts.map { highlightCount(buffer) }.distinctUntilChanged() - - fun liveHighlightCounts(): Observable<Map<BufferId, Int>> = - live_highlightCounts.map { _highlightCounts.toMap() } - - fun bufferInfo(bufferId: BufferId) = _bufferInfos[bufferId] - fun liveBufferInfo(bufferId: BufferId) = - live_bufferInfos.map { bufferInfo(bufferId) }.distinctUntilChanged() - - fun bufferInfos(): Collection<BufferInfo> = _bufferInfos.values.toList() - fun liveBufferInfos(): Observable<Map<BufferId, BufferInfo>> = live_bufferInfos.map { _bufferInfos.toMap() } - - override fun toVariantMap(): QVariantMap = mapOf( - "Activities" to QVariant.of(initActivities(), Type.QVariantList), - "HighlightCounts" to QVariant.of(initHighlightCounts(), Type.QVariantList), - "LastSeenMsg" to QVariant.of(initLastSeenMsg(), Type.QVariantList), - "MarkerLines" to QVariant.of(initMarkerLines(), Type.QVariantList) - ) - - override fun fromVariantMap(properties: QVariantMap) { - initSetActivities(properties["Activities"].valueOr(::emptyList)) - initSetHighlightCounts(properties["HighlightCounts"].valueOr(::emptyList)) - initSetLastSeenMsg(properties["LastSeenMsg"].valueOr(::emptyList)) - initSetMarkerLines(properties["MarkerLines"].valueOr(::emptyList)) - } - - fun copy() = BufferSyncer(session).also { - it.fromVariantMap(toVariantMap()) - } - - fun isEqual(other: BufferSyncer) = - _bufferInfos == other._bufferInfos && - _lastSeenMsg == other._lastSeenMsg && - _markerLines == other._markerLines && - _bufferActivities == other._bufferActivities && - _highlightCounts == other._highlightCounts - - - override fun initActivities(): QVariantList { - val list: MutableList<QVariant_> = mutableListOf() - for ((key, value) in _bufferActivities) { - list.add(QVariant.of(key, QType.BufferId)) - list.add(QVariant.of(value.toInt(), Type.Int)) - } - return list - } - - override fun initHighlightCounts(): QVariantList { - val list: MutableList<QVariant_> = mutableListOf() - for ((key, value) in _highlightCounts) { - list.add(QVariant.of(key, QType.BufferId)) - list.add(QVariant.of(value, Type.Int)) - } - return list - } - - override fun initLastSeenMsg(): QVariantList { - val list: MutableList<QVariant_> = mutableListOf() - for ((key, value) in _lastSeenMsg) { - list.add(QVariant.of(key, QType.BufferId)) - list.add(QVariant.of(value, QType.MsgId)) - } - return list - } - - override fun initMarkerLines(): QVariantList { - val list: MutableList<QVariant_> = mutableListOf() - for ((key, value) in _markerLines) { - list.add(QVariant.of(key, QType.BufferId)) - list.add(QVariant.of(value, QType.MsgId)) - } - return list - } - - override fun initSetActivities(data: QVariantList) { - setActivities((0 until data.size step 2).map { - Pair( - data[it].value(BufferId(0)), - Message_Type.of(data[it + 1].value(0)) - ) - }) - } - - fun setActivities(data: List<Pair<BufferId, Message_Types>>) { - for ((buffer, activity) in data) { - setBufferActivityInternal(buffer, activity) - } - live_bufferActivities.onNext(Unit) - } - - override fun initSetHighlightCounts(data: QVariantList) { - setHighlightCounts((0 until data.size step 2).map { - Pair( - data[it].value(BufferId(0)), - data[it + 1].value(0) - ) - }) - } - - fun setHighlightCounts(data: List<Pair<BufferId, Int>>) { - for ((buffer, count) in data) { - setHighlightCount(buffer, count) - } - live_highlightCounts.onNext(Unit) - } - - override fun initSetLastSeenMsg(data: QVariantList) { - setLastSeenMsg((0 until data.size step 2).map { - Pair( - data[it].value(BufferId(0)), - data[it + 1].value(MsgId(0L)) - ) - }) - } - - fun setLastSeenMsg(data: List<Pair<BufferId, MsgId>>) { - for ((buffer, msgId) in data) { - setLastSeenMsg(buffer, msgId) - } - live_lastSeenMsg.onNext(Unit) - } - - override fun initSetMarkerLines(data: QVariantList) { - setMarkerLines((0 until data.size step 2).map { - Pair( - data[it].value(BufferId(0)), - data[it + 1].value(MsgId(0L)) - ) - }) - } - - fun setMarkerLines(data: List<Pair<BufferId, MsgId>>) { - for ((buffer, msgId) in data) { - setMarkerLine(buffer, msgId) - } - live_markerLines.onNext(Unit) - } - - fun initSetBufferInfos(infos: QVariantList?) { - setBufferInfos(infos?.mapNotNull { it.value<BufferInfo>() }.orEmpty()) - } - - fun setBufferInfos(infos: List<BufferInfo>) { - _bufferInfos.clear() - for (info in infos) { - _bufferInfos[info.bufferId] = info - } - live_bufferInfos.onNext(Unit) - } - - override fun mergeBuffersPermanently(buffer1: BufferId, buffer2: BufferId) { - removeBuffer(buffer2) - } - - override fun removeBuffer(buffer: BufferId) { - _lastSeenMsg.remove(buffer);live_lastSeenMsg.onNext(Unit) - _markerLines.remove(buffer);live_markerLines.onNext(Unit) - _bufferActivities.remove(buffer);live_bufferActivities.onNext(Unit) - _highlightCounts.remove(buffer);live_highlightCounts.onNext(Unit) - _bufferInfos.remove(buffer);live_bufferInfos.onNext(Unit) - session.backlogManager.removeBuffer(buffer) - notificationManager?.clear(buffer) - } - - override fun renameBuffer(buffer: BufferId, newName: String?) { - val bufferInfo = _bufferInfos[buffer] - if (bufferInfo != null) { - _bufferInfos[buffer] = bufferInfo.copy(bufferName = newName) - live_bufferInfos.onNext(Unit) - } - } - - fun bufferInfoUpdated(info: BufferInfo) { - val oldInfo = _bufferInfos[info.bufferId] - if (info != oldInfo) { - _bufferInfos[info.bufferId] = info - live_bufferInfos.onNext(Unit) - - if (oldInfo == null) { - session.bufferViewManager.handleBuffer(info, this) - } - } - } - - override fun setLastSeenMsg(buffer: BufferId, msgId: MsgId) { - if (msgId < MsgId(0)) - return - - val oldLastSeenMsg = lastSeenMsg(buffer) - if (oldLastSeenMsg < msgId) { - _lastSeenMsg[buffer] = msgId - live_lastSeenMsg.onNext(Unit) - super.setLastSeenMsg(buffer, msgId) - notificationManager?.clear(buffer, msgId) - } - } - - override fun setMarkerLine(buffer: BufferId, msgId: MsgId) { - if (msgId < MsgId(0) || markerLine(buffer) == msgId) - return - - _markerLines[buffer] = msgId - live_markerLines.onNext(Unit) - super.setMarkerLine(buffer, msgId) - } - - override fun setBufferActivity(buffer: BufferId, activity: Int) { - setBufferActivity(buffer, Message_Type.of(activity)) - } - - fun setBufferActivityInternal(buffer: BufferId, activity: Message_Types) { - super.setBufferActivity(buffer, activity.toInt()) - _bufferActivities[buffer] = activity - live_bufferActivities.onNext(Unit) - } - - fun setBufferActivity(buffer: BufferId, activity: Message_Types) { - val oldActivity = activity(buffer) - setBufferActivityInternal(buffer, activity) - if ((activity - oldActivity).isNotEmpty()) { - bufferInfo(buffer)?.let { - session.bufferViewManager.handleBuffer(it, this, true) - } - } - } - - override fun setHighlightCount(buffer: BufferId, count: Int) { - super.setHighlightCount(buffer, count) - _highlightCounts[buffer] = count - live_highlightCounts.onNext(Unit) - } - - fun all( - bufferName: String? = null, - bufferId: BufferId? = null, - networkId: NetworkId? = null, - type: Buffer_Types? = null, - groupId: Int? = null - ) = _bufferInfos.values.toList().asSequence().filter { - bufferId == null || it.bufferId == bufferId - }.filter { - networkId == null || it.networkId == networkId - }.filter { - type == null || it.type == type - }.filter { - groupId == null || it.groupId == groupId - }.filter { - val caseMapper = IrcCaseMappers[session.networks[it.networkId]?.support("CASEMAPPING")] - bufferName == null || caseMapper.equalsIgnoreCaseNullable(it.bufferName, bufferName) - }.toList() - - fun liveAll( - bufferName: String? = null, - bufferId: BufferId? = null, - networkId: NetworkId? = null, - type: Buffer_Types? = null, - groupId: Int? = null - ) = liveBufferInfos().map { - it.values.toList().asSequence().filter { - bufferId == null || it.bufferId == bufferId - }.filter { - networkId == null || it.networkId == networkId - }.filter { - type == null || it.type == type - }.filter { - groupId == null || it.groupId == groupId - }.filter { - val caseMapper = IrcCaseMappers[session.networks[it.networkId]?.support("CASEMAPPING")] - bufferName == null || caseMapper.equalsIgnoreCaseNullable(it.bufferName, bufferName) - }.toList() - } - - fun find( - bufferName: String? = null, - bufferId: BufferId? = null, - networkId: NetworkId? = null, - type: Buffer_Types? = null, - groupId: Int? = null - ) = all(bufferName, bufferId, networkId, type, groupId).firstOrNull() - - fun liveFind( - bufferName: String? = null, - bufferId: BufferId? = null, - networkId: NetworkId? = null, - type: Buffer_Types? = null, - groupId: Int? = null - ) = liveAll(bufferName, bufferId, networkId, type, groupId).map { - Optional.ofNullable(it.firstOrNull()) - } - - override fun toString(): String { - return "BufferSyncer(_lastSeenMsg=$_lastSeenMsg, _markerLines=$_markerLines, _bufferActivities=$_bufferActivities, _highlightCounts=$_highlightCounts, _bufferInfos=$_bufferInfos)" - } - - private val _lastSeenMsg: MutableMap<BufferId, MsgId> = mutableMapOf() - private val live_lastSeenMsg = BehaviorSubject.createDefault(Unit) - - private val _markerLines: MutableMap<BufferId, MsgId> = mutableMapOf() - private val live_markerLines = BehaviorSubject.createDefault(Unit) - - private val _bufferActivities: MutableMap<BufferId, Message_Types> = mutableMapOf() - private val live_bufferActivities = BehaviorSubject.createDefault(Unit) - - private val _highlightCounts: MutableMap<BufferId, Int> = mutableMapOf() - private val live_highlightCounts = BehaviorSubject.createDefault(Unit) - - private val _bufferInfos = mutableMapOf<BufferId, BufferInfo>() - private val live_bufferInfos = BehaviorSubject.createDefault(Unit) -} diff --git a/lib/src/main/java/de/kuschku/libquassel/quassel/syncables/BufferViewConfig.kt b/lib/src/main/java/de/kuschku/libquassel/quassel/syncables/BufferViewConfig.kt deleted file mode 100644 index efe7dd25d8fbfb3020af5852ce8e70e0f739d56e..0000000000000000000000000000000000000000 --- a/lib/src/main/java/de/kuschku/libquassel/quassel/syncables/BufferViewConfig.kt +++ /dev/null @@ -1,387 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.libquassel.quassel.syncables - -import de.kuschku.libquassel.protocol.* -import de.kuschku.libquassel.protocol.Type -import de.kuschku.libquassel.quassel.BufferInfo -import de.kuschku.libquassel.quassel.syncables.interfaces.IBufferViewConfig -import de.kuschku.libquassel.session.SignalProxy -import de.kuschku.libquassel.util.flag.hasFlag -import de.kuschku.libquassel.util.helper.clampOf -import io.reactivex.Observable -import io.reactivex.subjects.BehaviorSubject - -class BufferViewConfig constructor( - bufferViewId: Int, - proxy: SignalProxy -) : SyncableObject(proxy, "BufferViewConfig"), IBufferViewConfig { - override fun init() { - renameObject("$_bufferViewId") - } - - override fun toVariantMap(): QVariantMap = mapOf( - "BufferList" to QVariant.of(initBufferList(), Type.QVariantList), - "RemovedBuffers" to QVariant.of(initRemovedBuffers(), Type.QVariantList), - "TemporarilyRemovedBuffers" to QVariant.of(initTemporarilyRemovedBuffers(), Type.QVariantList) - ) + initProperties() - - override fun fromVariantMap(properties: QVariantMap) { - initSetBufferList(properties["BufferList"].valueOr(::emptyList)) - initSetRemovedBuffers(properties["RemovedBuffers"].valueOr(::emptyList)) - initSetTemporarilyRemovedBuffers(properties["TemporarilyRemovedBuffers"].valueOr(::emptyList)) - initSetProperties(properties) - } - - override fun initBufferList(): QVariantList = _buffers.map { - QVariant.of(it, QType.BufferId) - } - - override fun initRemovedBuffers(): QVariantList = _removedBuffers.map { - QVariant.of(it, QType.BufferId) - } - - override fun initTemporarilyRemovedBuffers(): QVariantList = _temporarilyRemovedBuffers.map { - QVariant.of(it, QType.BufferId) - } - - override fun initProperties(): QVariantMap = mapOf( - "bufferViewName" to QVariant.of(bufferViewName(), Type.QString), - "networkId" to QVariant.of(networkId(), QType.NetworkId), - "addNewBuffersAutomatically" to QVariant.of(addNewBuffersAutomatically(), Type.Bool), - "sortAlphabetically" to QVariant.of(sortAlphabetically(), Type.Bool), - "hideInactiveBuffers" to QVariant.of(hideInactiveBuffers(), Type.Bool), - "hideInactiveNetworks" to QVariant.of(hideInactiveNetworks(), Type.Bool), - "disableDecoration" to QVariant.of(disableDecoration(), Type.Bool), - "allowedBufferTypes" to QVariant.of(allowedBufferTypes().toInt(), Type.Int), - "minimumActivity" to QVariant.of(minimumActivity().toInt(), Type.Int), - "showSearch" to QVariant.of(showSearch(), Type.Bool) - ) - - override fun initSetBufferList(buffers: QVariantList) { - _buffers = buffers.mapNotNull { it.value<BufferId?>() }.toMutableList() - live_buffers.onNext(Unit) - } - - override fun initSetRemovedBuffers(buffers: QVariantList) { - _removedBuffers = buffers.mapNotNull { it.value<BufferId?>() }.toMutableSet() - live_removedBuffers.onNext(Unit) - } - - override fun initSetTemporarilyRemovedBuffers(buffers: QVariantList) { - _temporarilyRemovedBuffers = buffers.mapNotNull { it.value<BufferId?>() }.toMutableSet() - live_temporarilyRemovedBuffers.onNext(Unit) - } - - override fun initSetProperties(properties: QVariantMap) { - _bufferViewName = properties["bufferViewName"].valueOr(this::bufferViewName) - _networkId = properties["networkId"].valueOr(this::networkId) - _addNewBuffersAutomatically = properties["addNewBuffersAutomatically"].valueOr(this::addNewBuffersAutomatically) - _sortAlphabetically = properties["sortAlphabetically"].valueOr(this::sortAlphabetically) - _hideInactiveBuffers = properties["hideInactiveBuffers"].valueOr(this::hideInactiveBuffers) - _hideInactiveNetworks = properties["hideInactiveNetworks"].valueOr(this::hideInactiveNetworks) - _disableDecoration = properties["disableDecoration"].valueOr(this::disableDecoration) - _allowedBufferTypes = Buffer_Type.of(properties["allowedBufferTypes"].value(_allowedBufferTypes.value.toInt()).toShort()) - _minimumActivity = Buffer_Activity.of(properties["minimumActivity"].value(_minimumActivity.value.toInt())) - _showSearch = properties["showSearch"].valueOr(this::showSearch) - } - - override fun addBuffer(bufferId: BufferId, pos: Int) { - if (_buffers.contains(bufferId)) - return - - if (_removedBuffers.contains(bufferId)) { - _removedBuffers.remove(bufferId) - live_removedBuffers.onNext(Unit) - } - - if (_temporarilyRemovedBuffers.contains(bufferId)) { - _temporarilyRemovedBuffers.remove(bufferId) - live_temporarilyRemovedBuffers.onNext(Unit) - } - - _buffers.add(minOf(maxOf(pos, 0), _buffers.size), bufferId) - live_buffers.onNext(Unit) - } - - override fun moveBuffer(bufferId: BufferId, pos: Int) { - if (!_buffers.contains(bufferId)) - return - - val currentPos = _buffers.indexOf(bufferId) - val targetPos = clampOf(pos, 0, _buffers.size - 1) - - if (currentPos > targetPos) { - _buffers.removeAt(currentPos) - _buffers.add(targetPos, bufferId) - } - - if (currentPos < targetPos) { - _buffers.removeAt(currentPos) - _buffers.add(targetPos - 1, bufferId) - } - - live_buffers.onNext(Unit) - } - - override fun removeBuffer(bufferId: BufferId) { - if (_buffers.contains(bufferId)) { - _buffers.remove(bufferId) - live_buffers.onNext(Unit) - } - - if (_removedBuffers.contains(bufferId)) { - _removedBuffers.remove(bufferId) - live_removedBuffers.onNext(Unit) - } - - _temporarilyRemovedBuffers.add(bufferId) - live_temporarilyRemovedBuffers.onNext(Unit) - } - - override fun removeBufferPermanently(bufferId: BufferId) { - if (_buffers.contains(bufferId)) { - _buffers.remove(bufferId) - live_buffers.onNext(Unit) - } - - if (_temporarilyRemovedBuffers.contains(bufferId)) { - _temporarilyRemovedBuffers.remove(bufferId) - live_temporarilyRemovedBuffers.onNext(Unit) - } - - _removedBuffers.add(bufferId) - live_removedBuffers.onNext(Unit) - } - - fun bufferViewId() = _bufferViewId - fun bufferViewName() = _bufferViewName - fun networkId() = _networkId - fun addNewBuffersAutomatically() = _addNewBuffersAutomatically - fun sortAlphabetically() = _sortAlphabetically - fun hideInactiveBuffers() = _hideInactiveBuffers - fun hideInactiveNetworks() = _hideInactiveNetworks - fun disableDecoration() = _disableDecoration - fun allowedBufferTypes() = _allowedBufferTypes - fun minimumActivity() = _minimumActivity - fun showSearch() = _showSearch - - fun buffers(): List<BufferId> = _buffers.toList() - fun removedBuffers(): Set<BufferId> = _removedBuffers.toSet() - fun temporarilyRemovedBuffers(): Set<BufferId> = _temporarilyRemovedBuffers.toSet() - - fun liveUpdates(): Observable<BufferViewConfig> = - live_config.map { this } - - fun liveBuffers(): Observable<List<BufferId>> = - live_buffers.map { buffers() } - - fun liveRemovedBuffers(): Observable<Set<BufferId>> = - live_removedBuffers.map { removedBuffers() } - - fun liveTemporarilyRemovedBuffers(): Observable<Set<BufferId>> = - live_temporarilyRemovedBuffers.map { temporarilyRemovedBuffers() } - - fun copy(): BufferViewConfig { - val config = BufferViewConfig(this.bufferViewId(), SignalProxy.NULL) - config.fromVariantMap(toVariantMap()) - return config - } - - override fun setAddNewBuffersAutomatically(addNewBuffersAutomatically: Boolean) { - _addNewBuffersAutomatically = addNewBuffersAutomatically - super.setAddNewBuffersAutomatically(addNewBuffersAutomatically) - } - - fun setAllowedBufferTypes(bufferTypes: Buffer_Types) { - _allowedBufferTypes = bufferTypes - super.setAllowedBufferTypes(bufferTypes.toInt()) - } - - override fun setAllowedBufferTypes(bufferTypes: Int) { - _allowedBufferTypes = Buffer_Type.of(bufferTypes.toShort()) - super.setAllowedBufferTypes(bufferTypes) - } - - override fun setBufferViewName(bufferViewName: String?) { - _bufferViewName = bufferViewName ?: "" - super.setBufferViewName(bufferViewName) - } - - override fun setDisableDecoration(disableDecoration: Boolean) { - _disableDecoration = disableDecoration - super.setDisableDecoration(disableDecoration) - } - - override fun setHideInactiveBuffers(hideInactiveBuffers: Boolean) { - _hideInactiveBuffers = hideInactiveBuffers - super.setHideInactiveBuffers(hideInactiveBuffers) - } - - override fun setHideInactiveNetworks(hideInactiveNetworks: Boolean) { - _hideInactiveNetworks = hideInactiveNetworks - super.setHideInactiveNetworks(hideInactiveNetworks) - } - - override fun setMinimumActivity(activity: Int) { - _minimumActivity = Buffer_Activity.of(activity) - super.setMinimumActivity(activity) - } - - override fun setNetworkId(networkId: NetworkId) { - _networkId = networkId - super.setNetworkId(networkId) - } - - override fun setShowSearch(showSearch: Boolean) { - _showSearch = showSearch - super.setShowSearch(showSearch) - } - - override fun setSortAlphabetically(sortAlphabetically: Boolean) { - _sortAlphabetically = sortAlphabetically - super.setSortAlphabetically(sortAlphabetically) - } - - - private val _bufferViewId: Int = bufferViewId - private var _bufferViewName: String = "" - set(value) { - field = value - live_config.onNext(Unit) - } - private var _networkId: NetworkId = NetworkId(0) - set(value) { - field = value - live_config.onNext(Unit) - } - private var _addNewBuffersAutomatically: Boolean = true - set(value) { - field = value - live_config.onNext(Unit) - } - private var _sortAlphabetically: Boolean = true - set(value) { - field = value - live_config.onNext(Unit) - } - private var _hideInactiveBuffers: Boolean = false - set(value) { - field = value - live_config.onNext(Unit) - } - private var _hideInactiveNetworks: Boolean = false - set(value) { - field = value - live_config.onNext(Unit) - } - private var _disableDecoration: Boolean = false - set(value) { - field = value - live_config.onNext(Unit) - } - private var _allowedBufferTypes: Buffer_Types = Buffer_Type.of(*Buffer_Type.validValues) - set(value) { - field = value - live_config.onNext(Unit) - } - private var _minimumActivity: Buffer_Activities = Buffer_Activities.of(0u) - set(value) { - field = value - live_config.onNext(Unit) - } - private var _showSearch: Boolean = false - set(value) { - field = value - live_config.onNext(Unit) - } - private var _buffers: MutableList<BufferId> = mutableListOf() - private var _removedBuffers: MutableSet<BufferId> = mutableSetOf() - private var _temporarilyRemovedBuffers: MutableSet<BufferId> = mutableSetOf() - private val live_config = BehaviorSubject.createDefault(Unit) - private val live_buffers = BehaviorSubject.createDefault(Unit) - private val live_removedBuffers = BehaviorSubject.createDefault(Unit) - private val live_temporarilyRemovedBuffers = BehaviorSubject.createDefault(Unit) - - object NameComparator : Comparator<BufferViewConfig> { - override fun compare(a: BufferViewConfig?, b: BufferViewConfig?) = - (a?.bufferViewName() ?: "").compareTo((b?.bufferViewName() ?: ""), true) - } - - fun insertBufferSorted(info: BufferInfo, bufferSyncer: BufferSyncer) { - if (sortAlphabetically()) { - var maxBuffer = -1 - for (i in 0 until _buffers.size) { - val buffer = bufferSyncer.bufferInfo(_buffers[i]) - ?: continue - if (buffer.networkId != info.networkId) - continue - if (String.CASE_INSENSITIVE_ORDER.compare(buffer.bufferName, info.bufferName) > 0) - continue - maxBuffer = i - } - requestAddBuffer(info.bufferId, maxBuffer + 1) - } else { - requestAddBuffer(info.bufferId, _buffers.size) - } - } - - fun handleBuffer(info: BufferInfo, bufferSyncer: BufferSyncer, unhide: Boolean = false) { - if (_addNewBuffersAutomatically && - !_buffers.contains(info.bufferId) && - !_temporarilyRemovedBuffers.contains(info.bufferId) && - !_removedBuffers.contains(info.bufferId) && - !info.type.hasFlag(Buffer_Type.StatusBuffer)) { - insertBufferSorted(info, bufferSyncer) - } else if (unhide && !_buffers.contains(info.bufferId) && - _temporarilyRemovedBuffers.contains(info.bufferId)) { - insertBufferSorted(info, bufferSyncer) - } - } - - fun isEqual(other: BufferViewConfig): Boolean = - this.bufferViewName() == other.bufferViewName() && - this.showSearch() == other.showSearch() && - this.sortAlphabetically() == other.sortAlphabetically() && - this.addNewBuffersAutomatically() == other.addNewBuffersAutomatically() && - this.hideInactiveBuffers() == other.hideInactiveBuffers() && - this.hideInactiveNetworks() == other.hideInactiveNetworks() && - this.allowedBufferTypes() == other.allowedBufferTypes() && - this.networkId() == other.networkId() && - this.minimumActivity() == other.minimumActivity() - - override fun toString(): String { - return "BufferViewConfig(_bufferViewId=$_bufferViewId, _bufferViewName='$_bufferViewName', _networkId=$_networkId, _addNewBuffersAutomatically=$_addNewBuffersAutomatically, _sortAlphabetically=$_sortAlphabetically, _hideInactiveBuffers=$_hideInactiveBuffers, _hideInactiveNetworks=$_hideInactiveNetworks, _disableDecoration=$_disableDecoration, _allowedBufferTypes=$_allowedBufferTypes, _minimumActivity=$_minimumActivity, _showSearch=$_showSearch)" - } - - companion object { - inline fun <T> sortBuffers(list: List<T>, sortAlphabetically: Boolean, - crossinline bufferName: (T) -> String, - crossinline networkName: (T) -> String, - crossinline type: (T) -> Buffer_Types) = - list.let { - if (sortAlphabetically) list.sortedWith(compareBy(String.CASE_INSENSITIVE_ORDER, - bufferName)) - else list - }.sortedBy { - !type(it).hasFlag(Buffer_Type.StatusBuffer) - }.sortedWith(compareBy(String.CASE_INSENSITIVE_ORDER, networkName)) - } -} diff --git a/lib/src/main/java/de/kuschku/libquassel/quassel/syncables/BufferViewManager.kt b/lib/src/main/java/de/kuschku/libquassel/quassel/syncables/BufferViewManager.kt deleted file mode 100644 index 37fdeff6602f76daec46c4cf8118f75396255c77..0000000000000000000000000000000000000000 --- a/lib/src/main/java/de/kuschku/libquassel/quassel/syncables/BufferViewManager.kt +++ /dev/null @@ -1,111 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.libquassel.quassel.syncables - -import de.kuschku.libquassel.protocol.* -import de.kuschku.libquassel.quassel.BufferInfo -import de.kuschku.libquassel.quassel.syncables.interfaces.IBufferViewManager -import de.kuschku.libquassel.session.SignalProxy -import io.reactivex.Observable -import io.reactivex.subjects.BehaviorSubject - -class BufferViewManager constructor( - proxy: SignalProxy -) : SyncableObject(proxy, "BufferViewManager"), IBufferViewManager { - override fun toVariantMap(): QVariantMap = mapOf( - "BufferViewIds" to QVariant.of(initBufferViewIds(), Type.QVariantList) - ) - - override fun fromVariantMap(properties: QVariantMap) { - initSetBufferViewIds(properties["BufferViewIds"].valueOr(::emptyList)) - } - - fun copy() = BufferViewManager(proxy).also { - it.fromVariantMap(toVariantMap()) - } - - fun isEqual(other: BufferViewManager) = - _bufferViewConfigs.keys == other._bufferViewConfigs.keys - - override fun initBufferViewIds(): QVariantList = _bufferViewConfigs.keys.map { - QVariant.of(it, Type.Int) - } - - fun bufferViewConfig(bufferViewId: Int) = _bufferViewConfigs[bufferViewId] - - fun bufferViewConfigs() = _bufferViewConfigs.values - - fun liveBufferViewConfigs(): Observable<Set<Int>> = live_bufferViewConfigs - - override fun initSetBufferViewIds(bufferViewIds: QVariantList) { - setBufferViewIds(bufferViewIds.mapNotNull { it.value<Int>() }) - } - - fun setBufferViewIds(ids: List<Int>) { - for (id in ids) { - addBufferViewConfig(id) - } - } - - override fun addBufferViewConfig(config: BufferViewConfig) { - if (_bufferViewConfigs.contains(config.bufferViewId())) - return - - proxy.synchronize(config, !initialized) - _bufferViewConfigs[config.bufferViewId()] = config - live_bufferViewConfigs.onNext(_bufferViewConfigs.keys) - } - - override fun addBufferViewConfig(bufferViewConfigId: Int) { - if (_bufferViewConfigs.contains(bufferViewConfigId)) - return - - addBufferViewConfig(BufferViewConfig(bufferViewConfigId, proxy)) - } - - override fun deleteBufferViewConfig(bufferViewConfigId: Int) { - if (!_bufferViewConfigs.contains(bufferViewConfigId)) - return - - _bufferViewConfigs.remove(bufferViewConfigId) - live_bufferViewConfigs.onNext(_bufferViewConfigs.keys) - } - - private val _bufferViewConfigs: MutableMap<Int, BufferViewConfig> = mutableMapOf() - - private val live_bufferViewConfigs: BehaviorSubject<Set<Int>> = BehaviorSubject.createDefault( - emptySet()) - - fun handleBuffer(info: BufferInfo, bufferSyncer: BufferSyncer, unhide: Boolean = false) { - for (bufferViewConfig in bufferViewConfigs()) { - bufferViewConfig.handleBuffer(info, bufferSyncer, unhide) - } - } - - override fun deinit() { - _bufferViewConfigs.values.map(BufferViewConfig::deinit) - } - - override fun toString(): String { - return "BufferViewManager(_bufferViewConfigs=${_bufferViewConfigs.keys})" - } - - -} diff --git a/lib/src/main/java/de/kuschku/libquassel/quassel/syncables/CertManager.kt b/lib/src/main/java/de/kuschku/libquassel/quassel/syncables/CertManager.kt deleted file mode 100644 index 4ef2cb8250ba2238cb4638ff42ef7344757c58a1..0000000000000000000000000000000000000000 --- a/lib/src/main/java/de/kuschku/libquassel/quassel/syncables/CertManager.kt +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.libquassel.quassel.syncables - -import de.kuschku.libquassel.protocol.* -import de.kuschku.libquassel.quassel.syncables.interfaces.ICertManager -import de.kuschku.libquassel.session.SignalProxy -import java.nio.ByteBuffer - -class CertManager constructor( - private val _identityId: IdentityId, - proxy: SignalProxy -) : SyncableObject(proxy, "CertManager"), ICertManager { - override fun init() { - renameObject("${_identityId.id}") - } - - override fun toVariantMap() = initProperties() - - override fun fromVariantMap(properties: QVariantMap) { - initSetProperties(properties) - } - - override fun initProperties(): QVariantMap = mapOf( - "sslKey" to QVariant.of(sslKeyPem(), Type.QByteArray), - "sslCert" to QVariant.of(sslCertPem(), Type.QByteArray) - ) - - override fun initSetProperties(properties: QVariantMap) { - setSslKey(properties["sslKey"].value()) - setSslCert(properties["sslCert"].value()) - } - - fun sslCertPem() = _sslCert - fun sslKeyPem() = _sslKey - - override fun setSslCert(encoded: ByteBuffer?) { - _sslCert = encoded - } - - override fun setSslKey(encoded: ByteBuffer?) { - _sslKey = encoded - } - - private var _sslKey: ByteBuffer? = null - private var _sslCert: ByteBuffer? = null -} diff --git a/lib/src/main/java/de/kuschku/libquassel/quassel/syncables/CoreInfo.kt b/lib/src/main/java/de/kuschku/libquassel/quassel/syncables/CoreInfo.kt deleted file mode 100644 index 41ffcf2440524430af76d3dffd349d7d0cdd69a9..0000000000000000000000000000000000000000 --- a/lib/src/main/java/de/kuschku/libquassel/quassel/syncables/CoreInfo.kt +++ /dev/null @@ -1,105 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.libquassel.quassel.syncables - -import de.kuschku.libquassel.protocol.* -import de.kuschku.libquassel.quassel.QuasselFeatures -import de.kuschku.libquassel.quassel.syncables.interfaces.ICoreInfo -import de.kuschku.libquassel.session.SignalProxy -import io.reactivex.subjects.BehaviorSubject -import org.threeten.bp.Instant - -class CoreInfo constructor( - proxy: SignalProxy -) : SyncableObject(proxy, "CoreInfo"), ICoreInfo { - override fun toVariantMap() = initProperties() - - override fun fromVariantMap(properties: QVariantMap) { - initSetProperties(properties) - } - - override fun initProperties(): QVariantMap = mapOf( - "coreData" to QVariant.of(coreData(), Type.QVariantMap) - ) - - override fun initSetProperties(properties: QVariantMap) { - setCoreData(properties["coreData"].value(coreData())) - } - - override fun setCoreData(data: QVariantMap) { - _coreData = data - super.setCoreData(data) - } - - fun coreData() = _coreData - fun info() = _coreData.let { - CoreData( - quasselVersion = it["quasselVersion"]?.value("") ?: "", - quasselBuildDate = it["quasselBuildDate"]?.value("") ?: "", - startTime = it["startTime"]?.value(Instant.EPOCH) ?: Instant.EPOCH, - sessionConnectedClients = it["sessionConnectedClients"]?.value(0) ?: 0, - sessionConnectedClientData = it["sessionConnectedClientData"]?.value(emptyList<QVariant_>())?.map { - it.value(emptyMap<String, QVariant_>()).let { - ConnectedClientData( - id = it["id"]?.value(0) ?: 0, - remoteAddress = it["remoteAddress"]?.value("") ?: "", - location = it["location"]?.value("") ?: "", - clientVersion = it["clientVersion"]?.value("") ?: "", - clientVersionDate = it["clientVersionDate"]?.value("") ?: "", - connectedSince = it["connectedSince"]?.value(Instant.EPOCH) ?: Instant.EPOCH, - secure = it["secure"]?.value(false) ?: false, - features = QuasselFeatures( - Legacy_Feature.of(it["features"]?.value(0) ?: 0), - it["featureList"]?.valueOr(::emptyList) ?: emptyList() - ) - ) - } - } ?: emptyList() - ) - } - - fun liveInfo() = live_coreData.map { info() } - - private val live_coreData = BehaviorSubject.createDefault(Unit) - private var _coreData: QVariantMap = emptyMap() - set(value) { - field = value - live_coreData.onNext(Unit) - } - - data class CoreData( - val quasselVersion: String, - val quasselBuildDate: String, - val startTime: Instant, - val sessionConnectedClients: Int, - val sessionConnectedClientData: List<ConnectedClientData> - ) - - data class ConnectedClientData( - val id: Int, - val remoteAddress: String, - val location: String, - val clientVersion: String, - val clientVersionDate: String, - val connectedSince: Instant, - val secure: Boolean, - val features: QuasselFeatures - ) -} diff --git a/lib/src/main/java/de/kuschku/libquassel/quassel/syncables/DccConfig.kt b/lib/src/main/java/de/kuschku/libquassel/quassel/syncables/DccConfig.kt deleted file mode 100644 index 5f93eb2d475fb55496992155c57b5fd8eb0ec80a..0000000000000000000000000000000000000000 --- a/lib/src/main/java/de/kuschku/libquassel/quassel/syncables/DccConfig.kt +++ /dev/null @@ -1,167 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.libquassel.quassel.syncables - -import de.kuschku.libquassel.protocol.* -import de.kuschku.libquassel.quassel.syncables.interfaces.IDccConfig -import de.kuschku.libquassel.session.SignalProxy -import java.net.Inet4Address -import java.net.InetAddress - -class DccConfig constructor( - proxy: SignalProxy -) : SyncableObject(proxy, "DccConfig"), IDccConfig { - override fun init() { - renameObject("DccConfig") - } - - override fun toVariantMap() = initProperties() - - override fun fromVariantMap(properties: QVariantMap) { - initSetProperties(properties) - } - - override fun initProperties(): QVariantMap = mapOf( - /// Whether DCC is enabled - "dccEnabled" to QVariant.of(isDccEnabled(), Type.Bool), - /// The IP to use for outgoing traffic - "outgoingIp" to QVariant.of(outgoingIp(), QType.QHostAddress), - /// The IP detection mode - "ipDetectionMode" to QVariant.of(ipDetectionMode(), QType.DccConfig_IpDetectionMode), - /// The port range selection mode - "portSelectionMode" to QVariant.of(portSelectionMode(), QType.DccConfig_PortSelectionMode), - /// Minimum port to use for incoming connections - "minPort" to QVariant.of(minPort(), Type.UShort), - /// Maximum port to use for incoming connections - "maxPort" to QVariant.of(maxPort(), Type.UShort), - /// The chunk size to be used - "chunkSize" to QVariant.of(chunkSize(), Type.Int), - /// The timeout for DCC transfers - "sendTimeout" to QVariant.of(sendTimeout(), Type.Int), - /// Whether passive (reverse) DCC should be used - "usePassiveDcc" to QVariant.of(usePassiveDcc(), Type.Bool), - /// Whether fast sending should be used - "useFastSend" to QVariant.of(useFastSend(), Type.Bool) - ) - - override fun initSetProperties(properties: QVariantMap) { - /// Whether DCC is enabled - setDccEnabled(properties["dccEnabled"].valueOr(this::isDccEnabled)) - /// The IP to use for outgoing traffic - setOutgoingIp(properties["outgoingIp"].valueOr(this::outgoingIp)) - /// The IP detection mode - setIpDetectionMode(properties["ipDetectionMode"].valueOr(this::ipDetectionMode)) - /// The port range selection mode - setPortSelectionMode(properties["portSelectionMode"].valueOr(this::portSelectionMode)) - /// Minimum port to use for incoming connections - setMinPort(properties["minPort"].valueOr(this::minPort)) - /// Maximum port to use for incoming connections - setMaxPort(properties["maxPort"].valueOr(this::maxPort)) - /// The chunk size to be used - setChunkSize(properties["chunkSize"].valueOr(this::chunkSize)) - /// The timeout for DCC transfers - setSendTimeout(properties["sendTimeout"].valueOr(this::sendTimeout)) - /// Whether passive (reverse) DCC should be used - setUsePassiveDcc(properties["usePassiveDcc"].valueOr(this::usePassiveDcc)) - /// Whether fast sending should be used - setUseFastSend(properties["useFastSend"].valueOr(this::useFastSend)) - } - - override fun setDccEnabled(enabled: Boolean) { - _dccEnabled = enabled - } - - override fun setOutgoingIp(outgoingIp: InetAddress) { - _outgoingIp = outgoingIp - } - - override fun setIpDetectionMode(ipDetectionMode: IDccConfig.IpDetectionMode) { - _ipDetectionMode = ipDetectionMode - } - - override fun setPortSelectionMode(portSelectionMode: IDccConfig.PortSelectionMode) { - _portSelectionMode = portSelectionMode - } - - override fun setMinPort(port: UShort) { - _minPort = port - } - - override fun setMaxPort(port: UShort) { - _maxPort = port - } - - override fun setChunkSize(chunkSize: Int) { - _chunkSize = chunkSize - } - - override fun setSendTimeout(timeout: Int) { - _sendTimeout = timeout - } - - override fun setUsePassiveDcc(use: Boolean) { - _usePassiveDcc = use - } - - override fun setUseFastSend(use: Boolean) { - _useFastSend = use - } - - fun isDccEnabled() = _dccEnabled - fun outgoingIp() = _outgoingIp - fun ipDetectionMode() = _ipDetectionMode - fun portSelectionMode() = _portSelectionMode - fun minPort() = _minPort - fun maxPort() = _maxPort - fun chunkSize() = _chunkSize - fun sendTimeout() = _sendTimeout - fun usePassiveDcc() = _usePassiveDcc - fun useFastSend() = _useFastSend - - /** Whether DCC is enabled */ - private var _dccEnabled: Boolean = false - - /** The IP to use for outgoing traffic */ - private var _outgoingIp: InetAddress = Inet4Address.getByAddress(byteArrayOf(127, 0, 0, 1)) - - /** The IP detection mode */ - private var _ipDetectionMode: IDccConfig.IpDetectionMode = IDccConfig.IpDetectionMode.Automatic - - /** The port range selection mode */ - private var _portSelectionMode: IDccConfig.PortSelectionMode = IDccConfig.PortSelectionMode.Automatic - - /** Minimum port to use for incoming connections */ - private var _minPort: UShort = 1024u - - /** Maximum port to use for incoming connections */ - private var _maxPort: UShort = 32767u - - /** The chunk size to be used */ - private var _chunkSize: Int = 16 - - /** The timeout for DCC transfers */ - private var _sendTimeout: Int = 180 - - /** Whether passive (reverse) DCC should be used */ - private var _usePassiveDcc: Boolean = false - - /** Whether fast sending should be used */ - private var _useFastSend: Boolean = false -} diff --git a/lib/src/main/java/de/kuschku/libquassel/quassel/syncables/HighlightRuleManager.kt b/lib/src/main/java/de/kuschku/libquassel/quassel/syncables/HighlightRuleManager.kt deleted file mode 100644 index 38c82fea129e4ee13eb788431e6305b26d2f305e..0000000000000000000000000000000000000000 --- a/lib/src/main/java/de/kuschku/libquassel/quassel/syncables/HighlightRuleManager.kt +++ /dev/null @@ -1,172 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.libquassel.quassel.syncables - -import de.kuschku.libquassel.protocol.* -import de.kuschku.libquassel.quassel.syncables.interfaces.IHighlightRuleManager -import de.kuschku.libquassel.session.SignalProxy -import java.io.Serializable - -class HighlightRuleManager( - proxy: SignalProxy -) : SyncableObject(proxy, "HighlightRuleManager"), IHighlightRuleManager { - data class HighlightRule( - val id: Int, - val name: String, - val isRegEx: Boolean = false, - val isCaseSensitive: Boolean = false, - val isEnabled: Boolean = true, - val isInverse: Boolean = false, - val sender: String, - val channel: String - ) : Serializable - - override fun toVariantMap(): QVariantMap = mapOf( - "HighlightRuleList" to QVariant.of(initHighlightRuleList(), Type.QVariantMap), - "highlightNick" to QVariant.of(_highlightNick.value, Type.Int), - "nicksCaseSensitive" to QVariant.of(_nicksCaseSensitive, Type.Bool) - ) - - override fun fromVariantMap(properties: QVariantMap) { - initSetHighlightRuleList(properties["HighlightRuleList"].valueOr(::emptyMap)) - - _highlightNick = properties["highlightNick"].value<Int>()?.let { - IHighlightRuleManager.HighlightNickType.of(it) - } ?: _highlightNick - _nicksCaseSensitive = properties["nicksCaseSensitive"].value(_nicksCaseSensitive) - } - - override fun initHighlightRuleList(): QVariantMap = mapOf( - "id" to QVariant.of(_highlightRuleList.map { - QVariant.of(it.id, Type.Int) - }, Type.QVariantList), - "name" to QVariant.of(_highlightRuleList.map { - it.name - }, Type.QStringList), - "isRegEx" to QVariant.of(_highlightRuleList.map { - QVariant.of(it.isRegEx, Type.Bool) - }, Type.QVariantList), - "isCaseSensitive" to QVariant.of(_highlightRuleList.map { - QVariant.of(it.isCaseSensitive, Type.Bool) - }, Type.QVariantList), - "isEnabled" to QVariant.of(_highlightRuleList.map { - QVariant.of(it.isEnabled, Type.Bool) - }, Type.QVariantList), - "isInverse" to QVariant.of(_highlightRuleList.map { - QVariant.of(it.isInverse, Type.Bool) - }, Type.QVariantList), - "sender" to QVariant.of(_highlightRuleList.map { - it.sender - }, Type.QStringList), - "channel" to QVariant.of(_highlightRuleList.map { - it.channel - }, Type.QStringList) - ) - - override fun initSetHighlightRuleList(highlightRuleList: QVariantMap) { - val idList = highlightRuleList["id"].valueOr<QVariantList>(::emptyList) - val nameList = highlightRuleList["name"].valueOr<QStringList>(::emptyList) - val isRegExList = highlightRuleList["isRegEx"].valueOr<QVariantList>(::emptyList) - val isCaseSensitiveList = highlightRuleList["isCaseSensitive"].valueOr<QVariantList>(::emptyList) - val isEnabledList = highlightRuleList["isEnabled"].valueOr<QVariantList>(::emptyList) - val isInverseList = highlightRuleList["isInverse"].valueOr<QVariantList>(::emptyList) - val senderList = highlightRuleList["sender"].valueOr<QStringList>(::emptyList) - val channelList = highlightRuleList["channel"].valueOr<QStringList>(::emptyList) - val size = idList.size - if (nameList.size != size || isRegExList.size != size || isCaseSensitiveList.size != size || - isEnabledList.size != size || isInverseList.size != size || senderList.size != size || - channelList.size != size) - return - - _highlightRuleList = List(size) { - HighlightRule( - id = idList[it].value(0), - name = nameList[it] ?: "", - isRegEx = isRegExList[it].value(false), - isCaseSensitive = isCaseSensitiveList[it].value(false), - isEnabled = isEnabledList[it].value(false), - isInverse = isInverseList[it].value(false), - sender = senderList[it] ?: "", - channel = channelList[it] ?: "" - ) - } - } - - override fun removeHighlightRule(highlightRule: Int) = removeAt(indexOf(highlightRule)) - - override fun toggleHighlightRule(highlightRule: Int) { - _highlightRuleList = _highlightRuleList.map { - if (it.id == highlightRule) it.copy(isEnabled = !it.isEnabled) else it - } - } - - override fun addHighlightRule(id: Int, name: String?, isRegEx: Boolean, isCaseSensitive: Boolean, - isEnabled: Boolean, isInverse: Boolean, sender: String?, - chanName: String?) { - if (contains(id)) return - - _highlightRuleList += HighlightRule( - id, name ?: "", isRegEx, isCaseSensitive, isEnabled, isInverse, sender ?: "", chanName ?: "" - ) - } - - - fun highlightNick() = _highlightNick - override fun setHighlightNick(highlightNick: Int) { - _highlightNick = IHighlightRuleManager.HighlightNickType.of(highlightNick) ?: _highlightNick - } - - fun nicksCaseSensitive() = _nicksCaseSensitive - override fun setNicksCaseSensitive(nicksCaseSensitive: Boolean) { - _nicksCaseSensitive = nicksCaseSensitive - } - - fun indexOf(id: Int): Int = _highlightRuleList.indexOfFirst { it.id == id } - fun contains(id: Int) = _highlightRuleList.any { it.id == id } - - fun isEmpty() = _highlightRuleList.isEmpty() - fun count() = _highlightRuleList.count() - fun removeAt(index: Int) { - _highlightRuleList = _highlightRuleList.drop(index) - } - - operator fun get(index: Int) = _highlightRuleList[index] - fun highlightRuleList() = _highlightRuleList - fun setHighlightRuleList(list: List<HighlightRule>) { - _highlightRuleList = list - } - - fun copy() = HighlightRuleManager(proxy).also { - it.fromVariantMap(toVariantMap()) - } - - private var _highlightRuleList = emptyList<HighlightRule>() - private var _highlightNick = IHighlightRuleManager.HighlightNickType.CurrentNick - private var _nicksCaseSensitive = false - - fun isEqual(other: HighlightRuleManager): Boolean = - this.highlightNick() == other.highlightNick() && - this.nicksCaseSensitive() == other.nicksCaseSensitive() && - this.highlightRuleList() == other.highlightRuleList() - - override fun toString(): String { - return "HighlightRuleManager(_highlightRuleList=$_highlightRuleList, _highlightNick=$_highlightNick, _nicksCaseSensitive=$_nicksCaseSensitive)" - } -} diff --git a/lib/src/main/java/de/kuschku/libquassel/quassel/syncables/Identity.kt b/lib/src/main/java/de/kuschku/libquassel/quassel/syncables/Identity.kt deleted file mode 100644 index 259c8cfc894048b1fd519448b503fdbcbd719a3d..0000000000000000000000000000000000000000 --- a/lib/src/main/java/de/kuschku/libquassel/quassel/syncables/Identity.kt +++ /dev/null @@ -1,324 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.libquassel.quassel.syncables - -import de.kuschku.libquassel.protocol.* -import de.kuschku.libquassel.quassel.syncables.interfaces.IIdentity -import de.kuschku.libquassel.session.SignalProxy -import io.reactivex.Observable -import io.reactivex.subjects.BehaviorSubject - -class Identity constructor( - proxy: SignalProxy -) : SyncableObject(proxy, "Identity"), IIdentity { - override fun toVariantMap() = initProperties() - override fun fromVariantMap(properties: QVariantMap) { - initSetProperties(properties) - } - - override fun init() { - renameObject("${id().id}") - } - - override fun initProperties(): QVariantMap = mapOf( - "identityId" to QVariant.of(id(), QType.IdentityId), - "identityName" to QVariant.of(identityName(), Type.QString), - "realName" to QVariant.of(realName(), Type.QString), - "nicks" to QVariant.of(nicks(), Type.QStringList), - "awayNick" to QVariant.of(awayNick(), Type.QString), - "awayNickEnabled" to QVariant.of(awayNickEnabled(), Type.Bool), - "awayReason" to QVariant.of(awayReason(), Type.QString), - "awayReasonEnabled" to QVariant.of(awayReasonEnabled(), Type.Bool), - "autoAwayEnabled" to QVariant.of(autoAwayEnabled(), Type.Bool), - "autoAwayTime" to QVariant.of(autoAwayTime(), Type.Int), - "autoAwayReason" to QVariant.of(autoAwayReason(), Type.QString), - "autoAwayReasonEnabled" to QVariant.of(autoAwayReasonEnabled(), Type.Bool), - "detachAwayEnabled" to QVariant.of(detachAwayEnabled(), Type.Bool), - "detachAwayReason" to QVariant.of(detachAwayReason(), Type.QString), - "detachAwayReasonEnabled" to QVariant.of(detachAwayReasonEnabled(), Type.Bool), - "ident" to QVariant.of(ident(), Type.QString), - "kickReason" to QVariant.of(kickReason(), Type.QString), - "partReason" to QVariant.of(partReason(), Type.QString), - "quitReason" to QVariant.of(quitReason(), Type.QString) - ) - - override fun initSetProperties(properties: QVariantMap) { - setId(properties["identityId"].value(id())) - setIdentityName(properties["identityName"].value(identityName())) - setRealName(properties["realName"].valueOr(this::realName)) - setNicks(properties["nicks"].valueOr(this::nicks)) - setAwayNick(properties["awayNick"].valueOr(this::awayNick)) - setAwayNickEnabled(properties["awayNickEnabled"].valueOr(this::awayNickEnabled)) - setAwayReason(properties["awayReason"].valueOr(this::awayReason)) - setAwayReasonEnabled(properties["awayReasonEnabled"].valueOr(this::awayReasonEnabled)) - setAutoAwayEnabled(properties["autoAwayEnabled"].valueOr(this::autoAwayEnabled)) - setAutoAwayTime(properties["autoAwayTime"].valueOr(this::autoAwayTime)) - setAutoAwayReason(properties["autoAwayReason"].valueOr(this::autoAwayReason)) - setAutoAwayReasonEnabled( - properties["autoAwayReasonEnabled"].valueOr(this::autoAwayReasonEnabled) - ) - setDetachAwayEnabled(properties["detachAwayEnabled"].valueOr(this::detachAwayEnabled)) - setDetachAwayReason(properties["detachAwayReason"].valueOr(this::detachAwayReason)) - setDetachAwayReasonEnabled( - properties["detachAwayReasonEnabled"].valueOr(this::detachAwayReasonEnabled) - ) - setIdent(properties["ident"].valueOr(this::ident)) - setKickReason(properties["kickReason"].valueOr(this::kickReason)) - setPartReason(properties["partReason"].valueOr(this::partReason)) - setQuitReason(properties["quitReason"].valueOr(this::quitReason)) - } - - fun liveUpdates(): Observable<Identity> = _change.map { this } - - fun id() = _identityId - fun identityName() = _identityName - fun realName() = _realName - fun nicks() = _nicks - fun awayNick() = _awayNick - fun awayNickEnabled() = _awayNickEnabled - fun awayReason() = _awayReason - fun awayReasonEnabled() = _awayReasonEnabled - fun autoAwayEnabled() = _autoAwayEnabled - fun autoAwayTime() = _autoAwayTime - fun autoAwayReason() = _autoAwayReason - fun autoAwayReasonEnabled() = _autoAwayReasonEnabled - fun detachAwayEnabled() = _detachAwayEnabled - fun detachAwayReason() = _detachAwayReason - fun detachAwayReasonEnabled() = _detachAwayReasonEnabled - fun ident() = _ident - fun kickReason() = _kickReason - fun partReason() = _partReason - fun quitReason() = _quitReason - - fun copy(): Identity { - val identity = Identity(SignalProxy.NULL) - identity.fromVariantMap(this.toVariantMap()) - return identity - } - - override fun setAutoAwayEnabled(enabled: Boolean) { - _autoAwayEnabled = enabled - super.setAutoAwayEnabled(enabled) - } - - override fun setAutoAwayReason(reason: String?) { - _autoAwayReason = reason - super.setAutoAwayReason(reason) - } - - override fun setAutoAwayReasonEnabled(enabled: Boolean) { - _autoAwayReasonEnabled = enabled - super.setAutoAwayReasonEnabled(enabled) - } - - override fun setAutoAwayTime(time: Int) { - _autoAwayTime = time - super.setAutoAwayTime(time) - } - - override fun setAwayNick(awayNick: String?) { - _awayNick = awayNick - super.setAwayNick(awayNick) - } - - override fun setAwayNickEnabled(enabled: Boolean) { - _awayNickEnabled = enabled - super.setAwayNickEnabled(enabled) - } - - override fun setAwayReason(awayReason: String?) { - _awayReason = awayReason - super.setAwayReason(awayReason) - } - - override fun setAwayReasonEnabled(enabled: Boolean) { - _awayReasonEnabled = enabled - super.setAwayReasonEnabled(enabled) - } - - override fun setDetachAwayEnabled(enabled: Boolean) { - _detachAwayEnabled = enabled - super.setDetachAwayEnabled(enabled) - } - - override fun setDetachAwayReason(reason: String?) { - _detachAwayReason = reason - super.setDetachAwayReason(reason) - } - - override fun setDetachAwayReasonEnabled(enabled: Boolean) { - _detachAwayReasonEnabled = enabled - super.setDetachAwayReasonEnabled(enabled) - } - - override fun setId(id: IdentityId) { - _identityId = id - super.setId(id) - } - - override fun setIdent(ident: String?) { - _ident = ident - super.setIdent(ident) - } - - override fun setIdentityName(name: String?) { - _identityName = name - super.setIdentityName(name) - } - - override fun setKickReason(reason: String?) { - _kickReason = reason - super.setKickReason(reason) - } - - override fun setNicks(nicks: QStringList) { - _nicks = nicks.filterNotNull().toMutableList() - super.setNicks(nicks) - } - - override fun setPartReason(reason: String?) { - _partReason = reason - super.setPartReason(reason) - } - - override fun setQuitReason(reason: String?) { - _quitReason = reason - super.setQuitReason(reason) - } - - override fun setRealName(realName: String?) { - _realName = realName - super.setRealName(realName) - } - - private val _change = BehaviorSubject.createDefault(Unit) - - private var _identityId: IdentityId = IdentityId(-1) - set(value) { - field = value - _change.onNext(Unit) - } - private var _identityName: String? = "<empty>" - set(value) { - field = value - _change.onNext(Unit) - } - private var _realName: String? = "" - set(value) { - field = value - _change.onNext(Unit) - } - private var _nicks: MutableList<String> = mutableListOf("quassel") - set(value) { - field = value - _change.onNext(Unit) - } - private var _awayNick: String? = "" - set(value) { - field = value - _change.onNext(Unit) - } - private var _awayNickEnabled: Boolean = false - set(value) { - field = value - _change.onNext(Unit) - } - private var _awayReason: String? = "Gone fishing." - set(value) { - field = value - _change.onNext(Unit) - } - private var _awayReasonEnabled: Boolean = true - set(value) { - field = value - _change.onNext(Unit) - } - private var _autoAwayEnabled: Boolean = false - set(value) { - field = value - _change.onNext(Unit) - } - private var _autoAwayTime: Int = 10 - set(value) { - field = value - _change.onNext(Unit) - } - private var _autoAwayReason: String? = "Not here. No, really. not here!" - set(value) { - field = value - _change.onNext(Unit) - } - private var _autoAwayReasonEnabled: Boolean = false - set(value) { - field = value - _change.onNext(Unit) - } - private var _detachAwayEnabled: Boolean = false - set(value) { - field = value - _change.onNext(Unit) - } - private var _detachAwayReason: String? = "All Quassel clients vanished from the face of the earth..." - set(value) { - field = value - _change.onNext(Unit) - } - private var _detachAwayReasonEnabled: Boolean = false - set(value) { - field = value - _change.onNext(Unit) - } - private var _ident: String? = "quassel" - set(value) { - field = value - _change.onNext(Unit) - } - private var _kickReason: String? = "Kindergarten is elsewhere!" - set(value) { - field = value - _change.onNext(Unit) - } - private var _partReason: String? = "http://quassel-irc.org - Chat comfortably. Anywhere." - set(value) { - field = value - _change.onNext(Unit) - } - private var _quitReason: String? = "http://quassel-irc.org - Chat comfortably. Anywhere." - set(value) { - field = value - _change.onNext(Unit) - } - - fun isEqual(other: Identity): Boolean = - this.identityName() == other.identityName() && - this.realName() == other.realName() && - this.ident() == other.ident() && - this.kickReason() == other.kickReason() && - this.partReason() == other.partReason() && - this.quitReason() == other.quitReason() && - this.awayReason() == other.awayReason() && - this.detachAwayEnabled() == other.detachAwayEnabled() && - this.detachAwayReason() == other.detachAwayReason() && - this.nicks() == other.nicks() - - override fun toString(): String { - return "Identity(_identityId=$_identityId, _identityName=$_identityName, _realName=$_realName, _nicks=$_nicks, _awayNick=$_awayNick, _awayNickEnabled=$_awayNickEnabled, _awayReason=$_awayReason, _awayReasonEnabled=$_awayReasonEnabled, _autoAwayEnabled=$_autoAwayEnabled, _autoAwayTime=$_autoAwayTime, _autoAwayReason=$_autoAwayReason, _autoAwayReasonEnabled=$_autoAwayReasonEnabled, _detachAwayEnabled=$_detachAwayEnabled, _detachAwayReason=$_detachAwayReason, _detachAwayReasonEnabled=$_detachAwayReasonEnabled, _ident=$_ident, _kickReason=$_kickReason, _partReason=$_partReason, _quitReason=$_quitReason)" - } -} diff --git a/lib/src/main/java/de/kuschku/libquassel/quassel/syncables/IgnoreListManager.kt b/lib/src/main/java/de/kuschku/libquassel/quassel/syncables/IgnoreListManager.kt deleted file mode 100644 index 44ab6bfdb05b02ff5da84d14d355b7198a14144e..0000000000000000000000000000000000000000 --- a/lib/src/main/java/de/kuschku/libquassel/quassel/syncables/IgnoreListManager.kt +++ /dev/null @@ -1,303 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.libquassel.quassel.syncables - -import de.kuschku.libquassel.protocol.* -import de.kuschku.libquassel.quassel.syncables.interfaces.IIgnoreListManager -import de.kuschku.libquassel.session.ISession -import de.kuschku.libquassel.util.ExpressionMatch -import de.kuschku.libquassel.util.flag.and -import io.reactivex.subjects.BehaviorSubject -import java.io.Serializable - -class IgnoreListManager constructor( - var session: ISession -) : SyncableObject(session.proxy, "IgnoreListManager"), IIgnoreListManager { - override fun deinit() { - super.deinit() - session = ISession.NULL - } - - override fun toVariantMap(): QVariantMap = mapOf( - "IgnoreList" to QVariant.of(initIgnoreList(), Type.QVariantMap) - ) - - override fun fromVariantMap(properties: QVariantMap) { - initSetIgnoreList(properties["IgnoreList"].valueOr(::emptyMap)) - } - - override fun initIgnoreList() = mapOf( - "ignoreType" to QVariant.of(_ignoreList.map { - QVariant.of(it.type.value, Type.Int) - }, Type.QVariantList), - "ignoreRule" to QVariant.of(_ignoreList.map { - it.ignoreRule - }, Type.QStringList), - "isRegEx" to QVariant.of(_ignoreList.map { - QVariant.of(it.isRegEx, Type.Bool) - }, Type.QVariantList), - "strictness" to QVariant.of(_ignoreList.map { - QVariant.of(it.strictness.value, Type.Int) - }, Type.QVariantList), - "scope" to QVariant.of(_ignoreList.map { - QVariant.of(it.scope.value, Type.Int) - }, Type.QVariantList), - "scopeRule" to QVariant.of(_ignoreList.map { - it.scopeRule - }, Type.QStringList), - "isActive" to QVariant.of(_ignoreList.map { - QVariant.of(it.isActive, Type.Bool) - }, Type.QVariantList) - ) - - override fun initSetIgnoreList(ignoreList: QVariantMap) { - val ignoreTypeList = ignoreList["ignoreType"].valueOr<QVariantList>(::emptyList) - val ignoreRuleList = ignoreList["ignoreRule"].valueOr<QStringList>(::emptyList) - val isRegExList = ignoreList["isRegEx"].valueOr<QVariantList>(::emptyList) - val strictnessList = ignoreList["strictness"].valueOr<QVariantList>(::emptyList) - val scopeList = ignoreList["scope"].valueOr<QVariantList>(::emptyList) - val scopeRuleList = ignoreList["scopeRule"].valueOr<QStringList>(::emptyList) - val isActiveList = ignoreList["isActive"].valueOr<QVariantList>(::emptyList) - val size = ignoreTypeList.size - if (ignoreRuleList.size != size || isRegExList.size != size || strictnessList.size != size || - scopeList.size != size || scopeRuleList.size != size || isActiveList.size != size) - return - - _ignoreList = List(size) { - IgnoreListItem( - type = ignoreTypeList[it].value(0), - ignoreRule = ignoreRuleList[it] ?: "", - isRegEx = isRegExList[it].value(false), - strictness = strictnessList[it].value(0), - scope = scopeList[it].value(0), - scopeRule = scopeRuleList[it] ?: "", - isActive = isActiveList[it].value(false) - ) - } - } - - override fun addIgnoreListItem(type: Int, ignoreRule: String?, isRegEx: Boolean, strictness: Int, - scope: Int, scopeRule: String?, isActive: Boolean) { - if (contains(ignoreRule)) return - - _ignoreList += IgnoreListItem(type, ignoreRule, isRegEx, strictness, scope, scopeRule, isActive) - } - - override fun removeIgnoreListItem(ignoreRule: String?) = removeAt(indexOf(ignoreRule)) - - override fun toggleIgnoreRule(ignoreRule: String?) { - _ignoreList = _ignoreList.map { - if (it.ignoreRule == ignoreRule) it.copy(isActive = !it.isActive) else it - } - } - - fun indexOf(ignore: String?): Int = _ignoreList.indexOfFirst { it.ignoreRule == ignore } - fun contains(ignore: String?) = _ignoreList.any { it.ignoreRule == ignore } - fun isEmpty() = _ignoreList.isEmpty() - fun count() = _ignoreList.count() - fun removeAt(index: Int) { - _ignoreList = _ignoreList.drop(index) - } - - operator fun get(index: Int) = _ignoreList[index] - fun ignoreList() = _ignoreList - fun setIgnoreList(list: List<IgnoreListItem>) { - _ignoreList = list - } - - fun matchingRules(sender: String) = _ignoreList.filter { - it.type == IgnoreType.SenderIgnore && - it.regEx.match(sender) - } - - fun liveMatchingRules(sender: String) = live_updates.map { - matchingRules(sender) - } - - fun updates() = live_updates.map { this } - - fun copy() = IgnoreListManager(session).also { - it.fromVariantMap(toVariantMap()) - } - - enum class IgnoreType(val value: Int) { - SenderIgnore(0), - MessageIgnore(1), - CtcpIgnore(2); - - companion object { - private val byId = enumValues<IgnoreType>().associateBy(IgnoreType::value) - fun of(value: Int) = byId[value] ?: IgnoreType.SenderIgnore - } - } - - enum class StrictnessType(val value: Int) { - UnmatchedStrictness(0), - SoftStrictness(1), - HardStrictness(2); - - companion object { - private val byId = enumValues<StrictnessType>().associateBy(StrictnessType::value) - fun of(value: Int) = byId[value] ?: StrictnessType.UnmatchedStrictness - } - } - - enum class ScopeType(val value: Int) { - GlobalScope(0), - NetworkScope(1), - ChannelScope(2); - - companion object { - private val byId = enumValues<ScopeType>().associateBy(ScopeType::value) - fun of(value: Int) = byId[value] ?: ScopeType.GlobalScope - } - } - - class IgnoreListItem private constructor( - val type: IgnoreType, - val ignoreRule: String, - val isRegEx: Boolean, - val strictness: StrictnessType, - val scope: ScopeType, - val scopeRule: String, - val isActive: Boolean, - val regEx: ExpressionMatch, - val scopeRegEx: ExpressionMatch - ) : Serializable { - constructor(type: Int, ignoreRule: String?, isRegEx: Boolean, strictness: Int, scope: Int, - scopeRule: String?, isActive: Boolean) : this( - IgnoreType.of(type), ignoreRule, isRegEx, StrictnessType.of(strictness), ScopeType.of(scope), - scopeRule, isActive - ) - - constructor(type: IgnoreType, ignoreRule: String?, isRegEx: Boolean, strictness: StrictnessType, - scope: ScopeType, scopeRule: String?, isActive: Boolean) : this( - type, ignoreRule ?: "", isRegEx, strictness, scope, scopeRule ?: "", isActive, - ExpressionMatch( - ignoreRule ?: "", - if (isRegEx) ExpressionMatch.MatchMode.MatchRegEx - else ExpressionMatch.MatchMode.MatchWildcard, - caseSensitive = false - ), - ExpressionMatch( - scopeRule ?: "", - ExpressionMatch.MatchMode.MatchMultiWildcard, - caseSensitive = false - ) - ) - - fun copy( - type: IgnoreType = this.type, - ignoreRule: String = this.ignoreRule, - isRegEx: Boolean = this.isRegEx, - strictness: StrictnessType = this.strictness, - scope: ScopeType = this.scope, - scopeRule: String = this.scopeRule, - isActive: Boolean = this.isActive - ) = IgnoreListItem( - type = type, - ignoreRule = ignoreRule, - isRegEx = isRegEx, - strictness = strictness, - scope = scope, - scopeRule = scopeRule, - isActive = isActive, - regEx = ExpressionMatch( - ignoreRule, - if (isRegEx) ExpressionMatch.MatchMode.MatchRegEx - else ExpressionMatch.MatchMode.MatchWildcard, - caseSensitive = false - ), - scopeRegEx = ExpressionMatch( - scopeRule, - ExpressionMatch.MatchMode.MatchMultiWildcard, - caseSensitive = false - ) - ) - - override fun equals(other: Any?): Boolean { - if (this === other) return true - if (javaClass != other?.javaClass) return false - - other as IgnoreListItem - - if (type != other.type) return false - if (ignoreRule != other.ignoreRule) return false - if (isRegEx != other.isRegEx) return false - if (strictness != other.strictness) return false - if (scope != other.scope) return false - if (scopeRule != other.scopeRule) return false - if (isActive != other.isActive) return false - - return true - } - - override fun hashCode(): Int { - var result = type.hashCode() - result = 31 * result + ignoreRule.hashCode() - result = 31 * result + isRegEx.hashCode() - result = 31 * result + strictness.hashCode() - result = 31 * result + scope.hashCode() - result = 31 * result + scopeRule.hashCode() - result = 31 * result + isActive.hashCode() - return result - } - - override fun toString(): String { - return "IgnoreListItem(type=$type, ignoreRule='$ignoreRule', isRegEx=$isRegEx, strictness=$strictness, scope=$scope, scopeRule='$scopeRule', isActive=$isActive)" - } - } - - fun match(msgContents: String, msgSender: String, msgType: Message_Types, network: String, - bufferName: String): StrictnessType { - if ((Message_Type.of(Message_Type.Plain, Message_Type.Notice, Message_Type.Action) and msgType) - .isEmpty()) return StrictnessType.UnmatchedStrictness - - return _ignoreList.filter { - it.isActive && it.type != IgnoreType.CtcpIgnore - }.filter { - it.scope == ScopeType.GlobalScope || - it.scope == ScopeType.NetworkScope && it.scopeRegEx.match(network) || - it.scope == ScopeType.ChannelScope && it.scopeRegEx.match(bufferName) - }.filter { - val content = if (it.type == IgnoreType.MessageIgnore) msgContents else msgSender - it.regEx.match(content) - }.map { - it.strictness - }.sortedByDescending { - it.value - }.firstOrNull() ?: StrictnessType.UnmatchedStrictness - } - - private val live_updates = BehaviorSubject.createDefault(Unit) - private var _ignoreList = emptyList<IgnoreListItem>() - set(value) { - field = value - live_updates.onNext(Unit) - if (initialized) session.backlogManager.updateIgnoreRules() - } - - fun isEqual(other: IgnoreListManager): Boolean = - this.ignoreList() == other.ignoreList() - - override fun toString(): String { - return "IgnoreListManager(_ignoreList=$_ignoreList)" - } -} diff --git a/lib/src/main/java/de/kuschku/libquassel/quassel/syncables/IrcChannel.kt b/lib/src/main/java/de/kuschku/libquassel/quassel/syncables/IrcChannel.kt deleted file mode 100644 index a668e57d94eda4ff4abaa0dc16efc13d54d13dc2..0000000000000000000000000000000000000000 --- a/lib/src/main/java/de/kuschku/libquassel/quassel/syncables/IrcChannel.kt +++ /dev/null @@ -1,443 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ -@file:Suppress("NOTHING_TO_INLINE") - -package de.kuschku.libquassel.quassel.syncables - -import de.kuschku.libquassel.protocol.* -import de.kuschku.libquassel.protocol.Type -import de.kuschku.libquassel.quassel.syncables.interfaces.IIrcChannel -import de.kuschku.libquassel.quassel.syncables.interfaces.INetwork -import de.kuschku.libquassel.session.SignalProxy -import de.kuschku.libquassel.util.compatibility.LoggingHandler.Companion.log -import de.kuschku.libquassel.util.compatibility.LoggingHandler.LogLevel.ERROR -import de.kuschku.libquassel.util.helper.getOr -import io.reactivex.Observable -import io.reactivex.subjects.BehaviorSubject -import java.nio.charset.Charset - -class IrcChannel( - name: String, - network: Network, - proxy: SignalProxy -) : SyncableObject(proxy, "IrcChannel"), IIrcChannel { - override fun init() { - if (name().isEmpty()) { - log(ERROR, "IrcChannel", "Error: channelName is empty") - } - renameObject("${network().networkId().id}/${name()}") - } - - override fun toVariantMap(): QVariantMap = mapOf( - "ChanModes" to QVariant.of(initChanModes(), Type.QVariantMap), - "UserModes" to QVariant.of(initUserModes(), Type.QVariantMap) - ) + initProperties() - - private inline fun QVariant_?.indexed(index: Int?) = this?.let { - index?.let { i -> - it.valueOr<QVariantList>(::emptyList)[i] - } ?: it - } - - fun fromVariantMap(properties: QVariantMap, i: Int? = null) { - initSetChanModes(properties["ChanModes"].indexed(i).valueOr(::emptyMap)) - initSetUserModes(properties["UserModes"].indexed(i).valueOr(::emptyMap)) - initSetProperties(properties, i) - } - - override fun fromVariantMap(properties: QVariantMap) { - initSetChanModes(properties["ChanModes"].valueOr(::emptyMap)) - initSetUserModes(properties["UserModes"].valueOr(::emptyMap)) - initSetProperties(properties) - } - - override fun initChanModes(): QVariantMap = mapOf( - "A" to QVariant.of(_A_channelModes.map { (key, value) -> - key.toString() to QVariant.of(value.toList(), Type.QStringList) - }.toMap(), Type.QVariantMap), - "B" to QVariant.of(_B_channelModes.map { (key, value) -> - key.toString() to QVariant.of(value, Type.QString) - }.toMap(), Type.QVariantMap), - "C" to QVariant.of(_C_channelModes.map { (key, value) -> - key.toString() to QVariant.of(value, Type.QString) - }.toMap(), Type.QVariantMap), - "D" to QVariant.of(_D_channelModes.joinToString(), Type.QString) - ) - - override fun initUserModes(): QVariantMap = synchronized(_userModes) { - _userModes.entries.map { (key, value) -> - key.nick() to QVariant.of(value, Type.QString) - }.toMap() - } - - override fun initProperties(): QVariantMap = mapOf( - "name" to QVariant.of(name(), Type.QString), - "topic" to QVariant.of(topic(), Type.QString), - "password" to QVariant.of(password(), Type.QString), - "encrypted" to QVariant.of(encrypted(), Type.Bool) - ) - - override fun initSetChanModes(chanModes: QVariantMap) { - chanModes["A"].valueOr<QVariantMap>(::emptyMap).forEach { (key, variant) -> - _A_channelModes[key.toCharArray().first()] = - variant.valueOr<QStringList>(::emptyList).filterNotNull().toMutableSet() - } - chanModes["B"].valueOr<QVariantMap>(::emptyMap).forEach { (key, variant) -> - _B_channelModes[key.toCharArray().first()] = variant.value("") - } - chanModes["C"].valueOr<QVariantMap>(::emptyMap).forEach { (key, variant) -> - _C_channelModes[key.toCharArray().first()] = variant.value("") - } - _D_channelModes = chanModes["D"].value("").toCharArray().toMutableSet() - } - - override fun initSetUserModes(usermodes: QVariantMap) { - val users = usermodes.map { (key, _) -> - network().newIrcUser(key) - } - val modes = usermodes.map { (_, value) -> - value.value("") - } - joinIrcUsersInternal(users, modes) - } - - override fun initSetProperties(properties: QVariantMap, i: Int?) { - setTopic(properties["topic"].indexed(i).valueOr(this::topic)) - setPassword(properties["password"].indexed(i).valueOr(this::password)) - setEncrypted(properties["encrypted"].indexed(i).valueOr(this::encrypted)) - } - - fun isKnownUser(ircUser: IrcUser) = synchronized(_userModes) { - _userModes.contains(ircUser) - } - - fun isValidChannelUserMode(mode: String): Boolean { - return mode.length <= 1 - } - - fun name() = _name - fun topic() = _topic - fun password() = _password - fun encrypted() = _encrypted - fun network() = _network - fun ircUsers() = synchronized(_userModes) { - _userModes.keys.toSet() - } - - fun liveIrcUsers(): Observable<Set<IrcUser>> = - live_userModes.map { ircUsers() } - - fun userModes(ircUser: IrcUser) = synchronized(_userModes) { - _userModes.getOr(ircUser, "") - } - - fun liveUserModes(ircUser: IrcUser) = live_userModes.map { - synchronized(_userModes) { - _userModes.getOr(ircUser, "") - } - } - - fun userCount() = _userCount - - fun userModes(): Map<IrcUser, String> = _userModes - fun userModes(nick: String) = network().ircUser(nick)?.let { userModes(it) } ?: "" - fun liveUserModes(nick: String) = network().ircUser(nick)?.let { userModes(it) } ?: "" - - fun updates(): Observable<IrcChannel> = live_updates.map { this } - - fun hasMode(mode: Char) = when (network().channelModeType(mode)) { - INetwork.ChannelModeType.A_CHANMODE -> - _A_channelModes.contains(mode) - INetwork.ChannelModeType.B_CHANMODE -> - _B_channelModes.contains(mode) - INetwork.ChannelModeType.C_CHANMODE -> - _C_channelModes.contains(mode) - INetwork.ChannelModeType.D_CHANMODE -> - _D_channelModes.contains(mode) - else -> - false - } - - fun modeValue(mode: Char) = when (network().channelModeType(mode)) { - INetwork.ChannelModeType.B_CHANMODE -> - _B_channelModes.getOr(mode, "") - INetwork.ChannelModeType.C_CHANMODE -> - _C_channelModes.getOr(mode, "") - else -> - "" - } - - fun modeValueList(mode: Char): Set<String> = when (network().channelModeType(mode)) { - INetwork.ChannelModeType.A_CHANMODE -> - _A_channelModes.getOrElse(mode, ::emptySet) - else -> - emptySet() - } - - fun channelModeString(): String { - val modeString = StringBuffer(_D_channelModes.joinToString()) - val params = mutableListOf<String>() - _C_channelModes.entries.forEach { (key, value) -> - modeString.append(key) - params.add(value) - } - _B_channelModes.entries.forEach { (key, value) -> - modeString.append(key) - params.add(value) - } - return if (modeString.isBlank()) { - "" - } else { - "+$modeString ${params.joinToString(" ")}" - } - } - - fun codecForEncoding() = _codecForEncoding - fun codecForDecoding() = _codecForDecoding - fun setCodecForEncoding(codecName: String) { - val charset = Charset.availableCharsets()[codecName] - if (charset != null) { - setCodecForEncoding(charset) - } - } - - fun setCodecForEncoding(codec: Charset) { - _codecForEncoding = codec - } - - fun setCodecForDecoding(codecName: String) { - val charset = Charset.availableCharsets()[codecName] - if (charset != null) { - setCodecForDecoding(charset) - } - } - - fun setCodecForDecoding(codec: Charset) { - _codecForDecoding = codec - } - - override fun setTopic(topic: String?) { - if (_topic == topic ?: "") - return - _topic = topic ?: "" - } - - override fun setPassword(password: String?) { - if (_password == password ?: "") - return - _password = password ?: "" - } - - override fun setEncrypted(encrypted: Boolean) { - if (_encrypted == encrypted) - return - _encrypted = encrypted - } - - override fun joinIrcUsers(nicks: QStringList, modes: QStringList) { - val (rawUsers, rawModes) = nicks.zip(modes) - .map { network().ircUser(it.first) to it.second } - .filter { it.first != null } - .map { Pair(it.first!!, it.second ?: "") }.unzip() - joinIrcUsersInternal(rawUsers, rawModes) - } - - private fun joinIrcUsersInternal(rawUsers: List<IrcUser>, rawModes: List<String>) { - synchronized(_userModes) { - val users = rawUsers.zip(rawModes) - val newNicks = users.filter { !_userModes.contains(it.first) } - val oldNicks = users.filter { _userModes.contains(it.first) } - for ((user, modes) in oldNicks) { - modes.forEach { mode -> - addUserMode(user, mode) - } - } - for ((user, modes) in newNicks) { - _userModes[user] = modes - user.joinChannel(this, true) - } - updateUsers() - } - } - - override fun joinIrcUser(ircuser: IrcUser) { - joinIrcUsersInternal(listOf(ircuser), listOf("")) - } - - override fun part(ircuser: IrcUser?) { - synchronized(_userModes) { - if (ircuser == null) - return - if (!isKnownUser(ircuser)) - return - _userModes.remove(ircuser) - ircuser.partChannel(this) - if (network().isMe(ircuser) || _userModes.isEmpty()) { - for (user in _userModes.keys.toList()) { - user.partChannel(this) - } - _userModes.clear() - network().removeIrcChannel(this) - proxy.stopSynchronize(this) - } - updateUsers() - } - } - - override fun part(nick: String?) { - part(network().ircUser(nick)) - } - - override fun setUserModes(ircuser: IrcUser?, modes: String?) { - synchronized(_userModes) { - if (ircuser == null || !isKnownUser(ircuser)) - return - _userModes[ircuser] = modes ?: "" - updateUsers() - } - } - - override fun setUserModes(nick: String?, modes: String?) { - setUserModes(network().ircUser(nick), modes ?: "") - } - - fun addUserMode(ircuser: IrcUser, mode: Char) { - addUserMode(ircuser, String(charArrayOf(mode))) - } - - override fun addUserMode(ircuser: IrcUser?, mode: String?) { - synchronized(_userModes) { - val userMode = mode ?: "" - if (ircuser == null || !isKnownUser(ircuser) || !isValidChannelUserMode(userMode)) - return - if (_userModes.getOr(ircuser, "").contains(userMode, ignoreCase = true)) - return - _userModes[ircuser] = _userModes.getOr(ircuser, "") + userMode - updateUsers() - } - } - - override fun addUserMode(nick: String?, mode: String?) { - addUserMode(network().ircUser(nick), mode ?: "") - } - - override fun removeUserMode(ircuser: IrcUser?, mode: String?) { - synchronized(_userModes) { - val userMode = mode ?: "" - if (ircuser == null || !isKnownUser(ircuser) || !isValidChannelUserMode(userMode)) - return - if (!_userModes.getOr(ircuser, "").contains(userMode, ignoreCase = true)) - return - _userModes[ircuser] = _userModes.getOr(ircuser, "") - .replace(userMode, "", ignoreCase = true) - updateUsers() - } - } - - override fun removeUserMode(nick: String?, mode: String?) { - removeUserMode(network().ircUser(nick), mode ?: "") - } - - override fun addChannelMode(mode: Char, value: String?) { - when (network().channelModeType(mode)) { - INetwork.ChannelModeType.A_CHANMODE -> - _A_channelModes.getOrPut(mode, ::mutableSetOf).add(value!!) - INetwork.ChannelModeType.B_CHANMODE -> - _B_channelModes[mode] = value!! - INetwork.ChannelModeType.C_CHANMODE -> - _C_channelModes[mode] = value!! - INetwork.ChannelModeType.D_CHANMODE -> - _D_channelModes.add(mode) - INetwork.ChannelModeType.NOT_A_CHANMODE -> - throw IllegalArgumentException("Received invalid channel mode: $mode $value") - } - } - - override fun removeChannelMode(mode: Char, value: String?) { - when (network().channelModeType(mode)) { - INetwork.ChannelModeType.A_CHANMODE -> - _A_channelModes.getOrPut(mode, ::mutableSetOf).remove(value) - INetwork.ChannelModeType.B_CHANMODE -> - _B_channelModes.remove(mode) - INetwork.ChannelModeType.C_CHANMODE -> - _C_channelModes.remove(mode) - INetwork.ChannelModeType.D_CHANMODE -> - _D_channelModes.remove(mode) - INetwork.ChannelModeType.NOT_A_CHANMODE -> - throw IllegalArgumentException("Received invalid channel mode: $mode $value") - } - } - - override fun update(properties: QVariantMap) { - fromVariantMap(properties) - } - - private val live_updates = BehaviorSubject.createDefault(Unit) - private var _name: String = name - set(value) { - field = value - live_updates.onNext(Unit) - } - - private var _userCount: Int = 0 - set(value) { - field = value - live_updates.onNext(Unit) - } - - private var _topic: String = "" - set(value) { - field = value - live_updates.onNext(Unit) - } - - private var _password: String = "" - set(value) { - field = value - live_updates.onNext(Unit) - } - - private var _encrypted: Boolean = false - set(value) { - field = value - live_updates.onNext(Unit) - } - - private fun updateUsers() = synchronized(_userModes) { - _userCount = _userModes.size - live_userModes.onNext(Unit) - } - - private val live_userModes = BehaviorSubject.createDefault(Unit) - private val _userModes = mutableMapOf<IrcUser, String>() - - private var _network: Network = network - - private var _codecForEncoding: Charset? = null - private var _codecForDecoding: Charset? = null - - var _A_channelModes: MutableMap<Char, MutableSet<String>> = mutableMapOf() - var _B_channelModes: MutableMap<Char, String> = mutableMapOf() - var _C_channelModes: MutableMap<Char, String> = mutableMapOf() - var _D_channelModes: MutableSet<Char> = mutableSetOf() - - companion object { - val NULL = IrcChannel("", Network.NULL, SignalProxy.NULL) - } -} diff --git a/lib/src/main/java/de/kuschku/libquassel/quassel/syncables/IrcListHelper.kt b/lib/src/main/java/de/kuschku/libquassel/quassel/syncables/IrcListHelper.kt deleted file mode 100644 index c9f0789d19ff5d5c28d54a122fa30cec73e2c45c..0000000000000000000000000000000000000000 --- a/lib/src/main/java/de/kuschku/libquassel/quassel/syncables/IrcListHelper.kt +++ /dev/null @@ -1,87 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.libquassel.quassel.syncables - -import de.kuschku.libquassel.protocol.NetworkId -import de.kuschku.libquassel.protocol.QStringList -import de.kuschku.libquassel.protocol.QVariantList -import de.kuschku.libquassel.protocol.value -import de.kuschku.libquassel.quassel.syncables.interfaces.IIrcListHelper -import de.kuschku.libquassel.session.SignalProxy -import de.kuschku.libquassel.util.rxjava.ReusableUnicastSubject - -class IrcListHelper constructor( - proxy: SignalProxy -) : SyncableObject(proxy, "IrcListHelper"), IIrcListHelper { - private var waitingNetwork: NetworkId = NetworkId(0) - - data class ChannelDescription( - val netId: NetworkId, - val channelName: String, - val userCount: UInt, - val topic: String - ) - - sealed class Event { - data class ChannelList(val netId: NetworkId, val channelFilters: QStringList, - val data: List<ChannelDescription>) : Event() - - data class Finished(val netId: NetworkId) : Event() - - data class Error(val error: String?) : Event() - } - - private val subject = ReusableUnicastSubject.create<Event>() - val observable = subject.publish().refCount() - - override fun requestChannelList(netId: NetworkId, channelFilters: QStringList): QVariantList { - waitingNetwork = netId - return super.requestChannelList(netId, channelFilters) - } - - override fun receiveChannelList(netId: NetworkId, channelFilters: QStringList, - channels: QVariantList) { - subject.onNext(Event.ChannelList(netId, channelFilters, channels.mapNotNull { - val list = it.value<QVariantList>(emptyList()) - if (list.size == 3) { - ChannelDescription( - netId, - list[0].value(""), - list[1].value(0u), - list[2].value("") - ) - } else { - null - } - })) - } - - override fun reportFinishedList(netId: NetworkId) { - if (waitingNetwork == netId) { - waitingNetwork = NetworkId(0) - requestChannelList(netId, emptyList()) - subject.onNext(Event.Finished(netId)) - } - } - - override fun reportError(error: String?) { - subject.onNext(Event.Error(error)) - } -} diff --git a/lib/src/main/java/de/kuschku/libquassel/quassel/syncables/IrcUser.kt b/lib/src/main/java/de/kuschku/libquassel/quassel/syncables/IrcUser.kt deleted file mode 100644 index 1880d5df9db19859cfc01a542cdee370922419b2..0000000000000000000000000000000000000000 --- a/lib/src/main/java/de/kuschku/libquassel/quassel/syncables/IrcUser.kt +++ /dev/null @@ -1,386 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ -@file:Suppress("NOTHING_TO_INLINE") - -package de.kuschku.libquassel.quassel.syncables - -import de.kuschku.libquassel.protocol.* -import de.kuschku.libquassel.quassel.ExtendedFeature -import de.kuschku.libquassel.quassel.syncables.interfaces.IIrcUser -import de.kuschku.libquassel.session.SignalProxy -import de.kuschku.libquassel.util.irc.HostmaskHelper -import io.reactivex.Observable -import io.reactivex.subjects.BehaviorSubject -import org.threeten.bp.Instant -import org.threeten.bp.temporal.Temporal -import java.nio.charset.Charset - -class IrcUser( - hostmask: String, - network: Network, - proxy: SignalProxy -) : SyncableObject(proxy, "IrcUser"), IIrcUser { - override fun init() { - updateObjectName() - } - - override fun toVariantMap() = initProperties() - fun fromVariantMap(properties: QVariantMap, index: Int? = null) { - initSetProperties(properties, index) - } - - override fun fromVariantMap(properties: QVariantMap) { - initSetProperties(properties) - } - - override fun initProperties(): QVariantMap = mapOf( - "user" to QVariant.of(user(), Type.QString), - "host" to QVariant.of(host(), Type.QString), - "nick" to QVariant.of(nick(), Type.QString), - "realName" to QVariant.of(realName(), Type.QString), - "account" to QVariant.of(account(), Type.QString), - "away" to QVariant.of(isAway(), Type.Bool), - "awayMessage" to QVariant.of(awayMessage(), Type.QString), - "idleTime" to QVariant.of(idleTime(), Type.QDateTime), - "loginTime" to QVariant.of(loginTime(), Type.QDateTime), - "server" to QVariant.of(server(), Type.QString), - "ircOperator" to QVariant.of(ircOperator(), Type.QString), - "lastAwayMessage" to QVariant.of(lastAwayMessage(), Type.Int), - "lastAwayMessageTime" to QVariant.of(lastAwayMessageTime(), Type.QDateTime), - "whoisServiceReply" to QVariant.of(whoisServiceReply(), Type.QString), - "suserHost" to QVariant.of(suserHost(), Type.QString), - "encrypted" to QVariant.of(encrypted(), Type.Bool), - - "channels" to QVariant.of(channels(), Type.QStringList), - "userModes" to QVariant.of(userModes(), Type.QString) - ) - - private inline fun QVariant_?.indexed(index: Int?) = this?.let { - index?.let { i -> - it.valueOr<QVariantList>(::emptyList)[i] - } ?: it - } - - override fun initSetProperties(properties: QVariantMap, index: Int?) { - setUser(properties["user"].indexed(index).valueOr(this::user)) - setHost(properties["host"].indexed(index).valueOr(this::host)) - setNick(properties["nick"].indexed(index).valueOr(this::nick)) - setRealName(properties["realName"].indexed(index).valueOr(this::realName)) - setAccount(properties["account"].indexed(index).valueOr(this::account)) - setAway(properties["away"].indexed(index).valueOr(this::isAway)) - setAwayMessage(properties["awayMessage"].indexed(index).valueOr(this::awayMessage)) - setIdleTime(properties["idleTime"].indexed(index).valueOr(this::idleTime)) - setLoginTime(properties["loginTime"].indexed(index).valueOr(this::loginTime)) - setServer(properties["server"].indexed(index).valueOr(this::server)) - setIrcOperator(properties["ircOperator"].indexed(index).valueOr(this::ircOperator)) - setLastAwayMessageTime(properties["lastAwayMessageTime"].indexed(index).valueOr { - Instant.ofEpochSecond(properties["lastAwayMessage"].indexed(index).valueOr(this::lastAwayMessage).toLong()) - }) - setWhoisServiceReply(properties["whoisServiceReply"].indexed(index).valueOr(this::whoisServiceReply)) - setSuserHost(properties["suserHost"].indexed(index).valueOr(this::suserHost)) - setEncrypted(properties["encrypted"].indexed(index).valueOr(this::encrypted)) - setUserModes(properties["userModes"].indexed(index).valueOr(this::userModes)) - } - - fun updates(): Observable<IrcUser> = hasChangedNotification.map { this } - - fun nick() = _nick - fun user() = _user - fun host() = _host - fun realName() = _realName - fun account() = _account - fun hostMask() = "${nick()}!${user()}@${host()}" - fun isAway() = _away - fun awayMessage() = _awayMessage - fun server() = _server - fun idleTime(): Instant { - if (Instant.now().epochSecond - _idleTimeSet.epochSecond > 1200) - _idleTime = Instant.EPOCH - return _idleTime - } - - fun loginTime() = _loginTime - fun ircOperator() = _ircOperator - fun lastAwayMessage() = _lastAwayMessageTime.epochSecond.toInt() - fun lastAwayMessageTime() = _lastAwayMessageTime - fun whoisServiceReply() = _whoisServiceReply - fun suserHost() = _suserHost - fun encrypted() = _encrypted - fun network() = _network - fun userModes() = _userModes - fun channels() = _channels.map(IrcChannel::name) - - override fun addUserModes(modes: String?) { - (_userModes.toSet() + modes?.toSet().orEmpty()).joinToString() - } - - override fun removeUserModes(modes: String?) { - (_userModes.toSet() - modes?.toSet().orEmpty()).joinToString() - } - - override fun setUser(user: String?) { - if (_user != user ?: "") { - _user = user ?: "" - } - } - - override fun setHost(host: String?) { - if (_host != host ?: "") { - _host = host ?: "" - } - } - - override fun setNick(nick: String?) { - if (!nick.isNullOrEmpty() && _nick != nick) { - network().ircUserNickChanged(_nick, nick) - _nick = nick - updateObjectName() - } - } - - override fun setRealName(realName: String?) { - if (_realName != realName ?: "") { - _realName = realName ?: "" - } - } - - override fun setAccount(account: String?) { - if (_account != account ?: "") { - _account = account ?: "" - } - } - - override fun setAway(away: Boolean) { - if (_away != away) { - _away = away - } - } - - override fun setAwayMessage(awayMessage: String?) { - if (_awayMessage != awayMessage ?: "") { - _awayMessage = awayMessage ?: "" - } - } - - override fun setIdleTime(idleTime: Temporal) { - if (_idleTime != idleTime) { - _idleTime = Instant.from(idleTime) - _idleTimeSet = Instant.now() - } - } - - override fun setLoginTime(loginTime: Temporal) { - if (_loginTime != loginTime) { - _loginTime = Instant.from(loginTime) - } - } - - override fun setIrcOperator(ircOperator: String?) { - if (_ircOperator != ircOperator ?: "") { - _ircOperator = ircOperator ?: "" - } - } - - override fun setLastAwayMessage(lastAwayMessage: Int) { - if (lastAwayMessage > lastAwayMessage() && - !(proxy.features.negotiated hasFeature ExtendedFeature.LongTime)) { - _lastAwayMessageTime = Instant.ofEpochSecond(lastAwayMessage.toLong()) - } - } - - override fun setLastAwayMessageTime(lastAwayMessageTime: Temporal) { - _lastAwayMessageTime = Instant.from(lastAwayMessageTime) - } - - override fun setWhoisServiceReply(whoisServiceReply: String?) { - if (_whoisServiceReply != whoisServiceReply ?: "") { - _whoisServiceReply = whoisServiceReply ?: "" - } - } - - override fun setSuserHost(suserHost: String?) { - if (_suserHost != suserHost ?: "") { - _suserHost = suserHost ?: "" - } - } - - override fun setEncrypted(encrypted: Boolean) { - if (_encrypted != encrypted) { - _encrypted = encrypted - } - } - - override fun setServer(server: String?) { - if (_server != server ?: "") { - _server = server ?: "" - } - } - - override fun updateHostmask(mask: String?) { - if (hostMask() != mask ?: "") { - val (user, host, _) = HostmaskHelper.split(mask ?: "") - setUser(user) - setHost(host) - } - } - - override fun setUserModes(modes: String?) { - if (_userModes != modes ?: "") { - _userModes = modes ?: "" - } - } - - override fun joinChannel(channel: IrcChannel, skip_channel_join: Boolean) { - if (!_channels.contains(channel)) { - _channels.add(channel) - if (!skip_channel_join) - channel.joinIrcUser(this) - } - } - - override fun joinChannel(channelname: String?) { - joinChannel(network().newIrcChannel(channelname ?: "")) - } - - override fun partChannel(channel: IrcChannel) { - if (_channels.contains(channel)) { - _channels.remove(channel) - channel.part(this) - if (_channels.isEmpty() && !network().isMe(this)) - quit() - } - } - - override fun partChannel(channelname: String?) { - val channel = network().ircChannel(channelname) ?: throw IllegalArgumentException( - "Received part for unknown channel : $channelname" - ) - partChannel(channel) - } - - override fun quit() { - for (channel in _channels.toList()) { - channel.part(this) - } - _channels.clear() - network().removeIrcUser(this) - proxy.stopSynchronize(this) - } - - fun updateObjectName() { - val identifier = "${network().networkId().id}/${nick()}" - renameObject(identifier) - } - - private val hasChangedNotification = BehaviorSubject.createDefault(Unit) - - private var _nick: String = HostmaskHelper.nick(hostmask) - set(value) { - field = value - hasChangedNotification.onNext(Unit) - } - private var _user: String = HostmaskHelper.user(hostmask) - set(value) { - field = value - hasChangedNotification.onNext(Unit) - } - private var _host: String = HostmaskHelper.host(hostmask) - set(value) { - field = value - hasChangedNotification.onNext(Unit) - } - private var _realName: String = "" - set(value) { - field = value - hasChangedNotification.onNext(Unit) - } - private var _account: String = "" - set(value) { - field = value - hasChangedNotification.onNext(Unit) - } - private var _awayMessage: String = "" - set(value) { - field = value - hasChangedNotification.onNext(Unit) - } - private var _away: Boolean = false - set(value) { - field = value - hasChangedNotification.onNext(Unit) - } - private var _server: String = "" - set(value) { - field = value - hasChangedNotification.onNext(Unit) - } - private var _idleTime: Instant = Instant.EPOCH - set(value) { - field = value - hasChangedNotification.onNext(Unit) - } - private var _idleTimeSet: Instant = Instant.EPOCH - set(value) { - field = value - hasChangedNotification.onNext(Unit) - } - private var _loginTime: Instant = Instant.EPOCH - set(value) { - field = value - hasChangedNotification.onNext(Unit) - } - private var _ircOperator: String = "" - set(value) { - field = value - hasChangedNotification.onNext(Unit) - } - private var _lastAwayMessageTime: Instant = Instant.EPOCH - set(value) { - field = value - hasChangedNotification.onNext(Unit) - } - private var _whoisServiceReply: String = "" - set(value) { - field = value - hasChangedNotification.onNext(Unit) - } - private var _suserHost: String = "" - set(value) { - field = value - hasChangedNotification.onNext(Unit) - } - private var _encrypted: Boolean = false - set(value) { - field = value - hasChangedNotification.onNext(Unit) - } - private var _channels: MutableSet<IrcChannel> = mutableSetOf() - private var _userModes: String = "" - set(value) { - field = value - hasChangedNotification.onNext(Unit) - } - private var _network: Network = network - private var _codecForEncoding: Charset? = null - private var _codecForDecoding: Charset? = null - - companion object { - val NULL = IrcUser("", Network.NULL, SignalProxy.NULL) - } -} diff --git a/lib/src/main/java/de/kuschku/libquassel/quassel/syncables/Network.kt b/lib/src/main/java/de/kuschku/libquassel/quassel/syncables/Network.kt deleted file mode 100644 index 4aef1333b4e16e37b486f6de1813422f0730bd2f..0000000000000000000000000000000000000000 --- a/lib/src/main/java/de/kuschku/libquassel/quassel/syncables/Network.kt +++ /dev/null @@ -1,1075 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.libquassel.quassel.syncables - -import de.kuschku.libquassel.protocol.* -import de.kuschku.libquassel.protocol.Type -import de.kuschku.libquassel.protocol.primitive.serializer.StringSerializer -import de.kuschku.libquassel.quassel.syncables.interfaces.INetwork -import de.kuschku.libquassel.quassel.syncables.interfaces.INetwork.* -import de.kuschku.libquassel.session.SignalProxy -import de.kuschku.libquassel.util.helper.getOr -import de.kuschku.libquassel.util.helper.serializeString -import de.kuschku.libquassel.util.irc.HostmaskHelper -import de.kuschku.libquassel.util.irc.IrcCaseMappers -import io.reactivex.Observable -import io.reactivex.subjects.BehaviorSubject -import java.nio.ByteBuffer -import java.util.* - -class Network constructor( - networkId: NetworkId, - proxy: SignalProxy -) : SyncableObject(proxy, "Network"), INetwork { - override fun init() { - renameObject("${_networkId.id}") - } - - override fun fromVariantMap(properties: QVariantMap) { - initSetSupports(properties["Supports"].valueOr(::emptyMap)) - initSetCaps(properties["Caps"].valueOr(::emptyMap)) - initSetCapsEnabled(properties["CapsEnabled"].valueOr(::emptyList)) - initSetIrcUsersAndChannels(properties["IrcUsersAndChannels"].valueOr(::emptyMap)) - initSetServerList(properties["ServerList"].valueOr(::emptyList)) - initSetProperties(properties) - } - - override fun toVariantMap(): QVariantMap = mapOf( - "Caps" to QVariant.of(initCaps(), Type.QVariantMap), - "CapsEnabled" to QVariant.of(initCapsEnabled(), Type.QVariantList), - "IrcUsersAndChannels" to QVariant.of(initIrcUsersAndChannels(), Type.QVariantMap), - "ServerList" to QVariant.of(initServerList(), Type.QVariantList), - "Supports" to QVariant.of(initSupports(), Type.QVariantMap) - ) + initProperties() - - fun isMyNick(nick: String) = myNick().equals(nick, true) - fun isMe(ircUser: IrcUser) = myNick().equals(ircUser.nick(), true) - fun isChannelName(channelName: String) = when { - channelName.isBlank() -> false - supports("CHANTYPES") -> support("CHANTYPES")?.contains(channelName[0]) ?: false - else -> "#&!+".contains(channelName[0]) - } - - val caseMapper: IrcCaseMappers.IrcCaseMapper - get() = IrcCaseMappers[support("CASEMAPPING")] - - /** - * Checks if the target counts as a STATUSMSG - * - * Status messages are prefixed with one or more characters from the server-provided STATUSMSG - * if available, otherwise "@" and "+" are assumed. Generally, status messages sent to a - * channel are only visible to those with the same or higher permissions, e.g. voiced. - * - * @param target Name of destination, e.g. a channel or query - * @return True if a STATUSMSG, otherwise false - */ - fun isStatusMsg(target: String) = when { - target.isBlank() -> false - supports("STATUSMSG") -> support("STATUSMSG")?.contains(target[0]) ?: false - else -> "@+".contains(target[0]) - } - - fun isConnected() = _connected - fun connectionState() = _connectionState - fun liveConnectionState(): Observable<ConnectionState> = live_connectionState - - fun prefixToMode(prefix: Char): Char? = prefixModes().elementAtOrNull(prefixes().indexOf(prefix)) - - fun prefixesToModes(prefixes: String): String = prefixes.mapNotNull { - prefixes().indexOf(it) - }.sorted().mapNotNull { - prefixModes().elementAtOrNull(it) - }.joinToString("") - - fun modeToPrefix(mode: Char): Char? = prefixes().elementAtOrNull(prefixModes().indexOf(mode)) - - fun modesToPrefixes(modes: String): String = modes.mapNotNull { - prefixModes().indexOf(it) - }.sorted().mapNotNull { - prefixes().elementAtOrNull(it) - }.joinToString("") - - fun channelModeType(mode: Char): ChannelModeType { - if (_channelModes == null) - determineChannelModeTypes() - return _channelModes?.entries - ?.filter { (_, chars) -> chars.contains(mode) } - ?.map(Map.Entry<ChannelModeType, Set<Char>>::key) - ?.firstOrNull() ?: ChannelModeType.NOT_A_CHANMODE - } - - private fun determineChannelModeTypes() { - _channelModes = ChannelModeType.validValues - .zip( - support("CHANMODES") - ?.split(',', limit = ChannelModeType.validValues.size) - ?.map(String::toCharArray) - ?.map(CharArray::toSet) - .orEmpty() - ).toMap() - } - - fun networkId() = _networkId - fun networkName() = _networkName - fun currentServer() = _currentServer - fun myNick() = _myNick - fun latency() = _latency - fun me() = ircUser(myNick()) - fun identity() = _identity - fun nicks() = _ircUsers.values.map(IrcUser::nick) - fun channels(): Set<String> = _ircChannels.keys - fun caps(): Set<String> = _caps.keys - fun liveCaps() = live_caps.map { caps() } - fun capsEnabled(): Set<String> = _capsEnabled - fun livecapsEnabled() = live_capsEnabled.map { capsEnabled() } - fun serverList() = _serverList - fun useRandomServer() = _useRandomServer - fun perform() = _perform - fun useAutoIdentify() = _useAutoIdentify - fun autoIdentifyService() = _autoIdentifyService - fun autoIdentifyPassword() = _autoIdentifyPassword - fun useSasl() = _useSasl - fun saslAccount() = _saslAccount - fun saslPassword() = _saslPassword - fun useAutoReconnect() = _useAutoReconnect - fun autoReconnectInterval() = _autoReconnectInterval - fun autoReconnectRetries() = _autoReconnectRetries - fun unlimitedReconnectRetries() = _unlimitedReconnectRetries - fun rejoinChannels() = _rejoinChannels - fun useCustomMessageRate() = _useCustomMessageRate - fun messageRateBurstSize() = _messageRateBurstSize - fun messageRateDelay() = _messageRateDelay - fun unlimitedMessageRate() = _unlimitedMessageRate - fun networkInfo() = NetworkInfo( - networkName = networkName(), - networkId = networkId(), - identity = identity(), - codecForServer = codecForServer(), - codecForEncoding = codecForEncoding(), - codecForDecoding = codecForDecoding(), - serverList = serverList(), - useRandomServer = useRandomServer(), - perform = perform(), - useAutoIdentify = useAutoIdentify(), - autoIdentifyService = autoIdentifyService(), - autoIdentifyPassword = autoIdentifyPassword(), - useSasl = useSasl(), - saslAccount = saslAccount(), - saslPassword = saslPassword(), - useAutoReconnect = useAutoReconnect(), - autoReconnectInterval = autoReconnectInterval(), - autoReconnectRetries = autoReconnectRetries(), - unlimitedReconnectRetries = unlimitedReconnectRetries(), - rejoinChannels = rejoinChannels(), - useCustomMessageRate = useCustomMessageRate(), - messageRateBurstSize = messageRateBurstSize(), - messageRateDelay = messageRateDelay(), - unlimitedMessageRate = unlimitedMessageRate() - ) - - fun liveNetworkInfo() = live_networkInfo.map { networkInfo() } - - override fun setNetworkInfo(info: NetworkInfo) { - // we don't set our ID! - if (!info.networkName.isEmpty() && info.networkName != networkName()) - setNetworkName(info.networkName) - if (info.identity.isValidId() && info.identity != identity()) - setIdentity(info.identity) - if (info.codecForServer != codecForServer()) - setCodecForServer(info.codecForServer) - if (info.codecForEncoding != codecForEncoding()) - setCodecForEncoding(info.codecForEncoding) - if (info.codecForDecoding != codecForDecoding()) - setCodecForDecoding(info.codecForDecoding) - // FIXME compare components - if (info.serverList.isNotEmpty()) - setServerList(info.serverList.map { QVariant.of(it.toVariantMap(), QType.Network_Server) }) - if (info.useRandomServer != useRandomServer()) - setUseRandomServer(info.useRandomServer) - if (info.perform != perform()) - setPerform(info.perform) - if (info.useAutoIdentify != useAutoIdentify()) - setUseAutoIdentify(info.useAutoIdentify) - if (info.autoIdentifyService != autoIdentifyService()) - setAutoIdentifyService(info.autoIdentifyService) - if (info.autoIdentifyPassword != autoIdentifyPassword()) - setAutoIdentifyPassword(info.autoIdentifyPassword) - if (info.useSasl != useSasl()) - setUseSasl(info.useSasl) - if (info.saslAccount != saslAccount()) - setSaslAccount(info.saslAccount) - if (info.saslPassword != saslPassword()) - setSaslPassword(info.saslPassword) - if (info.useAutoReconnect != useAutoReconnect()) - setUseAutoReconnect(info.useAutoReconnect) - if (info.autoReconnectInterval != autoReconnectInterval()) - setAutoReconnectInterval(info.autoReconnectInterval) - if (info.autoReconnectRetries != autoReconnectRetries()) - setAutoReconnectRetries(info.autoReconnectRetries) - if (info.unlimitedReconnectRetries != unlimitedReconnectRetries()) - setUnlimitedReconnectRetries(info.unlimitedReconnectRetries) - if (info.rejoinChannels != rejoinChannels()) - setRejoinChannels(info.rejoinChannels) - // Custom rate limiting - if (info.useCustomMessageRate != useCustomMessageRate()) - setUseCustomMessageRate(info.useCustomMessageRate) - if (info.messageRateBurstSize != messageRateBurstSize()) - setMessageRateBurstSize(info.messageRateBurstSize) - if (info.messageRateDelay != messageRateDelay()) - setMessageRateDelay(info.messageRateDelay) - if (info.unlimitedMessageRate != unlimitedMessageRate()) - setUnlimitedMessageRate(info.unlimitedMessageRate) - } - - fun prefixes(): List<Char> { - if (_prefixes == null) - determinePrefixes() - return _prefixes ?: emptyList() - } - - fun prefixModes(): List<Char> { - if (_prefixModes == null) - determinePrefixes() - return _prefixModes ?: emptyList() - } - - private fun determinePrefixes() { - // seems like we have to construct them first - val prefix = support("PREFIX") ?: "" - if (prefix.startsWith("(") && prefix.contains(")")) { - val (prefixModes, prefixes) = prefix.substring(1) - .split(')', limit = 2) - .map(String::toCharArray) - .map(CharArray::toList) - _prefixes = prefixes - _prefixModes = prefixModes - } else { - val defaultPrefixes = listOf('~', '&', '@', '%', '+') - val defaultPrefixModes = listOf('q', 'a', 'o', 'h', 'v') - if (prefix.isBlank()) { - _prefixes = defaultPrefixes - _prefixModes = defaultPrefixModes - return - } - // we just assume that in PREFIX are only prefix chars stored - val (prefixes, prefixModes) = defaultPrefixes.zip(defaultPrefixModes) - .filter { prefix.contains(it.second) } - .unzip() - _prefixes = prefixes - _prefixModes = prefixModes - // check for success - if (prefixes.isNotEmpty()) - return - // well... our assumption was obviously wrong... - // check if it's only prefix modes - val (prefixes2, prefixModes2) = defaultPrefixes.zip(defaultPrefixModes) - .filter { prefix.contains(it.first) } - .unzip() - _prefixes = prefixes2 - _prefixModes = prefixModes2 - // now we've done all we've could... - } - } - - fun channelModes(): Map<ChannelModeType, Set<Char>>? = _channelModes - - fun supports(): Map<String, String?> = _supports - fun liveSupports() = live_supports.map { supports() } - fun supports(param: String) = _supports.contains(param.toUpperCase(Locale.US)) - fun support(param: String) = _supports.getOr(param, "") - /** - * Checks if a given capability is advertised by the server. - * - * These results aren't valid if the network is disconnected or capability negotiation hasn't - * happened, and some servers might not correctly advertise capabilities. Don't treat this as a - * guarantee. - * - * @param capability Name of capability - * @return True if connected and advertised by the server, otherwise false - */ - fun capAvailable(capability: String) = _caps.contains(capability.toLowerCase(Locale.US)) - - /** - * Checks if a given capability is acknowledged and active. - * - * @param capability Name of capability - * @return True if acknowledged (active), otherwise false - */ - fun capEnabled(capability: String) = _capsEnabled.contains(capability.toLowerCase(Locale.US)) - - /** - * Gets the value of an available capability, e.g. for SASL, "EXTERNAL,PLAIN". - * - * @param capability Name of capability - * @return Value of capability if one was specified, otherwise isEmpty string - */ - fun capValue(capability: String) = _caps.getOr(capability.toLowerCase(Locale.US), "") - - /** - * Check if the given authentication mechanism is likely to be supported. - * - * This depends on the server advertising SASL support and either declaring available mechanisms - * (SASL 3.2), or just indicating something is supported (SASL 3.1). - * - * @param saslMechanism Desired SASL mechanism - * @return True if mechanism supported or unknown, otherwise false - */ - fun saslMaybeSupports(saslMechanism: String): Boolean { - if (!capAvailable(IrcCap.SASL)) { - // If SASL's not advertised at all, it's likely the mechanism isn't supported, as per specs. - // Unfortunately, we don't know for sure, but Quassel won't request SASL without it being - // advertised, anyways. - // This may also occur if the network's disconnected or negotiation hasn't yet happened. - return false - } - // Get the SASL capability value - val capValue = capValue(IrcCap.SASL) - // SASL mechanisms are only specified in capability values as part of SASL 3.2. In SASL 3.1, - // it's handled differently. If we don't know via capability value, assume it's supported to - // reduce the risk of breaking existing setups. - // See: http://ircv3.net/specs/extensions/sasl-3.1.html - // And: http://ircv3.net/specs/extensions/sasl-3.2.html - return (capValue.isNullOrBlank() || - capValue.contains(saslMechanism, ignoreCase = true)) - } - - fun newIrcUser(hostMask: String, initData: QVariantMap = emptyMap(), - index: Int? = null): IrcUser { - val nick = caseMapper.toLowerCase(HostmaskHelper.nick(hostMask)) - val user = ircUser(nick) - return if (user == null) { - val ircUser = IrcUser(hostMask, this, proxy) - ircUser.init() - if (initData.isNotEmpty()) { - ircUser.fromVariantMap(initData, index) - ircUser.initialized = true - } - proxy.synchronize(ircUser) - _ircUsers[nick] = ircUser - live_ircUsers.onNext(Unit) - ircUser - } else { - user - } - } - - fun ircUser(nickName: String?) = _ircUsers[caseMapper.toLowerCaseNullable(nickName)] - fun liveIrcUser(nickName: String?) = live_ircUsers.map { - ircUser(nickName) ?: IrcUser.NULL - }.distinctUntilChanged() - - fun ircUsers() = _ircUsers.values.toList() - fun liveIrcUsers() = live_ircUsers.map { - ircUsers() - } - - fun ircUserCount(): UInt = _ircUsers.size.toUInt() - fun liveIrcUserCount() = live_ircUsers.map { - ircUserCount() - } - - fun newIrcChannel(channelName: String, initData: QVariantMap = emptyMap(), - index: Int? = null): IrcChannel = - ircChannel(channelName).let { channel -> - return if (channel == null) { - val ircChannel = IrcChannel(channelName, this, proxy) - ircChannel.init() - if (initData.isNotEmpty()) { - ircChannel.fromVariantMap(initData, index) - ircChannel.initialized = true - } - proxy.synchronize(ircChannel) - _ircChannels[caseMapper.toLowerCase(channelName)] = ircChannel - live_ircChannels.onNext(Unit) - ircChannel - } else { - channel - } - } - - fun ircChannel(channelName: String?) = _ircChannels[channelName?.let(caseMapper::toLowerCase)] - fun liveIrcChannel(channelName: String?) = live_ircChannels.map { - ircChannel( - channelName - ) ?: IrcChannel.NULL - }.distinctUntilChanged() - - fun ircChannels() = _ircChannels.values.toList() - fun liveIrcChannels() = live_ircChannels.map { - ircChannels() - } - - fun ircChannelCount(): UInt = _ircChannels.size.toUInt() - fun liveIrcChannelCount() = live_ircChannels.map { - ircChannelCount() - } - - fun codecForServer(): String = _codecForServer - fun codecForEncoding(): String = _codecForEncoding - fun codecForDecoding(): String = _codecForDecoding - fun setCodecForDecoding(codec: String) { - _codecForDecoding = codec - } - - fun setCodecForEncoding(codec: String) { - _codecForEncoding = codec - } - - fun setCodecForServer(codec: String) { - _codecForServer = codec - } - - fun autoAwayActive() = _autoAwayActive - fun setAutoAwayActive(active: Boolean) { - _autoAwayActive = active - } - - override fun setNetworkName(networkName: String?) { - if (_networkName == networkName ?: "") - return - _networkName = networkName ?: "" - } - - override fun setCurrentServer(currentServer: String?) { - if (_currentServer == currentServer ?: "") - return - _currentServer = currentServer ?: "" - } - - override fun setConnected(isConnected: Boolean) { - if (_connected == isConnected) - return - _connected = isConnected - if (!isConnected) { - setMyNick("") - setCurrentServer("") - removeChansAndUsers() - } - } - - override fun setConnectionState(state: ConnectionState) { - if (_connectionState == state) - return - _connectionState = state - live_connectionState.onNext(_connectionState) - } - - override fun setMyNick(mynick: String?) { - if (_myNick == mynick) - return - _myNick = mynick - if (_myNick != null && _myNick.isNullOrEmpty() && ircUser(myNick()) == null) { - newIrcUser(myNick() ?: "") - } - } - - override fun setLatency(latency: Int) { - if (_latency == latency) - return - _latency = latency - } - - override fun setIdentity(identity: IdentityId) { - if (_identity == identity) - return - _identity = identity - } - - override fun setActualServerList(serverList: List<INetwork.Server>) { - if (_serverList == serverList) - return - _serverList = serverList - } - - override fun setUseRandomServer(randomServer: Boolean) { - if (_useRandomServer == randomServer) - return - _useRandomServer = randomServer - } - - override fun setPerform(perform: QStringList) { - val actualPerform = perform.map { it ?: "" } - if (_perform == actualPerform) - return - _perform = actualPerform - } - - override fun setUseAutoIdentify(autoIdentify: Boolean) { - if (_useAutoIdentify == autoIdentify) - return - _useAutoIdentify = autoIdentify - } - - override fun setAutoIdentifyService(service: String?) { - if (_autoIdentifyService == service ?: "") - return - _autoIdentifyService = service ?: "" - } - - override fun setAutoIdentifyPassword(password: String?) { - if (_autoIdentifyPassword == password ?: "") - return - _autoIdentifyPassword = password ?: "" - } - - override fun setUseSasl(sasl: Boolean) { - if (_useSasl == sasl) - return - _useSasl = sasl - } - - override fun setSaslAccount(account: String?) { - if (_saslAccount == account ?: "") - return - _saslAccount = account ?: "" - } - - override fun setSaslPassword(password: String?) { - if (_saslPassword == password ?: "") - return - _saslPassword = password ?: "" - } - - override fun setUseAutoReconnect(autoReconnect: Boolean) { - if (_useAutoReconnect == autoReconnect) - return - _useAutoReconnect = autoReconnect - } - - override fun setAutoReconnectInterval(interval: UInt) { - if (_autoReconnectInterval == interval) - return - _autoReconnectInterval = interval - } - - override fun setAutoReconnectRetries(retries: UShort) { - if (_autoReconnectRetries == retries) - return - _autoReconnectRetries = retries - } - - override fun setUnlimitedReconnectRetries(unlimitedRetries: Boolean) { - if (_unlimitedReconnectRetries == unlimitedRetries) - return - _unlimitedReconnectRetries = unlimitedRetries - } - - override fun setRejoinChannels(rejoinChannels: Boolean) { - if (_rejoinChannels == rejoinChannels) - return - _rejoinChannels = rejoinChannels - } - - /** - * Sets whether or not custom rate limiting is used. - * - * Setting limits too low may value you disconnected from the server! - * - * @param useCustomRate If true, use custom rate limits, otherwise use Quassel defaults. - */ - override fun setUseCustomMessageRate(useCustomRate: Boolean) { - if (_useCustomMessageRate == useCustomRate) - return - _useCustomMessageRate = useCustomRate - } - - override fun setMessageRateBurstSize(burstSize: UInt) { - if (_messageRateBurstSize == burstSize) - return - if (burstSize == 0u) - throw IllegalArgumentException("Message Burst Size must be a positive number: $burstSize") - _messageRateBurstSize = burstSize - } - - override fun setMessageRateDelay(messageDelay: UInt) { - if (_messageRateDelay == messageDelay) - return - if (messageDelay == 0u) - throw IllegalArgumentException("Message Delay must be a positive number: $messageDelay") - _messageRateDelay = messageDelay - } - - override fun setUnlimitedMessageRate(unlimitedRate: Boolean) { - if (_unlimitedMessageRate == unlimitedRate) - return - _unlimitedMessageRate = unlimitedRate - } - - override fun setCodecForDecoding(codecName: ByteBuffer?) { - if (codecName != null) - setCodecForDecoding(Charsets.ISO_8859_1.decode(codecName).toString()) - } - - override fun setCodecForEncoding(codecName: ByteBuffer?) { - if (codecName != null) - setCodecForEncoding(Charsets.ISO_8859_1.decode(codecName).toString()) - } - - override fun setCodecForServer(codecName: ByteBuffer?) { - if (codecName != null) - setCodecForServer(Charsets.ISO_8859_1.decode(codecName).toString()) - } - - override fun addSupport(param: String?, value: String?) { - _supports[param ?: ""] = value - } - - override fun removeSupport(param: String?) { - if (!_supports.contains(param ?: "")) - return - _supports.remove(param ?: "") - } - - override fun addCap(capability: String, value: String?) { - _caps[capability.toLowerCase(Locale.US)] = value - } - - override fun acknowledgeCap(capability: String?) { - val lowerCase = capability?.toLowerCase(Locale.US) - if (!_capsEnabled.contains(lowerCase ?: "")) - return - _capsEnabled.add(lowerCase ?: "") - } - - override fun removeCap(capability: String?) { - val lowerCase = capability?.toLowerCase(Locale.US) - if (!_caps.contains(lowerCase ?: "")) - return - _caps.remove(lowerCase ?: "") - _capsEnabled.remove(lowerCase ?: "") - } - - override fun clearCaps() { - if (_caps.isEmpty() && _capsEnabled.isEmpty()) - return - _caps.clear() - _capsEnabled.clear() - } - - override fun addIrcUser(hostmask: String?) { - newIrcUser(hostmask ?: "") - } - - override fun addIrcChannel(channel: String?) { - newIrcChannel(channel ?: "") - } - - override fun initSupports(): QVariantMap = _supports.entries.map { (key, value) -> - key to QVariant.of(value, Type.QString) - }.toMap() - - override fun initCaps(): QVariantMap = _caps.entries.map { (key, value) -> - key to QVariant.of(value, Type.QString) - }.toMap() - - override fun initCapsEnabled(): QVariantList = _capsEnabled.map { - QVariant.of(it, Type.QString) - }.toList() - - override fun initServerList(): QVariantList = _serverList.map { - QVariant.of(it.toVariantMap(), QType.Network_Server) - }.toList() - - override fun initIrcUsersAndChannels(): QVariantMap { - return mapOf( - "Users" to QVariant.of( - _ircUsers.values.map { it.toVariantMap() }.transpose().mapValues { (_, value) -> - QVariant.of(value, Type.QVariantList) - }, - Type.QVariantMap - ), - "Channels" to QVariant.of( - _ircChannels.values.map { it.toVariantMap() }.transpose().mapValues { (_, value) -> - QVariant.of(value, Type.QVariantList) - }, - Type.QVariantMap - ) - ) - } - - override fun initProperties(): QVariantMap = mapOf( - "networkName" to QVariant.of(networkName(), Type.QString), - "currentServer" to QVariant.of(currentServer(), Type.QString), - "myNick" to QVariant.of(myNick(), Type.QString), - "latency" to QVariant.of(latency(), Type.Int), - "codecForServer" to QVariant.of( - codecForServer().serializeString(StringSerializer.UTF8), Type.QByteArray - ), - "codecForEncoding" to QVariant.of( - codecForEncoding().serializeString(StringSerializer.UTF8), Type.QByteArray - ), - "codecForDecoding" to QVariant.of( - codecForDecoding().serializeString(StringSerializer.UTF8), Type.QByteArray - ), - "identityId" to QVariant.of(identity(), QType.IdentityId), - "isConnected" to QVariant.of(isConnected(), Type.Bool), - "connectionState" to QVariant.of(connectionState().value, Type.Int), - "useRandomServer" to QVariant.of(useRandomServer(), Type.Bool), - "perform" to QVariant.of(perform(), Type.QStringList), - "useAutoIdentify" to QVariant.of(useAutoIdentify(), Type.Bool), - "autoIdentifyService" to QVariant.of(autoIdentifyService(), Type.QString), - "autoIdentifyPassword" to QVariant.of(autoIdentifyPassword(), Type.QString), - "useSasl" to QVariant.of(useSasl(), Type.Bool), - "saslAccount" to QVariant.of(saslAccount(), Type.QString), - "saslPassword" to QVariant.of(saslPassword(), Type.QString), - "useAutoReconnect" to QVariant.of(useAutoReconnect(), Type.Bool), - "autoReconnectInterval" to QVariant.of(autoReconnectInterval(), Type.UInt), - "autoReconnectRetries" to QVariant.of(autoReconnectRetries(), Type.UShort), - "unlimitedReconnectRetries" to QVariant.of(unlimitedReconnectRetries(), Type.Bool), - "rejoinChannels" to QVariant.of(rejoinChannels(), Type.Bool), - "useCustomMessageRate" to QVariant.of(useCustomMessageRate(), Type.Bool), - "msgRateBurstSize" to QVariant.of(messageRateBurstSize(), Type.UInt), - "msgRateMessageDelay" to QVariant.of(messageRateDelay(), Type.UInt), - "unlimitedMessageRate" to QVariant.of(unlimitedMessageRate(), Type.Bool) - ) - - override fun initSetSupports(supports: QVariantMap) { - supports.entries.map { (key, value) -> key to value.value("") }.toMap(_supports) - } - - override fun initSetCaps(caps: QVariantMap) { - caps.entries.map { (key, value) -> key to value.value("") }.toMap(_caps) - } - - override fun initSetCapsEnabled(capsEnabled: QVariantList) { - capsEnabled.mapNotNull { it.value<String?>() }.toCollection(_capsEnabled) - } - - override fun initSetServerList(serverList: QVariantList) { - _serverList = serverList.mapNotNull { it.value<QVariantMap?>() }.map( - Server.Companion::fromVariantMap - ).toMutableList() - } - - override fun initSetIrcUsersAndChannels(usersAndChannels: QVariantMap) { - if (initialized) - throw IllegalArgumentException("Received init data for network ${networkId()} after init") - val users: Map<String, QVariant_> = usersAndChannels["Users"].valueOr(::emptyMap) - users["nick"].valueOr<QVariantList>(::emptyList).forEachIndexed { index, nick -> - newIrcUser(nick.value(""), users, index) - } - - val channels: Map<String, QVariant_> = usersAndChannels["Channels"].valueOr(::emptyMap) - channels["name"].valueOr<QVariantList>(::emptyList).forEachIndexed { index, nick -> - newIrcChannel(nick.value(""), channels, index) - } - } - - override fun initSetProperties(properties: QVariantMap) { - setNetworkName(properties["networkName"].valueOr(this::networkName)) - setCurrentServer(properties["currentServer"].valueOr(this::currentServer)) - setMyNick(properties["myNick"].valueOr(this::myNick)) - setLatency(properties["latency"].valueOr(this::latency)) - setCodecForServer( - properties["codecForServer"].value(codecForServer().serializeString(StringSerializer.UTF8)) - ) - setCodecForEncoding( - properties["codecForEncoding"].value( - codecForEncoding().serializeString(StringSerializer.UTF8) - ) - ) - setCodecForDecoding( - properties["codecForDecoding"].value( - codecForDecoding().serializeString(StringSerializer.UTF8) - ) - ) - setIdentity(properties["identityId"].valueOr(this::identity)) - setConnected(properties["isConnected"].valueOr(this::isConnected)) - setConnectionState(properties["connectionState"].value(connectionState().value)) - setUseRandomServer(properties["useRandomServer"].valueOr(this::useRandomServer)) - setPerform(properties["perform"].valueOr(this::perform)) - setUseAutoIdentify(properties["useAutoIdentify"].valueOr(this::useAutoIdentify)) - setAutoIdentifyService(properties["autoIdentifyService"].valueOr(this::autoIdentifyService)) - setAutoIdentifyPassword(properties["autoIdentifyPassword"].valueOr(this::autoIdentifyPassword)) - setUseSasl(properties["useSasl"].valueOr(this::useSasl)) - setSaslAccount(properties["saslAccount"].valueOr(this::saslAccount)) - setSaslPassword(properties["saslPassword"].valueOr(this::saslPassword)) - setUseAutoReconnect(properties["useAutoReconnect"].valueOr(this::useAutoReconnect)) - setAutoReconnectInterval( - properties["autoReconnectInterval"].valueOr(this::autoReconnectInterval) - ) - setAutoReconnectRetries(properties["autoReconnectRetries"].valueOr(this::autoReconnectRetries)) - setUnlimitedReconnectRetries( - properties["unlimitedReconnectRetries"].valueOr(this::unlimitedReconnectRetries) - ) - setRejoinChannels(properties["rejoinChannels"].valueOr(this::rejoinChannels)) - setUseCustomMessageRate(properties["useCustomMessageRate"].valueOr(this::useCustomMessageRate)) - setMessageRateBurstSize(properties["msgRateBurstSize"].valueOr(this::messageRateBurstSize)) - setMessageRateDelay(properties["msgRateMessageDelay"].valueOr(this::messageRateDelay)) - setUnlimitedMessageRate(properties["unlimitedMessageRate"].valueOr(this::unlimitedMessageRate)) - } - - fun updateNickFromMask(mask: String): IrcUser { - val nick = caseMapper.toLowerCase(HostmaskHelper.nick(mask)) - val user = _ircUsers[nick] - return if (user != null) { - user.updateHostmask(mask) - user - } else { - newIrcUser(mask) - } - } - - override fun ircUserNickChanged(old: String?, new: String?) { - val value = _ircUsers.remove(caseMapper.toLowerCase(old ?: "")) - if (value != null) { - _ircUsers[caseMapper.toLowerCase(new ?: "")] = value - } - } - - override fun emitConnectionError(error: String?) { - } - - fun removeChansAndUsers() { - _ircUsers.clear() - _ircChannels.clear() - live_ircChannels.onNext(Unit) - live_ircUsers.onNext(Unit) - } - - fun removeIrcUser(user: IrcUser) { - _ircUsers.remove(caseMapper.toLowerCase(user.nick())) - live_ircUsers.onNext(Unit) - } - - fun removeIrcChannel(channel: IrcChannel) { - _ircChannels.remove(caseMapper.toLowerCase(channel.name())) - live_ircChannels.onNext(Unit) - } - - fun copy(): Network { - val identity = Network(this.networkId(), SignalProxy.NULL) - identity.fromVariantMap(this.toVariantMap()) - return identity - } - - private var _networkId: NetworkId = networkId - set(value) { - field = value - live_networkInfo.onNext(Unit) - } - private var _identity: IdentityId = IdentityId(-1) - set(value) { - field = value - live_networkInfo.onNext(Unit) - } - private var _myNick: String? = null - private var _latency: Int = 0 - set(value) { - field = value - live_latency.onNext(value) - } - private val live_latency = BehaviorSubject.createDefault(0) - private var _networkName: String = "<not initialized>" - set(value) { - field = value - live_networkInfo.onNext(Unit) - } - private var _currentServer: String = "" - set(value) { - field = value - live_currentServer.onNext(value) - } - private val live_currentServer = BehaviorSubject.createDefault("") - private var _connected: Boolean = false - private var _connectionState: ConnectionState = ConnectionState.Disconnected - private val live_connectionState = BehaviorSubject.createDefault(ConnectionState.Disconnected) - private var _prefixes: List<Char>? = null - private var _prefixModes: List<Char>? = null - private var _channelModes: Map<ChannelModeType, Set<Char>>? = null - // stores all known nicks for the server - private var _ircUsers: MutableMap<String, IrcUser> = mutableMapOf() - private val live_ircUsers = BehaviorSubject.createDefault(Unit) - // stores all known channels - private var _ircChannels: MutableMap<String, IrcChannel> = mutableMapOf() - private val live_ircChannels = BehaviorSubject.createDefault(Unit) - // stores results from RPL_ISUPPORT - private var _supports: MutableMap<String, String?> = mutableMapOf() - set(value) { - field = value - live_caps.onNext(Unit) - } - private val live_supports = BehaviorSubject.createDefault(Unit) - /** - * Capabilities supported by the IRC server - * By synchronizing the supported capabilities, the client could suggest certain behaviors, e.g. - * in the Network settings dialog, recommending SASL instead of using NickServ, or warning if - * SASL EXTERNAL isn't available. - */ - private var _caps: MutableMap<String, String?> = mutableMapOf() - set(value) { - field = value - live_caps.onNext(Unit) - } - private val live_caps = BehaviorSubject.createDefault(Unit) - /** - * Enabled capabilities that received 'CAP ACK' - * _capsEnabled uses the same values from the <name>=<value> pairs stored in _caps - */ - private var _capsEnabled: MutableSet<String> = mutableSetOf() - set(value) { - field = value - live_capsEnabled.onNext(Unit) - } - private val live_capsEnabled = BehaviorSubject.createDefault(Unit) - private var _serverList: List<Server> = listOf() - set(value) { - field = value - live_networkInfo.onNext(Unit) - } - private var _useRandomServer: Boolean = false - set(value) { - field = value - live_networkInfo.onNext(Unit) - } - private var _perform: List<String> = listOf() - set(value) { - field = value - live_networkInfo.onNext(Unit) - } - private var _useAutoIdentify: Boolean = false - set(value) { - field = value - live_networkInfo.onNext(Unit) - } - private var _autoIdentifyService: String = "" - set(value) { - field = value - live_networkInfo.onNext(Unit) - } - private var _autoIdentifyPassword: String = "" - set(value) { - field = value - live_networkInfo.onNext(Unit) - } - private var _useSasl: Boolean = false - set(value) { - field = value - live_networkInfo.onNext(Unit) - } - private var _saslAccount: String = "" - set(value) { - field = value - live_networkInfo.onNext(Unit) - } - private var _saslPassword: String = "" - set(value) { - field = value - live_networkInfo.onNext(Unit) - } - private var _useAutoReconnect: Boolean = false - set(value) { - field = value - live_networkInfo.onNext(Unit) - } - private var _autoReconnectInterval: UInt = 60u - set(value) { - field = value - live_networkInfo.onNext(Unit) - } - private var _autoReconnectRetries: UShort = 10u - set(value) { - field = value - live_networkInfo.onNext(Unit) - } - private var _unlimitedReconnectRetries = false - set(value) { - field = value - live_networkInfo.onNext(Unit) - } - private var _rejoinChannels = false - set(value) { - field = value - live_networkInfo.onNext(Unit) - } - // Custom rate limiting - /** If true, use custom rate limits, otherwise use defaults */ - private var _useCustomMessageRate: Boolean = false - set(value) { - field = value - live_networkInfo.onNext(Unit) - } - /** Maximum number of messages to send without any delays */ - private var _messageRateBurstSize: UInt = 5u - set(value) { - field = value - live_networkInfo.onNext(Unit) - } - /** Delay in ms. for messages when max. burst messages sent */ - private var _messageRateDelay: UInt = 2200u - set(value) { - field = value - live_networkInfo.onNext(Unit) - } - /** If true, disable rate limiting, otherwise apply limits */ - private var _unlimitedMessageRate: Boolean = false - set(value) { - field = value - live_networkInfo.onNext(Unit) - } - private var _codecForServer: String = "UTF_8" - set(value) { - field = value - live_networkInfo.onNext(Unit) - } - private var _codecForEncoding: String = "UTF_8" - set(value) { - field = value - live_networkInfo.onNext(Unit) - } - private var _codecForDecoding: String = "UTF_8" - set(value) { - field = value - live_networkInfo.onNext(Unit) - } - /** when this is active handle305 and handle306 don't trigger any output */ - private var _autoAwayActive: Boolean = false - - private val live_networkInfo = BehaviorSubject.createDefault(Unit) - - fun isEqual(other: Network): Boolean = - this.networkName() == other.networkName() && - this.identity() == other.identity() && - this.serverList() == other.serverList() && - this.useSasl() == other.useSasl() && - this.saslAccount() == other.saslAccount() && - this.saslPassword() == other.saslPassword() && - this.useAutoIdentify() == other.useAutoIdentify() && - this.autoIdentifyService() == other.autoIdentifyService() && - this.autoIdentifyPassword() == other.autoIdentifyPassword() && - this.useAutoReconnect() == other.useAutoReconnect() && - this.autoReconnectInterval() == other.autoReconnectInterval() && - this.autoReconnectRetries() == other.autoReconnectRetries() && - this.unlimitedReconnectRetries() == other.unlimitedReconnectRetries() && - this.rejoinChannels() == other.rejoinChannels() && - this.perform() == other.perform() && - this.useCustomMessageRate() == other.useCustomMessageRate() && - this.messageRateBurstSize() == other.messageRateBurstSize() && - this.unlimitedMessageRate() == other.unlimitedMessageRate() && - this.messageRateDelay() == other.messageRateDelay() - - override fun toString(): String { - return "Network(_networkId=$_networkId, _identity=$_identity, _networkName='$_networkName', _serverList=$_serverList, _useRandomServer=$_useRandomServer, _perform=$_perform, _useAutoIdentify=$_useAutoIdentify, _autoIdentifyService='$_autoIdentifyService', _autoIdentifyPassword='$_autoIdentifyPassword', _useSasl=$_useSasl, _saslAccount='$_saslAccount', _saslPassword='$_saslPassword', _useAutoReconnect=$_useAutoReconnect, _autoReconnectInterval=$_autoReconnectInterval, _autoReconnectRetries=$_autoReconnectRetries, _unlimitedReconnectRetries=$_unlimitedReconnectRetries, _rejoinChannels=$_rejoinChannels, _useCustomMessageRate=$_useCustomMessageRate, _messageRateBurstSize=$_messageRateBurstSize, _messageRateDelay=$_messageRateDelay, _unlimitedMessageRate=$_unlimitedMessageRate, _codecForServer=$_codecForServer, _codecForEncoding=$_codecForEncoding, _codecForDecoding=$_codecForDecoding)" - } - - companion object { - val NULL = Network(NetworkId(-1), SignalProxy.NULL) - } -} diff --git a/lib/src/main/java/de/kuschku/libquassel/quassel/syncables/NetworkConfig.kt b/lib/src/main/java/de/kuschku/libquassel/quassel/syncables/NetworkConfig.kt deleted file mode 100644 index 784d78e28fb91b2d4c4430d9692f00d2ec4265ce..0000000000000000000000000000000000000000 --- a/lib/src/main/java/de/kuschku/libquassel/quassel/syncables/NetworkConfig.kt +++ /dev/null @@ -1,140 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.libquassel.quassel.syncables - -import de.kuschku.libquassel.protocol.QVariant -import de.kuschku.libquassel.protocol.QVariantMap -import de.kuschku.libquassel.protocol.Type -import de.kuschku.libquassel.protocol.valueOr -import de.kuschku.libquassel.quassel.syncables.interfaces.INetworkConfig -import de.kuschku.libquassel.session.SignalProxy - -class NetworkConfig constructor( - proxy: SignalProxy -) : SyncableObject(proxy, "NetworkConfig"), INetworkConfig { - override fun init() { - renameObject("GlobalNetworkConfig") - } - - override fun toVariantMap() = initProperties() - override fun fromVariantMap(properties: QVariantMap) { - initSetProperties(properties) - } - - override fun initProperties(): QVariantMap = mapOf( - "pingTimeoutEnabled" to QVariant.of(pingTimeoutEnabled(), Type.Bool), - "pingInterval" to QVariant.of(pingInterval(), Type.Int), - "maxPingCount" to QVariant.of(maxPingCount(), Type.Int), - "autoWhoEnabled" to QVariant.of(autoWhoEnabled(), Type.Bool), - "autoWhoInterval" to QVariant.of(autoWhoInterval(), Type.Int), - "autoWhoNickLimit" to QVariant.of(autoWhoNickLimit(), Type.Int), - "autoWhoDelay" to QVariant.of(autoWhoDelay(), Type.Int), - "standardCtcp" to QVariant.of(standardCtcp(), Type.Bool) - ) - - override fun initSetProperties(properties: QVariantMap) { - setPingTimeoutEnabled(properties["pingTimeoutEnabled"].valueOr(this::pingTimeoutEnabled)) - setPingInterval(properties["pingInterval"].valueOr(this::pingInterval)) - setMaxPingCount(properties["maxPingCount"].valueOr(this::maxPingCount)) - setAutoWhoEnabled(properties["autoWhoEnabled"].valueOr(this::autoWhoEnabled)) - setAutoWhoInterval(properties["autoWhoInterval"].valueOr(this::autoWhoInterval)) - setAutoWhoNickLimit(properties["autoWhoNickLimit"].valueOr(this::autoWhoNickLimit)) - setAutoWhoDelay(properties["autoWhoDelay"].valueOr(this::autoWhoDelay)) - setStandardCtcp(properties["standardCtcp"].valueOr(this::standardCtcp)) - } - - fun pingTimeoutEnabled() = _pingTimeoutEnabled - fun pingInterval() = _pingInterval - fun maxPingCount() = _maxPingCount - fun autoWhoEnabled() = _autoWhoEnabled - fun autoWhoInterval() = _autoWhoInterval - fun autoWhoNickLimit() = _autoWhoNickLimit - fun autoWhoDelay() = _autoWhoDelay - fun standardCtcp() = _standardCtcp - - override fun setPingTimeoutEnabled(enabled: Boolean) { - _pingTimeoutEnabled = enabled - super.setPingTimeoutEnabled(enabled) - } - - override fun setPingInterval(interval: Int) { - _pingInterval = interval - super.setPingInterval(interval) - } - - override fun setMaxPingCount(count: Int) { - _maxPingCount = count - super.setMaxPingCount(count) - } - - override fun setAutoWhoEnabled(enabled: Boolean) { - _autoWhoEnabled = enabled - super.setAutoWhoEnabled(enabled) - } - - override fun setAutoWhoInterval(interval: Int) { - _autoWhoInterval = interval - super.setAutoWhoInterval(interval) - } - - override fun setAutoWhoNickLimit(limit: Int) { - _autoWhoNickLimit = limit - super.setAutoWhoNickLimit(limit) - } - - override fun setAutoWhoDelay(delay: Int) { - _autoWhoDelay = delay - super.setAutoWhoDelay(delay) - } - - override fun setStandardCtcp(standardCtcp: Boolean) { - _standardCtcp = standardCtcp - super.setStandardCtcp(standardCtcp) - } - - fun copy(): NetworkConfig { - val config = NetworkConfig(SignalProxy.NULL) - config.fromVariantMap(this.toVariantMap()) - return config - } - - private var _pingTimeoutEnabled: Boolean = true - private var _pingInterval: Int = 30 - private var _maxPingCount: Int = 6 - private var _autoWhoEnabled: Boolean = true - private var _autoWhoInterval: Int = 90 - private var _autoWhoNickLimit: Int = 200 - private var _autoWhoDelay: Int = 5 - private var _standardCtcp: Boolean = false - - fun isEqual(other: NetworkConfig): Boolean = - this.pingTimeoutEnabled() == other.pingTimeoutEnabled() && - this.pingInterval() == other.pingInterval() && - this.maxPingCount() == other.maxPingCount() && - this.autoWhoEnabled() == other.autoWhoEnabled() && - this.autoWhoInterval() == other.autoWhoInterval() && - this.autoWhoNickLimit() == other.autoWhoNickLimit() && - this.autoWhoDelay() == other.autoWhoDelay() && - this.standardCtcp() == other.standardCtcp() - - override fun toString(): String { - return "NetworkConfig(_pingTimeoutEnabled=$_pingTimeoutEnabled, _pingInterval=$_pingInterval, _maxPingCount=$_maxPingCount, _autoWhoEnabled=$_autoWhoEnabled, _autoWhoInterval=$_autoWhoInterval, _autoWhoNickLimit=$_autoWhoNickLimit, _autoWhoDelay=$_autoWhoDelay, _standardCtcp=$_standardCtcp)" - } -} diff --git a/lib/src/main/java/de/kuschku/libquassel/quassel/syncables/RpcHandler.kt b/lib/src/main/java/de/kuschku/libquassel/quassel/syncables/RpcHandler.kt deleted file mode 100644 index df0ce4777964206a80556ad8dccca269ddf8c709..0000000000000000000000000000000000000000 --- a/lib/src/main/java/de/kuschku/libquassel/quassel/syncables/RpcHandler.kt +++ /dev/null @@ -1,133 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ -@file:Suppress("NOTHING_TO_INLINE") - -package de.kuschku.libquassel.quassel.syncables - -import de.kuschku.libquassel.protocol.* -import de.kuschku.libquassel.protocol.primitive.serializer.StringSerializer -import de.kuschku.libquassel.quassel.BufferInfo -import de.kuschku.libquassel.quassel.syncables.interfaces.INetwork -import de.kuschku.libquassel.quassel.syncables.interfaces.IRpcHandler -import de.kuschku.libquassel.session.BacklogStorage -import de.kuschku.libquassel.session.ISession -import de.kuschku.libquassel.session.NotificationManager -import de.kuschku.libquassel.util.helper.deserializeString -import de.kuschku.libquassel.util.rxjava.ReusableUnicastSubject -import java.nio.ByteBuffer - -class RpcHandler( - var session: ISession, - private val backlogStorage: BacklogStorage? = null, - private val notificationManager: NotificationManager? = null -) : IRpcHandler { - fun deinit() { - session = ISession.NULL - } - - override fun displayStatusMsg(net: String?, msg: String?) { - } - - override fun bufferInfoUpdated(bufferInfo: BufferInfo) { - session.bufferSyncer.bufferInfoUpdated(bufferInfo) - } - - override fun identityCreated(identity: QVariantMap) = session.addIdentity(identity) - override fun identityRemoved(identityId: IdentityId) = session.removeIdentity(identityId) - - override fun networkCreated(networkId: NetworkId) = session.addNetwork(networkId) - override fun networkRemoved(networkId: NetworkId) = session.removeNetwork(networkId) - - private val passwordChangedSubject = ReusableUnicastSubject.create<Boolean>() - val passwordChanged = passwordChangedSubject.publish().refCount() - - override fun passwordChanged(ignored: Long, success: Boolean) { - passwordChangedSubject.onNext(success) - } - - override fun disconnectFromCore() { - session.disconnectFromCore() - } - - override fun objectRenamed(classname: ByteBuffer, newname: String?, oldname: String?) { - session.proxy.renameObject(classname.deserializeString(StringSerializer.UTF8) ?: "", - newname ?: "", - oldname ?: "") - } - - override fun displayMsg(message: Message) { - session.bufferSyncer.bufferInfoUpdated(message.bufferInfo) - backlogStorage?.storeMessages(session, message) - notificationManager?.processMessages(session, true, message) - } - - override fun createIdentity(identity: Identity, additional: QVariantMap) = - RPC( - "2createIdentity(Identity,QVariantMap)", - ARG(identity.toVariantMap(), QType.Identity), - ARG(additional, Type.QVariantMap) - ) - - override fun removeIdentity(identityId: IdentityId) = - RPC( - "2removeIdentity(IdentityId)", - ARG(identityId, QType.IdentityId) - ) - - override fun createNetwork(networkInfo: INetwork.NetworkInfo, channels: List<String>) = - RPC( - "2createNetwork(NetworkInfo,QStringList)", - ARG(networkInfo.toVariantMap(), QType.NetworkInfo), - ARG(channels, Type.QStringList) - ) - - override fun removeNetwork(networkId: NetworkId) = - RPC( - "2removeNetwork(NetworkId)", - ARG(networkId, QType.NetworkId) - ) - - override fun changePassword(peerPtr: Long, user: String?, old: String?, new: String?) = - RPC( - "2changePassword(PeerPtr,QString,QString,QString)", - ARG(peerPtr, QType.PeerPtr), - ARG(user, Type.QString), - ARG(old, Type.QString), - ARG(new, Type.QString) - ) - - override fun requestKickClient(id: Int) = - RPC( - "2kickClient(int)", - ARG(id, Type.Int) - ) - - override fun sendInput(bufferInfo: BufferInfo, message: String?) = - RPC( - "2sendInput(BufferInfo,QString)", - ARG(bufferInfo, QType.BufferInfo), - ARG(message, Type.QString) - ) - - inline fun RPC(function: String, vararg arg: QVariant_) { - // Don’t transmit calls back that we just got from the network - if (session.proxy.shouldRpc(function)) - session.proxy.callRpc(function, arg.toList()) - } -} diff --git a/lib/src/main/java/de/kuschku/libquassel/quassel/syncables/SyncableObject.kt b/lib/src/main/java/de/kuschku/libquassel/quassel/syncables/SyncableObject.kt deleted file mode 100644 index e0d1009839e5464c287715fdaa17c199f1383430..0000000000000000000000000000000000000000 --- a/lib/src/main/java/de/kuschku/libquassel/quassel/syncables/SyncableObject.kt +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.libquassel.quassel.syncables - -import de.kuschku.libquassel.quassel.syncables.interfaces.ISyncableObject -import de.kuschku.libquassel.session.SignalProxy -import de.kuschku.libquassel.util.helper.safeValue -import io.reactivex.Observable -import io.reactivex.subjects.BehaviorSubject - -abstract class SyncableObject( - override var proxy: SignalProxy, - final override val className: String -) : ISyncableObject { - final override var objectName: String = "" - private set - override var identifier = Pair(className, objectName) - override var initialized: Boolean - get() = _liveInitialized.safeValue - set(value) { - _liveInitialized.onNext(value) - } - - private val _liveInitialized = BehaviorSubject.createDefault(false) - override val liveInitialized: Observable<Boolean> - get() = _liveInitialized - - protected fun renameObject(newName: String) { - val oldName = objectName - if (!initialized) { - objectName = newName - identifier = Pair(className, objectName) - } else if (oldName != newName) { - objectName = newName - identifier = Pair(className, objectName) - proxy.renameObject(this, newName, oldName) - } - } - - override fun deinit() { - this.proxy = SignalProxy.NULL - } - - override fun toString() = "${identifier.first}:${identifier.second}" -} diff --git a/lib/src/main/java/de/kuschku/libquassel/quassel/syncables/interfaces/IAliasManager.kt b/lib/src/main/java/de/kuschku/libquassel/quassel/syncables/interfaces/IAliasManager.kt deleted file mode 100644 index e1dee0f02b50ac5e4fdc5a7e13abe9fa6b29c12d..0000000000000000000000000000000000000000 --- a/lib/src/main/java/de/kuschku/libquassel/quassel/syncables/interfaces/IAliasManager.kt +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.libquassel.quassel.syncables.interfaces - -import de.kuschku.libquassel.annotations.Slot -import de.kuschku.libquassel.annotations.Syncable -import de.kuschku.libquassel.protocol.ARG -import de.kuschku.libquassel.protocol.QVariantMap -import de.kuschku.libquassel.protocol.Type -import de.kuschku.libquassel.quassel.BufferInfo -import java.io.Serializable - -@Syncable(name = "AliasManager") -interface IAliasManager : ISyncableObject { - fun initAliases(): QVariantMap - fun initSetAliases(aliases: QVariantMap) - @Slot - fun addAlias(name: String?, expansion: String?) { - SYNC("addAlias", ARG(name, Type.QString), ARG(expansion, Type.QString)) - } - - @Slot - override fun update(properties: QVariantMap) { - super.update(properties) - } - - data class Alias( - val name: String?, - val expansion: String? - ) : Serializable - - data class Command( - val buffer: BufferInfo, - val message: String - ) -} diff --git a/lib/src/main/java/de/kuschku/libquassel/quassel/syncables/interfaces/IBacklogManager.kt b/lib/src/main/java/de/kuschku/libquassel/quassel/syncables/interfaces/IBacklogManager.kt deleted file mode 100644 index 23f1f0898631b57fd8f65f3b6ab16c3366cc0e25..0000000000000000000000000000000000000000 --- a/lib/src/main/java/de/kuschku/libquassel/quassel/syncables/interfaces/IBacklogManager.kt +++ /dev/null @@ -1,103 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.libquassel.quassel.syncables.interfaces - -import de.kuschku.libquassel.annotations.Slot -import de.kuschku.libquassel.annotations.Syncable -import de.kuschku.libquassel.protocol.* -import de.kuschku.libquassel.protocol.Type - -@Syncable(name = "BacklogManager") -interface IBacklogManager : ISyncableObject { - @Slot - fun requestBacklog(bufferId: BufferId, first: MsgId = MsgId(-1), last: MsgId = MsgId(-1), - limit: Int = -1, additional: Int = 0) { - REQUEST( - "requestBacklog", ARG(bufferId, QType.BufferId), ARG(first, QType.MsgId), - ARG(last, QType.MsgId), ARG(limit, Type.Int), ARG(additional, Type.Int) - ) - } - - @Slot - fun requestBacklogFiltered(bufferId: BufferId, first: MsgId = MsgId(-1), - last: MsgId = MsgId(-1), limit: Int = -1, additional: Int = 0, - type: Int = -1, flags: Int = -1) { - REQUEST( - "requestBacklogFiltered", ARG(bufferId, QType.BufferId), ARG(first, QType.MsgId), - ARG(last, QType.MsgId), ARG(limit, Type.Int), ARG(additional, Type.Int), ARG(type, Type.Int), - ARG(flags, Type.Int) - ) - } - - @Slot - fun requestBacklogForward(bufferId: BufferId, first: MsgId = MsgId(-1), - last: MsgId = MsgId(-1), limit: Int = -1, - type: Int = -1, flags: Int = -1) { - REQUEST( - "requestBacklogForward", ARG(bufferId, QType.BufferId), ARG(first, QType.MsgId), - ARG(last, QType.MsgId), ARG(limit, Type.Int), ARG(type, Type.Int), - ARG(flags, Type.Int) - ) - } - - @Slot - fun requestBacklogAll(first: MsgId = MsgId(-1), last: MsgId = MsgId(-1), limit: Int = -1, - additional: Int = 0) { - REQUEST( - "requestBacklogAll", ARG(first, QType.MsgId), ARG(last, QType.MsgId), - ARG(limit, Type.Int), ARG(additional, Type.Int) - ) - } - - @Slot - fun requestBacklogAllFiltered(first: MsgId = MsgId(-1), last: MsgId = MsgId(-1), - limit: Int = -1, additional: Int = 0, type: Int = -1, - flags: Int = -1) { - REQUEST( - "requestBacklogAllFiltered", ARG(first, QType.MsgId), ARG(last, QType.MsgId), - ARG(limit, Type.Int), ARG(additional, Type.Int), ARG(type, Type.Int), ARG(flags, Type.Int) - ) - } - - @Slot - fun receiveBacklog(bufferId: BufferId, first: MsgId, last: MsgId, limit: Int, additional: Int, - messages: QVariantList) - - @Slot - fun receiveBacklogFiltered(bufferId: BufferId, first: MsgId, last: MsgId, limit: Int, - additional: Int, type: Int, flags: Int, messages: QVariantList) - - @Slot - fun receiveBacklogForward(bufferId: BufferId, first: MsgId, last: MsgId, limit: Int, - type: Int, flags: Int, messages: QVariantList) - - @Slot - fun receiveBacklogAll(first: MsgId, last: MsgId, limit: Int, additional: Int, - messages: QVariantList) - - @Slot - fun receiveBacklogAllFiltered(first: MsgId, last: MsgId, limit: Int, additional: Int, type: Int, - flags: Int, messages: QVariantList) - - @Slot - override fun update(properties: QVariantMap) { - super.update(properties) - } -} diff --git a/lib/src/main/java/de/kuschku/libquassel/quassel/syncables/interfaces/IBufferSyncer.kt b/lib/src/main/java/de/kuschku/libquassel/quassel/syncables/interfaces/IBufferSyncer.kt deleted file mode 100644 index ea9350f31f0539594d02f72630f1b7993a743044..0000000000000000000000000000000000000000 --- a/lib/src/main/java/de/kuschku/libquassel/quassel/syncables/interfaces/IBufferSyncer.kt +++ /dev/null @@ -1,114 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.libquassel.quassel.syncables.interfaces - -import de.kuschku.libquassel.annotations.Slot -import de.kuschku.libquassel.annotations.Syncable -import de.kuschku.libquassel.protocol.* -import de.kuschku.libquassel.protocol.Type - -@Syncable(name = "BufferSyncer") -interface IBufferSyncer : ISyncableObject { - fun initActivities(): QVariantList - fun initHighlightCounts(): QVariantList - fun initLastSeenMsg(): QVariantList - fun initMarkerLines(): QVariantList - fun initSetActivities(data: QVariantList) - fun initSetHighlightCounts(data: QVariantList) - fun initSetLastSeenMsg(data: QVariantList) - fun initSetMarkerLines(data: QVariantList) - - @Slot - fun markBufferAsRead(buffer: BufferId) { - SYNC("markBufferAsRead", ARG(buffer, QType.BufferId)) - } - - @Slot - fun mergeBuffersPermanently(buffer1: BufferId, buffer2: BufferId) - - @Slot - fun removeBuffer(buffer: BufferId) - - @Slot - fun renameBuffer(buffer: BufferId, newName: String?) - - @Slot - fun requestMarkBufferAsRead(buffer: BufferId) { - REQUEST("requestMarkBufferAsRead", ARG(buffer, QType.BufferId)) - } - - @Slot - fun requestMergeBuffersPermanently(buffer1: BufferId, buffer2: BufferId) { - REQUEST( - "requestMergeBuffersPermanently", ARG(buffer1, QType.BufferId), - ARG(buffer2, QType.BufferId) - ) - } - - @Slot - fun requestPurgeBufferIds() { - REQUEST("requestPurgeBufferIds") - } - - @Slot - fun requestRemoveBuffer(buffer: BufferId) { - REQUEST("requestRemoveBuffer", ARG(buffer, QType.BufferId)) - } - - @Slot - fun requestRenameBuffer(buffer: BufferId, newName: String) { - REQUEST("requestRenameBuffer", ARG(buffer, QType.BufferId), ARG(newName, Type.QString)) - } - - @Slot - fun requestSetLastSeenMsg(buffer: BufferId, msgId: MsgId) { - REQUEST("requestSetLastSeenMsg", ARG(buffer, QType.BufferId), ARG(msgId, QType.MsgId)) - } - - @Slot - fun requestSetMarkerLine(buffer: BufferId, msgId: MsgId) { - REQUEST("requestSetMarkerLine", ARG(buffer, QType.BufferId), ARG(msgId, QType.MsgId)) - } - - @Slot - fun setBufferActivity(buffer: BufferId, activity: Int) { - SYNC("setBufferActivity", ARG(buffer, QType.BufferId), ARG(activity, Type.Int)) - } - - @Slot - fun setHighlightCount(buffer: BufferId, count: Int) { - SYNC("setHighlightCount", ARG(buffer, QType.BufferId), ARG(count, Type.Int)) - } - - @Slot - fun setLastSeenMsg(buffer: BufferId, msgId: MsgId) { - SYNC("setLastSeenMsg", ARG(buffer, QType.BufferId), ARG(msgId, QType.MsgId)) - } - - @Slot - fun setMarkerLine(buffer: BufferId, msgId: MsgId) { - SYNC("setMarkerLine", ARG(buffer, QType.BufferId), ARG(msgId, QType.MsgId)) - } - - @Slot - override fun update(properties: QVariantMap) { - super.update(properties) - } -} diff --git a/lib/src/main/java/de/kuschku/libquassel/quassel/syncables/interfaces/IBufferViewConfig.kt b/lib/src/main/java/de/kuschku/libquassel/quassel/syncables/interfaces/IBufferViewConfig.kt deleted file mode 100644 index 203de5c80434da226e12050c2d896ecd629d8b4e..0000000000000000000000000000000000000000 --- a/lib/src/main/java/de/kuschku/libquassel/quassel/syncables/interfaces/IBufferViewConfig.kt +++ /dev/null @@ -1,130 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.libquassel.quassel.syncables.interfaces - -import de.kuschku.libquassel.annotations.Slot -import de.kuschku.libquassel.annotations.Syncable -import de.kuschku.libquassel.protocol.* -import de.kuschku.libquassel.protocol.Type - -@Syncable(name = "BufferViewConfig") -interface IBufferViewConfig : ISyncableObject { - fun initBufferList(): QVariantList - fun initRemovedBuffers(): QVariantList - fun initTemporarilyRemovedBuffers(): QVariantList - fun initSetBufferList(buffers: QVariantList) - fun initSetRemovedBuffers(buffers: QVariantList) - fun initSetTemporarilyRemovedBuffers(buffers: QVariantList) - - fun initProperties(): QVariantMap - fun initSetProperties(properties: QVariantMap) - - @Slot - fun addBuffer(bufferId: BufferId, pos: Int) - - @Slot - fun moveBuffer(bufferId: BufferId, pos: Int) - - @Slot - fun removeBuffer(bufferId: BufferId) - - @Slot - fun removeBufferPermanently(bufferId: BufferId) - - @Slot - fun requestAddBuffer(bufferId: BufferId, pos: Int) { - REQUEST("requestAddBuffer", ARG(bufferId, QType.BufferId), ARG(pos, Type.Int)) - } - - @Slot - fun requestMoveBuffer(bufferId: BufferId, pos: Int) { - REQUEST("requestMoveBuffer", ARG(bufferId, QType.BufferId), ARG(pos, Type.Int)) - } - - @Slot - fun requestRemoveBuffer(bufferId: BufferId) { - REQUEST("requestRemoveBuffer", ARG(bufferId, QType.BufferId)) - } - - @Slot - fun requestRemoveBufferPermanently(bufferId: BufferId) { - REQUEST("requestRemoveBufferPermanently", ARG(bufferId, QType.BufferId)) - } - - @Slot - fun requestSetBufferViewName(bufferViewName: String?) { - REQUEST("requestSetBufferViewName", ARG(bufferViewName, Type.QString)) - } - - @Slot - fun setAddNewBuffersAutomatically(addNewBuffersAutomatically: Boolean) { - SYNC("setAddNewBuffersAutomatically", ARG(addNewBuffersAutomatically, Type.Bool)) - } - - @Slot - fun setAllowedBufferTypes(bufferTypes: Int) { - SYNC("setAllowedBufferTypes", ARG(bufferTypes, Type.Int)) - } - - @Slot - fun setBufferViewName(bufferViewName: String?) { - SYNC("setBufferViewName", ARG(bufferViewName, Type.QString)) - } - - @Slot - fun setDisableDecoration(disableDecoration: Boolean) { - SYNC("setDisableDecoration", ARG(disableDecoration, Type.Bool)) - } - - @Slot - fun setHideInactiveBuffers(hideInactiveBuffers: Boolean) { - SYNC("setHideInactiveBuffers", ARG(hideInactiveBuffers, Type.Bool)) - } - - @Slot - fun setHideInactiveNetworks(hideInactiveNetworks: Boolean) { - SYNC("setHideInactiveNetworks", ARG(hideInactiveNetworks, Type.Bool)) - } - - @Slot - fun setMinimumActivity(activity: Int) { - SYNC("setMinimumActivity", ARG(activity, Type.Int)) - } - - @Slot - fun setNetworkId(networkId: NetworkId) { - SYNC("setNetworkId", ARG(networkId, QType.NetworkId)) - } - - @Slot - fun setShowSearch(showSearch: Boolean) { - SYNC("setShowSearch", ARG(showSearch, Type.Bool)) - } - - @Slot - fun setSortAlphabetically(sortAlphabetically: Boolean) { - SYNC("setSortAlphabetically", ARG(sortAlphabetically, Type.Bool)) - } - - @Slot - override fun update(properties: QVariantMap) { - super.update(properties) - } -} diff --git a/lib/src/main/java/de/kuschku/libquassel/quassel/syncables/interfaces/IBufferViewManager.kt b/lib/src/main/java/de/kuschku/libquassel/quassel/syncables/interfaces/IBufferViewManager.kt deleted file mode 100644 index 684b8da94bebca94f7a7d98b5706cbb3cbb3776e..0000000000000000000000000000000000000000 --- a/lib/src/main/java/de/kuschku/libquassel/quassel/syncables/interfaces/IBufferViewManager.kt +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.libquassel.quassel.syncables.interfaces - -import de.kuschku.libquassel.annotations.Slot -import de.kuschku.libquassel.annotations.Syncable -import de.kuschku.libquassel.protocol.ARG -import de.kuschku.libquassel.protocol.QVariantList -import de.kuschku.libquassel.protocol.QVariantMap -import de.kuschku.libquassel.protocol.Type -import de.kuschku.libquassel.quassel.syncables.BufferViewConfig - -@Syncable(name = "BufferViewManager") -interface IBufferViewManager : ISyncableObject { - fun initBufferViewIds(): QVariantList - fun initSetBufferViewIds(bufferViewIds: QVariantList) - - fun addBufferViewConfig(config: BufferViewConfig) - - @Slot - fun addBufferViewConfig(bufferViewConfigId: Int) - - @Slot - fun deleteBufferViewConfig(bufferViewConfigId: Int) - - @Slot - fun newBufferViewConfig(bufferViewConfigId: Int) { - addBufferViewConfig(bufferViewConfigId) - } - - @Slot - fun requestCreateBufferView(properties: QVariantMap) { - REQUEST("requestCreateBufferView", ARG(properties, Type.QVariantMap)) - } - - @Slot - fun requestCreateBufferViews(properties: QVariantList) { - REQUEST("requestCreateBufferViews", ARG(properties, Type.QVariantList)) - } - - @Slot - fun requestDeleteBufferView(bufferViewId: Int) { - REQUEST("requestDeleteBufferView", ARG(bufferViewId, Type.Int)) - } - - @Slot - fun requestDeleteBufferViews(bufferViews: QVariantList) { - REQUEST("requestDeleteBufferViews", ARG(bufferViews, Type.QVariantList)) - } - - @Slot - override fun update(properties: QVariantMap) { - super.update(properties) - } -} diff --git a/lib/src/main/java/de/kuschku/libquassel/quassel/syncables/interfaces/ICertManager.kt b/lib/src/main/java/de/kuschku/libquassel/quassel/syncables/interfaces/ICertManager.kt deleted file mode 100644 index e718508f49b035b2d69d2b986be9f32b5e96bb5a..0000000000000000000000000000000000000000 --- a/lib/src/main/java/de/kuschku/libquassel/quassel/syncables/interfaces/ICertManager.kt +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.libquassel.quassel.syncables.interfaces - -import de.kuschku.libquassel.annotations.Slot -import de.kuschku.libquassel.annotations.Syncable -import de.kuschku.libquassel.protocol.ARG -import de.kuschku.libquassel.protocol.QVariantMap -import de.kuschku.libquassel.protocol.Type -import java.nio.ByteBuffer - -@Syncable(name = "CertManager") -interface ICertManager : ISyncableObject { - - fun initProperties(): QVariantMap - fun initSetProperties(properties: QVariantMap) - - @Slot - fun setSslCert(encoded: ByteBuffer?) { - SYNC("setSslCert", ARG(encoded, Type.QByteArray)) - } - - @Slot - fun setSslKey(encoded: ByteBuffer?) { - SYNC("setSslKey", ARG(encoded, Type.QByteArray)) - } - - @Slot - override fun update(properties: QVariantMap) { - super.update(properties) - } -} diff --git a/lib/src/main/java/de/kuschku/libquassel/quassel/syncables/interfaces/ICoreInfo.kt b/lib/src/main/java/de/kuschku/libquassel/quassel/syncables/interfaces/ICoreInfo.kt deleted file mode 100644 index 913aafcc39dc9cc4fea6c739573b9917af0a8098..0000000000000000000000000000000000000000 --- a/lib/src/main/java/de/kuschku/libquassel/quassel/syncables/interfaces/ICoreInfo.kt +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.libquassel.quassel.syncables.interfaces - -import de.kuschku.libquassel.annotations.Slot -import de.kuschku.libquassel.annotations.Syncable -import de.kuschku.libquassel.protocol.ARG -import de.kuschku.libquassel.protocol.QVariantMap -import de.kuschku.libquassel.protocol.Type - -@Syncable(name = "CoreInfo") -interface ICoreInfo : ISyncableObject { - - fun initProperties(): QVariantMap - fun initSetProperties(properties: QVariantMap) - - @Slot - fun setCoreData(data: QVariantMap) { - SYNC("setCoreData", ARG(data, Type.QVariantMap)) - } - - @Slot - override fun update(properties: QVariantMap) { - super.update(properties) - } -} diff --git a/lib/src/main/java/de/kuschku/libquassel/quassel/syncables/interfaces/IDccConfig.kt b/lib/src/main/java/de/kuschku/libquassel/quassel/syncables/interfaces/IDccConfig.kt deleted file mode 100644 index 1ec2a3243340672e193e10268ecd06384dc83697..0000000000000000000000000000000000000000 --- a/lib/src/main/java/de/kuschku/libquassel/quassel/syncables/interfaces/IDccConfig.kt +++ /dev/null @@ -1,120 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.libquassel.quassel.syncables.interfaces - -import de.kuschku.libquassel.annotations.Slot -import de.kuschku.libquassel.annotations.Syncable -import de.kuschku.libquassel.protocol.ARG -import de.kuschku.libquassel.protocol.QType -import de.kuschku.libquassel.protocol.QVariantMap -import de.kuschku.libquassel.protocol.Type -import java.net.InetAddress - -@Syncable(name = "DccConfig") -interface IDccConfig : ISyncableObject { - - fun initProperties(): QVariantMap - fun initSetProperties(properties: QVariantMap) - - @Slot - fun setDccEnabled(enabled: Boolean) { - SYNC("setDccEnabled", ARG(enabled, Type.Bool)) - } - - @Slot - fun setOutgoingIp(outgoingIp: InetAddress) { - SYNC("setOutgoingIp", ARG(outgoingIp, QType.QHostAddress)) - } - - @Slot - fun setIpDetectionMode(ipDetectionMode: IpDetectionMode) { - SYNC("setIpDetectionMode", ARG(ipDetectionMode, QType.DccConfig_IpDetectionMode)) - } - - @Slot - fun setPortSelectionMode(portSelectionMode: PortSelectionMode) { - SYNC("setPortSelectionMode", ARG(portSelectionMode, QType.DccConfig_PortSelectionMode)) - } - - @Slot - fun setMinPort(port: UShort) { - SYNC("setMinPort", ARG(port, Type.UShort)) - } - - @Slot - fun setMaxPort(port: UShort) { - SYNC("setMaxPort", ARG(port, Type.UShort)) - } - - @Slot - fun setChunkSize(chunkSize: Int) { - SYNC("setChunkSize", ARG(chunkSize, Type.Int)) - } - - @Slot - fun setSendTimeout(timeout: Int) { - SYNC("setSendTimeout", ARG(timeout, Type.Int)) - } - - @Slot - fun setUsePassiveDcc(use: Boolean) { - SYNC("setUsePassiveDcc", ARG(use, Type.Bool)) - } - - @Slot - fun setUseFastSend(use: Boolean) { - SYNC("setUseFastSend", ARG(use, Type.Bool)) - } - - @Slot - override fun update(properties: QVariantMap) { - super.update(properties) - } - - /** - * Mode for detecting the outgoing IP - */ - enum class IpDetectionMode(val value: UByte) { - /** Automatic detection (network socket or USERHOST) */ - Automatic(0x00u), - /** Manually specified IP */ - Manual(0x01u); - - companion object { - private val byId = IpDetectionMode.values().associateBy(IpDetectionMode::value) - fun of(value: UByte) = byId[value] ?: Automatic - } - } - - /** - * Mode for selecting the port range for DCC - */ - enum class PortSelectionMode(val value: UByte) { - /** Automatic port selection */ - Automatic(0x00u), - /** Manually specified port range */ - Manual(0x01u); - - companion object { - private val byId = PortSelectionMode.values().associateBy(PortSelectionMode::value) - fun of(value: UByte) = byId[value] ?: Automatic - } - } -} diff --git a/lib/src/main/java/de/kuschku/libquassel/quassel/syncables/interfaces/IHighlightRuleManager.kt b/lib/src/main/java/de/kuschku/libquassel/quassel/syncables/interfaces/IHighlightRuleManager.kt deleted file mode 100644 index 72d1246105e8de5b9a194fce0477b2e354df1bc8..0000000000000000000000000000000000000000 --- a/lib/src/main/java/de/kuschku/libquassel/quassel/syncables/interfaces/IHighlightRuleManager.kt +++ /dev/null @@ -1,114 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.libquassel.quassel.syncables.interfaces - -import de.kuschku.libquassel.annotations.Slot -import de.kuschku.libquassel.annotations.Syncable -import de.kuschku.libquassel.protocol.ARG -import de.kuschku.libquassel.protocol.QVariantMap -import de.kuschku.libquassel.protocol.Type - -@Syncable(name = "HighlightRuleManager") -interface IHighlightRuleManager : ISyncableObject { - enum class HighlightNickType(val value: Int) { - NoNick(0x00), - CurrentNick(0x01), - AllNicks(0x02); - - companion object { - private val map = values().associateBy(HighlightNickType::value) - fun of(value: Int) = map[value] - } - } - - fun initHighlightRuleList(): QVariantMap - fun initSetHighlightRuleList(highlightRuleList: QVariantMap) - - /** - * Request removal of an ignore rule based on the rule itself. - * Use this method if you want to remove a single ignore rule - * and get that synced with the core immediately. - * @param highlightRule A valid ignore rule - */ - @Slot - fun requestRemoveHighlightRule(highlightRule: Int) { - REQUEST("requestRemoveHighlightRule", ARG(highlightRule, Type.Int)) - } - - @Slot - fun removeHighlightRule(highlightRule: Int) - - /** - * Request toggling of "isEnabled" flag of a given ignore rule. - * Use this method if you want to toggle the "isEnabled" flag of a single ignore rule - * and get that synced with the core immediately. - * @param highlightRule A valid ignore rule - */ - @Slot - fun requestToggleHighlightRule(highlightRule: Int) { - REQUEST("requestToggleHighlightRule", ARG(highlightRule, Type.Int)) - } - - @Slot - fun toggleHighlightRule(highlightRule: Int) - - /** - * Request an HighlightRule to be added to the ignore list - * Items added to the list with this method, get immediately synced with the core - * @param name The rule - * @param isRegEx If the rule should be interpreted as a nickname, or a regex - * @param isCaseSensitive If the rule should be interpreted as case-sensitive - * @param isEnabled If the rule is active - * @param chanName The channel in which the rule should apply - */ - @Slot - fun requestAddHighlightRule(id: Int, name: String?, isRegEx: Boolean, isCaseSensitive: Boolean, - isEnabled: Boolean, isInverse: Boolean, sender: String?, - chanName: String?) { - REQUEST("requestAddHighlightRule", ARG(id, Type.Int), ARG(name, Type.QString), - ARG(isRegEx, Type.Bool), ARG(isCaseSensitive, Type.Bool), ARG(isEnabled, Type.Bool), - ARG(isInverse, Type.Bool), ARG(sender, Type.QString), ARG(chanName, Type.QString)) - } - - @Slot - fun addHighlightRule(id: Int, name: String?, isRegEx: Boolean, isCaseSensitive: Boolean, - isEnabled: Boolean, isInverse: Boolean, sender: String?, chanName: String?) - - @Slot - fun requestSetHighlightNick(highlightNick: Int) { - REQUEST("requestSetHighlightNick", ARG(highlightNick, Type.Int)) - } - - @Slot - fun setHighlightNick(highlightNick: Int) - - @Slot - fun requestSetNicksCaseSensitive(nicksCaseSensitive: Boolean) { - REQUEST("requestSetNicksCaseSensitive", ARG(nicksCaseSensitive, Type.Bool)) - } - - @Slot - fun setNicksCaseSensitive(nicksCaseSensitive: Boolean) - - @Slot - override fun update(properties: QVariantMap) { - super.update(properties) - } -} diff --git a/lib/src/main/java/de/kuschku/libquassel/quassel/syncables/interfaces/IIdentity.kt b/lib/src/main/java/de/kuschku/libquassel/quassel/syncables/interfaces/IIdentity.kt deleted file mode 100644 index 9261ae8f1ac1b61ac07890ea516bbca090d5a1d4..0000000000000000000000000000000000000000 --- a/lib/src/main/java/de/kuschku/libquassel/quassel/syncables/interfaces/IIdentity.kt +++ /dev/null @@ -1,137 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.libquassel.quassel.syncables.interfaces - -import de.kuschku.libquassel.annotations.Slot -import de.kuschku.libquassel.annotations.Syncable -import de.kuschku.libquassel.protocol.* -import de.kuschku.libquassel.protocol.Type - -@Syncable(name = "Identity") -interface IIdentity : ISyncableObject { - - fun initProperties(): QVariantMap - fun initSetProperties(properties: QVariantMap) - - @Slot - fun copyFrom(other: IIdentity) { - SYNC("copyFrom", ARG(other, QType.Identity)) - } - - @Slot - fun setAutoAwayEnabled(enabled: Boolean) { - SYNC("setAutoAwayEnabled", ARG(enabled, Type.Bool)) - } - - @Slot - fun setAutoAwayReason(reason: String?) { - SYNC("setAutoAwayReason", ARG(reason, Type.QString)) - } - - @Slot - fun setAutoAwayReasonEnabled(enabled: Boolean) { - SYNC("setAutoAwayReasonEnabled", ARG(enabled, Type.Bool)) - } - - @Slot - fun setAutoAwayTime(time: Int) { - SYNC("setAutoAwayTime", ARG(time, Type.Int)) - } - - @Slot - fun setAwayNick(awayNick: String?) { - SYNC("setAwayNick", ARG(awayNick, Type.QString)) - } - - @Slot - fun setAwayNickEnabled(enabled: Boolean) { - SYNC("setAwayNickEnabled", ARG(enabled, Type.Bool)) - } - - @Slot - fun setAwayReason(awayReason: String?) { - SYNC("setAwayReason", ARG(awayReason, Type.QString)) - } - - @Slot - fun setAwayReasonEnabled(enabled: Boolean) { - SYNC("setAwayReasonEnabled", ARG(enabled, Type.Bool)) - } - - @Slot - fun setDetachAwayEnabled(enabled: Boolean) { - SYNC("setDetachAwayEnabled", ARG(enabled, Type.Bool)) - } - - @Slot - fun setDetachAwayReason(reason: String?) { - SYNC("setDetachAwayReason", ARG(reason, Type.QString)) - } - - @Slot - fun setDetachAwayReasonEnabled(enabled: Boolean) { - SYNC("setDetachAwayReasonEnabled", ARG(enabled, Type.Bool)) - } - - @Slot - fun setId(id: IdentityId) { - SYNC("setId", ARG(id, QType.IdentityId)) - } - - @Slot - fun setIdent(ident: String?) { - SYNC("setIdent", ARG(ident, Type.QString)) - } - - @Slot - fun setIdentityName(name: String?) { - SYNC("setIdentityName", ARG(name, Type.QString)) - } - - @Slot - fun setKickReason(reason: String?) { - SYNC("setKickReason", ARG(reason, Type.QString)) - } - - @Slot - fun setNicks(nicks: QStringList) { - SYNC("setNicks", ARG(nicks, Type.QStringList)) - } - - @Slot - fun setPartReason(reason: String?) { - SYNC("setPartReason", ARG(reason, Type.QString)) - } - - @Slot - fun setQuitReason(reason: String?) { - SYNC("setQuitReason", ARG(reason, Type.QString)) - } - - @Slot - fun setRealName(realName: String?) { - SYNC("setRealName", ARG(realName, Type.QString)) - } - - @Slot - override fun update(properties: QVariantMap) { - super.update(properties) - } -} diff --git a/lib/src/main/java/de/kuschku/libquassel/quassel/syncables/interfaces/IIgnoreListManager.kt b/lib/src/main/java/de/kuschku/libquassel/quassel/syncables/interfaces/IIgnoreListManager.kt deleted file mode 100644 index e07b741fac9b9680d89cd59d372d84670d670fb0..0000000000000000000000000000000000000000 --- a/lib/src/main/java/de/kuschku/libquassel/quassel/syncables/interfaces/IIgnoreListManager.kt +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.libquassel.quassel.syncables.interfaces - -import de.kuschku.libquassel.annotations.Slot -import de.kuschku.libquassel.annotations.Syncable -import de.kuschku.libquassel.protocol.ARG -import de.kuschku.libquassel.protocol.QVariantMap -import de.kuschku.libquassel.protocol.Type - -@Syncable(name = "IgnoreListManager") -interface IIgnoreListManager : ISyncableObject { - fun initIgnoreList(): QVariantMap - fun initSetIgnoreList(ignoreList: QVariantMap) - - @Slot - fun addIgnoreListItem(type: Int, ignoreRule: String?, isRegEx: Boolean, strictness: Int, - scope: Int, scopeRule: String?, isActive: Boolean) - - @Slot - fun removeIgnoreListItem(ignoreRule: String?) - - @Slot - fun requestAddIgnoreListItem(type: Int, ignoreRule: String?, isRegEx: Boolean, strictness: Int, - scope: Int, scopeRule: String?, isActive: Boolean) { - REQUEST( - "requestAddIgnoreListItem", ARG(type, Type.Int), ARG(ignoreRule, Type.QString), - ARG(isRegEx, Type.Bool), - ARG(strictness, Type.Int), ARG(scope, Type.Int), ARG(scopeRule, Type.QString), - ARG(isActive, Type.Bool) - ) - } - - @Slot - fun requestRemoveIgnoreListItem(ignoreRule: String?) { - REQUEST("requestRemoveIgnoreListItem", ARG(ignoreRule, Type.QString)) - } - - @Slot - fun requestToggleIgnoreRule(ignoreRule: String?) { - REQUEST("requestToggleIgnoreRule", ARG(ignoreRule, Type.QString)) - } - - @Slot - fun toggleIgnoreRule(ignoreRule: String?) - - @Slot - override fun update(properties: QVariantMap) { - super.update(properties) - } -} diff --git a/lib/src/main/java/de/kuschku/libquassel/quassel/syncables/interfaces/IIrcChannel.kt b/lib/src/main/java/de/kuschku/libquassel/quassel/syncables/interfaces/IIrcChannel.kt deleted file mode 100644 index 6ab1b73addfc29ff371806d8d3db08ae0664fa3f..0000000000000000000000000000000000000000 --- a/lib/src/main/java/de/kuschku/libquassel/quassel/syncables/interfaces/IIrcChannel.kt +++ /dev/null @@ -1,81 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.libquassel.quassel.syncables.interfaces - -import de.kuschku.libquassel.annotations.Slot -import de.kuschku.libquassel.annotations.Syncable -import de.kuschku.libquassel.protocol.QStringList -import de.kuschku.libquassel.protocol.QVariantMap -import de.kuschku.libquassel.quassel.syncables.IrcUser - -@Syncable(name = "IrcChannel") -interface IIrcChannel : ISyncableObject { - fun initChanModes(): QVariantMap - fun initUserModes(): QVariantMap - fun initSetChanModes(chanModes: QVariantMap) - fun initSetUserModes(usermodes: QVariantMap) - - fun initProperties(): QVariantMap - fun initSetProperties(properties: QVariantMap, i: Int? = null) - - @Slot - fun addChannelMode(mode: Char, value: String? = null) - - fun addUserMode(ircuser: IrcUser?, mode: String? = null) - - @Slot - fun addUserMode(nick: String?, mode: String? = null) - - @Slot - fun joinIrcUser(ircuser: IrcUser) - - @Slot - fun joinIrcUsers(nicks: QStringList, modes: QStringList) - - fun part(ircuser: IrcUser?) - - @Slot - fun part(nick: String?) - - @Slot - fun removeChannelMode(mode: Char, value: String? = null) - - fun removeUserMode(ircuser: IrcUser?, mode: String? = null) - - @Slot - fun removeUserMode(nick: String?, mode: String? = null) - - @Slot - fun setEncrypted(encrypted: Boolean) - - @Slot - fun setPassword(password: String?) - - @Slot - fun setTopic(topic: String?) - - fun setUserModes(ircuser: IrcUser?, modes: String? = null) - - @Slot - fun setUserModes(nick: String?, modes: String? = null) - - @Slot - override fun update(properties: QVariantMap) -} diff --git a/lib/src/main/java/de/kuschku/libquassel/quassel/syncables/interfaces/IIrcListHelper.kt b/lib/src/main/java/de/kuschku/libquassel/quassel/syncables/interfaces/IIrcListHelper.kt deleted file mode 100644 index 5bce5c45413a9b92f83db1d687667e534f33db9a..0000000000000000000000000000000000000000 --- a/lib/src/main/java/de/kuschku/libquassel/quassel/syncables/interfaces/IIrcListHelper.kt +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.libquassel.quassel.syncables.interfaces - -import de.kuschku.libquassel.annotations.Slot -import de.kuschku.libquassel.annotations.Syncable -import de.kuschku.libquassel.protocol.* -import de.kuschku.libquassel.protocol.Type - -@Syncable(name = "IrcListHelper") -interface IIrcListHelper : ISyncableObject { - @Slot - fun requestChannelList(netId: NetworkId, channelFilters: QStringList): QVariantList { - REQUEST( - "requestChannelList", ARG(netId, QType.NetworkId), - ARG(channelFilters, Type.QStringList) - ) - return emptyList() - } - - @Slot - fun receiveChannelList(netId: NetworkId, channelFilters: QStringList, channels: QVariantList) - - @Slot - fun reportError(error: String?) { - SYNC("reportError", ARG(error, Type.QString)) - } - - @Slot - fun reportFinishedList(netId: NetworkId) { - SYNC("reportFinishedList", ARG(netId, QType.NetworkId)) - } - - @Slot - override fun update(properties: QVariantMap) { - super.update(properties) - } -} diff --git a/lib/src/main/java/de/kuschku/libquassel/quassel/syncables/interfaces/IIrcUser.kt b/lib/src/main/java/de/kuschku/libquassel/quassel/syncables/interfaces/IIrcUser.kt deleted file mode 100644 index c46794953f4f97919d0bae8388d1d0f41eae1088..0000000000000000000000000000000000000000 --- a/lib/src/main/java/de/kuschku/libquassel/quassel/syncables/interfaces/IIrcUser.kt +++ /dev/null @@ -1,107 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.libquassel.quassel.syncables.interfaces - -import de.kuschku.libquassel.annotations.Slot -import de.kuschku.libquassel.annotations.Syncable -import de.kuschku.libquassel.protocol.QVariantMap -import de.kuschku.libquassel.quassel.syncables.IrcChannel -import org.threeten.bp.temporal.Temporal - -@Syncable(name = "IrcUser") -interface IIrcUser : ISyncableObject { - fun initProperties(): QVariantMap - fun initSetProperties(properties: QVariantMap, index: Int? = null) - @Slot - fun addUserModes(modes: String?) - - fun joinChannel(channel: IrcChannel, skip_channel_join: Boolean = false) - @Slot - fun joinChannel(channelname: String?) - - fun partChannel(channel: IrcChannel) - @Slot - fun partChannel(channelname: String?) - - @Slot - fun quit() - - @Slot - fun removeUserModes(modes: String?) - - @Slot - fun setAccount(account: String?) - - @Slot - fun setAway(away: Boolean) - - @Slot - fun setAwayMessage(awayMessage: String?) - - @Slot - fun setEncrypted(encrypted: Boolean) - - @Slot - fun setHost(host: String?) - - @Slot - fun setIdleTime(idleTime: Temporal) - - @Slot - fun setIrcOperator(ircOperator: String?) - - @Slot - fun setLastAwayMessage(lastAwayMessage: Int) - - @Slot - fun setLastAwayMessageTime(lastAwayMessageTime: Temporal) - - @Slot - fun setLoginTime(loginTime: Temporal) - - @Slot - fun setNick(nick: String?) - - @Slot - fun setRealName(realName: String?) - - @Slot - fun setServer(server: String?) - - @Slot - fun setSuserHost(suserHost: String?) - - @Slot - fun setUser(user: String?) - - @Slot - fun setUserModes(modes: String?) - - @Slot - fun setWhoisServiceReply(whoisServiceReply: String?) - - @Slot - fun updateHostmask(mask: String?) - - @Slot - override fun update(properties: QVariantMap) { - super.update(properties) - } -} diff --git a/lib/src/main/java/de/kuschku/libquassel/quassel/syncables/interfaces/INetwork.kt b/lib/src/main/java/de/kuschku/libquassel/quassel/syncables/interfaces/INetwork.kt deleted file mode 100644 index 5ceac0d8cf84e742ce9690e820e07f46ce56adb3..0000000000000000000000000000000000000000 --- a/lib/src/main/java/de/kuschku/libquassel/quassel/syncables/interfaces/INetwork.kt +++ /dev/null @@ -1,512 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.libquassel.quassel.syncables.interfaces - -import de.kuschku.libquassel.annotations.Slot -import de.kuschku.libquassel.annotations.Syncable -import de.kuschku.libquassel.protocol.* -import de.kuschku.libquassel.protocol.primitive.serializer.StringSerializer -import de.kuschku.libquassel.util.flag.Flag -import de.kuschku.libquassel.util.flag.Flags -import de.kuschku.libquassel.util.helper.serializeString -import java.io.Serializable -import java.nio.ByteBuffer - -@Syncable(name = "Network") -interface INetwork : ISyncableObject { - fun initCapsEnabled(): QVariantList - fun initServerList(): QVariantList - fun initCaps(): QVariantMap - fun initIrcUsersAndChannels(): QVariantMap - fun initSupports(): QVariantMap - fun initSetCaps(caps: QVariantMap) - fun initSetCapsEnabled(capsEnabled: QVariantList) - fun initSetIrcUsersAndChannels(usersAndChannels: QVariantMap) - fun initSetServerList(serverList: QVariantList) - fun initSetSupports(supports: QVariantMap) - - fun initProperties(): QVariantMap - fun initSetProperties(properties: QVariantMap) - - @Slot - fun acknowledgeCap(capability: String?) - - @Slot - fun addCap(capability: String, value: String? = null) - - @Slot - fun addIrcChannel(channel: String?) - - @Slot - fun addIrcUser(hostmask: String?) - - @Slot - fun addSupport(param: String?, value: String? = null) - - @Slot - fun clearCaps() - - @Slot - fun emitConnectionError(error: String?) - - @Slot - fun ircUserNickChanged(old: String?, new: String?) - - @Slot - fun removeCap(capability: String?) - - @Slot - fun removeSupport(param: String?) - - @Slot - fun requestConnect() { - REQUEST("requestConnect") - } - - @Slot - fun requestDisconnect() { - REQUEST("requestDisconnect") - } - - @Slot - fun requestSetNetworkInfo(info: NetworkInfo) { - REQUEST("requestSetNetworkInfo", ARG(info.toVariantMap(), QType.NetworkInfo)) - } - - @Slot - fun setAutoIdentifyPassword(password: String?) - - @Slot - fun setAutoIdentifyService(service: String?) - - @Slot - fun setAutoReconnectInterval(interval: UInt) - - @Slot - fun setAutoReconnectRetries(retries: UShort) - - @Slot - fun setCodecForDecoding(codecName: ByteBuffer?) - - @Slot - fun setCodecForEncoding(codecName: ByteBuffer?) - - @Slot - fun setCodecForServer(codecName: ByteBuffer?) - - @Slot - fun setConnected(isConnected: Boolean) - - @Slot - fun setConnectionState(state: Int) = setConnectionState(ConnectionState.of(state)) - - fun setConnectionState(state: ConnectionState) - - @Slot - fun setCurrentServer(currentServer: String?) - - @Slot - fun setIdentity(identity: IdentityId) - - @Slot - fun setLatency(latency: Int) - - @Slot - fun setMessageRateBurstSize(burstSize: UInt) - - @Slot - fun setMessageRateDelay(messageDelay: UInt) - - @Slot - fun setMyNick(mynick: String?) - - @Slot - fun setNetworkName(networkName: String?) - - @Slot - fun setNetworkInfo(info: NetworkInfo) - - @Slot - fun setPerform(perform: QStringList) - - @Slot - fun setRejoinChannels(rejoinChannels: Boolean) - - @Slot - fun setSaslAccount(account: String?) - - @Slot - fun setSaslPassword(password: String?) - - @Slot - fun setServerList(serverList: QVariantList) { - setActualServerList(serverList.map { - it.valueOrThrow<QVariantMap>() - }.map(Server.Companion::fromVariantMap)) - } - - fun setActualServerList(serverList: List<INetwork.Server>) - - @Slot - fun setUnlimitedMessageRate(unlimitedRate: Boolean) - - @Slot - fun setUnlimitedReconnectRetries(unlimitedRetries: Boolean) - - @Slot - fun setUseAutoIdentify(autoIdentify: Boolean) - - @Slot - fun setUseAutoReconnect(autoReconnect: Boolean) - - @Slot - fun setUseCustomMessageRate(useCustomRate: Boolean) - - @Slot - fun setUseRandomServer(randomServer: Boolean) - - @Slot - fun setUseSasl(sasl: Boolean) - - @Slot - override fun update(properties: QVariantMap) { - super.update(properties) - } - - enum class ConnectionState(val value: Int) { - Disconnected(0), - Connecting(1), - Initializing(2), - Initialized(3), - Reconnecting(4), - Disconnecting(5); - - companion object { - private val byId = enumValues<ConnectionState>().associateBy( - ConnectionState::value - ) - - fun of(value: Int) = byId[value] ?: Disconnected - } - } - - /** - * {@see http://www.irc.org/tech_docs/005.html} - * {@see http://www.irc.org/tech_docs/draft-brocklesby-irc-isupport-03.txt} - */ - enum class ChannelModeType(override val bit: UInt) : - Flag<ChannelModeType> { - NOT_A_CHANMODE(0x00u), - A_CHANMODE(0x01u), - B_CHANMODE(0x02u), - C_CHANMODE(0x04u), - D_CHANMODE(0x08u); - - companion object : Flags.Factory<ChannelModeType> { - override val NONE = ChannelModeType.of() - val validValues = values().filter { it.bit != 0u }.toTypedArray() - override fun of(bit: Int) = Flags.of<ChannelModeType>(bit) - override fun of(bit: UInt) = Flags.of<ChannelModeType>(bit) - override fun of(vararg flags: ChannelModeType) = Flags.of(*flags) - override fun of(flags: Iterable<ChannelModeType>) = Flags.of(flags) - } - } - - /** - * Default port assignments according to what many IRC networks have settled on. - * Technically not a standard, but it's fairly widespread. - * {@see https://freenode.net/news/port-6697-irc-via-tlsssl} - */ - enum class PortDefaults(val port: UInt) { - /** Default port for unencrypted connections */ - PORT_PLAINTEXT(6667u), - /** Default port for encrypted connections */ - PORT_SSL(6697u) - } - - data class Server( - val host: String? = "", - val port: UInt = PortDefaults.PORT_PLAINTEXT.port, - val password: String? = "", - val useSsl: Boolean = false, - val sslVerify: Boolean = false, - val sslVersion: Int = 0, - val useProxy: Boolean = false, - val proxyType: Int = ProxyType.Socks5Proxy.value, - val proxyHost: String? = "localhost", - val proxyPort: UInt = 8080u, - val proxyUser: String? = "", - val proxyPass: String? = "" - ) : Serializable { - fun toVariantMap(): QVariantMap = mapOf( - "Host" to QVariant.of(host, Type.QString), - "Port" to QVariant.of(port, Type.UInt), - "Password" to QVariant.of(password, Type.QString), - "UseSSL" to QVariant.of(useSsl, Type.Bool), - "sslVerify" to QVariant.of(sslVerify, Type.Bool), - "sslVersion" to QVariant.of(sslVersion, Type.Int), - "UseProxy" to QVariant.of(useProxy, Type.Bool), - "ProxyType" to QVariant.of(proxyType, Type.Int), - "ProxyHost" to QVariant.of(proxyHost, Type.QString), - "ProxyPort" to QVariant.of(proxyPort, Type.UInt), - "ProxyUser" to QVariant.of(proxyUser, Type.QString), - "ProxyPass" to QVariant.of(proxyPass, Type.QString) - ) - - companion object { - fun fromVariantMap(map: QVariantMap) = Server( - host = map["Host"].value(""), - port = map["Port"].value(PortDefaults.PORT_PLAINTEXT.port), - password = map["Password"].value(""), - useSsl = map["UseSSL"].value(false), - sslVerify = map["sslVerify"].value(false), - sslVersion = map["sslVersion"].value(0), - useProxy = map["UseProxy"].value(false), - proxyType = map["ProxyType"].value(ProxyType.Socks5Proxy.value), - proxyHost = map["ProxyHost"].value("localhost"), - proxyPort = map["ProxyPort"].value(8080u), - proxyUser = map["ProxyUser"].value(""), - proxyPass = map["ProxyPass"].value("") - ) - } - } - - enum class ProxyType(val value: Int) { - DefaultProxy(0), - Socks5Proxy(1), - NoProxy(2), - HttpProxy(3), - HttpCachingProxy(4), - FtpCachingProxy(5); - - companion object { - private val byId = enumValues<ProxyType>().associateBy(ProxyType::value) - fun of(value: Int) = byId[value] ?: DefaultProxy - } - } - - data class NetworkInfo( - var networkId: NetworkId = NetworkId(-1), - var networkName: String = "", - var identity: IdentityId = IdentityId(-1), - // unused - var useCustomEncodings: Boolean = false, - var codecForServer: String = "UTF_8", - var codecForEncoding: String = "UTF_8", - var codecForDecoding: String = "UTF_8", - var serverList: List<INetwork.Server> = emptyList(), - var useRandomServer: Boolean = false, - var perform: List<String> = emptyList(), - var useAutoIdentify: Boolean = false, - var autoIdentifyService: String = "", - var autoIdentifyPassword: String = "", - var useSasl: Boolean = false, - var saslAccount: String = "", - var saslPassword: String = "", - var useAutoReconnect: Boolean = true, - var autoReconnectInterval: UInt = 0u, - var autoReconnectRetries: UShort = 0u, - var unlimitedReconnectRetries: Boolean = true, - var rejoinChannels: Boolean = true, - var useCustomMessageRate: Boolean = false, - var messageRateBurstSize: UInt = 0u, - var messageRateDelay: UInt = 0u, - var unlimitedMessageRate: Boolean = false - ) { - fun toVariantMap() = mapOf( - "NetworkId" to QVariant.of(networkId, QType.NetworkId), - "NetworkName" to QVariant.of(networkName, Type.QString), - "Identity" to QVariant.of(identity, QType.IdentityId), - "UseCustomEncodings" to QVariant.of(useCustomEncodings, Type.Bool), - "CodecForServer" to QVariant.of( - codecForServer.serializeString(StringSerializer.UTF8), Type.QByteArray - ), - "CodecForEncoding" to QVariant.of( - codecForEncoding.serializeString(StringSerializer.UTF8), Type.QByteArray - ), - "CodecForDecoding" to QVariant.of( - codecForDecoding.serializeString(StringSerializer.UTF8), Type.QByteArray - ), - "ServerList" to QVariant.of(serverList.map { - QVariant.of(it.toVariantMap(), QType.Network_Server) - }, Type.QVariantList), - "UseRandomServer" to QVariant.of(useRandomServer, Type.Bool), - "Perform" to QVariant.of(perform, Type.QStringList), - "UseAutoIdentify" to QVariant.of(useAutoIdentify, Type.Bool), - "AutoIdentifyService" to QVariant.of(autoIdentifyService, Type.QString), - "AutoIdentifyPassword" to QVariant.of(autoIdentifyPassword, Type.QString), - "UseSasl" to QVariant.of(useSasl, Type.Bool), - "SaslAccount" to QVariant.of(saslAccount, Type.QString), - "SaslPassword" to QVariant.of(saslPassword, Type.QString), - "UseAutoReconnect" to QVariant.of(useAutoReconnect, Type.Bool), - "AutoReconnectInterval" to QVariant.of(autoReconnectInterval, Type.UInt), - "AutoReconnectRetries" to QVariant.of(autoReconnectRetries, Type.UShort), - "UnlimitedReconnectRetries" to QVariant.of(unlimitedReconnectRetries, Type.Bool), - "RejoinChannels" to QVariant.of(rejoinChannels, Type.Bool), - "UseCustomMessageRate" to QVariant.of(useCustomMessageRate, Type.Bool), - "MessageRateBurstSize" to QVariant.of(messageRateBurstSize, Type.UInt), - "MessageRateDelay" to QVariant.of(messageRateDelay, Type.UInt), - "UnlimitedMessageRate" to QVariant.of(unlimitedMessageRate, Type.Bool) - ) - - fun fromVariantMap(map: QVariantMap) { - networkId = map["NetworkId"].value(networkId) - networkName = map["NetworkName"].value(networkName) - identity = map["Identity"].value(identity) - useCustomEncodings = map["UseCustomEncodings"].value(useCustomEncodings) - codecForServer = map["CodecForServer"].value(codecForServer) - codecForEncoding = map["CodecForEncoding"].value(codecForEncoding) - codecForDecoding = map["CodecForDecoding"].value(codecForDecoding) - serverList = map["ServerList"].value(emptyList<QVariant_>()).map { - INetwork.Server.fromVariantMap(it.value(emptyMap())) - } - useRandomServer = map["UseRandomServer"].value(useRandomServer) - perform = map["Perform"].value(perform) - useAutoIdentify = map["UseAutoIdentify"].value(useAutoIdentify) - autoIdentifyService = map["AutoIdentifyService"].value(autoIdentifyService) - autoIdentifyPassword = map["AutoIdentifyPassword"].value(autoIdentifyPassword) - useSasl = map["UseSasl"].value(useSasl) - saslAccount = map["SaslAccount"].value(saslAccount) - saslPassword = map["SaslPassword"].value(saslPassword) - useAutoReconnect = map["UseAutoReconnect"].value(useAutoReconnect) - autoReconnectInterval = map["AutoReconnectInterval"].value(autoReconnectInterval) - autoReconnectRetries = map["AutoReconnectRetries"].value(autoReconnectRetries) - unlimitedReconnectRetries = map["UnlimitedReconnectRetries"].value(unlimitedReconnectRetries) - rejoinChannels = map["RejoinChannels"].value(rejoinChannels) - useCustomMessageRate = map["UseCustomMessageRate"].value(useCustomMessageRate) - messageRateBurstSize = map["MessageRateBurstSize"].value(messageRateBurstSize) - messageRateDelay = map["MessageRateDelay"].value(messageRateDelay) - unlimitedMessageRate = map["UnlimitedMessageRate"].value(unlimitedMessageRate) - } - } - - /** - * IRCv3 capability names and values - */ - object IrcCap { - // NOTE: If you add or modify the constants below, update the knownCaps list. - /** - * Account change notification. - * - * http://ircv3.net/specs/extensions/account-notify-3.1.html - */ - const val ACCOUNT_NOTIFY = "account-notify" - /** - * Magic number for WHOX, used to ignore user-requested WHOX replies from servers - * - * If a user initiates a WHOX, there's no easy way to tell what fields were requested. It's - * simpler to not attempt to parse data from user-requested WHOX replies. - */ - const val ACCOUNT_NOTIFY_WHOX_NUM = 369 - /** - * Away change notification. - * - * http://ircv3.net/specs/extensions/away-notify-3.1.html - */ - const val AWAY_NOTIFY = "away-notify" - /** - * Capability added/removed notification. - * - * This is implicitly enabled via CAP LS 302, and is here for servers that only partially - * support IRCv3.2. - * - * http://ircv3.net/specs/extensions/cap-notify-3.2.html - */ - const val CAP_NOTIFY = "cap-notify" - /** - * Hostname/user changed notification. - * - * http://ircv3.net/specs/extensions/chghost-3.2.html - */ - const val CHGHOST = "chghost" - /** - * Extended join information. - * - * http://ircv3.net/specs/extensions/extended-join-3.1.html - */ - const val EXTENDED_JOIN = "extended-join" - /** - * Multiple mode prefixes in MODE and WHO replies. - * - * http://ircv3.net/specs/extensions/multi-prefix-3.1.html - */ - const val MULTI_PREFIX = "multi-prefix" - /** - * SASL authentication. - * - * http://ircv3.net/specs/extensions/sasl-3.2.html - */ - const val SASL = "sasl" - /** - * Userhost in names replies. - * - * http://ircv3.net/specs/extensions/userhost-in-names-3.2.html - */ - const val USERHOST_IN_NAMES = "userhost-in-names" - - /** - * Vendor-specific capabilities - */ - object Vendor { - /** - * Self message support, as recognized by ZNC. - * - * Some servers (e.g. Bitlbee) assume self-message support; ZNC requires a capability - * instead. As self-message is already implemented, there's little reason to not do this. - * - * More information in the IRCv3 commit that removed the 'self-message' capability. - * - * https://github.com/ircv3/ircv3-specifications/commit/1bfba47843c2526707c902034b3395af934713c8 - */ - const val ZNC_SELF_MESSAGE = "znc.in/self-message" - } - - /** - * List of capabilities currently implemented and requested during capability negotiation. - */ - val knownCaps = listOf( - ACCOUNT_NOTIFY, - AWAY_NOTIFY, - CAP_NOTIFY, - CHGHOST, - EXTENDED_JOIN, - MULTI_PREFIX, - SASL, - USERHOST_IN_NAMES, - Vendor::ZNC_SELF_MESSAGE - ) - // NOTE: If you modify the knownCaps list, update the constants above as needed. - /** - * SASL authentication mechanisms - * - * http://ircv3.net/specs/extensions/sasl-3.1.html - */ - object SaslMech { - /** - * PLAIN authentication, e.g. hashed password - */ - const val PLAIN = "PLAIN" - /** - * EXTERNAL authentication, e.g. SSL certificate and keys - */ - const val EXTERNAL = "EXTERNAL" - } - } -} diff --git a/lib/src/main/java/de/kuschku/libquassel/quassel/syncables/interfaces/INetworkConfig.kt b/lib/src/main/java/de/kuschku/libquassel/quassel/syncables/interfaces/INetworkConfig.kt deleted file mode 100644 index 910662c165293d588c9481ad15589004360fa143..0000000000000000000000000000000000000000 --- a/lib/src/main/java/de/kuschku/libquassel/quassel/syncables/interfaces/INetworkConfig.kt +++ /dev/null @@ -1,118 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.libquassel.quassel.syncables.interfaces - -import de.kuschku.libquassel.annotations.Slot -import de.kuschku.libquassel.annotations.Syncable -import de.kuschku.libquassel.protocol.ARG -import de.kuschku.libquassel.protocol.QVariantMap -import de.kuschku.libquassel.protocol.Type - -@Syncable(name = "NetworkConfig") -interface INetworkConfig : ISyncableObject { - - fun initProperties(): QVariantMap - fun initSetProperties(properties: QVariantMap) - - @Slot - fun requestSetAutoWhoDelay(i: Int) { - REQUEST("requestSetAutoWhoDelay", ARG(i, Type.Int)) - } - - @Slot - fun requestSetAutoWhoEnabled(b: Boolean) { - REQUEST("requestSetAutoWhoEnabled", ARG(b, Type.Bool)) - } - - @Slot - fun requestSetAutoWhoInterval(i: Int) { - REQUEST("requestSetAutoWhoInterval", ARG(i, Type.Int)) - } - - @Slot - fun requestSetAutoWhoNickLimit(i: Int) { - REQUEST("requestSetAutoWhoNickLimit", ARG(i, Type.Int)) - } - - @Slot - fun requestSetMaxPingCount(i: Int) { - REQUEST("requestSetMaxPingCount", ARG(i, Type.Int)) - } - - @Slot - fun requestSetPingInterval(i: Int) { - REQUEST("requestSetPingInterval", ARG(i, Type.Int)) - } - - @Slot - fun requestSetPingTimeoutEnabled(b: Boolean) { - REQUEST("requestSetPingTimeoutEnabled", ARG(b, Type.Bool)) - } - - @Slot - fun requestSetStandardCtcp(b: Boolean) { - REQUEST("requestSetStandardCtcp", ARG(b, Type.Bool)) - } - - @Slot - fun setAutoWhoDelay(delay: Int) { - SYNC("setAutoWhoDelay", ARG(delay, Type.Int)) - } - - @Slot - fun setAutoWhoEnabled(enabled: Boolean) { - SYNC("setAutoWhoEnabled", ARG(enabled, Type.Bool)) - } - - @Slot - fun setAutoWhoInterval(interval: Int) { - SYNC("setAutoWhoInterval", ARG(interval, Type.Int)) - } - - @Slot - fun setAutoWhoNickLimit(limit: Int) { - SYNC("setAutoWhoNickLimit", ARG(limit, Type.Int)) - } - - @Slot - fun setMaxPingCount(count: Int) { - SYNC("setMaxPingCount", ARG(count, Type.Int)) - } - - @Slot - fun setPingInterval(interval: Int) { - SYNC("setPingInterval", ARG(interval, Type.Int)) - } - - @Slot - fun setPingTimeoutEnabled(enabled: Boolean) { - SYNC("setPingTimeoutEnabled", ARG(enabled, Type.Bool)) - } - - @Slot - fun setStandardCtcp(standardCtcp: Boolean) { - SYNC("setStandardCtcp", ARG(standardCtcp, Type.Bool)) - } - - @Slot - override fun update(properties: QVariantMap) { - super.update(properties) - } -} diff --git a/lib/src/main/java/de/kuschku/libquassel/quassel/syncables/interfaces/IRpcHandler.kt b/lib/src/main/java/de/kuschku/libquassel/quassel/syncables/interfaces/IRpcHandler.kt deleted file mode 100644 index 16c7876ae2b1a6065649006d6cb1d20338b2ab80..0000000000000000000000000000000000000000 --- a/lib/src/main/java/de/kuschku/libquassel/quassel/syncables/interfaces/IRpcHandler.kt +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.libquassel.quassel.syncables.interfaces - -import de.kuschku.libquassel.annotations.Slot -import de.kuschku.libquassel.annotations.Syncable -import de.kuschku.libquassel.protocol.IdentityId -import de.kuschku.libquassel.protocol.Message -import de.kuschku.libquassel.protocol.NetworkId -import de.kuschku.libquassel.protocol.QVariantMap -import de.kuschku.libquassel.quassel.BufferInfo -import de.kuschku.libquassel.quassel.syncables.Identity -import java.nio.ByteBuffer - -@Syncable(name = "RpcHandler") -interface IRpcHandler { - @Slot(value = "__objectRenamed__") - fun objectRenamed(classname: ByteBuffer, newname: String?, oldname: String?) - - @Slot("2displayMsg(Message)") - fun displayMsg(message: Message) - - @Slot("2displayStatusMsg(QString,QString)") - fun displayStatusMsg(net: String?, msg: String?) - - @Slot("2bufferInfoUpdated(BufferInfo)") - fun bufferInfoUpdated(bufferInfo: BufferInfo) - - @Slot("2identityCreated(Identity)") - fun identityCreated(identity: QVariantMap) - - @Slot("2identityRemoved(IdentityId)") - fun identityRemoved(identityId: IdentityId) - - @Slot("2networkCreated(NetworkId)") - fun networkCreated(networkId: NetworkId) - - @Slot("2networkRemoved(NetworkId)") - fun networkRemoved(networkId: NetworkId) - - @Slot("2passwordChanged(PeerPtr,bool)") - fun passwordChanged(ignored: Long, success: Boolean) - - @Slot("2disconnectFromCore()") - fun disconnectFromCore() - - fun createIdentity(identity: Identity, additional: QVariantMap) - fun removeIdentity(identityId: IdentityId) - fun createNetwork(networkInfo: INetwork.NetworkInfo, channels: List<String> = emptyList()) - fun removeNetwork(networkId: NetworkId) - fun changePassword(peerPtr: Long, user: String?, old: String?, new: String?) - fun requestKickClient(id: Int) - fun sendInput(bufferInfo: BufferInfo, message: String?) -} diff --git a/lib/src/main/java/de/kuschku/libquassel/quassel/syncables/interfaces/ISyncableObject.kt b/lib/src/main/java/de/kuschku/libquassel/quassel/syncables/interfaces/ISyncableObject.kt deleted file mode 100644 index 799c217ff90436891d33e7ee8e714c5e569957af..0000000000000000000000000000000000000000 --- a/lib/src/main/java/de/kuschku/libquassel/quassel/syncables/interfaces/ISyncableObject.kt +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ -@file:Suppress("NOTHING_TO_INLINE") - -package de.kuschku.libquassel.quassel.syncables.interfaces - -import de.kuschku.libquassel.protocol.ARG -import de.kuschku.libquassel.protocol.QVariantMap -import de.kuschku.libquassel.protocol.QVariant_ -import de.kuschku.libquassel.protocol.Type -import de.kuschku.libquassel.session.SignalProxy -import io.reactivex.Observable - -interface ISyncableObject { - val objectName: String - var identifier: Pair<String, String> - val className: String - var initialized: Boolean - val proxy: SignalProxy - val liveInitialized: Observable<Boolean> - - fun requestUpdate(properties: QVariantMap = toVariantMap()) { - REQUEST("requestUpdate", ARG(properties, Type.QVariantMap)) - } - - fun update(properties: QVariantMap) { - fromVariantMap(properties) - SYNC("update", ARG(properties, Type.QVariantMap)) - } - - fun deinit() - fun init() {} - - fun fromVariantMap(properties: QVariantMap) = Unit - fun toVariantMap(): QVariantMap = emptyMap() -} - -inline fun ISyncableObject.SYNC(function: String, vararg arg: QVariant_) { - // Don’t transmit calls back that we just got from the network - if (initialized && proxy.shouldSync(className, objectName, function)) - proxy.callSync(className, objectName, function, arg.toList()) -} - -inline fun ISyncableObject.REQUEST(function: String, vararg arg: QVariant_) { - // Don’t transmit calls back that we just got from the network - if (initialized && proxy.shouldSync(className, objectName, function)) - proxy.callSync(className, objectName, function, arg.toList()) -} diff --git a/lib/src/main/java/de/kuschku/libquassel/quassel/syncables/interfaces/ITransfer.kt b/lib/src/main/java/de/kuschku/libquassel/quassel/syncables/interfaces/ITransfer.kt deleted file mode 100644 index defbd14e44a521a9ccbc5ca294bdc336113f5265..0000000000000000000000000000000000000000 --- a/lib/src/main/java/de/kuschku/libquassel/quassel/syncables/interfaces/ITransfer.kt +++ /dev/null @@ -1,91 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.libquassel.quassel.syncables.interfaces - -import de.kuschku.libquassel.annotations.Slot -import de.kuschku.libquassel.annotations.Syncable -import de.kuschku.libquassel.protocol.ARG -import de.kuschku.libquassel.protocol.QVariantMap -import de.kuschku.libquassel.protocol.Type -import java.nio.ByteBuffer - -@Syncable(name = "Transfer") -interface ITransfer : ISyncableObject { - @Slot - fun accept(savePath: String?) { - SYNC("accept", ARG(savePath, Type.QString)) - } - - @Slot - fun reject() { - SYNC("reject") - } - - @Slot - fun requestAccepted(peer: Long) { - TODO() - } - - @Slot - fun requestRejected(peer: Long) { - TODO() - } - - @Slot - fun setStatus(status: Status) { - TODO() - } - - @Slot - fun setError(errorString: String?) { - SYNC("setError", ARG(errorString, Type.QString)) - } - - @Slot - fun dataReceived(peer: Long, data: ByteBuffer) { - TODO() - } - - @Slot - fun cleanUp() { - SYNC("cleanUp") - } - - @Slot - override fun update(properties: QVariantMap) { - super.update(properties) - } - - enum class Status { - New, - Pending, - Connecting, - Transferring, - Paused, - Completed, - Failed, - Rejected - } - - enum class Direction { - Send, - Receive - } -} diff --git a/lib/src/main/java/de/kuschku/libquassel/quassel/syncables/interfaces/ITransferManager.kt b/lib/src/main/java/de/kuschku/libquassel/quassel/syncables/interfaces/ITransferManager.kt deleted file mode 100644 index 2a7bf8ec074828a0e2dd547fe72ec9eb638b3f8d..0000000000000000000000000000000000000000 --- a/lib/src/main/java/de/kuschku/libquassel/quassel/syncables/interfaces/ITransferManager.kt +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.libquassel.quassel.syncables.interfaces - -import de.kuschku.libquassel.annotations.Slot -import de.kuschku.libquassel.annotations.Syncable -import de.kuschku.libquassel.protocol.QVariantMap -import java.util.* - -@Syncable(name = "TransferManager") -interface ITransferManager : ISyncableObject { - @Slot - fun setTransferIds(transferIds: List<UUID>) - - @Slot - fun onCoreTransferAdded(transferId: UUID) - - @Slot - override fun update(properties: QVariantMap) { - super.update(properties) - } -} diff --git a/lib/src/main/java/de/kuschku/libquassel/quassel/syncables/interfaces/invokers/Invoker.kt b/lib/src/main/java/de/kuschku/libquassel/quassel/syncables/interfaces/invokers/Invoker.kt deleted file mode 100644 index 1ba42b30d50f975405b86ae72ddef76140e5804c..0000000000000000000000000000000000000000 --- a/lib/src/main/java/de/kuschku/libquassel/quassel/syncables/interfaces/invokers/Invoker.kt +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.libquassel.quassel.syncables.interfaces.invokers - -import de.kuschku.libquassel.protocol.QVariantList -import de.kuschku.libquassel.quassel.exceptions.UnknownMethodException -import de.kuschku.libquassel.quassel.exceptions.WrongObjectTypeException - -interface Invoker<out T> { - val className: String - @Throws(WrongObjectTypeException::class, UnknownMethodException::class) - fun invoke(on: Any?, method: String, params: QVariantList) -} diff --git a/lib/src/main/java/de/kuschku/libquassel/quassel/syncables/interfaces/invokers/Invokers.kt b/lib/src/main/java/de/kuschku/libquassel/quassel/syncables/interfaces/invokers/Invokers.kt deleted file mode 100644 index d71a981179b133f4005cb80fbd4c4dddb0d73851..0000000000000000000000000000000000000000 --- a/lib/src/main/java/de/kuschku/libquassel/quassel/syncables/interfaces/invokers/Invokers.kt +++ /dev/null @@ -1,94 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.libquassel.quassel.syncables.interfaces.invokers - -import de.kuschku.libquassel.annotations.Syncable -import de.kuschku.libquassel.quassel.syncables.interfaces.* -import de.kuschku.libquassel.util.compatibility.LoggingHandler.Companion.log -import de.kuschku.libquassel.util.compatibility.LoggingHandler.LogLevel.DEBUG -import de.kuschku.libquassel.util.compatibility.LoggingHandler.LogLevel.WARN - -object Invokers { - private val registry = mutableMapOf<String, Invoker<*>>() - fun get(name: String) = registry[name] - - val RPC: Invoker<IRpcHandler>? - - val size - get() = registry.size - - init { - register(invoker<IAliasManager>()) - register(invoker<IBacklogManager>()) - register(invoker<IBufferSyncer>()) - register(invoker<IBufferViewConfig>()) - register(invoker<IBufferViewManager>()) - register(invoker<ICertManager>()) - register(invoker<ICoreInfo>()) - register(invoker<IDccConfig>()) - register(invoker<IIdentity>()) - register(invoker<IIgnoreListManager>()) - register(invoker<IHighlightRuleManager>()) - register(invoker<IIrcChannel>()) - register(invoker<IIrcListHelper>()) - register(invoker<IIrcUser>()) - register(invoker<INetwork>()) - register(invoker<INetworkConfig>()) - register(invoker<ITransfer>()) - register(invoker<ITransferManager>()) - - RPC = invoker() - - log(DEBUG, "Invokers", "$size invokers registered") - } - - private inline fun <reified T> invoker(): Invoker<T>? = getInvoker(T::class.java) - - private fun <T> getInvoker(type: Class<T>): Invoker<T>? { - val syncable: Syncable? = type.getAnnotation(Syncable::class.java) - if (syncable == null) { - log( - WARN, "Invokers", - "Invoker not annotated: ${type.canonicalName}" - ) - return null - } - - val packageName = "${type.`package`.name}.invokers" - val className = "${syncable.name}Invoker" - val klass = Class.forName("$packageName.$className") - val invoker = klass.getDeclaredField("INSTANCE").get(null) - if (invoker !is Invoker<*>) { - log( - WARN, "Invokers", - "Invoker not of proper type: ${type.canonicalName} != ${invoker.javaClass.canonicalName}" - ) - return null - } - - @Suppress("UNCHECKED_CAST") - return invoker as Invoker<T>? - } - - private fun <T> register(invoker: Invoker<T>?) { - if (invoker != null) - registry[invoker.className] = invoker - } -} diff --git a/lib/src/main/java/de/kuschku/libquassel/session/AuthHandler.kt b/lib/src/main/java/de/kuschku/libquassel/session/AuthHandler.kt deleted file mode 100644 index c41f8400ef34b9b6cab83d4c3147ea18c503a8c6..0000000000000000000000000000000000000000 --- a/lib/src/main/java/de/kuschku/libquassel/session/AuthHandler.kt +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.libquassel.session - -import de.kuschku.libquassel.protocol.message.HandshakeMessage - -interface AuthHandler { - fun handle(f: HandshakeMessage.ClientInit) = false - fun handle(f: HandshakeMessage.ClientInitReject) = false - fun handle(f: HandshakeMessage.ClientInitAck) = false - fun handle(f: HandshakeMessage.CoreSetupData) = false - fun handle(f: HandshakeMessage.CoreSetupReject) = false - fun handle(f: HandshakeMessage.CoreSetupAck) = false - fun handle(f: HandshakeMessage.ClientLogin) = false - fun handle(f: HandshakeMessage.ClientLoginReject) = false - fun handle(f: HandshakeMessage.ClientLoginAck) = false - fun handle(f: HandshakeMessage.SessionInit) = false - - fun handle(f: HandshakeMessage): Boolean = when (f) { - is HandshakeMessage.ClientInit -> handle(f) - is HandshakeMessage.ClientInitReject -> handle(f) - is HandshakeMessage.ClientInitAck -> handle(f) - is HandshakeMessage.CoreSetupData -> handle(f) - is HandshakeMessage.CoreSetupReject -> handle(f) - is HandshakeMessage.CoreSetupAck -> handle(f) - is HandshakeMessage.ClientLogin -> handle(f) - is HandshakeMessage.ClientLoginReject -> handle(f) - is HandshakeMessage.ClientLoginAck -> handle(f) - is HandshakeMessage.SessionInit -> handle(f) - } -} diff --git a/lib/src/main/java/de/kuschku/libquassel/session/BacklogStorage.kt b/lib/src/main/java/de/kuschku/libquassel/session/BacklogStorage.kt deleted file mode 100644 index 7e63d24af6605d1421b49988f31c2313ad152d84..0000000000000000000000000000000000000000 --- a/lib/src/main/java/de/kuschku/libquassel/session/BacklogStorage.kt +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.libquassel.session - -import de.kuschku.libquassel.protocol.BufferId -import de.kuschku.libquassel.protocol.Message - -interface BacklogStorage { - fun updateIgnoreRules(session: ISession) - - fun storeMessages(session: ISession, vararg messages: Message) - fun storeMessages(session: ISession, messages: Iterable<Message>) - - fun clearMessages(bufferId: BufferId, idRange: LongRange) - - fun clearMessages(bufferId: BufferId) - - fun clearMessages() -} diff --git a/lib/src/main/java/de/kuschku/libquassel/session/Error.kt b/lib/src/main/java/de/kuschku/libquassel/session/Error.kt deleted file mode 100644 index ef92bf2bb0d9340080a5cb6405c8803a49237c98..0000000000000000000000000000000000000000 --- a/lib/src/main/java/de/kuschku/libquassel/session/Error.kt +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.libquassel.session - -import de.kuschku.libquassel.connection.QuasselSecurityException -import de.kuschku.libquassel.protocol.message.HandshakeMessage - -sealed class Error { - data class ConnectionError(val throwable: Throwable) : Error() - data class SslError(val exception: QuasselSecurityException) : Error() - data class HandshakeError(val message: HandshakeMessage) : Error() -} diff --git a/lib/src/main/java/de/kuschku/libquassel/session/HeartBeatRunner.kt b/lib/src/main/java/de/kuschku/libquassel/session/HeartBeatRunner.kt deleted file mode 100644 index 5fcfdc76a7dba9499003e3f4ffd7d3e15a5f125d..0000000000000000000000000000000000000000 --- a/lib/src/main/java/de/kuschku/libquassel/session/HeartBeatRunner.kt +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.libquassel.session - -import de.kuschku.libquassel.protocol.message.SignalProxyMessage -import org.threeten.bp.Instant - -interface HeartBeatRunner { - fun setCloseCallback(callback: (() -> Unit)?) - fun setHeartbeatDispatchCallback(callback: ((SignalProxyMessage.HeartBeat) -> Unit)?) - - fun start() - fun end() - - fun setLastHeartBeatReply(time: Instant) - - companion object { - const val TIMEOUT = 120_000L - const val DELAY = 30_000L - } -} diff --git a/lib/src/main/java/de/kuschku/libquassel/session/ISession.kt b/lib/src/main/java/de/kuschku/libquassel/session/ISession.kt deleted file mode 100644 index 813ff8d90f191bb71192c914590d7ec8bd0c7f42..0000000000000000000000000000000000000000 --- a/lib/src/main/java/de/kuschku/libquassel/session/ISession.kt +++ /dev/null @@ -1,131 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.libquassel.session - -import de.kuschku.libquassel.connection.ConnectionState -import de.kuschku.libquassel.connection.Features -import de.kuschku.libquassel.protocol.IdentityId -import de.kuschku.libquassel.protocol.NetworkId -import de.kuschku.libquassel.protocol.QVariantMap -import de.kuschku.libquassel.protocol.message.HandshakeMessage -import de.kuschku.libquassel.quassel.QuasselFeatures -import de.kuschku.libquassel.quassel.syncables.* -import de.kuschku.libquassel.util.Optional -import io.reactivex.Observable -import io.reactivex.subjects.BehaviorSubject -import io.reactivex.subjects.PublishSubject -import java.io.Closeable -import javax.net.ssl.SSLSession - -interface ISession : Closeable { - val features: Features - val sslSession: Observable<Optional<SSLSession>> - val lag: BehaviorSubject<Long> - - val proxy: SignalProxy - - val aliasManager: AliasManager - val backlogManager: BacklogManager - val bufferSyncer: BufferSyncer - val bufferViewManager: BufferViewManager - val certManagers: Map<IdentityId, CertManager> - val coreInfo: CoreInfo - val dccConfig: DccConfig - val identities: Map<IdentityId, Identity> - fun liveIdentities(): Observable<Map<IdentityId, Identity>> - val ignoreListManager: IgnoreListManager - val highlightRuleManager: HighlightRuleManager - val ircListHelper: IrcListHelper - val networks: Map<NetworkId, Network> - fun liveNetworks(): Observable<Map<NetworkId, Network>> - fun liveNetworkAdded(): Observable<NetworkId> - val networkConfig: NetworkConfig - val rpcHandler: RpcHandler - fun network(id: NetworkId): Network? - fun identity(id: IdentityId): Identity? - - fun login(user: String, pass: String) - fun setupCore(setupData: HandshakeMessage.CoreSetupData) { - proxy.dispatch(setupData) - } - - fun disconnectFromCore() - fun addNetwork(networkId: NetworkId) - fun removeNetwork(networkId: NetworkId) - fun addIdentity(initData: QVariantMap) - fun removeIdentity(identityId: IdentityId) - - val progress: ProgressData - - data class ProgressData( - val state: Observable<ConnectionState>, - val progress: Observable<Pair<Int, Int>>, - val error: Observable<Error> - ) - - companion object { - val NULL = object : ISession { - override val features: Features = Features( - QuasselFeatures.empty(), - QuasselFeatures.empty()) - override val sslSession: Observable<Optional<SSLSession>> = Observable.empty() - override val lag = BehaviorSubject.createDefault(0L) - - override val proxy: SignalProxy = SignalProxy.NULL - - override val rpcHandler = RpcHandler(this) - override val aliasManager = AliasManager(proxy) - override val backlogManager = BacklogManager(this) - override val bufferSyncer = BufferSyncer(this) - override val bufferViewManager = BufferViewManager(proxy) - override val certManagers: Map<IdentityId, CertManager> = emptyMap() - override val coreInfo = CoreInfo(proxy) - override val dccConfig = DccConfig(proxy) - override val identities: Map<IdentityId, Identity> = emptyMap() - override fun liveIdentities() = Observable.empty<Map<IdentityId, Identity>>() - override val ignoreListManager = IgnoreListManager(this) - override val highlightRuleManager = HighlightRuleManager(proxy) - override val ircListHelper = IrcListHelper(proxy) - override val networks: Map<NetworkId, Network> = emptyMap() - override fun liveNetworks() = Observable.empty<Map<NetworkId, Network>>() - override fun liveNetworkAdded(): Observable<NetworkId> = PublishSubject.create() - override val networkConfig = NetworkConfig(proxy) - - override fun network(id: NetworkId): Network? = null - override fun identity(id: IdentityId): Identity? = null - - override fun login(user: String, pass: String) = Unit - override fun setupCore(setupData: HandshakeMessage.CoreSetupData) = Unit - override fun disconnectFromCore() = Unit - override fun addNetwork(networkId: NetworkId) = Unit - override fun removeNetwork(networkId: NetworkId) = Unit - override fun addIdentity(initData: QVariantMap) = Unit - override fun removeIdentity(identityId: IdentityId) = Unit - - override val progress = ProgressData( - state = BehaviorSubject.createDefault(ConnectionState.DISCONNECTED), - progress = BehaviorSubject.createDefault(Pair(0, 0)), - error = Observable.empty() - ) - - override fun close() = Unit - } - } -} diff --git a/lib/src/main/java/de/kuschku/libquassel/session/JavaHeartBeatRunner.kt b/lib/src/main/java/de/kuschku/libquassel/session/JavaHeartBeatRunner.kt deleted file mode 100644 index 2bb759e541a7fc5f253a613f8edcd56e1070de61..0000000000000000000000000000000000000000 --- a/lib/src/main/java/de/kuschku/libquassel/session/JavaHeartBeatRunner.kt +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.libquassel.session - -import de.kuschku.libquassel.protocol.message.SignalProxyMessage -import de.kuschku.libquassel.util.compatibility.LoggingHandler.Companion.log -import de.kuschku.libquassel.util.compatibility.LoggingHandler.LogLevel.INFO -import org.threeten.bp.Duration -import org.threeten.bp.Instant - -class JavaHeartBeatRunner : Thread(), HeartBeatRunner { - private var running = true - private var lastHeartBeatReply: Instant = Instant.now() - - private var closeCallback: (() -> Unit)? = null - private var heartbeatDispatchCallback: ((SignalProxyMessage.HeartBeat) -> Unit)? = null - - override fun setCloseCallback(callback: (() -> Unit)?) { - this.closeCallback = callback - } - - override fun setHeartbeatDispatchCallback(callback: ((SignalProxyMessage.HeartBeat) -> Unit)?) { - this.heartbeatDispatchCallback = callback - } - - override fun start() { - while (running) { - val now = Instant.now() - val duration = Duration.between(lastHeartBeatReply, now).toMillis() - if (duration > TIMEOUT) { - log(INFO, "Heartbeat", "Ping Timeout: Last Response ${duration}ms ago") - closeCallback?.invoke() - } else { - log(INFO, "Heartbeat", "Sending Heartbeat") - heartbeatDispatchCallback?.invoke(SignalProxyMessage.HeartBeat(now)) - } - Thread.sleep(DELAY) - } - } - - override fun end() { - running = false - } - - override fun setLastHeartBeatReply(time: Instant) { - this.lastHeartBeatReply = time - } - - companion object { - const val TIMEOUT = 120_000L - const val DELAY = 30_000L - } -} diff --git a/lib/src/main/java/de/kuschku/libquassel/session/NotificationManager.kt b/lib/src/main/java/de/kuschku/libquassel/session/NotificationManager.kt deleted file mode 100644 index 897281213a28d11106b075293e04cddf19b24917..0000000000000000000000000000000000000000 --- a/lib/src/main/java/de/kuschku/libquassel/session/NotificationManager.kt +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.libquassel.session - -import de.kuschku.libquassel.protocol.BufferId -import de.kuschku.libquassel.protocol.Message -import de.kuschku.libquassel.protocol.MsgId - -interface NotificationManager { - fun init(session: ISession) - fun processMessages(session: ISession, show: Boolean, vararg messages: Message) - fun clear(buffer: BufferId, lastRead: MsgId = MsgId.MAX_VALUE) -} diff --git a/lib/src/main/java/de/kuschku/libquassel/session/ObjectStorage.kt b/lib/src/main/java/de/kuschku/libquassel/session/ObjectStorage.kt deleted file mode 100644 index 92313f8671d221dfb8fadda8e89a005cbdfb0e32..0000000000000000000000000000000000000000 --- a/lib/src/main/java/de/kuschku/libquassel/session/ObjectStorage.kt +++ /dev/null @@ -1,88 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.libquassel.session - -import de.kuschku.libquassel.protocol.QType -import de.kuschku.libquassel.protocol.QVariant -import de.kuschku.libquassel.protocol.Type -import de.kuschku.libquassel.protocol.message.SignalProxyMessage -import de.kuschku.libquassel.quassel.exceptions.ObjectNotFoundException -import de.kuschku.libquassel.quassel.syncables.interfaces.ISyncableObject -import de.kuschku.libquassel.util.helper.removeIfEqual - -class ObjectStorage(private var proxy: SignalProxy) { - fun deinit() { - proxy = SignalProxy.NULL - objectTree.values.forEach(ISyncableObject::deinit) - objectTree.clear() - } - - private val objectTree: MutableMap<Pair<String, String>, ISyncableObject> = HashMap() - - fun add(obj: ISyncableObject) { - objectTree[obj.identifier] = obj - if (get(obj.className, obj.objectName) != obj) { - throw IllegalStateException("Object should be existing") - } - } - - fun remove(obj: ISyncableObject) { - objectTree.remove(obj.identifier) - if (get(obj.className, obj.objectName) == obj) { - throw IllegalStateException("Object should not be existing") - } - } - - fun rename(className: String, new: String, old: String) { - val obj = get(className, old) - if (obj != null) { - rename(obj, new, old) - } else { - throw ObjectNotFoundException(className, old) - } - } - - fun rename(obj: ISyncableObject, new: String, old: String) { - objectTree[Pair(obj.className, new)] = obj - objectTree.removeIfEqual(Pair(obj.className, old), obj) - if (get(obj.className, new) != obj) { - throw IllegalStateException("Object should be existing") - } - if (get(obj.className, old) == obj) { - throw IllegalStateException("Object should not be referenced by the old name") - } - if (proxy.shouldRpc("__objectRenamed__")) { - proxy.dispatch( - SignalProxyMessage.RpcCall( - "__objectRenamed__", - listOf( - QVariant.of(obj.className, Type.QString), QVariant.of(new, Type.QString), - QVariant.of(old, Type.QString) - ) - ) - ) - } - } - - fun get(className: QType, objectName: String) = get(className.typeName, objectName) - fun get(className: String, objectName: String) = objectTree[Pair(className, objectName)] - - fun clear() = objectTree.clear() -} diff --git a/lib/src/main/java/de/kuschku/libquassel/session/ProtocolHandler.kt b/lib/src/main/java/de/kuschku/libquassel/session/ProtocolHandler.kt deleted file mode 100644 index 7bb60be8164267125c8fd7e84fe3d0ec3016a7cb..0000000000000000000000000000000000000000 --- a/lib/src/main/java/de/kuschku/libquassel/session/ProtocolHandler.kt +++ /dev/null @@ -1,206 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.libquassel.session - -import de.kuschku.libquassel.protocol.QVariantList -import de.kuschku.libquassel.protocol.message.HandshakeMessage -import de.kuschku.libquassel.protocol.message.SignalProxyMessage -import de.kuschku.libquassel.quassel.exceptions.MessageHandlingException -import de.kuschku.libquassel.quassel.exceptions.ObjectNotFoundException -import de.kuschku.libquassel.quassel.syncables.RpcHandler -import de.kuschku.libquassel.quassel.syncables.interfaces.ISyncableObject -import de.kuschku.libquassel.quassel.syncables.interfaces.invokers.Invokers -import de.kuschku.libquassel.util.compatibility.LoggingHandler.Companion.log -import de.kuschku.libquassel.util.compatibility.LoggingHandler.LogLevel.DEBUG -import java.io.Closeable - -abstract class ProtocolHandler( - private val exceptionHandler: ((Throwable) -> Unit)? = null -) : SignalProxy, AuthHandler, Closeable { - protected var closed = false - protected abstract val objectStorage: ObjectStorage - protected abstract val rpcHandler: RpcHandler - - private val toInit = mutableMapOf<ISyncableObject, MutableList<SignalProxyMessage.SyncMessage>>() - private val syncQueue = mutableListOf<SignalProxyMessage.SyncMessage>() - - protected var isInitializing = false - - private var currentCallClass = "" - private var currentCallSlot = "" - private var currentCallInstance = "" - - abstract fun onInitDone() - - private var totalInitCount = 0 - - override fun handle(f: SignalProxyMessage): Boolean { - if (closed) return true - - try { - if (!super<SignalProxy>.handle(f)) { - log(DEBUG, "ProtocolHandler", "No receiver registered for $f") - } - } catch (e: ObjectNotFoundException) { - log(DEBUG, "ProtocolHandler", "An error has occured while processing $f", e) - } catch (e: Throwable) { - exceptionHandler?.invoke(MessageHandlingException.SignalProxy(f, e)) - } - return true - } - - override fun handle(f: HandshakeMessage): Boolean { - if (closed) return true - - try { - if (!super<AuthHandler>.handle(f)) { - log(DEBUG, "ProtocolHandler", "No receiver registered for $f") - } - } catch (e: ObjectNotFoundException) { - log(DEBUG, "ProtocolHandler", "An error has occured while processing $f", e) - } catch (e: Throwable) { - exceptionHandler?.invoke(MessageHandlingException.Handshake(f, e)) - } - return true - } - - override fun handle(f: SignalProxyMessage.InitData): Boolean { - val obj: ISyncableObject = objectStorage.get(f.className, f.objectName) - ?: throw ObjectNotFoundException(f.className, f.objectName) - - obj.fromVariantMap(f.initData) - obj.initialized = true - synchronize(obj) - val list = toInit.remove(obj) - checkForInitDone() - list?.map(this::handle) - return true - } - - private fun checkForInitDone() { - onInitStatusChanged(totalInitCount - toInit.size, totalInitCount) - if (isInitializing && toInit.isEmpty()) { - isInitializing = false - onInitDone() - syncQueue.map { - try { - this.handle(it) - } catch (e: Throwable) { - exceptionHandler?.invoke(e) - } - } - } - } - - open fun onInitStatusChanged(progress: Int, total: Int) {} - - override fun handle(f: SignalProxyMessage.SyncMessage): Boolean { - val obj = objectStorage.get(f.className, f.objectName) ?: if (isInitializing) { - syncQueue.add(f) - return true - } else null - - obj?.let { - val initQueue = toInit[it] - if (initQueue != null) { - initQueue.add(f) - return true - } - - val invoker = Invokers.get(f.className) - ?: throw IllegalArgumentException("Invalid classname: ${f.className}") - currentCallClass = f.className - currentCallInstance = f.objectName - currentCallSlot = f.slotName - invoker.invoke(it, f.slotName, f.params) - currentCallClass = "" - currentCallInstance = "" - currentCallSlot = "" - } - return true - } - - override fun handle(f: SignalProxyMessage.RpcCall): Boolean { - currentCallSlot = f.slotName - Invokers.RPC?.invoke(rpcHandler, f.slotName, f.params) - currentCallSlot = "" - return true - } - - override fun handle(f: SignalProxyMessage.HeartBeat): Boolean { - dispatch(SignalProxyMessage.HeartBeatReply(f.timestamp)) - return true - } - - override fun shouldSync(type: String, instance: String, - slot: String): Boolean = type != currentCallClass || slot != currentCallSlot || instance != currentCallInstance - - override fun callSync(type: String, instance: String, slot: String, params: QVariantList) { - dispatch(SignalProxyMessage.SyncMessage(type, instance, slot, params)) - } - - override fun shouldRpc(slot: String): Boolean = slot != currentCallSlot - - override fun callRpc(slot: String, params: QVariantList) { - dispatch(SignalProxyMessage.RpcCall(slot, params)) - } - - override fun renameObject(syncableObject: ISyncableObject, newName: String, oldName: String) { - objectStorage.rename(syncableObject, newName, oldName) - } - - override fun renameObject(className: String, newName: String, oldName: String) { - objectStorage.rename(className, newName, oldName) - } - - override fun synchronize(syncableObject: ISyncableObject?, baseInit: Boolean) { - if (syncableObject == null) - return - - if (!syncableObject.initialized) - syncableObject.init() - - objectStorage.add(syncableObject) - - if (!syncableObject.initialized) { - if (baseInit) { - toInit[syncableObject] = mutableListOf() - totalInitCount++ - } - dispatch(SignalProxyMessage.InitRequest(syncableObject.className, syncableObject.objectName)) - } - } - - override fun stopSynchronize(syncableObject: ISyncableObject?) { - if (syncableObject == null) - return - - syncableObject.deinit() - objectStorage.remove(syncableObject) - toInit.remove(syncableObject) - } - - override fun close() { - closed = true - - objectStorage.clear() - toInit.clear() - } -} diff --git a/lib/src/main/java/de/kuschku/libquassel/session/Session.kt b/lib/src/main/java/de/kuschku/libquassel/session/Session.kt deleted file mode 100644 index eb0ec7ada98730a7444814bc6c322c320679d873..0000000000000000000000000000000000000000 --- a/lib/src/main/java/de/kuschku/libquassel/session/Session.kt +++ /dev/null @@ -1,343 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.libquassel.session - -import de.kuschku.libquassel.connection.* -import de.kuschku.libquassel.protocol.* -import de.kuschku.libquassel.protocol.message.HandshakeMessage -import de.kuschku.libquassel.protocol.message.SignalProxyMessage -import de.kuschku.libquassel.quassel.ExtendedFeature -import de.kuschku.libquassel.quassel.QuasselFeatures -import de.kuschku.libquassel.quassel.syncables.* -import de.kuschku.libquassel.ssl.TrustManagers -import de.kuschku.libquassel.util.compatibility.HandlerService -import de.kuschku.libquassel.util.compatibility.LoggingHandler.Companion.log -import de.kuschku.libquassel.util.compatibility.LoggingHandler.LogLevel.INFO -import de.kuschku.libquassel.util.compatibility.reference.JavaHandlerService -import de.kuschku.libquassel.util.rxjava.ReusableUnicastSubject -import io.reactivex.Observable -import io.reactivex.subjects.BehaviorSubject -import io.reactivex.subjects.PublishSubject -import org.threeten.bp.Instant -import javax.net.ssl.HostnameVerifier -import javax.net.ssl.HttpsURLConnection -import javax.net.ssl.X509TrustManager - -class Session( - address: SocketAddress, - private var userData: Pair<String, String>, - requireSsl: Boolean = false, - trustManager: X509TrustManager = TrustManagers.default(), - hostnameVerifier: HostnameVerifier = HttpsURLConnection.getDefaultHostnameVerifier(), - clientData: ClientData = ClientData.DEFAULT, - private val handlerService: HandlerService = JavaHandlerService(), - heartBeatFactory: () -> HeartBeatRunner = ::JavaHeartBeatRunner, - val disconnectFromCore: (() -> Unit)? = null, - private val initCallback: ((Session) -> Unit)? = null, - exceptionHandler: ((Throwable) -> Unit)? = null, - private val hasErroredCallback: ((Error) -> Unit)? = null, - private val notificationManager: NotificationManager? = null, - backlogStorage: BacklogStorage? = null -) : ProtocolHandler(exceptionHandler), ISession { - override val objectStorage: ObjectStorage = ObjectStorage(this) - override val proxy: SignalProxy = this - override val features = Features(clientData.clientFeatures, QuasselFeatures.empty()) - - override val sslSession - get() = coreConnection.sslSession - - private val coreConnection = CoreConnection( - address, - clientData, - requireSsl, - features, - handlerService, - trustManager, - hostnameVerifier - ) - - private val __error = ReusableUnicastSubject.create<Error>() - private val __connectionError = ReusableUnicastSubject.create<Throwable>() - private val __initProgress = BehaviorSubject.createDefault(0 to 0) - override val progress = ISession.ProgressData( - coreConnection.state, - __initProgress, - __error.publish().refCount() - ) - - override val aliasManager = AliasManager(this) - override val backlogManager = BacklogManager(this, backlogStorage) - override val bufferViewManager = BufferViewManager(this) - override val bufferSyncer = BufferSyncer(this, notificationManager) - override var certManagers = emptyMap<IdentityId, CertManager>() - private set - override val coreInfo = CoreInfo(this) - override val dccConfig = DccConfig(this) - - override var identities = emptyMap<IdentityId, Identity>() - private set - private val live_identities = BehaviorSubject.createDefault(Unit) - override fun liveIdentities(): Observable<Map<IdentityId, Identity>> = live_identities.map { identities } - - override val ignoreListManager = IgnoreListManager(this) - override val highlightRuleManager = HighlightRuleManager(this) - override val ircListHelper = IrcListHelper(this) - - override var networks = emptyMap<NetworkId, Network>() - private set - private val live_networks = BehaviorSubject.createDefault(Unit) - override fun liveNetworks(): Observable<Map<NetworkId, Network>> = live_networks.map { networks } - - private val network_added = PublishSubject.create<NetworkId>() - override fun liveNetworkAdded(): Observable<NetworkId> = network_added - - override val networkConfig = NetworkConfig(this) - - override val rpcHandler = RpcHandler(this, backlogStorage, notificationManager) - - override val lag = BehaviorSubject.createDefault(0L) - - private val heartBeatThread = heartBeatFactory() - - init { - heartBeatThread.setCloseCallback(::close) - heartBeatThread.setHeartbeatDispatchCallback(::dispatch) - coreConnection.setHandlers(this, ::handle, ::handleConnectionError) - coreConnection.start() - } - - private fun handleError(error: Error) { - hasErroredCallback?.invoke(error) - __error.onNext(error) - } - - override fun handle(f: HandshakeMessage.ClientInitAck): Boolean { - features.core = QuasselFeatures(f.coreFeatures, f.featureList) - - if (f.coreConfigured == true) { - login() - } else { - handleError(Error.HandshakeError(f)) - } - return true - } - - private fun login() { - dispatch( - HandshakeMessage.ClientLogin( - user = userData.first, - password = userData.second - ) - ) - } - - override fun login(user: String, pass: String) { - userData = Pair(user, pass) - login() - } - - override fun setupCore(setupData: HandshakeMessage.CoreSetupData) { - dispatch(setupData) - } - - override fun handle(f: HandshakeMessage.CoreSetupAck): Boolean { - login() - return true - } - - override fun handle(f: HandshakeMessage.ClientInitReject): Boolean { - handleError(Error.HandshakeError(f)) - return true - } - - override fun handle(f: HandshakeMessage.CoreSetupReject): Boolean { - handleError(Error.HandshakeError(f)) - return true - } - - override fun handle(f: HandshakeMessage.ClientLoginReject): Boolean { - handleError(Error.HandshakeError(f)) - return true - } - - fun handle(f: QuasselSecurityException) { - handleError(Error.SslError(f)) - } - - fun handleConnectionError(connectionError: Throwable) { - __connectionError.onNext(connectionError) - } - - override fun addNetwork(networkId: NetworkId) { - val network = Network(networkId, this) - networks = networks + Pair(networkId, network) - synchronize(network) - live_networks.onNext(Unit) - network_added.onNext(networkId) - } - - override fun removeNetwork(networkId: NetworkId) { - val network = networks[networkId] - networks = networks - networkId - stopSynchronize(network) - live_networks.onNext(Unit) - } - - override fun addIdentity(initData: QVariantMap) { - val identity = Identity(this) - identity.fromVariantMap(initData) - identities = identities + Pair(identity.id(), identity) - synchronize(identity) - live_identities.onNext(Unit) - } - - override fun removeIdentity(identityId: IdentityId) { - val identity = identities[identityId] - identities = identities - identityId - stopSynchronize(identity) - live_identities.onNext(Unit) - } - - override fun disconnectFromCore() { - disconnectFromCore?.invoke() - } - - override fun handle(f: HandshakeMessage.SessionInit): Boolean { - coreConnection.setState(ConnectionState.INIT) - - handlerService.backend { - bufferSyncer.initSetBufferInfos(f.bufferInfos) - - networks = f.networkIds?.map { - Pair(it.value(NetworkId(-1)), Network(it.value(NetworkId(-1)), this)) - }?.toMap().orEmpty() - live_networks.onNext(Unit) - - val identityCertmanagerPairs = f.identities?.map { - val identity = Identity(this) - identity.fromVariantMap(it.valueOr(::emptyMap)) - identity.initialized = true - identity.init() - synchronize(identity) - - val certManager = CertManager(identity.id(), this) - Pair(identity, certManager) - }?.toMap().orEmpty() - - identities = identityCertmanagerPairs.map { (identity, _) -> - Pair(identity.id(), identity) - }.toMap() - - certManagers = identityCertmanagerPairs.map { (identity, certManager) -> - Pair(identity.id(), certManager) - }.toMap() - - isInitializing = true - networks.values.forEach { syncableObject -> this.synchronize(syncableObject, true) } - certManagers.values.forEach { syncableObject -> this.synchronize(syncableObject, true) } - - synchronize(aliasManager, true) - synchronize(bufferSyncer, true) - synchronize(bufferViewManager, true) - synchronize(coreInfo, true) - if (features.negotiated.hasFeature(ExtendedFeature.DccFileTransfer)) - synchronize(dccConfig, true) - synchronize(ignoreListManager, true) - if (features.negotiated.hasFeature(ExtendedFeature.CoreSideHighlights)) - synchronize(highlightRuleManager, true) - synchronize(ircListHelper, true) - synchronize(networkConfig, true) - - synchronize(backlogManager) - } - - heartBeatThread.start() - - return true - } - - override fun onInitStatusChanged(progress: Int, total: Int) { - __initProgress.onNext(Pair(progress, total)) - } - - override fun onInitDone() { - initCallback?.invoke(this) - for (config in bufferViewManager.bufferViewConfigs()) { - for (info in bufferSyncer.bufferInfos()) { - config.handleBuffer(info, bufferSyncer) - } - } - notificationManager?.init(this) - coreConnection.setState(ConnectionState.CONNECTED) - } - - override fun handle(f: SignalProxyMessage.HeartBeatReply): Boolean { - val now = Instant.now() - heartBeatThread.setLastHeartBeatReply(f.timestamp) - val latency = now.toEpochMilli() - f.timestamp.toEpochMilli() - log(INFO, "Heartbeat", "Received Heartbeat with ${latency}ms latency") - lag.onNext(latency) - return true - } - - override fun dispatch(message: SignalProxyMessage) { - if (closed) return - coreConnection.dispatch(message) - } - - override fun dispatch(message: HandshakeMessage) { - if (closed) return - coreConnection.dispatch(message) - } - - override fun network(id: NetworkId): Network? = networks[id] - override fun identity(id: IdentityId): Identity? = identities[id] - - override fun close() { - super.close() - - heartBeatThread.end() - coreConnection.close() - - objectStorage.deinit() - - aliasManager.deinit() - bufferSyncer.deinit() - bufferViewManager.deinit() - coreInfo.deinit() - dccConfig.deinit() - ignoreListManager.deinit() - highlightRuleManager.deinit() - ircListHelper.deinit() - networkConfig.deinit() - backlogManager.deinit() - rpcHandler.deinit() - - certManagers = emptyMap() - identities = emptyMap() - live_identities.onNext(Unit) - networks = emptyMap() - live_networks.onNext(Unit) - } - - fun join() { - coreConnection.join() - } -} diff --git a/lib/src/main/java/de/kuschku/libquassel/session/SessionManager.kt b/lib/src/main/java/de/kuschku/libquassel/session/SessionManager.kt deleted file mode 100644 index b0d725cd59624b1833e76c7b49c56c2c6158c7d4..0000000000000000000000000000000000000000 --- a/lib/src/main/java/de/kuschku/libquassel/session/SessionManager.kt +++ /dev/null @@ -1,186 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.libquassel.session - -import de.kuschku.libquassel.connection.ConnectionState -import de.kuschku.libquassel.protocol.message.HandshakeMessage -import de.kuschku.libquassel.quassel.syncables.interfaces.invokers.Invokers -import de.kuschku.libquassel.session.manager.ConnectionInfo -import de.kuschku.libquassel.session.manager.SessionState -import de.kuschku.libquassel.util.compatibility.HandlerService -import de.kuschku.libquassel.util.compatibility.LoggingHandler.Companion.log -import de.kuschku.libquassel.util.compatibility.LoggingHandler.LogLevel.* -import de.kuschku.libquassel.util.helper.combineLatest -import de.kuschku.libquassel.util.helper.or -import de.kuschku.libquassel.util.helper.safeSwitchMap -import de.kuschku.libquassel.util.helper.value -import io.reactivex.Observable -import io.reactivex.disposables.Disposable - -class SessionManager( - offlineSession: ISession, - private val backlogStorage: BacklogStorage, - private val notificationManager: NotificationManager?, - val handlerService: HandlerService, - private val heartBeatFactory: () -> HeartBeatRunner, - private val exceptionHandler: (Throwable) -> Unit -) : SessionStateHandler(SessionState(offlineSession, null, null)) { - // Stateful fields - private var lastConnectionInfo: ConnectionInfo? = null - private var hasErrored: Boolean = false - private var hasBeenDisconnected: Boolean = false - - private val disposables = mutableListOf<Disposable>() - - // Helping Rx Mappers - val connectionProgress: Observable<Triple<ConnectionState, Int, Int>> = progressData.safeSwitchMap { - combineLatest(it.state, it.progress).map { (state, progress) -> - Triple(state, progress.first, progress.second) - } - } - - // Listeners - private var disconnectFromCore: (() -> Unit)? = null - private var initCallback: ((Session) -> Unit)? = null - - fun setDisconnectFromCore(callback: (() -> Unit)?) { - this.disconnectFromCore = callback - } - - fun setInitCallback(callback: ((Session) -> Unit)?) { - this.initCallback = callback - } - - init { - log(INFO, "Session", "Session created") - - disposables.add(state.distinctUntilChanged().subscribe { state: ConnectionState -> - if (state == ConnectionState.CONNECTED) { - updateStateConnected() - } - }) - - // This should preload them - Invokers - } - - fun login(user: String, pass: String) { - connectingSession.value?.login(user, pass) - } - - fun setupCore(setupData: HandshakeMessage.CoreSetupData) { - connectingSession.value?.setupCore(setupData) - } - - fun connect( - connectionInfo: ConnectionInfo - ) { - log(DEBUG, "SessionManager", "Connecting") - lastConnectionInfo = connectionInfo - hasErrored = false - updateStateConnecting(Session( - connectionInfo.address, - connectionInfo.userData, - connectionInfo.requireSsl, - connectionInfo.trustManager, - connectionInfo.hostnameVerifier, - connectionInfo.clientData, - handlerService, - heartBeatFactory, - disconnectFromCore, - initCallback, - exceptionHandler, - ::hasErroredCallback, - notificationManager, - backlogStorage - )) - } - - fun hasErroredCallback(error: Error) { - log(WARN, "SessionManager", "Callback Error occured: $error") - hasErrored = true - } - - fun canAutoReconnect( - ignoreConnectionState: Boolean = false, - ignoreSetting: Boolean = false, - ignoreErrors: Boolean = false, - connectionInfo: ConnectionInfo? = lastConnectionInfo - ): Boolean { - if (hasBeenDisconnected) { - log(DEBUG, "SessionManager", "Reconnect not possible: manually disconnected") - return false - } - - if (connectionInfo == null) { - log(DEBUG, "SessionManager", "Reconnect not possible: not enough data available") - return false - } - - if (!connectionInfo.shouldReconnect && !ignoreSetting) { - log(DEBUG, "SessionManager", "Reconnect not possible: reconnect not allowed") - return false - } - - val connectionState = state.or(ConnectionState.DISCONNECTED) - if (connectionState != ConnectionState.DISCONNECTED && - connectionState != ConnectionState.CLOSED && - !ignoreConnectionState) { - log(DEBUG, "SessionManager", "Reconnect not possible: connection state is $connectionState") - return false - } - - if (hasErrored && !ignoreErrors) { - log(DEBUG, "SessionManager", "Reconnect not possible: errors have been thrown") - return false - } - - return true - } - - fun autoConnect( - ignoreConnectionState: Boolean = false, - ignoreSetting: Boolean = false, - ignoreErrors: Boolean = false, - connectionInfo: ConnectionInfo? = lastConnectionInfo - ): Boolean { - if (!canAutoReconnect(ignoreConnectionState, ignoreSetting, ignoreErrors, connectionInfo)) - return false - - log(DEBUG, "SessionManager", "Reconnect successful") - connect(connectionInfo!!) - return true - } - - fun disconnect(forever: Boolean) { - hasBeenDisconnected = true - if (forever) backlogStorage.clearMessages() - updateStateOffline() - } - - fun dispose() { - setDisconnectFromCore(null) - setInitCallback(null) - for (disposable in disposables) { - if (!disposable.isDisposed) - disposable.dispose() - } - } -} diff --git a/lib/src/main/java/de/kuschku/libquassel/session/SessionStateHandler.kt b/lib/src/main/java/de/kuschku/libquassel/session/SessionStateHandler.kt deleted file mode 100644 index 8251f27188471bc071d44efb74d99859cfcb6216..0000000000000000000000000000000000000000 --- a/lib/src/main/java/de/kuschku/libquassel/session/SessionStateHandler.kt +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.libquassel.session - -import de.kuschku.libquassel.session.manager.SessionState -import de.kuschku.libquassel.util.helper.safeSwitchMap -import de.kuschku.libquassel.util.helper.safeValue -import io.reactivex.subjects.BehaviorSubject - -open class SessionStateHandler constructor( - initialState: SessionState -) { - private val sessions = BehaviorSubject.createDefault(initialState) - - val connectedSession = sessions.map { - it.connected - ?: it.offline - } - - val connectingSession = sessions.map { - it.connecting - ?: it.connected - ?: it.offline - } - - val progressData = connectingSession.map { - it.progress - } - - val errors = progressData.safeSwitchMap { - it.error - } - - val progress = progressData.safeSwitchMap { - it.progress - } - - val state = progressData.safeSwitchMap { - it.state - } - - private fun updateState(f: SessionState.() -> SessionState) { - sessions.onNext(f(sessions.safeValue)) - } - - protected fun updateStateConnecting(connectingSession: ISession) = updateState { - connecting?.close() - copy(connecting = connectingSession) - } - - protected fun updateStateConnected() = updateState { - connected?.close() - copy(connected = connecting, connecting = null) - } - - protected fun updateStateOffline() = updateState { - connected?.close() - connecting?.close() - copy(connecting = null, connected = null) - } -} diff --git a/lib/src/main/java/de/kuschku/libquassel/session/SignalProxy.kt b/lib/src/main/java/de/kuschku/libquassel/session/SignalProxy.kt deleted file mode 100644 index 7b90c2bb24805e7410d61a6623658e82ead642f7..0000000000000000000000000000000000000000 --- a/lib/src/main/java/de/kuschku/libquassel/session/SignalProxy.kt +++ /dev/null @@ -1,92 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.libquassel.session - -import de.kuschku.libquassel.connection.Features -import de.kuschku.libquassel.protocol.IdentityId -import de.kuschku.libquassel.protocol.NetworkId -import de.kuschku.libquassel.protocol.QVariantList -import de.kuschku.libquassel.protocol.message.HandshakeMessage -import de.kuschku.libquassel.protocol.message.SignalProxyMessage -import de.kuschku.libquassel.quassel.QuasselFeatures -import de.kuschku.libquassel.quassel.syncables.Identity -import de.kuschku.libquassel.quassel.syncables.Network -import de.kuschku.libquassel.quassel.syncables.interfaces.ISyncableObject - -interface SignalProxy { - fun handle(f: SignalProxyMessage.SyncMessage) = false - fun handle(f: SignalProxyMessage.RpcCall) = false - fun handle(f: SignalProxyMessage.InitRequest) = false - fun handle(f: SignalProxyMessage.InitData) = false - fun handle(f: SignalProxyMessage.HeartBeat) = false - fun handle(f: SignalProxyMessage.HeartBeatReply) = false - - fun handle(f: SignalProxyMessage): Boolean = when (f) { - is SignalProxyMessage.SyncMessage -> handle(f) - is SignalProxyMessage.RpcCall -> handle(f) - is SignalProxyMessage.InitRequest -> handle(f) - is SignalProxyMessage.InitData -> handle(f) - is SignalProxyMessage.HeartBeat -> handle(f) - is SignalProxyMessage.HeartBeatReply -> handle(f) - } - - fun dispatch(message: SignalProxyMessage) - fun dispatch(message: HandshakeMessage) - - fun callSync(type: String, instance: String, slot: String, params: QVariantList) - fun callRpc(slot: String, params: QVariantList) - - fun shouldSync(type: String, instance: String, slot: String): Boolean - fun shouldRpc(slot: String): Boolean - - fun network(id: NetworkId): Network? - fun identity(id: IdentityId): Identity? - - fun renameObject(syncableObject: ISyncableObject, newName: String, oldName: String) - fun renameObject(className: String, newName: String, oldName: String) - fun synchronize(syncableObject: ISyncableObject?, baseInit: Boolean) - fun synchronize(syncableObject: ISyncableObject?) = synchronize(syncableObject, false) - fun stopSynchronize(syncableObject: ISyncableObject?) - - val features: Features - - companion object { - val NULL = object : SignalProxy { - override fun dispatch(message: SignalProxyMessage) = Unit - override fun dispatch(message: HandshakeMessage) = Unit - override fun callSync(type: String, instance: String, slot: String, - params: QVariantList) = Unit - - override fun callRpc(slot: String, params: QVariantList) = Unit - override fun shouldSync(type: String, instance: String, slot: String) = false - override fun shouldRpc(slot: String) = false - override fun network(id: NetworkId): Network? = null - override fun identity(id: IdentityId): Identity? = null - override fun renameObject(syncableObject: ISyncableObject, newName: String, - oldName: String) = Unit - - override fun renameObject(className: String, newName: String, oldName: String) = Unit - override fun synchronize(syncableObject: ISyncableObject?, baseInit: Boolean) = Unit - override fun stopSynchronize(syncableObject: ISyncableObject?) = Unit - - override val features get() = Features(QuasselFeatures.empty(), QuasselFeatures.empty()) - } - } -} diff --git a/lib/src/main/java/de/kuschku/libquassel/session/manager/ConnectionInfo.kt b/lib/src/main/java/de/kuschku/libquassel/session/manager/ConnectionInfo.kt deleted file mode 100644 index da961d408d3999c79f17a2a9d9f51826a57d07c4..0000000000000000000000000000000000000000 --- a/lib/src/main/java/de/kuschku/libquassel/session/manager/ConnectionInfo.kt +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.libquassel.session.manager - -import de.kuschku.libquassel.connection.SocketAddress -import de.kuschku.libquassel.protocol.ClientData -import javax.net.ssl.HostnameVerifier -import javax.net.ssl.X509TrustManager - -data class ConnectionInfo( - val clientData: ClientData, - val trustManager: X509TrustManager, - val hostnameVerifier: HostnameVerifier, - val address: SocketAddress, - val userData: Pair<String, String>, - val requireSsl: Boolean, - val shouldReconnect: Boolean -) diff --git a/lib/src/main/java/de/kuschku/libquassel/session/manager/SessionState.kt b/lib/src/main/java/de/kuschku/libquassel/session/manager/SessionState.kt deleted file mode 100644 index f1c2d9e9bccec0260d658a28cb18615f68f9870e..0000000000000000000000000000000000000000 --- a/lib/src/main/java/de/kuschku/libquassel/session/manager/SessionState.kt +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.libquassel.session.manager - -import de.kuschku.libquassel.session.ISession - -data class SessionState( - val offline: ISession, - val connecting: ISession?, - val connected: ISession? -) diff --git a/lib/src/main/java/de/kuschku/libquassel/ssl/TrustManagers.kt b/lib/src/main/java/de/kuschku/libquassel/ssl/TrustManagers.kt deleted file mode 100644 index 736030725dc15ad88896bc9beb17b1dd15a751df..0000000000000000000000000000000000000000 --- a/lib/src/main/java/de/kuschku/libquassel/ssl/TrustManagers.kt +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.libquassel.ssl - -import java.security.GeneralSecurityException -import java.security.KeyStore -import java.security.cert.X509Certificate -import javax.net.ssl.KeyManagerFactory -import javax.net.ssl.TrustManagerFactory -import javax.net.ssl.X509TrustManager - -object TrustManagers { - fun default() = TrustManagerFactory.getInstance(KeyManagerFactory.getDefaultAlgorithm()).apply { - init(null as KeyStore?) - }.trustManagers.mapNotNull { - it as? X509TrustManager - }.firstOrNull() ?: throw GeneralSecurityException("No TrustManager available") - - fun trustAll() = TrustAllX509TrustManager() - - class TrustAllX509TrustManager : X509TrustManager { - override fun checkClientTrusted(p0: Array<out X509Certificate>?, p1: String?) = Unit - override fun checkServerTrusted(p0: Array<out X509Certificate>?, p1: String?) = Unit - override fun getAcceptedIssuers(): Array<X509Certificate> = emptyArray() - } -} diff --git a/lib/src/main/java/de/kuschku/libquassel/ssl/X500PrincipalHelper.kt b/lib/src/main/java/de/kuschku/libquassel/ssl/X500PrincipalHelper.kt deleted file mode 100644 index 9521591cf6ae8a4f65d6cf0ceab92f613621678a..0000000000000000000000000000000000000000 --- a/lib/src/main/java/de/kuschku/libquassel/ssl/X500PrincipalHelper.kt +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.libquassel.ssl - -import javax.security.auth.x500.X500Principal - -val X500Principal.commonName - get() = commonName(name) - -fun commonName(distinguishedName: String) = - X509Helper.COMMON_NAME.find(distinguishedName)?.groups?.get(1)?.value - -val X500Principal.organization - get() = organization(name) - -fun organization(distinguishedName: String) = - X509Helper.ORGANIZATION.find(distinguishedName)?.groups?.get(1)?.value - -val X500Principal.organizationalUnit - get() = organizationalUnit(name) - -fun organizationalUnit(distinguishedName: String) = - X509Helper.ORGANIZATIONAL_UNIT.find(distinguishedName)?.groups?.get(1)?.value diff --git a/lib/src/main/java/de/kuschku/libquassel/ssl/X509CertificateHelper.kt b/lib/src/main/java/de/kuschku/libquassel/ssl/X509CertificateHelper.kt deleted file mode 100644 index ca88664e4e2026f4b3f380bc77257ca72225e398..0000000000000000000000000000000000000000 --- a/lib/src/main/java/de/kuschku/libquassel/ssl/X509CertificateHelper.kt +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.libquassel.ssl - -import javax.security.cert.X509Certificate - -fun X509Certificate.toJavaCertificate() = X509Helper.convert(this) -fun Array<X509Certificate>.toJavaCertificate() = X509Helper.convert(this) diff --git a/lib/src/main/java/de/kuschku/libquassel/ssl/X509Helper.kt b/lib/src/main/java/de/kuschku/libquassel/ssl/X509Helper.kt deleted file mode 100644 index 51412f517cc00c99a054df81b42225af9743198f..0000000000000000000000000000000000000000 --- a/lib/src/main/java/de/kuschku/libquassel/ssl/X509Helper.kt +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.libquassel.ssl - -import java.io.ByteArrayInputStream -import java.security.cert.CertificateFactory -import java.security.cert.X509Certificate - -object X509Helper { - private val certificateFactory = CertificateFactory.getInstance("X.509") - - fun hostnames(certificate: X509Certificate): Sequence<String> = - (sequenceOf(certificate.subjectX500Principal.commonName) + subjectAlternativeNames(certificate)) - .filterNotNull() - .distinct() - - fun subjectAlternativeNames(certificate: X509Certificate): Sequence<String> = - certificate.subjectAlternativeNames.orEmpty().asSequence().mapNotNull { - val type = it[0] as? Int - val name = it[1] as? String - if (type != null && name != null) Pair(type, name) - else null - }.filter { (type, _) -> - // 2 is DNS Name - type == 2 - }.map { (_, name) -> - name - } - - fun convert(certificate: javax.security.cert.X509Certificate) = - certificateFactory.generateCertificate(ByteArrayInputStream(certificate.encoded)) as? X509Certificate - - fun convert(chain: Array<out javax.security.cert.X509Certificate>): Array<X509Certificate>? = - chain.map { convert(it) ?: return null }.toTypedArray() - - - val COMMON_NAME = Regex("""(?:^|,\s?)(?:CN=("(?:[^"]|"")+"|[^,]+))""") - val ORGANIZATION = Regex("""(?:^|,\s?)(?:O=("(?:[^"]|"")+"|[^,]+))""") - val ORGANIZATIONAL_UNIT = Regex("""(?:^|,\s?)(?:OU=("(?:[^"]|"")+"|[^,]+))""") -} diff --git a/lib/src/main/java/de/kuschku/libquassel/util/CRCUtils.kt b/lib/src/main/java/de/kuschku/libquassel/util/CRCUtils.kt deleted file mode 100644 index 0a047c6a08f55e800ddae8bd50276ca903e24f44..0000000000000000000000000000000000000000 --- a/lib/src/main/java/de/kuschku/libquassel/util/CRCUtils.kt +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.libquassel.util - -object CRCUtils { - fun qChecksum(data: ByteArray): Int { - var crc = 0xffff - val crcHighBitMask = 0x8000 - - for (b in data) { - val c = reflect(b.toInt(), 8) - var j = 0x80 - while (j > 0) { - var highBit = crc and crcHighBitMask - crc = crc shl 1 - if (c and j > 0) { - highBit = highBit xor crcHighBitMask - } - if (highBit > 0) { - crc = crc xor 0x1021 - } - j = j shr 1 - } - } - - crc = reflect(crc, 16) - crc = crc xor 0xffff - crc = crc and 0xffff - - return crc - } - - private fun reflect(crc: Int, n: Int): Int { - var j = 1 - var crcout = 0 - var i = 1 shl n - 1 - while (i > 0) { - if (crc and i > 0) { - crcout = crcout or j - } - j = j shl 1 - i = i shr 1 - } - return crcout - } -} diff --git a/lib/src/main/java/de/kuschku/libquassel/util/ExpressionMatch.kt b/lib/src/main/java/de/kuschku/libquassel/util/ExpressionMatch.kt deleted file mode 100644 index 67185fdbf3d90e4de2b4d1c66e571c833af7dc94..0000000000000000000000000000000000000000 --- a/lib/src/main/java/de/kuschku/libquassel/util/ExpressionMatch.kt +++ /dev/null @@ -1,1142 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.libquassel.util - -import de.kuschku.libquassel.util.compatibility.LoggingHandler.Companion.log -import de.kuschku.libquassel.util.compatibility.LoggingHandler.LogLevel -import java.io.Serializable -import java.util.regex.PatternSyntaxException - -class ExpressionMatch : Serializable { - enum class MatchMode { - /** Match phrase as specified, no special handling */ - MatchPhrase, - /** Match phrase as specified, split on \n only */ - MatchMultiPhrase, - /** Match wildcards, "!" at start inverts, "\" escapes */ - MatchWildcard, - /** Match wildcards, split ; or \n, "!" at start inverts, "\" escapes */ - MatchMultiWildcard, - /** Match as regular expression, "!..." invert regex, "\" escapes */ - MatchRegEx - } - - /** - * Construct an Expression match with the given parameters - * - * @param expression A phrase, wildcard expression, or regular expression - * @param mode Expression matching mode @see ExpressionMatch.MatchMode - * @param caseSensitive If true, match case-sensitively, otherwise ignore case when matching - */ - constructor(expression: String, mode: MatchMode, caseSensitive: Boolean) { - // Store the original parameters for later reference - _sourceExpression = expression - _sourceMode = mode - _sourceCaseSensitive = caseSensitive - - // Calculate the internal regex - // - // Do this now instead of on-demand to provide immediate feedback on errors when editing - // highlight and ignore rules. - cacheRegEx() - } - - /** - * Check if the given string matches the stored expression - * - * @param string String to check - * @param matchEmpty If true, always match when the expression is empty, otherwise never match - * @return True if match found, otherwise false - */ - fun match(string: String, matchEmpty: Boolean = false): Boolean { - // Handle empty expression strings - if (_sourceExpressionEmpty) { - // Match found if matching empty is allowed, otherwise no match found - return matchEmpty - } - - if (!isValid()) { - // Can't match on an invalid rule - return false - } - - // We have "_matchRegEx", "_matchInvertRegEx", or both due to isValid() check above - - // If specified, first check inverted rules - val _matchInvertRegEx = _matchInvertRegEx - if (_matchInvertRegExActive && _matchInvertRegEx != null) { - // Check inverted match rule - if (_matchInvertRegEx.containsMatchIn(string)) { - // Inverted rule matched, the rest of the rule cannot match - return false - } - } - - val _matchRegEx = _matchRegEx - if (_matchRegExActive && _matchRegEx != null) { - // Check regular match rule - return _matchRegEx.containsMatchIn(string) - } else { - // If no valid regular rules exist, due to the isValid() check there must be valid inverted - // rules that did not match. Count this as properly matching (implicit wildcard). - return true - } - } - - /** - * Gets if the source expression is empty - * - * @return True if source expression is empty, otherwise false - */ - fun isEmpty() = _sourceExpressionEmpty - - /** - * Gets if the source expression and parameters resulted in a valid expression matcher - * - * @return True if given expression is valid, otherwise false - */ - fun isValid(): Boolean { - return _sourceExpressionEmpty || - ((!_matchRegExActive || _matchRegEx != null) && - (!_matchInvertRegExActive || _matchInvertRegEx != null)) - } - - var sourceExpression - /** - * Gets the original expression match string - * - * @return String of the source expression match string - */ - get() = _sourceExpression - /** - * Sets the expression match string - * - * @param expression A phrase, wildcard expression, or regular expression - */ - set(expression) { - if (_sourceExpression != expression) { - _sourceExpression = expression - cacheRegEx() - } - } - - var sourceMode - /** - * Gets the original expression match mode - * - * @return MatchMode of the source expression - */ - get() = _sourceMode - /** - * Sets the expression match mode - * - * @param mode Expression matching mode (see ExpressionMatch.MatchMode) - */ - set(mode) { - if (_sourceMode != mode) { - _sourceMode = mode - cacheRegEx() - } - } - - var sourceCaseSensitive - /** - * Gets the original expression case-sensitivity - * - * @return True if case-sensitive, otherwise false - */ - get() = _sourceCaseSensitive - /** - * Sets the expression match as case sensitive or not - * - * @param caseSensitive If true, match case-sensitively, otherwise ignore case when matching - */ - set(caseSensitive) { - if (_sourceCaseSensitive != caseSensitive) { - _sourceCaseSensitive = caseSensitive - cacheRegEx() - } - } - - override fun equals(other: Any?): Boolean { - return other is ExpressionMatch && - _sourceExpression == other._sourceExpression && - _sourceMode == other._sourceMode && - _sourceCaseSensitive == other._sourceCaseSensitive - } - - override fun hashCode(): Int { - var result = _sourceExpression.hashCode() - result = 31 * result + _sourceMode.hashCode() - result = 31 * result + _sourceCaseSensitive.hashCode() - return result - } - - private fun cacheRegEx() { - _matchRegExActive = false - _matchInvertRegExActive = false - - _sourceExpressionEmpty = _sourceExpression.isEmpty() - if (_sourceExpressionEmpty) { - // No need to calculate anything for empty strings - return - } - - // Convert the given expression to a regular expression based on the mode - when (_sourceMode) { - MatchMode.MatchPhrase -> { - // Match entire phrase, noninverted - // Don't trim whitespace for phrase matching as someone might want to match on " word ", a - // more-specific request than "word". - _matchRegEx = regExFactory("(?:^|\\W)" + regExEscape(_sourceExpression) + "(?:\\W|$)", - _sourceCaseSensitive) - _matchRegExActive = true - } - MatchMode.MatchMultiPhrase -> { - // Match multiple entire phrases, noninverted - // Convert from multiple-phrase rules - _matchRegEx = regExFactory(convertFromMultiPhrase(_sourceExpression), _sourceCaseSensitive) - _matchRegExActive = true - } - MatchMode.MatchWildcard -> { - // Match as wildcard expression - // Convert from wildcard rules for a single wildcard - if (_sourceExpression.startsWith("!")) { - // Inverted rule: take the remainder of the string - // "^" + invertComponents.at(0) + "$" - _matchInvertRegEx = regExFactory("^" + wildcardToRegEx(_sourceExpression.substring(1)) + "$", - _sourceCaseSensitive) - _matchInvertRegExActive = true - } else { - // Normal rule: take the whole string - // Account for any escaped "!" (i.e. "\!") by skipping past the "\", but don't skip past - // escaped "\" (i.e. "\\!") - val expression = - if (_sourceExpression.startsWith("\\!")) _sourceExpression.substring(1) - else _sourceExpression - _matchRegEx = regExFactory("^" + wildcardToRegEx(expression) + "$", _sourceCaseSensitive) - _matchRegExActive = true - } - } - MatchMode.MatchMultiWildcard -> { - // Match as multiple wildcard expressions - // Convert from wildcard rules for multiple wildcards - // (The generator function handles setting matchRegEx/matchInvertRegEx) - generateFromMultiWildcard(_sourceExpression, _sourceCaseSensitive) - } - MatchMode.MatchRegEx -> { - // Match as regular expression - if (_sourceExpression.startsWith("!")) { - // Inverted rule: take the remainder of the string - _matchInvertRegEx = regExFactory(_sourceExpression.substring(1), _sourceCaseSensitive) - _matchInvertRegExActive = true - } else { - // Normal rule: take the whole string - // Account for any escaped "!" (i.e. "\!") by skipping past the "\", but don't skip past - // escaped "\" (i.e. "\\!") - val expression = - if (_sourceExpression.startsWith("\\!")) _sourceExpression.substring(1) - else _sourceExpression - _matchRegEx = regExFactory(expression, _sourceCaseSensitive) - _matchRegExActive = true - } - } - } - - if (!isValid()) { - // This can happen with invalid regex, so make it a bit more user-friendly. Set it to Info - // level as ideally someone's not just going to leave a broken match rule around. For - // MatchRegEx, they probably need to fix their regex rule. For the other modes, there's - // probably a bug in the parsing routines (which should also be fixed). - - log(LogLevel.INFO, - "ExpressionMatch", - "Could not parse expression match rule $_sourceExpression (match mode: $_sourceMode), this rule will be ignored") - } - } - - /** - * Internally converts a wildcard rule into regular expressions - * - * Splits wildcards on ";" and "\n", "!..." inverts section, "\" escapes - * - * @param originalRule MultiWildcard rule list, ";"-separated - * @param caseSensitive If true, match case-sensitively, otherwise ignore case when matching - */ - private fun generateFromMultiWildcard(originalRule: String, caseSensitive: Boolean) { - // Convert the wildcard rule into regular expression format - // First, reset the existing match expressions - _matchRegEx = null - _matchInvertRegEx = null - _matchRegExActive = false - _matchInvertRegExActive = false - - // This gets handled in three steps: - // - // 1. Break apart ";"-separated list into components - // 2. Convert components from wildcard format into regular expression format - // 3. Combine normal/invert components into normal/invert regular expressions - // - // Let's start by making the list... - - // Convert a ";"-separated list into an actual list, splitting on newlines and unescaping - // escaped characters - - // Escaped list rules (where "[\n]" represents newline): - // --------------- - // Token | Outcome - // -------|-------- - // ; | Split - // \; | Replace with ";" - // \\; | Split (keep as "\\") - // ! | At start: mark as inverted - // \! | At start: replace with "!" - // \\! | At start: keep as "\\!" (replaced with "\!" in wildcard conversion) - // ! | Elsewhere: keep as "!" - // \! | Elsewhere: keep as "\!" - // \\! | Elsewhere: keep as "\\!" - // \\\ | Keep as "\\" + "\", set consecutive slashes to 1 - // [\n] | Split - // \[\n] | Split (keep as "\") - // \\[\n] | Split (keep as "\\") - // ... | Keep as "..." - // \... | Keep as "\..." - // \\... | Keep as "\\..." - // - // Strings are forced to end with "\n", always applying "\..." and "\\..." rules - // "..." also includes another "\" character - // - // All whitespace is trimmed from each component - - // "\\" and "\" are not downconverted to allow for other escape codes to be detected in - // ExpressionMatch::wildcardToRegex - - // Example: - // - // > Wildcard rule - // norm;!invert; norm-space ; !invert-space ;;!;\!norm-escaped;\\!slash-invert;\\\\double; - // escape\;sep;slash-end-split\\;quad\\\\!noninvert;newline-split[\n]newline-split-slash\\[\n] - // slash-at-end\\ [line does not continue] - // - // (Newlines are encoded as "[\n]". Ignore linebreaks for the sake of comment wrapping.) - // - // - // > Normal components without wildcard conversion - // norm - // norm-space - // !norm-escaped - // \\!slash-invert - // \\\\double - // escape;sep - // slash-end-split\\ [line does not continue] - // quad\\\\!noninvert - // newline-split - // newline-split-slash\\ [line does not continue] - // slash-at-end\\ [line does not continue] - // - // > Inverted components without wildcard conversion - // invert - // invert-space - // - // - // > Normal components with wildcard conversion - // norm - // norm\-space - // \!norm\-escaped - // \\\!slash\-invert - // \\\\double - // escape\;sep - // slash\-end\-split\\ [line does not continue] - // quad\\\\\!noninvert - // newline\-split - // newline\-split\-slash\\ [line does not continue] - // slash\-at\-end\\ [line does not continue] - // - // > Inverted components with wildcard conversion - // invert - // invert\-space - // - // - // > Normal wildcard-converted regex - // ^(?:norm|norm\-space|\!norm\-escaped|\\\!slash\-invert|\\\\double|escape\;sep| - // slash\-end\-split\\|quad\\\\\!noninvert|newline\-split|newline\-split\-slash\\| - // slash\-at\-end\\)$ - // - // > Inverted wildcard-converted regex - // ^(?:invert|invert\-space)$ - - // Prepare to loop! - - var rule = originalRule - - // Force a termination at the end of the string to trigger a split - // Don't check for ";" splits as they may be escaped - if (!rule.endsWith("\n")) { - rule += "\n" - } - - // Result, sorted into normal and inverted rules - val normalComponents = mutableSetOf<String>() - val invertComponents = mutableSetOf<String>() - - // Current string - var curString = "" - // Consecutive "\" characters - var consecutiveSlashes = 0 - // Whether or not this marks an inverted rule - var isInverted = false - // Whether or not we're at the beginning of the rule (for detecting "!" and "\!") - var isRuleStart = true - - for (curChar in rule) { - // Check if it's on the list of special list characters - when (curChar) { - ';' -> { - // Separator found - when (consecutiveSlashes) { - 0, 2 -> { - // ";" -> Split - // ...or... - // "\\;" -> Split (keep as "\\") - // Not escaped separator, split into a new item - - // Apply the additional "\\" if needed - if (consecutiveSlashes == 2) { - // "\\;" -> Split (keep as "\\") - curString += """\\""" - } - - // Remove any whitespace, e.g. "item1; item2" -> " item2" -> "item2" - curString = curString.trim() - - // Skip empty items - if (curString.isNotEmpty()) { - // Add to inverted/normal list - if (isInverted) { - invertComponents.add(wildcardToRegEx(curString)) - } else { - normalComponents.add(wildcardToRegEx(curString)) - } - } - // Reset the current list item - curString = "" - isInverted = false - isRuleStart = true - } - 1 -> { - // "\;" -> Replace with ";" - curString += ";" - isRuleStart = false - } - else -> { - // This shouldn't ever happen (even with invalid wildcard rules), log a warning - log(LogLevel.WARN, - "ExpressionMatch", - "Wildcard rule $rule resulted in rule component $curString with unexpected count of consecutive '\\' ($consecutiveSlashes), ignoring $curChar character!") - isRuleStart = false - } - } - consecutiveSlashes = 0 - } - '!' -> { - // Rule inverter found - if (isRuleStart) { - // Apply the inverting logic - when (consecutiveSlashes) { - 0 -> { - // "!" -> At start: mark as inverted - isInverted = true - // Don't include the "!" character - } - 1 -> { - // "\!" -> At start: replace with "!" - curString += "!" - } - 2 -> { - // "\\!" -> At start: keep as "\\!" (replaced with "\!" in wildcard conversion) - curString += """\\!""" - } - else -> { - // This shouldn't ever happen (even with invalid wildcard rules), log a warning - log(LogLevel.WARN, - "ExpressionMatch", - "Wildcard rule $rule resulted in rule component $curString with unexpected count of consecutive '\\' ($consecutiveSlashes), ignoring $curChar character!") - } - } - } else { - // Preserve the characters as they are now - when (consecutiveSlashes) { - 0 -> { - // "!" -> Elsewhere: keep as "!" - curString += "!" - } - 1, 2 -> { - // "\!" -> Elsewhere: keep as "\!" - // "\\!" -> Elsewhere: keep as "\\!" - curString += """\""".repeat(consecutiveSlashes) + "!" - } - else -> { - // This shouldn't ever happen (even with invalid wildcard rules), log a warning - log(LogLevel.WARN, - "ExpressionMatch", - "Wildcard rule $rule resulted in rule component $curString with unexpected count of consecutive '\\' ($consecutiveSlashes), ignoring $curChar character!") - } - } - } - isRuleStart = false - consecutiveSlashes = 0 - } - '\\' -> { - // Split escape - // Increase consecutive slash count - consecutiveSlashes++ - // Check if we've reached "\\\"... - if (consecutiveSlashes == 3) { - // "\\\" -> Keep as "\\" + "\" - curString += """\\""" - // No longer at the rule start - isRuleStart = false - // Set consecutive slashes to 1, recognizing the trailing "\" - consecutiveSlashes = 1 - } else if (consecutiveSlashes > 3) { - // This shouldn't ever happen (even with invalid wildcard rules), log a warning - log(LogLevel.WARN, - "ExpressionMatch", - "Wildcard rule $rule resulted in rule component $curString with unexpected count of consecutive '\\' ($consecutiveSlashes), ignoring $curChar character!") - } - // Don't set "isRuleStart" here as "\" is used in escape sequences - } - '\n' -> { - // Newline found - // Preserve the characters as they are now - - // "[\n]" -> Split - // "\[\n]" -> Split (keep as "\") - // "\\[\n]" -> Split (keep as "\\") - - when (consecutiveSlashes) { - 0 -> { - // Keep string as is - } - 1, 2 -> { - // Apply the additional "\" or "\\" - curString += """\""".repeat(consecutiveSlashes) - } - else -> { - // This shouldn't ever happen (even with invalid wildcard rules), log a warning - log(LogLevel.WARN, - "ExpressionMatch", - "Wildcard rule $rule resulted in rule component $curString with unexpected count of consecutive '\\' ($consecutiveSlashes), applying newline split anyways!") - } - } - - // Remove any whitespace, e.g. "item1; item2" -> " item2" -> "item2" - curString = curString.trim() - - // Skip empty items - if (curString.isNotEmpty()) { - // Add to inverted/normal list - if (isInverted) { - invertComponents.add(wildcardToRegEx(curString)) - } else { - normalComponents.add(wildcardToRegEx(curString)) - } - } - // Reset the current list item - curString = "" - isInverted = false - isRuleStart = true - consecutiveSlashes = 0 - } - else -> { - // Preserve the characters as they are now - when (consecutiveSlashes) { - 0 -> { - // "..." -> Keep as "..." - curString += curChar - } - 1, 2 -> { - // "\..." -> Keep as "\..." - // "\\..." -> Keep as "\\..." - curString += """\""".repeat(consecutiveSlashes) + curChar - } - else -> { - log(LogLevel.WARN, - "ExpressionMatch", - "Wildcard rule $rule resulted in rule component $curString with unexpected count of consecutive '\\' ($consecutiveSlashes), ignoring $curChar char escape!") - } - } - // Don't mark as past rule start for whitespace (whitespace gets trimmed) - if (!curChar.isWhitespace()) { - isRuleStart = false - } - consecutiveSlashes = 0 - } - } - } - - // Create full regular expressions by... - // > Anchoring to start and end of string to mimic QRegExp's .exactMatch() handling, "^...$" - // > Enclosing within a non-capturing group to avoid overhead of text extraction, "(?:...)" - // > Flattening normal and inverted rules using the regex OR character "...|..." - // - // Before: [foo, bar, baz] - // After: ^(?:foo|bar|baz)$ - // - // See https://doc.qt.io/qt-5/qregularexpression.html#porting-from-qregexp-exactmatch - // And https://regex101.com/ - - // Any empty/invalid regex are handled within ExpressionMatch::match() - if (!normalComponents.isEmpty()) { - // Create normal match regex - if (normalComponents.count() == 1) { - // Single item, skip the noncapturing group - _matchRegEx = regExFactory("^${normalComponents.toList().first()}$", caseSensitive) - } else { - val buffer = StringBuilder() - buffer.append("^(?:") - normalComponents.joinTo(buffer, "|") - buffer.append(")$") - _matchRegEx = regExFactory(buffer.toString(), caseSensitive) - } - _matchRegExActive = true - } - if (!invertComponents.isEmpty()) { - // Create invert match regex - if (invertComponents.count() == 1) { - // Single item, skip the noncapturing group - _matchInvertRegEx = regExFactory("^${invertComponents.toList().first()}$", caseSensitive) - } else { - val buffer = StringBuilder() - buffer.append("^(?:") - invertComponents.joinTo(buffer, "|") - buffer.append(")$") - _matchInvertRegEx = regExFactory(buffer.toString(), caseSensitive) - } - _matchInvertRegExActive = true - } - } - - // Original/source components - /** Expression match string given on creation */ - private var _sourceExpression: String = "" - /** Expression match mode given on creation */ - private var _sourceMode: MatchMode = MatchMode.MatchPhrase - /** Expression case sensitive on creation */ - private var _sourceCaseSensitive: Boolean = false - - // Derived components - /** Cached expression match string is empty */ - private var _sourceExpressionEmpty: Boolean = false - - /** Underlying regular expression matching instance for normal (noninverted) rules */ - private var _matchRegEx: Regex? = null - /** If true, use normal expression in matching */ - private var _matchRegExActive: Boolean = false - - /** Underlying regular expression matching instance for inverted rules */ - private var _matchInvertRegEx: Regex? = null - /** If true, use invert expression in matching */ - private var _matchInvertRegExActive: Boolean = false - - companion object { - - /** - * Creates a regular expression object of appropriate type and case-sensitivity - * - * @param regExString Regular expression string - * @param caseSensitive If true, match case-sensitively, otherwise ignore case when matching - * @return Configured QRegularExpression - */ - private fun regExFactory(regExString: String, caseSensitive: Boolean) = try { - if (caseSensitive) Regex(regExString) - else Regex(regExString, RegexOption.IGNORE_CASE) - } catch (e: PatternSyntaxException) { - null - } - - /** - * Escapes any regular expression characters in a string so they have no special meaning - * - * @param phrase String containing potential regular expression special characters - * @return QString with all regular expression characters escaped - */ - private fun regExEscape(phrase: String): String { - val size = phrase.length - val result = StringBuilder(size) - var i = 0 - while (i < size) { - val current = phrase[i] - when (current) { - 0.toChar() -> { - result.append('\\') - result.append('0') - } - '\\', '.', '[', ']', '{', '}', '(', ')', '<', '>', '*', '+', '-', '=', '?', '^', '$', '|' -> { - result.append('\\') - result.append(current) - } - else -> { - result.append(current) - } - } - i++ - } - return result.toString() - } - - /** - * Converts a multiple-phrase rule into a regular expression - * - * Unconditionally splits phrases on "\n", whitespace is preserved - * - * @param originalRule MultiPhrase rule list, "\n"-separated - * @return A regular expression matching the given phrases - */ - private fun convertFromMultiPhrase(originalRule: String): String { - // Convert the multi-phrase rule into regular expression format - // Split apart the original rule into components - val components = mutableListOf<String>() - // Split on "\n" - for (component in originalRule.splitToSequence('\n')) { - if (component.isNotEmpty()) { - components.add(regExEscape(component)) - } - } - - // Create full regular expression by... - // > Enclosing within a non-capturing group to avoid overhead of text extraction, "(?:...)" - // > Flattening normal and inverted rules using the regex OR character "...|..." - // - // Before: [foo, bar, baz] - // After: (?:^|\W)(?:foo|bar|baz)(?:\W|$) - - if (components.count() == 1) { - // Single item, skip the noncapturing group - return "(?:^|\\W)${components[0]}(?:\\W|$)" - } else { - val buffer = java.lang.StringBuilder() - buffer.append("(?:^|\\W)(?:") - components.joinTo(buffer, "|") - buffer.append(")(?:\\W|$)") - return buffer.toString() - } - } - - /** - * Converts a wildcard expression into a regular expression - * - * NOTE: Does not handle Quassel's extended scope matching and splitting. - * - * @see ExpressionMatch::convertFromWildcard() - * @return QString with all regular expression characters escaped - */ - private fun wildcardToRegEx(expression: String): String { - // Convert the wildcard expression into regular expression format - - // We're taking a little bit different of a route... - // - // Original QRegExp::Wildcard rules: - // -------------------------- - // Wildcard | Regex | Outcome - // ---------|-------|-------- - // * | .* | zero or more of any character - // ? | . | any single character - // - // NOTE 1: This is QRegExp::Wildcard, not QRegExp::WildcardUnix - // - // NOTE 2: We are ignoring the "[...]" character-class matching functionality of - // QRegExp::Wildcard as that feature's a bit more complex and can be handled with full-featured - // regexes. - // - // See https://doc.qt.io/qt-5/qregexp.html#wildcard-matching - // - // Quassel originally did not use QRegExp::WildcardUnix, which prevented escaping "*" and "?" in - // messages. Unfortunately, spam messages might decide to use both, so offering a way to escape - // makes sense. - // - // On the flip-side, that means to match "\" requires escaping as "\\", breaking backwards - // compatibility. - // - // Quassel's Wildcard rules - // ------------------------------------------ - // Wildcard | Regex escaped | Regex | Outcome - // ---------|---------------|-------|-------- - // * | \* | .* | zero or more of any character - // ? | \? | . | any single character - // \* | \\\* | \* | literal "*" - // \? | \\\? | \? | literal "?" - // \[...] | \\[...] | [...] | invalid escape, ignore it - // \\ | \\\\ | \\ | literal "\" - // - // In essence, "*" and "?" need changed only if not escaped, "\\" collapses into "\", "\" gets - // ignored; other characters escape normally. - // - // Example: - // - // > Wildcard rule - // never?gonna*give\*you\?up\\test|y\yeah\\1\\\\2\\\1inval - // - // ("\\\\" represents "\\", "\\" represents "\", and "\\\" is valid+invalid, "\") - // - // > Regex escaped wildcard rule - // never\?gonna\*give\\\*you\\\?up\\\\test\|y\\yeah\\\\1\\\\\\\\2\\\\\\1inval - // - // > Expected correct regex - // never.gonna.*give\*you\?up\\test\|yyeah\\1\\\\2\\1inval - // - // > Undoing regex escaping of "\" as "\\" (i.e. simple replace, with special escapes intact) - // never.gonna.*give\*you\?up\test\|yyeah\1\\2\1inval - - // Escape string according to regex - val regExEscaped = regExEscape(expression) - - // Fix up the result - // - // NOTE: In theory, regular expression lookbehind could solve this. Unfortunately, QRegExp does - // not support lookbehind, and it's theoretically inefficient, anyways. Just use an approach - // similar to that taken by QRegExp's official wildcard mode. - // - // Lookbehind example (that we can't use): - // (?<!abc)test Negative lookbehind - don't match if "test" is proceeded by "abc" // - // See https://code.qt.io/cgit/qt/qtbase.git/tree/src/corelib/tools/qregexp.cpp - // - // NOTE: We don't copy QRegExp's mode as QRegularExpression has more special characters. We - // can't use the same escaping code, hence calling the appropriate QReg[...]::escape() above. - - // Prepare to loop! - - // Result - val result = StringBuilder() - // Consecutive "\" characters - var consecutiveSlashes = 0 - - for (curChar in regExEscaped) { - // Check if it's on the list of special wildcard characters - when (curChar) { - '?' -> { - // Wildcard "?" - when (consecutiveSlashes) { - 1 -> { - // "?" -> "\?" -> "." - // Convert from regex escaped "?" to regular expression - result.append(".") - } - 3 -> { - // "\?" -> "\\\?" -> "\?" - // Convert from regex escaped "\?" to literal string - result.append("""\?""") - } - else -> { - // This shouldn't ever happen (even with invalid wildcard rules), log a warning - log(LogLevel.WARN, - "ExpressionMatch", - "Wildcard rule $expression resulted in escaped regular expression string $regExEscaped with unexpected count of consecutive '\\' ($consecutiveSlashes), ignoring $curChar character!") - } - } - consecutiveSlashes = 0 - } - '*' -> { - // Wildcard "*" - when (consecutiveSlashes) { - 1 -> { - // "*" -> "\*" -> ".*" - // Convert from regex escaped "*" to regular expression - result.append(".*") - } - 3 -> { - // "\*" -> "\\\*" -> "\*" - // Convert from regex escaped "\*" to literal string - result.append("""\*""") - } - else -> { - // This shouldn't ever happen (even with invalid wildcard rules), log a warning - log(LogLevel.WARN, - "ExpressionMatch", - "Wildcard rule $expression resulted in escaped regular expression string $regExEscaped with unexpected count of consecutive '\\' ($consecutiveSlashes), ignoring $curChar character!") - } - } - consecutiveSlashes = 0 - } - '\\' -> { - // Wildcard escape - // Increase consecutive slash count - consecutiveSlashes++ - // Check if we've hit an escape sequence - if (consecutiveSlashes == 4) { - // "\\" -> "\\\\" -> "\\" - // Convert from regex escaped "\\" to literal string - result.append("""\\""") - // Reset slash count - consecutiveSlashes = 0 - } - } - else -> { - // Any other character - when (consecutiveSlashes) { - 0, 2 -> { - // "[...]" -> "[...]" -> "[...]" - // ...or... - // "\[...]" -> "\\[...]" -> "[...]" - // Either just print the character itself, or convert from regex-escaped invalid - // wildcard escape sequence to the character itself - // - // Both mean doing nothing, the actual character [...] gets appended below - } - 1 -> { - // "[...]" -> "\[...]" -> "\" - // Keep regex-escaped special character "[...]" as literal string - // (Where "[...]" represents any non-wildcard regex special character) - result.append("""\""") - // The actual character [...] gets appended below - } - else -> { - // This shouldn't ever happen (even with invalid wildcard rules), log a warning - log(LogLevel.WARN, - "ExpressionMatch", - "Wildcard rule $expression resulted in escaped regular expression string $regExEscaped with unexpected count of consecutive '\\' ($consecutiveSlashes), ignoring $curChar char escape!") - } - } - consecutiveSlashes = 0 - // Add the character itself - result.append(curChar) - } - } - } - - // Anchoring to simulate QRegExp::exactMatch() is handled in - // ExpressionMatch::convertFromWildcard() - return result.toString() - } - - /** - * Trim extraneous whitespace from individual rules within a given MultiWildcard expression - * - * This respects the ";" escaping rules with "\". It is safe to call this multiple times; a - * trimmed string should remain unchanged. - * - * @see ExpressionMatch.MatchMode.MatchMultiWildcard - * - * @param originalRule MultiWildcard rule list, ";"-separated - * @return Trimmed MultiWildcard rule list - */ - fun trimMultiWildcardWhitespace(originalRule: String): String { - // This gets handled in two steps: - // - // 1. Break apart ";"-separated list into components - // 2. Combine whitespace-trimmed components into wildcard expression - // - // Let's start by making the list... - - // Convert a ";"-separated list into an actual list, splitting on newlines and unescaping - // escaped characters - - // Escaped list rules (where "[\n]" represents newline): - // --------------- - // Token | Outcome - // -------|-------- - // ; | Split - // \; | Keep as "\;" - // \\; | Split (keep as "\\") - // \\\ | Keep as "\\" + "\", set consecutive slashes to 1 - // [\n] | Split - // \[\n] | Split (keep as "\") - // \\[\n] | Split (keep as "\\") - // ... | Keep as "..." - // \... | Keep as "\..." - // \\... | Keep as "\\..." - // - // Strings are forced to end with "\n", always applying "\..." and "\\..." rules - // "..." also includes another "\" character - // - // All whitespace is trimmed from each component - - // "\\" and "\" are not downconverted to allow for other escape codes to be detected in - // ExpressionMatch::wildcardToRegex - - // Example: - // - // > Wildcard rule - // norm; norm-space ; newline-space [\n] ;escape \; sep ; slash-end-split\\; quad\\\\norm; - // newline-split-slash\\[\n] slash-at-end\\ [line does not continue] - // - // > Components - // norm - // norm-space - // newline-space - // escape \; sep - // slash-end-split\\ [line does not continue] - // quad\\\\norm - // newline-split-slash\\ [line does not continue] - // slash-at-end\\ [line does not continue] - // - // > Trimmed wildcard rule - // norm; norm-space; newline-space[\n]escape \; sep; slash-end-split\\; quad\\\\norm; - // newline-split-slash\\[\n]slash-at-end\\ [line does not continue] - // - // (Newlines are encoded as "[\n]". Ignore linebreaks for the sake of comment wrapping.) - - // Prepare to loop! - - var rule: String = originalRule - - // Force a termination at the end of the string to trigger a split - // Don't check for ";" splits as they may be escaped - if (!rule.endsWith("\n")) { - rule += "\n" - } - - // Result - val result = StringBuilder() - // Current string - var curString = "" - // Max length - // Consecutive "\" characters - var consecutiveSlashes = 0 - - for (curChar in rule) { - // Check if it's on the list of special list characters - when (curChar) { - ';' -> { - // Separator found - when (consecutiveSlashes) { - 0, 2 -> { - // ";" -> Split - // ...or... - // "\\;" -> Split (keep as "\\") - // Not escaped separator, split into a new item - - // Apply the additional "\\" if needed - if (consecutiveSlashes == 2) { - // "\\;" -> Split (keep as "\\") - curString += """\\""" - } - - curString = curString.trim() - - // Skip empty items - if (curString.isNotEmpty()) { - // Add to list with the same separator used - result.append(curString) - result.append("; ") - } - - // Reset the current list item - curString = "" - } - 1 -> { - // "\;" -> Keep as "\;" - curString += """\;""" - } - else -> { - // This shouldn't ever happen (even with invalid wildcard rules), log a warning - log(LogLevel.WARN, - "ExpressionMatch", - "Wildcard rule $rule resulted in rule component $curString with unexpected count of consecutive '\\' ($consecutiveSlashes), ignoring $curChar character!") - } - } - consecutiveSlashes = 0 - } - '\\' -> { - // Split escape - // Increase consecutive slash count - consecutiveSlashes++ - // Check if we’ve reached "\\\"... - if (consecutiveSlashes == 3) { - // "\\\" -> Keep as "\\" + "\" - curString += """\\""" - // Set consecutive slashes to 1, recognizing the trailing "\" - consecutiveSlashes = 1 - } else if (consecutiveSlashes > 3) { - // This shouldn't ever happen (even with invalid wildcard rules), log a warning - log(LogLevel.WARN, - "ExpressionMatch", - "Wildcard rule $rule resulted in rule component $curString with unexpected count of consecutive '\\' ($consecutiveSlashes), ignoring $curChar character!") - } - } - '\n' -> { - // Newline found - // Preserve the characters as they are now - - // "[\n]" -> Split - // "\[\n]" -> Split (keep as "\") - // "\\[\n]" -> Split (keep as "\\") - - when (consecutiveSlashes) { - 0 -> { - // Keep string as is - } - 1, 2 -> { - // Apply the additional "\" or "\\" - curString += """\""".repeat(consecutiveSlashes) - } - else -> { - log(LogLevel.WARN, - "ExpressionMatch", - "Wildcard rule $rule resulted in rule component $curString with unexpected count of consecutive '\\' ($consecutiveSlashes), applying newline split anyways!") - } - } - - // Remove any whitespace, e.g. "item1; item2" -> " item2" -> "item2" - curString = curString.trim() - - // Skip empty items - if (curString.isNotEmpty()) { - // Add to list with the same separator used - result.append(curString + "\n") - } - - // Reset the current list item - curString = "" - consecutiveSlashes = 0 - } - else -> { - when (consecutiveSlashes) { - 0 -> { - // "..." -> Keep as "..." - curString += curChar - } - 1, 2 -> { - // "\..." -> Keep as "\..." - // "\\..." -> Keep as "\\..." - curString += """\""".repeat(consecutiveSlashes) - curString += curChar - } - else -> { - log(LogLevel.WARN, - "ExpressionMatch", - "Wildcard rule $rule resulted in rule component $curString with unexpected count of consecutive '\\' ($consecutiveSlashes), ignoring $curChar char escape!") - } - } - consecutiveSlashes = 0 - } - } - } - - // Remove any trailing separators - if (result.endsWith("; ")) { - result.setLength(maxOf(result.length - 2, 0)) - } - - // Remove any trailing whitespace - return result.trim().toString() - } - } -} diff --git a/lib/src/main/java/de/kuschku/libquassel/util/Optional.kt b/lib/src/main/java/de/kuschku/libquassel/util/Optional.kt deleted file mode 100644 index 1e9c4614383345101946b38d3797ff11e2e00cf5..0000000000000000000000000000000000000000 --- a/lib/src/main/java/de/kuschku/libquassel/util/Optional.kt +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.libquassel.util - -import java.io.Serializable - -interface Optional<T : Any> : Serializable { - fun get(): T - fun isPresent(): Boolean - fun ifPresent(consumer: (T) -> Unit) - fun filter(predicate: (T) -> Boolean): Optional<T> - fun <U : Any> map(mapper: (T) -> U): Optional<U> - fun <U : Any> flatMap(mapper: (T) -> Optional<U>): Optional<U> - fun orElse(other: T): T - fun orNull(): T? - fun <X : Throwable> orElseThrow(supplier: () -> X): T - override fun equals(other: Any?): Boolean - override fun hashCode(): Int - override fun toString(): String - - private class Present<T : Any>(private val value: T) : Optional<T> { - override fun get() = value - override fun isPresent() = true - override fun ifPresent(consumer: (T) -> Unit) = consumer(value) - override fun filter(predicate: (T) -> Boolean) = if (predicate(value)) this else empty<T>() - override fun <U : Any> map(mapper: (T) -> U) = ofNullable(mapper(value)) - override fun <U : Any> flatMap(mapper: (T) -> Optional<U>) = mapper(value) - override fun orElse(other: T) = value - override fun orNull(): T? = value - override fun <X : Throwable> orElseThrow(supplier: () -> X) = value - override fun equals(other: Any?) = (other as? Present<*>)?.value == value - override fun hashCode() = value.hashCode() - override fun toString() = "Optional[$value]" - } - - private class Absent<T : Any> : Optional<T> { - override fun get() = throw NoSuchElementException("No value present") - override fun isPresent() = false - override fun ifPresent(consumer: (T) -> Unit) = Unit - override fun filter(predicate: (T) -> Boolean) = this - override fun <U : Any> map(mapper: (T) -> U) = empty<U>() - override fun <U : Any> flatMap(mapper: (T) -> Optional<U>) = empty<U>() - override fun orElse(other: T) = other - override fun orNull(): T? = null - override fun <X : Throwable> orElseThrow(supplier: () -> X) = throw supplier() - override fun equals(other: Any?) = other === this - override fun hashCode() = 0 - override fun toString() = "Optional.empty" - } - - companion object { - private val absent = Absent<Any>() - - @Suppress("UNCHECKED_CAST") - fun <T : Any> empty(): Optional<T> = absent as Absent<T> - - fun <T : Any> of(value: T): Optional<T> = Present(value) - fun <T : Any> ofNullable(value: T?): Optional<T> = value?.let(::Present) ?: empty() - } -} diff --git a/lib/src/main/java/de/kuschku/libquassel/util/compatibility/CompatibilityUtils.kt b/lib/src/main/java/de/kuschku/libquassel/util/compatibility/CompatibilityUtils.kt deleted file mode 100644 index d02507a4c6237b8e9a6f4c00dc76b1e5f185f270..0000000000000000000000000000000000000000 --- a/lib/src/main/java/de/kuschku/libquassel/util/compatibility/CompatibilityUtils.kt +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.libquassel.util.compatibility - -import de.kuschku.libquassel.util.compatibility.backport.ProperlyClosingSyncFlushDeflaterOutputStream -import java.io.OutputStream -import java.util.zip.DeflaterOutputStream - -object CompatibilityUtils { - var supportsKeepAlive = true - var supportsCompression = true - - /** - * Creates a SyncFlush output stream, even if the current device does not support doing so - * natively. - * - * @param rawOut the raw output stream to be wrapped - * @return The wrapping output stream - */ - fun createDeflaterOutputStream(rawOut: OutputStream?): DeflaterOutputStream { - return ProperlyClosingSyncFlushDeflaterOutputStream(rawOut) - } -} diff --git a/lib/src/main/java/de/kuschku/libquassel/util/compatibility/HandlerService.kt b/lib/src/main/java/de/kuschku/libquassel/util/compatibility/HandlerService.kt deleted file mode 100644 index 84a9c6a08fdeb4f93d2ac2d0651043309696de04..0000000000000000000000000000000000000000 --- a/lib/src/main/java/de/kuschku/libquassel/util/compatibility/HandlerService.kt +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.libquassel.util.compatibility - -import io.reactivex.Scheduler - -interface HandlerService { - val scheduler: Scheduler - - var exceptionHandler: Thread.UncaughtExceptionHandler? - - fun serialize(f: () -> Unit) - fun deserialize(f: () -> Unit) - fun write(f: () -> Unit) - fun backend(f: () -> Unit) - fun backendDelayed(delayMillis: Long, f: () -> Unit) - - fun quit() -} diff --git a/lib/src/main/java/de/kuschku/libquassel/util/compatibility/LoggingHandler.kt b/lib/src/main/java/de/kuschku/libquassel/util/compatibility/LoggingHandler.kt deleted file mode 100644 index 73e24687e63ef1f75f630da00b700efb94fd5264..0000000000000000000000000000000000000000 --- a/lib/src/main/java/de/kuschku/libquassel/util/compatibility/LoggingHandler.kt +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ -@file:Suppress("NOTHING_TO_INLINE") - -package de.kuschku.libquassel.util.compatibility - -import de.kuschku.libquassel.util.compatibility.reference.JavaLoggingHandler - -abstract class LoggingHandler { - abstract fun _log(logLevel: LogLevel, tag: String, message: String? = null, - throwable: Throwable? = null) - - abstract fun _isLoggable(logLevel: LogLevel, tag: String): Boolean - inline fun isLoggable(logLevel: LogLevel, tag: String, f: LogContext.() -> Unit) { - if (_isLoggable(logLevel, tag)) { - object : LogContext { - override fun log(message: String?, throwable: Throwable?) { - this@LoggingHandler._log(logLevel, tag, message, throwable) - } - }.f() - } - } - - interface LogContext { - fun log(message: String? = null, throwable: Throwable? = null) - } - - enum class LogLevel { - VERBOSE, - DEBUG, - INFO, - WARN, - ERROR, - ASSERT - } - - companion object { - val loggingHandlers: MutableSet<LoggingHandler> = mutableSetOf(JavaLoggingHandler) - - inline fun log(logLevel: LogLevel, tag: String, message: String?, - throwable: Throwable?) { - loggingHandlers - .filter { it._isLoggable(logLevel, tag) } - .forEach { it._log(logLevel, tag, message, throwable) } - } - - inline fun log(logLevel: LogLevel, tag: String, throwable: Throwable) = - log(logLevel, tag, null, throwable) - - inline fun log(logLevel: LogLevel, tag: String, message: String) = - log(logLevel, tag, message, null) - } -} diff --git a/lib/src/main/java/de/kuschku/libquassel/util/compatibility/StreamChannelFactory.kt b/lib/src/main/java/de/kuschku/libquassel/util/compatibility/StreamChannelFactory.kt deleted file mode 100644 index 8f1c58da3da27f60dfddf20cb386ddcb98b8735a..0000000000000000000000000000000000000000 --- a/lib/src/main/java/de/kuschku/libquassel/util/compatibility/StreamChannelFactory.kt +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.libquassel.util.compatibility - -import de.kuschku.libquassel.util.compatibility.reference.JavaStreamChannelFactory -import java.io.InputStream -import java.io.OutputStream -import java.nio.channels.ReadableByteChannel -import java.nio.channels.WritableByteChannel - -interface StreamChannelFactory { - fun create(stream: InputStream): ReadableByteChannel - fun create(stream: OutputStream): WritableByteChannel - - companion object : StreamChannelFactory { - override fun create(stream: InputStream) = instance.create(stream) - override fun create(stream: OutputStream) = instance.create(stream) - var instance: StreamChannelFactory = JavaStreamChannelFactory - } -} diff --git a/lib/src/main/java/de/kuschku/libquassel/util/compatibility/backport/ProperlyClosingSyncFlushDeflaterOutputStream.kt b/lib/src/main/java/de/kuschku/libquassel/util/compatibility/backport/ProperlyClosingSyncFlushDeflaterOutputStream.kt deleted file mode 100644 index db029eda498e697b996ed76a80a2382caa00a1a9..0000000000000000000000000000000000000000 --- a/lib/src/main/java/de/kuschku/libquassel/util/compatibility/backport/ProperlyClosingSyncFlushDeflaterOutputStream.kt +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.libquassel.util.compatibility.backport - -import java.io.OutputStream -import java.util.zip.DeflaterOutputStream - -class ProperlyClosingSyncFlushDeflaterOutputStream( - stream: OutputStream? -) : DeflaterOutputStream(stream, true) { - override fun close() { - try { - super.close() - } finally { - def.end() - } - } -} diff --git a/lib/src/main/java/de/kuschku/libquassel/util/compatibility/reference/JavaHandlerService.kt b/lib/src/main/java/de/kuschku/libquassel/util/compatibility/reference/JavaHandlerService.kt deleted file mode 100644 index 0930fd55e71f382d3c30f702789e55d3c129b4a6..0000000000000000000000000000000000000000 --- a/lib/src/main/java/de/kuschku/libquassel/util/compatibility/reference/JavaHandlerService.kt +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.libquassel.util.compatibility.reference - -import de.kuschku.libquassel.util.compatibility.HandlerService -import io.reactivex.schedulers.Schedulers -import java.util.concurrent.Executors - -class JavaHandlerService : HandlerService { - override val scheduler = Schedulers.computation() - - override fun backendDelayed(delayMillis: Long, f: () -> Unit) = backend(f) - - private val serializeExecutor = Executors.newSingleThreadExecutor() - private val deserializeExecutor = Executors.newSingleThreadExecutor() - private val writeExecutor = Executors.newSingleThreadExecutor() - private val backendExecutor = Executors.newSingleThreadExecutor() - - override fun serialize(f: () -> Unit) { - serializeExecutor.submit { - try { - f() - } catch (e: Throwable) { - exceptionHandler?.uncaughtException(Thread.currentThread(), e) - } - } - } - - override fun deserialize(f: () -> Unit) { - deserializeExecutor.submit { - try { - f() - } catch (e: Throwable) { - exceptionHandler?.uncaughtException(Thread.currentThread(), e) - } - } - } - - override fun write(f: () -> Unit) { - writeExecutor.submit { - try { - f() - } catch (e: Throwable) { - exceptionHandler?.uncaughtException(Thread.currentThread(), e) - } - } - } - - override fun backend(f: () -> Unit) { - backendExecutor.submit { - try { - f() - } catch (e: Throwable) { - exceptionHandler?.uncaughtException(Thread.currentThread(), e) - } - } - } - - override fun quit() { - serializeExecutor.shutdownNow() - writeExecutor.shutdownNow() - backendExecutor.shutdownNow() - } - - override var exceptionHandler: Thread.UncaughtExceptionHandler? = null -} diff --git a/lib/src/main/java/de/kuschku/libquassel/util/compatibility/reference/JavaLoggingHandler.kt b/lib/src/main/java/de/kuschku/libquassel/util/compatibility/reference/JavaLoggingHandler.kt deleted file mode 100644 index f861af6001c4822e3cfec3b287d37d18c7f38e6f..0000000000000000000000000000000000000000 --- a/lib/src/main/java/de/kuschku/libquassel/util/compatibility/reference/JavaLoggingHandler.kt +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.libquassel.util.compatibility.reference - -import de.kuschku.libquassel.util.compatibility.LoggingHandler -import java.util.logging.Level -import java.util.logging.Logger - -object JavaLoggingHandler : LoggingHandler() { - override fun _isLoggable(logLevel: LogLevel, tag: String): Boolean { - return Logger.getLogger(tag).isLoggable( - priority(logLevel) - ) - } - - override fun _log(logLevel: LogLevel, tag: String, message: String?, throwable: Throwable?) { - val priority = priority( - logLevel - ) - val logger = Logger.getLogger(tag) - if (message != null) - logger.log(priority, message) - if (throwable != null) - logger.log(priority, "", throwable) - } - - private fun priority(logLevel: LogLevel): Level = when (logLevel) { - LogLevel.VERBOSE -> Level.FINEST - LogLevel.DEBUG -> Level.FINE - LogLevel.INFO -> Level.INFO - LogLevel.WARN -> Level.WARNING - LogLevel.ERROR -> Level.SEVERE - LogLevel.ASSERT -> Level.SEVERE - } - - fun inject() { - loggingHandlers.clear() - loggingHandlers.add(this) - } -} diff --git a/lib/src/main/java/de/kuschku/libquassel/util/compatibility/reference/JavaStreamChannelFactory.kt b/lib/src/main/java/de/kuschku/libquassel/util/compatibility/reference/JavaStreamChannelFactory.kt deleted file mode 100644 index e62e04a651c221dee4409aa58a5214ca4ea896cd..0000000000000000000000000000000000000000 --- a/lib/src/main/java/de/kuschku/libquassel/util/compatibility/reference/JavaStreamChannelFactory.kt +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.libquassel.util.compatibility.reference - -import de.kuschku.libquassel.util.compatibility.StreamChannelFactory -import java.io.InputStream -import java.io.OutputStream -import java.nio.channels.Channels -import java.nio.channels.ReadableByteChannel -import java.nio.channels.WritableByteChannel - -object JavaStreamChannelFactory : StreamChannelFactory { - override fun create(stream: InputStream): ReadableByteChannel = Channels.newChannel(stream) - override fun create(stream: OutputStream): WritableByteChannel = Channels.newChannel(stream) - - fun inject() { - StreamChannelFactory.instance = this - } -} diff --git a/lib/src/main/java/de/kuschku/libquassel/util/flag/Flag.kt b/lib/src/main/java/de/kuschku/libquassel/util/flag/Flag.kt deleted file mode 100644 index 1186207ec53ad55b6bcbd9e66ac385f280b5e367..0000000000000000000000000000000000000000 --- a/lib/src/main/java/de/kuschku/libquassel/util/flag/Flag.kt +++ /dev/null @@ -1,162 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.libquassel.util.flag - -import de.kuschku.libquassel.util.helper.sum -import java.io.Serializable - -interface Flag<T> : Serializable where T : Enum<T>, T : Flag<T> { - val bit: UInt - fun toByte() = bit.toByte() - fun toChar() = bit.toLong().toChar() - fun toDouble() = bit.toLong().toDouble() - fun toFloat() = bit.toLong().toFloat() - fun toInt() = bit.toInt() - fun toLong() = bit.toLong() - fun toShort() = bit.toShort() - fun toUByte() = bit.toUByte() - fun toUInt() = bit.toUInt() - fun toULong() = bit.toULong() - fun toUShort() = bit.toUShort() -} - -data class Flags<E>( - val value: UInt, - val values: Array<E>? = null -) : Number(), Serializable, Comparable<UInt> where E : Enum<E>, E : Flag<E> { - override fun compareTo(other: UInt) = value.compareTo(other) - - override fun toByte() = value.toByte() - override fun toChar() = value.toLong().toChar() - override fun toDouble() = value.toLong().toDouble() - override fun toFloat() = value.toLong().toFloat() - override fun toInt() = value.toInt() - override fun toLong() = value.toLong() - override fun toShort() = value.toShort() - fun toUByte() = value.toUByte() - fun toUInt() = value.toUInt() - fun toULong() = value.toULong() - fun toUShort() = value.toUShort() - - override fun equals(other: Any?) = when (other) { - is Flags<*> -> other.value == value - is Flag<*> -> other.bit == value - else -> other === this - } - - override fun hashCode(): Int { - return value.hashCode() - } - - fun enabledValues() = values?.filter { hasFlag(it) }?.toSet() ?: emptySet() - - fun isEmpty() = value == 0u - fun isNotEmpty() = !isEmpty() - - override fun toString() = if (values != null) { - enabledValues().joinToString("|", "[", "]") - } else { - value.toString(16) - } - - companion object { - inline fun <reified T> of(int: Int): Flags<T> - where T : Flag<T>, T : Enum<T> = - Flags(int.toUInt(), enumValues()) - - inline fun <reified T> of(int: UInt): Flags<T> - where T : Flag<T>, T : Enum<T> = - Flags(int, enumValues()) - - inline fun <reified T> of(vararg flags: T): Flags<T> - where T : Flag<T>, T : Enum<T> = - Flags(flags.map(Flag<T>::bit).distinct().sum(), enumValues()) - - inline fun <reified T> of(flags: Iterable<T>): Flags<T> - where T : Flag<T>, T : Enum<T> = - Flags(flags.map(Flag<T>::bit).distinct().sum(), enumValues()) - } - - interface Factory<E> where E : Flag<E>, E : Enum<E> { - val NONE: Flags<E> - fun of(bit: Int): Flags<E> - fun of(bit: UInt): Flags<E> - fun of(vararg flags: E): Flags<E> - fun of(flags: Iterable<E>): Flags<E> - } -} - -infix fun <T> Flags<T>.hasFlag(which: T): Boolean where T : Enum<T>, T : Flag<T> { - // an Undefined flag is a special case. - if (which.bit == 0u) return false - return value and which.bit == which.bit -} - -infix fun <T> Flags<T>.or(other: UInt): Flags<T> - where T : Enum<T>, T : Flag<T> = - Flags(value or other) - -infix fun <T> Flags<T>.or(other: Flag<T>): Flags<T> - where T : Enum<T>, T : Flag<T> = - Flags(value or other.bit) - -infix fun <T> Flags<T>.or(other: Flags<T>): Flags<T> - where T : Enum<T>, T : Flag<T> = - Flags(value or other.value) - -infix fun <T> Flags<T>.and(other: UInt): Flags<T> - where T : Enum<T>, T : Flag<T> = - Flags(value and other) - -infix fun <T> Flags<T>.and(other: Flag<T>): Flags<T> - where T : Enum<T>, T : Flag<T> = - Flags(value and other.bit) - -infix fun <T> Flags<T>.and(other: Flags<T>): Flags<T> - where T : Enum<T>, T : Flag<T> = - Flags(value and other.value) - -infix operator fun <T> Flags<T>.plus(other: UInt): Flags<T> - where T : Enum<T>, T : Flag<T> = - Flags(value or other) - -infix operator fun <T> Flags<T>.plus(other: Flag<T>): Flags<T> - where T : Enum<T>, T : Flag<T> = - Flags(value or other.bit) - -infix operator fun <T> Flags<T>.plus(other: Flags<T>): Flags<T> - where T : Enum<T>, T : Flag<T> = - Flags(value or other.value) - -infix operator fun <T> Flags<T>.minus(other: UInt): Flags<T> - where T : Enum<T>, T : Flag<T> = - Flags(value and other.inv()) - -infix operator fun <T> Flags<T>.minus(other: Flag<T>): Flags<T> - where T : Enum<T>, T : Flag<T> = - Flags(value and other.bit.inv()) - -infix operator fun <T> Flags<T>.minus(other: Flags<T>): Flags<T> - where T : Enum<T>, T : Flag<T> = - Flags(value and other.value.inv()) - -infix fun <T> Flags<T>.unset(which: T): Flags<T> - where T : Enum<T>, T : Flag<T> = - Flags(value xor which.bit) diff --git a/lib/src/main/java/de/kuschku/libquassel/util/flag/LongFlag.kt b/lib/src/main/java/de/kuschku/libquassel/util/flag/LongFlag.kt deleted file mode 100644 index 001fe892c45c44f81b9913eed766a63f4c8065fa..0000000000000000000000000000000000000000 --- a/lib/src/main/java/de/kuschku/libquassel/util/flag/LongFlag.kt +++ /dev/null @@ -1,162 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.libquassel.util.flag - -import de.kuschku.libquassel.util.helper.sum -import java.io.Serializable - -interface LongFlag<T> : Serializable where T : Enum<T>, T : LongFlag<T> { - val bit: ULong - fun toByte() = bit.toByte() - fun toChar() = bit.toLong().toChar() - fun toDouble() = bit.toLong().toDouble() - fun toFloat() = bit.toLong().toFloat() - fun toInt() = bit.toInt() - fun toLong() = bit.toLong() - fun toShort() = bit.toShort() - fun toUByte() = bit.toUByte() - fun toUInt() = bit.toUInt() - fun toULong() = bit.toULong() - fun toUShort() = bit.toUShort() -} - -data class LongFlags<E>( - val value: ULong, - val values: Array<E>? = null -) : Number(), Serializable, Comparable<ULong> where E : Enum<E>, E : LongFlag<E> { - override fun compareTo(other: ULong) = value.compareTo(other) - - override fun toByte() = value.toByte() - override fun toChar() = value.toLong().toChar() - override fun toDouble() = value.toLong().toDouble() - override fun toFloat() = value.toLong().toFloat() - override fun toInt() = value.toInt() - override fun toLong() = value.toLong() - override fun toShort() = value.toShort() - fun toUByte() = value.toUByte() - fun toUInt() = value.toUInt() - fun toULong() = value.toULong() - fun toUShort() = value.toUShort() - - override fun equals(other: Any?) = when (other) { - is LongFlags<*> -> other.value == value - is LongFlag<*> -> other.bit == value - else -> other === this - } - - override fun hashCode(): Int { - return value.hashCode() - } - - fun enabledValues() = values?.filter { hasFlag(it) }?.toSet() ?: emptySet() - - fun isEmpty() = value == 0uL - fun isNotEmpty() = !isEmpty() - - override fun toString() = if (values != null) { - enabledValues().joinToString("|", "[", "]") - } else { - value.toString(16) - } - - companion object { - inline fun <reified T> of(int: Long): LongFlags<T> - where T : LongFlag<T>, T : Enum<T> = - LongFlags(int.toULong(), enumValues()) - - inline fun <reified T> of(int: ULong): LongFlags<T> - where T : LongFlag<T>, T : Enum<T> = - LongFlags(int, enumValues()) - - inline fun <reified T> of(vararg flags: T): LongFlags<T> - where T : LongFlag<T>, T : Enum<T> = - LongFlags(flags.map(LongFlag<T>::bit).distinct().sum(), enumValues()) - - inline fun <reified T> of(flags: Iterable<T>): LongFlags<T> - where T : LongFlag<T>, T : Enum<T> = - LongFlags(flags.map(LongFlag<T>::bit).distinct().sum(), enumValues()) - } - - interface Factory<E> where E : LongFlag<E>, E : Enum<E> { - val NONE: LongFlags<E> - fun of(bit: Long): LongFlags<E> - fun of(bit: ULong): LongFlags<E> - fun of(vararg flags: E): LongFlags<E> - fun of(flags: Iterable<E>): LongFlags<E> - } -} - -infix fun <T> LongFlags<T>.hasFlag(which: T): Boolean where T : Enum<T>, T : LongFlag<T> { - // an Undefined flag is a special case. - if (which.bit == 0uL) return false - return value and which.bit == which.bit -} - -infix fun <T> LongFlags<T>.or(other: ULong): LongFlags<T> - where T : Enum<T>, T : LongFlag<T> = - LongFlags(value or other) - -infix fun <T> LongFlags<T>.or(other: LongFlag<T>): LongFlags<T> - where T : Enum<T>, T : LongFlag<T> = - LongFlags(value or other.bit) - -infix fun <T> LongFlags<T>.or(other: LongFlags<T>): LongFlags<T> - where T : Enum<T>, T : LongFlag<T> = - LongFlags(value or other.value) - -infix fun <T> LongFlags<T>.and(other: ULong): LongFlags<T> - where T : Enum<T>, T : LongFlag<T> = - LongFlags(value and other) - -infix fun <T> LongFlags<T>.and(other: LongFlag<T>): LongFlags<T> - where T : Enum<T>, T : LongFlag<T> = - LongFlags(value and other.bit) - -infix fun <T> LongFlags<T>.and(other: LongFlags<T>): LongFlags<T> - where T : Enum<T>, T : LongFlag<T> = - LongFlags(value and other.value) - -infix operator fun <T> LongFlags<T>.plus(other: ULong): LongFlags<T> - where T : Enum<T>, T : LongFlag<T> = - LongFlags(value or other) - -infix operator fun <T> LongFlags<T>.plus(other: LongFlag<T>): LongFlags<T> - where T : Enum<T>, T : LongFlag<T> = - LongFlags(value or other.bit) - -infix operator fun <T> LongFlags<T>.plus(other: LongFlags<T>): LongFlags<T> - where T : Enum<T>, T : LongFlag<T> = - LongFlags(value or other.value) - -infix operator fun <T> LongFlags<T>.minus(other: ULong): LongFlags<T> - where T : Enum<T>, T : LongFlag<T> = - LongFlags(value and other.inv()) - -infix operator fun <T> LongFlags<T>.minus(other: LongFlag<T>): LongFlags<T> - where T : Enum<T>, T : LongFlag<T> = - LongFlags(value and other.bit.inv()) - -infix operator fun <T> LongFlags<T>.minus(other: LongFlags<T>): LongFlags<T> - where T : Enum<T>, T : LongFlag<T> = - LongFlags(value and other.value.inv()) - -infix fun <T> LongFlags<T>.unset(which: T): LongFlags<T> - where T : Enum<T>, T : LongFlag<T> = - LongFlags(value xor which.bit) diff --git a/lib/src/main/java/de/kuschku/libquassel/util/flag/ShortFlag.kt b/lib/src/main/java/de/kuschku/libquassel/util/flag/ShortFlag.kt deleted file mode 100644 index f95fbca1f2a4e7f592022537dfd9233fff850929..0000000000000000000000000000000000000000 --- a/lib/src/main/java/de/kuschku/libquassel/util/flag/ShortFlag.kt +++ /dev/null @@ -1,162 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.libquassel.util.flag - -import de.kuschku.libquassel.util.helper.sum -import java.io.Serializable - -interface ShortFlag<T> : Serializable where T : Enum<T>, T : ShortFlag<T> { - val bit: UShort - fun toByte() = bit.toByte() - fun toChar() = bit.toLong().toChar() - fun toDouble() = bit.toLong().toDouble() - fun toFloat() = bit.toLong().toFloat() - fun toInt() = bit.toInt() - fun toLong() = bit.toLong() - fun toShort() = bit.toShort() - fun toUByte() = bit.toUByte() - fun toUInt() = bit.toUInt() - fun toULong() = bit.toULong() - fun toUShort() = bit.toUShort() -} - -data class ShortFlags<E>( - val value: UShort, - val values: Array<E>? = null -) : Number(), Serializable, Comparable<UShort> where E : Enum<E>, E : ShortFlag<E> { - override fun compareTo(other: UShort) = value.compareTo(other) - - override fun toByte() = value.toByte() - override fun toChar() = value.toLong().toChar() - override fun toDouble() = value.toLong().toDouble() - override fun toFloat() = value.toLong().toFloat() - override fun toInt() = value.toInt() - override fun toLong() = value.toLong() - override fun toShort() = value.toShort() - fun toUByte() = value.toUByte() - fun toUInt() = value.toUInt() - fun toULong() = value.toULong() - fun toUShort() = value.toUShort() - - override fun equals(other: Any?) = when (other) { - is ShortFlags<*> -> other.value == value - is ShortFlag<*> -> other.bit == value - else -> other === this - } - - override fun hashCode(): Int { - return value.hashCode() - } - - fun enabledValues() = values?.filter { hasFlag(it) }?.toSet() ?: emptySet() - - fun isEmpty() = value == 0u.toUShort() - fun isNotEmpty() = !isEmpty() - - override fun toString() = if (values != null) { - enabledValues().joinToString("|", "[", "]") - } else { - value.toString(16) - } - - companion object { - inline fun <reified T> of(int: Short): ShortFlags<T> - where T : ShortFlag<T>, T : Enum<T> = - ShortFlags(int.toUShort(), enumValues()) - - inline fun <reified T> of(int: UShort): ShortFlags<T> - where T : ShortFlag<T>, T : Enum<T> = - ShortFlags(int, enumValues()) - - inline fun <reified T> of(vararg flags: T): ShortFlags<T> - where T : ShortFlag<T>, T : Enum<T> = - ShortFlags(flags.map(ShortFlag<T>::bit).distinct().sum().toUShort(), enumValues()) - - inline fun <reified T> of(flags: Iterable<T>): ShortFlags<T> - where T : ShortFlag<T>, T : Enum<T> = - ShortFlags(flags.map(ShortFlag<T>::bit).distinct().sum().toUShort(), enumValues()) - } - - interface Factory<E> where E : ShortFlag<E>, E : Enum<E> { - val NONE: ShortFlags<E> - fun of(bit: Short): ShortFlags<E> - fun of(bit: UShort): ShortFlags<E> - fun of(vararg flags: E): ShortFlags<E> - fun of(flags: Iterable<E>): ShortFlags<E> - } -} - -infix fun <T> ShortFlags<T>.hasFlag(which: T): Boolean where T : Enum<T>, T : ShortFlag<T> { - // an Undefined flag is a special case. - if (which.bit == 0u.toUShort()) return false - return value and which.bit == which.bit -} - -infix fun <T> ShortFlags<T>.or(other: UShort): ShortFlags<T> - where T : Enum<T>, T : ShortFlag<T> = - ShortFlags(value or other) - -infix fun <T> ShortFlags<T>.or(other: ShortFlag<T>): ShortFlags<T> - where T : Enum<T>, T : ShortFlag<T> = - ShortFlags(value or other.bit) - -infix fun <T> ShortFlags<T>.or(other: ShortFlags<T>): ShortFlags<T> - where T : Enum<T>, T : ShortFlag<T> = - ShortFlags(value or other.value) - -infix fun <T> ShortFlags<T>.and(other: UShort): ShortFlags<T> - where T : Enum<T>, T : ShortFlag<T> = - ShortFlags(value and other) - -infix fun <T> ShortFlags<T>.and(other: ShortFlag<T>): ShortFlags<T> - where T : Enum<T>, T : ShortFlag<T> = - ShortFlags(value and other.bit) - -infix fun <T> ShortFlags<T>.and(other: ShortFlags<T>): ShortFlags<T> - where T : Enum<T>, T : ShortFlag<T> = - ShortFlags(value and other.value) - -infix operator fun <T> ShortFlags<T>.plus(other: UShort): ShortFlags<T> - where T : Enum<T>, T : ShortFlag<T> = - ShortFlags(value or other) - -infix operator fun <T> ShortFlags<T>.plus(other: ShortFlag<T>): ShortFlags<T> - where T : Enum<T>, T : ShortFlag<T> = - ShortFlags(value or other.bit) - -infix operator fun <T> ShortFlags<T>.plus(other: ShortFlags<T>): ShortFlags<T> - where T : Enum<T>, T : ShortFlag<T> = - ShortFlags(value or other.value) - -infix operator fun <T> ShortFlags<T>.minus(other: UShort): ShortFlags<T> - where T : Enum<T>, T : ShortFlag<T> = - ShortFlags(value and other.inv()) - -infix operator fun <T> ShortFlags<T>.minus(other: ShortFlag<T>): ShortFlags<T> - where T : Enum<T>, T : ShortFlag<T> = - ShortFlags(value and other.bit.inv()) - -infix operator fun <T> ShortFlags<T>.minus(other: ShortFlags<T>): ShortFlags<T> - where T : Enum<T>, T : ShortFlag<T> = - ShortFlags(value and other.value.inv()) - -infix fun <T> ShortFlags<T>.unset(which: T): ShortFlags<T> - where T : Enum<T>, T : ShortFlag<T> = - ShortFlags(value xor which.bit) diff --git a/lib/src/main/java/de/kuschku/libquassel/util/helper/AnyHelper.kt b/lib/src/main/java/de/kuschku/libquassel/util/helper/AnyHelper.kt deleted file mode 100644 index 1d5e1352da8d2cf6419a658410e8ab24d6bf617a..0000000000000000000000000000000000000000 --- a/lib/src/main/java/de/kuschku/libquassel/util/helper/AnyHelper.kt +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.libquassel.util.helper - -inline fun <T> T.nullIf(f: (T) -> Boolean): T? = if (f(this)) null else this diff --git a/lib/src/main/java/de/kuschku/libquassel/util/helper/ArrayHelper.kt b/lib/src/main/java/de/kuschku/libquassel/util/helper/ArrayHelper.kt deleted file mode 100644 index e101970f7106fc4abf527cae794e24cd234ec295..0000000000000000000000000000000000000000 --- a/lib/src/main/java/de/kuschku/libquassel/util/helper/ArrayHelper.kt +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.libquassel.util.helper - -import de.kuschku.libquassel.util.compatibility.LoggingHandler.Companion.log -import de.kuschku.libquassel.util.compatibility.LoggingHandler.LogLevel.WARN - -fun ByteArray.hexDump() { - for (i in 0 until this.size step 33) { - log( - WARN, "HexDump", - (0 until 33).map { it + i }.filter { it < this.size }.joinToString(" ") { - String.format("%02x", this[it]) - } - ) - } -} diff --git a/lib/src/main/java/de/kuschku/libquassel/util/helper/BehaviorSubjectHelper.kt b/lib/src/main/java/de/kuschku/libquassel/util/helper/BehaviorSubjectHelper.kt deleted file mode 100644 index 91a06c508202543ca1777fdc5a0a9848471d7244..0000000000000000000000000000000000000000 --- a/lib/src/main/java/de/kuschku/libquassel/util/helper/BehaviorSubjectHelper.kt +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.libquassel.util.helper - -import io.reactivex.subjects.BehaviorSubject - -val <T : Any> BehaviorSubject<T>.safeValue: T - get() = value!! diff --git a/lib/src/main/java/de/kuschku/libquassel/util/helper/ByteBufferHelper.kt b/lib/src/main/java/de/kuschku/libquassel/util/helper/ByteBufferHelper.kt deleted file mode 100644 index da9311aeceea943e5c81b57fe73a000ccbdb92de..0000000000000000000000000000000000000000 --- a/lib/src/main/java/de/kuschku/libquassel/util/helper/ByteBufferHelper.kt +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.libquassel.util.helper - -import de.kuschku.libquassel.protocol.primitive.serializer.StringSerializer -import java.nio.ByteBuffer - -fun ByteBuffer.copyTo(target: ByteBuffer) { - while (target.remaining() > 8) - target.putLong(this.long) - while (target.hasRemaining()) - target.put(this.get()) -} - -fun ByteBuffer?.deserializeString(serializer: StringSerializer) = if (this == null) { - null -} else { - serializer.deserializeAll(this) -} - -fun ByteBuffer.hexDump() { - val target = ByteBuffer.allocate(this.capacity()) - this.clear() - this.copyTo(target) - target.array().hexDump() -} diff --git a/lib/src/main/java/de/kuschku/libquassel/util/helper/CollectionHelper.kt b/lib/src/main/java/de/kuschku/libquassel/util/helper/CollectionHelper.kt deleted file mode 100644 index 87d2054235e5a13cf8abb021d58cdf89e805c1be..0000000000000000000000000000000000000000 --- a/lib/src/main/java/de/kuschku/libquassel/util/helper/CollectionHelper.kt +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.libquassel.util.helper - - -/** - * Returns the sum of all elements in the collection. - */ -@kotlin.jvm.JvmName("sumOfUByte") -fun Iterable<UByte>.sum(): UInt { - var sum: UInt = 0u - for (element in this) { - sum += element - } - return sum -} - -/** - * Returns the sum of all elements in the collection. - */ -@kotlin.jvm.JvmName("sumOfUShort") -fun Iterable<UShort>.sum(): UInt { - var sum: UInt = 0u - for (element in this) { - sum += element - } - return sum -} - -/** - * Returns the sum of all elements in the collection. - */ -@kotlin.jvm.JvmName("sumOfUInt") -fun Iterable<UInt>.sum(): UInt { - var sum: UInt = 0u - for (element in this) { - sum += element - } - return sum -} - -/** - * Returns the sum of all elements in the collection. - */ -@kotlin.jvm.JvmName("sumOfULong") -fun Iterable<ULong>.sum(): ULong { - var sum: ULong = 0uL - for (element in this) { - sum += element - } - return sum -} diff --git a/lib/src/main/java/de/kuschku/libquassel/util/helper/MapHelper.kt b/lib/src/main/java/de/kuschku/libquassel/util/helper/MapHelper.kt deleted file mode 100644 index eb7d28f37cced12c07d7da90a35c1405e9c55166..0000000000000000000000000000000000000000 --- a/lib/src/main/java/de/kuschku/libquassel/util/helper/MapHelper.kt +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.libquassel.util.helper - -fun <K, V> Map<K, V>.getOr(key: K, defValue: V) = this[key] ?: defValue - -fun <K, V> MutableMap<K, V>.removeIfEqual(key: K, value: V): Boolean { - if (!this.containsKey(key)) - return false - - if (this[key] != value) - return false - - this.remove(key) - return true -} diff --git a/lib/src/main/java/de/kuschku/libquassel/util/helper/MathHelper.kt b/lib/src/main/java/de/kuschku/libquassel/util/helper/MathHelper.kt deleted file mode 100644 index 84fcd852a214b54326358c8519d7e62085052409..0000000000000000000000000000000000000000 --- a/lib/src/main/java/de/kuschku/libquassel/util/helper/MathHelper.kt +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ -@file:Suppress("NOTHING_TO_INLINE") - -package de.kuschku.libquassel.util.helper - -inline fun clampOf(value: Int, lowerBound: Int, upperBound: Int): Int = - maxOf(lowerBound, minOf(value, upperBound)) - -inline fun clampOf(value: Long, lowerBound: Long, upperBound: Long): Long = - maxOf(lowerBound, minOf(value, upperBound)) diff --git a/lib/src/main/java/de/kuschku/libquassel/util/helper/ObservableHelper.kt b/lib/src/main/java/de/kuschku/libquassel/util/helper/ObservableHelper.kt deleted file mode 100644 index 07c2f4b12726ae432b136083e0f7368d70a5fee1..0000000000000000000000000000000000000000 --- a/lib/src/main/java/de/kuschku/libquassel/util/helper/ObservableHelper.kt +++ /dev/null @@ -1,159 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.libquassel.util.helper - -import de.kuschku.libquassel.util.Optional -import io.reactivex.Observable -import io.reactivex.ObservableSource -import io.reactivex.functions.BiFunction - -fun <T> Observable<T>.or(default: T): T = try { - this.blockingLatest().firstOrNull() ?: default -} catch (_: Throwable) { - default -} - -val <T : Any> Observable<T>.value - get() = this.map { Optional.of(it) }.blockingMostRecent(Optional.empty()).firstOrNull()?.orNull() - -fun <T : Any, U : Any> Observable<Optional<T>>.mapMap(mapper: (T) -> U): Observable<Optional<U>> = - map { it.map(mapper) } - -fun <T : Any, U : Any> Observable<Optional<T>>.mapMapNullable( - mapper: (T) -> U?): Observable<Optional<U>> = map { - it.flatMap { - Optional.ofNullable(mapper(it)) - } -} - -inline fun <T : Any, R : Any> Observable<T>.safeSwitchMap( - noinline mapper: (T) -> ObservableSource<R>): Observable<R> = - switchMap(mapper) - -fun <T : Any, U : Any> Observable<T>.mapNullable( - nullableValue: T, - mapper: (T?) -> U): Observable<U> = map { - mapper(it.nullIf { it == nullableValue }) -} - -fun <T : Any, U : Any> Observable<T>.switchMapNullable( - nullableValue: T, - mapper: (T?) -> Observable<U>): Observable<U> = switchMap { - mapper(it.nullIf { it == nullableValue }) -} - -fun <T : Any, U : Any> Observable<Optional<T>>.mapSwitchMap( - mapper: (T) -> Observable<U>): Observable<Optional<U>> = switchMap { - if (it.isPresent()) { - it.map(mapper).get().map { Optional.of(it) } - } else { - Observable.just(Optional.empty()) - } -} - -fun <T : Any, U : Any> Observable<Optional<T>>.flatMapSwitchMap( - mapper: (T) -> Observable<Optional<U>>): Observable<Optional<U>> = switchMap { - it.map(mapper).orElse(Observable.just(Optional.empty())) -} - -fun <T : Any> Observable<Optional<T>>.mapOrElse(orElse: T): Observable<T> = map { - it.orElse(orElse) -} - -inline fun <reified A, B> combineLatest( - a: ObservableSource<A>, - b: ObservableSource<B> -): Observable<Pair<A, B>> = - Observable.combineLatest(a, b, BiFunction(::Pair)) - -inline fun <reified A, B, C> combineLatest( - a: ObservableSource<A>, - b: ObservableSource<B>, - c: ObservableSource<C> -): Observable<Triple<A, B, C>> = - Observable.combineLatest(listOf(a, b, c)) { - Triple(it[0], it[1], it[2]) as Triple<A, B, C> - } - -inline fun <reified A, B, C, D> combineLatest( - a: ObservableSource<A>, - b: ObservableSource<B>, - c: ObservableSource<C>, - d: ObservableSource<D> -): Observable<Tuple4<A, B, C, D>> = - Observable.combineLatest(listOf(a, b, c, d)) { - Tuple4(it[0], it[1], it[2], it[3]) as Tuple4<A, B, C, D> - } - -inline fun <reified A, B, C, D, E> combineLatest( - a: ObservableSource<A>, - b: ObservableSource<B>, - c: ObservableSource<C>, - d: ObservableSource<D>, - e: ObservableSource<E> -): Observable<Tuple5<A, B, C, D, E>> = - Observable.combineLatest(listOf(a, b, c, d, e)) { - Tuple5(it[0], it[1], it[2], it[3], it[4]) as Tuple5<A, B, C, D, E> - } - -inline fun <reified A, B, C, D, E, F> combineLatest( - a: ObservableSource<A>, - b: ObservableSource<B>, - c: ObservableSource<C>, - d: ObservableSource<D>, - e: ObservableSource<E>, - f: ObservableSource<F> -): Observable<Tuple6<A, B, C, D, E, F>> = - Observable.combineLatest(listOf(a, b, c, d, e, f)) { - Tuple6(it[0], it[1], it[2], it[3], it[4], it[5]) as Tuple6<A, B, C, D, E, F> - } - -inline fun <reified T> combineLatest( - sources: Collection<ObservableSource<out T>> -): Observable<List<T>> = - if (sources.isEmpty()) Observable.just(emptyList()) - else Observable.combineLatest(sources) { t -> t.toList() as List<T> } - -inline operator fun <T, U> Observable<T>.invoke(f: (T) -> U?) = - blockingLatest().firstOrNull()?.let(f) - -data class Tuple4<out A, out B, out C, out D>( - val first: A, - val second: B, - val third: C, - val fourth: D -) - -data class Tuple5<out A, out B, out C, out D, out E>( - val first: A, - val second: B, - val third: C, - val fourth: D, - val fifth: E -) - -data class Tuple6<out A, out B, out C, out D, out E, out F>( - val first: A, - val second: B, - val third: C, - val fourth: D, - val fifth: E, - val sixth: F -) diff --git a/lib/src/main/java/de/kuschku/libquassel/util/helper/StringHelper.kt b/lib/src/main/java/de/kuschku/libquassel/util/helper/StringHelper.kt deleted file mode 100644 index 01e97e97b28c83575df09e69727acb90965d55c5..0000000000000000000000000000000000000000 --- a/lib/src/main/java/de/kuschku/libquassel/util/helper/StringHelper.kt +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.libquassel.util.helper - -import de.kuschku.libquassel.protocol.primitive.serializer.StringSerializer - -/** - * Because Android’s String::split is broken - * - * @return A list with all substrings of length 1, in order - */ -fun String.split() = Array(length) { this.substring(it, it + 1) } - -fun String?.serializeString(serializer: StringSerializer) = if (this == null) { - null -} else { - serializer.serialize(this) -} diff --git a/lib/src/main/java/de/kuschku/libquassel/util/helper/WritableByteChannelHelper.kt b/lib/src/main/java/de/kuschku/libquassel/util/helper/WritableByteChannelHelper.kt deleted file mode 100644 index 8847a669bb66f4583e19e6bc1c59fcc0664ccf51..0000000000000000000000000000000000000000 --- a/lib/src/main/java/de/kuschku/libquassel/util/helper/WritableByteChannelHelper.kt +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.libquassel.util.helper - -import de.kuschku.libquassel.util.nio.ChainedByteBuffer -import java.nio.channels.WritableByteChannel - -fun WritableByteChannel.write(buffer: ChainedByteBuffer) { - buffer.write(this) - buffer.clear() -} diff --git a/lib/src/main/java/de/kuschku/libquassel/util/irc/HostmaskHelper.kt b/lib/src/main/java/de/kuschku/libquassel/util/irc/HostmaskHelper.kt deleted file mode 100644 index 78f5cce62db5622188e990b3e65ab5c515e4e02b..0000000000000000000000000000000000000000 --- a/lib/src/main/java/de/kuschku/libquassel/util/irc/HostmaskHelper.kt +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.libquassel.util.irc - -object HostmaskHelper { - fun nick(mask: String) = mask - .substringBeforeLast('@') - .substringBefore('!') - - fun user(mask: String) = mask - .substringBeforeLast('@') - .substringAfter('!', missingDelimiterValue = "") - - fun host(mask: String) = mask - .substringAfterLast('@', missingDelimiterValue = "") - - fun split(mask: String): Triple<String, String, String> { - val userPart = mask.substringBeforeLast('@') - val host = mask.substringAfterLast('@', missingDelimiterValue = "") - - val user = userPart.substringAfter('!', missingDelimiterValue = "") - val nick = userPart.substringBefore('!') - - return Triple(nick, user, host) - } - - fun build(nick: String, user: String?, host: String?) = buildString { - append(nick) - if (!user.isNullOrEmpty()) { - append("!$user") - } - if (!host.isNullOrEmpty()) { - append("@$host") - } - } -} diff --git a/lib/src/main/java/de/kuschku/libquassel/util/irc/IrcCaseMappers.kt b/lib/src/main/java/de/kuschku/libquassel/util/irc/IrcCaseMappers.kt deleted file mode 100644 index eb60d6d8412a168ebbba826e6e19f7804f9176e2..0000000000000000000000000000000000000000 --- a/lib/src/main/java/de/kuschku/libquassel/util/irc/IrcCaseMappers.kt +++ /dev/null @@ -1,85 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.libquassel.util.irc - -import java.util.* - -object IrcCaseMappers { - var irc: IrcCaseMapper = ClassicalIrcCaseMapper() - var unicode: IrcCaseMapper = UnicodeCaseMapper() - - interface IrcCaseMapper { - fun equalsIgnoreCase(a: String, b: String): Boolean - fun equalsIgnoreCaseNullable(a: String?, b: String?) = when { - a === null && b === null -> true - a === null -> false - b === null -> false - else -> this.equalsIgnoreCase(a, b) - } - - fun toLowerCase(value: String): String - fun toLowerCaseNullable(value: String?): String? = value?.let(this@IrcCaseMapper::toLowerCase) - - fun toUpperCase(value: String): String - fun toUpperCaseNullable(value: String?): String? = value?.let(this@IrcCaseMapper::toUpperCase) - } - - internal class UnicodeCaseMapper : IrcCaseMapper { - - override fun equalsIgnoreCase(a: String, b: String): Boolean { - return a.equals(b, ignoreCase = true) - } - - override fun toLowerCase(value: String): String { - return value.toLowerCase(Locale.US) - } - - override fun toUpperCase(value: String): String { - return value.toUpperCase(Locale.US) - } - } - - internal class ClassicalIrcCaseMapper : - IrcCaseMapper { - override fun toLowerCase(value: String): String { - return value.toLowerCase(Locale.US) - .replace('[', '{') - .replace(']', '}') - .replace('^', '~') - } - - override fun toUpperCase(value: String): String { - return value.toUpperCase(Locale.US) - .replace('{', '[') - .replace('}', ']') - .replace('~', '^') - } - - override fun equalsIgnoreCase(a: String, b: String): Boolean { - return toLowerCase(a) == toLowerCase(b) || toUpperCase(a) == toUpperCase(b) - } - } - - operator fun get(caseMapping: String?) = if (caseMapping.equals("rfc1459", ignoreCase = true)) { - irc - } else { - unicode - } -} diff --git a/lib/src/main/java/de/kuschku/libquassel/util/irc/SenderColorUtil.kt b/lib/src/main/java/de/kuschku/libquassel/util/irc/SenderColorUtil.kt deleted file mode 100644 index 1bb753d77db5aaa5e368766a2035bc8721a5b3c1..0000000000000000000000000000000000000000 --- a/lib/src/main/java/de/kuschku/libquassel/util/irc/SenderColorUtil.kt +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.libquassel.util.irc - -import de.kuschku.libquassel.util.CRCUtils -import java.util.* - -object SenderColorUtil { - fun senderColor(nick: String): Int { - return 0xf and CRCUtils.qChecksum( - nick.trimEnd('_').toLowerCase(Locale.US).toByteArray(Charsets.ISO_8859_1) - ) - } -} diff --git a/lib/src/main/java/de/kuschku/libquassel/util/nio/ChainedByteBuffer.kt b/lib/src/main/java/de/kuschku/libquassel/util/nio/ChainedByteBuffer.kt deleted file mode 100644 index 5689f15a964a023d3d71a8b33b7d29d7b0a9dbcb..0000000000000000000000000000000000000000 --- a/lib/src/main/java/de/kuschku/libquassel/util/nio/ChainedByteBuffer.kt +++ /dev/null @@ -1,129 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.libquassel.util.nio - -import java.nio.ByteBuffer -import java.nio.channels.WritableByteChannel -import java.util.* - -class ChainedByteBuffer(private val bufferSize: Int = 1024, private val direct: Boolean = false) { - private val bufferList: MutableList<ByteBuffer> = ArrayList() - - var size = 0 - private set - - private var currentBuffer = 0 - - private fun allocate(size: Int) = when (direct) { - true -> ByteBuffer.allocateDirect(size) - false -> ByteBuffer.allocate(size) - } - - private fun ensureSpace(size: Int) { - if (bufferList.isEmpty()) { - bufferList.add(allocate(bufferSize)) - } - if (bufferList[currentBuffer].remaining() < size) { - currentBuffer += 1 - } - if (currentBuffer == bufferList.size) { - bufferList.add(allocate(bufferSize)) - } - this.size += size - } - - fun put(value: Byte) { - ensureSpace(1) - - bufferList.last().put(value) - } - - fun putChar(value: Char) { - ensureSpace(2) - - bufferList.last().putChar(value) - } - - fun putShort(value: Short) { - ensureSpace(2) - - bufferList.last().putShort(value) - } - - fun putInt(value: Int) { - ensureSpace(4) - - bufferList.last().putInt(value) - } - - fun putLong(value: Long) { - ensureSpace(8) - - bufferList.last().putLong(value) - } - - fun putFloat(value: Float) { - ensureSpace(4) - - bufferList.last().putFloat(value) - } - - fun putDouble(value: Double) { - ensureSpace(8) - - bufferList.last().putDouble(value) - } - - fun put(value: ByteBuffer) { - while (value.remaining() > 8) { - putLong(value.long) - } - while (value.hasRemaining()) { - put(value.get()) - } - } - - fun put(value: ByteArray) { - value.forEach(this::put) - } - - fun clear() { - bufferList.clear() - currentBuffer = 0 - size = 0 - } - - fun write(channel: WritableByteChannel) { - for (buffer in bufferList) { - buffer.flip() - channel.write(buffer) - } - } - - fun toBuffer(): ByteBuffer { - val byteBuffer = allocate(size) - for (buffer in bufferList) { - buffer.flip() - byteBuffer.put(buffer) - } - byteBuffer.flip() - return byteBuffer - } -} diff --git a/lib/src/main/java/de/kuschku/libquassel/util/nio/WrappedChannel.kt b/lib/src/main/java/de/kuschku/libquassel/util/nio/WrappedChannel.kt deleted file mode 100644 index 9b539999c76e19e0bdd7458fa6253842797e7a4a..0000000000000000000000000000000000000000 --- a/lib/src/main/java/de/kuschku/libquassel/util/nio/WrappedChannel.kt +++ /dev/null @@ -1,257 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.libquassel.util.nio - -import de.kuschku.libquassel.connection.QuasselSecurityException -import de.kuschku.libquassel.connection.SocketAddress -import de.kuschku.libquassel.ssl.X509Helper -import de.kuschku.libquassel.util.compatibility.CompatibilityUtils -import de.kuschku.libquassel.util.compatibility.LoggingHandler.Companion.log -import de.kuschku.libquassel.util.compatibility.LoggingHandler.LogLevel -import de.kuschku.libquassel.util.compatibility.StreamChannelFactory -import java.io.* -import java.net.Socket -import java.net.SocketException -import java.nio.ByteBuffer -import java.nio.channels.ByteChannel -import java.nio.channels.InterruptibleChannel -import java.nio.channels.ReadableByteChannel -import java.nio.channels.WritableByteChannel -import java.security.GeneralSecurityException -import java.security.NoSuchAlgorithmException -import java.util.zip.InflaterInputStream -import javax.net.ssl.* - -class WrappedChannel private constructor( - private val socket: Socket, - private var rawInStream: InputStream? = null, - private var rawOutStream: OutputStream? = null, - private var flusher: (() -> Unit)? = null, - private val closeListeners: List<Closeable> = emptyList() -) : Flushable, ByteChannel, InterruptibleChannel { - private var rawIn: ReadableByteChannel? = null - private var rawOut: WritableByteChannel? = null - - init { - val rawInStream = this.rawInStream - if (rawInStream != null) - this.rawIn = StreamChannelFactory.create(rawInStream) - - val rawOutStream = this.rawOutStream - if (rawOutStream != null) - this.rawOut = StreamChannelFactory.create(rawOutStream) - } - - companion object { - const val DEFAULT_TLS_VERSION = "TLSv1.2" - - fun ofSocket(s: Socket, closeListeners: List<Closeable> = emptyList()): WrappedChannel { - return WrappedChannel( - s, - s.getInputStream(), - s.getOutputStream(), - closeListeners = closeListeners + s.getInputStream() + s.getOutputStream() - ) - } - - fun selectBestTlsVersion(availableVersions: Array<String>): String? { - return availableVersions.filter { - it.startsWith("TLSv") && it >= "TLSv1.2" - }.sorted().lastOrNull() - } - } - - fun withCompression(): WrappedChannel { - val deflaterOutputStream = CompatibilityUtils.createDeflaterOutputStream(rawOutStream) - return WrappedChannel( - socket, InflaterInputStream(rawInStream), deflaterOutputStream, - deflaterOutputStream::flush, - closeListeners = closeListeners + deflaterOutputStream - ) - } - - @Throws(GeneralSecurityException::class, IOException::class) - fun withSSL(certificateManager: X509TrustManager, - hostnameVerifier: HostnameVerifier, - address: SocketAddress - ): WrappedChannel { - val tlsVersion = try { - selectBestTlsVersion(SSLContext.getDefault().defaultSSLParameters.protocols) - } catch (e: NoSuchAlgorithmException) { - null - } - log(LogLevel.DEBUG, - "WrappedChannel", - "TLS Version chosen is: $tlsVersion, with fallback $DEFAULT_TLS_VERSION") - - val context = SSLContext.getInstance(tlsVersion ?: DEFAULT_TLS_VERSION) - val managers = arrayOf(certificateManager) - context.init(null, managers, null) - val factory = context.socketFactory - SSLSocketFactory.getDefault() - - val socket = factory.createSocket(socket, address.host, address.port, true) as SSLSocket - socket.useClientMode = true - socket.addHandshakeCompletedListener { - if (socket.session.peerCertificateChain.isEmpty()) { - throw QuasselSecurityException.NoCertificate(address) - } - if (!hostnameVerifier.verify(address.host, socket.session)) { - throw QuasselSecurityException.WrongHostname(X509Helper.convert(socket.session.peerCertificateChain), - address) - } - } - socket.startHandshake() - return ofSocket(socket) - } - - /** - * Reads a sequence of bytes from this channel into the given buffer. - * <p> - * <p> An attempt is made to read up to <i>r</i> bytes from the channel, - * where <i>r</i> is the number of bytes remaining in the buffer, that is, - * <tt>dst.remaining()</tt>, at the moment this method is invoked. - * <p> - * <p> Suppose that a byte sequence of length <i>n</i> is read, where - * <tt>0</tt> <tt><=</tt> <i>n</i> <tt><=</tt> <i>r</i>. - * This byte sequence will be transferred into the buffer so that the first - * byte in the sequence is at index <i>p</i> and the last byte is at index - * <i>p</i> <tt>+</tt> <i>n</i> <tt>-</tt> <tt>1</tt>, - * where <i>p</i> is the buffer's position at the moment this method is - * invoked. Upon return the buffer's position will be equal to - * <i>p</i> <tt>+</tt> <i>n</i>; its limit will not have changed. - * <p> - * <p> A read operation might not fill the buffer, and in fact it might not - * read any bytes at all. Whether or not it does so depends upon the - * nature and state of the channel. A socket channel in non-blocking mode, - * for example, cannot read any more bytes than are immediately available - * from the socket's input buffer; similarly, a file channel cannot read - * any more bytes than remain in the file. It is guaranteed, however, that - * if a channel is in blocking mode and there is at least one byte - * remaining in the buffer then this method will block until at least one - * byte is read. - * <p> - * <p> This method may be invoked at any time. If another thread has - * already initiated a read operation upon this channel, however, then an - * invocation of this method will block until the first operation is - * complete. - * - * @param dst The buffer into which bytes are to be transferred - * @return The number of bytes read, possibly zero, or <tt>-1</tt> if the - * channel has reached end-of-stream - * @throws IOException If some other I/O Error occurs - */ - @Throws(IOException::class) - override fun read(dst: ByteBuffer): Int { - val stream = rawIn ?: throw SocketException("Socket Closed") - return stream.read(dst) - } - - /** - * Writes a sequence of bytes to this channel from the given buffer. - * <p> - * <p> An attempt is made to write up to <i>r</i> bytes to the channel, - * where <i>r</i> is the number of bytes remaining in the buffer, that is, - * <tt>src.remaining()</tt>, at the moment this method is invoked. - * <p> - * <p> Suppose that a byte sequence of length <i>n</i> is written, where - * <tt>0</tt> <tt><=</tt> <i>n</i> <tt><=</tt> <i>r</i>. - * This byte sequence will be transferred from the buffer starting at index - * <i>p</i>, where <i>p</i> is the buffer's position at the moment this - * method is invoked; the index of the last byte written will be - * <i>p</i> <tt>+</tt> <i>n</i> <tt>-</tt> <tt>1</tt>. - * Upon return the buffer's position will be equal to - * <i>p</i> <tt>+</tt> <i>n</i>; its limit will not have changed. - * <p> - * <p> Unless otherwise specified, a write operation will return only after - * writing all of the <i>r</i> requested bytes. Some types of channels, - * depending upon their state, may write only some of the bytes or possibly - * none at all. A socket channel in non-blocking mode, for example, cannot - * write any more bytes than are free in the socket's output buffer. - * <p> - * <p> This method may be invoked at any time. If another thread has - * already initiated a write operation upon this channel, however, then an - * invocation of this method will block until the first operation is - * complete. </p> - * - * @param src The buffer from which bytes are to be retrieved - * @return The number of bytes written, possibly zero - * @throws IOException If some other I/O Error occurs - */ - @Throws(IOException::class) - override fun write(src: ByteBuffer): Int { - val stream = rawOut ?: throw SocketException("Socket Closed") - return stream.write(src) - } - - override fun isOpen(): Boolean { - return rawIn != null || rawOut != null - } - - /** - * Closes this channel. - * <p> - * <p> After a channel is closed, any further attempt to invoke I/O - * operations upon it will cause a {@link ClosedChannelException} to be - * thrown. - * <p> - * <p> If this channel is already closed then invoking this method has no - * effect. - * <p> - * <p> This method may be invoked at any time. If some other thread has - * already invoked it, however, then another invocation will block until - * the first invocation is complete, after which it will return without - * effect. </p> - * - * @throws IOException If an I/O Error occurs - */ - @Throws(IOException::class) - override fun close() { - rawIn?.close() - rawIn = null - rawOut?.close() - rawOut = null - socket.close() - /* - for (listener in closeListeners + socket) { - try { - log(INFO, "WrappedChannel", "Closing: ${listener::class.java}") - listener.close() - } catch (e: Throwable) { - log(WARN, "WrappedChannel", "Error encountered while closing connection: $e") - } - } - */ - } - - /** - * Flushes this stream by writing any buffered output to the underlying - * stream. - * - * @throws IOException If an I/O Error occurs - */ - @Throws(IOException::class) - override fun flush() { - flusher?.invoke() - } - - val sslSession - get() = (socket as? SSLSocket)?.session -} diff --git a/lib/src/main/java/de/kuschku/libquassel/util/rxjava/ReusableUnicastSubject.java b/lib/src/main/java/de/kuschku/libquassel/util/rxjava/ReusableUnicastSubject.java deleted file mode 100644 index 86c4a242ba0d973e15fb7d17dd9aa564cf9a85fd..0000000000000000000000000000000000000000 --- a/lib/src/main/java/de/kuschku/libquassel/util/rxjava/ReusableUnicastSubject.java +++ /dev/null @@ -1,584 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.libquassel.util.rxjava; - -import java.util.concurrent.atomic.AtomicBoolean; -import java.util.concurrent.atomic.AtomicReference; - -import io.reactivex.Observer; -import io.reactivex.annotations.CheckReturnValue; -import io.reactivex.annotations.Experimental; -import io.reactivex.annotations.Nullable; -import io.reactivex.disposables.Disposable; -import io.reactivex.internal.disposables.EmptyDisposable; -import io.reactivex.internal.functions.ObjectHelper; -import io.reactivex.internal.fuseable.SimpleQueue; -import io.reactivex.internal.observers.BasicIntQueueDisposable; -import io.reactivex.internal.queue.SpscLinkedArrayQueue; -import io.reactivex.plugins.RxJavaPlugins; -import io.reactivex.subjects.Subject; - -/** - * A Subject that queues up events until a single {@link Observer} subscribes to it, replays - * those events to it until the {@code Observer} catches up and then switches to relaying events live to - * this single {@code Observer} until this {@code UnicastSubject} terminates or the {@code Observer} unsubscribes. - * <p> - * <img width="640" height="370" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/UnicastSubject.png" alt=""> - * <p> - * Note that {@code UnicastSubject} holds an unbounded internal buffer. - * <p> - * This subject does not have a public constructor by design; a new empty instance of this - * {@code UnicastSubject} can be created via the following {@code create} methods that - * allow specifying the retention policy for items: - * <ul> - * <li>{@link #create()} - creates an empty, unbounded {@code UnicastSubject} that - * caches all items and the terminal event it receives.</li> - * <li>{@link #create(int)} - creates an empty, unbounded {@code UnicastSubject} - * with a hint about how many <b>total</b> items one expects to retain.</li> - * <li>{@link #create(boolean)} - creates an empty, unbounded {@code UnicastSubject} that - * optionally delays an error it receives and replays it after the regular items have been emitted.</li> - * <li>{@link #create(int, Runnable)} - creates an empty, unbounded {@code UnicastSubject} - * with a hint about how many <b>total</b> items one expects to retain and a callback that will be - * called exactly once when the {@code UnicastSubject} gets terminated or the single {@code Observer} unsubscribes.</li> - * <li>{@link #create(int, Runnable, boolean)} - creates an empty, unbounded {@code UnicastSubject} - * with a hint about how many <b>total</b> items one expects to retain and a callback that will be - * called exactly once when the {@code UnicastSubject} gets terminated or the single {@code Observer} unsubscribes - * and optionally delays an error it receives and replays it after the regular items have been emitted.</li> - * </ul> - * <p> - * If more than one {@code Observer} attempts to subscribe to this {@code UnicastSubject}, they - * will receive an {@code IllegalStateException} indicating the single-use-only nature of this {@code UnicastSubject}, - * even if the {@code UnicastSubject} already terminated with an error. - * <p> - * Since a {@code Subject} is conceptionally derived from the {@code Processor} type in the Reactive Streams specification, - * {@code null}s are not allowed (<a href="https://github.com/reactive-streams/reactive-streams-jvm#2.13">Rule 2.13</a>) as - * parameters to {@link #onNext(Object)} and {@link #onError(Throwable)}. Such calls will result in a - * {@link NullPointerException} being thrown and the subject's state is not changed. - * <p> - * Since a {@code UnicastSubject} is an {@link io.reactivex.Observable}, it does not support backpressure. - * <p> - * When this {@code UnicastSubject} is terminated via {@link #onError(Throwable)} the current or late single {@code Observer} - * may receive the {@code Throwable} before any available items could be emitted. To make sure an onError event is delivered - * to the {@code Observer} after the normal items, create a {@code UnicastSubject} with the {@link #create(boolean)} or - * {@link #create(int, Runnable, boolean)} factory methods. - * <p> - * Even though {@code UnicastSubject} implements the {@code Observer} interface, calling - * {@code onSubscribe} is not required (<a href="https://github.com/reactive-streams/reactive-streams-jvm#2.12">Rule 2.12</a>) - * if the subject is used as a standalone source. However, calling {@code onSubscribe} - * after the {@code UnicastSubject} reached its terminal state will result in the - * given {@code Disposable} being disposed immediately. - * <p> - * Calling {@link #onNext(Object)}, {@link #onError(Throwable)} and {@link #onComplete()} - * is required to be serialized (called from the same thread or called non-overlappingly from different threads - * through external means of serialization). The {@link #toSerialized()} method available to all {@code Subject}s - * provides such serialization and also protects against reentrance (i.e., when a downstream {@code Observer} - * consuming this subject also wants to call {@link #onNext(Object)} on this subject recursively). - * <p> - * This {@code UnicastSubject} supports the standard state-peeking methods {@link #hasComplete()}, {@link #hasThrowable()}, - * {@link #getThrowable()} and {@link #hasObservers()}. - * <dl> - * <dt><b>Scheduler:</b></dt> - * <dd>{@code UnicastSubject} does not operate by default on a particular {@link io.reactivex.Scheduler} and - * the {@code Observer}s get notified on the thread the respective {@code onXXX} methods were invoked.</dd> - * <dt><b>Error handling:</b></dt> - * <dd>When the {@link #onError(Throwable)} is called, the {@code UnicastSubject} enters into a terminal state - * and emits the same {@code Throwable} instance to the last set of {@code Observer}s. During this emission, - * if one or more {@code Observer}s dispose their respective {@code Disposable}s, the - * {@code Throwable} is delivered to the global error handler via - * {@link io.reactivex.plugins.RxJavaPlugins#onError(Throwable)} (multiple times if multiple {@code Observer}s - * cancel at once). - * If there were no {@code Observer}s subscribed to this {@code UnicastSubject} when the {@code onError()} - * was called, the global error handler is not invoked. - * </dd> - * </dl> - * <p> - * Example usage: - * <pre><code> - * UnicastSubject<Integer> subject = UnicastSubject.create(); - * - * TestObserver<Integer> to1 = subject.test(); - * - * // fresh UnicastSubjects are empty - * to1.assertEmpty(); - * - * TestObserver<Integer> to2 = subject.test(); - * - * // A UnicastSubject only allows one Observer during its lifetime - * to2.assertFailure(IllegalStateException.class); - * - * subject.onNext(1); - * to1.assertValue(1); - * - * subject.onNext(2); - * to1.assertValues(1, 2); - * - * subject.onComplete(); - * to1.assertResult(1, 2); - * - * // ---------------------------------------------------- - * - * UnicastSubject<Integer> subject2 = UnicastSubject.create(); - * - * // a UnicastSubject caches events util its single Observer subscribes - * subject.onNext(1); - * subject.onNext(2); - * subject.onComplete(); - * - * TestObserver<Integer> to3 = subject2.test(); - * - * // the cached events are emitted in order - * to3.assertResult(1, 2); - * </code></pre> - * - * @param <T> the value type received and emitted by this Subject subclass - * @since 2.0 - */ -public final class ReusableUnicastSubject<T> extends Subject<T> { - /** - * The queue that buffers the source events. - */ - private final SpscLinkedArrayQueue<T> queue; - - /** - * The single Observer. - */ - private final AtomicReference<Observer<? super T>> actual; - - /** - * The optional callback when the Subject gets cancelled or terminates. - */ - private final AtomicReference<Runnable> onTerminate; - - /** - * deliver onNext events before error event. - */ - private final boolean delayError; - /** - * Set to 1 atomically for the first and only Subscriber. - */ - private final AtomicBoolean once; - /** - * The wip counter and QueueDisposable surface. - */ - private final BasicIntQueueDisposable<T> wip; - /** - * Indicates the single observer has cancelled. - */ - private volatile boolean disposed; - /** - * Indicates the source has terminated. - */ - private volatile boolean done; - /** - * The terminal error if not null. - * Must be set before writing to done and read after done == true. - */ - private Throwable error; - private boolean enableOperatorFusion; - - /** - * Creates an UnicastSubject with the given capacity hint and delay error flag. - * - * @param capacityHint the capacity hint for the internal, unbounded queue - * @param delayError deliver pending onNext events before onError - * @since 2.0.8 - experimental - */ - ReusableUnicastSubject(int capacityHint, boolean delayError) { - this.queue = new SpscLinkedArrayQueue<>(ObjectHelper.verifyPositive(capacityHint, "capacityHint")); - this.onTerminate = new AtomicReference<>(); - this.delayError = delayError; - this.actual = new AtomicReference<>(); - this.once = new AtomicBoolean(); - this.wip = new ReusableUnicastSubject<T>.UnicastQueueDisposable(); - } - - /** - * Creates an UnicastSubject with the given capacity hint and callback - * for when the Subject is terminated normally or its single Subscriber cancels. - * - * @param capacityHint the capacity hint for the internal, unbounded queue - * @param onTerminate the callback to run when the Subject is terminated or cancelled, null not allowed - * @since 2.0 - */ - ReusableUnicastSubject(int capacityHint, Runnable onTerminate) { - this(capacityHint, onTerminate, true); - } - - /** - * Creates an UnicastSubject with the given capacity hint, delay error flag and callback - * for when the Subject is terminated normally or its single Subscriber cancels. - * - * @param capacityHint the capacity hint for the internal, unbounded queue - * @param onTerminate the callback to run when the Subject is terminated or cancelled, null not allowed - * @param delayError deliver pending onNext events before onError - * @since 2.0.8 - experimental - */ - ReusableUnicastSubject(int capacityHint, Runnable onTerminate, boolean delayError) { - this.queue = new SpscLinkedArrayQueue<T>(ObjectHelper.verifyPositive(capacityHint, "capacityHint")); - this.onTerminate = new AtomicReference<Runnable>(ObjectHelper.requireNonNull(onTerminate, "onTerminate")); - this.delayError = delayError; - this.actual = new AtomicReference<Observer<? super T>>(); - this.once = new AtomicBoolean(); - this.wip = new ReusableUnicastSubject<T>.UnicastQueueDisposable(); - } - - /** - * Creates an UnicastSubject with an internal buffer capacity hint 16. - * - * @param <T> the value type - * @return an UnicastSubject instance - */ - @CheckReturnValue - public static <T> ReusableUnicastSubject<T> create() { - return new ReusableUnicastSubject<T>(bufferSize(), true); - } - - /** - * Creates an UnicastSubject with the given internal buffer capacity hint. - * - * @param <T> the value type - * @param capacityHint the hint to size the internal unbounded buffer - * @return an UnicastSubject instance - */ - @CheckReturnValue - public static <T> ReusableUnicastSubject<T> create(int capacityHint) { - return new ReusableUnicastSubject<T>(capacityHint, true); - } - - /** - * Creates an UnicastSubject with the given internal buffer capacity hint and a callback for - * the case when the single Subscriber cancels its subscription. - * - * <p>The callback, if not null, is called exactly once and - * non-overlapped with any active replay. - * - * @param <T> the value type - * @param capacityHint the hint to size the internal unbounded buffer - * @param onTerminate the callback to run when the Subject is terminated or cancelled, null not allowed - * @return an UnicastSubject instance - */ - @CheckReturnValue - public static <T> ReusableUnicastSubject<T> create(int capacityHint, Runnable onTerminate) { - return new ReusableUnicastSubject<T>(capacityHint, onTerminate, true); - } - - /** - * Creates an UnicastSubject with the given internal buffer capacity hint, delay error flag and - * a callback for the case when the single Subscriber cancels its subscription. - * - * <p>The callback, if not null, is called exactly once and - * non-overlapped with any active replay. - * - * @param <T> the value type - * @param capacityHint the hint to size the internal unbounded buffer - * @param onTerminate the callback to run when the Subject is terminated or cancelled, null not allowed - * @param delayError deliver pending onNext events before onError - * @return an UnicastSubject instance - * @since 2.0.8 - experimental - */ - @CheckReturnValue - @Experimental - public static <T> ReusableUnicastSubject<T> create(int capacityHint, Runnable onTerminate, boolean delayError) { - return new ReusableUnicastSubject<T>(capacityHint, onTerminate, delayError); - } - - /** - * Creates an UnicastSubject with an internal buffer capacity hint 16 and given delay error flag. - * - * <p>The callback, if not null, is called exactly once and - * non-overlapped with any active replay. - * - * @param <T> the value type - * @param delayError deliver pending onNext events before onError - * @return an UnicastSubject instance - * @since 2.0.8 - experimental - */ - @CheckReturnValue - @Experimental - public static <T> ReusableUnicastSubject<T> create(boolean delayError) { - return new ReusableUnicastSubject<T>(bufferSize(), delayError); - } - - @Override - protected void subscribeActual(Observer<? super T> observer) { - if (!once.get() && once.compareAndSet(false, true)) { - observer.onSubscribe(wip); - actual.lazySet(observer); // full barrier in drain - if (disposed) { - actual.lazySet(null); - return; - } - drain(); - } else { - EmptyDisposable.error(new IllegalStateException("Only a single observer allowed."), observer); - } - } - - void doTerminate() { - Runnable r = onTerminate.get(); - if (r != null && onTerminate.compareAndSet(r, null)) { - r.run(); - } - } - - @Override - public void onSubscribe(Disposable s) { - if (done || disposed) { - s.dispose(); - } - } - - @Override - public void onNext(T t) { - ObjectHelper.requireNonNull(t, "onNext called with null. Null values are generally not allowed in 2.x operators and sources."); - if (done || disposed) { - return; - } - queue.offer(t); - drain(); - } - - @Override - public void onError(Throwable t) { - ObjectHelper.requireNonNull(t, "onError called with null. Null values are generally not allowed in 2.x operators and sources."); - if (done || disposed) { - RxJavaPlugins.onError(t); - return; - } - error = t; - done = true; - - doTerminate(); - - drain(); - } - - @Override - public void onComplete() { - if (done || disposed) { - return; - } - done = true; - - doTerminate(); - - drain(); - } - - void drainNormal(Observer<? super T> a) { - int missed = 1; - SimpleQueue<T> q = queue; - boolean failFast = !this.delayError; - boolean canBeError = true; - for (; ; ) { - for (; ; ) { - - if (disposed) { - actual.lazySet(null); - q.clear(); - return; - } - - boolean d = this.done; - T v = queue.poll(); - boolean empty = v == null; - - if (d) { - if (failFast && canBeError) { - if (failedFast(q, a)) { - return; - } else { - canBeError = false; - } - } - - if (empty) { - errorOrComplete(a); - return; - } - } - - if (empty) { - break; - } - - a.onNext(v); - } - - missed = wip.addAndGet(-missed); - if (missed == 0) { - break; - } - } - } - - void drainFused(Observer<? super T> a) { - int missed = 1; - - final SpscLinkedArrayQueue<T> q = queue; - final boolean failFast = !delayError; - - for (; ; ) { - - if (disposed) { - actual.lazySet(null); - q.clear(); - return; - } - boolean d = done; - - if (failFast && d) { - if (failedFast(q, a)) { - return; - } - } - - a.onNext(null); - - if (d) { - errorOrComplete(a); - return; - } - - missed = wip.addAndGet(-missed); - if (missed == 0) { - break; - } - } - } - - void errorOrComplete(Observer<? super T> a) { - actual.lazySet(null); - Throwable ex = error; - if (ex != null) { - a.onError(ex); - } else { - a.onComplete(); - } - } - - boolean failedFast(final SimpleQueue<T> q, Observer<? super T> a) { - Throwable ex = error; - if (ex != null) { - actual.lazySet(null); - q.clear(); - a.onError(ex); - return true; - } else { - return false; - } - } - - void drain() { - if (wip.getAndIncrement() != 0) { - return; - } - - Observer<? super T> a = actual.get(); - int missed = 1; - - for (; ; ) { - - if (a != null) { - if (enableOperatorFusion) { - drainFused(a); - } else { - drainNormal(a); - } - return; - } - - missed = wip.addAndGet(-missed); - if (missed == 0) { - break; - } - - a = actual.get(); - } - } - - @Override - public boolean hasObservers() { - return actual.get() != null; - } - - @Override - public Throwable getThrowable() { - if (done) { - return error; - } - return null; - } - - @Override - public boolean hasThrowable() { - return done && error != null; - } - - @Override - public boolean hasComplete() { - return done && error == null; - } - - final class UnicastQueueDisposable extends BasicIntQueueDisposable<T> { - private static final long serialVersionUID = 7926949470189395511L; - - @Override - public int requestFusion(int mode) { - if ((mode & ASYNC) != 0) { - enableOperatorFusion = true; - return ASYNC; - } - return NONE; - } - - @Nullable - @Override - public T poll() { - return queue.poll(); - } - - @Override - public boolean isEmpty() { - return queue.isEmpty(); - } - - @Override - public void clear() { - queue.clear(); - } - - @Override - public void dispose() { - if (!disposed) { - once.set(false); - actual.set(null); - wip.set(0); - queue.clear(); - } - } - - @Override - public boolean isDisposed() { - return disposed; - } - - } -} diff --git a/lib/src/test/java/de/kuschku/libquassel/integration/AliasManagerTest.kt b/lib/src/test/java/de/kuschku/libquassel/integration/AliasManagerTest.kt deleted file mode 100644 index d0cdd9489aca7417cc14d8f634b2568e3a8998a6..0000000000000000000000000000000000000000 --- a/lib/src/test/java/de/kuschku/libquassel/integration/AliasManagerTest.kt +++ /dev/null @@ -1,170 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.libquassel.integration - -import de.kuschku.libquassel.protocol.Buffer_Type -import de.kuschku.libquassel.protocol.NetworkId -import de.kuschku.libquassel.quassel.BufferInfo -import de.kuschku.libquassel.quassel.syncables.interfaces.IAliasManager -import de.kuschku.libquassel.util.TestSession -import de.kuschku.libquassel.util.setupTestSession -import de.kuschku.libquassel.util.with -import org.junit.Assert.assertEquals -import org.junit.Before -import org.junit.Test - -class AliasManagerTest { - lateinit var session: TestSession - lateinit var channelBuffer: BufferInfo - lateinit var queryBuffer: BufferInfo - - @Before - fun setUp() { - session = setupTestSession() - session.aliasManager.setAliasList(listOf( - IAliasManager.Alias( - "userexpansion", - "$1 $1:account $1:hostname $1:identd $1:ident" - ), - IAliasManager.Alias( - "channelexpansion", - "\$channel" - ), - IAliasManager.Alias( - "rangeexpansion", - "1 \"\$1\" 2 \"\$2\" 3..4 \"\$3..4\" 3.. \"\$3..\"" - ) - )) - - channelBuffer = session.bufferSyncer.find( - bufferName = "#quassel-test", - networkId = NetworkId(1) - )!! - assert(channelBuffer.type == Buffer_Type.of(Buffer_Type.ChannelBuffer)) - - queryBuffer = session.bufferSyncer.find( - bufferName = "digitalcircuit", - networkId = NetworkId(1) - )!! - assert(queryBuffer.type == Buffer_Type.of(Buffer_Type.QueryBuffer)) - } - - // Test with user where identd works - @Test - fun userExpansionWithIdentd() = session.with { - assertEquals( - listOf(IAliasManager.Command( - channelBuffer, - "justJanne justJanne kuschku.de kuschku kuschku" - )), - aliasManager.processInput( - channelBuffer, - "/userexpansion justJanne" - ) - ) - } - - // Test with user where identd doesn’t work - @Test - fun userExpansionNoIdentd() = session.with { - assertEquals( - listOf(IAliasManager.Command( - channelBuffer, - "digitalcircuit digitalcircuit 2605:6000:1518:830d:ec4:7aff:fe6b:c6b0 * ~quassel" - )), - aliasManager.processInput( - channelBuffer, - "/userexpansion digitalcircuit" - ) - ) - } - - // Test with user that isn’t even in channel - @Test - fun userExpansionUnknownUser() = session.with { - assertEquals( - listOf(IAliasManager.Command( - channelBuffer, - "ChanServ * * * *" - )), - aliasManager.processInput( - channelBuffer, - "/userexpansion ChanServ" - ) - ) - } - - // Test in query - @Test - fun userExpansionQuery() = session.with { - assertEquals( - listOf(IAliasManager.Command( - queryBuffer, - "digitalcircuit digitalcircuit 2605:6000:1518:830d:ec4:7aff:fe6b:c6b0 * ~quassel" - )), - aliasManager.processInput( - queryBuffer, - "/userexpansion digitalcircuit" - ) - ) - } - - @Test - fun channelExpansionChannel() = session.with { - assertEquals( - listOf(IAliasManager.Command( - channelBuffer, - "#quassel-test" - )), - aliasManager.processInput( - channelBuffer, - "/channelexpansion" - ) - ) - } - - @Test - fun channelExpansionQuery() = session.with { - assertEquals( - listOf(IAliasManager.Command( - queryBuffer, - "digitalcircuit" - )), - aliasManager.processInput( - queryBuffer, - "/channelexpansion" - ) - ) - } - - @Test - fun rangeExpansion() = session.with { - assertEquals( - listOf(IAliasManager.Command( - queryBuffer, - "1 \"a\" 2 \"b\" 3..4 \"c d\" 3.. \"c d e f\"" - )), - aliasManager.processInput( - queryBuffer, - "/rangeexpansion a b c d e f" - ) - ) - } -} diff --git a/lib/src/test/java/de/kuschku/libquassel/integration/BufferViewConfigTest.kt b/lib/src/test/java/de/kuschku/libquassel/integration/BufferViewConfigTest.kt deleted file mode 100644 index 3ed2abb4b850172a54f4cd1dc97be8e2ae08ddc5..0000000000000000000000000000000000000000 --- a/lib/src/test/java/de/kuschku/libquassel/integration/BufferViewConfigTest.kt +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.libquassel.integration - -import de.kuschku.libquassel.protocol.BufferId -import de.kuschku.libquassel.protocol.QType -import de.kuschku.libquassel.protocol.QVariant_ -import de.kuschku.libquassel.protocol.Type -import de.kuschku.libquassel.util.TestSession -import de.kuschku.libquassel.util.setupTestSession -import de.kuschku.libquassel.util.with -import org.junit.Before -import org.junit.Test - -class BufferViewConfigTest { - lateinit var session: TestSession - - @Before - fun setUp() { - session = setupTestSession() - } - - // Test positioning of added channel - @Test - fun addChannelAutomatically() = session.with { - val bufferViewConfig = bufferViewManager.bufferViewConfig(0)!! - - ensure { - bufferViewConfig.insertBufferSorted(bufferSyncer.bufferInfo(BufferId(4))!!, bufferSyncer) - }.does { - callSync(bufferViewConfig, "requestAddBuffer", listOf( - QVariant_.of(BufferId(4), QType.BufferId), - QVariant_.of(2, Type.Int) - )) - } - } -} diff --git a/lib/src/test/java/de/kuschku/libquassel/integration/SampleIntegrationTest.kt b/lib/src/test/java/de/kuschku/libquassel/integration/SampleIntegrationTest.kt deleted file mode 100644 index a005fe23fc82f2dca52b8f7a7ece6bc335ff12ef..0000000000000000000000000000000000000000 --- a/lib/src/test/java/de/kuschku/libquassel/integration/SampleIntegrationTest.kt +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.libquassel.integration - -import de.kuschku.libquassel.protocol.NetworkId -import de.kuschku.libquassel.protocol.QType -import de.kuschku.libquassel.protocol.QVariant_ -import de.kuschku.libquassel.protocol.Type -import de.kuschku.libquassel.util.withTestSession -import org.junit.Test - -class SampleIntegrationTest { - @Test - fun test() = withTestSession { - ensure { - rpcHandler.changePassword(0L, "user", "pass", "p@ssword1") - }.does { - callRpc( - "2changePassword(PeerPtr,QString,QString,QString)", - listOf( - QVariant_.of(0L, QType.PeerPtr), - QVariant_.of("user", Type.QString), - QVariant_.of("pass", Type.QString), - QVariant_.of("p@ssword1", Type.QString) - ) - ) - } - - ensure { - val network = network(NetworkId(1))!! - val justJanne = network.ircUser("justJanne")!! - assert(justJanne.channels().contains("#quassel-test")) - } - } -} diff --git a/lib/src/test/java/de/kuschku/libquassel/integration/SignedIdNameTests.kt b/lib/src/test/java/de/kuschku/libquassel/integration/SignedIdNameTests.kt deleted file mode 100644 index 21b76ee33d3ee5b2a51e6e64762374126be3c813..0000000000000000000000000000000000000000 --- a/lib/src/test/java/de/kuschku/libquassel/integration/SignedIdNameTests.kt +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.libquassel.integration - -import de.kuschku.libquassel.protocol.IdentityId -import de.kuschku.libquassel.protocol.NetworkId -import de.kuschku.libquassel.util.withTestSession -import org.junit.Test - -/* - * When implementing SignedIds properly for the first time, we noticed that they were used in - * objectNames directly, leading e.g. IrcChannel’s renameObject("${network().networkId()}/${name()}") - * to return "NetworkId(4)/justJanne" instead of the "4/justJanne" that it used to. - * - * This test exists to prevent this regression from reoccuring. - */ -class SignedIdNameTests { - @Test - fun testNetworkName() = withTestSession { - ensure { - addNetwork(buildNetwork(NetworkId(2)), initialize = true) - }.does { - requestInit("Network", "2") - } - } - - @Test - fun testIdentityName() = withTestSession { - ensure { - addIdentity(buildIdentity(IdentityId(2)), initialize = true) - }.does { - requestInit("Identity", "2") - } - } - - @Test - fun testIrcUserName() = withTestSession { - ensure { - val network = network(NetworkId(1))!! - network.addIrcUser("testuser") - }.does { - requestInit("IrcUser", "1/testuser") - } - } - - @Test - fun testIrcChannelName() = withTestSession { - ensure { - val network = network(NetworkId(1))!! - network.addIrcChannel("#testchannel") - }.does { - requestInit("IrcChannel", "1/#testchannel") - } - } -} diff --git a/lib/src/test/java/de/kuschku/libquassel/protocol/primitive/serializer/BoolSerializerTest.kt b/lib/src/test/java/de/kuschku/libquassel/protocol/primitive/serializer/BoolSerializerTest.kt deleted file mode 100644 index 743ea0a65074f522ea35e9edc34cd4dd4f1dde98..0000000000000000000000000000000000000000 --- a/lib/src/test/java/de/kuschku/libquassel/protocol/primitive/serializer/BoolSerializerTest.kt +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.libquassel.protocol.primitive.serializer - -import de.kuschku.libquassel.util.deserialize -import de.kuschku.libquassel.util.roundTrip -import org.junit.Assert.assertEquals -import org.junit.Test - -class BoolSerializerTest { - @Test - fun test() { - assertEquals(true, roundTrip(BoolSerializer, true)) - // @formatter:off - assertEquals(true, deserialize(BoolSerializer, byteArrayOf(1))) - // @formatter:on - - assertEquals(false, roundTrip(BoolSerializer, false)) - // @formatter:off - assertEquals(false, deserialize(BoolSerializer, byteArrayOf(0))) - // @formatter:on - } -} diff --git a/lib/src/test/java/de/kuschku/libquassel/protocol/primitive/serializer/BufferInfoSerializerTest.kt b/lib/src/test/java/de/kuschku/libquassel/protocol/primitive/serializer/BufferInfoSerializerTest.kt deleted file mode 100644 index 803bc62f6e82dee0be7c0968c867b3ec16ea603b..0000000000000000000000000000000000000000 --- a/lib/src/test/java/de/kuschku/libquassel/protocol/primitive/serializer/BufferInfoSerializerTest.kt +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.libquassel.protocol.primitive.serializer - -import de.kuschku.libquassel.protocol.BufferId -import de.kuschku.libquassel.protocol.Buffer_Type -import de.kuschku.libquassel.protocol.NetworkId -import de.kuschku.libquassel.quassel.BufferInfo -import de.kuschku.libquassel.util.deserialize -import de.kuschku.libquassel.util.roundTrip -import org.junit.Assert.assertEquals -import org.junit.Test - -class BufferInfoSerializerTest { - @Test - fun testBaseCase() { - val value = BufferInfo( - BufferId(-1), - NetworkId(-1), - Buffer_Type.of(), - -1, - "" - ) - assertEquals(value, roundTrip(BufferInfoSerializer, value)) - // @formatter:off - assertEquals(value, deserialize(BufferInfoSerializer, byteArrayOf(-1, -1, -1, -1, -1, -1, -1, -1, 0, 0, -1, -1, -1, -1, 0, 0, 0, 0))) - // @formatter:on - } - - @Test - fun testNormal() { - val value = BufferInfo( - BufferId.MAX_VALUE, - NetworkId.MAX_VALUE, - Buffer_Type.of(*Buffer_Type.validValues), - Int.MAX_VALUE, - "äẞ\u0000\uFFFF" - ) - assertEquals(value, roundTrip(BufferInfoSerializer, value)) - // @formatter:off - assertEquals(value, deserialize(BufferInfoSerializer, byteArrayOf(127, -1, -1, -1, 127, -1, -1, -1, 0, 15, 127, -1, -1, -1, 0, 0, 0, 9, -61, -92, -31, -70, -98, 0, -17, -65, -65))) - // @formatter:on - } -} diff --git a/lib/src/test/java/de/kuschku/libquassel/protocol/primitive/serializer/ByteArraySerializerTest.kt b/lib/src/test/java/de/kuschku/libquassel/protocol/primitive/serializer/ByteArraySerializerTest.kt deleted file mode 100644 index 548f340efbbce7f8b1b722216ba2000db5fbd971..0000000000000000000000000000000000000000 --- a/lib/src/test/java/de/kuschku/libquassel/protocol/primitive/serializer/ByteArraySerializerTest.kt +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.libquassel.protocol.primitive.serializer - -import de.kuschku.libquassel.util.deserialize -import de.kuschku.libquassel.util.roundTrip -import org.junit.Assert.assertArrayEquals -import org.junit.Test -import java.nio.ByteBuffer - -class ByteArraySerializerTest { - @Test - fun testBaseCase() { - val value = byteArrayOf() - assertArrayEquals(value, roundTrip(ByteArraySerializer, ByteBuffer.wrap(value))?.array()) - // @formatter:off - assertArrayEquals(value, deserialize(ByteArraySerializer, byteArrayOf(0, 0, 0, 0))?.array()) - // @formatter:on - } - - @Test - fun testNormal() { - val value = byteArrayOf(1, 2, 3, 4, 5, 6, 7, 8, 9) - assertArrayEquals(value, roundTrip(ByteArraySerializer, ByteBuffer.wrap(value))?.array()) - // @formatter:off - assertArrayEquals(value, deserialize(ByteArraySerializer, byteArrayOf(0, 0, 0, 9, 1, 2, 3, 4, 5, 6, 7, 8, 9))?.array()) - // @formatter:on - } -} diff --git a/lib/src/test/java/de/kuschku/libquassel/protocol/primitive/serializer/ByteSerializerTest.kt b/lib/src/test/java/de/kuschku/libquassel/protocol/primitive/serializer/ByteSerializerTest.kt deleted file mode 100644 index 81850e3201c0d965f121fcb2eeb413c96d431d4d..0000000000000000000000000000000000000000 --- a/lib/src/test/java/de/kuschku/libquassel/protocol/primitive/serializer/ByteSerializerTest.kt +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.libquassel.protocol.primitive.serializer - -import de.kuschku.libquassel.util.deserialize -import de.kuschku.libquassel.util.roundTrip -import org.junit.Assert.assertEquals -import org.junit.Test -import kotlin.experimental.inv - -class ByteSerializerTest { - @Test - fun testZero() { - assertEquals(0.toByte(), roundTrip(ByteSerializer, 0.toByte())) - // @formatter:off - assertEquals(0.toByte(), deserialize(ByteSerializer, byteArrayOf(0))) - // @formatter:on - } - - @Test - fun testMinimal() { - assertEquals(Byte.MIN_VALUE, roundTrip(ByteSerializer, Byte.MIN_VALUE)) - // @formatter:off - assertEquals(Byte.MIN_VALUE, deserialize(ByteSerializer, byteArrayOf(-128))) - // @formatter:on - } - - @Test - fun testMaximal() { - assertEquals(Byte.MAX_VALUE, roundTrip(ByteSerializer, Byte.MAX_VALUE)) - // @formatter:off - assertEquals(Byte.MAX_VALUE, deserialize(ByteSerializer, byteArrayOf(127))) - // @formatter:on - } - - @Test - fun testAllOnes() { - assertEquals((0.toByte().inv()), roundTrip(ByteSerializer, (0.toByte().inv()))) - // @formatter:off - assertEquals((0.toByte().inv()), deserialize(ByteSerializer, byteArrayOf(-1))) - // @formatter:on - } -} diff --git a/lib/src/test/java/de/kuschku/libquassel/protocol/primitive/serializer/CharSerializerTest.kt b/lib/src/test/java/de/kuschku/libquassel/protocol/primitive/serializer/CharSerializerTest.kt deleted file mode 100644 index 0f6ebaa3609831881d8a18a6a439455fc997dfc3..0000000000000000000000000000000000000000 --- a/lib/src/test/java/de/kuschku/libquassel/protocol/primitive/serializer/CharSerializerTest.kt +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.libquassel.protocol.primitive.serializer - -import de.kuschku.libquassel.util.deserialize -import de.kuschku.libquassel.util.roundTrip -import org.junit.Assert.assertEquals -import org.junit.Test - -class CharSerializerTest { - @Test - fun testAll() { - assertEquals(' ', roundTrip(CharSerializer, ' ')) - // @formatter:off - assertEquals(' ', deserialize(CharSerializer, byteArrayOf(0, 32))) - // @formatter:on - - assertEquals('a', roundTrip(CharSerializer, 'a')) - // @formatter:off - assertEquals('a', deserialize(CharSerializer, byteArrayOf(0, 97))) - // @formatter:on - - assertEquals('ä', roundTrip(CharSerializer, 'ä')) - // @formatter:off - assertEquals('ä', deserialize(CharSerializer, byteArrayOf(0, -28))) - // @formatter:on - - assertEquals('\u0000', roundTrip(CharSerializer, '\u0000')) - // @formatter:off - assertEquals('\u0000', deserialize(CharSerializer, byteArrayOf(0, 0))) - // @formatter:on - - assertEquals('\uFFFF', roundTrip(CharSerializer, '\uFFFF')) - // @formatter:off - assertEquals('\uFFFF', deserialize(CharSerializer, byteArrayOf(-1, -1))) - // @formatter:on - } -} diff --git a/lib/src/test/java/de/kuschku/libquassel/protocol/primitive/serializer/DateTimeSerializerTest.kt b/lib/src/test/java/de/kuschku/libquassel/protocol/primitive/serializer/DateTimeSerializerTest.kt deleted file mode 100644 index d8cd85655fc85c0fb3029a37373f86f7c03b046a..0000000000000000000000000000000000000000 --- a/lib/src/test/java/de/kuschku/libquassel/protocol/primitive/serializer/DateTimeSerializerTest.kt +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.libquassel.protocol.primitive.serializer - -import de.kuschku.libquassel.util.deserialize -import de.kuschku.libquassel.util.roundTrip -import org.junit.Assert.assertEquals -import org.junit.Test -import org.threeten.bp.* - -class DateTimeSerializerTest { - @Test - fun testEpoch() { - val value = roundTrip(DateTimeSerializer, Instant.EPOCH) - assertEquals(Instant.EPOCH, value) - // @formatter:off - assertEquals(Instant.EPOCH, deserialize(DateTimeSerializer, byteArrayOf(0, 37, 61, -116, 0, 0, 0, 0, 2))) - // @formatter:on - } - - @Test - fun testEpochAtTimezone() { - val value = Instant.EPOCH.atOffset(ZoneOffset.ofTotalSeconds(1234)) - assertEquals(value, roundTrip(DateTimeSerializer, value)) - // @formatter:off - assertEquals(value, deserialize(DateTimeSerializer, byteArrayOf(0, 37, 61, -116, 0, 18, -44, 80, 3, 0, 0, 4, -46))) - // @formatter:on - } - - @Test - fun testEpochByCalendarAtTimezone() { - val value = LocalDateTime - .of(1970, 1, 1, 0, 0) - .atZone(ZoneId.of("Europe/Berlin")) - .toInstant() - assertEquals(value, roundTrip(DateTimeSerializer, value)) - // @formatter:off - assertEquals(value, deserialize(DateTimeSerializer, byteArrayOf(0, 37, 61, -117, 4, -17, 109, -128, 2))) - // @formatter:on - } - - @Test - fun testNormalCase() { - val value = LocalDateTime - .of(2019, Month.JANUARY, 15, 20, 25) - .atZone(ZoneId.of("Europe/Berlin")) - .toInstant() - assertEquals(value, roundTrip(DateTimeSerializer, value)) - // @formatter:off - assertEquals(value, deserialize(DateTimeSerializer, byteArrayOf(0, 37, -125, -125, 4, 42, -106, -32, 2))) - // @formatter:on - } -} diff --git a/lib/src/test/java/de/kuschku/libquassel/protocol/primitive/serializer/HostAddressSerializerTest.kt b/lib/src/test/java/de/kuschku/libquassel/protocol/primitive/serializer/HostAddressSerializerTest.kt deleted file mode 100644 index a6963e2d89bc1caddb27b944d189654c0fd7e2d5..0000000000000000000000000000000000000000 --- a/lib/src/test/java/de/kuschku/libquassel/protocol/primitive/serializer/HostAddressSerializerTest.kt +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.libquassel.protocol.primitive.serializer - -import de.kuschku.libquassel.util.deserialize -import de.kuschku.libquassel.util.roundTrip -import org.junit.Assert.assertEquals -import org.junit.Test -import java.net.InetAddress - -class HostAddressSerializerTest { - @Test - fun testIpv4() { - val address = InetAddress.getByName("176.9.136.3") - assertEquals(address, roundTrip(HostAddressSerializer, address)) - // @formatter:off - assertEquals(address, deserialize(HostAddressSerializer, byteArrayOf(0, -80, 9, -120, 3))) - // @formatter:on - } - - @Test - fun testIpv6() { - val address = InetAddress.getByName("[2a01:4f8:160:1012::2]") - assertEquals(address, roundTrip(HostAddressSerializer, address)) - // @formatter:off - assertEquals(address, deserialize(HostAddressSerializer, byteArrayOf(1, 42, 1, 4, -8, 1, 96, 16, 18, 0, 0, 0, 0, 0, 0, 0, 2))) - // @formatter:on - } -} diff --git a/lib/src/test/java/de/kuschku/libquassel/protocol/primitive/serializer/IntSerializerTest.kt b/lib/src/test/java/de/kuschku/libquassel/protocol/primitive/serializer/IntSerializerTest.kt deleted file mode 100644 index e2d3d5d426c84e91f28d4c100d08552c5bafab39..0000000000000000000000000000000000000000 --- a/lib/src/test/java/de/kuschku/libquassel/protocol/primitive/serializer/IntSerializerTest.kt +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.libquassel.protocol.primitive.serializer - -import de.kuschku.libquassel.util.deserialize -import de.kuschku.libquassel.util.roundTrip -import org.junit.Assert.assertEquals -import org.junit.Test - -class IntSerializerTest { - @Test - fun testZero() { - assertEquals(0, roundTrip(IntSerializer, 0)) - // @formatter:off - assertEquals(0, deserialize(IntSerializer, byteArrayOf(0, 0, 0, 0))) - // @formatter:on - } - - @Test - fun testMinimal() { - assertEquals(Int.MIN_VALUE, roundTrip(IntSerializer, Int.MIN_VALUE)) - // @formatter:off - assertEquals(Int.MIN_VALUE, deserialize(IntSerializer, byteArrayOf(-128, 0, 0, 0))) - // @formatter:on - } - - @Test - fun testMaximal() { - assertEquals(Int.MAX_VALUE, roundTrip(IntSerializer, Int.MAX_VALUE)) - // @formatter:off - assertEquals(Int.MAX_VALUE, deserialize(IntSerializer, byteArrayOf(127, -1, -1, -1))) - // @formatter:on - } - - @Test - fun testAllOnes() { - assertEquals(0.inv(), roundTrip(IntSerializer, 0.inv())) - // @formatter:off - assertEquals(0.inv(), deserialize(IntSerializer, byteArrayOf(-1, -1, -1, -1))) - // @formatter:on - } -} diff --git a/lib/src/test/java/de/kuschku/libquassel/protocol/primitive/serializer/LongSerializerTest.kt b/lib/src/test/java/de/kuschku/libquassel/protocol/primitive/serializer/LongSerializerTest.kt deleted file mode 100644 index dd5bf9b59cb7adc3ca50fca279f3ef55475d9b26..0000000000000000000000000000000000000000 --- a/lib/src/test/java/de/kuschku/libquassel/protocol/primitive/serializer/LongSerializerTest.kt +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.libquassel.protocol.primitive.serializer - -import de.kuschku.libquassel.util.deserialize -import de.kuschku.libquassel.util.roundTrip -import org.junit.Assert.assertEquals -import org.junit.Test - -class LongSerializerTest { - @Test - fun testZero() { - assertEquals(0L, roundTrip(LongSerializer, 0L)) - // @formatter:off - assertEquals(0L, deserialize(LongSerializer, byteArrayOf(0, 0, 0, 0, 0, 0, 0, 0))) - // @formatter:on - } - - @Test - fun testMinimal() { - assertEquals(Long.MIN_VALUE, roundTrip(LongSerializer, Long.MIN_VALUE)) - // @formatter:off - assertEquals(Long.MIN_VALUE, deserialize(LongSerializer, byteArrayOf(-128, 0, 0, 0, 0, 0, 0, 0))) - // @formatter:on - } - - @Test - fun testMaximal() { - assertEquals(Long.MAX_VALUE, roundTrip(LongSerializer, Long.MAX_VALUE)) - // @formatter:off - assertEquals(Long.MAX_VALUE, deserialize(LongSerializer, byteArrayOf(127, -1, -1, -1, -1, -1, -1, -1))) - // @formatter:on - } - - @Test - fun testAllOnes() { - assertEquals(0L.inv(), roundTrip(LongSerializer, 0L.inv())) - // @formatter:off - assertEquals(0L.inv(), deserialize(LongSerializer, byteArrayOf(-1, -1, -1, -1, -1, -1, -1, -1))) - // @formatter:on - } -} diff --git a/lib/src/test/java/de/kuschku/libquassel/protocol/primitive/serializer/MessageSerializerTest.kt b/lib/src/test/java/de/kuschku/libquassel/protocol/primitive/serializer/MessageSerializerTest.kt deleted file mode 100644 index 8ad3b0bdf8968feb34ed1a6833eb010c23e89359..0000000000000000000000000000000000000000 --- a/lib/src/test/java/de/kuschku/libquassel/protocol/primitive/serializer/MessageSerializerTest.kt +++ /dev/null @@ -1,166 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.libquassel.protocol.primitive.serializer - -import de.kuschku.libquassel.protocol.* -import de.kuschku.libquassel.quassel.BufferInfo -import de.kuschku.libquassel.quassel.QuasselFeatures -import de.kuschku.libquassel.util.deserialize -import de.kuschku.libquassel.util.roundTrip -import org.junit.Assert.assertEquals -import org.junit.Test -import org.threeten.bp.Instant - -class MessageSerializerTest { - @Test - fun testBaseCaseNoFeatures() { - val value = Message( - MsgId(-1), - Instant.EPOCH, - Message_Type.of(), - Message_Flag.of(), - BufferInfo( - BufferId(-1), - NetworkId(-1), - Buffer_Type.of(), - -1, - "" - ), - "", - "", - "", - "", - "" - ) - val other = roundTrip(MessageSerializer, value, features = QuasselFeatures.empty()) - assertEquals(value, other) - // @formatter:off - assertEquals(value, deserialize(MessageSerializer, byteArrayOf(-1, -1, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, -1, -1, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0), features = QuasselFeatures.empty())) - // @formatter:on - } - - @Test - fun testNormalNoFeatures() { - val value = Message( - MsgId(Int.MAX_VALUE.toLong()), - Instant.ofEpochMilli(1524601750000), - Message_Type.of(*Message_Type.values()), - Message_Flag.of(*Message_Flag.values()), - BufferInfo( - BufferId.MAX_VALUE, - NetworkId.MAX_VALUE, - Buffer_Type.of(*Buffer_Type.validValues), - Int.MAX_VALUE, - "äẞ\u0000\uFFFF" - ), - "äẞ\u0000\uFFFF", - "", - "", - "", - "äẞ\u0000\uFFFF" - ) - val other = roundTrip(MessageSerializer, value, features = QuasselFeatures.empty()) - assertEquals(value, other) - // @formatter:off - assertEquals(value, deserialize(MessageSerializer, byteArrayOf(127, -1, -1, -1, 90, -33, -109, -106, 0, 7, -1, -1, -113, 127, -1, -1, -1, 127, -1, -1, -1, 0, 15, 127, -1, -1, -1, 0, 0, 0, 9, -61, -92, -31, -70, -98, 0, -17, -65, -65, 0, 0, 0, 9, -61, -92, -31, -70, -98, 0, -17, -65, -65, 0, 0, 0, 9, -61, -92, -31, -70, -98, 0, -17, -65, -65), features = QuasselFeatures.empty())) - // @formatter:on - } - - @Test - fun testBaseCaseAllFeatures() { - val value = Message( - MsgId(-1), - Instant.EPOCH, - Message_Type.of(), - Message_Flag.of(), - BufferInfo( - BufferId(-1), - NetworkId(-1), - Buffer_Type.of(), - -1, - "" - ), - "", - "", - "", - "", - "" - ) - val other = roundTrip(MessageSerializer, value, features = QuasselFeatures.all()) - assertEquals(value, other) - // @formatter:off - assertEquals(value, deserialize(MessageSerializer, byteArrayOf(-1, -1, -1, -1, -1, -1, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, -1, -1, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0), features = QuasselFeatures.all())) - // @formatter:on - } - - @Test - fun testNormalAllFeatures() { - val value = Message( - MsgId.MAX_VALUE, - Instant.ofEpochMilli(1524601750000), - Message_Type.of(*Message_Type.values()), - Message_Flag.of(*Message_Flag.values()), - BufferInfo( - BufferId.MAX_VALUE, - NetworkId.MAX_VALUE, - Buffer_Type.of(*Buffer_Type.validValues), - Int.MAX_VALUE, - "äẞ\u0000\uFFFF" - ), - "äẞ\u0000\uFFFF", - "äẞ\u0000\uFFFF", - "äẞ\u0000\uFFFF", - "äẞ\u0000\uFFFF", - "äẞ\u0000\uFFFF" - ) - val other = roundTrip(MessageSerializer, value, features = QuasselFeatures.all()) - assertEquals(value, other) - // @formatter:off - assertEquals(value, deserialize(MessageSerializer, byteArrayOf(127, -1, -1, -1, -1, -1, -1, -1, 0, 0, 1, 98, -7, 88, -127, -16, 0, 7, -1, -1, -113, 127, -1, -1, -1, 127, -1, -1, -1, 0, 15, 127, -1, -1, -1, 0, 0, 0, 9, -61, -92, -31, -70, -98, 0, -17, -65, -65, 0, 0, 0, 9, -61, -92, -31, -70, -98, 0, -17, -65, -65, 0, 0, 0, 9, -61, -92, -31, -70, -98, 0, -17, -65, -65, 0, 0, 0, 9, -61, -92, -31, -70, -98, 0, -17, -65, -65, 0, 0, 0, 9, -61, -92, -31, -70, -98, 0, -17, -65, -65, 0, 0, 0, 9, -61, -92, -31, -70, -98, 0, -17, -65, -65), features = QuasselFeatures.all())) - // @formatter:on - } - - @Test - fun testExtremeAllFeatures() { - val value = Message( - MsgId.MAX_VALUE, - Instant.ofEpochMilli(Int.MAX_VALUE * 10000L), - Message_Type.of(*Message_Type.values()), - Message_Flag.of(*Message_Flag.values()), - BufferInfo( - BufferId.MAX_VALUE, - NetworkId.MAX_VALUE, - Buffer_Type.of(*Buffer_Type.validValues), - Int.MAX_VALUE, - "äẞ\u0000\uFFFF" - ), - "äẞ\u0000\uFFFF", - "äẞ\u0000\uFFFF", - "äẞ\u0000\uFFFF", - "äẞ\u0000\uFFFF", - "äẞ\u0000\uFFFF" - ) - val other = roundTrip(MessageSerializer, value, features = QuasselFeatures.all()) - assertEquals(value, other) - // @formatter:off - assertEquals(value, deserialize(MessageSerializer, byteArrayOf(127, -1, -1, -1, -1, -1, -1, -1, 0, 0, 19, -121, -1, -1, -40, -16, 0, 7, -1, -1, -113, 127, -1, -1, -1, 127, -1, -1, -1, 0, 15, 127, -1, -1, -1, 0, 0, 0, 9, -61, -92, -31, -70, -98, 0, -17, -65, -65, 0, 0, 0, 9, -61, -92, -31, -70, -98, 0, -17, -65, -65, 0, 0, 0, 9, -61, -92, -31, -70, -98, 0, -17, -65, -65, 0, 0, 0, 9, -61, -92, -31, -70, -98, 0, -17, -65, -65, 0, 0, 0, 9, -61, -92, -31, -70, -98, 0, -17, -65, -65, 0, 0, 0, 9, -61, -92, -31, -70, -98, 0, -17, -65, -65), features = QuasselFeatures.all())) - // @formatter:on - } -} diff --git a/lib/src/test/java/de/kuschku/libquassel/protocol/primitive/serializer/ProtocolInfoSerializerTest.kt b/lib/src/test/java/de/kuschku/libquassel/protocol/primitive/serializer/ProtocolInfoSerializerTest.kt deleted file mode 100644 index ff55d5dc0d23aa0213d4c384e2f997a2f3a6b447..0000000000000000000000000000000000000000 --- a/lib/src/test/java/de/kuschku/libquassel/protocol/primitive/serializer/ProtocolInfoSerializerTest.kt +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.libquassel.protocol.primitive.serializer - -import de.kuschku.libquassel.protocol.Protocol -import de.kuschku.libquassel.protocol.Protocol_Feature -import de.kuschku.libquassel.quassel.ProtocolInfo -import de.kuschku.libquassel.util.deserialize -import de.kuschku.libquassel.util.roundTrip -import org.junit.Assert.assertEquals -import org.junit.Test - -class ProtocolInfoSerializerTest { - @Test - fun testNone() { - val data = ProtocolInfo( - flags = Protocol_Feature.of(), - data = 0u, - version = 0u - ) - assertEquals(data, roundTrip(ProtocolInfoSerializer, data)) - // @formatter:off - assertEquals(data, deserialize(ProtocolInfoSerializer, byteArrayOf(0, 0, 0, 0))) - // @formatter:on - } - - @Test - fun testUsual() { - val data = ProtocolInfo( - flags = Protocol_Feature.of( - Protocol_Feature.TLS, - Protocol_Feature.Compression - ), - data = 0u, - version = Protocol.Datastream.toUByte() - ) - assertEquals(data, roundTrip(ProtocolInfoSerializer, data)) - // @formatter:off - assertEquals(data, deserialize(ProtocolInfoSerializer, byteArrayOf(3, 0, 0, 2))) - // @formatter:on - } - - @Test - fun testExtreme() { - val data = ProtocolInfo( - flags = Protocol_Feature.of( - Protocol_Feature.TLS, - Protocol_Feature.Compression - ), - data = 0xffffu, - version = 0xffu - ) - assertEquals(data, roundTrip(ProtocolInfoSerializer, data)) - // @formatter:off - assertEquals(data, deserialize(ProtocolInfoSerializer, byteArrayOf(3, -1, -1, -1))) - // @formatter:on - } -} diff --git a/lib/src/test/java/de/kuschku/libquassel/protocol/primitive/serializer/ShortSerializerTest.kt b/lib/src/test/java/de/kuschku/libquassel/protocol/primitive/serializer/ShortSerializerTest.kt deleted file mode 100644 index f72ed3aad12b72269bf0bab74b556cca77aba6c0..0000000000000000000000000000000000000000 --- a/lib/src/test/java/de/kuschku/libquassel/protocol/primitive/serializer/ShortSerializerTest.kt +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.libquassel.protocol.primitive.serializer - -import de.kuschku.libquassel.util.deserialize -import de.kuschku.libquassel.util.roundTrip -import org.junit.Assert.assertEquals -import org.junit.Test -import kotlin.experimental.inv - -class ShortSerializerTest { - @Test - fun testZero() { - assertEquals(0.toShort(), roundTrip(ShortSerializer, 0.toShort())) - // @formatter:off - assertEquals(0.toShort(), deserialize(ShortSerializer, byteArrayOf(0, 0))) - // @formatter:on - } - - @Test - fun testMinimal() { - assertEquals(Short.MIN_VALUE, roundTrip(ShortSerializer, Short.MIN_VALUE)) - // @formatter:off - assertEquals(Short.MIN_VALUE, deserialize(ShortSerializer, byteArrayOf(-128, 0))) - // @formatter:on - } - - @Test - fun testMaximal() { - assertEquals(Short.MAX_VALUE, roundTrip(ShortSerializer, Short.MAX_VALUE)) - // @formatter:off - assertEquals(Short.MAX_VALUE, deserialize(ShortSerializer, byteArrayOf(127, -1))) - // @formatter:on - } - - @Test - fun testAllOnes() { - assertEquals((0.toShort().inv()), roundTrip(ShortSerializer, (0.toShort().inv()))) - // @formatter:off - assertEquals((0.toShort().inv()), deserialize(ShortSerializer, byteArrayOf(-1, -1))) - // @formatter:on - } -} diff --git a/lib/src/test/java/de/kuschku/libquassel/protocol/primitive/serializer/StringSerializerTest.kt b/lib/src/test/java/de/kuschku/libquassel/protocol/primitive/serializer/StringSerializerTest.kt deleted file mode 100644 index 5b07c0bf5f255d2928938927a3b49579a9fe00f4..0000000000000000000000000000000000000000 --- a/lib/src/test/java/de/kuschku/libquassel/protocol/primitive/serializer/StringSerializerTest.kt +++ /dev/null @@ -1,89 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.libquassel.protocol.primitive.serializer - -import de.kuschku.libquassel.util.deserialize -import de.kuschku.libquassel.util.roundTrip -import org.hamcrest.BaseMatcher -import org.hamcrest.Description -import org.junit.Assert.assertEquals -import org.junit.Assert.assertThat -import org.junit.Test - -class StringSerializerTest { - @Test - fun testBigListOfNaughtyStrings() { - this::class.java.getResourceAsStream("/blns.txt").bufferedReader(Charsets.UTF_8).forEachLine { - // Ignore comments - if (!it.startsWith('#')) { - assertThat<String>(roundTrip(StringSerializer.UTF8, it), BomMatcher(it)) - assertThat<String>(roundTrip(StringSerializer.UTF16, it), BomMatcher(it)) - } - } - } - - @Test - fun testNaughtyStrings() { - this::class.java.getResourceAsStream("/naughty_strings.txt").bufferedReader(Charsets.UTF_8).forEachLine { - // Ignore comments - if (!it.startsWith('#')) { - assertEquals(it, roundTrip(StringSerializer.UTF8, it)) - assertEquals(it, roundTrip(StringSerializer.UTF16, it)) - } - } - } - - @Test - fun testSample() { - val value = """ - : ACHTUNG! - ALLES TURISTEN UND NONTEKNISCHEN LOOKENPEEPERS! - DAS KOMPUTERMASCHINE IST NICHT FÜR DER GEFINGERPOKEN UND MITTENGRABEN! ODERWISE IST EASY TO SCHNAPPEN DER SPRINGENWERK, BLOWENFUSEN UND POPPENCORKEN MIT SPITZENSPARKEN. - IST NICHT FÜR GEWERKEN BEI DUMMKOPFEN. DER RUBBERNECKEN SIGHTSEEREN KEEPEN DAS COTTONPICKEN HÄNDER IN DAS POCKETS MUSS. - ZO RELAXEN UND WATSCHEN DER BLINKENLICHTEN. - """.trimIndent() - - assertEquals(value, roundTrip(StringSerializer.UTF8, value)) - // @formatter:off - assertEquals(value, deserialize(StringSerializer.UTF8, byteArrayOf(0, 0, 1, -118, 58, 32, 65, 67, 72, 84, 85, 78, 71, 33, 10, 65, 76, 76, 69, 83, 32, 84, 85, 82, 73, 83, 84, 69, 78, 32, 85, 78, 68, 32, 78, 79, 78, 84, 69, 75, 78, 73, 83, 67, 72, 69, 78, 32, 76, 79, 79, 75, 69, 78, 80, 69, 69, 80, 69, 82, 83, 33, 10, 68, 65, 83, 32, 75, 79, 77, 80, 85, 84, 69, 82, 77, 65, 83, 67, 72, 73, 78, 69, 32, 73, 83, 84, 32, 78, 73, 67, 72, 84, 32, 70, -61, -100, 82, 32, 68, 69, 82, 32, 71, 69, 70, 73, 78, 71, 69, 82, 80, 79, 75, 69, 78, 32, 85, 78, 68, 32, 77, 73, 84, 84, 69, 78, 71, 82, 65, 66, 69, 78, 33, 32, 79, 68, 69, 82, 87, 73, 83, 69, 32, 73, 83, 84, 32, 69, 65, 83, 89, 32, 84, 79, 32, 83, 67, 72, 78, 65, 80, 80, 69, 78, 32, 68, 69, 82, 32, 83, 80, 82, 73, 78, 71, 69, 78, 87, 69, 82, 75, 44, 32, 66, 76, 79, 87, 69, 78, 70, 85, 83, 69, 78, 32, 85, 78, 68, 32, 80, 79, 80, 80, 69, 78, 67, 79, 82, 75, 69, 78, 32, 77, 73, 84, 32, 83, 80, 73, 84, 90, 69, 78, 83, 80, 65, 82, 75, 69, 78, 46, 10, 73, 83, 84, 32, 78, 73, 67, 72, 84, 32, 70, -61, -100, 82, 32, 71, 69, 87, 69, 82, 75, 69, 78, 32, 66, 69, 73, 32, 68, 85, 77, 77, 75, 79, 80, 70, 69, 78, 46, 32, 68, 69, 82, 32, 82, 85, 66, 66, 69, 82, 78, 69, 67, 75, 69, 78, 32, 83, 73, 71, 72, 84, 83, 69, 69, 82, 69, 78, 32, 75, 69, 69, 80, 69, 78, 32, 68, 65, 83, 32, 67, 79, 84, 84, 79, 78, 80, 73, 67, 75, 69, 78, 32, 72, -61, -124, 78, 68, 69, 82, 32, 73, 78, 32, 68, 65, 83, 32, 80, 79, 67, 75, 69, 84, 83, 32, 77, 85, 83, 83, 46, 10, 90, 79, 32, 82, 69, 76, 65, 88, 69, 78, 32, 85, 78, 68, 32, 87, 65, 84, 83, 67, 72, 69, 78, 32, 68, 69, 82, 32, 66, 76, 73, 78, 75, 69, 78, 76, 73, 67, 72, 84, 69, 78, 46))) - // @formatter:on - - assertEquals(value, roundTrip(StringSerializer.UTF16, value)) - // @formatter:off - assertEquals(value, deserialize(StringSerializer.UTF16, byteArrayOf(0, 0, 3, 14, 0, 58, 0, 32, 0, 65, 0, 67, 0, 72, 0, 84, 0, 85, 0, 78, 0, 71, 0, 33, 0, 10, 0, 65, 0, 76, 0, 76, 0, 69, 0, 83, 0, 32, 0, 84, 0, 85, 0, 82, 0, 73, 0, 83, 0, 84, 0, 69, 0, 78, 0, 32, 0, 85, 0, 78, 0, 68, 0, 32, 0, 78, 0, 79, 0, 78, 0, 84, 0, 69, 0, 75, 0, 78, 0, 73, 0, 83, 0, 67, 0, 72, 0, 69, 0, 78, 0, 32, 0, 76, 0, 79, 0, 79, 0, 75, 0, 69, 0, 78, 0, 80, 0, 69, 0, 69, 0, 80, 0, 69, 0, 82, 0, 83, 0, 33, 0, 10, 0, 68, 0, 65, 0, 83, 0, 32, 0, 75, 0, 79, 0, 77, 0, 80, 0, 85, 0, 84, 0, 69, 0, 82, 0, 77, 0, 65, 0, 83, 0, 67, 0, 72, 0, 73, 0, 78, 0, 69, 0, 32, 0, 73, 0, 83, 0, 84, 0, 32, 0, 78, 0, 73, 0, 67, 0, 72, 0, 84, 0, 32, 0, 70, 0, -36, 0, 82, 0, 32, 0, 68, 0, 69, 0, 82, 0, 32, 0, 71, 0, 69, 0, 70, 0, 73, 0, 78, 0, 71, 0, 69, 0, 82, 0, 80, 0, 79, 0, 75, 0, 69, 0, 78, 0, 32, 0, 85, 0, 78, 0, 68, 0, 32, 0, 77, 0, 73, 0, 84, 0, 84, 0, 69, 0, 78, 0, 71, 0, 82, 0, 65, 0, 66, 0, 69, 0, 78, 0, 33, 0, 32, 0, 79, 0, 68, 0, 69, 0, 82, 0, 87, 0, 73, 0, 83, 0, 69, 0, 32, 0, 73, 0, 83, 0, 84, 0, 32, 0, 69, 0, 65, 0, 83, 0, 89, 0, 32, 0, 84, 0, 79, 0, 32, 0, 83, 0, 67, 0, 72, 0, 78, 0, 65, 0, 80, 0, 80, 0, 69, 0, 78, 0, 32, 0, 68, 0, 69, 0, 82, 0, 32, 0, 83, 0, 80, 0, 82, 0, 73, 0, 78, 0, 71, 0, 69, 0, 78, 0, 87, 0, 69, 0, 82, 0, 75, 0, 44, 0, 32, 0, 66, 0, 76, 0, 79, 0, 87, 0, 69, 0, 78, 0, 70, 0, 85, 0, 83, 0, 69, 0, 78, 0, 32, 0, 85, 0, 78, 0, 68, 0, 32, 0, 80, 0, 79, 0, 80, 0, 80, 0, 69, 0, 78, 0, 67, 0, 79, 0, 82, 0, 75, 0, 69, 0, 78, 0, 32, 0, 77, 0, 73, 0, 84, 0, 32, 0, 83, 0, 80, 0, 73, 0, 84, 0, 90, 0, 69, 0, 78, 0, 83, 0, 80, 0, 65, 0, 82, 0, 75, 0, 69, 0, 78, 0, 46, 0, 10, 0, 73, 0, 83, 0, 84, 0, 32, 0, 78, 0, 73, 0, 67, 0, 72, 0, 84, 0, 32, 0, 70, 0, -36, 0, 82, 0, 32, 0, 71, 0, 69, 0, 87, 0, 69, 0, 82, 0, 75, 0, 69, 0, 78, 0, 32, 0, 66, 0, 69, 0, 73, 0, 32, 0, 68, 0, 85, 0, 77, 0, 77, 0, 75, 0, 79, 0, 80, 0, 70, 0, 69, 0, 78, 0, 46, 0, 32, 0, 68, 0, 69, 0, 82, 0, 32, 0, 82, 0, 85, 0, 66, 0, 66, 0, 69, 0, 82, 0, 78, 0, 69, 0, 67, 0, 75, 0, 69, 0, 78, 0, 32, 0, 83, 0, 73, 0, 71, 0, 72, 0, 84, 0, 83, 0, 69, 0, 69, 0, 82, 0, 69, 0, 78, 0, 32, 0, 75, 0, 69, 0, 69, 0, 80, 0, 69, 0, 78, 0, 32, 0, 68, 0, 65, 0, 83, 0, 32, 0, 67, 0, 79, 0, 84, 0, 84, 0, 79, 0, 78, 0, 80, 0, 73, 0, 67, 0, 75, 0, 69, 0, 78, 0, 32, 0, 72, 0, -60, 0, 78, 0, 68, 0, 69, 0, 82, 0, 32, 0, 73, 0, 78, 0, 32, 0, 68, 0, 65, 0, 83, 0, 32, 0, 80, 0, 79, 0, 67, 0, 75, 0, 69, 0, 84, 0, 83, 0, 32, 0, 77, 0, 85, 0, 83, 0, 83, 0, 46, 0, 10, 0, 90, 0, 79, 0, 32, 0, 82, 0, 69, 0, 76, 0, 65, 0, 88, 0, 69, 0, 78, 0, 32, 0, 85, 0, 78, 0, 68, 0, 32, 0, 87, 0, 65, 0, 84, 0, 83, 0, 67, 0, 72, 0, 69, 0, 78, 0, 32, 0, 68, 0, 69, 0, 82, 0, 32, 0, 66, 0, 76, 0, 73, 0, 78, 0, 75, 0, 69, 0, 78, 0, 76, 0, 73, 0, 67, 0, 72, 0, 84, 0, 69, 0, 78, 0, 46))) - // @formatter:on - } - - @Test - fun testAscii() { - // The simple solution: Just test all - val it = String(CharArray(256, Int::toChar).toList().shuffled().toCharArray()) - assertEquals(it, roundTrip(StringSerializer.C, it)) - } - - private class BomMatcher(private val expected: String) : BaseMatcher<String>() { - override fun describeTo(description: Description?) { - description?.appendText(expected) - } - - override fun matches(item: Any?) = - (item as? String)?.endsWith(expected.trimStart('', '')) == true - } -} diff --git a/lib/src/test/java/de/kuschku/libquassel/quassel/BufferTypeTest.kt b/lib/src/test/java/de/kuschku/libquassel/quassel/BufferTypeTest.kt deleted file mode 100644 index fa9bc86c147159e940b1829c5ef8f8854df9ecf6..0000000000000000000000000000000000000000 --- a/lib/src/test/java/de/kuschku/libquassel/quassel/BufferTypeTest.kt +++ /dev/null @@ -1,89 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.libquassel.quassel - -import de.kuschku.libquassel.protocol.Buffer_Type -import de.kuschku.libquassel.util.flag.hasFlag -import org.junit.Assert -import org.junit.Test - -class BufferTypeTest { - @Test - fun testHasFlag() { - Assert.assertTrue(Buffer_Type.of(Buffer_Type.StatusBuffer).hasFlag(Buffer_Type.StatusBuffer)) - Assert.assertFalse(Buffer_Type.of(Buffer_Type.StatusBuffer).hasFlag(Buffer_Type.QueryBuffer)) - Assert.assertFalse(Buffer_Type.of(Buffer_Type.StatusBuffer).hasFlag(Buffer_Type.ChannelBuffer)) - Assert.assertFalse(Buffer_Type.of(Buffer_Type.StatusBuffer).hasFlag(Buffer_Type.GroupBuffer)) - - Assert.assertFalse(Buffer_Type.of(Buffer_Type.QueryBuffer).hasFlag(Buffer_Type.StatusBuffer)) - Assert.assertTrue(Buffer_Type.of(Buffer_Type.QueryBuffer).hasFlag(Buffer_Type.QueryBuffer)) - Assert.assertFalse(Buffer_Type.of(Buffer_Type.QueryBuffer).hasFlag(Buffer_Type.ChannelBuffer)) - Assert.assertFalse(Buffer_Type.of(Buffer_Type.QueryBuffer).hasFlag(Buffer_Type.GroupBuffer)) - - Assert.assertFalse(Buffer_Type.of(Buffer_Type.ChannelBuffer).hasFlag(Buffer_Type.StatusBuffer)) - Assert.assertFalse(Buffer_Type.of(Buffer_Type.ChannelBuffer).hasFlag(Buffer_Type.QueryBuffer)) - Assert.assertTrue(Buffer_Type.of(Buffer_Type.ChannelBuffer).hasFlag(Buffer_Type.ChannelBuffer)) - Assert.assertFalse(Buffer_Type.of(Buffer_Type.ChannelBuffer).hasFlag(Buffer_Type.GroupBuffer)) - - Assert.assertFalse(Buffer_Type.of(Buffer_Type.GroupBuffer).hasFlag(Buffer_Type.StatusBuffer)) - Assert.assertFalse(Buffer_Type.of(Buffer_Type.GroupBuffer).hasFlag(Buffer_Type.QueryBuffer)) - Assert.assertFalse(Buffer_Type.of(Buffer_Type.GroupBuffer).hasFlag(Buffer_Type.ChannelBuffer)) - Assert.assertTrue(Buffer_Type.of(Buffer_Type.GroupBuffer).hasFlag(Buffer_Type.GroupBuffer)) - } - - @Test - fun testEnabledValues() { - Assert.assertEquals( - Buffer_Type.StatusBuffer, - Buffer_Type.of(Buffer_Type.StatusBuffer).enabledValues().firstOrNull() - ) - Assert.assertEquals( - setOf(Buffer_Type.StatusBuffer), - Buffer_Type.of(Buffer_Type.StatusBuffer).enabledValues() - ) - - Assert.assertEquals( - Buffer_Type.QueryBuffer, - Buffer_Type.of(Buffer_Type.QueryBuffer).enabledValues().firstOrNull() - ) - Assert.assertEquals( - setOf(Buffer_Type.QueryBuffer), - Buffer_Type.of(Buffer_Type.QueryBuffer).enabledValues() - ) - - Assert.assertEquals( - Buffer_Type.ChannelBuffer, - Buffer_Type.of(Buffer_Type.ChannelBuffer).enabledValues().firstOrNull() - ) - Assert.assertEquals( - setOf(Buffer_Type.ChannelBuffer), - Buffer_Type.of(Buffer_Type.ChannelBuffer).enabledValues() - ) - - Assert.assertEquals( - Buffer_Type.GroupBuffer, - Buffer_Type.of(Buffer_Type.GroupBuffer).enabledValues().firstOrNull() - ) - Assert.assertEquals( - setOf(Buffer_Type.GroupBuffer), - Buffer_Type.of(Buffer_Type.GroupBuffer).enabledValues() - ) - } -} diff --git a/lib/src/test/java/de/kuschku/libquassel/quassel/syncables/AliasManagerTest.kt b/lib/src/test/java/de/kuschku/libquassel/quassel/syncables/AliasManagerTest.kt deleted file mode 100644 index 3d2008a65f6b0ae99b576476eda5746bc72c739e..0000000000000000000000000000000000000000 --- a/lib/src/test/java/de/kuschku/libquassel/quassel/syncables/AliasManagerTest.kt +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.libquassel.quassel.syncables - -import de.kuschku.libquassel.protocol.primitive.serializer.VariantMapSerializer -import de.kuschku.libquassel.session.SignalProxy -import de.kuschku.libquassel.util.roundTrip -import org.junit.Test - -class AliasManagerTest { - @Test - fun testSerialization() { - val original = AliasManager(SignalProxy.NULL) - original.setAliasList(AliasManager.defaults()) - - val copy = original.copy() - copy.fromVariantMap(roundTrip(VariantMapSerializer, original.toVariantMap())) - assert(original.isEqual(copy)) { - System.err.println("Original:\n$original") - System.err.println("Copy:\n$copy") - } - } - - @Test - fun testCopy() { - val original = AliasManager(SignalProxy.NULL) - original.setAliasList(AliasManager.defaults()) - - val copy = original.copy() - copy.fromVariantMap(original.toVariantMap()) - assert(original.isEqual(copy)) { - System.err.println("Original:\n$original") - System.err.println("Copy:\n$copy") - } - } -} diff --git a/lib/src/test/java/de/kuschku/libquassel/quassel/syncables/BufferSyncerTest.kt b/lib/src/test/java/de/kuschku/libquassel/quassel/syncables/BufferSyncerTest.kt deleted file mode 100644 index 2a64f7c8b420d3c622cb220097366ff243582f16..0000000000000000000000000000000000000000 --- a/lib/src/test/java/de/kuschku/libquassel/quassel/syncables/BufferSyncerTest.kt +++ /dev/null @@ -1,102 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.libquassel.quassel.syncables - -import de.kuschku.libquassel.protocol.BufferId -import de.kuschku.libquassel.protocol.Message_Type -import de.kuschku.libquassel.protocol.MsgId -import de.kuschku.libquassel.protocol.primitive.serializer.VariantMapSerializer -import de.kuschku.libquassel.session.ISession -import de.kuschku.libquassel.util.roundTrip -import org.junit.Test - -class BufferSyncerTest { - @Test - fun testSerialization() { - val original = BufferSyncer(ISession.NULL) - original.setLastSeenMsg(listOf( - Pair(BufferId(1), MsgId(16)), - Pair(BufferId(2), MsgId(17)), - Pair(BufferId(3), MsgId(18)), - Pair(BufferId(4), MsgId(19)) - )) - original.setMarkerLines(listOf( - Pair(BufferId(1), MsgId(26)), - Pair(BufferId(2), MsgId(27)), - Pair(BufferId(3), MsgId(28)), - Pair(BufferId(4), MsgId(29)) - )) - original.setActivities(listOf( - Pair(BufferId(1), Message_Type.of(Message_Type.Plain)), - Pair(BufferId(2), Message_Type.of(Message_Type.Notice)), - Pair(BufferId(3), Message_Type.of(Message_Type.Action)), - Pair(BufferId(4), Message_Type.of(Message_Type.Error)) - )) - original.setHighlightCounts(listOf( - Pair(BufferId(1), 36), - Pair(BufferId(2), 37), - Pair(BufferId(3), 38), - Pair(BufferId(4), 39) - )) - - val copy = original.copy() - copy.fromVariantMap(roundTrip(VariantMapSerializer, original.toVariantMap())) - assert(original.isEqual(copy)) { - System.err.println("Original:\n$original") - System.err.println("Copy:\n$copy") - } - } - - @Test - fun testCopy() { - val original = BufferSyncer(ISession.NULL) - original.setLastSeenMsg(listOf( - Pair(BufferId(1), MsgId(16)), - Pair(BufferId(2), MsgId(17)), - Pair(BufferId(3), MsgId(18)), - Pair(BufferId(4), MsgId(19)) - )) - original.setMarkerLines(listOf( - Pair(BufferId(1), MsgId(26)), - Pair(BufferId(2), MsgId(27)), - Pair(BufferId(3), MsgId(28)), - Pair(BufferId(4), MsgId(29)) - )) - original.setActivities(listOf( - Pair(BufferId(1), Message_Type.of(Message_Type.Plain)), - Pair(BufferId(2), Message_Type.of(Message_Type.Notice)), - Pair(BufferId(3), Message_Type.of(Message_Type.Action)), - Pair(BufferId(4), Message_Type.of(Message_Type.Error)) - )) - original.setHighlightCounts(listOf( - Pair(BufferId(1), 36), - Pair(BufferId(2), 37), - Pair(BufferId(3), 38), - Pair(BufferId(4), 39) - )) - - val copy = original.copy() - copy.fromVariantMap(original.toVariantMap()) - assert(original.isEqual(copy)) { - System.err.println("Original:\n$original") - System.err.println("Copy:\n$copy") - } - } -} diff --git a/lib/src/test/java/de/kuschku/libquassel/quassel/syncables/BufferViewConfigTest.kt b/lib/src/test/java/de/kuschku/libquassel/quassel/syncables/BufferViewConfigTest.kt deleted file mode 100644 index 94eea57ffdfee235b2fbb67853ae44b448283aa0..0000000000000000000000000000000000000000 --- a/lib/src/test/java/de/kuschku/libquassel/quassel/syncables/BufferViewConfigTest.kt +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.libquassel.quassel.syncables - -import de.kuschku.libquassel.protocol.Buffer_Activity -import de.kuschku.libquassel.protocol.Buffer_Type -import de.kuschku.libquassel.protocol.NetworkId -import de.kuschku.libquassel.protocol.primitive.serializer.VariantMapSerializer -import de.kuschku.libquassel.session.SignalProxy -import de.kuschku.libquassel.util.* -import org.junit.Test - -class BufferViewConfigTest { - @Test - fun testSerialization() { - val original = BufferViewConfig(randomInt(), SignalProxy.NULL) - original.setBufferViewName(randomString()) - original.setNetworkId(NetworkId(randomInt())) - original.setAddNewBuffersAutomatically(randomBoolean()) - original.setSortAlphabetically(randomBoolean()) - original.setHideInactiveNetworks(randomBoolean()) - original.setHideInactiveNetworks(randomBoolean()) - original.setDisableDecoration(randomBoolean()) - original.setAllowedBufferTypes(Buffer_Type.of(randomOf(*Buffer_Type.validValues), - randomOf(*Buffer_Type.validValues))) - original.setMinimumActivity(randomOf(*Buffer_Activity.values()).toInt()) - original.setShowSearch(randomBoolean()) - - val copy = original.copy() - copy.fromVariantMap(roundTrip(VariantMapSerializer, original.toVariantMap())) - assert(original.isEqual(copy)) { - System.err.println("Original:\n$original") - System.err.println("Copy:\n$copy") - } - } - - @Test - fun testCopy() { - val original = BufferViewConfig(randomInt(), SignalProxy.NULL) - original.setBufferViewName(randomString()) - original.setNetworkId(NetworkId(randomInt())) - original.setAddNewBuffersAutomatically(randomBoolean()) - original.setSortAlphabetically(randomBoolean()) - original.setHideInactiveNetworks(randomBoolean()) - original.setHideInactiveNetworks(randomBoolean()) - original.setDisableDecoration(randomBoolean()) - original.setAllowedBufferTypes(Buffer_Type.of(randomOf(*Buffer_Type.validValues), - randomOf(*Buffer_Type.validValues))) - original.setMinimumActivity(randomOf(*Buffer_Activity.values()).toInt()) - original.setShowSearch(randomBoolean()) - - val copy = original.copy() - copy.fromVariantMap(original.toVariantMap()) - assert(original.isEqual(copy)) { - System.err.println("Original:\n$original") - System.err.println("Copy:\n$copy") - } - } -} diff --git a/lib/src/test/java/de/kuschku/libquassel/quassel/syncables/BufferViewManagerTest.kt b/lib/src/test/java/de/kuschku/libquassel/quassel/syncables/BufferViewManagerTest.kt deleted file mode 100644 index 258eaf969c6667366e33cf41eb263a89af1603c5..0000000000000000000000000000000000000000 --- a/lib/src/test/java/de/kuschku/libquassel/quassel/syncables/BufferViewManagerTest.kt +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.libquassel.quassel.syncables - -import de.kuschku.libquassel.protocol.primitive.serializer.VariantMapSerializer -import de.kuschku.libquassel.session.SignalProxy -import de.kuschku.libquassel.util.roundTrip -import org.junit.Test - -class BufferViewManagerTest { - @Test - fun testSerialization() { - val original = BufferViewManager(SignalProxy.NULL) - original.setBufferViewIds(listOf(-1, 0, 9999, Int.MIN_VALUE, Int.MAX_VALUE)) - - val copy = original.copy() - copy.fromVariantMap(roundTrip(VariantMapSerializer, original.toVariantMap())) - assert(original.isEqual(copy)) { - System.err.println("Original:\n$original") - System.err.println("Copy:\n$copy") - } - } - - @Test - fun testCopy() { - val original = BufferViewManager(SignalProxy.NULL) - original.setBufferViewIds(listOf(-1, 0, 9999, Int.MIN_VALUE, Int.MAX_VALUE)) - - val copy = original.copy() - copy.fromVariantMap(original.toVariantMap()) - assert(original.isEqual(copy)) { - System.err.println("Original:\n$original") - System.err.println("Copy:\n$copy") - } - } -} diff --git a/lib/src/test/java/de/kuschku/libquassel/quassel/syncables/HighlightRuleManagerTest.kt b/lib/src/test/java/de/kuschku/libquassel/quassel/syncables/HighlightRuleManagerTest.kt deleted file mode 100644 index 84dbbce94b004586108e0e0107fa5ae8e97becbd..0000000000000000000000000000000000000000 --- a/lib/src/test/java/de/kuschku/libquassel/quassel/syncables/HighlightRuleManagerTest.kt +++ /dev/null @@ -1,120 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.libquassel.quassel.syncables - -import de.kuschku.libquassel.protocol.primitive.serializer.VariantMapSerializer -import de.kuschku.libquassel.quassel.syncables.interfaces.IHighlightRuleManager -import de.kuschku.libquassel.session.SignalProxy -import de.kuschku.libquassel.util.* -import org.junit.Test - -class HighlightRuleManagerTest { - @Test - fun testSerialization() { - val original = HighlightRuleManager(SignalProxy.NULL) - original.setHighlightNick(randomOf(*IHighlightRuleManager.HighlightNickType.values()).value) - original.setNicksCaseSensitive(randomBoolean()) - original.setHighlightRuleList(listOf( - HighlightRuleManager.HighlightRule( - randomInt(), - randomString(), - randomBoolean(), - randomBoolean(), - randomBoolean(), - randomBoolean(), - randomString(), - randomString() - ), - HighlightRuleManager.HighlightRule( - randomInt(), - randomString(), - randomBoolean(), - randomBoolean(), - randomBoolean(), - randomBoolean(), - randomString(), - randomString() - ), - HighlightRuleManager.HighlightRule( - randomInt(), - randomString(), - randomBoolean(), - randomBoolean(), - randomBoolean(), - randomBoolean(), - randomString(), - randomString() - ) - )) - - val copy = original.copy() - copy.fromVariantMap(roundTrip(VariantMapSerializer, original.toVariantMap())) - assert(original.isEqual(copy)) { - System.err.println("Original:\n$original") - System.err.println("Copy:\n$copy") - } - } - - @Test - fun testCopy() { - val original = HighlightRuleManager(SignalProxy.NULL) - original.setHighlightNick(randomOf(*IHighlightRuleManager.HighlightNickType.values()).value) - original.setNicksCaseSensitive(randomBoolean()) - original.setHighlightRuleList(listOf( - HighlightRuleManager.HighlightRule( - randomInt(), - randomString(), - randomBoolean(), - randomBoolean(), - randomBoolean(), - randomBoolean(), - randomString(), - randomString() - ), - HighlightRuleManager.HighlightRule( - randomInt(), - randomString(), - randomBoolean(), - randomBoolean(), - randomBoolean(), - randomBoolean(), - randomString(), - randomString() - ), - HighlightRuleManager.HighlightRule( - randomInt(), - randomString(), - randomBoolean(), - randomBoolean(), - randomBoolean(), - randomBoolean(), - randomString(), - randomString() - ) - )) - - val copy = original.copy() - copy.fromVariantMap(original.toVariantMap()) - assert(original.isEqual(copy)) { - System.err.println("Original:\n$original") - System.err.println("Copy:\n$copy") - } - } -} diff --git a/lib/src/test/java/de/kuschku/libquassel/quassel/syncables/IdentityTest.kt b/lib/src/test/java/de/kuschku/libquassel/quassel/syncables/IdentityTest.kt deleted file mode 100644 index 93da54521606ab6bc4e2c007996d09aaf12836f8..0000000000000000000000000000000000000000 --- a/lib/src/test/java/de/kuschku/libquassel/quassel/syncables/IdentityTest.kt +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.libquassel.quassel.syncables - -import de.kuschku.libquassel.protocol.IdentityId -import de.kuschku.libquassel.protocol.primitive.serializer.VariantMapSerializer -import de.kuschku.libquassel.session.SignalProxy -import de.kuschku.libquassel.util.randomInt -import de.kuschku.libquassel.util.randomString -import de.kuschku.libquassel.util.roundTrip -import org.junit.Test - -class IdentityTest { - @Test - fun testSerialization() { - val original = Identity(SignalProxy.NULL) - original.setId(IdentityId(randomInt())) - original.setIdentityName(randomString()) - original.setRealName(randomString()) - original.setNicks(listOf( - randomString(), - randomString(), - randomString() - )) - - val copy = original.copy() - copy.fromVariantMap(roundTrip(VariantMapSerializer, original.toVariantMap())) - assert(original.isEqual(copy)) { - System.err.println("Original:\n$original") - System.err.println("Copy:\n$copy") - } - } - - @Test - fun testCopy() { - val original = Identity(SignalProxy.NULL) - original.setId(IdentityId(randomInt())) - original.setIdentityName(randomString()) - original.setRealName(randomString()) - original.setNicks(listOf( - randomString(), - randomString(), - randomString() - )) - - val copy = original.copy() - copy.fromVariantMap(original.toVariantMap()) - assert(original.isEqual(copy)) { - System.err.println("Original:\n$original") - System.err.println("Copy:\n$copy") - } - } -} diff --git a/lib/src/test/java/de/kuschku/libquassel/quassel/syncables/IgnoreListManagerTest.kt b/lib/src/test/java/de/kuschku/libquassel/quassel/syncables/IgnoreListManagerTest.kt deleted file mode 100644 index 1d4e58da4177b3750e5abd0f1f5b43b408815873..0000000000000000000000000000000000000000 --- a/lib/src/test/java/de/kuschku/libquassel/quassel/syncables/IgnoreListManagerTest.kt +++ /dev/null @@ -1,98 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.libquassel.quassel.syncables - -import de.kuschku.libquassel.protocol.primitive.serializer.VariantMapSerializer -import de.kuschku.libquassel.session.ISession -import de.kuschku.libquassel.util.randomBoolean -import de.kuschku.libquassel.util.randomOf -import de.kuschku.libquassel.util.randomString -import de.kuschku.libquassel.util.roundTrip -import org.junit.Test - -class IgnoreListManagerTest { - @Test - fun testSerialization() { - val original = IgnoreListManager(ISession.NULL) - original.setIgnoreList(listOf( - IgnoreListManager.IgnoreListItem( - type = randomOf(*IgnoreListManager.IgnoreType.values()), - ignoreRule = randomString(), - isRegEx = randomBoolean(), - strictness = randomOf(IgnoreListManager.StrictnessType.SoftStrictness, - IgnoreListManager.StrictnessType.HardStrictness), - scope = randomOf(*IgnoreListManager.ScopeType.values()), - scopeRule = randomString(), - isActive = randomBoolean() - ), - IgnoreListManager.IgnoreListItem( - type = randomOf(*IgnoreListManager.IgnoreType.values()), - ignoreRule = randomString(), - isRegEx = randomBoolean(), - strictness = randomOf(IgnoreListManager.StrictnessType.SoftStrictness, - IgnoreListManager.StrictnessType.HardStrictness), - scope = randomOf(*IgnoreListManager.ScopeType.values()), - scopeRule = randomString(), - isActive = randomBoolean() - ) - )) - - val copy = original.copy() - copy.fromVariantMap(roundTrip(VariantMapSerializer, original.toVariantMap())) - assert(original.isEqual(copy)) { - System.err.println("Original:\n$original") - System.err.println("Copy:\n$copy") - } - } - - @Test - fun testCopy() { - val original = IgnoreListManager(ISession.NULL) - original.setIgnoreList(listOf( - IgnoreListManager.IgnoreListItem( - type = randomOf(*IgnoreListManager.IgnoreType.values()), - ignoreRule = randomString(), - isRegEx = randomBoolean(), - strictness = randomOf(IgnoreListManager.StrictnessType.SoftStrictness, - IgnoreListManager.StrictnessType.HardStrictness), - scope = randomOf(*IgnoreListManager.ScopeType.values()), - scopeRule = randomString(), - isActive = randomBoolean() - ), - IgnoreListManager.IgnoreListItem( - type = randomOf(*IgnoreListManager.IgnoreType.values()), - ignoreRule = randomString(), - isRegEx = randomBoolean(), - strictness = randomOf(IgnoreListManager.StrictnessType.SoftStrictness, - IgnoreListManager.StrictnessType.HardStrictness), - scope = randomOf(*IgnoreListManager.ScopeType.values()), - scopeRule = randomString(), - isActive = randomBoolean() - ) - )) - - val copy = original.copy() - copy.fromVariantMap(original.toVariantMap()) - assert(original.isEqual(copy)) { - System.err.println("Original:\n$original") - System.err.println("Copy:\n$copy") - } - } -} diff --git a/lib/src/test/java/de/kuschku/libquassel/quassel/syncables/NetworkConfigTest.kt b/lib/src/test/java/de/kuschku/libquassel/quassel/syncables/NetworkConfigTest.kt deleted file mode 100644 index ff981a4fac1dc0bb2707432fe10dc125620ace50..0000000000000000000000000000000000000000 --- a/lib/src/test/java/de/kuschku/libquassel/quassel/syncables/NetworkConfigTest.kt +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.libquassel.quassel.syncables - -import de.kuschku.libquassel.protocol.primitive.serializer.VariantMapSerializer -import de.kuschku.libquassel.session.SignalProxy -import de.kuschku.libquassel.util.randomBoolean -import de.kuschku.libquassel.util.randomInt -import de.kuschku.libquassel.util.roundTrip -import org.junit.Test -import kotlin.math.abs - -class NetworkConfigTest { - @Test - fun testSerialization() { - val original = NetworkConfig(SignalProxy.NULL) - original.setPingTimeoutEnabled(randomBoolean()) - original.setPingInterval(abs(randomInt())) - original.setMaxPingCount(abs(randomInt())) - original.setAutoWhoEnabled(randomBoolean()) - original.setAutoWhoInterval(abs(randomInt())) - original.setAutoWhoNickLimit(abs(randomInt())) - original.setAutoWhoDelay(abs(randomInt())) - original.setStandardCtcp(randomBoolean()) - - val copy = original.copy() - copy.fromVariantMap(roundTrip(VariantMapSerializer, original.toVariantMap())) - assert(original.isEqual(copy)) { - System.err.println("Original:\n$original") - System.err.println("Copy:\n$copy") - } - } - - @Test - fun testCopy() { - val original = NetworkConfig(SignalProxy.NULL) - original.setPingTimeoutEnabled(randomBoolean()) - original.setPingInterval(abs(randomInt())) - original.setMaxPingCount(abs(randomInt())) - original.setAutoWhoEnabled(randomBoolean()) - original.setAutoWhoInterval(abs(randomInt())) - original.setAutoWhoNickLimit(abs(randomInt())) - original.setAutoWhoDelay(abs(randomInt())) - original.setStandardCtcp(randomBoolean()) - - val copy = original.copy() - copy.fromVariantMap(original.toVariantMap()) - assert(original.isEqual(copy)) { - System.err.println("Original:\n$original") - System.err.println("Copy:\n$copy") - } - } -} diff --git a/lib/src/test/java/de/kuschku/libquassel/quassel/syncables/NetworkTest.kt b/lib/src/test/java/de/kuschku/libquassel/quassel/syncables/NetworkTest.kt deleted file mode 100644 index 6487778721399ce5bdd70665d903720413a91a04..0000000000000000000000000000000000000000 --- a/lib/src/test/java/de/kuschku/libquassel/quassel/syncables/NetworkTest.kt +++ /dev/null @@ -1,307 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.libquassel.quassel.syncables - -import de.kuschku.libquassel.protocol.IdentityId -import de.kuschku.libquassel.protocol.NetworkId -import de.kuschku.libquassel.protocol.primitive.serializer.VariantMapSerializer -import de.kuschku.libquassel.quassel.syncables.interfaces.INetwork -import de.kuschku.libquassel.session.SignalProxy -import de.kuschku.libquassel.util.* -import org.junit.Test - -class NetworkTest { - @Test - fun testSerialization() { - val original = Network(NetworkId(randomInt()), SignalProxy.NULL) - original.setNetworkName(randomString()) - original.setIdentity(IdentityId(randomInt())) - original.setActualServerList(listOf( - INetwork.Server( - host = randomString(), - port = randomUInt(), - password = randomString(), - useSsl = randomBoolean(), - sslVerify = randomBoolean(), - sslVersion = randomInt(), - useProxy = randomBoolean(), - proxyType = randomOf(*INetwork.ProxyType.values()).value, - proxyHost = randomString(), - proxyPort = randomUInt(), - proxyUser = randomString(), - proxyPass = randomString() - ) - )) - original.setUseRandomServer(randomBoolean()) - original.setPerform(listOf( - randomString(), - randomString(), - randomString() - )) - original.setUseAutoIdentify(randomBoolean()) - original.setAutoIdentifyService(randomString()) - original.setAutoIdentifyPassword(randomString()) - original.setUseSasl(randomBoolean()) - original.setSaslAccount(randomString()) - original.setSaslPassword(randomString()) - original.setUseAutoReconnect(randomBoolean()) - original.setAutoReconnectInterval(randomUInt()) - original.setAutoReconnectRetries(randomUShort()) - original.setUnlimitedReconnectRetries(randomBoolean()) - original.setRejoinChannels(randomBoolean()) - original.setUseCustomMessageRate(randomBoolean()) - original.setMessageRateBurstSize(randomUInt()) - original.setMessageRateDelay(randomUInt()) - original.setUnlimitedMessageRate(randomBoolean()) - original.setCodecForServer(randomCharset().name()) - original.setCodecForEncoding(randomCharset().name()) - original.setCodecForDecoding(randomCharset().name()) - original.addSupport("AWAYLEN", "200") - original.addSupport("CALLERID", "g") - original.addSupport("CASEMAPPING", "rfc1459") - original.addSupport("CHANMODES", "IXZbegw,k,FHJLUdfjlx,ABCDKMNOPQRSTcimnprstuz") - original.addSupport("CHANNELLEN", "64") - original.addSupport("CHANTYPES", "#") - original.addSupport("CHARSET", "ascii") - original.addSupport("ELIST", "MU") - original.addSupport("ESILENCE", null) - original.addSupport("EXCEPTS", "e") - original.addSupport("EXTBAN", ",ABCNOQRSTUcjmprsz") - original.addSupport("FNC", null) - original.addSupport("INVEX", "I") - for (i in 0 until 8) { - original.newIrcUser(randomString() + "!" + randomString() + "@" + randomString()).apply { - setUser(randomString()) - setHost(randomString()) - setNick(randomString()) - setRealName(randomString()) - setAccount(randomString()) - setAway(randomBoolean()) - setAwayMessage(randomString()) - setIdleTime(randomInstant()) - setLoginTime(randomInstant()) - setServer(randomString()) - setIrcOperator(randomString()) - setLastAwayMessageTime(randomInstant()) - setWhoisServiceReply(randomString()) - setSuserHost(randomString()) - setEncrypted(randomBoolean()) - setUserModes(listOf( - randomOf(*USERMODES), - randomOf(*USERMODES), - randomOf(*USERMODES) - ).toString()) - } - } - for (i in 0 until 8) { - original.newIrcChannel(randomString(), mapOf()).apply { - setTopic(randomString()) - setPassword(randomString()) - setEncrypted(randomBoolean()) - addChannelMode(randomOf(*CHANMODES_A), randomString()) - addChannelMode(randomOf(*CHANMODES_A), randomString()) - addChannelMode(randomOf(*CHANMODES_A), randomString()) - addChannelMode(randomOf(*CHANMODES_B), randomString()) - addChannelMode(randomOf(*CHANMODES_C), randomString()) - addChannelMode(randomOf(*CHANMODES_C), randomString()) - addChannelMode(randomOf(*CHANMODES_D), null) - addChannelMode(randomOf(*CHANMODES_D), null) - addChannelMode(randomOf(*CHANMODES_D), null) - randomOf(original.ircUsers()).let { - joinIrcUser(it) - setUserModes(it, randomOf(*CHANMODES_PREFIX).toString()) - } - randomOf(original.ircUsers()).let { - joinIrcUser(it) - setUserModes(it, randomOf(*CHANMODES_PREFIX).toString()) - } - randomOf(original.ircUsers()).let { - joinIrcUser(it) - setUserModes(it, randomOf(*CHANMODES_PREFIX).toString()) - } - randomOf(original.ircUsers()).let { - joinIrcUser(it) - setUserModes(it, randomOf(*CHANMODES_PREFIX).toString()) - } - randomOf(original.ircUsers()).let { - joinIrcUser(it) - setUserModes(it, randomOf(*CHANMODES_PREFIX).toString()) - } - } - } - - val copy = original.copy() - copy.fromVariantMap(roundTrip(VariantMapSerializer, original.toVariantMap())) - assert(original.isEqual(copy)) { - System.err.println("Original:\n$original") - System.err.println("Copy:\n$copy") - } - } - - @Test - fun testCopy() { - val original = Network(NetworkId(randomInt()), SignalProxy.NULL) - original.setNetworkName(randomString()) - original.setIdentity(IdentityId(randomInt())) - original.setActualServerList(listOf( - INetwork.Server( - host = randomString(), - port = randomUInt(), - password = randomString(), - useSsl = randomBoolean(), - sslVerify = randomBoolean(), - sslVersion = randomInt(), - useProxy = randomBoolean(), - proxyType = randomOf(*INetwork.ProxyType.values()).value, - proxyHost = randomString(), - proxyPort = randomUInt(), - proxyUser = randomString(), - proxyPass = randomString() - ) - )) - original.setUseRandomServer(randomBoolean()) - original.setPerform(listOf( - randomString(), - randomString(), - randomString() - )) - original.setUseAutoIdentify(randomBoolean()) - original.setAutoIdentifyService(randomString()) - original.setAutoIdentifyPassword(randomString()) - original.setUseSasl(randomBoolean()) - original.setSaslAccount(randomString()) - original.setSaslPassword(randomString()) - original.setUseAutoReconnect(randomBoolean()) - original.setAutoReconnectInterval(randomUInt()) - original.setAutoReconnectRetries(randomUShort()) - original.setUnlimitedReconnectRetries(randomBoolean()) - original.setRejoinChannels(randomBoolean()) - original.setUseCustomMessageRate(randomBoolean()) - original.setMessageRateBurstSize(randomUInt()) - original.setMessageRateDelay(randomUInt()) - original.setUnlimitedMessageRate(randomBoolean()) - original.setCodecForServer(randomCharset().name()) - original.setCodecForEncoding(randomCharset().name()) - original.setCodecForDecoding(randomCharset().name()) - original.addSupport("AWAYLEN", "200") - original.addSupport("CALLERID", "g") - original.addSupport("CASEMAPPING", "rfc1459") - original.addSupport("CHANMODES", "IXZbegw,k,FHJLUdfjlx,ABCDKMNOPQRSTcimnprstuz") - original.addSupport("CHANNELLEN", "64") - original.addSupport("CHANTYPES", "#") - original.addSupport("CHARSET", "ascii") - original.addSupport("ELIST", "MU") - original.addSupport("ESILENCE", null) - original.addSupport("EXCEPTS", "e") - original.addSupport("EXTBAN", ",ABCNOQRSTUcjmprsz") - original.addSupport("FNC", null) - original.addSupport("INVEX", "I") - for (i in 0 until 8) { - original.newIrcUser(randomString() + "!" + randomString() + "@" + randomString()).apply { - setUser(randomString()) - setHost(randomString()) - setNick(randomString()) - setRealName(randomString()) - setAccount(randomString()) - setAway(randomBoolean()) - setAwayMessage(randomString()) - setIdleTime(randomInstant()) - setLoginTime(randomInstant()) - setServer(randomString()) - setIrcOperator(randomString()) - setLastAwayMessageTime(randomInstant()) - setWhoisServiceReply(randomString()) - setSuserHost(randomString()) - setEncrypted(randomBoolean()) - setUserModes(listOf( - randomOf(*USERMODES), - randomOf(*USERMODES), - randomOf(*USERMODES) - ).toString()) - } - } - for (i in 0 until 8) { - original.newIrcChannel(randomString(), mapOf()).apply { - setTopic(randomString()) - setPassword(randomString()) - setEncrypted(randomBoolean()) - addChannelMode(randomOf(*CHANMODES_A), randomString()) - addChannelMode(randomOf(*CHANMODES_A), randomString()) - addChannelMode(randomOf(*CHANMODES_A), randomString()) - addChannelMode(randomOf(*CHANMODES_B), randomString()) - addChannelMode(randomOf(*CHANMODES_C), randomString()) - addChannelMode(randomOf(*CHANMODES_C), randomString()) - addChannelMode(randomOf(*CHANMODES_D), null) - addChannelMode(randomOf(*CHANMODES_D), null) - addChannelMode(randomOf(*CHANMODES_D), null) - randomOf(original.ircUsers()).let { - joinIrcUser(it) - setUserModes(it, randomOf(*CHANMODES_PREFIX).toString()) - } - randomOf(original.ircUsers()).let { - joinIrcUser(it) - setUserModes(it, randomOf(*CHANMODES_PREFIX).toString()) - } - randomOf(original.ircUsers()).let { - joinIrcUser(it) - setUserModes(it, randomOf(*CHANMODES_PREFIX).toString()) - } - randomOf(original.ircUsers()).let { - joinIrcUser(it) - setUserModes(it, randomOf(*CHANMODES_PREFIX).toString()) - } - randomOf(original.ircUsers()).let { - joinIrcUser(it) - setUserModes(it, randomOf(*CHANMODES_PREFIX).toString()) - } - } - } - - val copy = original.copy() - copy.fromVariantMap(original.toVariantMap()) - assert(original.isEqual(copy)) { - System.err.println("Original:\n$original") - System.err.println("Copy:\n$copy") - } - } - - companion object { - private val USERMODES = arrayOf( - 'B', 'H', 'I', 'L', 'O', 'R', 'S', 'T', 'W', 'c', 'd', 'g', 'h', 'i', 'k', 'o', 'r', 's', 'w', - 'x' - ) - private val CHANMODES_PREFIX = arrayOf( - 'Y', 'o', 'h', 'v' - ) - private val CHANMODES_A = arrayOf( - 'I', 'X', 'Z', 'b', 'e', 'g', 'w' - ) - private val CHANMODES_B = arrayOf( - 'k' - ) - private val CHANMODES_C = arrayOf( - 'F', 'H', 'J', 'L', 'U', 'd', 'f', 'j', 'l', 'x' - ) - private val CHANMODES_D = arrayOf( - 'A', 'B', 'C', 'D', 'K', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'c', 'i', 'm', 'n', 'p', 'r', - 's', 't', 'u', 'z' - ) - } -} diff --git a/lib/src/test/java/de/kuschku/libquassel/quassel/syncables/interfaces/INetworkInfoTest.kt b/lib/src/test/java/de/kuschku/libquassel/quassel/syncables/interfaces/INetworkInfoTest.kt deleted file mode 100644 index 517f8239663560e538cba4a5cfcdc8714c6aa245..0000000000000000000000000000000000000000 --- a/lib/src/test/java/de/kuschku/libquassel/quassel/syncables/interfaces/INetworkInfoTest.kt +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.libquassel.quassel.syncables.interfaces - -import de.kuschku.libquassel.protocol.IdentityId -import de.kuschku.libquassel.protocol.primitive.serializer.VariantMapSerializer -import de.kuschku.libquassel.quassel.syncables.interfaces.INetwork.PortDefaults.PORT_PLAINTEXT -import de.kuschku.libquassel.util.roundTrip -import org.junit.Assert.assertEquals -import org.junit.Test - -class INetworkInfoTest { - @Test - fun testSerialization() { - val original = INetwork.NetworkInfo( - networkName = "QuakeNet", - identity = IdentityId(5), - serverList = listOf( - INetwork.Server( - host = "irc.quakenet.org", - port = PORT_PLAINTEXT.port - ) - ) - ) - val copy = original.copy() - copy.fromVariantMap(roundTrip(VariantMapSerializer, original.toVariantMap())) - assertEquals(original, copy) - } - - @Test - fun testCopy() { - val original = INetwork.NetworkInfo( - networkName = "QuakeNet", - identity = IdentityId(5), - serverList = listOf( - INetwork.Server( - host = "irc.quakenet.org", - port = PORT_PLAINTEXT.port - ) - ) - ) - val copy = original.copy() - copy.fromVariantMap(original.toVariantMap()) - assertEquals(original, copy) - } -} diff --git a/lib/src/test/java/de/kuschku/libquassel/util/ExpressionMatchTest.kt b/lib/src/test/java/de/kuschku/libquassel/util/ExpressionMatchTest.kt deleted file mode 100644 index 86aba750fbec3dbba4d889353ef0ab852ee14b81..0000000000000000000000000000000000000000 --- a/lib/src/test/java/de/kuschku/libquassel/util/ExpressionMatchTest.kt +++ /dev/null @@ -1,472 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.libquassel.util - -import org.junit.Assert.* -import org.junit.Test - -class ExpressionMatchTest { - @Test - fun testEmptyPattern() { - // Empty pattern - val emptyMatch = ExpressionMatch("", ExpressionMatch.MatchMode.MatchPhrase, false) - - // Assert empty is valid - assertTrue(emptyMatch.isValid()) - // Assert empty - assertTrue(emptyMatch.isEmpty()) - // Assert default match fails (same as setting match empty to false) - assertFalse(emptyMatch.match("something")) - // Assert match empty succeeds - assertTrue(emptyMatch.match("something", true)) - } - - @Test - fun testMatchPhrase() { - // Simple phrase, case-insensitive - val simpleMatch = ExpressionMatch("test", ExpressionMatch.MatchMode.MatchPhrase, false) - // Simple phrase, case-sensitive - val simpleMatchCS = ExpressionMatch("test", ExpressionMatch.MatchMode.MatchPhrase, true) - // Phrase with space, case-insensitive - val simpleMatchSpace = ExpressionMatch(" space ", ExpressionMatch.MatchMode.MatchPhrase, true) - // Complex phrase - val complexMatchFull = """^(?:norm|norm\-space|\!norm\-escaped|\\\!slash\-invert|\\\\double|escape\;sep|slash\-end\-split\\|quad\\\\\!noninvert|newline\-split|newline\-split\-slash\\|slash\-at\-end\\)$""" - val complexMatch = ExpressionMatch(complexMatchFull, - ExpressionMatch.MatchMode.MatchPhrase, - false) - - // Assert valid and not empty - assertTrue(simpleMatch.isValid()) - assertFalse(simpleMatch.isEmpty()) - assertTrue(simpleMatchCS.isValid()) - assertFalse(simpleMatchCS.isEmpty()) - assertTrue(simpleMatchSpace.isValid()) - assertFalse(simpleMatchSpace.isEmpty()) - assertTrue(complexMatch.isValid()) - assertFalse(complexMatch.isEmpty()) - - // Assert match succeeds - assertTrue(simpleMatch.match("test")) - assertTrue(simpleMatch.match("other test;")) - assertTrue(simpleMatchSpace.match(" space ")) - // Assert partial match fails - assertFalse(simpleMatch.match("testing")) - assertFalse(simpleMatchSpace.match("space")) - // Assert unrelated fails - assertFalse(simpleMatch.match("not above")) - - // Assert case sensitivity followed - assertFalse(simpleMatch.sourceCaseSensitive) - assertTrue(simpleMatch.match("TeSt")) - assertTrue(simpleMatchCS.sourceCaseSensitive) - assertFalse(simpleMatchCS.match("TeSt")) - - // Assert complex phrases are escaped properly - assertTrue(complexMatch.match(complexMatchFull)) - assertFalse(complexMatch.match("norm")) - } - - @Test - fun matchMultiPhrase() { - // Simple phrases, case-insensitive - val simpleMatch = ExpressionMatch("test\nOther ", - ExpressionMatch.MatchMode.MatchMultiPhrase, - false) - // Simple phrases, case-sensitive - val simpleMatchCS = ExpressionMatch("test\nOther ", - ExpressionMatch.MatchMode.MatchMultiPhrase, - true) - // Complex phrases - val complexMatchFullA = """^(?:norm|norm\-space|\!norm\-escaped|\\\!slash\-invert|\\\\double)|escape\;sep|slash\-end\-split\\|quad\\\\\!noninvert)|newline\-split|newline\-split\-slash\\|slash\-at\-end\\)$""" - val complexMatchFullB = """^(?:invert|invert\-space)$)$""" - val complexMatch = ExpressionMatch(complexMatchFullA + "\n" + complexMatchFullB, - ExpressionMatch.MatchMode.MatchMultiPhrase, - false) - - // Assert valid and not empty - assertTrue(simpleMatch.isValid()) - assertFalse(simpleMatch.isEmpty()) - assertTrue(simpleMatchCS.isValid()) - assertFalse(simpleMatchCS.isEmpty()) - assertTrue(complexMatch.isValid()) - assertFalse(complexMatch.isEmpty()) - - // Assert match succeeds - assertTrue(simpleMatch.match("test")) - assertTrue(simpleMatch.match("test[suffix]")) - assertTrue(simpleMatch.match("other test;")) - assertTrue(simpleMatch.match("Other ")) - assertTrue(simpleMatch.match(".Other !")) - // Assert partial match fails - assertFalse(simpleMatch.match("testing")) - assertFalse(simpleMatch.match("Other!")) - // Assert unrelated fails - assertFalse(simpleMatch.match("not above")) - - // Assert case sensitivity followed - assertFalse(simpleMatch.sourceCaseSensitive) - assertTrue(simpleMatch.match("TeSt")) - assertTrue(simpleMatchCS.sourceCaseSensitive) - assertFalse(simpleMatchCS.match("TeSt")) - - // Assert complex phrases are escaped properly - assertTrue(complexMatch.match(complexMatchFullA)) - assertTrue(complexMatch.match(complexMatchFullB)) - assertFalse(complexMatch.match("norm")) - assertFalse(complexMatch.match("invert")) - } - - @Test - fun matchWildcard() { - // Simple wildcard, case-insensitive - val simpleMatch = - ExpressionMatch("?test*", ExpressionMatch.MatchMode.MatchWildcard, false) - // Simple wildcard, case-sensitive - val simpleMatchCS = - ExpressionMatch("?test*", ExpressionMatch.MatchMode.MatchWildcard, true) - // Escaped wildcard, case-insensitive - val simpleMatchEscape = - ExpressionMatch("""\?test\*""", ExpressionMatch.MatchMode.MatchWildcard, false) - // Inverted wildcard, case-insensitive - val simpleMatchInvert = - ExpressionMatch("!test*", ExpressionMatch.MatchMode.MatchWildcard, false) - // Not inverted wildcard, case-insensitive - val simpleMatchNoInvert = - ExpressionMatch("""\!test*""", ExpressionMatch.MatchMode.MatchWildcard, false) - // Not inverted wildcard literal slash, case-insensitive - val simpleMatchNoInvertSlash = - ExpressionMatch("""\\!test*""", ExpressionMatch.MatchMode.MatchWildcard, false) - // Complex wildcard - val complexMatch = - ExpressionMatch("""never?gonna*give\*you\?up\\test|y\yeah\\1\\\\2\\\1inval""", - ExpressionMatch.MatchMode.MatchWildcard, false) - - // Assert valid and not empty - assertTrue(simpleMatch.isValid()) - assertFalse(simpleMatch.isEmpty()) - assertTrue(simpleMatchCS.isValid()) - assertFalse(simpleMatchCS.isEmpty()) - assertTrue(simpleMatchEscape.isValid()) - assertFalse(simpleMatchEscape.isEmpty()) - assertTrue(simpleMatchInvert.isValid()) - assertFalse(simpleMatchInvert.isEmpty()) - assertTrue(simpleMatchNoInvert.isValid()) - assertFalse(simpleMatchNoInvert.isEmpty()) - assertTrue(simpleMatchNoInvertSlash.isValid()) - assertFalse(simpleMatchNoInvertSlash.isEmpty()) - assertTrue(complexMatch.isValid()) - assertFalse(complexMatch.isEmpty()) - - // Assert match succeeds - assertTrue(simpleMatch.match("@test")) - assertTrue(simpleMatch.match("@testing")) - assertTrue(simpleMatch.match("!test")) - assertTrue(simpleMatchEscape.match("?test*")) - assertTrue(simpleMatchInvert.match("atest")) - assertTrue(simpleMatchNoInvert.match("!test")) - assertTrue(simpleMatchNoInvertSlash.match("""\!test)""")) - // Assert partial match fails - assertFalse(simpleMatch.match("test")) - // Assert unrelated fails - assertFalse(simpleMatch.match("not above")) - // Assert escaped wildcard fails - assertFalse(simpleMatchEscape.match("@testing")) - assertFalse(simpleMatchNoInvert.match("test")) - assertFalse(simpleMatchNoInvert.match("anything")) - assertFalse(simpleMatchNoInvertSlash.match("!test")) - assertFalse(simpleMatchNoInvertSlash.match("test")) - assertFalse(simpleMatchNoInvertSlash.match("anything")) - // Assert non-inverted fails - assertFalse(simpleMatchInvert.match("testing")) - - // Assert case sensitivity followed - assertFalse(simpleMatch.sourceCaseSensitive) - assertTrue(simpleMatch.match("@TeSt")) - assertTrue(simpleMatchCS.sourceCaseSensitive) - assertFalse(simpleMatchCS.match("@TeSt")) - - // Assert complex match - assertTrue(complexMatch.match("""neverAgonnaBBBgive*you?up\test|yyeah\1\\2\1inval""")) - // Assert complex not literal match - assertFalse(complexMatch.match("""never?gonna*give\*you\?up\\test|y\yeah\\1\\\\2\\\1inval""")) - // Assert complex unrelated not match - assertFalse(complexMatch.match("other")) - } - - @Test - fun matchMultiWildcard() { - // Simple wildcards, case-insensitive - val simpleMatch = - ExpressionMatch("?test*;another?", - ExpressionMatch.MatchMode.MatchMultiWildcard, false) - // Simple wildcards, case-sensitive - val simpleMatchCS = - ExpressionMatch("?test*;another?", - ExpressionMatch.MatchMode.MatchMultiWildcard, true) - // Escaped wildcards, case-insensitive - val simpleMatchEscape = - ExpressionMatch("""\?test\*\;*thing\*""", - ExpressionMatch.MatchMode.MatchMultiWildcard, false) - // Inverted wildcards, case-insensitive - val simpleMatchInvert = - ExpressionMatch("""test*;!testing""", - ExpressionMatch.MatchMode.MatchMultiWildcard, false) - // Implicit wildcards, case-insensitive - val simpleMatchImplicit = - ExpressionMatch("""!testing*""", - ExpressionMatch.MatchMode.MatchMultiWildcard, false) - // Complex wildcard - val complexMatchFull = """norm;!invert; norm-space ; !invert-space ;;!;\!norm-escaped;""" + - """\\!slash-invert;\\\\double; escape\;sep;slash-end-split\\;""" + - """quad\\\\!noninvert;newline-split""" + "\n" + - """newline-split-slash\\""" + "\n" + - """slash-at-end\\""" - - // Match normal components - val complexMatchNormal = listOf( - """norm""", - """norm-space""", - """!norm-escaped""", - """\!slash-invert""", - """\\double""", - """escape;sep""", - """slash-end-split\""", - """quad\\!noninvert""", - """newline-split""", - """newline-split-slash\""", - """slash-at-end\""" - ) - // Match negating components - val complexMatchInvert = listOf( - """invert""", - """invert-space""" - ) - val complexMatch = - ExpressionMatch(complexMatchFull, ExpressionMatch.MatchMode.MatchMultiWildcard, - false) - - // Assert valid and not empty - assertTrue(simpleMatch.isValid()) - assertFalse(simpleMatch.isEmpty()) - assertTrue(simpleMatchCS.isValid()) - assertFalse(simpleMatchCS.isEmpty()) - assertTrue(simpleMatchEscape.isValid()) - assertFalse(simpleMatchEscape.isEmpty()) - assertTrue(simpleMatchInvert.isValid()) - assertFalse(simpleMatchInvert.isEmpty()) - assertTrue(simpleMatchImplicit.isValid()) - assertFalse(simpleMatchImplicit.isEmpty()) - assertTrue(complexMatch.isValid()) - assertFalse(complexMatch.isEmpty()) - - // Assert match succeeds - assertTrue(simpleMatch.match("@test")) - assertTrue(simpleMatch.match("@testing")) - assertTrue(simpleMatch.match("!test")) - assertTrue(simpleMatch.match("anotherA")) - assertTrue(simpleMatchEscape.match("?test*;thing*")) - assertTrue(simpleMatchEscape.match("?test*;AAAAAthing*")) - assertTrue(simpleMatchInvert.match("test")) - assertTrue(simpleMatchInvert.match("testing things")) - // Assert implicit wildcard succeeds - assertTrue(simpleMatchImplicit.match("AAAAAA")) - // Assert partial match fails - assertFalse(simpleMatch.match("test")) - assertFalse(simpleMatch.match("another")) - assertFalse(simpleMatch.match("anotherBB")) - // Assert unrelated fails - assertFalse(simpleMatch.match("not above")) - // Assert escaped wildcard fails - assertFalse(simpleMatchEscape.match("@testing")) - // Assert inverted match fails - assertFalse(simpleMatchInvert.match("testing")) - assertFalse(simpleMatchImplicit.match("testing")) - - // Assert case sensitivity followed - assertFalse(simpleMatch.sourceCaseSensitive) - assertTrue(simpleMatch.match("@TeSt")) - assertTrue(simpleMatchCS.sourceCaseSensitive) - assertFalse(simpleMatchCS.match("@TeSt")) - - // Assert complex match - for (normMatch in complexMatchNormal) { - // Each normal component should match - assertTrue(complexMatch.match(normMatch)) - } - - for (invertMatch in complexMatchInvert) { - // Each invert component should not match - assertFalse(complexMatch.match(invertMatch)) - } - - // Assert complex not literal match - assertFalse(complexMatch.match(complexMatchFull)) - // Assert complex unrelated not match - assertFalse(complexMatch.match("other")) - } - - @Test - fun matchRegEx() { - // Simple regex, case-insensitive - val simpleMatch = - ExpressionMatch("""simple.\*escape-match.*""", - ExpressionMatch.MatchMode.MatchRegEx, false) - // Simple regex, case-sensitive - val simpleMatchCS = - ExpressionMatch("""simple.\*escape-match.*""", - ExpressionMatch.MatchMode.MatchRegEx, true) - // Inverted regex, case-insensitive - val simpleMatchInvert = - ExpressionMatch("""!invert.\*escape-match.*""", - ExpressionMatch.MatchMode.MatchRegEx, false) - // Non-inverted regex, case-insensitive - val simpleMatchNoInvert = - ExpressionMatch("""\!simple.\*escape-match.*""", - ExpressionMatch.MatchMode.MatchRegEx, false) - // Non-inverted regex literal slash, case-insensitive - val simpleMatchNoInvertSlash = - ExpressionMatch("""\\!simple.\*escape-match.*""", - ExpressionMatch.MatchMode.MatchRegEx, false) - - // Assert valid and not empty - assertTrue(simpleMatch.isValid()) - assertFalse(simpleMatch.isEmpty()) - assertTrue(simpleMatchCS.isValid()) - assertFalse(simpleMatchCS.isEmpty()) - assertTrue(simpleMatchInvert.isValid()) - assertFalse(simpleMatchInvert.isEmpty()) - assertTrue(simpleMatchNoInvert.isValid()) - assertFalse(simpleMatchNoInvert.isEmpty()) - assertTrue(simpleMatchNoInvertSlash.isValid()) - assertFalse(simpleMatchNoInvertSlash.isEmpty()) - - // Assert match succeeds - assertTrue(simpleMatch.match("simpleA*escape-match")) - assertTrue(simpleMatch.match("simpleA*escape-matchBBBB")) - assertTrue(simpleMatchInvert.match("not above")) - assertTrue(simpleMatchNoInvert.match("!simpleA*escape-matchBBBB")) - assertTrue(simpleMatchNoInvertSlash.match("""\!simpleA*escape-matchBBBB""")) - // Assert partial match fails - assertFalse(simpleMatch.match("simpleA*escape-mat")) - assertFalse(simpleMatch.match("simple*escape-match")) - // Assert unrelated fails - assertFalse(simpleMatch.match("not above")) - // Assert escaped wildcard fails - assertFalse(simpleMatch.match("simpleABBBBescape-matchBBBB")) - // Assert inverted fails - assertFalse(simpleMatchInvert.match("invertA*escape-match")) - assertFalse(simpleMatchInvert.match("invertA*escape-matchBBBB")) - assertFalse(simpleMatchNoInvert.match("simpleA*escape-matchBBBB")) - assertFalse(simpleMatchNoInvert.match("anything")) - assertFalse(simpleMatchNoInvertSlash.match("!simpleA*escape-matchBBBB")) - assertFalse(simpleMatchNoInvertSlash.match("anything")) - - // Assert case sensitivity followed - assertFalse(simpleMatch.sourceCaseSensitive) - assertTrue(simpleMatch.match("SiMpLEA*escape-MATCH")) - assertTrue(simpleMatchCS.sourceCaseSensitive) - assertFalse(simpleMatchCS.match("SiMpLEA*escape-MATCH")) - } - - @Test - fun trimMultiWildcardWhitespace() { - // Patterns - val patterns = listOf( - // Literal - Pair("literal", - "literal"), - // Simple semicolon cleanup - Pair("simple1 ;simple2; simple3 ", - "simple1; simple2; simple3"), - // Simple newline cleanup - Pair("simple1 \nsimple2\n simple3 ", - "simple1\nsimple2\nsimple3"), - // Complex cleanup - Pair( - """norm; norm-space ; newline-space """ + "\n" + - """ ;escape \; sep ; slash-end-split\\; quad\\\\norm; newline-split-slash\\""" + "\n" + - """slash-at-end\\""", - """norm; norm-space; newline-space""" + "\n" + - """escape \; sep; slash-end-split\\; quad\\\\norm; newline-split-slash\\""" + "\n" + - """slash-at-end\\""" - ) - ) - - // Check every source string... - for (patternPair in patterns) { - // Run transformation - val result = ExpressionMatch.trimMultiWildcardWhitespace(patternPair.first) - // Assert that source trims into expected pattern - assertEquals(patternPair.second, result) - // Assert that re-trimming expected pattern gives the same result - assertEquals(ExpressionMatch.trimMultiWildcardWhitespace(result), result) - } - } - - @Test - fun testInvalid() { - val invalidRegex = ExpressionMatch("*network", ExpressionMatch.MatchMode.MatchRegEx, false) - assertFalse(invalidRegex.isValid()) - assertFalse(invalidRegex.match("")) - assertFalse(invalidRegex.match("network")) - assertFalse(invalidRegex.match("testnetwork")) - } - - // Tests imported from https://github.com/ircdocs/parser-tests/blob/master/tests/mask-match.yaml - @Test - fun testDan() { - val mask1 = ExpressionMatch("*@127.0.0.1", - ExpressionMatch.MatchMode.MatchWildcard, - caseSensitive = false) - assertTrue(mask1.match("coolguy!ab@127.0.0.1")) - assertTrue(mask1.match("cooldud3!~bc@127.0.0.1")) - assertFalse(mask1.match("coolguy!ab@127.0.0.5")) - assertFalse(mask1.match("cooldud3!~d@124.0.0.1")) - - val mask2 = ExpressionMatch("cool*@*", - ExpressionMatch.MatchMode.MatchWildcard, - caseSensitive = false) - assertTrue(mask2.match("coolguy!ab@127.0.0.1")) - assertTrue(mask2.match("cooldud3!~bc@127.0.0.1")) - assertTrue(mask2.match("cool132!ab@example.com")) - assertFalse(mask2.match("koolguy!ab@127.0.0.5")) - assertFalse(mask2.match("cooodud3!~d@124.0.0.1")) - - val mask3 = ExpressionMatch("cool!*@*", - ExpressionMatch.MatchMode.MatchWildcard, - caseSensitive = false) - assertTrue(mask3.match("cool!guyab@127.0.0.1")) - assertTrue(mask3.match("cool!~dudebc@127.0.0.1")) - assertTrue(mask3.match("cool!312ab@example.com")) - assertFalse(mask3.match("coolguy!ab@127.0.0.1")) - assertFalse(mask3.match("cooldud3!~bc@127.0.0.1")) - assertFalse(mask3.match("koolguy!ab@127.0.0.5")) - assertFalse(mask3.match("cooodud3!~d@124.0.0.1")) - - // Cause failures in fnmatch/glob based matchers - val mask4 = ExpressionMatch("cool[guy]!*@*", - ExpressionMatch.MatchMode.MatchWildcard, - caseSensitive = false) - assertTrue(mask4.match("cool[guy]!guy@127.0.0.1")) - assertTrue(mask4.match("cool[guy]!a@example.com")) - assertFalse(mask4.match("coolg!ab@127.0.0.1")) - assertFalse(mask4.match("cool[!ac@127.0.1.1")) - } -} diff --git a/lib/src/test/java/de/kuschku/libquassel/util/RandomHelpers.kt b/lib/src/test/java/de/kuschku/libquassel/util/RandomHelpers.kt deleted file mode 100644 index 6cd8e06d65a1e3575ff115110d7e7891cce9fc05..0000000000000000000000000000000000000000 --- a/lib/src/test/java/de/kuschku/libquassel/util/RandomHelpers.kt +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.libquassel.util - -import org.threeten.bp.Instant -import java.nio.charset.Charset -import java.util.* - -private val random = Random() - -fun Any?.randomBoolean(): Boolean = random.nextBoolean() - -fun Any?.randomByte(): Byte = random.nextInt().toByte() -fun Any?.randomUByte(): UByte = random.nextInt().toUByte() - -fun Any?.randomShort(): Short = random.nextInt().toShort() -fun Any?.randomUShort(): UShort = random.nextInt().toUShort() - -fun Any?.randomInt(): Int = random.nextInt() -fun Any?.randomUInt(): UInt = random.nextInt().toUInt() - -fun Any?.randomLong(): Long = random.nextLong() -fun Any?.randomULong(): ULong = random.nextLong().toULong() - -fun Any?.randomString(): String = UUID.randomUUID().toString() - -fun Any?.randomInstant(): Instant = Instant.ofEpochMilli(randomLong()) - -fun <T> Any?.randomOf(vararg elements: T): T = elements[random.nextInt(elements.size)] -fun <T> Any?.randomOf(elements: List<T>): T = elements[random.nextInt(elements.size)] - -fun Any?.randomCharset(): Charset = randomOf(*Charset.availableCharsets().values.toTypedArray()) diff --git a/lib/src/test/java/de/kuschku/libquassel/util/SerializerHelpers.kt b/lib/src/test/java/de/kuschku/libquassel/util/SerializerHelpers.kt deleted file mode 100644 index 39bc4d43dfe3854e96cfce9c2614c45cd120ac2e..0000000000000000000000000000000000000000 --- a/lib/src/test/java/de/kuschku/libquassel/util/SerializerHelpers.kt +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.libquassel.util - -import de.kuschku.libquassel.protocol.primitive.serializer.Serializer -import de.kuschku.libquassel.quassel.QuasselFeatures -import de.kuschku.libquassel.util.nio.ChainedByteBuffer -import java.nio.ByteBuffer - -fun <T> roundTrip(serializer: Serializer<T>, value: T, - features: QuasselFeatures = QuasselFeatures.all()): T { - val chainedBuffer = ChainedByteBuffer( - direct = false - ) - serializer.serialize(chainedBuffer, value, features) - val buffer = chainedBuffer.toBuffer() - return serializer.deserialize(buffer, features) -} - -fun <T> deserialize(serializer: Serializer<T>, values: ByteArray, - features: QuasselFeatures = QuasselFeatures.all()): T { - return serializer.deserialize(ByteBuffer.wrap(byteArrayOf(*values)), features) -} diff --git a/lib/src/test/java/de/kuschku/libquassel/util/SetupTests.kt b/lib/src/test/java/de/kuschku/libquassel/util/SetupTests.kt deleted file mode 100644 index 343f039c1616548dc387b00fc814b16e7947413a..0000000000000000000000000000000000000000 --- a/lib/src/test/java/de/kuschku/libquassel/util/SetupTests.kt +++ /dev/null @@ -1,190 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.libquassel.util - -import de.kuschku.libquassel.protocol.BufferId -import de.kuschku.libquassel.protocol.Buffer_Type -import de.kuschku.libquassel.protocol.IdentityId -import de.kuschku.libquassel.protocol.NetworkId -import de.kuschku.libquassel.quassel.BufferInfo -import de.kuschku.libquassel.quassel.syncables.AliasManager -import de.kuschku.libquassel.quassel.syncables.interfaces.INetwork - -fun TestSession.with(f: TestSession.() -> Unit) = f.invoke(this) - -fun withTestSession(f: TestSession.() -> Unit) = f.invoke(setupTestSession()) - -fun setupTestSession() = TestSession().provideTestData { - bufferViewConfigs = listOf( - buildBufferViewConfig(0) { - setBufferViewName("All Chats") - addBuffer(BufferId(1), 0) - addBuffer(BufferId(2), 1) - addBuffer(BufferId(3), 2) - } - ) - - identities = listOf( - buildIdentity(IdentityId(1)) { - setIdentityName("Default Identity") - setRealName("Janne Mareike Koschinski <janne@kuschku.de>") - setNicks(listOf( - "justJanne", - "ninjanne", - "janne", - "kuschku" - )) - setIdent("justJanne") - } - ) - - networks = listOf( - buildNetwork(NetworkId(1)) { - setNetworkName("FreeNode") - setCurrentServer("tepper.freenode.net") - setConnected(true) - setConnectionState(INetwork.ConnectionState.Initialized) - setMyNick("justJanne") - setLatency(48) - setIdentity(IdentityId(1)) - setActualServerList(listOf( - INetwork.Server( - host = "irc.freenode.net", - port = INetwork.PortDefaults.PORT_SSL.port, - useSsl = true - ), - INetwork.Server( - host = "chat.freenode.net", - port = INetwork.PortDefaults.PORT_SSL.port, - useSsl = true - ) - )) - addSupport("CHANTYPES", "#") - addSupport("EXCEPTS") - addSupport("INVEX") - addSupport("CHANMODES", "eIbq,k,flj,CFLMPQScgimnprstz") - addSupport("CHANLIMIT", "#:120") - addSupport("PREFIX", "(ov)@+") - addSupport("MAXLIST", "bqeI:100") - addSupport("MODES", "4") - addSupport("NETWORK", "freenode") - addSupport("STATUSMSG", "@+") - addSupport("CALLERID", "g") - addSupport("CASEMAPPING", "rfc1459") - addSupport("CHARSET", "ascii") - addSupport("NICKLEN", "16") - addSupport("CHANNELLEN", "50") - addSupport("TOPICLEN", "390") - addSupport("DEAF", "D") - addSupport("FNC") - addSupport("TARGMAX", "NAMES:1,LIST:1,KICK:1,WHOIS:1,PRIVMSG:4,NOTICE:4,ACCEPT:,MONITOR:") - addSupport("EXTBAN", "$,ajrxz") - addSupport("CLIENTVER", "3.0") - addSupport("ETRACE") - addSupport("KNOCK") - addSupport("WHOX") - addSupport("CPRIVMSG") - addSupport("CNOTICE") - addSupport("SAFELIST") - addSupport("ELIST", "CTU") - - addCap("account-notify") - addCap("sasl") - addCap("identify-msg") - addCap("multi-prefix") - addCap("extended-join") - - acknowledgeCap("sasl") - acknowledgeCap("account-notify") - acknowledgeCap("extended-join") - acknowledgeCap("multi-prefix") - - val justJanne = buildIrcUser("justJanne") { - setUser("kuschku") - setHost("kuschku.de") - setRealName("Janne Mareike Koschinski <janne@kuschku.de>") - setAccount("justJanne") - setServer("tepper.freenode.net") - } - val digitalcircuit = buildIrcUser("digitalcircuit") { - setUser("~quassel") - setHost("2605:6000:1518:830d:ec4:7aff:fe6b:c6b0") - setRealName("Shane <avatar@mg.zorro.casa>") - setAccount("digitalcircuit") - setServer("wolfe.freenode.net") - } - val Sput = buildIrcUser("Sput") { - setUser("~sputnick") - setHost("quassel/developer/sput") - setRealName("Sputnick -- http://quassel-irc.org") - setAccount("Sput") - setServer("niven.freenode.net") - } - - buildIrcChannel("#quassel-test") { - setTopic("Quassel testing channel") - addChannelMode('n') - addChannelMode('t') - addChannelMode('c') - - joinIrcUser(justJanne) - joinIrcUser(digitalcircuit) - joinIrcUser(Sput) - } - } - ) - - buffers = listOf( - TestSession.BufferTestData( - bufferInfo = BufferInfo( - bufferId = BufferId(1), - networkId = NetworkId(1), - bufferName = "FreeNode", - type = Buffer_Type.of(Buffer_Type.StatusBuffer) - ) - ), - TestSession.BufferTestData( - bufferInfo = BufferInfo( - bufferId = BufferId(2), - networkId = NetworkId(1), - bufferName = "#quassel-test", - type = Buffer_Type.of(Buffer_Type.ChannelBuffer) - ) - ), - TestSession.BufferTestData( - bufferInfo = BufferInfo( - bufferId = BufferId(3), - networkId = NetworkId(1), - bufferName = "digitalcircuit", - type = Buffer_Type.of(Buffer_Type.QueryBuffer) - ) - ), - TestSession.BufferTestData( - bufferInfo = BufferInfo( - bufferId = BufferId(4), - networkId = NetworkId(1), - bufferName = "ChanServ", - type = Buffer_Type.of(Buffer_Type.QueryBuffer) - ) - ) - ) - - aliases = AliasManager.defaults() -} diff --git a/lib/src/test/java/de/kuschku/libquassel/util/TestSession.kt b/lib/src/test/java/de/kuschku/libquassel/util/TestSession.kt deleted file mode 100644 index 382f211d6fb4697ef5d6ccff363e4b53f608e9ca..0000000000000000000000000000000000000000 --- a/lib/src/test/java/de/kuschku/libquassel/util/TestSession.kt +++ /dev/null @@ -1,353 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.libquassel.util - -import de.kuschku.libquassel.connection.ConnectionState -import de.kuschku.libquassel.connection.Features -import de.kuschku.libquassel.protocol.* -import de.kuschku.libquassel.protocol.message.HandshakeMessage -import de.kuschku.libquassel.protocol.message.SignalProxyMessage -import de.kuschku.libquassel.quassel.BufferInfo -import de.kuschku.libquassel.quassel.syncables.* -import de.kuschku.libquassel.quassel.syncables.interfaces.IAliasManager -import de.kuschku.libquassel.quassel.syncables.interfaces.ISyncableObject -import de.kuschku.libquassel.session.ISession -import de.kuschku.libquassel.session.ObjectStorage -import de.kuschku.libquassel.session.ProtocolHandler -import io.reactivex.Observable -import io.reactivex.subjects.BehaviorSubject -import io.reactivex.subjects.PublishSubject -import org.junit.Assert.assertTrue -import javax.net.ssl.SSLSession - -class TestSession : ProtocolHandler({ throw it }), ISession { - private val submissionCallbacks = mutableListOf<SubmissionCallback>() - - interface SubmissionCallback { - fun callSubmitted(message: SignalProxyMessage) - } - - class EnsuranceEnvironment(submittedCalls: List<SignalProxyMessage>) { - private val sync = submittedCalls.mapNotNull { it as? SignalProxyMessage.SyncMessage } - private val rpc = submittedCalls.mapNotNull { it as? SignalProxyMessage.RpcCall } - private val initRequest = submittedCalls.mapNotNull { it as? SignalProxyMessage.InitRequest } - private val initData = submittedCalls.mapNotNull { it as? SignalProxyMessage.InitData } - private val heartbeat = submittedCalls.mapNotNull { it as? SignalProxyMessage.HeartBeat } - private val heartbeatReply = submittedCalls.mapNotNull { it as? SignalProxyMessage.HeartBeatReply } - - fun callSync(target: ISyncableObject, slotName: String, params: QVariantList?) { - val matchingTargetTypes = sync.filter { - it.className == target.className - } - assertTrue( - "SYNC No calls were made on objects of type ${target.className}", - matchingTargetTypes.isNotEmpty() - ) - val matchingTargets = matchingTargetTypes.filter { - it.objectName == target.objectName - } - assertTrue( - if (matchingTargetTypes.isNotEmpty()) { - "SYNC No calls were made on ${target.className}:${target.objectName}, instead only on:\n ${matchingTargetTypes.map { "${it.className}:${it.objectName}" }.joinToString( - "\n ")}" - } else { - "SYNC No calls were made on ${target.className}:${target.objectName}" - }, - matchingTargets.isNotEmpty() - ) - - val matchingNames = matchingTargets.filter { - it.slotName == slotName - } - assertTrue( - "SYNC ${target.className}:${target.objectName}:$slotName() was never called", - matchingNames.isNotEmpty() - ) - if (!params.isNullOrEmpty()) { - val calledParams = matchingNames.map(SignalProxyMessage.SyncMessage::params) - assertTrue( - "SYNC ${target.className}:${target.objectName}:$slotName was called with the wrong parameters:\nExpected:\n $params\nActual:\n ${calledParams.joinToString( - "\n ")}", - calledParams.contains(params) - ) - } - } - - fun callRpc(slotName: String, params: QVariantList?) { - val matchingNames = rpc.filter { - it.slotName == slotName - } - assertTrue( - "RPC $slotName() was not called", - matchingNames.isNotEmpty() - ) - if (!params.isNullOrEmpty()) { - val calledParams = matchingNames.map(SignalProxyMessage.RpcCall::params) - assertTrue( - "RPC $slotName was called with the wrong parameters:\nExpected:\n $params\nActual:\n ${calledParams.joinToString( - "\n ")}", - calledParams.contains(params) - ) - } - } - - fun requestInit(className: String, objectName: String) { - val matchingType = initRequest.filter { - it.className == className - } - assertTrue( - "InitRequest No data was requested for objects of type $className", - matchingType.isNotEmpty() - ) - val matchingCalls = matchingType.filter { - it.objectName == objectName - } - assertTrue( - "InitRequest No data was requested for object $className:$objectName, instead only for:\n ${matchingType.map { "${it.className}:${it.objectName}" }.joinToString( - "\n ")}", - matchingCalls.isNotEmpty() - ) - } - } - - class TestEnvironment(private val session: TestSession) : - SubmissionCallback { - private val submittedCalls = mutableListOf<SignalProxyMessage>() - - fun run(f: ISession.() -> Unit): TestEnvironment { - session.submissionCallbacks.add(this) - f.invoke(session) - session.submissionCallbacks.remove(this) - return this - } - - fun does(f: EnsuranceEnvironment.() -> Unit) { - f.invoke(EnsuranceEnvironment(submittedCalls)) - } - - override fun callSubmitted(message: SignalProxyMessage) { - submittedCalls.add(message) - } - } - - fun ensure(f: ISession.() -> Unit) = TestEnvironment(this).run(f) - - override val proxy = this - override val objectStorage = ObjectStorage(this) - - override val progress = ISession.ProgressData( - state = BehaviorSubject.createDefault(ConnectionState.CONNECTED), - progress = BehaviorSubject.createDefault(Pair(0, 0)), - error = Observable.empty() - ) - - override val features = Features.all() - override val sslSession = BehaviorSubject.createDefault(Optional.empty<SSLSession>()) - - override val aliasManager = AliasManager(proxy) - override val backlogManager = BacklogManager(this) - override val bufferViewManager = BufferViewManager(this) - override val bufferSyncer = BufferSyncer(this) - override val certManagers = mutableMapOf<IdentityId, CertManager>() - override val coreInfo = CoreInfo(this) - override val dccConfig = DccConfig(this) - - override val identities = mutableMapOf<IdentityId, Identity>() - private val live_identities = BehaviorSubject.createDefault(Unit) - override fun liveIdentities(): Observable<Map<IdentityId, Identity>> = live_identities.map { identities.toMap() } - override fun identity(id: IdentityId) = identities[id] - override fun addIdentity(initData: QVariantMap) { - val identity = Identity(this) - identity.fromVariantMap(initData) - identities[identity.id()] = identity - synchronize(identity) - live_identities.onNext(Unit) - } - - fun addIdentity(identity: Identity, initialize: Boolean = false) { - identities[identity.id()] = identity - if (!initialize) - identity.initialized = true - synchronize(identity) - } - - override fun removeIdentity(identityId: IdentityId) { - val identity = identities.remove(identityId) - stopSynchronize(identity) - live_identities.onNext(Unit) - } - - override val ignoreListManager = IgnoreListManager(this) - override val highlightRuleManager = HighlightRuleManager(this) - override val ircListHelper = IrcListHelper(this) - - override val networks = mutableMapOf<NetworkId, Network>() - private val live_networks = BehaviorSubject.createDefault(Unit) - override fun liveNetworks(): Observable<Map<NetworkId, Network>> = live_networks.map { networks.toMap() } - override fun network(id: NetworkId) = networks[id] - private val network_added = PublishSubject.create<NetworkId>() - override fun liveNetworkAdded(): Observable<NetworkId> = network_added - override fun addNetwork(networkId: NetworkId) { - val network = Network(networkId, this) - networks[networkId] = network - synchronize(network) - live_networks.onNext(Unit) - network_added.onNext(networkId) - } - - fun addNetwork(network: Network, initialize: Boolean = false) { - networks[network.networkId()] = network - if (!initialize) - network.initialized = true - synchronize(network) - } - - fun addBufferViewConfig(bufferViewConfig: BufferViewConfig, initialize: Boolean = false) { - if (!initialize) - bufferViewConfig.initialized = true - bufferViewManager.addBufferViewConfig(bufferViewConfig) - synchronize(bufferViewConfig) - } - - override fun removeNetwork(networkId: NetworkId) { - val network = networks.remove(networkId) - stopSynchronize(network) - live_networks.onNext(Unit) - } - - override val networkConfig = NetworkConfig(this) - - override val rpcHandler = RpcHandler(this) - - override val lag = BehaviorSubject.createDefault(0L) - - fun buildNetwork(networkId: NetworkId, f: (Network.() -> Unit)? = null): Network { - val network = Network(networkId, proxy) - f?.invoke(network) - return network - } - - fun buildIdentity(identityId: IdentityId, f: (Identity.() -> Unit)? = null): Identity { - val identity = Identity(proxy) - identity.setId(identityId) - f?.invoke(identity) - return identity - } - - fun buildBufferViewConfig(bufferViewConfigId: Int, - f: (BufferViewConfig.() -> Unit)? = null): BufferViewConfig { - val bufferViewConfig = BufferViewConfig(bufferViewConfigId, proxy) - f?.invoke(bufferViewConfig) - return bufferViewConfig - } - - data class BufferTestData( - val bufferInfo: BufferInfo, - val activity: Message_Types = Message_Type.of(), - val lastSeenMsg: MsgId = MsgId(-1), - val markerLine: MsgId = MsgId(-1), - val highlightCount: Int = 0 - ) - - data class TestData( - val session: TestSession, - var bufferViewConfigs: List<BufferViewConfig> = emptyList(), - var networks: List<Network> = emptyList(), - var identities: List<Identity> = emptyList(), - var buffers: List<BufferTestData> = emptyList(), - var aliases: List<IAliasManager.Alias> = emptyList() - ) { - fun buildBufferViewConfig(bufferViewConfigId: Int, - f: (BufferViewConfig.() -> Unit)? = null): BufferViewConfig { - return session.buildBufferViewConfig(bufferViewConfigId, f) - } - - fun buildNetwork(networkId: NetworkId, f: (Network.() -> Unit)? = null): Network { - return session.buildNetwork(networkId, f) - } - - fun buildIdentity(identityId: IdentityId, f: (Identity.() -> Unit)? = null): Identity { - return session.buildIdentity(identityId, f) - } - - fun Network.buildIrcChannel(name: String, f: IrcChannel.() -> Unit): IrcChannel { - val ircChannel = IrcChannel(name, this, session.proxy) - ircChannel.initialized = true - f.invoke(ircChannel) - newIrcChannel(name, ircChannel.toVariantMap()) - return ircChannel(name)!! - } - - fun Network.buildIrcUser(name: String, f: IrcUser.() -> Unit): IrcUser { - val ircUser = IrcUser(name, this, session.proxy) - ircUser.initialized = true - f.invoke(ircUser) - newIrcUser(name, ircUser.toVariantMap()) - return ircUser(name)!! - } - } - - fun provideTestData(f: TestData.() -> Unit): TestSession { - val data = TestData(this) - f.invoke(data) - for (bufferViewConfig in data.bufferViewConfigs) { - addBufferViewConfig(bufferViewConfig) - } - for (network in data.networks) { - addNetwork(network) - } - for (identity in data.identities) { - addIdentity(identity) - } - bufferSyncer.setBufferInfos(data.buffers.map { - it.bufferInfo - }) - bufferSyncer.setActivities(data.buffers.map { - Pair(it.bufferInfo.bufferId, it.activity) - }) - bufferSyncer.setMarkerLines(data.buffers.map { - Pair(it.bufferInfo.bufferId, it.markerLine) - }) - bufferSyncer.setLastSeenMsg(data.buffers.map { - Pair(it.bufferInfo.bufferId, it.lastSeenMsg) - }) - bufferSyncer.setHighlightCounts(data.buffers.map { - Pair(it.bufferInfo.bufferId, it.highlightCount) - }) - aliasManager.setAliasList(data.aliases) - return this - } - - override fun onInitDone() = Unit - override fun dispatch(message: HandshakeMessage) = Unit - override fun dispatch(message: SignalProxyMessage) { - for (submissionCallback in submissionCallbacks) { - submissionCallback.callSubmitted(message) - } - } - - override fun login(user: String, pass: String) = Unit - - override fun setupCore(setupData: HandshakeMessage.CoreSetupData) { - dispatch(setupData) - } - - override fun disconnectFromCore() {} -} diff --git a/lib/src/test/java/de/kuschku/libquassel/util/irc/HostmaskHelperTest.kt b/lib/src/test/java/de/kuschku/libquassel/util/irc/HostmaskHelperTest.kt deleted file mode 100644 index a49ccbd89685ee2b0d9704ef049eba92b9369fd7..0000000000000000000000000000000000000000 --- a/lib/src/test/java/de/kuschku/libquassel/util/irc/HostmaskHelperTest.kt +++ /dev/null @@ -1,206 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.libquassel.util.irc - -import org.junit.Assert.assertEquals -import org.junit.Test - -class HostmaskHelperTest { - @Test - fun testNormal() { - runTest( - source = "justJanne!kuschku@lithium.kuschku.de", - nick = "justJanne", - user = "kuschku", - host = "lithium.kuschku.de" - ) - assertEquals( - "justJanne!kuschku@lithium.kuschku.de", - HostmaskHelper.build(nick = "justJanne", user = "kuschku", host = "lithium.kuschku.de") - ) - } - - @Test - fun testUnvalidatedIdent() { - runTest( - source = "justJanne!~kuschku@lithium.kuschku.de", - nick = "justJanne", - user = "~kuschku", - host = "lithium.kuschku.de" - ) - assertEquals( - "justJanne!~kuschku@lithium.kuschku.de", - HostmaskHelper.build(nick = "justJanne", user = "~kuschku", host = "lithium.kuschku.de") - ) - } - - @Test - fun testUnicode() { - runTest( - source = "bärlauch!maße@flüge.de", - nick = "bärlauch", - user = "maße", - host = "flüge.de" - ) - assertEquals( - "bärlauch!maße@flüge.de", - HostmaskHelper.build(nick = "bärlauch", user = "maße", host = "flüge.de") - ) - } - - @Test - fun testServer() { - runTest( - source = "irc.freenode.org", - nick = "irc.freenode.org", - user = "", - host = "" - ) - assertEquals( - "irc.freenode.org", - HostmaskHelper.build(nick = "irc.freenode.org", user = "", host = "") - ) - } - - @Test - fun testAtNick() { - runTest( - source = "@nick!~ident@example.org", - nick = "@nick", - user = "~ident", - host = "example.org" - ) - assertEquals( - "@nick!~ident@example.org", - HostmaskHelper.build(nick = "@nick", user = "~ident", host = "example.org") - ) - } - - @Test - fun testReversedDelimiters() { - runTest( - source = "a@a!", - nick = "a", - user = "", - host = "a!" - ) - assertEquals( - "a@a!", - HostmaskHelper.build(nick = "a", user = "", host = "a!") - ) - } - - @Test - fun testDiscord() { - runTest( - source = "Gin_!Gin_!♡♅ƸӜƷ♅♡!@discord", - nick = "Gin_", - user = "Gin_!♡♅ƸӜƷ♅♡!", - host = "discord" - ) - assertEquals( - "Gin_!Gin_!♡♅ƸӜƷ♅♡!@discord", - HostmaskHelper.build(nick = "Gin_", user = "Gin_!♡♅ƸӜƷ♅♡!", host = "discord") - ) - } - - @Test - fun testDan() { - runTest( - source = "coolguy!ag@127.0.0.1", - nick = "coolguy", - user = "ag", - host = "127.0.0.1" - ) - - runTest( - source = "coolguy!~ag@localhost", - nick = "coolguy", - user = "~ag", - host = "localhost" - ) - } - - @Test - fun testDanMissingAtoms() { - runTest( - source = "!ag@127.0.0.1", - nick = "", - user = "ag", - host = "127.0.0.1" - ) - - runTest( - source = "coolguy!@127.0.0.1", - nick = "coolguy", - user = "", - host = "127.0.0.1" - ) - - runTest( - source = "coolguy@127.0.0.1", - nick = "coolguy", - user = "", - host = "127.0.0.1" - ) - - runTest( - source = "coolguy!ag@", - nick = "coolguy", - user = "ag", - host = "" - ) - - runTest( - source = "coolguy!ag", - nick = "coolguy", - user = "ag", - host = "" - ) - } - - @Test - fun testDanWeirdControlCodes() { - runTest( - source = "coolguy!ag@net\u00035w\u0003ork.admin", - nick = "coolguy", - user = "ag", - host = "net\u00035w\u0003ork.admin" - ) - - runTest( - source = "coolguy!~ag@n\u0002et\u000305w\u000fork.admin", - nick = "coolguy", - user = "~ag", - host = "n\u0002et\u000305w\u000fork.admin" - ) - } - - private fun runTest(source: String, nick: String, user: String, host: String) { - assertEquals(nick, HostmaskHelper.nick(source)) - assertEquals(nick, HostmaskHelper.split(source).first) - - assertEquals(user, HostmaskHelper.user(source)) - assertEquals(user, HostmaskHelper.split(source).second) - - assertEquals(host, HostmaskHelper.host(source)) - assertEquals(host, HostmaskHelper.split(source).third) - } -} diff --git a/lib/src/test/java/de/kuschku/libquassel/util/nio/WrappedChannelTest.kt b/lib/src/test/java/de/kuschku/libquassel/util/nio/WrappedChannelTest.kt deleted file mode 100644 index ff5bbc08509ee1fd775070c2cdde561a8fffe9ec..0000000000000000000000000000000000000000 --- a/lib/src/test/java/de/kuschku/libquassel/util/nio/WrappedChannelTest.kt +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.libquassel.util.nio - -import de.kuschku.libquassel.util.nio.WrappedChannel.Companion.selectBestTlsVersion -import org.junit.Assert.assertEquals -import org.junit.Test - -class WrappedChannelTest { - @Test - fun doesNotSelectOutdatedTlsVersions() { - assertEquals(null, selectBestTlsVersion(arrayOf( - "SSLv3", "TLSv1", "TLSv1.0", "TLSv1.1" - ))) - } - - @Test - fun rejectsNonTlsProtocols() { - assertEquals(null, selectBestTlsVersion(arrayOf( - "SSLv3", "UberSecurityProtocol5" - ))) - } - - @Test - fun selectsLatestTlsVersion() { - assertEquals("TLSv1.2", selectBestTlsVersion(arrayOf( - "SSLv3", "TLSv1", "TLSv1.0", "TLSv1.1", "TLSv1.2", "UberSecurityProtocol5" - ))) - assertEquals("TLSv1.3", selectBestTlsVersion(arrayOf( - "SSLv3", "TLSv1", "TLSv1.0", "TLSv1.1", "TLSv1.2", "TLSv1.3", "UberSecurityProtocol5" - ))) - } -} diff --git a/lib/src/test/java/de/kuschku/libquassel/util/rxjava/ReusableUnicastSubjectTest.kt b/lib/src/test/java/de/kuschku/libquassel/util/rxjava/ReusableUnicastSubjectTest.kt deleted file mode 100644 index 7310ea8ded4a28beadc4830932390950c189bc52..0000000000000000000000000000000000000000 --- a/lib/src/test/java/de/kuschku/libquassel/util/rxjava/ReusableUnicastSubjectTest.kt +++ /dev/null @@ -1,104 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.libquassel.util.rxjava - -import org.junit.Assert.assertEquals -import org.junit.Test - -class ReusableUnicastSubjectTest { - @Test - fun test() { - // We have Object A and B1, B2, etc. - // - // Object A should provide an observable to Objects B1, B2, etc. - // Object A will at some points publish items to this Observable. - // As long as no subscriber is subscribed, these items should be buffered. - // - // As soon as a subscriber subscribers, it should get all buffered items, as well as all that - // come after until it unsubscribes. - // - // If the subscriber unsubscribes again, the observable should buffer incoming items again, - // until another subscriber subscribes again - - val expected1 = listOf(1, 2, 3, 4, 5, 6, 7, 8, 9, 10) - val received1 = mutableListOf<Int>() - - val expected2 = listOf(11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25) - val received2 = mutableListOf<Int>() - - val expected3 = listOf(21, 22, 23, 24, 25, 26, 27, 28, 29, 30) - val received3 = mutableListOf<Int>() - - // We create our observable, this is supposed to be in Object A - val subject = ReusableUnicastSubject.create<Int>() - val observable = subject.publish().refCount() - - // And emit items while no subscriber is subscribed. - // These should get buffered - for (i in 1..5) { - subject.onNext(i) - } - - // B1 subscribes, the subscriber should now receive all buffered items - val subscription1 = observable.subscribe { - received1.add(it) - } - - // We emit items while a subscriber is subscribed, - // these shouldn’t get buffered but instead directly consumed by the subscriber - for (i in 6..10) { - subject.onNext(i) - } - // B1 unsubscribes again, from now on items should get buffered again - subscription1.dispose() - - // These items should get buffered again - for (i in 11..15) { - subject.onNext(i) - } - // As soon as B2 subscribes, it should receive the buffered items 11..15 - val subscription2 = observable.subscribe { - received2.add(it) - } - - // These items should get directly consumed by the subscriber again - for (i in 16..20) { - subject.onNext(i) - } - // B3 should receive no buffered items - val subscription3 = observable.subscribe { - received3.add(it) - } - for (i in 21..25) { - subject.onNext(i) - } - // And B2 unsubscribes again - subscription2.dispose() - // These items should get directly consumed by the B3 - for (i in 26..30) { - subject.onNext(i) - } - subscription3.dispose() - - assertEquals(expected1, received1) - assertEquals(expected2, received2) - assertEquals(expected3, received3) - } -} diff --git a/lib/src/test/resources/blns.txt b/lib/src/test/resources/blns.txt deleted file mode 100644 index 54d73bf4682d4558c8427a79e798831e335bd48e..0000000000000000000000000000000000000000 --- a/lib/src/test/resources/blns.txt +++ /dev/null @@ -1,712 +0,0 @@ -# Reserved Strings -# -# Strings which may be used elsewhere in code - -undefined -undef -null -NULL -(null) -nil -NIL -true -false -True -False -TRUE -FALSE -None -hasOwnProperty -then -\ -\\ - -# Numeric Strings -# -# Strings which can be interpreted as numeric - -0 -1 -1.00 -$1.00 -1/2 -1E2 -1E02 -1E+02 --1 --1.00 --$1.00 --1/2 --1E2 --1E02 --1E+02 -1/0 -0/0 --2147483648/-1 --9223372036854775808/-1 --0 --0.0 -+0 -+0.0 -0.00 -0..0 -. -0.0.0 -0,00 -0,,0 -, -0,0,0 -0.0/0 -1.0/0.0 -0.0/0.0 -1,0/0,0 -0,0/0,0 ---1 -- --. --, -999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999 -NaN -Infinity --Infinity -INF -1#INF --1#IND -1#QNAN -1#SNAN -1#IND -0x0 -0xffffffff -0xffffffffffffffff -0xabad1dea -123456789012345678901234567890123456789 -1,000.00 -1 000.00 -1'000.00 -1,000,000.00 -1 000 000.00 -1'000'000.00 -1.000,00 -1 000,00 -1'000,00 -1.000.000,00 -1 000 000,00 -1'000'000,00 -01000 -08 -09 -2.2250738585072011e-308 - -# Special Characters -# -# ASCII punctuation. All of these characters may need to be escaped in some -# contexts. Divided into three groups based on (US-layout) keyboard position. - -,./;'[]\-= -<>?:"{}|_+ -!@#$%^&*()`~ - -# Non-whitespace C0 controls: U+0001 through U+0008, U+000E through U+001F, -# and U+007F (DEL) -# Often forbidden to appear in various text-based file formats (e.g. XML), -# or reused for internal delimiters on the theory that they should never -# appear in input. -# The next line may appear to be blank or mojibake in some viewers. - - -# Non-whitespace C1 controls: U+0080 through U+0084 and U+0086 through U+009F. -# Commonly misinterpreted as additional graphic characters. -# The next line may appear to be blank, mojibake, or dingbats in some viewers. - - -# Whitespace: all of the characters with category Zs, Zl, or Zp (in Unicode -# version 8.0.0), plus U+0009 (HT), U+000B (VT), U+000C (FF), U+0085 (NEL), -# and U+200B (ZERO WIDTH SPACE), which are in the C categories but are often -# treated as whitespace in some contexts. -# This file unfortunately cannot express strings containing -# U+0000, U+000A, or U+000D (NUL, LF, CR). -# The next line may appear to be blank or mojibake in some viewers. -# The next line may be flagged for "trailing whitespace" in some viewers. - - -# Unicode additional control characters: all of the characters with -# general category Cf (in Unicode 8.0.0). -# The next line may appear to be blank or mojibake in some viewers. - - -# "Byte order marks", U+FEFF and U+FFFE, each on its own line. -# The next two lines may appear to be blank or mojibake in some viewers. - - - -# Unicode Symbols -# -# Strings which contain common unicode symbols (e.g. smart quotes) - -Ω≈ç√∫˜µ≤≥÷ -åß∂ƒ©˙∆˚¬…æ -œ∑´®†¥¨ˆøπ“‘ -¡™£¢∞§¶•ªº–≠ -¸˛Ç◊ı˜Â¯˘¿ -ÅÍÎÏ˝ÓÔÒÚÆ☃ -Œ„´‰ˇÁ¨ˆØ∏”’ -`⁄€‹›fifl‡°·‚—± -⅛⅜⅝⅞ -ЁЂЃЄЅІЇЈЉЊЋЌЍЎЏАБВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯабвгдежзийклмнопрстуфхцчшщъыьэюя -٠١٢٣٤٥٦٧٨٩ - -# Unicode Subscript/Superscript/Accents -# -# Strings which contain unicode subscripts/superscripts; can cause rendering issues - -⁰⁴⁵ -₀₁₂ -⁰⁴⁵₀₁₂ -ด้้้้้็็็็็้้้้้็็็็็้้้้้้้้็็็็็้้้้้็็็็็้้้้้้้้็็็็็้้้้้็็็็็้้้้้้้้็็็็็้้้้้็็็็ ด้้้้้็็็็็้้้้้็็็็็้้้้้้้้็็็็็้้้้้็็็็็้้้้้้้้็็็็็้้้้้็็็็็้้้้้้้้็็็็็้้้้้็็็็ ด้้้้้็็็็็้้้้้็็็็็้้้้้้้้็็็็็้้้้้็็็็็้้้้้้้้็็็็็้้้้้็็็็็้้้้้้้้็็็็็้้้้้็็็็ - -# Quotation Marks -# -# Strings which contain misplaced quotation marks; can cause encoding errors - -' -" -'' -"" -'"' -"''''"'" -"'"'"''''" -<foo val=“bar” /> -<foo val=“bar” /> -<foo val=”bar“ /> -<foo val=`bar' /> - -# Two-Byte Characters -# -# Strings which contain two-byte characters: can cause rendering issues or character-length issues - -田中さんにあげて下さい -パーティーへ行かないか -和製漢語 -部落格 -사회과학원 어학연구소 -찦차를 타고 온 펲시맨과 쑛다리 똠방각하 -社會科學院語學研究所 -울란바토르 -𠜎𠜱𠝹𠱓𠱸𠲖𠳏 - -# Special Unicode Characters Union -# -# A super string recommended by VMware Inc. Globalization Team: can effectively cause rendering issues or character-length issues to validate product globalization readiness. -# -# 表 CJK_UNIFIED_IDEOGRAPHS (U+8868) -# ポ KATAKANA LETTER PO (U+30DD) -# あ HIRAGANA LETTER A (U+3042) -# A LATIN CAPITAL LETTER A (U+0041) -# 鷗 CJK_UNIFIED_IDEOGRAPHS (U+9DD7) -# Œ LATIN SMALL LIGATURE OE (U+0153) -# é LATIN SMALL LETTER E WITH ACUTE (U+00E9) -# B FULLWIDTH LATIN CAPITAL LETTER B (U+FF22) -# 逍 CJK_UNIFIED_IDEOGRAPHS (U+900D) -# Ü LATIN SMALL LETTER U WITH DIAERESIS (U+00FC) -# ß LATIN SMALL LETTER SHARP S (U+00DF) -# ª FEMININE ORDINAL INDICATOR (U+00AA) -# ą LATIN SMALL LETTER A WITH OGONEK (U+0105) -# ñ LATIN SMALL LETTER N WITH TILDE (U+00F1) -# 丂 CJK_UNIFIED_IDEOGRAPHS (U+4E02) -# 㐀 CJK Ideograph Extension A, First (U+3400) -# 𠀀 CJK Ideograph Extension B, First (U+20000) - -表ポあA鷗ŒéB逍Üߪąñ丂㐀𠀀 - -# Changing length when lowercased -# -# Characters which increase in length (2 to 3 bytes) when lowercased -# Credit: https://twitter.com/jifa/status/625776454479970304 - -Ⱥ -Ⱦ - -# Japanese Emoticons -# -# Strings which consists of Japanese-style emoticons which are popular on the web - -ヽ༼ຈل͜ຈ༽ノ ヽ༼ຈل͜ຈ༽ノ -(。◕ ∀ ◕。) -`ィ(´∀`∩ -__ロ(,_,*) -・( ̄∀ ̄)・:*: -゚・✿ヾ╲(。◕‿◕。)╱✿・゚ -,。・:*:・゜’( ☻ ω ☻ )。・:*:・゜’ -(╯°□°)╯︵ ┻━┻) -(ノಥ益ಥ)ノ ┻━┻ -┬─┬ノ( º _ ºノ) -( ͡° ͜ʖ ͡°) -¯\_(ツ)_/¯ - -# Emoji -# -# Strings which contain Emoji; should be the same behavior as two-byte characters, but not always - -😍 -👩🏽 -👾 🙇 💁 🙅 🙆 🙋 🙎 🙍 -🐵 🙈 🙉 🙊 -❤️ 💔 💌 💕 💞 💓 💗 💖 💘 💝 💟 💜 💛 💚 💙 -✋🏿 💪🏿 👐🏿 🙌🏿 👏🏿 🙏🏿 -🚾 🆒 🆓 🆕 🆖 🆗 🆙 🏧 -0️⃣ 1️⃣ 2️⃣ 3️⃣ 4️⃣ 5️⃣ 6️⃣ 7️⃣ 8️⃣ 9️⃣ 🔟 - -# Regional Indicator Symbols -# -# Regional Indicator Symbols can be displayed differently across -# fonts, and have a number of special behaviors - -🇺🇸🇷🇺🇸 🇦🇫🇦🇲🇸 -🇺🇸🇷🇺🇸🇦🇫🇦🇲 -🇺🇸🇷🇺🇸🇦 - -# Unicode Numbers -# -# Strings which contain unicode numbers; if the code is localized, it should see the input as numeric - -123 -١٢٣ - -# Right-To-Left Strings -# -# Strings which contain text that should be rendered RTL if possible (e.g. Arabic, Hebrew) - -ثم نفس سقطت وبالتحديد،, جزيرتي باستخدام أن دنو. إذ هنا؟ الستار وتنصيب كان. أهّل ايطاليا، بريطانيا-فرنسا قد أخذ. سليمان، إتفاقية بين ما, يذكر الحدود أي بعد, معاملة بولندا، الإطلاق عل إيو. -בְּרֵאשִׁית, בָּרָא אֱלֹהִים, אֵת הַשָּׁמַיִם, וְאֵת הָאָרֶץ -הָיְתָהtestالصفحات التّحول -﷽ -ﷺ -مُنَاقَشَةُ سُبُلِ اِسْتِخْدَامِ اللُّغَةِ فِي النُّظُمِ الْقَائِمَةِ وَفِيم يَخُصَّ التَّطْبِيقَاتُ الْحاسُوبِيَّةُ، - -# Trick Unicode -# -# Strings which contain unicode with unusual properties (e.g. Right-to-left override) (c.f. http://www.unicode.org/charts/PDF/U2000.pdf) - -test -test - test -testtest -test - -# Zalgo Text -# -# Strings which contain "corrupted" text. The corruption will not appear in non-HTML text, however. (via http://www.eeemo.net) - -Ṱ̺̺̕o͞ ̷i̲̬͇̪͙n̝̗͕v̟̜̘̦͟o̶̙̰̠kè͚̮̺̪̹̱̤ ̖t̝͕̳̣̻̪͞h̼͓̲̦̳̘̲e͇̣̰̦̬͎ ̢̼̻̱̘h͚͎͙̜̣̲ͅi̦̲̣̰̤v̻͍e̺̭̳̪̰-m̢iͅn̖̺̞̲̯̰d̵̼̟͙̩̼̘̳ ̞̥̱̳̭r̛̗̘e͙p͠r̼̞̻̭̗e̺̠̣͟s̘͇̳͍̝͉e͉̥̯̞̲͚̬͜ǹ̬͎͎̟̖͇̤t͍̬̤͓̼̭͘ͅi̪̱n͠g̴͉ ͏͉ͅc̬̟h͡a̫̻̯͘o̫̟̖͍̙̝͉s̗̦̲.̨̹͈̣ -̡͓̞ͅI̗̘̦͝n͇͇͙v̮̫ok̲̫̙͈i̖͙̭̹̠̞n̡̻̮̣̺g̲͈͙̭͙̬͎ ̰t͔̦h̞̲e̢̤ ͍̬̲͖f̴̘͕̣è͖ẹ̥̩l͖͔͚i͓͚̦͠n͖͍̗͓̳̮g͍ ̨o͚̪͡f̘̣̬ ̖̘͖̟͙̮c҉͔̫͖͓͇͖ͅh̵̤̣͚͔á̗̼͕ͅo̼̣̥s̱͈̺̖̦̻͢.̛̖̞̠̫̰ -̗̺͖̹̯͓Ṯ̤͍̥͇͈h̲́e͏͓̼̗̙̼̣͔ ͇̜̱̠͓͍ͅN͕͠e̗̱z̘̝̜̺͙p̤̺̹͍̯͚e̠̻̠͜r̨̤͍̺̖͔̖̖d̠̟̭̬̝͟i̦͖̩͓͔̤a̠̗̬͉̙n͚͜ ̻̞̰͚ͅh̵͉i̳̞v̢͇ḙ͎͟-҉̭̩̼͔m̤̭̫i͕͇̝̦n̗͙ḍ̟ ̯̲͕͞ǫ̟̯̰̲͙̻̝f ̪̰̰̗̖̭̘͘c̦͍̲̞͍̩̙ḥ͚a̮͎̟̙͜ơ̩̹͎s̤.̝̝ ҉Z̡̖̜͖̰̣͉̜a͖̰͙̬͡l̲̫̳͍̩g̡̟̼̱͚̞̬ͅo̗͜.̟ -̦H̬̤̗̤͝e͜ ̜̥̝̻͍̟́w̕h̖̯͓o̝͙̖͎̱̮ ҉̺̙̞̟͈W̷̼̭a̺̪͍į͈͕̭͙̯̜t̶̼̮s̘͙͖̕ ̠̫̠B̻͍͙͉̳ͅe̵h̵̬͇̫͙i̹͓̳̳̮͎̫̕n͟d̴̪̜̖ ̰͉̩͇͙̲͞ͅT͖̼͓̪͢h͏͓̮̻e̬̝̟ͅ ̤̹̝W͙̞̝͔͇͝ͅa͏͓͔̹̼̣l̴͔̰̤̟͔ḽ̫.͕ -Z̮̞̠͙͔ͅḀ̗̞͈̻̗Ḷ͙͎̯̹̞͓G̻O̭̗̮ - -# Unicode Upsidedown -# -# Strings which contain unicode with an "upsidedown" effect (via http://www.upsidedowntext.com) - -˙ɐnbᴉlɐ ɐuƃɐɯ ǝɹolop ʇǝ ǝɹoqɐl ʇn ʇunpᴉpᴉɔuᴉ ɹodɯǝʇ poɯsnᴉǝ op pǝs 'ʇᴉlǝ ƃuᴉɔsᴉdᴉpɐ ɹnʇǝʇɔǝsuoɔ 'ʇǝɯɐ ʇᴉs ɹolop ɯnsdᴉ ɯǝɹo˥ -00˙Ɩ$- - -# Unicode font -# -# Strings which contain bold/italic/etc. versions of normal characters - -The quick brown fox jumps over the lazy dog -𝐓𝐡𝐞 𝐪𝐮𝐢𝐜𝐤 𝐛𝐫𝐨𝐰𝐧 𝐟𝐨𝐱 𝐣𝐮𝐦𝐩𝐬 𝐨𝐯𝐞𝐫 𝐭𝐡𝐞 𝐥𝐚𝐳𝐲 𝐝𝐨𝐠 -𝕿𝖍𝖊 𝖖𝖚𝖎𝖈𝖐 𝖇𝖗𝖔𝖜𝖓 𝖋𝖔𝖝 𝖏𝖚𝖒𝖕𝖘 𝖔𝖛𝖊𝖗 𝖙𝖍𝖊 𝖑𝖆𝖟𝖞 𝖉𝖔𝖌 -𝑻𝒉𝒆 𝒒𝒖𝒊𝒄𝒌 𝒃𝒓𝒐𝒘𝒏 𝒇𝒐𝒙 𝒋𝒖𝒎𝒑𝒔 𝒐𝒗𝒆𝒓 𝒕𝒉𝒆 𝒍𝒂𝒛𝒚 𝒅𝒐𝒈 -𝓣𝓱𝓮 𝓺𝓾𝓲𝓬𝓴 𝓫𝓻𝓸𝔀𝓷 𝓯𝓸𝔁 𝓳𝓾𝓶𝓹𝓼 𝓸𝓿𝓮𝓻 𝓽𝓱𝓮 𝓵𝓪𝔃𝔂 𝓭𝓸𝓰 -𝕋𝕙𝕖 𝕢𝕦𝕚𝕔𝕜 𝕓𝕣𝕠𝕨𝕟 𝕗𝕠𝕩 𝕛𝕦𝕞𝕡𝕤 𝕠𝕧𝕖𝕣 𝕥𝕙𝕖 𝕝𝕒𝕫𝕪 𝕕𝕠𝕘 -𝚃𝚑𝚎 𝚚𝚞𝚒𝚌𝚔 𝚋𝚛𝚘𝚠𝚗 𝚏𝚘𝚡 𝚓𝚞𝚖𝚙𝚜 𝚘𝚟𝚎𝚛 𝚝𝚑𝚎 𝚕𝚊𝚣𝚢 𝚍𝚘𝚐 -⒯⒣⒠ ⒬⒰⒤⒞⒦ ⒝⒭⒪⒲⒩ ⒡⒪⒳ ⒥⒰⒨⒫⒮ ⒪⒱⒠⒭ ⒯⒣⒠ ⒧⒜⒵⒴ ⒟⒪⒢ - -# Script Injection -# -# Strings which attempt to invoke a benign script injection; shows vulnerability to XSS - -<script>alert(123)</script> -<script>alert('123');</script> -<img src=x onerror=alert(123) /> -<svg><script>123<1>alert(123)</script> -"><script>alert(123)</script> -'><script>alert(123)</script> -><script>alert(123)</script> -</script><script>alert(123)</script> -< / script >< script >alert(123)< / script > - onfocus=JaVaSCript:alert(123) autofocus -" onfocus=JaVaSCript:alert(123) autofocus -' onfocus=JaVaSCript:alert(123) autofocus -<script>alert(123)</script> -<sc<script>ript>alert(123)</sc</script>ript> ---><script>alert(123)</script> -";alert(123);t=" -';alert(123);t=' -JavaSCript:alert(123) -;alert(123); -src=JaVaSCript:prompt(132) -"><script>alert(123);</script x=" -'><script>alert(123);</script x=' -><script>alert(123);</script x= -" autofocus onkeyup="javascript:alert(123) -' autofocus onkeyup='javascript:alert(123) -<script\x20type="text/javascript">javascript:alert(1);</script> -<script\x3Etype="text/javascript">javascript:alert(1);</script> -<script\x0Dtype="text/javascript">javascript:alert(1);</script> -<script\x09type="text/javascript">javascript:alert(1);</script> -<script\x0Ctype="text/javascript">javascript:alert(1);</script> -<script\x2Ftype="text/javascript">javascript:alert(1);</script> -<script\x0Atype="text/javascript">javascript:alert(1);</script> -'`"><\x3Cscript>javascript:alert(1)</script> -'`"><\x00script>javascript:alert(1)</script> -ABC<div style="x\x3Aexpression(javascript:alert(1)">DEF -ABC<div style="x:expression\x5C(javascript:alert(1)">DEF -ABC<div style="x:expression\x00(javascript:alert(1)">DEF -ABC<div style="x:exp\x00ression(javascript:alert(1)">DEF -ABC<div style="x:exp\x5Cression(javascript:alert(1)">DEF -ABC<div style="x:\x0Aexpression(javascript:alert(1)">DEF -ABC<div style="x:\x09expression(javascript:alert(1)">DEF -ABC<div style="x:\xE3\x80\x80expression(javascript:alert(1)">DEF -ABC<div style="x:\xE2\x80\x84expression(javascript:alert(1)">DEF -ABC<div style="x:\xC2\xA0expression(javascript:alert(1)">DEF -ABC<div style="x:\xE2\x80\x80expression(javascript:alert(1)">DEF -ABC<div style="x:\xE2\x80\x8Aexpression(javascript:alert(1)">DEF -ABC<div style="x:\x0Dexpression(javascript:alert(1)">DEF -ABC<div style="x:\x0Cexpression(javascript:alert(1)">DEF -ABC<div style="x:\xE2\x80\x87expression(javascript:alert(1)">DEF -ABC<div style="x:\xEF\xBB\xBFexpression(javascript:alert(1)">DEF -ABC<div style="x:\x20expression(javascript:alert(1)">DEF -ABC<div style="x:\xE2\x80\x88expression(javascript:alert(1)">DEF -ABC<div style="x:\x00expression(javascript:alert(1)">DEF -ABC<div style="x:\xE2\x80\x8Bexpression(javascript:alert(1)">DEF -ABC<div style="x:\xE2\x80\x86expression(javascript:alert(1)">DEF -ABC<div style="x:\xE2\x80\x85expression(javascript:alert(1)">DEF -ABC<div style="x:\xE2\x80\x82expression(javascript:alert(1)">DEF -ABC<div style="x:\x0Bexpression(javascript:alert(1)">DEF -ABC<div style="x:\xE2\x80\x81expression(javascript:alert(1)">DEF -ABC<div style="x:\xE2\x80\x83expression(javascript:alert(1)">DEF -ABC<div style="x:\xE2\x80\x89expression(javascript:alert(1)">DEF -<a href="\x0Bjavascript:javascript:alert(1)" id="fuzzelement1">test</a> -<a href="\x0Fjavascript:javascript:alert(1)" id="fuzzelement1">test</a> -<a href="\xC2\xA0javascript:javascript:alert(1)" id="fuzzelement1">test</a> -<a href="\x05javascript:javascript:alert(1)" id="fuzzelement1">test</a> -<a href="\xE1\xA0\x8Ejavascript:javascript:alert(1)" id="fuzzelement1">test</a> -<a href="\x18javascript:javascript:alert(1)" id="fuzzelement1">test</a> -<a href="\x11javascript:javascript:alert(1)" id="fuzzelement1">test</a> -<a href="\xE2\x80\x88javascript:javascript:alert(1)" id="fuzzelement1">test</a> -<a href="\xE2\x80\x89javascript:javascript:alert(1)" id="fuzzelement1">test</a> -<a href="\xE2\x80\x80javascript:javascript:alert(1)" id="fuzzelement1">test</a> -<a href="\x17javascript:javascript:alert(1)" id="fuzzelement1">test</a> -<a href="\x03javascript:javascript:alert(1)" id="fuzzelement1">test</a> -<a href="\x0Ejavascript:javascript:alert(1)" id="fuzzelement1">test</a> -<a href="\x1Ajavascript:javascript:alert(1)" id="fuzzelement1">test</a> -<a href="\x00javascript:javascript:alert(1)" id="fuzzelement1">test</a> -<a href="\x10javascript:javascript:alert(1)" id="fuzzelement1">test</a> -<a href="\xE2\x80\x82javascript:javascript:alert(1)" id="fuzzelement1">test</a> -<a href="\x20javascript:javascript:alert(1)" id="fuzzelement1">test</a> -<a href="\x13javascript:javascript:alert(1)" id="fuzzelement1">test</a> -<a href="\x09javascript:javascript:alert(1)" id="fuzzelement1">test</a> -<a href="\xE2\x80\x8Ajavascript:javascript:alert(1)" id="fuzzelement1">test</a> -<a href="\x14javascript:javascript:alert(1)" id="fuzzelement1">test</a> -<a href="\x19javascript:javascript:alert(1)" id="fuzzelement1">test</a> -<a href="\xE2\x80\xAFjavascript:javascript:alert(1)" id="fuzzelement1">test</a> -<a href="\x1Fjavascript:javascript:alert(1)" id="fuzzelement1">test</a> -<a href="\xE2\x80\x81javascript:javascript:alert(1)" id="fuzzelement1">test</a> -<a href="\x1Djavascript:javascript:alert(1)" id="fuzzelement1">test</a> -<a href="\xE2\x80\x87javascript:javascript:alert(1)" id="fuzzelement1">test</a> -<a href="\x07javascript:javascript:alert(1)" id="fuzzelement1">test</a> -<a href="\xE1\x9A\x80javascript:javascript:alert(1)" id="fuzzelement1">test</a> -<a href="\xE2\x80\x83javascript:javascript:alert(1)" id="fuzzelement1">test</a> -<a href="\x04javascript:javascript:alert(1)" id="fuzzelement1">test</a> -<a href="\x01javascript:javascript:alert(1)" id="fuzzelement1">test</a> -<a href="\x08javascript:javascript:alert(1)" id="fuzzelement1">test</a> -<a href="\xE2\x80\x84javascript:javascript:alert(1)" id="fuzzelement1">test</a> -<a href="\xE2\x80\x86javascript:javascript:alert(1)" id="fuzzelement1">test</a> -<a href="\xE3\x80\x80javascript:javascript:alert(1)" id="fuzzelement1">test</a> -<a href="\x12javascript:javascript:alert(1)" id="fuzzelement1">test</a> -<a href="\x0Djavascript:javascript:alert(1)" id="fuzzelement1">test</a> -<a href="\x0Ajavascript:javascript:alert(1)" id="fuzzelement1">test</a> -<a href="\x0Cjavascript:javascript:alert(1)" id="fuzzelement1">test</a> -<a href="\x15javascript:javascript:alert(1)" id="fuzzelement1">test</a> -<a href="\xE2\x80\xA8javascript:javascript:alert(1)" id="fuzzelement1">test</a> -<a href="\x16javascript:javascript:alert(1)" id="fuzzelement1">test</a> -<a href="\x02javascript:javascript:alert(1)" id="fuzzelement1">test</a> -<a href="\x1Bjavascript:javascript:alert(1)" id="fuzzelement1">test</a> -<a href="\x06javascript:javascript:alert(1)" id="fuzzelement1">test</a> -<a href="\xE2\x80\xA9javascript:javascript:alert(1)" id="fuzzelement1">test</a> -<a href="\xE2\x80\x85javascript:javascript:alert(1)" id="fuzzelement1">test</a> -<a href="\x1Ejavascript:javascript:alert(1)" id="fuzzelement1">test</a> -<a href="\xE2\x81\x9Fjavascript:javascript:alert(1)" id="fuzzelement1">test</a> -<a href="\x1Cjavascript:javascript:alert(1)" id="fuzzelement1">test</a> -<a href="javascript\x00:javascript:alert(1)" id="fuzzelement1">test</a> -<a href="javascript\x3A:javascript:alert(1)" id="fuzzelement1">test</a> -<a href="javascript\x09:javascript:alert(1)" id="fuzzelement1">test</a> -<a href="javascript\x0D:javascript:alert(1)" id="fuzzelement1">test</a> -<a href="javascript\x0A:javascript:alert(1)" id="fuzzelement1">test</a> -`"'><img src=xxx:x \x0Aonerror=javascript:alert(1)> -`"'><img src=xxx:x \x22onerror=javascript:alert(1)> -`"'><img src=xxx:x \x0Bonerror=javascript:alert(1)> -`"'><img src=xxx:x \x0Donerror=javascript:alert(1)> -`"'><img src=xxx:x \x2Fonerror=javascript:alert(1)> -`"'><img src=xxx:x \x09onerror=javascript:alert(1)> -`"'><img src=xxx:x \x0Conerror=javascript:alert(1)> -`"'><img src=xxx:x \x00onerror=javascript:alert(1)> -`"'><img src=xxx:x \x27onerror=javascript:alert(1)> -`"'><img src=xxx:x \x20onerror=javascript:alert(1)> -"`'><script>\x3Bjavascript:alert(1)</script> -"`'><script>\x0Djavascript:alert(1)</script> -"`'><script>\xEF\xBB\xBFjavascript:alert(1)</script> -"`'><script>\xE2\x80\x81javascript:alert(1)</script> -"`'><script>\xE2\x80\x84javascript:alert(1)</script> -"`'><script>\xE3\x80\x80javascript:alert(1)</script> -"`'><script>\x09javascript:alert(1)</script> -"`'><script>\xE2\x80\x89javascript:alert(1)</script> -"`'><script>\xE2\x80\x85javascript:alert(1)</script> -"`'><script>\xE2\x80\x88javascript:alert(1)</script> -"`'><script>\x00javascript:alert(1)</script> -"`'><script>\xE2\x80\xA8javascript:alert(1)</script> -"`'><script>\xE2\x80\x8Ajavascript:alert(1)</script> -"`'><script>\xE1\x9A\x80javascript:alert(1)</script> -"`'><script>\x0Cjavascript:alert(1)</script> -"`'><script>\x2Bjavascript:alert(1)</script> -"`'><script>\xF0\x90\x96\x9Ajavascript:alert(1)</script> -"`'><script>-javascript:alert(1)</script> -"`'><script>\x0Ajavascript:alert(1)</script> -"`'><script>\xE2\x80\xAFjavascript:alert(1)</script> -"`'><script>\x7Ejavascript:alert(1)</script> -"`'><script>\xE2\x80\x87javascript:alert(1)</script> -"`'><script>\xE2\x81\x9Fjavascript:alert(1)</script> -"`'><script>\xE2\x80\xA9javascript:alert(1)</script> -"`'><script>\xC2\x85javascript:alert(1)</script> -"`'><script>\xEF\xBF\xAEjavascript:alert(1)</script> -"`'><script>\xE2\x80\x83javascript:alert(1)</script> -"`'><script>\xE2\x80\x8Bjavascript:alert(1)</script> -"`'><script>\xEF\xBF\xBEjavascript:alert(1)</script> -"`'><script>\xE2\x80\x80javascript:alert(1)</script> -"`'><script>\x21javascript:alert(1)</script> -"`'><script>\xE2\x80\x82javascript:alert(1)</script> -"`'><script>\xE2\x80\x86javascript:alert(1)</script> -"`'><script>\xE1\xA0\x8Ejavascript:alert(1)</script> -"`'><script>\x0Bjavascript:alert(1)</script> -"`'><script>\x20javascript:alert(1)</script> -"`'><script>\xC2\xA0javascript:alert(1)</script> -<img \x00src=x onerror="alert(1)"> -<img \x47src=x onerror="javascript:alert(1)"> -<img \x11src=x onerror="javascript:alert(1)"> -<img \x12src=x onerror="javascript:alert(1)"> -<img\x47src=x onerror="javascript:alert(1)"> -<img\x10src=x onerror="javascript:alert(1)"> -<img\x13src=x onerror="javascript:alert(1)"> -<img\x32src=x onerror="javascript:alert(1)"> -<img\x47src=x onerror="javascript:alert(1)"> -<img\x11src=x onerror="javascript:alert(1)"> -<img \x47src=x onerror="javascript:alert(1)"> -<img \x34src=x onerror="javascript:alert(1)"> -<img \x39src=x onerror="javascript:alert(1)"> -<img \x00src=x onerror="javascript:alert(1)"> -<img src\x09=x onerror="javascript:alert(1)"> -<img src\x10=x onerror="javascript:alert(1)"> -<img src\x13=x onerror="javascript:alert(1)"> -<img src\x32=x onerror="javascript:alert(1)"> -<img src\x12=x onerror="javascript:alert(1)"> -<img src\x11=x onerror="javascript:alert(1)"> -<img src\x00=x onerror="javascript:alert(1)"> -<img src\x47=x onerror="javascript:alert(1)"> -<img src=x\x09onerror="javascript:alert(1)"> -<img src=x\x10onerror="javascript:alert(1)"> -<img src=x\x11onerror="javascript:alert(1)"> -<img src=x\x12onerror="javascript:alert(1)"> -<img src=x\x13onerror="javascript:alert(1)"> -<img[a][b][c]src[d]=x[e]onerror=[f]"alert(1)"> -<img src=x onerror=\x09"javascript:alert(1)"> -<img src=x onerror=\x10"javascript:alert(1)"> -<img src=x onerror=\x11"javascript:alert(1)"> -<img src=x onerror=\x12"javascript:alert(1)"> -<img src=x onerror=\x32"javascript:alert(1)"> -<img src=x onerror=\x00"javascript:alert(1)"> -<a href=javascript:javascript:alert(1)>XXX</a> -<img src="x` `<script>javascript:alert(1)</script>"` `> -<img src onerror /" '"= alt=javascript:alert(1)//"> -<title onpropertychange=javascript:alert(1)></title><title title=> -<a href=http://foo.bar/#x=`y></a><img alt="`><img src=x:x onerror=javascript:alert(1)></a>"> -<!--[if]><script>javascript:alert(1)</script --> -<!--[if<img src=x onerror=javascript:alert(1)//]> --> -<script src="/\%(jscript)s"></script> -<script src="\\%(jscript)s"></script> -<IMG """><SCRIPT>alert("XSS")</SCRIPT>"> -<IMG SRC=javascript:alert(String.fromCharCode(88,83,83))> -<IMG SRC=# onmouseover="alert('xxs')"> -<IMG SRC= onmouseover="alert('xxs')"> -<IMG onmouseover="alert('xxs')"> -<IMG SRC=javascript:alert('XSS')> -<IMG SRC=javascript:alert('XSS')> -<IMG SRC=javascript:alert('XSS')> -<IMG SRC="jav ascript:alert('XSS');"> -<IMG SRC="jav	ascript:alert('XSS');"> -<IMG SRC="jav
ascript:alert('XSS');"> -<IMG SRC="jav
ascript:alert('XSS');"> -perl -e 'print "<IMG SRC=java\0script:alert(\"XSS\")>";' > out -<IMG SRC="  javascript:alert('XSS');"> -<SCRIPT/XSS SRC="http://ha.ckers.org/xss.js"></SCRIPT> -<BODY onload!#$%&()*~+-_.,:;?@[/|\]^`=alert("XSS")> -<SCRIPT/SRC="http://ha.ckers.org/xss.js"></SCRIPT> -<<SCRIPT>alert("XSS");//<</SCRIPT> -<SCRIPT SRC=http://ha.ckers.org/xss.js?< B > -<SCRIPT SRC=//ha.ckers.org/.j> -<IMG SRC="javascript:alert('XSS')" -<iframe src=http://ha.ckers.org/scriptlet.html < -\";alert('XSS');// -<u oncopy=alert()> Copy me</u> -<i onwheel=alert(1)> Scroll over me </i> -<plaintext> -http://a/%%30%30 -</textarea><script>alert(123)</script> - -# SQL Injection -# -# Strings which can cause a SQL injection if inputs are not sanitized - -1;DROP TABLE users -1'; DROP TABLE users-- 1 -' OR 1=1 -- 1 -' OR '1'='1 - -% -_ - -# Server Code Injection -# -# Strings which can cause user to run code on server as a privileged user (c.f. https://news.ycombinator.com/item?id=7665153) - -- --- ---version ---help -$USER -/dev/null; touch /tmp/blns.fail ; echo -`touch /tmp/blns.fail` -$(touch /tmp/blns.fail) -@{[system "touch /tmp/blns.fail"]} - -# Command Injection (Ruby) -# -# Strings which can call system commands within Ruby/Rails applications - -eval("puts 'hello world'") -System("ls -al /") -`ls -al /` -Kernel.exec("ls -al /") -Kernel.exit(1) -%x('ls -al /') - -# XXE Injection (XML) -# -# String which can reveal system files when parsed by a badly configured XML parser - -<?xml version="1.0" encoding="ISO-8859-1"?><!DOCTYPE foo [ <!ELEMENT foo ANY ><!ENTITY xxe SYSTEM "file:///etc/passwd" >]><foo>&xxe;</foo> - -# Unwanted Interpolation -# -# Strings which can be accidentally expanded into different strings if evaluated in the wrong context, e.g. used as a printf format string or via Perl or shell eval. Might expose sensitive data from the program doing the interpolation, or might just represent the wrong string. - -$HOME -$ENV{'HOME'} -%d -%s%s%s%s%s -{0} -%*.*s -%@ -%n -File:/// - -# File Inclusion -# -# Strings which can cause user to pull in files that should not be a part of a web server - -../../../../../../../../../../../etc/passwd%00 -../../../../../../../../../../../etc/hosts - -# Known CVEs and Vulnerabilities -# -# Strings that test for known vulnerabilities - -() { 0; }; touch /tmp/blns.shellshock1.fail; -() { _; } >_[$($())] { touch /tmp/blns.shellshock2.fail; } -<<< %s(un='%s') = %u -+++ATH0 - -# MSDOS/Windows Special Filenames -# -# Strings which are reserved characters in MSDOS/Windows - -CON -PRN -AUX -CLOCK$ -NUL -A: -ZZ: -COM1 -LPT1 -LPT2 -LPT3 -COM2 -COM3 -COM4 - -# IRC specific strings -# -# Strings that may occur on IRC clients that make security products freak out - -DCC SEND STARTKEYLOGGER 0 0 0 - -# Scunthorpe Problem -# -# Innocuous strings which may be blocked by profanity filters (https://en.wikipedia.org/wiki/Scunthorpe_problem) - -Scunthorpe General Hospital -Penistone Community Church -Lightwater Country Park -Jimmy Clitheroe -Horniman Museum -shitake mushrooms -RomansInSussex.co.uk -http://www.cum.qc.ca/ -Craig Cockburn, Software Specialist -Linda Callahan -Dr. Herman I. Libshitz -magna cum laude -Super Bowl XXX -medieval erection of parapets -evaluate -mocha -expression -Arsenal canal -classic -Tyson Gay -Dick Van Dyke -basement - -# Human injection -# -# Strings which may cause human to reinterpret worldview - -If you're reading this, you've been in a coma for almost 20 years now. We're trying a new technique. We don't know where this message will end up in your dream, but we hope it works. Please wake up, we miss you. - -# Terminal escape codes -# -# Strings which punish the fools who use cat/type on this file - -Roses are [0;31mred[0m, violets are [0;34mblue. Hope you enjoy terminal hue -But now...[20Cfor my greatest trick...[8m -The quick brown fox... [Beeeep] - -# iOS Vulnerabilities -# -# Strings which crashed iMessage in various versions of iOS - -Powerلُلُصّبُلُلصّبُررً ॣ ॣh ॣ ॣ冗 -🏳0🌈️ -జ్ఞా diff --git a/lib/src/test/resources/logging.properties b/lib/src/test/resources/logging.properties deleted file mode 100644 index 1c42c90f0d8f87e2cbc67231c2978d0a83d4bf8f..0000000000000000000000000000000000000000 --- a/lib/src/test/resources/logging.properties +++ /dev/null @@ -1,47 +0,0 @@ -# Quasseldroid - Quassel client for Android -# -# Copyright (c) 2020 Janne Mareike Koschinski -# Copyright (c) 2020 The Quassel Project -# -# This program is free software: you can redistribute it and/or modify it -# under the terms of the GNU General Public License version 3 as published -# by the Free Software Foundation. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License along -# with this program. If not, see <http://www.gnu.org/licenses/>. -handlers=java.util.logging.ConsoleHandler -config= -.level=ALL -java.util.logging.SimpleFormatter.format=%1$tY-%1$tm-%1$td %1$tH:%1$tM:%1$tS.%1$tL %4$s %5$s%6$s%n -java.util.logging.FileHandler.level=WARNING -java.util.logging.FileHandler.filter= -java.util.logging.FileHandler.formatter= -java.util.logging.FileHandler.encoding= -java.util.logging.FileHandler.limit= -java.util.logging.FileHandler.count= -java.util.logging.FileHandler.append=false -java.util.logging.FileHandler.pattern=log.%u.%g.txt -java.util.logging.ConsoleHandler.level=FINEST -java.util.logging.ConsoleHandler.filter= -java.util.logging.ConsoleHandler.formatter= -java.util.logging.ConsoleHandler.encoding= -java.util.logging.StreamHandler.level=WARNING -java.util.logging.StreamHandler.filter= -java.util.logging.StreamHandler.formatter= -java.util.logging.StreamHandler.encoding= -java.util.logging.SocketHandler.level=WARNING -java.util.logging.SocketHandler.filter= -java.util.logging.SocketHandler.formatter= -java.util.logging.SocketHandler.encoding= -java.util.logging.SocketHandler.host= -java.util.logging.SocketHandler.port= -java.util.logging.MemoryHandler.level=WARNING -java.util.logging.MemoryHandler.filter= -java.util.logging.MemoryHandler.size= -java.util.logging.MemoryHandler.push= -java.util.logging.MemoryHandler.target= diff --git a/lib/src/test/resources/naughty_strings.txt b/lib/src/test/resources/naughty_strings.txt deleted file mode 100644 index 26a67c62e4439026cfec63bb561245e9c6534ab7..0000000000000000000000000000000000000000 --- a/lib/src/test/resources/naughty_strings.txt +++ /dev/null @@ -1 +0,0 @@ -“This is very Interesting! 😂" diff --git a/lifecycle-ktx/src/main/java/androidx/lifecycle/DefaultLifecycleObserver.kt b/lifecycle-ktx/src/main/java/androidx/lifecycle/DefaultLifecycleObserver.kt deleted file mode 100644 index 714cf8f3551287bdc5031b8b243a885fd0dc45cb..0000000000000000000000000000000000000000 --- a/lifecycle-ktx/src/main/java/androidx/lifecycle/DefaultLifecycleObserver.kt +++ /dev/null @@ -1,89 +0,0 @@ -/* - * Copyright (C) 2017 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package androidx.lifecycle - -/** - * Callback interface for listening to [LifecycleOwner] state changes. - * - * - * If you use Java 8 language, **always** prefer it over annotations. - */ -interface DefaultLifecycleObserver : FullLifecycleObserverProxy { - /** - * Notifies that `ON_CREATE` event occurred. - * - * - * This method will be called after the [LifecycleOwner]'s `onCreate` - * method returns. - * - * @param owner the component, whose state was changed - */ - override fun onCreate(owner: LifecycleOwner) = Unit - - /** - * Notifies that `ON_START` event occurred. - * - * - * This method will be called after the [LifecycleOwner]'s `onStart` method returns. - * - * @param owner the component, whose state was changed - */ - override fun onStart(owner: LifecycleOwner) = Unit - - /** - * Notifies that `ON_RESUME` event occurred. - * - * - * This method will be called after the [LifecycleOwner]'s `onResume` - * method returns. - * - * @param owner the component, whose state was changed - */ - override fun onResume(owner: LifecycleOwner) = Unit - - /** - * Notifies that `ON_PAUSE` event occurred. - * - * - * This method will be called before the [LifecycleOwner]'s `onPause` method - * is called. - * - * @param owner the component, whose state was changed - */ - override fun onPause(owner: LifecycleOwner) = Unit - - /** - * Notifies that `ON_STOP` event occurred. - * - * - * This method will be called before the [LifecycleOwner]'s `onStop` method - * is called. - * - * @param owner the component, whose state was changed - */ - override fun onStop(owner: LifecycleOwner) = Unit - - /** - * Notifies that `ON_DESTROY` event occurred. - * - * - * This method will be called before the [LifecycleOwner]'s `onStop` method - * is called. - * - * @param owner the component, whose state was changed - */ - override fun onDestroy(owner: LifecycleOwner) = Unit -} diff --git a/lifecycle-ktx/src/main/java/androidx/lifecycle/FullLifecycleObserverProxy.java b/lifecycle-ktx/src/main/java/androidx/lifecycle/FullLifecycleObserverProxy.java deleted file mode 100644 index 19f7a953888a3b9bd2b54d86e0f2f2167c27ab23..0000000000000000000000000000000000000000 --- a/lifecycle-ktx/src/main/java/androidx/lifecycle/FullLifecycleObserverProxy.java +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package androidx.lifecycle; - -public interface FullLifecycleObserverProxy extends FullLifecycleObserver { -} diff --git a/lint.xml b/lint.xml index b18845a9b5b6b185d3b7240ebfcb843422ef57a4..e2f8b6aaf3d0db0a3d508523b19d6147aaa5d6a2 100644 --- a/lint.xml +++ b/lint.xml @@ -20,9 +20,6 @@ <lint> <issue id="NewerVersionAvailable" severity="error" /> - <!-- Because of course paging and room have incompatible versions --> - <issue id="GradleCompatible" severity="ignore" /> - <!-- Because these are entirely broken --> <issue id="ResourceType" severity="ignore" /> <issue id="UnusedResources" severity="ignore" /> diff --git a/malheur/build.gradle.kts b/malheur/build.gradle.kts deleted file mode 100644 index 9516e3b2ef6f4ed2598fa637389b81690c27fd1e..0000000000000000000000000000000000000000 --- a/malheur/build.gradle.kts +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2018 Janne Mareike Koschinski - * Copyright (c) 2018 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -plugins { - id("com.android.library") - kotlin("android") -} - -android { - compileSdkVersion(29) - - defaultConfig { - minSdkVersion(20) - targetSdkVersion(29) - - consumerProguardFiles("proguard-rules.pro") - - // Disable test runner analytics - testInstrumentationRunnerArguments = mapOf( - "disableAnalytics" to "true" - ) - } - - lintOptions { - isWarningsAsErrors = true - setLintConfig(file("../lint.xml")) - } -} - -dependencies { - implementation(kotlin("stdlib", "1.3.72")) - - implementation("com.google.code.gson", "gson", "2.8.5") - implementation("androidx.annotation", "annotation", "1.1.0") -} diff --git a/malheur/proguard-rules.pro b/malheur/proguard-rules.pro deleted file mode 100644 index 8c9db7a6d02c604a02d4e04a47e3e45639eca4e2..0000000000000000000000000000000000000000 --- a/malheur/proguard-rules.pro +++ /dev/null @@ -1,21 +0,0 @@ -# Gson uses generic type information stored in a class file when working with fields. Proguard -# removes such information by default, so configure it to keep all of it. --keepattributes Signature - -# For using GSON @Expose annotation --keepattributes *Annotation* - -# Gson specific classes --dontwarn sun.misc.** -#-keep class com.google.gson.stream.** { *; } - -# Application classes that will be serialized/deserialized over Gson --keep class com.google.gson.examples.android.model.** { *; } - -# Prevent proguard from stripping interface information from TypeAdapterFactory, -# JsonSerializer, JsonDeserializer instances (so they can be used in @JsonAdapter) --keep class * implements com.google.gson.TypeAdapterFactory --keep class * implements com.google.gson.JsonSerializer --keep class * implements com.google.gson.JsonDeserializer - --keep class **.BuildConfig { *; } diff --git a/malheur/src/main/AndroidManifest.xml b/malheur/src/main/AndroidManifest.xml deleted file mode 100644 index 716184c658e659def1d2b286dc843473c1ce52ed..0000000000000000000000000000000000000000 --- a/malheur/src/main/AndroidManifest.xml +++ /dev/null @@ -1,20 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2019 Janne Mareike Koschinski - Copyright (c) 2019 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<manifest package="de.kuschku.malheur" /> diff --git a/malheur/src/main/java/de/kuschku/malheur/CrashContext.kt b/malheur/src/main/java/de/kuschku/malheur/CrashContext.kt deleted file mode 100644 index 9a711218038c5dd4c520aba157d3540f2baab8c3..0000000000000000000000000000000000000000 --- a/malheur/src/main/java/de/kuschku/malheur/CrashContext.kt +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.malheur - -import android.app.Application -import de.kuschku.malheur.config.ReportConfig -import java.util.* - -data class CrashContext( - val application: Application, - val config: ReportConfig, - val crashingThread: Thread, - val throwable: Throwable, - val startTime: Date, - val crashTime: Date, - val buildConfig: Class<*>?, - val stackTraces: Map<Thread, Array<StackTraceElement>>? -) diff --git a/malheur/src/main/java/de/kuschku/malheur/CrashHandler.kt b/malheur/src/main/java/de/kuschku/malheur/CrashHandler.kt deleted file mode 100644 index a6f5f21d36027d938e071c7d06f92552f5a62a27..0000000000000000000000000000000000000000 --- a/malheur/src/main/java/de/kuschku/malheur/CrashHandler.kt +++ /dev/null @@ -1,118 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.malheur - -import android.app.Application -import android.os.Handler -import android.os.HandlerThread -import android.util.Log -import android.widget.Toast -import com.google.gson.GsonBuilder -import de.kuschku.malheur.collectors.ReportCollector -import de.kuschku.malheur.config.ReportConfig -import java.io.File -import java.util.* - -object CrashHandler { - private val gson = GsonBuilder().disableHtmlEscaping().setPrettyPrinting().create() - - private val startTime = Date() - private var originalHandler: Thread.UncaughtExceptionHandler? = null - private var myHandler: ((Thread, Throwable) -> Unit)? = null - - private lateinit var handler: Handler - - inline fun <reified T> init(application: Application, config: ReportConfig = ReportConfig()) { - init(application, config, T::class.java) - } - - fun init(application: Application, config: ReportConfig = ReportConfig(), - buildConfig: Class<*>?) { - if (myHandler == null) { - originalHandler = Thread.getDefaultUncaughtExceptionHandler() - } - - val handlerThread = HandlerThread("Malheur") - handlerThread.start() - handler = Handler(handlerThread.looper) - - val reportCollector = ReportCollector(application) - myHandler = { activeThread, throwable -> - val crashTime = Date() - val stackTraces = Thread.getAllStackTraces() - Log.e("Malheur", "Creating crash report") - handler.post { - Toast.makeText(application, "Creating crash report", Toast.LENGTH_LONG).show() - } - try { - val json = gson.toJson( - reportCollector.collect( - CrashContext( - application = application, - config = config, - crashingThread = activeThread, - throwable = throwable, - startTime = startTime, - crashTime = crashTime, - buildConfig = buildConfig, - stackTraces = stackTraces - ), config - ) - ) - val crashDirectory = File(application.cacheDir, "crashes") - crashDirectory.mkdirs() - val crashFile = File(crashDirectory, "${System.currentTimeMillis()}.json") - crashFile.createNewFile() - crashFile.writeText(json) - Log.e("Malheur", "Crash report saved: $crashFile", throwable) - handler.post { - Toast.makeText( - application, "Crash report saved: ${crashFile.name}", Toast.LENGTH_LONG - ).show() - } - } catch (e: Throwable) { - e.printStackTrace() - throwable.addSuppressed(e) - } - } - - Thread.setDefaultUncaughtExceptionHandler { currentThread, throwable -> - myHandler?.invoke(currentThread, throwable) - originalHandler?.uncaughtException(currentThread, throwable) - } - - val oldHandler = Thread.currentThread().uncaughtExceptionHandler - Thread.currentThread().setUncaughtExceptionHandler { currentThread, throwable -> - myHandler?.invoke(currentThread, throwable) - oldHandler?.uncaughtException(currentThread, throwable) - } - } - - fun handle(throwable: Throwable) { - val thread = Thread.currentThread() - Thread { - myHandler?.invoke(thread, throwable) - }.start() - } - - fun handleSync(throwable: Throwable) { - myHandler?.invoke(Thread.currentThread(), throwable) - } -} diff --git a/malheur/src/main/java/de/kuschku/malheur/collectors/AppCollector.kt b/malheur/src/main/java/de/kuschku/malheur/collectors/AppCollector.kt deleted file mode 100644 index 8232ad6dd3a234554302e1e5f41997b01a6c0313..0000000000000000000000000000000000000000 --- a/malheur/src/main/java/de/kuschku/malheur/collectors/AppCollector.kt +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.malheur.collectors - -import android.app.Application -import android.os.Build -import de.kuschku.malheur.CrashContext -import de.kuschku.malheur.config.AppConfig -import de.kuschku.malheur.data.AppInfo -import de.kuschku.malheur.util.reflectionCollectConstants - -class AppCollector(private val application: Application) : Collector<AppInfo, AppConfig> { - override fun collect(context: CrashContext, config: AppConfig) = AppInfo( - versionName = collectIf(config.versionName) { - application.packageManager.getPackageInfo(application.packageName, 0).versionName - }, - versionCode = collectIf(config.versionCode) { - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) { - application.packageManager.getPackageInfo(application.packageName, 0).longVersionCode - } else { - @Suppress("DEPRECATION") - application.packageManager.getPackageInfo(application.packageName, 0).versionCode.toLong() - } - }, - buildConfig = collectIf(config.buildConfig) { - reflectionCollectConstants( - context.buildConfig ?: getBuildConfigClass(application.packageName) - ) - }, - installationSource = collectIf(config.installationSource) { - application.packageManager.getInstallerPackageName(application.packageName) - } - ) - - private fun getBuildConfigClass(packageName: String) = try { - Class.forName("$packageName.BuildConfig") - } catch (e: ClassNotFoundException) { - null - } -} diff --git a/malheur/src/main/java/de/kuschku/malheur/collectors/Collector.kt b/malheur/src/main/java/de/kuschku/malheur/collectors/Collector.kt deleted file mode 100644 index ba3b42ad6d12555b1b6833bc7bd8d74fa2fe9d2a..0000000000000000000000000000000000000000 --- a/malheur/src/main/java/de/kuschku/malheur/collectors/Collector.kt +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ -@file:Suppress("NOTHING_TO_INLINE") - -package de.kuschku.malheur.collectors - -import de.kuschku.malheur.CrashContext - -interface Collector<out DataType, in ConfigType> { - fun collect(context: CrashContext, config: ConfigType): DataType? -} - -inline fun <DataType, ConfigType> Collector<DataType, ConfigType>.collectIf( - context: CrashContext, - config: ConfigType? -) = if (config != null) collect(context, config) else null - -inline fun <DataType> collectIf(enabled: Boolean, closure: () -> DataType?) = - if (enabled) closure() else null diff --git a/malheur/src/main/java/de/kuschku/malheur/collectors/ConfigurationCollector.kt b/malheur/src/main/java/de/kuschku/malheur/collectors/ConfigurationCollector.kt deleted file mode 100644 index 01f5e2ba75b17f4f1a6878f3d64219350880113f..0000000000000000000000000000000000000000 --- a/malheur/src/main/java/de/kuschku/malheur/collectors/ConfigurationCollector.kt +++ /dev/null @@ -1,128 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.malheur.collectors - -import android.app.Application -import android.content.res.Configuration -import android.util.SparseArray -import de.kuschku.malheur.CrashContext -import java.lang.reflect.Field -import java.lang.reflect.Modifier - -class ConfigurationCollector(private val application: Application) : - Collector<Map<String, Any?>, Boolean> { - private val configValueInfo = mutableMapOf<String, SparseArray<String>>() - - private val configurationFields = listOf( - FieldDefinition( - fieldName = "screenHeightDp" - ), - FieldDefinition( - fieldName = "screenWidthDp" - ), - FieldDefinition( - fieldName = "smallestScreenWidthDp" - ), - FieldDefinition( - fieldName = "navigation", - enumPrefix = "NAVIGATION" - ), - FieldDefinition( - fieldName = "navigationHidden", - enumPrefix = "NAVIGATIONHIDDEN" - ), - FieldDefinition( - fieldName = "orientation", - enumPrefix = "ORIENTATION" - ), - FieldDefinition( - fieldName = "screenLayout", - enumPrefix = "SCREENLAYOUT", - isFlag = true - ), - FieldDefinition( - fieldName = "touchscreen", - enumPrefix = "TOUCHSCREEN" - ), - FieldDefinition( - fieldName = "uiMode", - enumPrefix = "UI_MODE", - isFlag = true - ) - ) - - init { - val configurationFieldPrefixes = configurationFields.map(FieldDefinition::enumPrefix) - - Configuration::class.java.declaredFields.filter { - Modifier.isStatic(it.modifiers) - }.filter { - it.type == Int::class.java - }.filterNot { - it.name.endsWith("_MASK") - }.forEach { field -> - val group = configurationFieldPrefixes.find { field.name.startsWith(it + "_") } - if (group != null) { - val value = field.name.substring(group.length + 1) - configValueInfo.getOrPut(group, ::SparseArray).put(field.getInt(null), value) - } - } - } - - override fun collect(context: CrashContext, - config: Boolean) = configurationFields.mapNotNull { info -> - val field: Field? = Configuration::class.java.getDeclaredField(info.fieldName) - field?.let { - Pair(info, it) - } - }.filter { (_, field) -> - !Modifier.isStatic(field.modifiers) - }.map { (info, field) -> - val groupInfo = configValueInfo[info.enumPrefix] - if (groupInfo != null) { - val value = field.getInt(application.resources.configuration) - if (info.isFlag) { - info.fieldName to (0 until groupInfo.size()).map { idx -> - groupInfo.keyAt(idx) to groupInfo.valueAt(idx) - }.filter { (key, _) -> - value and key != 0 - }.map { (_, value) -> - value - }.toList() - } else { - val valueConstant = groupInfo[value] - if (valueConstant == null) { - info.fieldName to value - } else { - info.fieldName to valueConstant - } - } - } else { - val value = field.getInt(application.resources.configuration) - info.fieldName to value - } - }.toMap() - - class FieldDefinition( - val fieldName: String, - val enumPrefix: String? = null, - val isFlag: Boolean = false - ) -} diff --git a/malheur/src/main/java/de/kuschku/malheur/collectors/CrashCollector.kt b/malheur/src/main/java/de/kuschku/malheur/collectors/CrashCollector.kt deleted file mode 100644 index d44120c5c897f0d11b49b9e29313e3b1d8b03a2d..0000000000000000000000000000000000000000 --- a/malheur/src/main/java/de/kuschku/malheur/collectors/CrashCollector.kt +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.malheur.collectors - -import de.kuschku.malheur.CrashContext -import de.kuschku.malheur.config.CrashConfig -import de.kuschku.malheur.data.CrashInfo -import de.kuschku.malheur.data.ExceptionInfo -import java.io.PrintWriter -import java.io.StringWriter - -class CrashCollector : Collector<CrashInfo, CrashConfig> { - override fun collect(context: CrashContext, config: CrashConfig) = CrashInfo( - cause = collectIf(config.cause) { - ExceptionInfo(context.throwable) - }, - exception = collectIf(config.exception) { - val result = StringWriter() - val printWriter = PrintWriter(result) - context.throwable.printStackTrace(printWriter) - result.toString() - } - ) -} diff --git a/malheur/src/main/java/de/kuschku/malheur/collectors/DeviceCollector.kt b/malheur/src/main/java/de/kuschku/malheur/collectors/DeviceCollector.kt deleted file mode 100644 index 20cbfcc91d5dfe6dc193fff103c972316937fee9..0000000000000000000000000000000000000000 --- a/malheur/src/main/java/de/kuschku/malheur/collectors/DeviceCollector.kt +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.malheur.collectors - -import android.app.Application -import android.os.Build -import de.kuschku.malheur.CrashContext -import de.kuschku.malheur.config.DeviceConfig -import de.kuschku.malheur.data.DeviceInfo -import de.kuschku.malheur.util.reflectionCollectConstants -import java.io.File - -class DeviceCollector(private val application: Application) : Collector<DeviceInfo, DeviceConfig> { - private val displayCollector = DisplayCollector(application) - - override fun collect(context: CrashContext, config: DeviceConfig): DeviceInfo { - return DeviceInfo( - build = collectIf(config.build) { - reflectionCollectConstants(Build::class.java) - }, - version = collectIf(config.version) { - reflectionCollectConstants(Build.VERSION::class.java) - }, - processor = collectIf(config.processor) { - readProcInfo() - }, - display = displayCollector.collectIf(context, config.display) - ) - } - - private fun readProcInfo() = File("/proc/cpuinfo") - .bufferedReader(Charsets.UTF_8) - .lineSequence() - .map { line -> line.split(":") } - .filter { split -> split.size == 2 } - .map { (key, value) -> key.trim() to value.trim() } - .filter { (key, _) -> key == "Hardware" } - .map { (_, value) -> value } - .firstOrNull() -} diff --git a/malheur/src/main/java/de/kuschku/malheur/collectors/DisplayCollector.kt b/malheur/src/main/java/de/kuschku/malheur/collectors/DisplayCollector.kt deleted file mode 100644 index 7eb37e44c69dab49a2ccd747a38ee9ac7362436b..0000000000000000000000000000000000000000 --- a/malheur/src/main/java/de/kuschku/malheur/collectors/DisplayCollector.kt +++ /dev/null @@ -1,87 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.malheur.collectors - -import android.app.Application -import android.content.Context -import android.graphics.Point -import android.os.Build -import android.util.SparseArray -import android.view.Display -import android.view.WindowManager -import androidx.annotation.RequiresApi -import de.kuschku.malheur.CrashContext -import de.kuschku.malheur.data.DisplayInfo -import de.kuschku.malheur.data.MetricsInfo -import de.kuschku.malheur.util.getMetrics -import java.lang.reflect.Modifier - -class DisplayCollector(application: Application) : - Collector<DisplayInfo, Boolean> { - private val windowManager = application.getSystemService( - Context.WINDOW_SERVICE - ) as WindowManager - - override fun collect(context: CrashContext, config: Boolean): DisplayInfo? { - val display = windowManager.defaultDisplay - val hdrCapabilities = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) { - val capabilitiesEnum = getHdrCapabilitiesEnum() - display.hdrCapabilities.supportedHdrTypes.map(capabilitiesEnum::get) - } else { - null - } - - val size = Point().also { - display.getRealSize(it) - } - - return DisplayInfo( - width = size.x, - height = size.y, - refreshRate = display.refreshRate, - hdr = hdrCapabilities, - isWideGamut = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { - display.isWideColorGamut - } else { - null - }, - metrics = MetricsInfo(display.getMetrics()) - ) - } - - @RequiresApi(Build.VERSION_CODES.N) - private fun getHdrCapabilitiesEnum(): SparseArray<String> { - val hdrCapabilityEnums = SparseArray<String>() - Display.HdrCapabilities::class.java.declaredFields.filter { - Modifier.isStatic(it.modifiers) - }.filter { - it.name.startsWith("HDR_TYPE_") - }.filter { - it.type == Int::class.java - }.forEach { - try { - val value = it.getInt(null) - hdrCapabilityEnums.put(value, it.name.substring("HDR_TYPE_".length)) - } catch (e: IllegalAccessException) { - } - } - return hdrCapabilityEnums - } -} diff --git a/malheur/src/main/java/de/kuschku/malheur/collectors/EnvCollector.kt b/malheur/src/main/java/de/kuschku/malheur/collectors/EnvCollector.kt deleted file mode 100644 index 0651be4c0f950f473f720766509ea84c97f074d5..0000000000000000000000000000000000000000 --- a/malheur/src/main/java/de/kuschku/malheur/collectors/EnvCollector.kt +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.malheur.collectors - -import android.app.Application -import android.os.Debug -import android.os.Environment -import de.kuschku.malheur.CrashContext -import de.kuschku.malheur.config.EnvConfig -import de.kuschku.malheur.data.EnvInfo -import de.kuschku.malheur.data.MemoryInfo -import de.kuschku.malheur.util.reflectionCollectGetters -import java.io.File - -class EnvCollector(application: Application) : Collector<EnvInfo, EnvConfig> { - private val configurationCollector = ConfigurationCollector(application) - - override fun collect(context: CrashContext, config: EnvConfig) = EnvInfo( - paths = collectIf(config.paths) { - reflectionCollectGetters( - Environment::class.java - )?.map { (key, value) -> - key to if (value is File) { - value.canonicalPath - } else { - value - } - }?.toMap() - }, - memory = collectIf(config.memory) { - val memoryInfo = Debug.MemoryInfo() - Debug.getMemoryInfo(memoryInfo) - MemoryInfo(memoryInfo) - }, - configuration = configurationCollector.collectIf(context, config.configuration), - startTime = collectIf(config.startTime) { - context.startTime.time - }, - crashTime = collectIf(config.crashTime) { - context.crashTime.time - } - ) -} diff --git a/malheur/src/main/java/de/kuschku/malheur/collectors/LogCollector.kt b/malheur/src/main/java/de/kuschku/malheur/collectors/LogCollector.kt deleted file mode 100644 index c5a806d88f67e741a51aa8ab29da85e49c6003d0..0000000000000000000000000000000000000000 --- a/malheur/src/main/java/de/kuschku/malheur/collectors/LogCollector.kt +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.malheur.collectors - -import de.kuschku.malheur.CrashContext -import de.kuschku.malheur.config.LogConfig -import java.text.SimpleDateFormat -import java.util.* - -class LogCollector : Collector<Map<String, List<String>>, LogConfig> { - private val logcatTimeFormatter = SimpleDateFormat("MM-dd HH:mm:ss.SSS", Locale.US) - - override fun collect(context: CrashContext, config: LogConfig): Map<String, List<String>> { - val since = logcatTimeFormatter.format(context.startTime) - return config.buffers.map { buffer -> - buffer to readLogCat(since, buffer) - }.toMap() - } - - private fun readLogCat(since: String, buffer: String) = ProcessBuilder() - .command("logcat", "-t", since, "-b", buffer) - .redirectErrorStream(true) - .start() - .inputStream - .bufferedReader(Charsets.UTF_8) - .readLines() -} diff --git a/malheur/src/main/java/de/kuschku/malheur/collectors/ReportCollector.kt b/malheur/src/main/java/de/kuschku/malheur/collectors/ReportCollector.kt deleted file mode 100644 index 7eff4fcc32aa4884c9daf8b7632c60ec2ca364b5..0000000000000000000000000000000000000000 --- a/malheur/src/main/java/de/kuschku/malheur/collectors/ReportCollector.kt +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.malheur.collectors - -import android.app.Application -import de.kuschku.malheur.CrashContext -import de.kuschku.malheur.config.ReportConfig -import de.kuschku.malheur.data.Report - -class ReportCollector(application: Application) : Collector<Report, ReportConfig> { - private val crashCollector = CrashCollector() - private val threadCollector = ThreadCollector() - private val logcatCollector = LogCollector() - private val applicationCollector = AppCollector(application) - private val deviceCollector = DeviceCollector(application) - private val environmentCollector = EnvCollector(application) - - override fun collect(context: CrashContext, config: ReportConfig) = Report( - crash = crashCollector.collectIf(context, config.crash), - threads = threadCollector.collectIf(context, config.threads), - /*logcat = logcatCollector.collectIf(context, config.logcat),*/ - application = applicationCollector.collectIf(context, config.application), - device = deviceCollector.collectIf(context, config.device), - environment = environmentCollector.collectIf(context, config.environment) - ) -} diff --git a/malheur/src/main/java/de/kuschku/malheur/collectors/ThreadCollector.kt b/malheur/src/main/java/de/kuschku/malheur/collectors/ThreadCollector.kt deleted file mode 100644 index e147273520f9f77f56ea3ed730a1cf40282e8952..0000000000000000000000000000000000000000 --- a/malheur/src/main/java/de/kuschku/malheur/collectors/ThreadCollector.kt +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.malheur.collectors - -import de.kuschku.malheur.CrashContext -import de.kuschku.malheur.CrashHandler -import de.kuschku.malheur.config.ThreadConfig -import de.kuschku.malheur.data.ThreadInfo -import de.kuschku.malheur.data.ThreadsInfo -import de.kuschku.malheur.data.TraceElement - -class ThreadCollector : Collector<ThreadsInfo, ThreadConfig> { - override fun collect(context: CrashContext, config: ThreadConfig) = ThreadsInfo( - crashed = context.stackTraces?.filterKeys { - it == context.crashingThread - }?.map { (thread, stackTrace) -> - threadToInfo(thread, stackTrace) - }?.firstOrNull(), - others = context.stackTraces?.filterKeys { - it != Thread.currentThread() && it != context.crashingThread - }?.map { (thread, stackTrace) -> - threadToInfo(thread, stackTrace) - } - ) - - private fun threadToInfo(thread: Thread, stackTrace: Array<StackTraceElement>) = ThreadInfo( - id = thread.id, - name = thread.name, - group = thread.threadGroup?.name, - status = thread.state?.name, - stackTrace = ArrayList(sanitize(stackTrace.map(::TraceElement))), - isDaemon = thread.isDaemon, - priority = thread.priority - ) - - private fun sanitize(list: List<TraceElement>): List<TraceElement> { - var idx = 0 - while (idx < list.size) { - val traceElement = list[idx] - if (traceElement.className == CrashHandler::class.java.canonicalName) - break - idx++ - } - while (idx < list.size) { - val traceElement = list[idx] - if (traceElement.className != CrashHandler::class.java.canonicalName) - break - idx++ - } - val after = mutableListOf<TraceElement>() - while (idx < list.size) { - val traceElement = list[idx] - after.add(traceElement) - idx++ - } - - return if (after.size > 0) { - after - } else list - } -} diff --git a/malheur/src/main/java/de/kuschku/malheur/config/AppConfig.kt b/malheur/src/main/java/de/kuschku/malheur/config/AppConfig.kt deleted file mode 100644 index 1f783e45c42080030b4175dc954188bcffbd707c..0000000000000000000000000000000000000000 --- a/malheur/src/main/java/de/kuschku/malheur/config/AppConfig.kt +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.malheur.config - -data class AppConfig( - val versionName: Boolean = true, - val versionCode: Boolean = true, - val buildConfig: Boolean = true, - val installationSource: Boolean = true -) diff --git a/malheur/src/main/java/de/kuschku/malheur/config/CrashConfig.kt b/malheur/src/main/java/de/kuschku/malheur/config/CrashConfig.kt deleted file mode 100644 index 6cd2d828d320d0ac0f7c7c071dfa05a6bcb3af5e..0000000000000000000000000000000000000000 --- a/malheur/src/main/java/de/kuschku/malheur/config/CrashConfig.kt +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.malheur.config - -data class CrashConfig( - val cause: Boolean = true, - val exception: Boolean = true -) diff --git a/malheur/src/main/java/de/kuschku/malheur/config/DeviceConfig.kt b/malheur/src/main/java/de/kuschku/malheur/config/DeviceConfig.kt deleted file mode 100644 index 228057c21e5e9cb93aaf153a1bc77a2e7ab9de54..0000000000000000000000000000000000000000 --- a/malheur/src/main/java/de/kuschku/malheur/config/DeviceConfig.kt +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.malheur.config - -data class DeviceConfig( - val build: Boolean = true, - val version: Boolean = true, - val installationId: Boolean = true, - val processor: Boolean = true, - val runtime: Boolean = true, - val display: Boolean = true -) diff --git a/malheur/src/main/java/de/kuschku/malheur/config/EnvConfig.kt b/malheur/src/main/java/de/kuschku/malheur/config/EnvConfig.kt deleted file mode 100644 index c1ad3b0de4a9309bb1273a519489dea743e592c3..0000000000000000000000000000000000000000 --- a/malheur/src/main/java/de/kuschku/malheur/config/EnvConfig.kt +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.malheur.config - -data class EnvConfig( - val paths: Boolean = true, - val memory: Boolean = true, - val configuration: Boolean = true, - val startTime: Boolean = true, - val crashTime: Boolean = true -) diff --git a/malheur/src/main/java/de/kuschku/malheur/config/LogConfig.kt b/malheur/src/main/java/de/kuschku/malheur/config/LogConfig.kt deleted file mode 100644 index 490a8ed599b49c8e0e0fd966a11bd2f7da1e649d..0000000000000000000000000000000000000000 --- a/malheur/src/main/java/de/kuschku/malheur/config/LogConfig.kt +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.malheur.config - -data class LogConfig( - val buffers: List<String> = listOf("main", "events", "crash") -) diff --git a/malheur/src/main/java/de/kuschku/malheur/config/ReportConfig.kt b/malheur/src/main/java/de/kuschku/malheur/config/ReportConfig.kt deleted file mode 100644 index 7d89a34346f9bfe8c623d8047cbbcb268b8ec6ee..0000000000000000000000000000000000000000 --- a/malheur/src/main/java/de/kuschku/malheur/config/ReportConfig.kt +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.malheur.config - -data class ReportConfig( - val crash: CrashConfig? = CrashConfig(), - val threads: ThreadConfig? = ThreadConfig(), - val logcat: LogConfig? = LogConfig(), - val application: AppConfig? = AppConfig(), - val device: DeviceConfig? = DeviceConfig(), - val environment: EnvConfig? = EnvConfig() -) diff --git a/malheur/src/main/java/de/kuschku/malheur/config/ThreadConfig.kt b/malheur/src/main/java/de/kuschku/malheur/config/ThreadConfig.kt deleted file mode 100644 index 16d6fa59e315febd4762df3c19820fae54ab25f5..0000000000000000000000000000000000000000 --- a/malheur/src/main/java/de/kuschku/malheur/config/ThreadConfig.kt +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.malheur.config - -data class ThreadConfig( - val current: Boolean = true, - val others: Boolean = true -) diff --git a/malheur/src/main/java/de/kuschku/malheur/data/AppInfo.kt b/malheur/src/main/java/de/kuschku/malheur/data/AppInfo.kt deleted file mode 100644 index 5f0c3d592447c246ea65cc94a210c6a1742b3bcb..0000000000000000000000000000000000000000 --- a/malheur/src/main/java/de/kuschku/malheur/data/AppInfo.kt +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.malheur.data - -data class AppInfo( - val versionName: String?, - val versionCode: Long?, - val buildConfig: Map<String, Any?>?, - val installationSource: String? -) diff --git a/malheur/src/main/java/de/kuschku/malheur/data/CrashInfo.kt b/malheur/src/main/java/de/kuschku/malheur/data/CrashInfo.kt deleted file mode 100644 index 6dec8b59b1c53f52636b0f321aca59a4852e50cd..0000000000000000000000000000000000000000 --- a/malheur/src/main/java/de/kuschku/malheur/data/CrashInfo.kt +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.malheur.data - -data class CrashInfo( - val cause: ExceptionInfo?, - val exception: String? -) diff --git a/malheur/src/main/java/de/kuschku/malheur/data/DeviceInfo.kt b/malheur/src/main/java/de/kuschku/malheur/data/DeviceInfo.kt deleted file mode 100644 index 60b4eaa0495e7932f2ccfdf83c343666f55851a1..0000000000000000000000000000000000000000 --- a/malheur/src/main/java/de/kuschku/malheur/data/DeviceInfo.kt +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.malheur.data - -data class DeviceInfo( - val build: Map<String, Any?>?, - val version: Map<String, Any?>?, - val processor: String?, - val display: DisplayInfo? -) diff --git a/malheur/src/main/java/de/kuschku/malheur/data/DisplayInfo.kt b/malheur/src/main/java/de/kuschku/malheur/data/DisplayInfo.kt deleted file mode 100644 index 28137649dde18bfe62e3b566daf9a9d83b8f6145..0000000000000000000000000000000000000000 --- a/malheur/src/main/java/de/kuschku/malheur/data/DisplayInfo.kt +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.malheur.data - -data class DisplayInfo( - val width: Int, - val height: Int, - val refreshRate: Float, - val hdr: List<String>?, - val isWideGamut: Boolean?, - val metrics: MetricsInfo -) diff --git a/malheur/src/main/java/de/kuschku/malheur/data/EnvInfo.kt b/malheur/src/main/java/de/kuschku/malheur/data/EnvInfo.kt deleted file mode 100644 index 852a9aa156a611c6fbf153b8f2d61b0f898daacb..0000000000000000000000000000000000000000 --- a/malheur/src/main/java/de/kuschku/malheur/data/EnvInfo.kt +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.malheur.data - -data class EnvInfo( - val paths: Map<String, Any?>?, - val memory: MemoryInfo?, - val configuration: Map<String, Any?>?, - val startTime: Long?, - val crashTime: Long? -) diff --git a/malheur/src/main/java/de/kuschku/malheur/data/ExceptionInfo.kt b/malheur/src/main/java/de/kuschku/malheur/data/ExceptionInfo.kt deleted file mode 100644 index a0b0c912f64e9cfe3c582975f5a2340f6336f7b1..0000000000000000000000000000000000000000 --- a/malheur/src/main/java/de/kuschku/malheur/data/ExceptionInfo.kt +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.malheur.data - -data class ExceptionInfo( - val type: String?, - val message: String?, - val localizedMessage: String?, - val stackTrace: List<TraceElement>?, - val cause: ExceptionInfo? -) { - constructor(throwable: Throwable) : this( - type = throwable.javaClass.canonicalName, - message = throwable.message, - localizedMessage = throwable.localizedMessage, - stackTrace = throwable.stackTrace?.map(::TraceElement), - cause = throwable.cause?.let(::ExceptionInfo) - ) -} diff --git a/malheur/src/main/java/de/kuschku/malheur/data/MemoryInfo.kt b/malheur/src/main/java/de/kuschku/malheur/data/MemoryInfo.kt deleted file mode 100644 index 9a0ddd33bdd8c5a99eea9f8eab1d0d78d43e10c5..0000000000000000000000000000000000000000 --- a/malheur/src/main/java/de/kuschku/malheur/data/MemoryInfo.kt +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.malheur.data - -import android.os.Debug - -data class MemoryInfo( - var dalvikPss: Int?, - var dalvikPrivateDirty: Int?, - var dalvikSharedDirty: Int?, - - var nativePss: Int?, - var nativePrivateDirty: Int?, - var nativeSharedDirty: Int?, - - var otherPss: Int?, - var otherPrivateDirty: Int?, - var otherSharedDirty: Int? -) { - constructor(memoryInfo: Debug.MemoryInfo?) : this( - dalvikPss = memoryInfo?.dalvikPss, - dalvikPrivateDirty = memoryInfo?.dalvikPrivateDirty, - dalvikSharedDirty = memoryInfo?.dalvikSharedDirty, - - nativePss = memoryInfo?.nativePss, - nativePrivateDirty = memoryInfo?.nativePrivateDirty, - nativeSharedDirty = memoryInfo?.nativeSharedDirty, - - otherPss = memoryInfo?.otherPss, - otherPrivateDirty = memoryInfo?.otherPrivateDirty, - otherSharedDirty = memoryInfo?.otherSharedDirty - ) -} diff --git a/malheur/src/main/java/de/kuschku/malheur/data/MetricsInfo.kt b/malheur/src/main/java/de/kuschku/malheur/data/MetricsInfo.kt deleted file mode 100644 index 308708871bdf461811a10b7cb9e3b778ddd95686..0000000000000000000000000000000000000000 --- a/malheur/src/main/java/de/kuschku/malheur/data/MetricsInfo.kt +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.malheur.data - -import android.util.DisplayMetrics - -data class MetricsInfo( - val density: Float, - val scaledDensity: Float, - val widthPixels: Int, - val heightPixels: Int, - val xdpi: Float, - val ydpi: Float -) { - constructor(metrics: DisplayMetrics) : this( - density = metrics.density, - scaledDensity = metrics.scaledDensity, - widthPixels = metrics.widthPixels, - heightPixels = metrics.heightPixels, - xdpi = metrics.xdpi, - ydpi = metrics.ydpi - ) -} diff --git a/malheur/src/main/java/de/kuschku/malheur/data/Report.kt b/malheur/src/main/java/de/kuschku/malheur/data/Report.kt deleted file mode 100644 index 5b13196061dea0009e47a0bd0783c402937b70ec..0000000000000000000000000000000000000000 --- a/malheur/src/main/java/de/kuschku/malheur/data/Report.kt +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.malheur.data - -data class Report( - val crash: CrashInfo? = null, - val threads: ThreadsInfo? = null, - val logcat: Map<String, List<String>?>? = null, - val application: AppInfo? = null, - val device: DeviceInfo? = null, - val environment: EnvInfo? = null -) diff --git a/malheur/src/main/java/de/kuschku/malheur/data/ThreadInfo.kt b/malheur/src/main/java/de/kuschku/malheur/data/ThreadInfo.kt deleted file mode 100644 index 40fd06d74ddec5b55e6ca23c47714ebdce35d4b2..0000000000000000000000000000000000000000 --- a/malheur/src/main/java/de/kuschku/malheur/data/ThreadInfo.kt +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.malheur.data - -data class ThreadInfo( - val id: Long?, - val name: String?, - val group: String?, - val status: String?, - val stackTrace: List<TraceElement>?, - val isDaemon: Boolean?, - val priority: Int? -) diff --git a/malheur/src/main/java/de/kuschku/malheur/data/ThreadsInfo.kt b/malheur/src/main/java/de/kuschku/malheur/data/ThreadsInfo.kt deleted file mode 100644 index dd344798c24aaec72986127c5bc458e7512580fc..0000000000000000000000000000000000000000 --- a/malheur/src/main/java/de/kuschku/malheur/data/ThreadsInfo.kt +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.malheur.data - -data class ThreadsInfo( - val crashed: ThreadInfo?, - val others: List<ThreadInfo>? -) diff --git a/malheur/src/main/java/de/kuschku/malheur/data/TraceElement.kt b/malheur/src/main/java/de/kuschku/malheur/data/TraceElement.kt deleted file mode 100644 index c612c4d096941b4ce2c5e26efe0d80f22f9abcc5..0000000000000000000000000000000000000000 --- a/malheur/src/main/java/de/kuschku/malheur/data/TraceElement.kt +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.malheur.data - -data class TraceElement( - val className: String?, - val methodName: String?, - val fileName: String?, - val lineNumber: Int?, - val isNative: Boolean? -) { - constructor(element: StackTraceElement) : this( - className = element.className, - methodName = element.methodName, - fileName = element.fileName, - lineNumber = element.lineNumber, - isNative = element.isNativeMethod - ) -} diff --git a/malheur/src/main/java/de/kuschku/malheur/util/DisplayHelper.kt b/malheur/src/main/java/de/kuschku/malheur/util/DisplayHelper.kt deleted file mode 100644 index ecd6fe0c2d12b5c33453d2692d6c8878c49c2d92..0000000000000000000000000000000000000000 --- a/malheur/src/main/java/de/kuschku/malheur/util/DisplayHelper.kt +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.malheur.util - -import android.util.DisplayMetrics -import android.view.Display - -fun Display.getMetrics(): DisplayMetrics { - val metrics = DisplayMetrics() - getMetrics(metrics) - return metrics -} diff --git a/malheur/src/main/java/de/kuschku/malheur/util/ReflectionHelper.kt b/malheur/src/main/java/de/kuschku/malheur/util/ReflectionHelper.kt deleted file mode 100644 index fd18a0550e3411ad19078a82303df7c963514f9d..0000000000000000000000000000000000000000 --- a/malheur/src/main/java/de/kuschku/malheur/util/ReflectionHelper.kt +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.malheur.util - -fun reflectionCollectConstants(klass: Class<*>?) = klass?.declaredFields - ?.mapNotNull { - var result: Pair<String, Any?>? = null - try { - result = it.name to it.get(null) - } catch (e: IllegalAccessException) { - } catch (e: IllegalArgumentException) { - } - result - }?.toMap() - -fun <T> reflectionCollectGetters(klass: Class<T>?) = klass?.declaredMethods - ?.filter { it.parameterTypes.isEmpty() && it.returnType != Void::class.java } - ?.filter { it.name != "getClass" } - ?.filter { it.name.startsWith("get") || it.name.startsWith("is") } - ?.mapNotNull { - var result: Pair<String, Any?>? = null - try { - result = it.name to it.invoke(it) - } catch (e: IllegalAccessException) { - } catch (e: IllegalArgumentException) { - } - result - }?.toMap() diff --git a/metadata/de-DE/full_description.txt b/metadata/de-DE/full_description.txt deleted file mode 100644 index 0f897635929c72de7eb245f188934fc9e29ad1d5..0000000000000000000000000000000000000000 --- a/metadata/de-DE/full_description.txt +++ /dev/null @@ -1,22 +0,0 @@ -Chat comfortably. Everywhere. - - -BENÖTIGT EINEN QUASSEL CORE – FUNKTIONIERT NICHT OHNE - -• <b>Benutze IRC unterwegs</b> – dank des Quassel Cores wirst du nichts verpassen -• <b>Habe immer alle deine Chats in der Hosentasche</b> – einfach hochscrollen um das zu laden, was du verpasst hast -• <b>Benachrichtigungen, wenn dich jemand anschreibt oder erwähnt</b> – selbst wenn du währenddessen offline warst - -Wenn du nach dem Komfort suchst, den du von modernen Chat Apps kennst, ist Quasseldroid der beste freie Android IRC Client für dich — mit Profilbildern, einem UI basierend auf Material Design, und all den Features, die du liebst. - -Und das Beste an all dem: Es ist komplett umsonst und Open Source. - -<b>Anforderungen:</b> - -Du benötigst einen Account auf einem Quassel Core, um diese App zu nutzen. Wenn du noch keinen hast, kannst du dir entweder einen eigenen Core aufsetzen, oder versuchen, einen Account auf dem Core von jemand anderem zu bekommen. - -Diese App benötigt einen Quassel Core Version 0.10 oder neuer, damit alle Features verfügbar sind wird Quassel Version 0.13 benötigt. - -Um zu lernen, wie du einen Quassel Core selber aufsetzt, lies <a href="http://bugs.quassel-irc.org/projects/quassel-irc/wiki">das Wiki</a>. - -<b>Hast du Probleme oder Anregungen?</b> Schreib uns eine E-Mail an support@kuschku.de \ No newline at end of file diff --git a/metadata/de-DE/short_description.txt b/metadata/de-DE/short_description.txt deleted file mode 100644 index 5a27469ea15c63e39df5bf0b4e411513d9941008..0000000000000000000000000000000000000000 --- a/metadata/de-DE/short_description.txt +++ /dev/null @@ -1,3 +0,0 @@ -Chat comfortably. Everywhere. - -BENÖTIGT EINEN QUASSEL CORE diff --git a/metadata/en-GB/full_description.txt b/metadata/en-GB/full_description.txt deleted file mode 100644 index effa089362f62e629ede8e64040c76cab616cb2d..0000000000000000000000000000000000000000 --- a/metadata/en-GB/full_description.txt +++ /dev/null @@ -1,22 +0,0 @@ -Chat comfortably. Everywhere. - - -REQUIRES A QUASSEL CORE – DOES NOT WORK AS STANDALONE IRC CLIENT - -• <b>Use IRC on the go</b> – thanks to the Quassel core, you’ll never miss anything -• <b>Always have your entire chat history available</b> – just scroll up to load older messages, the core keeps them for you -• <b>Be notified when someone messages you</b> – even if you had no connection in the meantime - -If you are looking for the comfort you’re used to from modern chat apps, Quasseldroid is the best free android IRC client for you — you’ll get profile pictures, a beautiful UI based on Material Design, and all the features you love. - -And best of all, it’s fully free and open source. - -<b>Requirements:</b> - -You need to have an account on a Quassel core to use this app. If you have none, you can either set a core up yourself, or check if you can get an account on someone else’s core. - -This app only works with cores that run at least Quassel v0.10, for all features to be available you’ll need Quassel v0.13 - -To learn about how to set up a quassel core, see <a href="http://bugs.quassel-irc.org/projects/quassel-irc/wiki">the wiki</a> - -<b>Having trouble or feedback?:</b> Send us an email at support@kuschku.de \ No newline at end of file diff --git a/metadata/en-GB/short_description.txt b/metadata/en-GB/short_description.txt deleted file mode 100644 index a51a99cd6e52e4cfae7db3eb36377fee17437528..0000000000000000000000000000000000000000 --- a/metadata/en-GB/short_description.txt +++ /dev/null @@ -1,3 +0,0 @@ -Chat comfortably. Everywhere. - -REQUIRES A QUASSEL CORE \ No newline at end of file diff --git a/metadata/en-US/full_description.txt b/metadata/en-US/full_description.txt deleted file mode 100644 index e76e7a7cc5737915e1e22ff021631d38e2f171e0..0000000000000000000000000000000000000000 --- a/metadata/en-US/full_description.txt +++ /dev/null @@ -1,22 +0,0 @@ -Chat comfortably. Everywhere. - - -REQUIRES A QUASSEL CORE – DOES NOT WORK AS STANDALONE IRC CLIENT - -• <b>Use IRC on the go</b> – thanks to the Quassel core, you’ll never miss anything -• <b>Always have your entire chat history available</b> – just scroll up to load older messages, the core keeps them for you -• <b>Be notified when someone messages you</b> – even if you had no connection in the meantime - -If you are looking for the comfort you’re used to from modern chat apps, Quasseldroid is the best free android IRC client for you — you’ll get profile pictures, a beautiful UI based on Material Design, and all the features you love. - -And best of all, it’s fully free and open source. - -<b>Requirements:</b> - -You need to have an account on a Quassel core to use this app. If you have none, you can either set a core up yourself, or check if you can get an account on someone else’s core. - -This app only works with cores that run at least Quassel v0.10, for all features to be available you’ll need Quassel v0.13 - -To learn about how to set up a quassel core, see <a href="http://bugs.quassel-irc.org/projects/quassel-irc/wiki">the wiki</a> - -<b>Having trouble or feedback?:</b> Send us an email at support@kuschku.de diff --git a/metadata/en-US/images/featureGraphic.png b/metadata/en-US/images/featureGraphic.png deleted file mode 100644 index cfb71417c03f5ae2ed251bfde02032bf8117b21a..0000000000000000000000000000000000000000 Binary files a/metadata/en-US/images/featureGraphic.png and /dev/null differ diff --git a/metadata/en-US/images/icon.png b/metadata/en-US/images/icon.png deleted file mode 100644 index 621c7c940bd79e832fdb60e0abca141712df7ec6..0000000000000000000000000000000000000000 Binary files a/metadata/en-US/images/icon.png and /dev/null differ diff --git a/metadata/en-US/images/phoneScreenshots/01.png b/metadata/en-US/images/phoneScreenshots/01.png deleted file mode 100644 index 2d459b4565f9cd12a211c40244f5510254d4fc11..0000000000000000000000000000000000000000 Binary files a/metadata/en-US/images/phoneScreenshots/01.png and /dev/null differ diff --git a/metadata/en-US/images/phoneScreenshots/02.png b/metadata/en-US/images/phoneScreenshots/02.png deleted file mode 100644 index e4a8aa99b3042b3d151bf45ac83852e30b861bc8..0000000000000000000000000000000000000000 Binary files a/metadata/en-US/images/phoneScreenshots/02.png and /dev/null differ diff --git a/metadata/en-US/images/phoneScreenshots/03.png b/metadata/en-US/images/phoneScreenshots/03.png deleted file mode 100644 index c8319a2055d6cd8df35181ddc5239ece68cfe826..0000000000000000000000000000000000000000 Binary files a/metadata/en-US/images/phoneScreenshots/03.png and /dev/null differ diff --git a/metadata/en-US/images/phoneScreenshots/04.png b/metadata/en-US/images/phoneScreenshots/04.png deleted file mode 100644 index 2f1672b0d1cc19a7a59ef689ee8149b120382ff7..0000000000000000000000000000000000000000 Binary files a/metadata/en-US/images/phoneScreenshots/04.png and /dev/null differ diff --git a/metadata/en-US/images/phoneScreenshots/05.png b/metadata/en-US/images/phoneScreenshots/05.png deleted file mode 100644 index 9722cdb0a93bba40775169ec51b9bf60ea8ab7ab..0000000000000000000000000000000000000000 Binary files a/metadata/en-US/images/phoneScreenshots/05.png and /dev/null differ diff --git a/metadata/en-US/images/phoneScreenshots/06.png b/metadata/en-US/images/phoneScreenshots/06.png deleted file mode 100644 index 7a235a6bee638eef383eeee9997e1e9a649cdcef..0000000000000000000000000000000000000000 Binary files a/metadata/en-US/images/phoneScreenshots/06.png and /dev/null differ diff --git a/metadata/en-US/images/phoneScreenshots/07.png b/metadata/en-US/images/phoneScreenshots/07.png deleted file mode 100644 index 9460f5c4df9837e32bbb7edd35894d4e7a881e14..0000000000000000000000000000000000000000 Binary files a/metadata/en-US/images/phoneScreenshots/07.png and /dev/null differ diff --git a/metadata/en-US/images/phoneScreenshots/08.png b/metadata/en-US/images/phoneScreenshots/08.png deleted file mode 100644 index 0c64cec240699ab685a0510ea50b8a52975c33c4..0000000000000000000000000000000000000000 Binary files a/metadata/en-US/images/phoneScreenshots/08.png and /dev/null differ diff --git a/metadata/en-US/images/sevenInchScreenshots/01.png b/metadata/en-US/images/sevenInchScreenshots/01.png deleted file mode 100644 index 55e33afe4a1ec60b180ee0afe5d2f88c1f5fb2fb..0000000000000000000000000000000000000000 Binary files a/metadata/en-US/images/sevenInchScreenshots/01.png and /dev/null differ diff --git a/metadata/en-US/images/sevenInchScreenshots/02.png b/metadata/en-US/images/sevenInchScreenshots/02.png deleted file mode 100644 index ed0bdd0d700d94f554a628823179acb223156714..0000000000000000000000000000000000000000 Binary files a/metadata/en-US/images/sevenInchScreenshots/02.png and /dev/null differ diff --git a/metadata/en-US/images/sevenInchScreenshots/03.png b/metadata/en-US/images/sevenInchScreenshots/03.png deleted file mode 100644 index 0eba10c9d619b8ff9a62ae2d60d4fded58450f9b..0000000000000000000000000000000000000000 Binary files a/metadata/en-US/images/sevenInchScreenshots/03.png and /dev/null differ diff --git a/metadata/en-US/images/sevenInchScreenshots/04.png b/metadata/en-US/images/sevenInchScreenshots/04.png deleted file mode 100644 index 11e449b68a09b18401319cc603e41fe503b55f68..0000000000000000000000000000000000000000 Binary files a/metadata/en-US/images/sevenInchScreenshots/04.png and /dev/null differ diff --git a/metadata/en-US/images/sevenInchScreenshots/05.png b/metadata/en-US/images/sevenInchScreenshots/05.png deleted file mode 100644 index 978c768bb5361e51e2d8151c395439008feb0994..0000000000000000000000000000000000000000 Binary files a/metadata/en-US/images/sevenInchScreenshots/05.png and /dev/null differ diff --git a/metadata/en-US/images/sevenInchScreenshots/06.png b/metadata/en-US/images/sevenInchScreenshots/06.png deleted file mode 100644 index cc7149fb2c67a6026348e60d382eac77a784c9a2..0000000000000000000000000000000000000000 Binary files a/metadata/en-US/images/sevenInchScreenshots/06.png and /dev/null differ diff --git a/metadata/en-US/images/sevenInchScreenshots/07.png b/metadata/en-US/images/sevenInchScreenshots/07.png deleted file mode 100644 index bf3debd56aae88c33a4e1842cca47ad6e6c8eca1..0000000000000000000000000000000000000000 Binary files a/metadata/en-US/images/sevenInchScreenshots/07.png and /dev/null differ diff --git a/metadata/en-US/images/sevenInchScreenshots/08.png b/metadata/en-US/images/sevenInchScreenshots/08.png deleted file mode 100644 index 01a908ba325c5e6e1971133ff69426f0fdb752de..0000000000000000000000000000000000000000 Binary files a/metadata/en-US/images/sevenInchScreenshots/08.png and /dev/null differ diff --git a/metadata/en-US/images/tenInchScreenshots/01.png b/metadata/en-US/images/tenInchScreenshots/01.png deleted file mode 100644 index 3c1e3add51116643c550e95c6ed7a634c26a6d7d..0000000000000000000000000000000000000000 Binary files a/metadata/en-US/images/tenInchScreenshots/01.png and /dev/null differ diff --git a/metadata/en-US/images/tenInchScreenshots/02.png b/metadata/en-US/images/tenInchScreenshots/02.png deleted file mode 100644 index 65a9ae2b074f4dd2a86fe13051ebf773ad80cd56..0000000000000000000000000000000000000000 Binary files a/metadata/en-US/images/tenInchScreenshots/02.png and /dev/null differ diff --git a/metadata/en-US/images/tenInchScreenshots/03.png b/metadata/en-US/images/tenInchScreenshots/03.png deleted file mode 100644 index 9db30356273a0f00c60bde5f6ee9152f3923c36c..0000000000000000000000000000000000000000 Binary files a/metadata/en-US/images/tenInchScreenshots/03.png and /dev/null differ diff --git a/metadata/en-US/images/tenInchScreenshots/04.png b/metadata/en-US/images/tenInchScreenshots/04.png deleted file mode 100644 index 3baa07adfc1220d9195ba742095dad69dcf63b5f..0000000000000000000000000000000000000000 Binary files a/metadata/en-US/images/tenInchScreenshots/04.png and /dev/null differ diff --git a/metadata/en-US/images/tenInchScreenshots/05.png b/metadata/en-US/images/tenInchScreenshots/05.png deleted file mode 100644 index 80301658541d53002edfc8690724c7a3d6e0492a..0000000000000000000000000000000000000000 Binary files a/metadata/en-US/images/tenInchScreenshots/05.png and /dev/null differ diff --git a/metadata/en-US/images/tenInchScreenshots/06.png b/metadata/en-US/images/tenInchScreenshots/06.png deleted file mode 100644 index ddb542992d51809da9da3c0868e529c9da49520b..0000000000000000000000000000000000000000 Binary files a/metadata/en-US/images/tenInchScreenshots/06.png and /dev/null differ diff --git a/metadata/en-US/images/tenInchScreenshots/07.png b/metadata/en-US/images/tenInchScreenshots/07.png deleted file mode 100644 index 8dfec463cb7064e7f797adc4240f741875aa3846..0000000000000000000000000000000000000000 Binary files a/metadata/en-US/images/tenInchScreenshots/07.png and /dev/null differ diff --git a/metadata/en-US/images/tenInchScreenshots/08.png b/metadata/en-US/images/tenInchScreenshots/08.png deleted file mode 100644 index 1ba3ba95305e4ea19ca4a53856224b9ad11f5c89..0000000000000000000000000000000000000000 Binary files a/metadata/en-US/images/tenInchScreenshots/08.png and /dev/null differ diff --git a/metadata/en-US/short_description.txt b/metadata/en-US/short_description.txt deleted file mode 100644 index fc7a4d3c51c333ee96afde4d214dcc3d6e802a94..0000000000000000000000000000000000000000 --- a/metadata/en-US/short_description.txt +++ /dev/null @@ -1,3 +0,0 @@ -Chat comfortably. Everywhere. - -REQUIRES A QUASSEL CORE diff --git a/metadata/en-US/title.txt b/metadata/en-US/title.txt deleted file mode 100644 index d9a6f316c59f1bc2a8e7f7f1c32c2959e110caf9..0000000000000000000000000000000000000000 --- a/metadata/en-US/title.txt +++ /dev/null @@ -1 +0,0 @@ -Quasseldroid IRC diff --git a/metadata/fr-CA/full_description.txt b/metadata/fr-CA/full_description.txt deleted file mode 100644 index effa089362f62e629ede8e64040c76cab616cb2d..0000000000000000000000000000000000000000 --- a/metadata/fr-CA/full_description.txt +++ /dev/null @@ -1,22 +0,0 @@ -Chat comfortably. Everywhere. - - -REQUIRES A QUASSEL CORE – DOES NOT WORK AS STANDALONE IRC CLIENT - -• <b>Use IRC on the go</b> – thanks to the Quassel core, you’ll never miss anything -• <b>Always have your entire chat history available</b> – just scroll up to load older messages, the core keeps them for you -• <b>Be notified when someone messages you</b> – even if you had no connection in the meantime - -If you are looking for the comfort you’re used to from modern chat apps, Quasseldroid is the best free android IRC client for you — you’ll get profile pictures, a beautiful UI based on Material Design, and all the features you love. - -And best of all, it’s fully free and open source. - -<b>Requirements:</b> - -You need to have an account on a Quassel core to use this app. If you have none, you can either set a core up yourself, or check if you can get an account on someone else’s core. - -This app only works with cores that run at least Quassel v0.10, for all features to be available you’ll need Quassel v0.13 - -To learn about how to set up a quassel core, see <a href="http://bugs.quassel-irc.org/projects/quassel-irc/wiki">the wiki</a> - -<b>Having trouble or feedback?:</b> Send us an email at support@kuschku.de \ No newline at end of file diff --git a/metadata/fr-CA/short_description.txt b/metadata/fr-CA/short_description.txt deleted file mode 100644 index a51a99cd6e52e4cfae7db3eb36377fee17437528..0000000000000000000000000000000000000000 --- a/metadata/fr-CA/short_description.txt +++ /dev/null @@ -1,3 +0,0 @@ -Chat comfortably. Everywhere. - -REQUIRES A QUASSEL CORE \ No newline at end of file diff --git a/metadata/fr-FR/full_description.txt b/metadata/fr-FR/full_description.txt deleted file mode 100644 index effa089362f62e629ede8e64040c76cab616cb2d..0000000000000000000000000000000000000000 --- a/metadata/fr-FR/full_description.txt +++ /dev/null @@ -1,22 +0,0 @@ -Chat comfortably. Everywhere. - - -REQUIRES A QUASSEL CORE – DOES NOT WORK AS STANDALONE IRC CLIENT - -• <b>Use IRC on the go</b> – thanks to the Quassel core, you’ll never miss anything -• <b>Always have your entire chat history available</b> – just scroll up to load older messages, the core keeps them for you -• <b>Be notified when someone messages you</b> – even if you had no connection in the meantime - -If you are looking for the comfort you’re used to from modern chat apps, Quasseldroid is the best free android IRC client for you — you’ll get profile pictures, a beautiful UI based on Material Design, and all the features you love. - -And best of all, it’s fully free and open source. - -<b>Requirements:</b> - -You need to have an account on a Quassel core to use this app. If you have none, you can either set a core up yourself, or check if you can get an account on someone else’s core. - -This app only works with cores that run at least Quassel v0.10, for all features to be available you’ll need Quassel v0.13 - -To learn about how to set up a quassel core, see <a href="http://bugs.quassel-irc.org/projects/quassel-irc/wiki">the wiki</a> - -<b>Having trouble or feedback?:</b> Send us an email at support@kuschku.de \ No newline at end of file diff --git a/metadata/fr-FR/short_description.txt b/metadata/fr-FR/short_description.txt deleted file mode 100644 index a51a99cd6e52e4cfae7db3eb36377fee17437528..0000000000000000000000000000000000000000 --- a/metadata/fr-FR/short_description.txt +++ /dev/null @@ -1,3 +0,0 @@ -Chat comfortably. Everywhere. - -REQUIRES A QUASSEL CORE \ No newline at end of file diff --git a/metadata/it-IT/full_description.txt b/metadata/it-IT/full_description.txt deleted file mode 100644 index 2037cdd2ac00489e15955d2c8dd714114c730ec2..0000000000000000000000000000000000000000 --- a/metadata/it-IT/full_description.txt +++ /dev/null @@ -1,22 +0,0 @@ -La chat diventa comoda. Ovunque. - - -È NECESSARIO UN CORE QUASSEL – NON FUNZIONA COME CLIENT IRC A SÉ STANTE - -• <b>Usa IRC in movimento</b> – grazie al core Quassel core non perderai mai nulla -• <b>Avrai sempre a disposizione il registro storico delle chat</b> – basta scorrere verso l’alto per caricare i messaggi meno recenti, il core li conserva per te -• <b>Ricevi una notifica quando qualcuno ti scrive un messaggio</b> – anche se nel frattempo non avevi connessione - -Se cerchi un’app di chat comoda e moderna, Quasseldroid è la tua miglior scelta per avere su android un client IRC gratuito — troverai avatar, una bellissima interfaccia grafica basata sul Material Design e tutte le funzionalità che già ami. - -E, qui arriva il bello, è completamente gratuita ed open source. - -<b>Requisiti:</b> - -È necessario disporre di un account su un core Quassel per utilizzare questa app. Se non lo hai, puoi configurare tu stesso un core, oppure potresti avere la possibilità di avere un account sul core di qualcun altro. - -Questa app funziona solo con core che eseguono almeno Quassel v0.10, per usufruire di tutte le funzionalità disponibili avrai bisogno di Quassel v0.13 - -Per saperne di più su come configurare un core quassel, consulta <a href="http://bugs.quassel-irc.org/projects/quassel-irc/wiki">la wiki</a> - -<b>Vuoi segnalare un malfunzionamento o darci un suggerimento?:</b> Inviaci un'email a support@kuschku.de \ No newline at end of file diff --git a/metadata/it-IT/short_description.txt b/metadata/it-IT/short_description.txt deleted file mode 100644 index 646222cdf78da0639859bf36ddefc4aec566adaf..0000000000000000000000000000000000000000 --- a/metadata/it-IT/short_description.txt +++ /dev/null @@ -1,3 +0,0 @@ -La chat diventa comoda. Ovunque. - -È NECESSARIO UN CORE QUASSEL diff --git a/metadata/lt/full_description.txt b/metadata/lt/full_description.txt deleted file mode 100644 index 45ab87e24a7d5d9b9705320b2c221f8e4a2e35ea..0000000000000000000000000000000000000000 --- a/metadata/lt/full_description.txt +++ /dev/null @@ -1,22 +0,0 @@ -Bendraukite patogiai. Visur ir visada. - - -REIKALINGAS QUASSEL BRANDUOLYS - PROGRAMA NEVEIKS KAIP VISIŠKAI SAVARANKIŠKAS IRC KLIENTAS - -• <b>Naudokite IRC bet kur</b> – Quassel branduolio dėka, niekada nieko nepraleisite -• <b>Visada prieinama jūsų pokalbių istorija</b> – tiesiog slinkite į viršų, jog branduolys jums rodytų senas žinutes -• <b>Gaukite pranešimus</b> – net jeigu tuo metu neturėjote interneto ryšio - -If you are looking for the comfort you’re used to from modern chat apps, Quasseldroid is the best free android IRC client for you — you’ll get profile pictures, a beautiful UI based on Material Design, and all the features you love. - -Ir geriausia tai, jog programa visiškai nemokama ir atviro kodo. - -<b>Reikalavimai:</b> - -Jums reikia turėti Quassel branduolio paskyrą norint naudotis šia programa. Jeigu jos neturite, galite susikurti savo branduolį, arba pasiteirauti paskyros pas tuos kurie turi jau egzistuojantį branduolį. - -Ši programa veikia tik su branduoliais kurie yra ne senesni nei Quassel v0.10. Norint naudotis visomis funkcijomis reikalingas Quassel v0.13 - -Norint išmokti kaip susikurti savo branduolį, paskaitykite <a href="http://bugs.quassel-irc.org/projects/quassel-irc/wiki">wiki</a> - -<b>Radote problemų ar turite pasiūlymų?:</b> Susisiekite su mumis elektroniniu paštu - support@kuschku.de \ No newline at end of file diff --git a/metadata/lt/short_description.txt b/metadata/lt/short_description.txt deleted file mode 100644 index fc4b5b3ae31e1908057c18b22c411ec2d2d873c2..0000000000000000000000000000000000000000 --- a/metadata/lt/short_description.txt +++ /dev/null @@ -1,3 +0,0 @@ -Bendraukite patogiai. Visur ir visada. - -REIKALINGAS QUASSEL BRANDUOLYS \ No newline at end of file diff --git a/metadata/nl-NL/full_description.txt b/metadata/nl-NL/full_description.txt deleted file mode 100644 index effa089362f62e629ede8e64040c76cab616cb2d..0000000000000000000000000000000000000000 --- a/metadata/nl-NL/full_description.txt +++ /dev/null @@ -1,22 +0,0 @@ -Chat comfortably. Everywhere. - - -REQUIRES A QUASSEL CORE – DOES NOT WORK AS STANDALONE IRC CLIENT - -• <b>Use IRC on the go</b> – thanks to the Quassel core, you’ll never miss anything -• <b>Always have your entire chat history available</b> – just scroll up to load older messages, the core keeps them for you -• <b>Be notified when someone messages you</b> – even if you had no connection in the meantime - -If you are looking for the comfort you’re used to from modern chat apps, Quasseldroid is the best free android IRC client for you — you’ll get profile pictures, a beautiful UI based on Material Design, and all the features you love. - -And best of all, it’s fully free and open source. - -<b>Requirements:</b> - -You need to have an account on a Quassel core to use this app. If you have none, you can either set a core up yourself, or check if you can get an account on someone else’s core. - -This app only works with cores that run at least Quassel v0.10, for all features to be available you’ll need Quassel v0.13 - -To learn about how to set up a quassel core, see <a href="http://bugs.quassel-irc.org/projects/quassel-irc/wiki">the wiki</a> - -<b>Having trouble or feedback?:</b> Send us an email at support@kuschku.de \ No newline at end of file diff --git a/metadata/nl-NL/short_description.txt b/metadata/nl-NL/short_description.txt deleted file mode 100644 index a51a99cd6e52e4cfae7db3eb36377fee17437528..0000000000000000000000000000000000000000 --- a/metadata/nl-NL/short_description.txt +++ /dev/null @@ -1,3 +0,0 @@ -Chat comfortably. Everywhere. - -REQUIRES A QUASSEL CORE \ No newline at end of file diff --git a/metadata/pt-PT/full_description.txt b/metadata/pt-PT/full_description.txt deleted file mode 100644 index 83cad67ff8bf556a41aaf43d24f6cc11499046a9..0000000000000000000000000000000000000000 --- a/metadata/pt-PT/full_description.txt +++ /dev/null @@ -1,22 +0,0 @@ -Converse confortavelmente. Em qualquer lugar. - - -REQUER UM NÚCLEO QUASSEL - NÃO FUNCIONA COMO CLIENTE DE IRC SOZINHO - -• <b>Use o IRC em movimento</b> – graças ao núcleo Quassel, você nunca perderá nada -• Tenha sempre todo o seu histórico de chat disponível</b> – basta rolar para cima para carregar mensagens mais antigas, o núcleo guarda-as para si -• <b>Seja notificado quando alguém lhe enviar uma mensagem</b> – mesmo se você não tivesse conexão nesse meio tempo - -If you are looking for the comfort you’re used to from modern chat apps, Quasseldroid is the best free android IRC client for you — you’ll get profile pictures, a beautiful UI based on Material Design, and all the features you love. - -E o melhor de tudo, é completamente gratuito e de fonte aberta. - -<b>Requisitos:</b> - -Você precisa ter uma conta num núcleo Quassel para usar esta aplicação. Se você não tem nenhum, pode criar o seu próprio núcleo ou tentar onter uma conta no núcleo de outra pessoa. - -Esta aplicação só funciona com núcleos que utilizam pelo menos o Quassel v0.10. Para que todas as funcionalidades estejam disponíveis, você precisará do Quassel v0.13 - -Para aprender sobre como configurar um núcleo quassel, veja <a href="http://bugs.quassel-irc.org/projects/quassel-irc/wiki">a wiki</a> - -<b>Com problemas ou apenas feedback?:</b> Envie um email para support@kuschku.de \ No newline at end of file diff --git a/metadata/pt-PT/short_description.txt b/metadata/pt-PT/short_description.txt deleted file mode 100644 index 1d1ed69ed156735fda114ab5dff3b55dacefa67f..0000000000000000000000000000000000000000 --- a/metadata/pt-PT/short_description.txt +++ /dev/null @@ -1,3 +0,0 @@ -Converse confortavelmente. Em qualquer lugar. - -REQUER UM NÚCLEO QUASSEL diff --git a/metadata/sr/full_description.txt b/metadata/sr/full_description.txt deleted file mode 100644 index effa089362f62e629ede8e64040c76cab616cb2d..0000000000000000000000000000000000000000 --- a/metadata/sr/full_description.txt +++ /dev/null @@ -1,22 +0,0 @@ -Chat comfortably. Everywhere. - - -REQUIRES A QUASSEL CORE – DOES NOT WORK AS STANDALONE IRC CLIENT - -• <b>Use IRC on the go</b> – thanks to the Quassel core, you’ll never miss anything -• <b>Always have your entire chat history available</b> – just scroll up to load older messages, the core keeps them for you -• <b>Be notified when someone messages you</b> – even if you had no connection in the meantime - -If you are looking for the comfort you’re used to from modern chat apps, Quasseldroid is the best free android IRC client for you — you’ll get profile pictures, a beautiful UI based on Material Design, and all the features you love. - -And best of all, it’s fully free and open source. - -<b>Requirements:</b> - -You need to have an account on a Quassel core to use this app. If you have none, you can either set a core up yourself, or check if you can get an account on someone else’s core. - -This app only works with cores that run at least Quassel v0.10, for all features to be available you’ll need Quassel v0.13 - -To learn about how to set up a quassel core, see <a href="http://bugs.quassel-irc.org/projects/quassel-irc/wiki">the wiki</a> - -<b>Having trouble or feedback?:</b> Send us an email at support@kuschku.de \ No newline at end of file diff --git a/metadata/sr/short_description.txt b/metadata/sr/short_description.txt deleted file mode 100644 index a51a99cd6e52e4cfae7db3eb36377fee17437528..0000000000000000000000000000000000000000 --- a/metadata/sr/short_description.txt +++ /dev/null @@ -1,3 +0,0 @@ -Chat comfortably. Everywhere. - -REQUIRES A QUASSEL CORE \ No newline at end of file diff --git a/persistence/build.gradle.kts b/persistence/build.gradle.kts deleted file mode 100644 index 1a91c005edbc0643b997f5a780581d0af6581959..0000000000000000000000000000000000000000 --- a/persistence/build.gradle.kts +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2018 Janne Mareike Koschinski - * Copyright (c) 2018 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -plugins { - id("com.android.library") - kotlin("android") - kotlin("kapt") -} - -android { - compileSdkVersion(29) - - defaultConfig { - minSdkVersion(20) - targetSdkVersion(29) - - consumerProguardFiles("proguard-rules.pro") - - javaCompileOptions { - annotationProcessorOptions { - arguments = mapOf("room.schemaLocation" to "$projectDir/schemas") - } - } - - // Disable test runner analytics - testInstrumentationRunnerArguments = mapOf( - "disableAnalytics" to "true" - ) - } - - lintOptions { - isWarningsAsErrors = true - setLintConfig(file("../lint.xml")) - } -} - -dependencies { - implementation(kotlin("stdlib", "1.3.72")) - - implementation("androidx.appcompat", "appcompat", "1.1.0") - - withVersion("2.2.5") { - implementation("androidx.room", "room-runtime", version) - kapt("androidx.room", "room-compiler", version) - implementation("androidx.room", "room-rxjava2", version) - testImplementation("androidx.room", "room-testing", version) - } - - implementation("androidx.paging", "paging-runtime", "2.1.2") - - // Utility - implementation("org.threeten", "threetenbp", "1.4.0", classifier = "no-tzdb") - implementation("org.jetbrains", "annotations", "17.0.0") - - // Quassel - implementation(project(":lib")) { - exclude(group = "org.threeten", module = "threetenbp") - } -} diff --git a/persistence/proguard-rules.pro b/persistence/proguard-rules.pro deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/persistence/src/main/AndroidManifest.xml b/persistence/src/main/AndroidManifest.xml deleted file mode 100644 index 2072478a4ecf226594050e6eb849e5837144a951..0000000000000000000000000000000000000000 --- a/persistence/src/main/AndroidManifest.xml +++ /dev/null @@ -1,20 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2019 Janne Mareike Koschinski - Copyright (c) 2019 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<manifest package="de.kuschku.quasseldroid.persistence" /> diff --git a/persistence/src/main/java/de/kuschku/quasseldroid/persistence/dao/AccountDao.kt b/persistence/src/main/java/de/kuschku/quasseldroid/persistence/dao/AccountDao.kt deleted file mode 100644 index ccc784296df66e0b8fab0a5f5ae57280d93652bd..0000000000000000000000000000000000000000 --- a/persistence/src/main/java/de/kuschku/quasseldroid/persistence/dao/AccountDao.kt +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.persistence.dao - -import androidx.lifecycle.LiveData -import androidx.room.* -import de.kuschku.quasseldroid.persistence.models.Account -import de.kuschku.quasseldroid.persistence.util.AccountId -import io.reactivex.Flowable - -@Dao -interface AccountDao { - @Insert(onConflict = OnConflictStrategy.REPLACE) - fun save(vararg entities: Account) - - @Insert(onConflict = OnConflictStrategy.IGNORE) - fun _create(vararg entities: Account): Array<Long> - - @Query("SELECT * FROM account WHERE id = :id") - fun _findById(id: Long): Account? - - @Query("SELECT * FROM account WHERE id = :id") - fun _listen(id: Long): LiveData<Account?> - - @Query("SELECT IFNULL(t.defaultFiltered, :defaultValue) FROM (SELECT defaultFiltered FROM account WHERE id = :id UNION SELECT NULL ORDER BY defaultFiltered DESC LIMIT 1) t") - fun _listenDefaultFiltered(id: Long, defaultValue: Int): Flowable<Int> - - @Query("SELECT * FROM account ORDER BY lastUsed DESC") - fun all(): LiveData<List<Account>> - - @Delete - fun delete(account: Account) - - @Query("UPDATE account SET defaultFiltered = :defaultFiltered WHERE id = :id") - fun _setFiltered(id: Long, defaultFiltered: Int) - - @Query("DELETE FROM account") - fun clear() -} - - -fun AccountDao.create(vararg entities: Account): List<AccountId> = - _create(*entities).map(::AccountId) - -fun AccountDao.findById(id: AccountId): Account? = - _findById(id.id) - -fun AccountDao.listen(id: AccountId): LiveData<Account?> = - _listen(id.id) - -fun AccountDao.listenDefaultFiltered(id: AccountId, defaultValue: Int): Flowable<Int> = - _listenDefaultFiltered(id.id, defaultValue) - -fun AccountDao.setFiltered(id: AccountId, defaultFiltered: Int) = - _setFiltered(id.id, defaultFiltered) diff --git a/persistence/src/main/java/de/kuschku/quasseldroid/persistence/dao/FilteredDao.kt b/persistence/src/main/java/de/kuschku/quasseldroid/persistence/dao/FilteredDao.kt deleted file mode 100644 index 862d4ca5f782c8a91f526a517da26e5e1aac0945..0000000000000000000000000000000000000000 --- a/persistence/src/main/java/de/kuschku/quasseldroid/persistence/dao/FilteredDao.kt +++ /dev/null @@ -1,89 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ -@file:Suppress("NOTHING_TO_INLINE") - -package de.kuschku.quasseldroid.persistence.dao - -import androidx.lifecycle.LiveData -import androidx.room.Dao -import androidx.room.Insert -import androidx.room.OnConflictStrategy -import androidx.room.Query -import de.kuschku.libquassel.protocol.BufferId -import de.kuschku.libquassel.protocol.BufferId_Type -import de.kuschku.quasseldroid.persistence.models.Filtered -import de.kuschku.quasseldroid.persistence.util.AccountId -import io.reactivex.Flowable - -@Dao -interface FilteredDao { - @Query("SELECT DISTINCT bufferId FROM filtered WHERE accountId = :accountId") - fun _buffers(accountId: Long): List<BufferId_Type> - - @Insert(onConflict = OnConflictStrategy.REPLACE) - fun replace(vararg entities: Filtered) - - @Query("UPDATE filtered SET filtered = :filtered WHERE accountId = :accountId AND bufferId = :bufferId") - fun _setFiltered(accountId: Long, bufferId: BufferId_Type, filtered: Int) - - @Query("SELECT IFNULL(t.filtered, :defaultValue) FROM (SELECT filtered FROM filtered WHERE bufferId = :bufferId AND accountId = :accountId UNION SELECT NULL ORDER BY filtered DESC LIMIT 1) t") - fun _get(accountId: Long, bufferId: BufferId_Type, defaultValue: Int): Int - - @Query("SELECT * FROM filtered WHERE accountId = :accountId") - fun _listen(accountId: Long): LiveData<List<Filtered>> - - @Query("SELECT * FROM filtered WHERE accountId = :accountId") - fun _listenRx(accountId: Long): Flowable<List<Filtered>> - - @Query("SELECT IFNULL(t.filtered, :defaultValue) FROM (SELECT filtered FROM filtered WHERE bufferId = :bufferId AND accountId = :accountId UNION SELECT NULL ORDER BY filtered DESC LIMIT 1) t") - fun _listen(accountId: Long, bufferId: BufferId_Type, defaultValue: Int): LiveData<Int> - - @Query("DELETE FROM filtered") - fun clear() - - @Query("DELETE FROM filtered WHERE accountId = :accountId") - fun _clear(accountId: Long) - - @Query("DELETE FROM filtered WHERE bufferId = :bufferId AND accountId = :accountId") - fun _clear(accountId: Long, bufferId: BufferId_Type) -} - -inline fun FilteredDao.buffers(accountId: AccountId) = - _buffers(accountId.id).map(::BufferId) - -inline fun FilteredDao.setFiltered(accountId: AccountId, bufferId: BufferId, filtered: Int) = - _setFiltered(accountId.id, bufferId.id, filtered) - -inline fun FilteredDao.get(accountId: AccountId, bufferId: BufferId, defaultValue: Int) = - _get(accountId.id, bufferId.id, defaultValue) - -inline fun FilteredDao.listen(accountId: AccountId) = - _listen(accountId.id) - -inline fun FilteredDao.listenRx(accountId: AccountId) = - _listenRx(accountId.id) - -inline fun FilteredDao.listen(accountId: AccountId, bufferId: BufferId, defaultValue: Int) = - _listen(accountId.id, bufferId.id, defaultValue) - -inline fun FilteredDao.clear(accountId: AccountId) = - _clear(accountId.id) - -inline fun FilteredDao.clear(accountId: AccountId, bufferId: BufferId) = - _clear(accountId.id, bufferId.id) diff --git a/persistence/src/main/java/de/kuschku/quasseldroid/persistence/dao/LegacyAccountDao.kt b/persistence/src/main/java/de/kuschku/quasseldroid/persistence/dao/LegacyAccountDao.kt deleted file mode 100644 index a042e518b5889565eb93b5555b20849f3be3a4f9..0000000000000000000000000000000000000000 --- a/persistence/src/main/java/de/kuschku/quasseldroid/persistence/dao/LegacyAccountDao.kt +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.persistence.dao - -import androidx.room.Dao -import androidx.room.Query -import de.kuschku.quasseldroid.persistence.models.LegacyAccount - -@Dao -interface LegacyAccountDao { - @Query("SELECT * FROM account") - fun all(): List<LegacyAccount> -} diff --git a/persistence/src/main/java/de/kuschku/quasseldroid/persistence/dao/MessageDao.kt b/persistence/src/main/java/de/kuschku/quasseldroid/persistence/dao/MessageDao.kt deleted file mode 100644 index a965ef9aadc9ffaf5e39a16b4e0652590d54d1d1..0000000000000000000000000000000000000000 --- a/persistence/src/main/java/de/kuschku/quasseldroid/persistence/dao/MessageDao.kt +++ /dev/null @@ -1,153 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ -@file:Suppress("NOTHING_TO_INLINE") - -package de.kuschku.quasseldroid.persistence.dao - -import androidx.lifecycle.LiveData -import androidx.paging.DataSource -import androidx.room.Dao -import androidx.room.Insert -import androidx.room.OnConflictStrategy -import androidx.room.Query -import de.kuschku.libquassel.protocol.* -import de.kuschku.quasseldroid.persistence.models.MessageData -import io.reactivex.Flowable - -@Dao -interface MessageDao { - @Query("SELECT * FROM message") - fun all(): List<MessageData> - - @Query("SELECT DISTINCT bufferId FROM message") - fun _buffers(): List<BufferId_Type> - - @Query("SELECT * FROM message WHERE messageId = :messageId") - fun find(messageId: MsgId_Type): MessageData? - - @Query("SELECT * FROM message WHERE bufferId = :bufferId ORDER BY messageId ASC") - fun _findByBufferId(bufferId: BufferId_Type): List<MessageData> - - @Query("SELECT * FROM message WHERE (bufferId = :bufferId AND type & ~ :type > 0 AND ignored = 0) OR (networkId = :networkId AND type & 2 > 0 AND ignored = 0 AND currentBufferId = :bufferId AND currentBufferType = 4 AND :showUserNotices != 0) OR (bufferId = :serverBufferId AND type & 2 > 0 AND ignored = 0 AND currentBufferId = :bufferId AND currentBufferType = 1 AND :showServerNotices != 0) OR (bufferId = :serverBufferId AND type & 4096 > 0 AND ignored = 0 AND currentBufferId = :bufferId AND :showErrors != 0) ORDER BY messageId DESC") - fun _findByBufferIdPaged(networkId: NetworkId_Type, serverBufferId: BufferId_Type, - bufferId: BufferId_Type, type: Int, - showUserNotices: Boolean, showServerNotices: Boolean, - showErrors: Boolean): DataSource.Factory<Int, MessageData> - - @Query("SELECT * FROM message WHERE bufferId = :bufferId ORDER BY messageId DESC LIMIT 1") - fun _findLastByBufferId(bufferId: BufferId_Type): MessageData? - - @Query("SELECT * FROM message WHERE bufferId = :bufferId ORDER BY messageId DESC LIMIT 1") - fun _lastMsgId(bufferId: BufferId_Type): LiveData<MessageData> - - @Query("SELECT messageId FROM message WHERE bufferId = :bufferId ORDER BY messageId ASC LIMIT 1") - fun _firstMsgId(bufferId: BufferId_Type): Flowable<MsgId_Type> - - @Query("SELECT messageId FROM message WHERE (bufferId = :bufferId AND type & ~ :type > 0 AND ignored = 0) OR (networkId = :networkId AND type & 2 > 0 AND ignored = 0 AND currentBufferId = :bufferId AND currentBufferType = 4 AND :showUserNotices != 0) OR (bufferId = :serverBufferId AND type & 2 > 0 AND ignored = 0 AND currentBufferId = :bufferId AND currentBufferType = 1 AND :showServerNotices != 0) OR (bufferId = :serverBufferId AND type & 4096 > 0 AND ignored = 0 AND currentBufferId = :bufferId AND :showErrors != 0) ORDER BY messageId ASC LIMIT 1") - fun _firstVisibleMsgId(networkId: NetworkId_Type, serverBufferId: BufferId_Type, - bufferId: BufferId_Type, type: Int, - showUserNotices: Boolean, showServerNotices: Boolean, - showErrors: Boolean): MsgId_Type? - - @Query("SELECT * FROM message WHERE bufferId = :bufferId ORDER BY messageId ASC LIMIT 1") - fun _findFirstByBufferId(bufferId: BufferId_Type): MessageData? - - @Query("SELECT EXISTS(SELECT 1 FROM message WHERE (bufferId = :bufferId AND type & ~ :type > 0 AND ignored = 0) OR (networkId = :networkId AND type & 2 > 0 AND ignored = 0 AND currentBufferId = :bufferId AND currentBufferType = 4 AND :showUserNotices != 0) OR (bufferId = :serverBufferId AND type & 2 > 0 AND ignored = 0 AND currentBufferId = :bufferId AND currentBufferType = 1 AND :showServerNotices != 0) OR (bufferId = :serverBufferId AND type & 4096 > 0 AND ignored = 0 AND currentBufferId = :bufferId AND :showErrors != 0))") - fun _hasVisibleMessages(networkId: NetworkId_Type, serverBufferId: BufferId_Type, - bufferId: BufferId_Type, type: Int, - showUserNotices: Boolean, showServerNotices: Boolean, - showErrors: Boolean): Boolean - - @Insert(onConflict = OnConflictStrategy.REPLACE) - fun save(vararg entities: MessageData) - - @Query("UPDATE message SET bufferId = :bufferId1 WHERE bufferId = :bufferId2") - fun _merge(bufferId1: BufferId_Type, bufferId2: BufferId_Type) - - @Query("SELECT count(*) FROM message WHERE bufferId = :bufferId") - fun _bufferSize(bufferId: BufferId_Type): Int - - @Query("DELETE FROM message") - fun clearMessages() - - @Query("DELETE FROM message WHERE bufferId = :bufferId") - fun clearMessages(bufferId: BufferId_Type) - - @Query( - "DELETE FROM message WHERE bufferId = :bufferId AND messageId >= :first AND messageId <= :last" - ) - fun clearMessages(bufferId: BufferId_Type, first: MsgId_Type, last: MsgId_Type) -} - -inline fun MessageDao.buffers() = - _buffers().map { BufferId(it) } - -inline fun MessageDao.findByBufferId(bufferId: BufferId) = - _findByBufferId(bufferId.id) - -inline fun MessageDao.findByBufferIdPaged(networkId: NetworkId, serverBufferId: BufferId, - bufferId: BufferId, type: Int, showServerNotices: Boolean, - showUserNotices: Boolean, showErrors: Boolean) = - _findByBufferIdPaged(networkId.id, - serverBufferId.id, - bufferId.id, - type, - showServerNotices, - showUserNotices, - showErrors) - -inline fun MessageDao.findLastByBufferId(bufferId: BufferId) = - _findLastByBufferId(bufferId.id) - -inline fun MessageDao.lastMsgId(bufferId: BufferId) = - _lastMsgId(bufferId.id) - -inline fun MessageDao.firstMsgId(bufferId: BufferId) = - _firstMsgId(bufferId.id).map(::MsgId) - -inline fun MessageDao.firstVisibleMsgId(networkId: NetworkId, serverBufferId: BufferId, - bufferId: BufferId, type: Int, showUserNotices: Boolean, - showServerNotices: Boolean, showErrors: Boolean) = - _firstVisibleMsgId(networkId.id, - serverBufferId.id, - bufferId.id, - type, - showUserNotices, - showServerNotices, - showErrors)?.let(::MsgId) - -inline fun MessageDao.findFirstByBufferId(bufferId: BufferId) = - _findFirstByBufferId(bufferId.id) - -inline fun MessageDao.hasVisibleMessages(networkId: NetworkId, serverBufferId: BufferId, - bufferId: BufferId, type: Int, showUserNotices: Boolean, - showServerNotices: Boolean, showErrors: Boolean) = - _hasVisibleMessages(networkId.id, - serverBufferId.id, - bufferId.id, - type, - showUserNotices, - showServerNotices, - showErrors) - -inline fun MessageDao.merge(bufferId1: BufferId, bufferId2: BufferId) = - _merge(bufferId1.id, bufferId2.id) - -inline fun MessageDao.bufferSize(bufferId: BufferId) = - _bufferSize(bufferId.id) diff --git a/persistence/src/main/java/de/kuschku/quasseldroid/persistence/dao/NotificationDao.kt b/persistence/src/main/java/de/kuschku/quasseldroid/persistence/dao/NotificationDao.kt deleted file mode 100644 index f900a9939a8e66158ceebccc1a397e1b4dd55776..0000000000000000000000000000000000000000 --- a/persistence/src/main/java/de/kuschku/quasseldroid/persistence/dao/NotificationDao.kt +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ -@file:Suppress("NOTHING_TO_INLINE") - -package de.kuschku.quasseldroid.persistence.dao - -import androidx.room.Dao -import androidx.room.Insert -import androidx.room.OnConflictStrategy -import androidx.room.Query -import de.kuschku.libquassel.protocol.BufferId -import de.kuschku.libquassel.protocol.BufferId_Type -import de.kuschku.libquassel.protocol.MsgId -import de.kuschku.libquassel.protocol.MsgId_Type -import de.kuschku.quasseldroid.persistence.models.NotificationData - -@Dao -interface NotificationDao { - @Insert(onConflict = OnConflictStrategy.IGNORE) - fun save(vararg entities: NotificationData) - - @Query("SELECT DISTINCT bufferId FROM notification") - fun _buffers(): List<BufferId_Type> - - @Query("SELECT * FROM notification WHERE hidden = 0 ORDER BY time ASC") - fun all(): List<NotificationData> - - @Query("SELECT * FROM notification WHERE bufferId = :bufferId AND hidden = 0 ORDER BY time ASC") - fun _all(bufferId: BufferId_Type): List<NotificationData> - - @Query("UPDATE notification SET hidden = 1 WHERE bufferId = :bufferId AND messageId <= :messageId") - fun _markHidden(bufferId: BufferId_Type, messageId: MsgId_Type) - - @Query("UPDATE notification SET hidden = 1 WHERE bufferId = :bufferId AND flag & 2 = 0") - fun _markHiddenNormal(bufferId: BufferId_Type) - - @Query("DELETE FROM notification WHERE bufferId = :bufferId AND messageId <= :messageId") - fun _markRead(bufferId: BufferId_Type, messageId: MsgId_Type) - - @Query("DELETE FROM notification WHERE bufferId = :bufferId AND flag & 2 = 0") - fun _markReadNormal(bufferId: BufferId_Type) - - @Query("DELETE FROM notification") - fun clear() -} - -inline fun NotificationDao.buffers() = - _buffers().map(::BufferId) - -inline fun NotificationDao.all(bufferId: BufferId) = - _all(bufferId.id) - -inline fun NotificationDao.markHidden(bufferId: BufferId, messageId: MsgId) = - _markHidden(bufferId.id, messageId.id) - -inline fun NotificationDao.markHiddenNormal(bufferId: BufferId) = - _markHiddenNormal(bufferId.id) - -inline fun NotificationDao.markRead(bufferId: BufferId, messageId: MsgId) = - _markRead(bufferId.id, messageId.id) - -inline fun NotificationDao.markReadNormal(bufferId: BufferId) = - _markReadNormal(bufferId.id) diff --git a/persistence/src/main/java/de/kuschku/quasseldroid/persistence/dao/SslHostnameWhitelistDao.kt b/persistence/src/main/java/de/kuschku/quasseldroid/persistence/dao/SslHostnameWhitelistDao.kt deleted file mode 100644 index de302ac3e2055e34f841d0de39f0554cc1a75dc1..0000000000000000000000000000000000000000 --- a/persistence/src/main/java/de/kuschku/quasseldroid/persistence/dao/SslHostnameWhitelistDao.kt +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.persistence.dao - -import androidx.room.Dao -import androidx.room.Insert -import androidx.room.OnConflictStrategy -import androidx.room.Query -import de.kuschku.quasseldroid.persistence.models.SslHostnameWhitelistEntry - -@Dao -interface SslHostnameWhitelistDao { - @Insert(onConflict = OnConflictStrategy.REPLACE) - fun save(vararg entities: SslHostnameWhitelistEntry) - - @Query("SELECT * FROM ssl_hostname_whitelist") - fun all(): List<SslHostnameWhitelistEntry> - - @Query("SELECT * FROM ssl_hostname_whitelist WHERE fingerprint = :fingerprint AND hostname = :hostname") - fun find(fingerprint: String, hostname: String): SslHostnameWhitelistEntry? - - @Query("DELETE FROM ssl_hostname_whitelist WHERE fingerprint = :fingerprint AND hostname = :hostname") - fun delete(fingerprint: String, hostname: String) - - @Query("DELETE FROM ssl_hostname_whitelist") - fun clear() -} diff --git a/persistence/src/main/java/de/kuschku/quasseldroid/persistence/dao/SslValidityWhitelistDao.kt b/persistence/src/main/java/de/kuschku/quasseldroid/persistence/dao/SslValidityWhitelistDao.kt deleted file mode 100644 index d2167e4c63caa95bde1b2da7f4954ce669031222..0000000000000000000000000000000000000000 --- a/persistence/src/main/java/de/kuschku/quasseldroid/persistence/dao/SslValidityWhitelistDao.kt +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.persistence.dao - -import androidx.room.Dao -import androidx.room.Insert -import androidx.room.OnConflictStrategy -import androidx.room.Query -import de.kuschku.quasseldroid.persistence.models.SslValidityWhitelistEntry - -@Dao -interface SslValidityWhitelistDao { - @Insert(onConflict = OnConflictStrategy.REPLACE) - fun save(vararg entities: SslValidityWhitelistEntry) - - @Query("SELECT * FROM ssl_validity_whitelist") - fun all(): List<SslValidityWhitelistEntry> - - @Query("SELECT * FROM ssl_validity_whitelist WHERE fingerprint = :fingerprint") - fun find(fingerprint: String): SslValidityWhitelistEntry? - - @Query("DELETE FROM ssl_validity_whitelist WHERE fingerprint = :fingerprint") - fun delete(fingerprint: String) - - @Query("DELETE FROM ssl_validity_whitelist") - fun clear() -} diff --git a/persistence/src/main/java/de/kuschku/quasseldroid/persistence/db/AccountDatabase.kt b/persistence/src/main/java/de/kuschku/quasseldroid/persistence/db/AccountDatabase.kt deleted file mode 100644 index 19db1b703320ade0f4ae18b6e1f617ad5ac69476..0000000000000000000000000000000000000000 --- a/persistence/src/main/java/de/kuschku/quasseldroid/persistence/db/AccountDatabase.kt +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.persistence.db - -import android.content.Context -import androidx.room.Database -import androidx.room.Room -import androidx.room.RoomDatabase -import androidx.room.migration.Migration -import androidx.sqlite.db.SupportSQLiteDatabase -import de.kuschku.quasseldroid.persistence.dao.AccountDao -import de.kuschku.quasseldroid.persistence.models.Account - -@Database(entities = [(Account::class)], version = 4) -abstract class AccountDatabase : RoomDatabase() { - abstract fun accounts(): AccountDao - - object Creator { - private var database: AccountDatabase? = null - - // For Singleton instantiation - private val LOCK = Any() - - fun init(context: Context): AccountDatabase { - if (database == null) { - synchronized(LOCK) { - if (database == null) { - database = Room.databaseBuilder( - context.applicationContext, - AccountDatabase::class.java, - DATABASE_NAME - ).addMigrations( - object : Migration(1, 2) { - override fun migrate(database: SupportSQLiteDatabase) { - database.execSQL("ALTER TABLE account ADD COLUMN acceptedMissingFeatures INTEGER NOT NULL DEFAULT 0;") - } - }, - object : Migration(2, 3) { - override fun migrate(database: SupportSQLiteDatabase) { - database.execSQL("ALTER TABLE account ADD COLUMN defaultFiltered INTEGER NOT NULL DEFAULT 0;") - } - }, - object : Migration(3, 4) { - override fun migrate(database: SupportSQLiteDatabase) { - database.execSQL("ALTER TABLE account ADD COLUMN requireSsl INTEGER NOT NULL DEFAULT 0;") - } - } - ).allowMainThreadQueries().build() - } - } - } - return database!! - } - } - - companion object { - const val DATABASE_NAME = "persistence-accounts" - } -} diff --git a/persistence/src/main/java/de/kuschku/quasseldroid/persistence/db/LegacyAccountDatabase.kt b/persistence/src/main/java/de/kuschku/quasseldroid/persistence/db/LegacyAccountDatabase.kt deleted file mode 100644 index e6fe5208e96961a6b529130bc9c0bcca381d85a2..0000000000000000000000000000000000000000 --- a/persistence/src/main/java/de/kuschku/quasseldroid/persistence/db/LegacyAccountDatabase.kt +++ /dev/null @@ -1,91 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.persistence.db - -import android.content.Context -import androidx.room.Database -import androidx.room.Room -import androidx.room.RoomDatabase -import androidx.room.migration.Migration -import androidx.sqlite.db.SupportSQLiteDatabase -import de.kuschku.quasseldroid.persistence.dao.LegacyAccountDao -import de.kuschku.quasseldroid.persistence.models.LegacyAccount - -@Database(entities = [(LegacyAccount::class)], version = 4) -abstract class LegacyAccountDatabase : RoomDatabase() { - abstract fun accounts(): LegacyAccountDao - - object Creator { - private var database: LegacyAccountDatabase? = null - - // For Singleton instantiation - private val LOCK = Any() - - fun init(context: Context): LegacyAccountDatabase { - if (database == null) { - synchronized(LOCK) { - if (database == null) { - database = Room.databaseBuilder( - context.applicationContext, - LegacyAccountDatabase::class.java, - DATABASE_NAME - ).addMigrations( - object : Migration(0, 1) { - override fun migrate(database: SupportSQLiteDatabase) { - database.execSQL("DROP TABLE IF EXISTS cores") - database.execSQL("create table cores (_id integer primary key autoincrement, name text not null, server text not null, port integer not null);") - - database.execSQL("DROP TABLE IF EXISTS user") - database.execSQL("CREATE TABLE user(userid integer primary key autoincrement, username text not null, password text not null, coreid integer not null unique, foreign key(coreid) references cores(_id) ON DELETE CASCADE ON UPDATE CASCADE)") - } - }, - object : Migration(1, 2) { - override fun migrate(database: SupportSQLiteDatabase) { - database.execSQL("DROP TABLE IF EXISTS cores") - database.execSQL("create table cores (_id integer primary key autoincrement, name text not null, server text not null, port integer not null);") - - database.execSQL("DROP TABLE IF EXISTS user") - database.execSQL("CREATE TABLE user(userid integer primary key autoincrement, username text not null, password text not null, coreid integer not null unique, foreign key(coreid) references cores(_id) ON DELETE CASCADE ON UPDATE CASCADE)") - } - }, - object : Migration(2, 3) { - override fun migrate(database: SupportSQLiteDatabase) = Unit - }, - object : Migration(3, 4) { - override fun migrate(database: SupportSQLiteDatabase) { - database.execSQL("CREATE TABLE IF NOT EXISTS `Account` (`id` INTEGER NOT NULL, `host` TEXT NOT NULL, `port` INTEGER NOT NULL, `user` TEXT NOT NULL, `pass` TEXT NOT NULL, `name` TEXT NOT NULL, PRIMARY KEY(`id`))") - database.execSQL("INSERT INTO Account (id, host, port, user, pass, name) SELECT _id AS id, server, port, coalesce(username, ''), coalesce(password, ''), name FROM cores LEFT JOIN user ON user.coreid = cores._id") - - database.execSQL("DROP TABLE IF EXISTS cores") - database.execSQL("DROP TABLE IF EXISTS user") - } - } - ).allowMainThreadQueries().build() - } - } - } - return database!! - } - } - - companion object { - const val DATABASE_NAME = "data" - } -} diff --git a/persistence/src/main/java/de/kuschku/quasseldroid/persistence/db/QuasselDatabase.kt b/persistence/src/main/java/de/kuschku/quasseldroid/persistence/db/QuasselDatabase.kt deleted file mode 100644 index 207f8bdb57bf258820a66224acda4583d71873f7..0000000000000000000000000000000000000000 --- a/persistence/src/main/java/de/kuschku/quasseldroid/persistence/db/QuasselDatabase.kt +++ /dev/null @@ -1,185 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ -package de.kuschku.quasseldroid.persistence.db - -import android.content.Context -import androidx.room.Database -import androidx.room.Room -import androidx.room.RoomDatabase -import androidx.room.TypeConverters -import androidx.room.migration.Migration -import androidx.sqlite.db.SupportSQLiteDatabase -import de.kuschku.quasseldroid.persistence.dao.* -import de.kuschku.quasseldroid.persistence.models.* -import de.kuschku.quasseldroid.persistence.util.MessageTypeConverter - -@Database(entities = [MessageData::class, Filtered::class, SslValidityWhitelistEntry::class, SslHostnameWhitelistEntry::class, NotificationData::class], - version = 21) -@TypeConverters(MessageTypeConverter::class) -abstract class QuasselDatabase : RoomDatabase() { - abstract fun message(): MessageDao - abstract fun filtered(): FilteredDao - abstract fun validityWhitelist(): SslValidityWhitelistDao - abstract fun hostnameWhitelist(): SslHostnameWhitelistDao - abstract fun notifications(): NotificationDao - - object Creator { - private var database: QuasselDatabase? = null - - // For Singleton instantiation - private val LOCK = Any() - - fun init(context: Context): QuasselDatabase { - if (database == null) { - synchronized(LOCK) { - if (database == null) { - database = Room.databaseBuilder( - context.applicationContext, - QuasselDatabase::class.java, - DATABASE_NAME - ).addMigrations( - object : Migration(2, 3) { - override fun migrate(database: SupportSQLiteDatabase) { - database.execSQL( - "CREATE TABLE filtered(bufferId INTEGER, accountId INTEGER, filtered INTEGER, PRIMARY KEY(accountId, bufferId));" - ) - } - }, - object : Migration(3, 4) { - override fun migrate(database: SupportSQLiteDatabase) { - database.execSQL( - "ALTER TABLE message ADD followUp INT DEFAULT 0 NOT NULL;" - ) - } - }, - object : Migration(4, 5) { - override fun migrate(database: SupportSQLiteDatabase) { - database.execSQL("drop table message;") - database.execSQL("create table message (messageId INTEGER not null primary key, time INTEGER not null, type INTEGER not null, flag INTEGER not null, bufferId INTEGER not null, sender TEXT not null, senderPrefixes TEXT not null, content TEXT not null);") - } - }, - object : Migration(5, 6) { - override fun migrate(database: SupportSQLiteDatabase) { - database.execSQL("drop table message;") - database.execSQL("create table message (messageId INTEGER not null primary key, time INTEGER not null, type INTEGER not null, flag INTEGER not null, bufferId INTEGER not null, sender TEXT not null, senderPrefixes TEXT not null, realName TEXT not null, avatarUrl TEXT not null, content TEXT not null);") - } - }, - object : Migration(6, 7) { - override fun migrate(database: SupportSQLiteDatabase) { - database.execSQL("drop table message;") - database.execSQL("create table message (messageId INTEGER not null primary key, time INTEGER not null, type INTEGER not null, flag INTEGER not null, bufferId INTEGER not null, sender TEXT not null, senderPrefixes TEXT not null, realName TEXT not null, avatarUrl TEXT not null, content TEXT not null, ignored INTEGER not null);") - } - }, - object : Migration(7, 8) { - override fun migrate(database: SupportSQLiteDatabase) { - database.execSQL("CREATE INDEX index_message_bufferId ON message(bufferId);") - database.execSQL("CREATE INDEX index_message_ignored ON message(ignored);") - } - }, - object : Migration(8, 9) { - override fun migrate(database: SupportSQLiteDatabase) { - database.execSQL("create table ssl_exception (accountId INTEGER not null, certificateFingerprint TEXT not null, ignoreValidityDate INTEGER not null, primary key(accountId, certificateFingerprint));") - } - }, - object : Migration(9, 10) { - override fun migrate(database: SupportSQLiteDatabase) { - database.execSQL("drop table ssl_exception;") - database.execSQL("create table ssl_exception (accountId INTEGER not null, hostName TEXT not null, certificateFingerprint TEXT not null, ignoreValidityDate INTEGER not null, primary key(accountId, hostName, certificateFingerprint));") - } - }, - object : Migration(10, 11) { - override fun migrate(database: SupportSQLiteDatabase) { - database.execSQL("drop table ssl_exception;") - database.execSQL("create table ssl_exception (accountId INTEGER not null, certificateFingerprint TEXT not null, ignoreValidityDate INTEGER not null, primary key(accountId, certificateFingerprint));") - } - }, - object : Migration(11, 12) { - override fun migrate(database: SupportSQLiteDatabase) { - database.execSQL("drop table ssl_exception;") - database.execSQL("create table ssl_validity_whitelist (fingerprint TEXT not null, ignoreDate INTEGER not null, primary key(fingerprint));") - database.execSQL("create table ssl_hostname_whitelist (fingerprint TEXT not null, hostname TEXT not null, primary key(fingerprint, hostname));") - } - }, - object : Migration(12, 13) { - override fun migrate(database: SupportSQLiteDatabase) { - database.execSQL("drop table ssl_validity_whitelist;") - database.execSQL("drop table ssl_hostname_whitelist;") - database.execSQL("create table ssl_validity_whitelist (fingerprint TEXT not null, ignoreDate INTEGER not null, primary key(fingerprint));") - database.execSQL("create table ssl_hostname_whitelist (fingerprint TEXT not null, hostname TEXT not null, primary key(fingerprint, hostname));") - } - }, - object : Migration(13, 14) { - override fun migrate(database: SupportSQLiteDatabase) { - database.execSQL("CREATE TABLE IF NOT EXISTS `notification` (`messageId` INTEGER NOT NULL, `time` INTEGER NOT NULL, `type` INTEGER NOT NULL, `flag` INTEGER NOT NULL, `bufferId` INTEGER NOT NULL, `bufferName` TEXT NOT NULL, `bufferType` INTEGER NOT NULL, `networkId` INTEGER NOT NULL, `sender` TEXT NOT NULL, `senderPrefixes` TEXT NOT NULL, `realName` TEXT NOT NULL, `avatarUrl` TEXT NOT NULL, `content` TEXT NOT NULL, PRIMARY KEY(`messageId`));") - database.execSQL("CREATE INDEX `index_notification_bufferId` ON `notification` (`bufferId`);") - } - }, - object : Migration(14, 15) { - override fun migrate(database: SupportSQLiteDatabase) { - database.execSQL("ALTER TABLE message ADD networkId INT DEFAULT 0 NOT NULL;") - } - }, - object : Migration(15, 16) { - override fun migrate(database: SupportSQLiteDatabase) { - database.execSQL("ALTER TABLE `notification` ADD `creationTime` INT DEFAULT 0 NOT NULL;") - } - }, - object : Migration(16, 17) { - override fun migrate(database: SupportSQLiteDatabase) { - database.execSQL("ALTER TABLE `notification` ADD `ownNick` TEXT DEFAULT '' NOT NULL;") - database.execSQL("ALTER TABLE `notification` ADD `ownIdent` TEXT DEFAULT '' NOT NULL;") - database.execSQL("ALTER TABLE `notification` ADD `ownRealName` TEXT DEFAULT '' NOT NULL;") - database.execSQL("ALTER TABLE `notification` ADD `ownAvatarUrl` TEXT DEFAULT '' NOT NULL;") - } - }, - object : Migration(17, 18) { - override fun migrate(database: SupportSQLiteDatabase) { - database.execSQL("ALTER TABLE `notification` ADD `hidden` INT DEFAULT 0 NOT NULL;") - } - }, - object : Migration(18, 19) { - override fun migrate(database: SupportSQLiteDatabase) { - database.execSQL("ALTER TABLE `notification` ADD `networkName` TEXT DEFAULT '' NOT NULL;") - } - }, - object : Migration(19, 20) { - override fun migrate(database: SupportSQLiteDatabase) { - database.execSQL("ALTER TABLE message ADD currentBufferId INT DEFAULT 0 NOT NULL;") - database.execSQL("CREATE INDEX index_message_currentBufferId ON message(currentBufferId);") - database.execSQL("CREATE INDEX index_message_networkId ON message(networkId);") - } - }, - object : Migration(20, 21) { - override fun migrate(database: SupportSQLiteDatabase) { - database.execSQL("ALTER TABLE message ADD currentBufferType INT DEFAULT 0 NOT NULL;") - database.execSQL("CREATE INDEX index_message_currentBufferType ON message(currentBufferType);") - } - } - ).build() - } - } - } - return database!! - } - } - - companion object { - const val DATABASE_NAME = "persistence-clientData" - } -} diff --git a/persistence/src/main/java/de/kuschku/quasseldroid/persistence/models/Account.kt b/persistence/src/main/java/de/kuschku/quasseldroid/persistence/models/Account.kt deleted file mode 100644 index 51b84d242ce6c481662390529112e74db7878eea..0000000000000000000000000000000000000000 --- a/persistence/src/main/java/de/kuschku/quasseldroid/persistence/models/Account.kt +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.persistence.models - -import androidx.room.ColumnInfo -import androidx.room.Entity -import androidx.room.PrimaryKey -import de.kuschku.quasseldroid.persistence.util.AccountId - -@Entity(tableName = "Account") -data class Account( - @PrimaryKey(autoGenerate = true) - @ColumnInfo(name = "id") - var rawId: Long, - var host: String, - var port: Int, - var requireSsl: Boolean, - var user: String, - var pass: String, - var name: String, - var lastUsed: Long, - var acceptedMissingFeatures: Boolean, - var defaultFiltered: Int -) { - inline var id - get() = AccountId(rawId) - set(value) { - rawId = value.id - } - - companion object { - inline fun of( - id: AccountId, - host: String, - port: Int, - requireSsl: Boolean, - user: String, - pass: String, - name: String, - lastUsed: Long, - acceptedMissingFeatures: Boolean, - defaultFiltered: Int - ) = Account( - id.id, - host, - port, - requireSsl, - user, - pass, - name, - lastUsed, - acceptedMissingFeatures, - defaultFiltered - ) - } -} diff --git a/persistence/src/main/java/de/kuschku/quasseldroid/persistence/models/Filtered.kt b/persistence/src/main/java/de/kuschku/quasseldroid/persistence/models/Filtered.kt deleted file mode 100644 index 3fda2b2fc99cf689828f24aa1cbaa454f32cb168..0000000000000000000000000000000000000000 --- a/persistence/src/main/java/de/kuschku/quasseldroid/persistence/models/Filtered.kt +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.persistence.models - -import androidx.room.ColumnInfo -import androidx.room.Entity -import de.kuschku.libquassel.protocol.BufferId -import de.kuschku.libquassel.protocol.BufferId_Type -import de.kuschku.quasseldroid.persistence.util.AccountId - -@Entity(tableName = "filtered", primaryKeys = ["accountId", "bufferId"]) -data class Filtered( - var accountId: Long, - @ColumnInfo(name = "bufferId") - var rawBufferId: BufferId_Type, - var filtered: Int -) { - inline val bufferId - get() = BufferId(rawBufferId) - - companion object { - inline fun of( - accountId: AccountId, - bufferId: BufferId, - filtered: Int - ) = Filtered( - accountId.id, - bufferId.id, - filtered - ) - } -} diff --git a/persistence/src/main/java/de/kuschku/quasseldroid/persistence/models/LegacyAccount.kt b/persistence/src/main/java/de/kuschku/quasseldroid/persistence/models/LegacyAccount.kt deleted file mode 100644 index 593e3be26a7438e42d01ed7a29f9fc1b1bf9a7d3..0000000000000000000000000000000000000000 --- a/persistence/src/main/java/de/kuschku/quasseldroid/persistence/models/LegacyAccount.kt +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.persistence.models - -import androidx.room.Entity -import androidx.room.PrimaryKey - -@Entity(tableName = "Account") -data class LegacyAccount( - @PrimaryKey - var id: Long, - var host: String, - var port: Int, - var user: String, - var pass: String, - var name: String -) diff --git a/persistence/src/main/java/de/kuschku/quasseldroid/persistence/models/MessageData.kt b/persistence/src/main/java/de/kuschku/quasseldroid/persistence/models/MessageData.kt deleted file mode 100644 index b3fb69799458a8923775e04b754d83fe4bd956bf..0000000000000000000000000000000000000000 --- a/persistence/src/main/java/de/kuschku/quasseldroid/persistence/models/MessageData.kt +++ /dev/null @@ -1,102 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ -@file:Suppress("NOTHING_TO_INLINE") - -package de.kuschku.quasseldroid.persistence.models - -import androidx.room.ColumnInfo -import androidx.room.Entity -import androidx.room.Index -import androidx.room.PrimaryKey -import de.kuschku.libquassel.protocol.* -import org.threeten.bp.Instant -import java.io.Serializable - -@Entity(tableName = "message", - indices = [ - Index("bufferId"), - Index("ignored"), - Index("currentBufferId"), - Index("currentBufferType"), - Index("networkId") - ]) -data class MessageData( - @PrimaryKey - @ColumnInfo(name = "messageId") - var rawMessageId: MsgId_Type, - var time: Instant, - var type: Message_Types, - var flag: Message_Flags, - @ColumnInfo(name = "bufferId") - var rawBufferId: BufferId_Type, - @ColumnInfo(name = "currentBufferId") - var rawCurrentBufferId: BufferId_Type, - var currentBufferType: Buffer_Types, - @ColumnInfo(name = "networkId") - var rawNetworkId: NetworkId_Type, - var sender: String, - var senderPrefixes: String, - var realName: String, - var avatarUrl: String, - var content: String, - var ignored: Boolean -) : Serializable { - inline val messageId - get() = MsgId(rawMessageId) - inline val bufferId - get() = BufferId(rawBufferId) - inline val currentBufferId - get() = BufferId(rawCurrentBufferId) - inline val networkId - get() = NetworkId(rawNetworkId) - - companion object { - inline fun of( - messageId: MsgId, - time: Instant, - type: Message_Types, - flag: Message_Flags, - bufferId: BufferId, - currentBufferType: Buffer_Types, - networkId: NetworkId, - currentBufferId: BufferId, - sender: String, - senderPrefixes: String, - realName: String, - avatarUrl: String, - content: String, - ignored: Boolean - ) = MessageData( - messageId.id, - time, - type, - flag, - bufferId.id, - currentBufferId.id, - currentBufferType, - networkId.id, - sender, - senderPrefixes, - realName, - avatarUrl, - content, - ignored - ) - } -} diff --git a/persistence/src/main/java/de/kuschku/quasseldroid/persistence/models/NotificationData.kt b/persistence/src/main/java/de/kuschku/quasseldroid/persistence/models/NotificationData.kt deleted file mode 100644 index cf8fe25284df68958dea03026fa7673b10cff187..0000000000000000000000000000000000000000 --- a/persistence/src/main/java/de/kuschku/quasseldroid/persistence/models/NotificationData.kt +++ /dev/null @@ -1,110 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.persistence.models - -import androidx.room.ColumnInfo -import androidx.room.Entity -import androidx.room.Index -import androidx.room.PrimaryKey -import de.kuschku.libquassel.protocol.* -import org.threeten.bp.Instant - -@Entity(tableName = "notification", indices = [Index("bufferId")]) -data class NotificationData( - @PrimaryKey - @ColumnInfo(name = "messageId") - var rawMessageId: MsgId_Type, - var creationTime: Instant, - var time: Instant, - var type: Message_Types, - var flag: Message_Flags, - @ColumnInfo(name = "bufferId") - var rawBufferId: BufferId_Type, - var bufferName: String, - var bufferType: Buffer_Types, - @ColumnInfo(name = "networkId") - var rawNetworkId: NetworkId_Type, - var networkName: String, - var sender: String, - var senderPrefixes: String, - var realName: String, - var avatarUrl: String, - var content: String, - var ownNick: String, - var ownIdent: String, - var ownRealName: String, - var ownAvatarUrl: String, - var hidden: Boolean -) { - inline val messageId - get() = MsgId(rawMessageId) - - inline val bufferId - get() = BufferId(rawBufferId) - - inline val networkId - get() = NetworkId(rawNetworkId) - - companion object { - inline fun of( - messageId: MsgId, - creationTime: Instant, - time: Instant, - type: Message_Types, - flag: Message_Flags, - bufferId: BufferId, - bufferName: String, - bufferType: Buffer_Types, - networkId: NetworkId, - networkName: String, - sender: String, - senderPrefixes: String, - realName: String, - avatarUrl: String, - content: String, - ownNick: String, - ownIdent: String, - ownRealName: String, - ownAvatarUrl: String, - hidden: Boolean - ) = NotificationData( - messageId.id, - creationTime, - time, - type, - flag, - bufferId.id, - bufferName, - bufferType, - networkId.id, - networkName, - sender, - senderPrefixes, - realName, - avatarUrl, - content, - ownNick, - ownIdent, - ownRealName, - ownAvatarUrl, - hidden - ) - } -} diff --git a/persistence/src/main/java/de/kuschku/quasseldroid/persistence/models/SslHostnameWhitelistEntry.kt b/persistence/src/main/java/de/kuschku/quasseldroid/persistence/models/SslHostnameWhitelistEntry.kt deleted file mode 100644 index 41480e9806d2668c19b99cc7748f406911727d10..0000000000000000000000000000000000000000 --- a/persistence/src/main/java/de/kuschku/quasseldroid/persistence/models/SslHostnameWhitelistEntry.kt +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.persistence.models - -import androidx.room.Entity - -@Entity(tableName = "ssl_hostname_whitelist", primaryKeys = ["fingerprint", "hostname"]) -data class SslHostnameWhitelistEntry( - var fingerprint: String, - var hostname: String -) diff --git a/persistence/src/main/java/de/kuschku/quasseldroid/persistence/models/SslValidityWhitelistEntry.kt b/persistence/src/main/java/de/kuschku/quasseldroid/persistence/models/SslValidityWhitelistEntry.kt deleted file mode 100644 index c4b06fa2372dc8bba7e6bbe1d1e928275b6be1e0..0000000000000000000000000000000000000000 --- a/persistence/src/main/java/de/kuschku/quasseldroid/persistence/models/SslValidityWhitelistEntry.kt +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.persistence.models - -import androidx.room.Entity -import androidx.room.PrimaryKey - -@Entity(tableName = "ssl_validity_whitelist") -data class SslValidityWhitelistEntry( - @PrimaryKey - var fingerprint: String, - var ignoreDate: Boolean -) diff --git a/persistence/src/main/java/de/kuschku/quasseldroid/persistence/util/AccountId.kt b/persistence/src/main/java/de/kuschku/quasseldroid/persistence/util/AccountId.kt deleted file mode 100644 index d6cc4d995924fc3f1b993184b29eee14d01995c2..0000000000000000000000000000000000000000 --- a/persistence/src/main/java/de/kuschku/quasseldroid/persistence/util/AccountId.kt +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.persistence.util - -import java.io.Serializable - -typealias AccountId_Type = Long - -inline class AccountId(val id: AccountId_Type) : Comparable<AccountId>, Serializable { - override fun compareTo(other: AccountId) = id.compareTo(other.id) - inline fun isValidId() = id >= 0 - - override fun toString(): String { - return "AccountId($id)" - } - - companion object { - val MIN_VALUE = AccountId(AccountId_Type.MIN_VALUE) - val MAX_VALUE = AccountId(AccountId_Type.MAX_VALUE) - } -} diff --git a/persistence/src/main/java/de/kuschku/quasseldroid/persistence/util/MessageTypeConverter.kt b/persistence/src/main/java/de/kuschku/quasseldroid/persistence/util/MessageTypeConverter.kt deleted file mode 100644 index bdc7db78c2ba616f86f385a29e2d651d844f0bd9..0000000000000000000000000000000000000000 --- a/persistence/src/main/java/de/kuschku/quasseldroid/persistence/util/MessageTypeConverter.kt +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.persistence.util - -import androidx.room.TypeConverter -import de.kuschku.libquassel.protocol.* -import org.threeten.bp.Instant - -class MessageTypeConverter { - @TypeConverter - fun convertInstant(value: Long): Instant = Instant.ofEpochMilli(value) - - @TypeConverter - fun convertInstant(value: Instant) = value.toEpochMilli() - - @TypeConverter - fun convertBufferTypes(value: Buffer_Types) = value.toShort() - - @TypeConverter - fun convertBufferTypes(value: Short) = Buffer_Type.of(value) - - @TypeConverter - fun convertMessageTypes(value: Message_Types) = value.toInt() - - @TypeConverter - fun convertMessageTypes(value: Int) = Message.MessageType.of(value) - - @TypeConverter - fun convertMessageFlags(value: Message_Flags) = value.toInt() - - @TypeConverter - fun convertMessageFlags(value: Int) = Message.MessageFlag.of(value) -} diff --git a/persistence/src/main/java/de/kuschku/quasseldroid/persistence/util/QuasselBacklogStorage.kt b/persistence/src/main/java/de/kuschku/quasseldroid/persistence/util/QuasselBacklogStorage.kt deleted file mode 100644 index 0ed914bd97aadd089597b3c889e79d9c1fe7ac12..0000000000000000000000000000000000000000 --- a/persistence/src/main/java/de/kuschku/quasseldroid/persistence/util/QuasselBacklogStorage.kt +++ /dev/null @@ -1,104 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.persistence.util - -import de.kuschku.libquassel.protocol.BufferId -import de.kuschku.libquassel.protocol.Message -import de.kuschku.libquassel.protocol.NetworkId -import de.kuschku.libquassel.quassel.syncables.IgnoreListManager -import de.kuschku.libquassel.session.BacklogStorage -import de.kuschku.libquassel.session.ISession -import de.kuschku.libquassel.util.helper.safeValue -import de.kuschku.quasseldroid.persistence.db.QuasselDatabase -import de.kuschku.quasseldroid.persistence.models.MessageData -import io.reactivex.subjects.BehaviorSubject - -class QuasselBacklogStorage(private val db: QuasselDatabase) : BacklogStorage { - val currentBuffer = BehaviorSubject.createDefault(BufferId(0)) - - override fun updateIgnoreRules(session: ISession) { - db.message().save( - *db.message().all().map { - it.copy(ignored = isIgnored( - session, - it)) - }.toTypedArray() - ) - } - - override fun storeMessages(session: ISession, vararg messages: Message) = - storeMessages(session, messages.asIterable()) - - override fun storeMessages(session: ISession, messages: Iterable<Message>) { - db.message().save(*messages.map { - MessageData.of( - messageId = it.messageId, - time = it.time, - type = it.type, - flag = it.flag, - bufferId = it.bufferInfo.bufferId, - currentBufferId = currentBuffer.safeValue, - currentBufferType = it.bufferInfo.type, - networkId = it.bufferInfo.networkId, - sender = it.sender, - senderPrefixes = it.senderPrefixes, - realName = it.realName, - avatarUrl = it.avatarUrl, - content = it.content, - ignored = isIgnored(session, it) - ) - }.toTypedArray()) - } - - override fun clearMessages(bufferId: BufferId, idRange: LongRange) { - db.message().clearMessages(bufferId.id, idRange.first, idRange.last) - } - - override fun clearMessages(bufferId: BufferId) { - db.message().clearMessages(bufferId.id) - } - - override fun clearMessages() { - db.message().clearMessages() - } - - companion object { - fun isIgnored(session: ISession, message: Message): Boolean { - val bufferName = message.bufferInfo.bufferName ?: "" - val networkId = message.bufferInfo.networkId - val networkName = session.network(networkId)?.networkName() ?: "" - - return session.ignoreListManager.match( - message.content, message.sender, message.type, networkName, bufferName - ) != IgnoreListManager.StrictnessType.UnmatchedStrictness - } - - fun isIgnored(session: ISession, message: MessageData): Boolean { - val bufferInfo = session.bufferSyncer.bufferInfo(message.bufferId) - val bufferName = bufferInfo?.bufferName ?: "" - val networkId = bufferInfo?.networkId ?: NetworkId(-1) - val networkName = session.network(networkId)?.networkName() ?: "" - - return session.ignoreListManager.match( - message.content, message.sender, message.type, networkName, bufferName - ) != IgnoreListManager.StrictnessType.UnmatchedStrictness - } - } -} diff --git a/settings.gradle b/settings.gradle deleted file mode 100644 index ba3c6fc225852162d46facb01443ee206569b702..0000000000000000000000000000000000000000 --- a/settings.gradle +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2019 Janne Mareike Koschinski - * Copyright (c) 2019 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -rootProject.buildFileName = 'build.gradle.kts' - -include ':app', - ':invokerannotations', - ':invokergenerator', - ':lib', - ':lifecycle-ktx', - ':malheur', - ':persistence', - ':viewmodel', - ':ui_spinner' diff --git a/lifecycle-ktx/build.gradle.kts b/settings.gradle.kts similarity index 76% rename from lifecycle-ktx/build.gradle.kts rename to settings.gradle.kts index 1c350468f36834e0a2b066011ad8319519b212d3..c6507812c436445bbb9a03855774751d10d04ef3 100644 --- a/lifecycle-ktx/build.gradle.kts +++ b/settings.gradle.kts @@ -17,14 +17,16 @@ * with this program. If not, see <http://www.gnu.org/licenses/>. */ -plugins { - kotlin("jvm") -} +rootProject.buildFileName = "build.gradle.kts" -dependencies { - implementation(kotlin("stdlib", "1.3.72")) - - implementation("androidx.annotation", "annotation", "1.1.0") - - implementation("androidx.lifecycle", "lifecycle-common", "2.1.0") -} +include( + ":app"//, + //":invokerannotations", + //":invokergenerator", + //":lib", + //":lifecycle-ktx", + //":malheur", + //":persistence", + //":viewmodel", + //":ui_spinner" +) diff --git a/ui_spinner/build.gradle.kts b/ui_spinner/build.gradle.kts deleted file mode 100644 index b2b102c80a72067382ffbbdbcc9f3900fe6b8d6f..0000000000000000000000000000000000000000 --- a/ui_spinner/build.gradle.kts +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2018 Janne Mareike Koschinski - * Copyright (c) 2018 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -plugins { - id("com.android.library") - kotlin("android") -} - -android { - compileSdkVersion(29) - - defaultConfig { - minSdkVersion(20) - targetSdkVersion(29) - - consumerProguardFiles("proguard-rules.pro") - - // Disable test runner analytics - testInstrumentationRunnerArguments = mapOf( - "disableAnalytics" to "true" - ) - } - - lintOptions { - isWarningsAsErrors = true - setLintConfig(file("../lint.xml")) - } -} - -dependencies { - implementation(kotlin("stdlib", "1.3.72")) - implementation("androidx.appcompat", "appcompat", "1.1.0") -} diff --git a/ui_spinner/proguard-rules.pro b/ui_spinner/proguard-rules.pro deleted file mode 100644 index 8c9db7a6d02c604a02d4e04a47e3e45639eca4e2..0000000000000000000000000000000000000000 --- a/ui_spinner/proguard-rules.pro +++ /dev/null @@ -1,21 +0,0 @@ -# Gson uses generic type information stored in a class file when working with fields. Proguard -# removes such information by default, so configure it to keep all of it. --keepattributes Signature - -# For using GSON @Expose annotation --keepattributes *Annotation* - -# Gson specific classes --dontwarn sun.misc.** -#-keep class com.google.gson.stream.** { *; } - -# Application classes that will be serialized/deserialized over Gson --keep class com.google.gson.examples.android.model.** { *; } - -# Prevent proguard from stripping interface information from TypeAdapterFactory, -# JsonSerializer, JsonDeserializer instances (so they can be used in @JsonAdapter) --keep class * implements com.google.gson.TypeAdapterFactory --keep class * implements com.google.gson.JsonSerializer --keep class * implements com.google.gson.JsonDeserializer - --keep class **.BuildConfig { *; } diff --git a/ui_spinner/src/main/AndroidManifest.xml b/ui_spinner/src/main/AndroidManifest.xml deleted file mode 100644 index 49b9c52a7229b3a876d77aebd50fcb91e2e71fd1..0000000000000000000000000000000000000000 --- a/ui_spinner/src/main/AndroidManifest.xml +++ /dev/null @@ -1,20 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2019 Janne Mareike Koschinski - Copyright (c) 2019 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<manifest package="de.kuschku.ui.spinner" /> diff --git a/ui_spinner/src/main/java/de/kuschku/ui/animation/AnimationUtils.kt b/ui_spinner/src/main/java/de/kuschku/ui/animation/AnimationUtils.kt deleted file mode 100644 index 7186061c1da98bec1a87c6f263fa5180e58cc3cc..0000000000000000000000000000000000000000 --- a/ui_spinner/src/main/java/de/kuschku/ui/animation/AnimationUtils.kt +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (C) 2015 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package de.kuschku.ui.animation - -import android.view.animation.LinearInterpolator -import androidx.interpolator.view.animation.LinearOutSlowInInterpolator - -/** - * Utility class for animations containing Material interpolators. - */ -object AnimationUtils { - val LINEAR_INTERPOLATOR = LinearInterpolator() - val LINEAR_OUT_SLOW_IN_INTERPOLATOR = LinearOutSlowInInterpolator() -} diff --git a/ui_spinner/src/main/java/de/kuschku/ui/animation/AnimatorSetCompat.java b/ui_spinner/src/main/java/de/kuschku/ui/animation/AnimatorSetCompat.java deleted file mode 100644 index 93116c4032a8babf09021b7238761b88b2dd9351..0000000000000000000000000000000000000000 --- a/ui_spinner/src/main/java/de/kuschku/ui/animation/AnimatorSetCompat.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright 2017 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package de.kuschku.ui.animation; - -import android.animation.Animator; -import android.animation.AnimatorSet; -import android.animation.ValueAnimator; - -import java.util.List; - -/** - * Compatibility utils for {@link android.animation.AnimatorSet}. - */ -public class AnimatorSetCompat { - - /** - * Sets up this AnimatorSet to play all of the supplied animations at the same time. - */ - public static void playTogether(AnimatorSet animatorSet, List<Animator> items) { - // Fix for pre-M bug where animators with start delay are not played correctly in an - // AnimatorSet. - long totalDuration = 0; - for (int i = 0, count = items.size(); i < count; i++) { - Animator animator = items.get(i); - totalDuration = Math.max(totalDuration, animator.getStartDelay() + animator.getDuration()); - } - Animator fix = ValueAnimator.ofInt(0, 0); - fix.setDuration(totalDuration); - items.add(0, fix); - - animatorSet.playTogether(items); - } -} diff --git a/ui_spinner/src/main/java/de/kuschku/ui/color/MaterialColors.kt b/ui_spinner/src/main/java/de/kuschku/ui/color/MaterialColors.kt deleted file mode 100644 index d8f3e8f5a37bf2adc0c636e4e040573b690ec0a7..0000000000000000000000000000000000000000 --- a/ui_spinner/src/main/java/de/kuschku/ui/color/MaterialColors.kt +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright (C) 2018 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package de.kuschku.ui.color - -import android.content.Context -import android.view.View -import androidx.annotation.AttrRes -import androidx.annotation.ColorInt -import androidx.core.graphics.ColorUtils -import de.kuschku.ui.resources.MaterialAttributes - -/** - * A utility class for common color variants used in Material themes. - */ -object MaterialColors { - /** - * Returns the color int for the provided theme color attribute, or the default value if the - * attribute is not set in the current theme, using the `view`'s [Context]. - */ - @ColorInt - fun getColor( - view: View, @AttrRes colorAttributeResId: Int, @ColorInt defaultValue: Int): Int { - return getColor(view.context, colorAttributeResId, defaultValue) - } - - /** - * Returns the color int for the provided theme color attribute, or the default value if the - * attribute is not set in the current theme. - */ - @ColorInt - private fun getColor( - context: Context, @AttrRes colorAttributeResId: Int, @ColorInt defaultValue: Int): Int { - val typedValue = MaterialAttributes.resolveAttribute(context, colorAttributeResId) - return typedValue?.data ?: defaultValue - } - - /** - * Calculates a color that represents the layering of the `overlayColor` on top of the - * `backgroundColor`. - */ - @ColorInt - fun layer(@ColorInt backgroundColor: Int, @ColorInt overlayColor: Int): Int { - return ColorUtils.compositeColors(overlayColor, backgroundColor) - } -} diff --git a/ui_spinner/src/main/java/de/kuschku/ui/graphics/drawable/TintAwareDrawable.java b/ui_spinner/src/main/java/de/kuschku/ui/graphics/drawable/TintAwareDrawable.java deleted file mode 100644 index 4367a766f28246c3868a54a42ad654ae2227a3c3..0000000000000000000000000000000000000000 --- a/ui_spinner/src/main/java/de/kuschku/ui/graphics/drawable/TintAwareDrawable.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright (C) 2016 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package de.kuschku.ui.graphics.drawable; - -import android.content.res.ColorStateList; -import android.graphics.PorterDuff; - -import androidx.annotation.ColorInt; - -/** - * Interface which allows a {@link android.graphics.drawable.Drawable} to receive tinting calls - * from {@code DrawableCompat}. - */ -public interface TintAwareDrawable { - void setTint(@ColorInt int tint); - - void setTintList(ColorStateList tint); - - void setTintMode(PorterDuff.Mode tintMode); -} diff --git a/ui_spinner/src/main/java/de/kuschku/ui/internal/CollapsingTextHelper.java b/ui_spinner/src/main/java/de/kuschku/ui/internal/CollapsingTextHelper.java deleted file mode 100644 index 76733076b1499817c73500319c1fe2552d4385f6..0000000000000000000000000000000000000000 --- a/ui_spinner/src/main/java/de/kuschku/ui/internal/CollapsingTextHelper.java +++ /dev/null @@ -1,341 +0,0 @@ -/* - * Copyright (C) 2015 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package de.kuschku.ui.internal; - -import android.annotation.SuppressLint; -import android.content.Context; -import android.content.res.ColorStateList; -import android.content.res.TypedArray; -import android.graphics.Canvas; -import android.graphics.Paint; -import android.graphics.Rect; -import android.graphics.RectF; -import android.graphics.Typeface; -import android.text.TextPaint; -import android.text.TextUtils; -import android.view.Gravity; -import android.view.View; - -import androidx.annotation.ColorInt; -import androidx.annotation.Nullable; -import androidx.core.text.TextDirectionHeuristicsCompat; -import androidx.core.view.GravityCompat; -import androidx.core.view.ViewCompat; - -import de.kuschku.ui.resources.MaterialResources; -import de.kuschku.ui.spinner.R; - -/** - * Helper class for rendering and animating collapsed text. - */ -public final class CollapsingTextHelper { - private final View view; - private final Rect collapsedBounds; - private final RectF currentBounds; - private final TextPaint textPaint; - private final TextPaint tmpPaint; - private boolean drawTitle; - private int collapsedTextGravity = Gravity.CENTER_VERTICAL; - private float collapsedTextSize = 15; - private ColorStateList collapsedTextColor; - private float collapsedDrawY; - private float collapsedDrawX; - private float currentDrawX; - private float currentDrawY; - private Typeface collapsedTypeface; - private CharSequence text; - private CharSequence textToDraw; - private boolean isRtl; - private int[] state; - private boolean boundsChanged; - - public CollapsingTextHelper(View view) { - this.view = view; - - textPaint = new TextPaint(Paint.ANTI_ALIAS_FLAG | Paint.SUBPIXEL_TEXT_FLAG); - tmpPaint = new TextPaint(textPaint); - - collapsedBounds = new Rect(); - currentBounds = new RectF(); - } - - private static boolean rectEquals(Rect r, int left, int top, int right, int bottom) { - return !(r.left != left || r.top != top || r.right != right || r.bottom != bottom); - } - - private void setCollapsedBounds(int left, int top, int right, int bottom) { - if (!rectEquals(collapsedBounds, left, top, right, bottom)) { - collapsedBounds.set(left, top, right, bottom); - boundsChanged = true; - onBoundsChanged(); - } - } - - public void setCollapsedBounds(Rect bounds) { - setCollapsedBounds(bounds.left, bounds.top, bounds.right, bounds.bottom); - } - - private float calculateCollapsedTextWidth() { - if (text == null) { - return 0; - } - getTextPaintCollapsed(tmpPaint); - return tmpPaint.measureText(text, 0, text.length()); - } - - public float getCollapsedTextHeight() { - getTextPaintCollapsed(tmpPaint); - // Return collapsed height measured from the baseline. - return -tmpPaint.ascent(); - } - - public void getCollapsedTextActualBounds(RectF bounds) { - boolean isRtl = calculateIsRtl(text); - - bounds.left = - !isRtl ? collapsedBounds.left : collapsedBounds.right - calculateCollapsedTextWidth(); - bounds.top = collapsedBounds.top; - bounds.right = !isRtl ? bounds.left + calculateCollapsedTextWidth() : collapsedBounds.right; - bounds.bottom = collapsedBounds.top + getCollapsedTextHeight(); - } - - private void getTextPaintCollapsed(TextPaint textPaint) { - textPaint.setTextSize(collapsedTextSize); - textPaint.setTypeface(collapsedTypeface); - } - - private void onBoundsChanged() { - drawTitle = - collapsedBounds.width() > 0 - && collapsedBounds.height() > 0; - } - - public void setCollapsedTextGravity(int gravity) { - if (collapsedTextGravity != gravity) { - collapsedTextGravity = gravity; - recalculate(); - } - } - - public void setCollapsedTextAppearance(int resId) { - Context context = view.getContext(); - TypedArray a = context.obtainStyledAttributes(resId, R.styleable.md_TextAppearance); - ColorStateList textColor = MaterialResources.getColorStateList(context, a, R.styleable.md_TextAppearance_android_textColor); - if (textColor != null) { - collapsedTextColor = textColor; - } - float textSize = a.getDimension(R.styleable.md_TextAppearance_android_textSize, 0f); - if (textSize != 0) { - collapsedTextSize = textSize; - } - a.recycle(); - - recalculate(); - } - - public void setTypefaces(Typeface typeface) { - boolean collapsedFontChanged = setCollapsedTypefaceInternal(typeface); - if (collapsedFontChanged) { - recalculate(); - } - } - - @SuppressWarnings("ReferenceEquality") // Matches the Typeface comparison in TextView - private boolean setCollapsedTypefaceInternal(Typeface typeface) { - // Explicit Typeface setting cancels pending async fetch, if any, to avoid old font overriding - // already updated one when async op comes back after a while. - if (collapsedTypeface != typeface) { - collapsedTypeface = typeface; - return true; - } - return false; - } - - public final boolean setState(final int[] state) { - this.state = state; - - if (isStateful()) { - recalculate(); - return true; - } - - return false; - } - - private boolean isStateful() { - return (collapsedTextColor != null && collapsedTextColor.isStateful()); - } - - private void calculateOffsets() { - currentBounds.left = collapsedBounds.left; - currentBounds.top = collapsedDrawY; - currentBounds.right = collapsedBounds.right; - currentBounds.bottom = collapsedBounds.bottom; - currentDrawX = collapsedDrawX; - currentDrawY = collapsedDrawY; - - setInterpolatedTextSize(); - - textPaint.setColor(getCurrentCollapsedTextColor()); - - ViewCompat.postInvalidateOnAnimation(view); - } - - @ColorInt - public int getCurrentCollapsedTextColor() { - return getCurrentColor(collapsedTextColor); - } - - @ColorInt - private int getCurrentColor(@Nullable ColorStateList colorStateList) { - if (colorStateList == null) { - return 0; - } - if (state != null) { - return colorStateList.getColorForState(state, 0); - } - return colorStateList.getDefaultColor(); - } - - @SuppressLint("RtlHardcoded") - private void calculateBaseOffsets() { - // We then calculate the collapsed text size, using the same logic - calculateUsingTextSize(); - float width = - textToDraw != null ? textPaint.measureText(textToDraw, 0, textToDraw.length()) : 0; - final int collapsedAbsGravity = - GravityCompat.getAbsoluteGravity( - collapsedTextGravity, - isRtl ? ViewCompat.LAYOUT_DIRECTION_RTL : ViewCompat.LAYOUT_DIRECTION_LTR); - switch (collapsedAbsGravity & Gravity.VERTICAL_GRAVITY_MASK) { - case Gravity.BOTTOM: - collapsedDrawY = collapsedBounds.bottom; - break; - case Gravity.TOP: - collapsedDrawY = collapsedBounds.top - textPaint.ascent(); - break; - case Gravity.CENTER_VERTICAL: - default: - float textHeight = textPaint.descent() - textPaint.ascent(); - float textOffset = (textHeight / 2) - textPaint.descent(); - collapsedDrawY = collapsedBounds.centerY() + textOffset; - break; - } - switch (collapsedAbsGravity & GravityCompat.RELATIVE_HORIZONTAL_GRAVITY_MASK) { - case Gravity.CENTER_HORIZONTAL: - collapsedDrawX = collapsedBounds.centerX() - (width / 2); - break; - case Gravity.RIGHT: - collapsedDrawX = collapsedBounds.right - width; - break; - case Gravity.LEFT: - default: - collapsedDrawX = collapsedBounds.left; - break; - } - } - - public void draw(Canvas canvas) { - final int saveCount = canvas.save(); - - if (textToDraw != null && drawTitle) { - float x = currentDrawX; - float y = currentDrawY; - - canvas.drawText(textToDraw, 0, textToDraw.length(), x, y, textPaint); - } - - canvas.restoreToCount(saveCount); - } - - private boolean calculateIsRtl(CharSequence text) { - final boolean defaultIsRtl = - ViewCompat.getLayoutDirection(view) == ViewCompat.LAYOUT_DIRECTION_RTL; - return (defaultIsRtl - ? TextDirectionHeuristicsCompat.FIRSTSTRONG_RTL - : TextDirectionHeuristicsCompat.FIRSTSTRONG_LTR) - .isRtl(text, 0, text.length()); - } - - private void setInterpolatedTextSize() { - calculateUsingTextSize(); - ViewCompat.postInvalidateOnAnimation(view); - } - - @SuppressWarnings("ReferenceEquality") // Matches the Typeface comparison in TextView - private void calculateUsingTextSize() { - if (text == null) { - return; - } - - final float collapsedWidth = collapsedBounds.width(); - - boolean updateDrawText = false; - - final float availableWidth; - availableWidth = collapsedWidth; - - if (availableWidth > 0) { - updateDrawText = boundsChanged; - boundsChanged = false; - } - - if (textToDraw == null || updateDrawText) { - textPaint.setTextSize(collapsedTextSize); - textPaint.setTypeface(collapsedTypeface); - - // If we don't currently have text to draw, or the text size has changed, ellipsize... - final CharSequence title = - TextUtils.ellipsize(text, textPaint, availableWidth, TextUtils.TruncateAt.END); - if (!TextUtils.equals(title, textToDraw)) { - textToDraw = title; - isRtl = calculateIsRtl(textToDraw); - } - } - } - - public void recalculate() { - if (view.getHeight() > 0 && view.getWidth() > 0) { - // If we've already been laid out, calculate everything now otherwise we'll wait - // until a layout - calculateBaseOffsets(); - calculateOffsets(); - } - } - - /** - * Set the title to display - */ - public void setText(CharSequence text) { - if (text == null || !TextUtils.equals(this.text, text)) { - this.text = text; - textToDraw = null; - recalculate(); - } - } - - public ColorStateList getCollapsedTextColor() { - return collapsedTextColor; - } - - public void setCollapsedTextColor(ColorStateList textColor) { - if (collapsedTextColor != textColor) { - collapsedTextColor = textColor; - recalculate(); - } - } -} diff --git a/ui_spinner/src/main/java/de/kuschku/ui/internal/DescendantOffsetUtils.java b/ui_spinner/src/main/java/de/kuschku/ui/internal/DescendantOffsetUtils.java deleted file mode 100644 index 68e7de829ed3897ff7194f571bb444103ac473d2..0000000000000000000000000000000000000000 --- a/ui_spinner/src/main/java/de/kuschku/ui/internal/DescendantOffsetUtils.java +++ /dev/null @@ -1,92 +0,0 @@ -/* - * Copyright (C) 2015 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package de.kuschku.ui.internal; - -import android.graphics.Matrix; -import android.graphics.Rect; -import android.graphics.RectF; -import android.view.View; -import android.view.ViewGroup; -import android.view.ViewParent; - -/** - * Utility class for descendant {@link Rect} calculations. - */ -public class DescendantOffsetUtils { - private static final ThreadLocal<Matrix> matrix = new ThreadLocal<>(); - private static final ThreadLocal<RectF> rectF = new ThreadLocal<>(); - - /** - * This is a port of the common {@link ViewGroup#offsetDescendantRectToMyCoords(View, Rect)} from - * the framework, but adapted to take transformations into account. The result will be the - * bounding rect of the real transformed rect. - * - * @param descendant view defining the original coordinate system of rect - * @param rect (in/out) the rect to offset from descendant to this view's coordinate system - */ - private static void offsetDescendantRect(ViewGroup parent, View descendant, Rect rect) { - Matrix m = matrix.get(); - if (m == null) { - m = new Matrix(); - matrix.set(m); - } else { - m.reset(); - } - - offsetDescendantMatrix(parent, descendant, m); - - RectF rectF = DescendantOffsetUtils.rectF.get(); - if (rectF == null) { - rectF = new RectF(); - DescendantOffsetUtils.rectF.set(rectF); - } - rectF.set(rect); - m.mapRect(rectF); - rect.set( - (int) (rectF.left + 0.5f), - (int) (rectF.top + 0.5f), - (int) (rectF.right + 0.5f), - (int) (rectF.bottom + 0.5f)); - } - - /** - * Retrieve the transformed bounding rect of an arbitrary descendant view. This does not need to - * be a direct child. - * - * @param descendant descendant view to reference - * @param out rect to set to the bounds of the descendant view - */ - public static void getDescendantRect(ViewGroup parent, View descendant, Rect out) { - out.set(0, 0, descendant.getWidth(), descendant.getHeight()); - offsetDescendantRect(parent, descendant, out); - } - - private static void offsetDescendantMatrix(ViewParent target, View view, Matrix m) { - final ViewParent parent = view.getParent(); - if (parent instanceof View && parent != target) { - final View vp = (View) parent; - offsetDescendantMatrix(target, vp, m); - m.preTranslate(-vp.getScrollX(), -vp.getScrollY()); - } - - m.preTranslate(view.getLeft(), view.getTop()); - - if (!view.getMatrix().isIdentity()) { - m.preConcat(view.getMatrix()); - } - } -} diff --git a/ui_spinner/src/main/java/de/kuschku/ui/internal/ThemeEnforcement.java b/ui_spinner/src/main/java/de/kuschku/ui/internal/ThemeEnforcement.java deleted file mode 100644 index b103278cd69f437423cd049ce90803d0a356342e..0000000000000000000000000000000000000000 --- a/ui_spinner/src/main/java/de/kuschku/ui/internal/ThemeEnforcement.java +++ /dev/null @@ -1,102 +0,0 @@ -/* - * Copyright (C) 2017 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package de.kuschku.ui.internal; - -import android.content.Context; -import android.content.res.TypedArray; -import android.util.AttributeSet; - -import androidx.annotation.AttrRes; -import androidx.annotation.StyleRes; -import androidx.appcompat.view.ContextThemeWrapper; - -import de.kuschku.ui.spinner.R; - -/** - * Utility methods to check Theme compatibility with components. - */ -public final class ThemeEnforcement { - - private static final int[] ANDROID_THEME_OVERLAY_ATTRS = - new int[]{android.R.attr.theme, R.attr.theme}; - private static final int[] MATERIAL_THEME_OVERLAY_ATTR = new int[]{R.attr.materialThemeOverlay}; - - private ThemeEnforcement() { - } - - - /** - * Uses the materialThemeOverlay attribute to create a themed context. This allows us to use - * ThemeOverlays with a default style, and gives us some protection against losing our - * ThemeOverlay by clients who set android:theme or app:theme. If android:theme or app:theme is - * specified by the client, any attributes defined there will take precedence over attributes - * defined in materialThemeOverlay. - */ - public static Context createThemedContext( - Context context, AttributeSet attrs, @AttrRes int defStyleAttr, @StyleRes int defStyleRes) { - int materialThemeOverlayId = - obtainMaterialThemeOverlayId(context, attrs, defStyleAttr, defStyleRes); - if (materialThemeOverlayId != 0 - && (!(context instanceof ContextThemeWrapper) - || ((ContextThemeWrapper) context).getThemeResId() != materialThemeOverlayId)) { - // If the context isn't a ContextThemeWrapper, or it is but does not have the same theme as we - // need, wrap it in a new wrapper. - context = new ContextThemeWrapper(context, materialThemeOverlayId); - - // We want values set in android:theme or app:theme to always override values supplied by - // materialThemeOverlay, so we'll wrap the context again if either of those are set. - int androidThemeOverlayId = obtainAndroidThemeOverlayId(context, attrs); - if (androidThemeOverlayId != 0) { - context = new ContextThemeWrapper(context, androidThemeOverlayId); - } - } - return context; - } - - /** - * Retrieves the value of {@code android:theme} or {@code app:theme}, not taking into account - * {@code defStyleAttr} and {@code defStyleRes} because the Android theme overlays shouldn't work - * from default styles. - */ - @StyleRes - private static int obtainAndroidThemeOverlayId(Context context, AttributeSet attrs) { - TypedArray a = context.obtainStyledAttributes(attrs, ANDROID_THEME_OVERLAY_ATTRS); - int androidThemeId = a.getResourceId(0 /* index */, 0 /* defaultVal */); - int appThemeId = a.getResourceId(1 /* index */, 0 /* defaultVal */); - a.recycle(); - if (androidThemeId != 0) { - return androidThemeId; - } else { - return appThemeId; - } - } - - /** - * Retrieves the value of {@code materialThemeOverlay}, taking into account {@code defStyleAttr} - * and {@code defStyleRes} because the Material theme overlay should work from default styles. - */ - @StyleRes - private static int obtainMaterialThemeOverlayId( - Context context, AttributeSet attrs, @AttrRes int defStyleAttr, @StyleRes int defStyleRes) { - TypedArray a = - context.obtainStyledAttributes( - attrs, MATERIAL_THEME_OVERLAY_ATTR, defStyleAttr, defStyleRes); - int materialThemeOverlayId = a.getResourceId(0 /* index */, 0 /* defaultVal */); - a.recycle(); - return materialThemeOverlayId; - } -} diff --git a/ui_spinner/src/main/java/de/kuschku/ui/resources/MaterialAttributes.java b/ui_spinner/src/main/java/de/kuschku/ui/resources/MaterialAttributes.java deleted file mode 100644 index 1ae84762db1507f57f127e58dd82c6fa67f6aead..0000000000000000000000000000000000000000 --- a/ui_spinner/src/main/java/de/kuschku/ui/resources/MaterialAttributes.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (C) 2018 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package de.kuschku.ui.resources; - -import android.content.Context; -import android.util.TypedValue; - -import androidx.annotation.AttrRes; -import androidx.annotation.Nullable; - -/** - * Utility methods to work with attributes. - */ -public class MaterialAttributes { - /** - * Returns the {@link TypedValue} for the provided {@code attributeResId}. - */ - @Nullable - public static TypedValue resolveAttribute(Context context, @AttrRes int attributeResId) { - TypedValue typedValue = new TypedValue(); - if (context.getTheme().resolveAttribute(attributeResId, typedValue, true)) { - return typedValue; - } - return null; - } -} diff --git a/ui_spinner/src/main/java/de/kuschku/ui/resources/MaterialResources.java b/ui_spinner/src/main/java/de/kuschku/ui/resources/MaterialResources.java deleted file mode 100644 index 485d7f6fff8676395f5c32b9df4fa81016aa30d1..0000000000000000000000000000000000000000 --- a/ui_spinner/src/main/java/de/kuschku/ui/resources/MaterialResources.java +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Copyright (C) 2017 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package de.kuschku.ui.resources; - -import android.content.Context; -import android.content.res.ColorStateList; -import android.content.res.TypedArray; - -import androidx.annotation.Nullable; -import androidx.annotation.StyleableRes; -import androidx.appcompat.content.res.AppCompatResources; - -/** - * Utility methods to resolve resources for components. - */ -public class MaterialResources { - - private MaterialResources() { - } - - /** - * Returns the {@link ColorStateList} from the given {@link TypedArray} attributes. The resource - * can include themeable attributes, regardless of API level. - */ - @Nullable - public static ColorStateList getColorStateList( - Context context, TypedArray attributes, @StyleableRes int index) { - if (attributes.hasValue(index)) { - int resourceId = attributes.getResourceId(index, 0); - if (resourceId != 0) { - ColorStateList value = AppCompatResources.getColorStateList(context, resourceId); - if (value != null) { - return value; - } - } - } - - // Reading a single color with getColorStateList() on API 15 and below doesn't always correctly - // read the value. Instead we'll first try to read the color directly here. - - return attributes.getColorStateList(index); - } - - /** - * Returns the @StyleableRes index that contains value in the attributes array. If both indices - * contain values, the first given index takes precedence and is returned. - */ - @StyleableRes - static int getIndexWithValue(TypedArray attributes, @StyleableRes int a, @StyleableRes int b) { - if (attributes.hasValue(a)) { - return a; - } - return b; - } -} diff --git a/ui_spinner/src/main/java/de/kuschku/ui/shape/CornerFamily.java b/ui_spinner/src/main/java/de/kuschku/ui/shape/CornerFamily.java deleted file mode 100644 index 6ea72fea9595ecfb570a9eb25e70ecfe914bac4b..0000000000000000000000000000000000000000 --- a/ui_spinner/src/main/java/de/kuschku/ui/shape/CornerFamily.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright 2018 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package de.kuschku.ui.shape; - -import androidx.annotation.IntDef; - -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; - -/** - * CornerFamily enum that holds which family to be used to create a {@link CornerTreatment} - * - * <p>The corner family determines which family to use to create a {@link CornerTreatment}. Setting - * the CornerFamily to {@link CornerFamily#ROUNDED} sets the corner treatment to {@link - * RoundedCornerTreatment}, and setting the CornerFamily to {@link CornerFamily#CUT} sets the corner - * treatment to a {@link CutCornerTreatment}. - */ -@IntDef({CornerFamily.ROUNDED, CornerFamily.CUT}) -@Retention(RetentionPolicy.SOURCE) -public @interface CornerFamily { - /** - * Corresponds to a {@link RoundedCornerTreatment}. - */ - int ROUNDED = 0; - /** - * Corresponds to a {@link CutCornerTreatment}. - */ - int CUT = 1; -} diff --git a/ui_spinner/src/main/java/de/kuschku/ui/shape/CornerTreatment.java b/ui_spinner/src/main/java/de/kuschku/ui/shape/CornerTreatment.java deleted file mode 100644 index 6e5f971d08a0e731742bcbb9a45f82a2abc2b856..0000000000000000000000000000000000000000 --- a/ui_spinner/src/main/java/de/kuschku/ui/shape/CornerTreatment.java +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Copyright 2017 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package de.kuschku.ui.shape; - -/** - * A basic corner treatment (a single point which does not affect the shape). - * - * <p>Note: For corner treatments which result in a concave shape, the parent view must disable - * clipping of children by calling {@link android.view.ViewGroup#setClipChildren(boolean)}, or by - * setting `android:clipChildren="false"` in xml. `clipToPadding` may also need to be false if there - * is any padding on the parent that could intersect the shadow. - */ -public class CornerTreatment implements Cloneable { - - float cornerSize; - - CornerTreatment() { - // Default Constructor has no size. Using this treatment for all corners will draw a square - this.cornerSize = 0; - } - - CornerTreatment(float cornerSize) { - // Most CornerTreatments have a concept of corner size. This constructor is exposed for - // extending classes. - this.cornerSize = cornerSize; - } - - /** - * Generates a {@link ShapePath} for this corner treatment. - * - * <p>CornerTreatments are assumed to have an origin of (0, 0) (i.e. they represent the top-left - * corner), and are automatically rotated and scaled as necessary when applied to other corners. - * - * @param angle the angle of the corner, typically 90 degrees. - * @param interpolation the interpolation of the corner treatment. Ranges between 0 (none) and 1 - * (fully) interpolated. Custom corner treatments can implement interpolation to support shape - * transition between two arbitrary states. Typically, a value of 0 indicates that the custom - * corner treatment is not rendered (i.e. that it is a 90 degree angle), and a value of 1 - * indicates that the treatment is fully rendered. Animation between these two values can - * "heal" or "reveal" a corner treatment. - * @param shapePath the {@link ShapePath} that this treatment should write to. - */ - public void getCornerPath(float angle, float interpolation, ShapePath shapePath) { - } - - public float getCornerSize() { - return cornerSize; - } - - public void setCornerSize(float cornerSize) { - this.cornerSize = cornerSize; - } - - @Override - public CornerTreatment clone() { - try { - return (CornerTreatment) super.clone(); - } catch (CloneNotSupportedException e) { - throw new AssertionError(e); // This should never happen, because CornerTreatment handles the - // cloning, so all subclasses of CornerTreatment will support cloning. - } - } -} diff --git a/ui_spinner/src/main/java/de/kuschku/ui/shape/CutCornerTreatment.java b/ui_spinner/src/main/java/de/kuschku/ui/shape/CutCornerTreatment.java deleted file mode 100644 index 2a48ca9d0fb98293e206eabda621a6a8f5f8c441..0000000000000000000000000000000000000000 --- a/ui_spinner/src/main/java/de/kuschku/ui/shape/CutCornerTreatment.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright 2017 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package de.kuschku.ui.shape; - -/** - * A corner treatment which cuts or clips the original corner of a shape with a straight line. - */ -public class CutCornerTreatment extends CornerTreatment implements Cloneable { - - /** - * Instantiates a cut corner treatment of a given size. A cut corner treatment introduces two new - * corners to a shape, produced by a straight line drawn between two points {@param size} pixels - * away, on the vertical and horizontal axes, from the rectilinear (original) corner of the shape. - * Stated another way, if the rectilinear (original) corner of the shape was at co-ordinates (0, - * 0), the new corners are at co-ordinates (size, 0) and (0, size), and a straight line is drawn - * between them. - * - * @param size the length in pixels that the new corners will be drawn away from the origin. - */ - public CutCornerTreatment(float size) { - super(size); - } - - @Override - public void getCornerPath(float angle, float interpolation, ShapePath shapePath) { - shapePath.reset(0, cornerSize * interpolation); - shapePath.lineTo( - (float) (Math.sin(Math.toRadians(angle)) * cornerSize * interpolation), - // Something about using cos() is causing rounding which prevents the path from being convex - // on api levels 21 and 22. Using sin() with 90 - angle is helping for now. - (float) (Math.sin(Math.toRadians(90 - angle)) * cornerSize * interpolation)); - } -} diff --git a/ui_spinner/src/main/java/de/kuschku/ui/shape/EdgeTreatment.java b/ui_spinner/src/main/java/de/kuschku/ui/shape/EdgeTreatment.java deleted file mode 100644 index 91edd7e139c04268e84fe4d5c619a28ae2dc3862..0000000000000000000000000000000000000000 --- a/ui_spinner/src/main/java/de/kuschku/ui/shape/EdgeTreatment.java +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright 2017 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package de.kuschku.ui.shape; - -/** - * A basic edge treatment (a single straight line). Sub-classed for custom edge treatments. - * - * <p>Note: For edge treatments which result in a concave shape, the parent view must disable - * clipping of children by calling {@link android.view.ViewGroup#setClipChildren(boolean)}, or by - * setting `android:clipChildren="false"` in xml. `clipToPadding` may also need to be false if there - * is any padding on the parent that could intersect the shadow. - */ -public class EdgeTreatment implements Cloneable { - - /** - * @deprecated Does not support interpolation. Use {@link #getEdgePath(float, float, float, - * ShapePath)} instead. - */ - @Deprecated - public void getEdgePath(float length, float interpolation, ShapePath shapePath) { - // Best guess at center since it could be offset by corners of different size. - float center = length / 2f; - getEdgePath(length, center, interpolation, shapePath); - } - - /** - * Generates a {@link ShapePath} for this edge treatment. - * - * <p>EdgeTreatments have an origin of (0, 0) and a destination of (0, length) (i.e. they - * represent the top edge), and are automatically rotated and scaled as necessary when applied to - * other edges. Only the horizontal, top EdgeTreatment needs to be defined in order to apply it to - * all four edges. - * - * @param length the length of the edge. - * @param center the distance to the center of the edge. This takes into account any offset added - * by the proceeding corner. Drawing anything at (center, 0) will be center aligned with the - * shape. Normally you'll want to use this instead of length / 2. - * @param interpolation the interpolation of the edge treatment. Ranges between 0 (none) and 1 - * (fully) interpolated. Custom edge treatments can implement interpolation to support shape - * transition between two arbitrary states. Typically, a value of 0 indicates that the custom - * edge treatment is not rendered (i.e. that it is a straight line), and a value of 1 - * indicates that the treatment is fully rendered. Animation between these two values can - * "heal" or "reveal" an edge treatment. - * @param shapePath the {@link ShapePath} that this treatment should write to. - */ - public void getEdgePath(float length, float center, float interpolation, ShapePath shapePath) { - shapePath.lineTo(length, 0); - } - - @Override - public EdgeTreatment clone() { - try { - return (EdgeTreatment) super.clone(); - } catch (CloneNotSupportedException e) { - throw new AssertionError(e); // This should never happen, because EdgeTreatment handles the - // cloning, so all subclasses of EdgeTreatment will support cloning. - } - } -} diff --git a/ui_spinner/src/main/java/de/kuschku/ui/shape/MaterialShapeDrawable.java b/ui_spinner/src/main/java/de/kuschku/ui/shape/MaterialShapeDrawable.java deleted file mode 100644 index 2eb333bce97fab1c56069452614946e9b153b34c..0000000000000000000000000000000000000000 --- a/ui_spinner/src/main/java/de/kuschku/ui/shape/MaterialShapeDrawable.java +++ /dev/null @@ -1,552 +0,0 @@ -/* - * Copyright 2017 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package de.kuschku.ui.shape; - -import android.content.res.ColorStateList; -import android.graphics.Canvas; -import android.graphics.Color; -import android.graphics.ColorFilter; -import android.graphics.Matrix; -import android.graphics.Paint; -import android.graphics.Paint.Style; -import android.graphics.Path; -import android.graphics.PixelFormat; -import android.graphics.PorterDuff; -import android.graphics.PorterDuff.Mode; -import android.graphics.PorterDuffColorFilter; -import android.graphics.PorterDuffXfermode; -import android.graphics.Rect; -import android.graphics.RectF; -import android.graphics.Region; -import android.graphics.Region.Op; -import android.graphics.drawable.Drawable; - -import androidx.annotation.ColorInt; -import androidx.annotation.IntRange; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import androidx.core.util.ObjectsCompat; - -import org.jetbrains.annotations.NotNull; - -import de.kuschku.ui.graphics.drawable.TintAwareDrawable; - -/** - * Base drawable class for Material Shapes that handles shadows, elevation, scale and color for a - * generated path. - */ -public class MaterialShapeDrawable extends Drawable - implements TintAwareDrawable, ShapeAppearanceModel.OnChangedListener { - - private static final Paint clearPaint = new Paint(Paint.ANTI_ALIAS_FLAG); - // Pre-allocated objects that are re-used several times during path computation and rendering. - private final Matrix matrix = new Matrix(); - private final Path path = new Path(); - private final Path pathInsetByStroke = new Path(); - private final RectF rectF = new RectF(); - private final RectF insetRectF = new RectF(); - private final Region transparentRegion = new Region(); - private final Region scratchRegion = new Region(); - private final Paint fillPaint = new Paint(Paint.ANTI_ALIAS_FLAG); - private final Paint strokePaint = new Paint(Paint.ANTI_ALIAS_FLAG); - private final ShapeAppearancePathProvider pathProvider = new ShapeAppearancePathProvider(); - private MaterialShapeDrawableState drawableState; - // Inter-method state. - private boolean pathDirty; - private ShapeAppearanceModel strokeShapeAppearance; - @Nullable - private PorterDuffColorFilter tintFilter; - @Nullable - private PorterDuffColorFilter strokeTintFilter; - - public MaterialShapeDrawable() { - this(new ShapeAppearanceModel()); - } - - /** - * @param shapeAppearanceModel the {@link ShapeAppearanceModel} containing the path that will be - * rendered in this drawable. - */ - public MaterialShapeDrawable(ShapeAppearanceModel shapeAppearanceModel) { - this(new MaterialShapeDrawableState(shapeAppearanceModel)); - } - - private MaterialShapeDrawable(MaterialShapeDrawableState drawableState) { - this.drawableState = drawableState; - strokePaint.setStyle(Style.STROKE); - fillPaint.setStyle(Style.FILL); - clearPaint.setColor(Color.WHITE); - clearPaint.setXfermode(new PorterDuffXfermode(Mode.DST_OUT)); - updateTintFilter(); - updateColorsForState(getState()); - - // Listens for modifications made in the ShapeAppearanceModel, and requests a redraw if the - // ShapeAppearanceModel has changed. - drawableState.shapeAppearanceModel.addOnChangedListener(this); - } - - private static int modulateAlpha(int paintAlpha, int alpha) { - int scale = alpha + (alpha >>> 7); // convert to 0..256 - return (paintAlpha * scale) >>> 8; - } - - @Nullable - @Override - public ConstantState getConstantState() { - return drawableState; - } - - @NonNull - @Override - public Drawable mutate() { - drawableState = new MaterialShapeDrawableState(drawableState); - return this; - } - - /** - * Get the {@link ShapeAppearanceModel} containing the path that will be rendered in this - * drawable. - * - * @return the current model. - */ - @NonNull - private ShapeAppearanceModel getShapeAppearanceModel() { - return drawableState.shapeAppearanceModel; - } - - /** - * Set the {@link ShapeAppearanceModel} containing the path that will be rendered in this - * drawable. - * - * @param shapeAppearanceModel the desired model. - */ - public void setShapeAppearanceModel(@NonNull ShapeAppearanceModel shapeAppearanceModel) { - drawableState.shapeAppearanceModel.removeOnChangedListener(this); - drawableState.shapeAppearanceModel = shapeAppearanceModel; - shapeAppearanceModel.addOnChangedListener(this); - invalidateSelf(); - } - - /** - * Set the color used for the fill. - * - * @param fillColor the color set on the {@link Paint} object responsible for the fill. - */ - public void setFillColor(@Nullable ColorStateList fillColor) { - if (drawableState.fillColor != fillColor) { - drawableState.fillColor = fillColor; - onStateChange(getState()); - } - } - - /** - * Set the color used for the stroke. - * - * @param strokeColor the color set on the {@link Paint} object responsible for the stroke. - */ - private void setStrokeColor(@Nullable ColorStateList strokeColor) { - if (drawableState.strokeColor != strokeColor) { - drawableState.strokeColor = strokeColor; - onStateChange(getState()); - } - } - - @Override - public void setTintMode(@Nullable PorterDuff.Mode tintMode) { - if (drawableState.tintMode != tintMode) { - drawableState.tintMode = tintMode; - updateTintFilter(); - invalidateSelfIgnoreShape(); - } - } - - @Override - public void setTintList(@Nullable ColorStateList tintList) { - drawableState.tintList = tintList; - updateTintFilter(); - invalidateSelfIgnoreShape(); - } - - @Override - public void setTint(@ColorInt int tintColor) { - setTintList(ColorStateList.valueOf(tintColor)); - } - - /** - * Set the shape's stroke width and stroke color. - * - * @param strokeWidth a float for the width of the stroke. - * @param strokeColor an int representing the Color to use for the shape's stroke. - */ - public void setStroke(float strokeWidth, @ColorInt int strokeColor) { - setStrokeWidth(strokeWidth); - setStrokeColor(ColorStateList.valueOf(strokeColor)); - } - - /** - * Set the stroke width used by the shape's paint. - * - * @param strokeWidth desired stroke width. - */ - private void setStrokeWidth(float strokeWidth) { - drawableState.strokeWidth = strokeWidth; - invalidateSelf(); - } - - @Override - public int getOpacity() { - // OPAQUE or TRANSPARENT are possible, but the complexity of determining this based on the - // shape model outweighs the optimizations gained. - return PixelFormat.TRANSLUCENT; - } - - @Override - public void setAlpha(@IntRange(from = 0, to = 255) int alpha) { - if (drawableState.alpha != alpha) { - drawableState.alpha = alpha; - invalidateSelfIgnoreShape(); - } - } - - @Override - public void setColorFilter(@Nullable ColorFilter colorFilter) { - drawableState.colorFilter = colorFilter; - invalidateSelfIgnoreShape(); - } - - @Override - public Region getTransparentRegion() { - Rect bounds = getBounds(); - transparentRegion.set(bounds); - calculatePath(getBoundsAsRectF(), path); - scratchRegion.setPath(path, transparentRegion); - transparentRegion.op(scratchRegion, Op.DIFFERENCE); - return transparentRegion; - } - - private RectF getBoundsAsRectF() { - Rect bounds = getBounds(); - rectF.set(bounds.left, bounds.top, bounds.right, bounds.bottom); - return rectF; - } - - @Override - public void onShapeAppearanceModelChanged() { - invalidateSelf(); - } - - @Override - public void invalidateSelf() { - pathDirty = true; - super.invalidateSelf(); - } - - /** - * Invalidate without recalculating the path associated with this shape. This is useful if the - * shape has stayed the same but we still need to be redrawn, such as when the color has changed. - */ - private void invalidateSelfIgnoreShape() { - super.invalidateSelf(); - } - - /** - * Returns whether the shape has a fill. - */ - private boolean hasFill() { - return drawableState.paintStyle == Style.FILL_AND_STROKE - || drawableState.paintStyle == Style.FILL; - } - - /** - * Returns whether the shape has a stroke with a positive width. - */ - private boolean hasStroke() { - return (drawableState.paintStyle == Style.FILL_AND_STROKE - || drawableState.paintStyle == Style.STROKE) - && strokePaint.getStrokeWidth() > 0; - } - - @Override - protected void onBoundsChange(Rect bounds) { - pathDirty = true; - super.onBoundsChange(bounds); - } - - @Override - public void draw(@NotNull Canvas canvas) { - fillPaint.setColorFilter(tintFilter); - final int prevAlpha = fillPaint.getAlpha(); - fillPaint.setAlpha(modulateAlpha(prevAlpha, drawableState.alpha)); - - strokePaint.setColorFilter(strokeTintFilter); - strokePaint.setStrokeWidth(drawableState.strokeWidth); - - final int prevStrokeAlpha = strokePaint.getAlpha(); - strokePaint.setAlpha(modulateAlpha(prevStrokeAlpha, drawableState.alpha)); - - if (pathDirty) { - calculateStrokePath(); - calculatePath(getBoundsAsRectF(), path); - pathDirty = false; - } - - if (hasFill()) { - drawFillShape(canvas); - } - if (hasStroke()) { - drawStrokeShape(canvas); - } - - fillPaint.setAlpha(prevAlpha); - strokePaint.setAlpha(prevStrokeAlpha); - } - - /** - * Draw the path or try to draw a round rect if possible. - */ - private void drawShape( - Canvas canvas, - Paint paint, - Path path, - ShapeAppearanceModel shapeAppearanceModel, - RectF bounds) { - if (shapeAppearanceModel.isRoundRect()) { - float cornerSize = shapeAppearanceModel.getTopRightCorner().getCornerSize(); - canvas.drawRoundRect(bounds, cornerSize, cornerSize, paint); - } else { - canvas.drawPath(path, paint); - } - } - - private void drawFillShape(Canvas canvas) { - drawShape(canvas, fillPaint, path, drawableState.shapeAppearanceModel, getBoundsAsRectF()); - } - - private void drawStrokeShape(Canvas canvas) { - drawShape( - canvas, strokePaint, pathInsetByStroke, strokeShapeAppearance, getBoundsInsetByStroke()); - } - - /** - * @deprecated see {@link ShapeAppearancePathProvider} - */ - @Deprecated - public void getPathForSize(int width, int height, Path path) { - calculatePathForSize(new RectF(0, 0, width, height), path); - } - - /** - * @deprecated see {@link ShapeAppearancePathProvider} - */ - @Deprecated - public void getPathForSize(Rect bounds, Path path) { - calculatePathForSize(new RectF(bounds), path); - } - - private void calculatePathForSize(RectF bounds, Path path) { - pathProvider.calculatePath( - drawableState.shapeAppearanceModel, - drawableState.interpolation, - bounds, - null, - path); - } - - /** - * Calculates the path that can be used to draw the stroke entirely inside the shape - */ - private void calculateStrokePath() { - strokeShapeAppearance = new ShapeAppearanceModel(getShapeAppearanceModel()); - float cornerSizeTopLeft = strokeShapeAppearance.getTopLeftCorner().cornerSize; - float cornerSizeTopRight = strokeShapeAppearance.getTopRightCorner().cornerSize; - float cornerSizeBottomRight = strokeShapeAppearance.getBottomRightCorner().cornerSize; - float cornerSizeBottomLeft = strokeShapeAppearance.getBottomLeftCorner().cornerSize; - - // Adjust corner radius in order to draw the stroke so that the corners of the background are - // drawn on top of the edges. - strokeShapeAppearance.setCornerRadii( - adjustCornerSizeForStrokeSize(cornerSizeTopLeft), - adjustCornerSizeForStrokeSize(cornerSizeTopRight), - adjustCornerSizeForStrokeSize(cornerSizeBottomRight), - adjustCornerSizeForStrokeSize(cornerSizeBottomLeft)); - - pathProvider.calculatePath( - strokeShapeAppearance, - drawableState.interpolation, - getBoundsInsetByStroke(), - pathInsetByStroke); - } - - private float adjustCornerSizeForStrokeSize(float cornerSize) { - float adjustedCornerSize = cornerSize - getStrokeInsetLength(); - return Math.max(adjustedCornerSize, 0); - } - - private void calculatePath(RectF bounds, Path path) { - calculatePathForSize(bounds, path); - if (drawableState.scale == 1f) { - return; - } - matrix.reset(); - matrix.setScale( - drawableState.scale, drawableState.scale, bounds.width() / 2.0f, bounds.height() / 2.0f); - path.transform(matrix); - } - - private boolean updateTintFilter() { - PorterDuffColorFilter originalTintFilter = tintFilter; - PorterDuffColorFilter originalStrokeTintFilter = strokeTintFilter; - tintFilter = - calculateTintFilter( - drawableState.tintList, - drawableState.tintMode - ); - strokeTintFilter = - calculateTintFilter( - drawableState.strokeTintList, - drawableState.tintMode - ); - return !ObjectsCompat.equals(originalTintFilter, tintFilter) - || !ObjectsCompat.equals(originalStrokeTintFilter, strokeTintFilter); - } - - @Nullable - private PorterDuffColorFilter calculateTintFilter(ColorStateList tintList, PorterDuff.Mode tintMode) { - return tintList == null || tintMode == null - ? null - : new PorterDuffColorFilter(tintList.getColorForState(getState(), Color.TRANSPARENT), tintMode); - } - - @Override - public boolean isStateful() { - return super.isStateful() - || (drawableState.tintList != null && drawableState.tintList.isStateful()) - || (drawableState.strokeTintList != null && drawableState.strokeTintList.isStateful()) - || (drawableState.strokeColor != null && drawableState.strokeColor.isStateful()) - || (drawableState.fillColor != null && drawableState.fillColor.isStateful()); - } - - @Override - protected boolean onStateChange(int[] state) { - boolean paintColorChanged = updateColorsForState(state); - boolean tintFilterChanged = updateTintFilter(); - boolean invalidateSelf = paintColorChanged || tintFilterChanged; - if (invalidateSelf) { - invalidateSelf(); - } - return invalidateSelf; - } - - private boolean updateColorsForState(int[] state) { - boolean invalidateSelf = false; - - if (drawableState.fillColor != null) { - final int previousFillColor = fillPaint.getColor(); - final int newFillColor = drawableState.fillColor.getColorForState(state, previousFillColor); - if (previousFillColor != newFillColor) { - fillPaint.setColor(newFillColor); - invalidateSelf = true; - } - } - - if (drawableState.strokeColor != null) { - final int previousStrokeColor = strokePaint.getColor(); - final int newStrokeColor = - drawableState.strokeColor.getColorForState(state, previousStrokeColor); - if (previousStrokeColor != newStrokeColor) { - strokePaint.setColor(newStrokeColor); - invalidateSelf = true; - } - } - - return invalidateSelf; - } - - private float getStrokeInsetLength() { - if (hasStroke()) { - return strokePaint.getStrokeWidth() / 2.0f; - } - return 0f; - } - - private RectF getBoundsInsetByStroke() { - RectF rectF = getBoundsAsRectF(); - float inset = getStrokeInsetLength(); - insetRectF.set( - rectF.left + inset, rectF.top + inset, rectF.right - inset, rectF.bottom - inset); - return insetRectF; - } - - static final class MaterialShapeDrawableState extends ConstantState { - - @NonNull - ShapeAppearanceModel shapeAppearanceModel; - - @Nullable - ColorFilter colorFilter; - @Nullable - ColorStateList fillColor = null; - @Nullable - ColorStateList strokeColor = null; - @Nullable - ColorStateList strokeTintList = null; - @Nullable - ColorStateList tintList = null; - @Nullable - PorterDuff.Mode tintMode = PorterDuff.Mode.SRC_IN; - - float scale = 1f; - float interpolation = 1f; - float strokeWidth; - - int alpha = 255; - - boolean useTintColorForShadow = false; - - Style paintStyle = Style.FILL_AND_STROKE; - - MaterialShapeDrawableState(@NotNull ShapeAppearanceModel shapeAppearanceModel) { - this.shapeAppearanceModel = shapeAppearanceModel; - } - - MaterialShapeDrawableState(MaterialShapeDrawableState orig) { - shapeAppearanceModel = orig.shapeAppearanceModel; - strokeWidth = orig.strokeWidth; - colorFilter = orig.colorFilter; - fillColor = orig.fillColor; - strokeColor = orig.strokeColor; - tintMode = orig.tintMode; - tintList = orig.tintList; - alpha = orig.alpha; - scale = orig.scale; - useTintColorForShadow = orig.useTintColorForShadow; - interpolation = orig.interpolation; - strokeTintList = orig.strokeTintList; - paintStyle = orig.paintStyle; - } - - @Override - public Drawable newDrawable() { - return new MaterialShapeDrawable(this); - } - - @Override - public int getChangingConfigurations() { - return 0; - } - } -} diff --git a/ui_spinner/src/main/java/de/kuschku/ui/shape/MaterialShapeUtils.java b/ui_spinner/src/main/java/de/kuschku/ui/shape/MaterialShapeUtils.java deleted file mode 100644 index e8043b8d451b41bfbf7b9beafea1c17168c5d6d8..0000000000000000000000000000000000000000 --- a/ui_spinner/src/main/java/de/kuschku/ui/shape/MaterialShapeUtils.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright 2018 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package de.kuschku.ui.shape; - -/** - * Utility methods for {@link MaterialShapeDrawable} and related classes. - */ -class MaterialShapeUtils { - - static CornerTreatment createCornerTreatment(@CornerFamily int cornerFamily, int cornerSize) { - switch (cornerFamily) { - case CornerFamily.ROUNDED: - return new RoundedCornerTreatment(cornerSize); - case CornerFamily.CUT: - return new CutCornerTreatment(cornerSize); - default: - return createDefaultCornerTreatment(); - } - } - - static CornerTreatment createDefaultCornerTreatment() { - return new RoundedCornerTreatment(0); - } - - static EdgeTreatment createDefaultEdgeTreatment() { - return new EdgeTreatment(); - } -} diff --git a/ui_spinner/src/main/java/de/kuschku/ui/shape/RoundedCornerTreatment.java b/ui_spinner/src/main/java/de/kuschku/ui/shape/RoundedCornerTreatment.java deleted file mode 100644 index 3cec841a080c7482cb315e2d8762300c5dbe8592..0000000000000000000000000000000000000000 --- a/ui_spinner/src/main/java/de/kuschku/ui/shape/RoundedCornerTreatment.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright 2017 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package de.kuschku.ui.shape; - -/** - * A corner treatment which rounds a corner of a shape. - */ -public class RoundedCornerTreatment extends CornerTreatment implements Cloneable { - - /** - * Instantiates a rounded corner treatment. - * - * @param radius the radius, in pixels, of the rounded corner, which is rendered as a quarter - * circle. - */ - public RoundedCornerTreatment(float radius) { - super(radius); - } - - @Override - public void getCornerPath(float angle, float interpolation, ShapePath shapePath) { - float radius = cornerSize; - shapePath.reset(0, radius * interpolation); - shapePath.addArc(0, 0, 2 * radius * interpolation, 2 * radius * interpolation, 180, angle); - } -} diff --git a/ui_spinner/src/main/java/de/kuschku/ui/shape/ShapeAppearanceModel.java b/ui_spinner/src/main/java/de/kuschku/ui/shape/ShapeAppearanceModel.java deleted file mode 100644 index f5b481dd3cfc35b45ddf2d6a98f3730efdd1f5ce..0000000000000000000000000000000000000000 --- a/ui_spinner/src/main/java/de/kuschku/ui/shape/ShapeAppearanceModel.java +++ /dev/null @@ -1,638 +0,0 @@ -/* - * Copyright 2018 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package de.kuschku.ui.shape; - -import android.content.Context; -import android.content.res.TypedArray; -import android.graphics.Canvas; -import android.graphics.Paint; -import android.graphics.RectF; -import android.util.AttributeSet; -import android.view.ContextThemeWrapper; - -import androidx.annotation.AttrRes; -import androidx.annotation.Dimension; -import androidx.annotation.Nullable; -import androidx.annotation.StyleRes; - -import java.util.LinkedHashSet; -import java.util.Set; - -import de.kuschku.ui.spinner.R; - -/** - * This class models the edges and corners of a shape, which are used by {@link - * MaterialShapeDrawable} to generate and render the shape for a view's background. - */ -public class ShapeAppearanceModel { - - private final Set<OnChangedListener> onChangedListeners = new LinkedHashSet<>(); - private CornerTreatment topLeftCorner; - private CornerTreatment topRightCorner; - private CornerTreatment bottomRightCorner; - private CornerTreatment bottomLeftCorner; - private EdgeTreatment topEdge; - private EdgeTreatment rightEdge; - private EdgeTreatment bottomEdge; - private EdgeTreatment leftEdge; - - /** - * Constructs a default path generator with default edge and corner treatments. - */ - public ShapeAppearanceModel() { - setTopLeftCornerInternal(MaterialShapeUtils.createDefaultCornerTreatment()); - setTopRightCornerInternal(MaterialShapeUtils.createDefaultCornerTreatment()); - setBottomRightCornerInternal(MaterialShapeUtils.createDefaultCornerTreatment()); - setBottomLeftCornerInternal(MaterialShapeUtils.createDefaultCornerTreatment()); - - setLeftEdgeInternal(MaterialShapeUtils.createDefaultEdgeTreatment()); - setTopEdgeInternal(MaterialShapeUtils.createDefaultEdgeTreatment()); - setRightEdgeInternal(MaterialShapeUtils.createDefaultEdgeTreatment()); - setBottomEdgeInternal(MaterialShapeUtils.createDefaultEdgeTreatment()); - - onShapeAppearanceModelChanged(); - } - - public ShapeAppearanceModel(ShapeAppearanceModel shapeAppearanceModel) { - setTopLeftCornerInternal(shapeAppearanceModel.getTopLeftCorner().clone()); - setTopRightCornerInternal(shapeAppearanceModel.getTopRightCorner().clone()); - setBottomRightCornerInternal(shapeAppearanceModel.getBottomRightCorner().clone()); - setBottomLeftCornerInternal(shapeAppearanceModel.getBottomLeftCorner().clone()); - - setLeftEdgeInternal(shapeAppearanceModel.getLeftEdge().clone()); - setTopEdgeInternal(shapeAppearanceModel.getTopEdge().clone()); - setRightEdgeInternal(shapeAppearanceModel.getRightEdge().clone()); - setBottomEdgeInternal(shapeAppearanceModel.getBottomEdge().clone()); - } - - public ShapeAppearanceModel( - Context context, AttributeSet attrs, @AttrRes int defStyleAttr, @StyleRes int defStyleRes) { - this(context, attrs, defStyleAttr, defStyleRes, 0); - } - - private ShapeAppearanceModel( - Context context, - AttributeSet attrs, - @AttrRes int defStyleAttr, - @StyleRes int defStyleRes, - int defaultCornerSize) { - TypedArray a = - context.obtainStyledAttributes(attrs, R.styleable.MaterialShape, defStyleAttr, defStyleRes); - - int shapeAppearanceResId = a.getResourceId(R.styleable.MaterialShape_md_shapeAppearance, 0); - int shapeAppearanceOverlayResId = - a.getResourceId(R.styleable.MaterialShape_md_shapeAppearanceOverlay, 0); - a.recycle(); - - // The attributes in shapeAppearanceOverlay should be applied on top of shapeAppearance. - if (shapeAppearanceOverlayResId != 0) { - context = new ContextThemeWrapper(context, shapeAppearanceResId); - shapeAppearanceResId = shapeAppearanceOverlayResId; - } - - a = context.obtainStyledAttributes(shapeAppearanceResId, R.styleable.ShapeAppearance); - - int cornerFamily = a.getInt(R.styleable.ShapeAppearance_md_cornerFamily, CornerFamily.ROUNDED); - int cornerFamilyTopLeft = - a.getInt(R.styleable.ShapeAppearance_md_cornerFamilyTopLeft, cornerFamily); - int cornerFamilyTopRight = - a.getInt(R.styleable.ShapeAppearance_md_cornerFamilyTopRight, cornerFamily); - int cornerFamilyBottomRight = - a.getInt(R.styleable.ShapeAppearance_md_cornerFamilyBottomRight, cornerFamily); - int cornerFamilyBottomLeft = - a.getInt(R.styleable.ShapeAppearance_md_cornerFamilyBottomLeft, cornerFamily); - - int cornerSize = - a.getDimensionPixelSize(R.styleable.ShapeAppearance_md_cornerSize, defaultCornerSize); - int cornerSizeTopLeft = - a.getDimensionPixelSize(R.styleable.ShapeAppearance_md_cornerSizeTopLeft, cornerSize); - int cornerSizeTopRight = - a.getDimensionPixelSize(R.styleable.ShapeAppearance_md_cornerSizeTopRight, cornerSize); - int cornerSizeBottomRight = - a.getDimensionPixelSize(R.styleable.ShapeAppearance_md_cornerSizeBottomRight, cornerSize); - int cornerSizeBottomLeft = - a.getDimensionPixelSize(R.styleable.ShapeAppearance_md_cornerSizeBottomLeft, cornerSize); - - setTopLeftCornerInternal( - MaterialShapeUtils.createCornerTreatment(cornerFamilyTopLeft, cornerSizeTopLeft)); - setTopRightCornerInternal( - MaterialShapeUtils.createCornerTreatment(cornerFamilyTopRight, cornerSizeTopRight)); - setBottomRightCornerInternal( - MaterialShapeUtils.createCornerTreatment(cornerFamilyBottomRight, cornerSizeBottomRight)); - setBottomLeftCornerInternal( - MaterialShapeUtils.createCornerTreatment(cornerFamilyBottomLeft, cornerSizeBottomLeft)); - - setTopEdgeInternal(MaterialShapeUtils.createDefaultEdgeTreatment()); - setRightEdgeInternal(MaterialShapeUtils.createDefaultEdgeTreatment()); - setBottomEdgeInternal(MaterialShapeUtils.createDefaultEdgeTreatment()); - setLeftEdgeInternal(MaterialShapeUtils.createDefaultEdgeTreatment()); - - a.recycle(); - } - - /** - * Sets all corner treatments to {@link CornerTreatment}s generated from a {@code cornerFamily} - * and {@code cornerSize}. - * - * @param cornerFamily The family to be used to create the {@link CornerTreatment}s for all four - * corners. May be one of {@link CornerFamily#ROUNDED} or {@link CornerFamily#CUT}. - * @param cornerSize The size to be used to create the {@link CornerTreatment}s for all four - * corners. - */ - public void setAllCorners(@CornerFamily int cornerFamily, @Dimension int cornerSize) { - setAllCorners(MaterialShapeUtils.createCornerTreatment(cornerFamily, cornerSize)); - } - - /** - * Sets all corner treatments. - * - * @param cornerTreatment the corner treatment to use for all four corners. - */ - private void setAllCorners(CornerTreatment cornerTreatment) { - boolean changed = setTopLeftCornerInternal(cornerTreatment.clone()); - changed |= setTopRightCornerInternal(cornerTreatment.clone()); - changed |= setBottomRightCornerInternal(cornerTreatment.clone()); - changed |= setBottomLeftCornerInternal(cornerTreatment.clone()); - - if (changed) { - onShapeAppearanceModelChanged(); - } - } - - /** - * Sets the corner size of all four corner treatments to {@code cornerRadius}. This is a - * convenience method for {@link #setCornerRadii(float, float, float, float)})}. - * - * <p>Note: This method does not create new {@link CornerTreatment}s for all four corners. - * Instead, it directly modifies the corner size of each existing corner treatment. - * - * @see #setCornerRadii(float, float, float, float) - */ - public void setCornerRadius(float cornerRadius) { - setCornerRadii(cornerRadius, cornerRadius, cornerRadius, cornerRadius); - } - - /** - * Sets the corner size of all four corner treatments using the {@code topLeftCornerRadius}, - * {@code topRightCornerRadius}, {@code bottomRightCornerRadius}, and {@code - * bottomLeftCornerRadius}. - * - * <p>Note: This method does not create new {@link CornerTreatment}s for all four corners. - * Instead, it directly modifies the corner size of each existing corner treatment. - */ - public void setCornerRadii( - float topLeftCornerRadius, - float topRightCornerRadius, - float bottomRightCornerRadius, - float bottomLeftCornerRadius) { - boolean changed = setTopLeftCornerSizeInternal(topLeftCornerRadius); - changed |= setTopRightCornerSizeInternal(topRightCornerRadius); - changed |= setBottomRightCornerSizeInternal(bottomRightCornerRadius); - changed |= setBottomLeftCornerSizeInternal(bottomLeftCornerRadius); - - if (changed) { - onShapeAppearanceModelChanged(); - } - } - - private boolean setTopLeftCornerSizeInternal(float topLeftCornerSize) { - boolean changed = false; - if (this.topLeftCorner.cornerSize != topLeftCornerSize) { - this.topLeftCorner.cornerSize = topLeftCornerSize; - changed = true; - } - return changed; - } - - private boolean setTopRightCornerSizeInternal(float topRightCornerSize) { - boolean changed = false; - if (this.topRightCorner.cornerSize != topRightCornerSize) { - this.topRightCorner.cornerSize = topRightCornerSize; - changed = true; - } - return changed; - } - - private boolean setBottomRightCornerSizeInternal(float bottomRightCornerSize) { - boolean changed = false; - if (this.bottomRightCorner.cornerSize != bottomRightCornerSize) { - this.bottomRightCorner.cornerSize = bottomRightCornerSize; - changed = true; - } - return changed; - } - - private boolean setBottomLeftCornerSizeInternal(float bottomLeftCornerSize) { - boolean changed = false; - if (this.bottomLeftCorner.cornerSize != bottomLeftCornerSize) { - this.bottomLeftCorner.cornerSize = bottomLeftCornerSize; - changed = true; - } - return changed; - } - - /** - * Sets all edge treatments. - * - * @param edgeTreatment the edge treatment to use for all four edges. - */ - public void setAllEdges(EdgeTreatment edgeTreatment) { - boolean changed = setLeftEdgeInternal(edgeTreatment.clone()); - changed |= setTopEdgeInternal(edgeTreatment.clone()); - changed |= setRightEdgeInternal(edgeTreatment.clone()); - changed |= setBottomEdgeInternal(edgeTreatment.clone()); - - if (changed) { - onShapeAppearanceModelChanged(); - } - } - - /** - * Sets corner treatments. - * - * @param topLeftCorner the corner treatment to use in the top left corner. - * @param topRightCorner the corner treatment to use in the top right corner. - * @param bottomRightCorner the corner treatment to use in the bottom right corner. - * @param bottomLeftCorner the corner treatment to use in the bottom left corner. - */ - public void setCornerTreatments( - CornerTreatment topLeftCorner, - CornerTreatment topRightCorner, - CornerTreatment bottomRightCorner, - CornerTreatment bottomLeftCorner) { - boolean changed = setTopLeftCornerInternal(topLeftCorner); - changed |= setTopRightCornerInternal(topRightCorner); - changed |= setBottomRightCornerInternal(bottomRightCorner); - changed |= setBottomLeftCornerInternal(bottomLeftCorner); - - if (changed) { - onShapeAppearanceModelChanged(); - } - } - - /** - * Sets edge treatments. - * - * @param leftEdge the edge treatment to use on the left edge. - * @param topEdge the edge treatment to use on the top edge. - * @param rightEdge the edge treatment to use on the right edge. - * @param bottomEdge the edge treatment to use on the bottom edge. - */ - public void setEdgeTreatments( - EdgeTreatment leftEdge, - EdgeTreatment topEdge, - EdgeTreatment rightEdge, - EdgeTreatment bottomEdge) { - boolean changed = setLeftEdgeInternal(leftEdge); - changed |= setTopEdgeInternal(topEdge); - changed |= setRightEdgeInternal(rightEdge); - changed |= setBottomEdgeInternal(bottomEdge); - - if (changed) { - onShapeAppearanceModelChanged(); - } - } - - /** - * Sets the corner treatment for the top left corner. - * - * @param cornerFamily the family to use to create the corner treatment - * @param cornerSize the size to use to create the corner treatment - */ - public void setTopLeftCorner(@CornerFamily int cornerFamily, @Dimension int cornerSize) { - setTopLeftCorner(MaterialShapeUtils.createCornerTreatment(cornerFamily, cornerSize)); - } - - private boolean setTopLeftCornerInternal(CornerTreatment topLeftCorner) { - boolean changed = false; - if (this.topLeftCorner != topLeftCorner) { - this.topLeftCorner = topLeftCorner; - changed = true; - } - return changed; - } - - /** - * Gets the corner treatment for the top left corner. - * - * @return the corner treatment for the top left corner. - */ - public CornerTreatment getTopLeftCorner() { - return topLeftCorner; - } - - /** - * Sets the corner treatment for the top left corner. - * - * @param topLeftCorner the desired treatment. - */ - private void setTopLeftCorner(CornerTreatment topLeftCorner) { - if (setTopLeftCornerInternal(topLeftCorner)) { - onShapeAppearanceModelChanged(); - } - } - - /** - * Sets the corner treatment for the top right corner. - * - * @param cornerFamily the family to use to create the corner treatment - * @param cornerSize the size to use to create the corner treatment - */ - public void setTopRightCorner(@CornerFamily int cornerFamily, @Dimension int cornerSize) { - setTopRightCorner(MaterialShapeUtils.createCornerTreatment(cornerFamily, cornerSize)); - } - - private boolean setTopRightCornerInternal(CornerTreatment topRightCorner) { - boolean changed = false; - if (this.topRightCorner != topRightCorner) { - this.topRightCorner = topRightCorner; - changed = true; - } - return changed; - } - - /** - * Gets the corner treatment for the top right corner. - * - * @return the corner treatment for the top right corner. - */ - public CornerTreatment getTopRightCorner() { - return topRightCorner; - } - - /** - * Sets the corner treatment for the top right corner. - * - * @param topRightCorner the desired treatment. - */ - private void setTopRightCorner(CornerTreatment topRightCorner) { - if (setTopRightCornerInternal(topRightCorner)) { - onShapeAppearanceModelChanged(); - } - } - - /** - * Sets the corner treatment for the bottom right corner. - * - * @param cornerFamily the family to use to create the corner treatment - * @param cornerSize the size to use to create the corner treatment - */ - public void setBottomRightCorner(@CornerFamily int cornerFamily, @Dimension int cornerSize) { - setBottomRightCorner(MaterialShapeUtils.createCornerTreatment(cornerFamily, cornerSize)); - } - - private boolean setBottomRightCornerInternal(CornerTreatment bottomRightCorner) { - boolean changed = false; - if (this.bottomRightCorner != bottomRightCorner) { - this.bottomRightCorner = bottomRightCorner; - changed = true; - } - return changed; - } - - /** - * Gets the corner treatment for the bottom right corner. - * - * @return the corner treatment for the bottom right corner. - */ - public CornerTreatment getBottomRightCorner() { - return bottomRightCorner; - } - - /** - * Sets the corner treatment for the bottom right corner. - * - * @param bottomRightCorner the desired treatment. - */ - private void setBottomRightCorner(CornerTreatment bottomRightCorner) { - if (setBottomRightCornerInternal(bottomRightCorner)) { - onShapeAppearanceModelChanged(); - } - } - - /** - * Sets the corner treatment for the bottom left corner. - * - * @param cornerFamily the family to use to create the corner treatment - * @param cornerSize the size to use to create the corner treatment - */ - public void setBottomLeftCorner(@CornerFamily int cornerFamily, @Dimension int cornerSize) { - setBottomLeftCorner(MaterialShapeUtils.createCornerTreatment(cornerFamily, cornerSize)); - } - - private boolean setBottomLeftCornerInternal(CornerTreatment bottomLeftCorner) { - boolean changed = false; - if (this.bottomLeftCorner != bottomLeftCorner) { - this.bottomLeftCorner = bottomLeftCorner; - changed = true; - } - return changed; - } - - /** - * Gets the corner treatment for the bottom left corner. - * - * @return the corner treatment for the bottom left corner. - */ - public CornerTreatment getBottomLeftCorner() { - return bottomLeftCorner; - } - - /** - * Sets the corner treatment for the bottom left corner. - * - * @param bottomLeftCorner the desired treatment. - */ - private void setBottomLeftCorner(CornerTreatment bottomLeftCorner) { - if (setBottomLeftCornerInternal(bottomLeftCorner)) { - onShapeAppearanceModelChanged(); - } - } - - private boolean setLeftEdgeInternal(EdgeTreatment leftEdge) { - boolean changed = false; - if (this.leftEdge != leftEdge) { - this.leftEdge = leftEdge; - changed = true; - } - return changed; - } - - /** - * Gets the edge treatment for the left edge. - * - * @return the edge treatment for the left edge. - */ - public EdgeTreatment getLeftEdge() { - return leftEdge; - } - - /** - * Sets the edge treatment for the left edge. - * - * @param leftEdge the desired treatment. - */ - public void setLeftEdge(EdgeTreatment leftEdge) { - if (setLeftEdgeInternal(leftEdge)) { - onShapeAppearanceModelChanged(); - } - } - - private boolean setTopEdgeInternal(EdgeTreatment topEdge) { - boolean changed = false; - if (this.topEdge != topEdge) { - this.topEdge = topEdge; - changed = true; - } - return changed; - } - - /** - * Gets the edge treatment for the top edge. - * - * @return the edge treatment for the top edge. - */ - public EdgeTreatment getTopEdge() { - return topEdge; - } - - /** - * Sets the edge treatment for the top edge. - * - * @param topEdge the desired treatment. - */ - public void setTopEdge(EdgeTreatment topEdge) { - if (setTopEdgeInternal(topEdge)) { - onShapeAppearanceModelChanged(); - } - } - - private boolean setRightEdgeInternal(EdgeTreatment rightEdge) { - boolean changed = false; - if (this.rightEdge != rightEdge) { - this.rightEdge = rightEdge; - changed = true; - } - return changed; - } - - /** - * Gets the edge treatment for the right edge. - * - * @return the edge treatment for the right edge. - */ - public EdgeTreatment getRightEdge() { - return rightEdge; - } - - /** - * Sets the edge treatment for the right edge. - * - * @param rightEdge the desired treatment. - */ - public void setRightEdge(EdgeTreatment rightEdge) { - if (setRightEdgeInternal(rightEdge)) { - onShapeAppearanceModelChanged(); - } - } - - private boolean setBottomEdgeInternal(EdgeTreatment bottomEdge) { - boolean changed = false; - if (this.bottomEdge != bottomEdge) { - this.bottomEdge = bottomEdge; - changed = true; - } - return changed; - } - - /** - * Gets the edge treatment for the bottom edge. - * - * @return the edge treatment for the bottom edge. - */ - public EdgeTreatment getBottomEdge() { - return bottomEdge; - } - - /** - * Sets the edge treatment for the bottom edge. - * - * @param bottomEdge the desired treatment. - */ - public void setBottomEdge(EdgeTreatment bottomEdge) { - if (setBottomEdgeInternal(bottomEdge)) { - onShapeAppearanceModelChanged(); - } - } - - void addOnChangedListener(@Nullable OnChangedListener onChangedListener) { - onChangedListeners.add(onChangedListener); - } - - void removeOnChangedListener(@Nullable OnChangedListener onChangedListener) { - onChangedListeners.remove(onChangedListener); - } - - private void onShapeAppearanceModelChanged() { - for (OnChangedListener onChangedListener : onChangedListeners) { - if (onChangedListener != null) { - onChangedListener.onShapeAppearanceModelChanged(); - } - } - } - - /** - * Checks Corner and Edge treatments to see if we can use {@link Canvas#drawRoundRect(RectF, float, - * float, Paint)} "} to draw this model. - */ - public boolean isRoundRect() { - boolean hasDefaultEdges = - leftEdge.getClass().equals(EdgeTreatment.class) - && rightEdge.getClass().equals(EdgeTreatment.class) - && topEdge.getClass().equals(EdgeTreatment.class) - && bottomEdge.getClass().equals(EdgeTreatment.class); - - float cornerSize = topLeftCorner.getCornerSize(); - - boolean cornersHaveSameSize = - topRightCorner.getCornerSize() == cornerSize - && bottomLeftCorner.getCornerSize() == cornerSize - && bottomRightCorner.getCornerSize() == cornerSize; - - boolean hasRoundedCorners = - topRightCorner instanceof RoundedCornerTreatment - && topLeftCorner instanceof RoundedCornerTreatment - && bottomRightCorner instanceof RoundedCornerTreatment - && bottomLeftCorner instanceof RoundedCornerTreatment; - - return hasDefaultEdges && cornersHaveSameSize && hasRoundedCorners; - } - - /** - * Listener called every time a {@link ShapeAppearanceModel} corner or edge is modified and - * notifies the {@link MaterialShapeDrawable} that the shape has changed so that it can invalidate - * itself. Components that need to respond to shape changes can use this interface to get a - * callback to respond to shape changes. - */ - public interface OnChangedListener { - - /** - * Callback invoked when a corner or edge of the {@link ShapeAppearanceModel} changes. - */ - void onShapeAppearanceModelChanged(); - } -} diff --git a/ui_spinner/src/main/java/de/kuschku/ui/shape/ShapeAppearancePathProvider.java b/ui_spinner/src/main/java/de/kuschku/ui/shape/ShapeAppearancePathProvider.java deleted file mode 100644 index b87864008982904befc85741fbef7c94c2f8cbfc..0000000000000000000000000000000000000000 --- a/ui_spinner/src/main/java/de/kuschku/ui/shape/ShapeAppearancePathProvider.java +++ /dev/null @@ -1,269 +0,0 @@ -/* - * Copyright 2018 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package de.kuschku.ui.shape; - -import android.graphics.Matrix; -import android.graphics.Path; -import android.graphics.PointF; -import android.graphics.RectF; - -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; - -import org.jetbrains.annotations.NotNull; - -/** - * A class to convert a {@link ShapeAppearanceModel to a {@link android.graphics.Path}}. - */ -class ShapeAppearancePathProvider { - - // Inter-method state. - private final ShapePath[] cornerPaths = new ShapePath[4]; - private final Matrix[] cornerTransforms = new Matrix[4]; - private final Matrix[] edgeTransforms = new Matrix[4]; - // Pre-allocated objects that are re-used several times during path computation and rendering. - private final PointF pointF = new PointF(); - private final ShapePath shapePath = new ShapePath(); - private final float[] scratch = new float[2]; - private final float[] scratch2 = new float[2]; - - public ShapeAppearancePathProvider() { - for (int i = 0; i < 4; i++) { - cornerPaths[i] = new ShapePath(); - cornerTransforms[i] = new Matrix(); - edgeTransforms[i] = new Matrix(); - } - } - - /** - * Writes the given {@link ShapeAppearanceModel} to {@code path} - * - * @param shapeAppearanceModel The shape to be applied in the path. - * @param interpolation the desired interpolation. - * @param bounds the desired bounds for the path. - * @param path the returned path out-var. - */ - public void calculatePath( - ShapeAppearanceModel shapeAppearanceModel, float interpolation, RectF bounds, Path path) { - calculatePath(shapeAppearanceModel, interpolation, bounds, null, path); - } - - /** - * Writes the given {@link ShapeAppearanceModel} to {@code path} - * - * @param shapeAppearanceModel The shape to be applied in the path. - * @param interpolation the desired interpolation. - * @param bounds the desired bounds for the path. - * @param pathListener the path - * @param path the returned path out-var. - */ - public void calculatePath( - ShapeAppearanceModel shapeAppearanceModel, - float interpolation, - RectF bounds, - PathListener pathListener, - Path path) { - path.rewind(); - ShapeAppearancePathSpec spec = - new ShapeAppearancePathSpec( - shapeAppearanceModel, interpolation, bounds, pathListener, path); - - // Calculate the transformations (rotations and translations) necessary for each edge and - // corner treatment. - for (int index = 0; index < 4; index++) { - setCornerPathAndTransform(spec, index); - setEdgePathAndTransform(index); - } - - // Apply corners and edges to the path in clockwise interleaving sequence: top-right corner, - // right edge, bottom-right corner, bottom edge, bottom-left corner etc. We start from the top - // right corner rather than the top left to work around a bug in API level 21 and 22 in which - // rounding error causes the path to incorrectly be marked as concave. - for (int index = 0; index < 4; index++) { - appendCornerPath(spec, index); - appendEdgePath(spec, index); - } - - path.close(); - } - - private void setCornerPathAndTransform(ShapeAppearancePathSpec spec, int index) { - getCornerTreatmentForIndex(index, spec.shapeAppearanceModel) - .getCornerPath(90, spec.interpolation, cornerPaths[index]); - - float edgeAngle = angleOfEdge(index); - cornerTransforms[index].reset(); - getCoordinatesOfCorner(index, spec.bounds, pointF); - cornerTransforms[index].setTranslate(pointF.x, pointF.y); - cornerTransforms[index].preRotate(edgeAngle); - } - - private void setEdgePathAndTransform(int index) { - scratch[0] = cornerPaths[index].getEndX(); - scratch[1] = cornerPaths[index].getEndY(); - cornerTransforms[index].mapPoints(scratch); - float edgeAngle = angleOfEdge(index); - edgeTransforms[index].reset(); - edgeTransforms[index].setTranslate(scratch[0], scratch[1]); - edgeTransforms[index].preRotate(edgeAngle); - } - - private void appendCornerPath(ShapeAppearancePathSpec spec, int index) { - scratch[0] = cornerPaths[index].getStartX(); - scratch[1] = cornerPaths[index].getStartY(); - cornerTransforms[index].mapPoints(scratch); - if (index == 0) { - spec.path.moveTo(scratch[0], scratch[1]); - } else { - spec.path.lineTo(scratch[0], scratch[1]); - } - cornerPaths[index].applyToPath(cornerTransforms[index], spec.path); - if (spec.pathListener != null) { - spec.pathListener.onCornerPathCreated(cornerPaths[index], cornerTransforms[index], index); - } - } - - private void appendEdgePath(ShapeAppearancePathSpec spec, int index) { - int nextIndex = (index + 1) % 4; - scratch[0] = cornerPaths[index].getEndX(); - scratch[1] = cornerPaths[index].getEndY(); - cornerTransforms[index].mapPoints(scratch); - - scratch2[0] = cornerPaths[nextIndex].getStartX(); - scratch2[1] = cornerPaths[nextIndex].getStartY(); - cornerTransforms[nextIndex].mapPoints(scratch2); - - float edgeLength = (float) Math.hypot(scratch[0] - scratch2[0], scratch[1] - scratch2[1]); - // TODO: Remove this -.001f that is currently needed to handle rounding errors - edgeLength = Math.max(edgeLength - .001f, 0); - float center = getEdgeCenterForIndex(spec.bounds, index); - shapePath.reset(0, 0); - getEdgeTreatmentForIndex(index, spec.shapeAppearanceModel) - .getEdgePath(edgeLength, center, spec.interpolation, shapePath); - shapePath.applyToPath(edgeTransforms[index], spec.path); - if (spec.pathListener != null) { - spec.pathListener.onEdgePathCreated(shapePath, edgeTransforms[index], index); - } - } - - private float getEdgeCenterForIndex(RectF bounds, int index) { - scratch[0] = cornerPaths[index].getEndX(); - scratch[1] = cornerPaths[index].getEndY(); - cornerTransforms[index].mapPoints(scratch); - switch (index) { - case 1: - case 3: - return Math.abs(bounds.centerX() - scratch[0]); - case 2: - case 0: - default: - return Math.abs(bounds.centerY() - scratch[1]); - } - } - - private CornerTreatment getCornerTreatmentForIndex( - int index, ShapeAppearanceModel shapeAppearanceModel) { - switch (index) { - case 1: - return shapeAppearanceModel.getBottomRightCorner(); - case 2: - return shapeAppearanceModel.getBottomLeftCorner(); - case 3: - return shapeAppearanceModel.getTopLeftCorner(); - case 0: - default: - return shapeAppearanceModel.getTopRightCorner(); - } - } - - private EdgeTreatment getEdgeTreatmentForIndex( - int index, ShapeAppearanceModel shapeAppearanceModel) { - switch (index) { - case 1: - return shapeAppearanceModel.getBottomEdge(); - case 2: - return shapeAppearanceModel.getLeftEdge(); - case 3: - return shapeAppearanceModel.getTopEdge(); - case 0: - default: - return shapeAppearanceModel.getRightEdge(); - } - } - - private void getCoordinatesOfCorner(int index, RectF bounds, PointF pointF) { - switch (index) { - case 1: // bottom-right - pointF.set(bounds.right, bounds.bottom); - break; - case 2: // bottom-left - pointF.set(bounds.left, bounds.bottom); - break; - case 3: // top-left - pointF.set(bounds.left, bounds.top); - break; - case 0: // top-right - default: - pointF.set(bounds.right, bounds.top); - break; - } - } - - private float angleOfEdge(int index) { - return 90 * (index + 1 % 4); - } - - /** - * Listener called every time a {@link ShapePath} is created for a corner or an edge treatment. - */ - public interface PathListener { - void onCornerPathCreated(ShapePath cornerPath, Matrix transform, int count); - - void onEdgePathCreated(ShapePath edgePath, Matrix transform, int count); - } - - /** - * Necessary information to map a {@link ShapeAppearanceModel} into a Path. - */ - static final class ShapeAppearancePathSpec { - - @NonNull - final ShapeAppearanceModel shapeAppearanceModel; - @NonNull - final Path path; - @NonNull - final RectF bounds; - - @Nullable - final PathListener pathListener; - - final float interpolation; - - ShapeAppearancePathSpec( - @NonNull ShapeAppearanceModel shapeAppearanceModel, - float interpolation, - @NotNull RectF bounds, - @Nullable PathListener pathListener, - @NotNull Path path) { - this.pathListener = pathListener; - this.shapeAppearanceModel = shapeAppearanceModel; - this.interpolation = interpolation; - this.bounds = bounds; - this.path = path; - } - } -} diff --git a/ui_spinner/src/main/java/de/kuschku/ui/shape/ShapePath.kt b/ui_spinner/src/main/java/de/kuschku/ui/shape/ShapePath.kt deleted file mode 100644 index 99d48021bbb3c9e54fe73bd4a220600bb0f67822..0000000000000000000000000000000000000000 --- a/ui_spinner/src/main/java/de/kuschku/ui/shape/ShapePath.kt +++ /dev/null @@ -1,193 +0,0 @@ -/* - * Copyright 2017 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package de.kuschku.ui.shape - -import android.graphics.Matrix -import android.graphics.Path -import android.graphics.RectF -import kotlin.math.cos -import kotlin.math.sin - -/** - * Represents the descriptive path of a shape. Path segments are stored in sequence so that - * transformations can be applied to them when the [android.graphics.Path] is produced by the - * [MaterialShapeDrawable]. - */ -class ShapePath { - private val operations = mutableListOf<PathOperation>() - var startX = 0f - var startY = 0f - var endX = 0f - var endY = 0f - - constructor() { - reset(0f, 0f) - } - - constructor(startX: Float, startY: Float) { - reset(startX, startY) - } - - fun reset(startX: Float, startY: Float) { - this.startX = startX - this.startY = startY - this.endX = startX - this.endY = startY - this.operations.clear() - } - - /** - * Add a line to the ShapePath. - * - * @param x the x to which the line should be drawn. - * @param y the y to which the line should be drawn. - */ - fun lineTo(x: Float, y: Float) { - operations.add(PathLineOperation( - x = x, - y = y - )) - - endX = x - endY = y - } - - /** - * Add a quad to the ShapePath. - * - * @param controlX the control point x of the arc. - * @param controlY the control point y of the arc. - * @param toX the end x of the arc. - * @param toY the end y of the arc. - */ - fun quadToPoint(controlX: Float, controlY: Float, toX: Float, toY: Float) { - operations.add(PathQuadOperation( - controlX = controlX, - controlY = controlY, - endX = toX, - endY = toY - )) - - endX = toX - endY = toY - } - - /** - * Add an arc to the ShapePath. - * - * @param left the X coordinate of the left side of the rectangle containing the arc oval. - * @param top the Y coordinate of the top of the rectangle containing the arc oval. - * @param right the X coordinate of the right side of the rectangle containing the arc oval. - * @param bottom the Y coordinate of the bottom of the rectangle containing the arc oval. - * @param startAngle start angle of the arc. - * @param sweepAngle sweep angle of the arc. - */ - fun addArc(left: Float, top: Float, right: Float, bottom: Float, - startAngle: Float, sweepAngle: Float) { - operations.add(PathArcOperation( - left = left, - top = top, - right = right, - bottom = bottom, - startAngle = startAngle, - sweepAngle = sweepAngle - )) - - endX = (left + right) * 0.5f + (right - left) / 2 * cos(Math.toRadians((startAngle + sweepAngle).toDouble())).toFloat() - endY = (top + bottom) * 0.5f + (bottom - top) / 2 * sin(Math.toRadians((startAngle + sweepAngle).toDouble())).toFloat() - } - - /** - * Apply the ShapePath sequence to a [android.graphics.Path] under a matrix transform. - * - * @param transform the matrix transform under which this ShapePath is applied - * @param path the path to which this ShapePath is applied - */ - fun applyToPath(transform: Matrix, path: Path) { - for (operation in operations) { - operation.applyToPath(transform, path) - } - } - - /** - * Interface for a path operation to be appended to the operations list. - */ - abstract class PathOperation { - val matrix = Matrix() - - abstract fun applyToPath(transform: Matrix, path: Path) - } - - /** - * Straight line operation. - */ - class PathLineOperation( - val x: Float = 0f, - val y: Float = 0f - ) : PathOperation() { - override fun applyToPath(transform: Matrix, path: Path) { - val inverse = matrix - transform.invert(inverse) - path.transform(inverse) - path.lineTo(x, y) - path.transform(transform) - } - } - - /** - * Path quad operation. - */ - class PathQuadOperation( - val controlX: Float = 0f, - val controlY: Float = 0f, - val endX: Float = 0f, - val endY: Float = 0f - ) : PathOperation() { - override fun applyToPath(transform: Matrix, path: Path) { - val inverse = matrix - transform.invert(inverse) - path.transform(inverse) - path.quadTo(controlX, controlY, endX, endY) - path.transform(transform) - } - } - - /** - * Path arc operation. - */ - class PathArcOperation( - val left: Float, - val top: Float, - val right: Float, - val bottom: Float, - val startAngle: Float = 0f, - val sweepAngle: Float = 0f - ) : PathOperation() { - override fun applyToPath(transform: Matrix, path: Path) { - val inverse = matrix - transform.invert(inverse) - path.transform(inverse) - rectF.set(left, top, right, bottom) - path.arcTo(rectF, startAngle, sweepAngle, false) - path.transform(transform) - } - - companion object { - private val rectF = RectF() - } - } -} diff --git a/ui_spinner/src/main/java/de/kuschku/ui/spinner/CutoutDrawable.java b/ui_spinner/src/main/java/de/kuschku/ui/spinner/CutoutDrawable.java deleted file mode 100644 index 64b865c4cc56bc50e34817684a7e5736d889dd53..0000000000000000000000000000000000000000 --- a/ui_spinner/src/main/java/de/kuschku/ui/spinner/CutoutDrawable.java +++ /dev/null @@ -1,131 +0,0 @@ -/* - * Copyright (C) 2017 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package de.kuschku.ui.spinner; - -import android.graphics.Canvas; -import android.graphics.Color; -import android.graphics.Paint; -import android.graphics.Paint.Style; -import android.graphics.PorterDuff.Mode; -import android.graphics.PorterDuffXfermode; -import android.graphics.RectF; -import android.os.Build.VERSION; -import android.os.Build.VERSION_CODES; -import android.view.View; - -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; - -import de.kuschku.ui.shape.MaterialShapeDrawable; -import de.kuschku.ui.shape.ShapeAppearanceModel; - -/** - * A {@link MaterialShapeDrawable} that can draw a cutout for the label in {@link MaterialSpinnerLayout}'s - * outline mode. - */ -class CutoutDrawable extends MaterialShapeDrawable { - private final Paint cutoutPaint; - private final RectF cutoutBounds; - private int savedLayer; - - CutoutDrawable() { - this(null); - } - - CutoutDrawable(@Nullable ShapeAppearanceModel shapeAppearanceModel) { - super(shapeAppearanceModel != null ? shapeAppearanceModel : new ShapeAppearanceModel()); - cutoutPaint = new Paint(Paint.ANTI_ALIAS_FLAG); - setPaintStyles(); - cutoutBounds = new RectF(); - } - - private void setPaintStyles() { - cutoutPaint.setStyle(Style.FILL_AND_STROKE); - cutoutPaint.setColor(Color.WHITE); - cutoutPaint.setXfermode(new PorterDuffXfermode(Mode.DST_OUT)); - } - - boolean hasCutout() { - return !cutoutBounds.isEmpty(); - } - - private void setCutout(float left, float top, float right, float bottom) { - // Avoid expensive redraws by only calling invalidateSelf if one of the cutout's dimensions has - // changed. - if (left != cutoutBounds.left - || top != cutoutBounds.top - || right != cutoutBounds.right - || bottom != cutoutBounds.bottom) { - cutoutBounds.set(left, top, right, bottom); - invalidateSelf(); - } - } - - void setCutout(RectF bounds) { - setCutout(bounds.left, bounds.top, bounds.right, bounds.bottom); - } - - void removeCutout() { - // Call setCutout with empty bounds to remove the cutout. - setCutout(0, 0, 0, 0); - } - - @Override - public void draw(@NonNull Canvas canvas) { - preDraw(canvas); - super.draw(canvas); - - // Draw mask for the cutout. - canvas.drawRect(cutoutBounds, cutoutPaint); - - postDraw(canvas); - } - - private void preDraw(@NonNull Canvas canvas) { - Callback callback = getCallback(); - - if (useHardwareLayer(callback)) { - View viewCallback = (View) callback; - // Make sure we're using a hardware layer. - if (viewCallback.getLayerType() != View.LAYER_TYPE_HARDWARE) { - viewCallback.setLayerType(View.LAYER_TYPE_HARDWARE, null); - } - } else { - // If we're not using a hardware layer, save the canvas layer. - saveCanvasLayer(canvas); - } - } - - private void saveCanvasLayer(@NonNull Canvas canvas) { - if (VERSION.SDK_INT >= VERSION_CODES.LOLLIPOP) { - savedLayer = canvas.saveLayer(0, 0, canvas.getWidth(), canvas.getHeight(), null); - } else { - savedLayer = - canvas.saveLayer(0, 0, canvas.getWidth(), canvas.getHeight(), null, Canvas.ALL_SAVE_FLAG); - } - } - - private void postDraw(@NonNull Canvas canvas) { - if (!useHardwareLayer(getCallback())) { - canvas.restoreToCount(savedLayer); - } - } - - private boolean useHardwareLayer(Callback callback) { - return callback instanceof View; - } -} diff --git a/ui_spinner/src/main/java/de/kuschku/ui/spinner/IndicatorViewController.java b/ui_spinner/src/main/java/de/kuschku/ui/spinner/IndicatorViewController.java deleted file mode 100644 index e4ac2900695d549d37e5626e34c783f199ae9807..0000000000000000000000000000000000000000 --- a/ui_spinner/src/main/java/de/kuschku/ui/spinner/IndicatorViewController.java +++ /dev/null @@ -1,590 +0,0 @@ -/* - * Copyright (C) 2017 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package de.kuschku.ui.spinner; - -import android.animation.Animator; -import android.animation.AnimatorListenerAdapter; -import android.animation.AnimatorSet; -import android.animation.ObjectAnimator; -import android.content.Context; -import android.content.res.ColorStateList; -import android.graphics.Typeface; -import android.text.TextUtils; -import android.view.View; -import android.view.ViewGroup; -import android.view.ViewGroup.LayoutParams; -import android.widget.FrameLayout; -import android.widget.LinearLayout; -import android.widget.Space; -import android.widget.TextView; - -import androidx.annotation.ColorInt; -import androidx.annotation.IntDef; -import androidx.annotation.Nullable; -import androidx.annotation.StyleRes; -import androidx.appcompat.widget.AppCompatTextView; -import androidx.core.view.ViewCompat; -import androidx.core.widget.TextViewCompat; - -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.util.ArrayList; -import java.util.List; - -import de.kuschku.ui.animation.AnimationUtils; -import de.kuschku.ui.animation.AnimatorSetCompat; - -import static android.view.View.TRANSLATION_Y; -import static android.view.View.VISIBLE; - -/** - * Controller for indicator views underneath the text input line in {@link - * de.kuschku.ui.spinner.spinnerLayout}. This class controls helper and error views. - */ -final class IndicatorViewController { - /* - * TODO: Update placeholder values for caption animation. - * - */ - - /** - * Duration for the caption's vertical translation animation. - */ - private static final int CAPTION_TRANSLATE_Y_ANIMATION_DURATION = 217; - - /** - * Duration for the caption's opacity fade animation. - */ - private static final int CAPTION_OPACITY_FADE_ANIMATION_DURATION = 167; - private static final int ERROR_INDEX = 0; - private static final int HELPER_INDEX = 1; - private static final int CAPTION_STATE_NONE = 0; - private static final int CAPTION_STATE_ERROR = 1; - private static final int CAPTION_STATE_HELPER_TEXT = 2; - private final Context context; - private final MaterialSpinnerLayout spinnerView; - private final float captionTranslationYPx; - private LinearLayout indicatorArea; - private int indicatorsAdded; - private FrameLayout captionArea; - private int captionViewsAdded; - @Nullable - private Animator captionAnimator; - private int captionDisplayed; - private int captionToShow; - private CharSequence errorText; - private boolean errorEnabled; - private TextView errorView; - private int errorTextAppearance; - @Nullable - private ColorStateList errorViewTextColor; - private CharSequence helperText; - private boolean helperTextEnabled; - private TextView helperTextView; - private int helperTextTextAppearance; - @Nullable - private ColorStateList helperTextViewTextColor; - private Typeface typeface; - - public IndicatorViewController(MaterialSpinnerLayout spinnerView) { - this.context = spinnerView.getContext(); - this.spinnerView = spinnerView; - this.captionTranslationYPx = - context.getResources().getDimensionPixelSize(R.dimen.md_design_spinner_caption_translate_y); - } - - void showHelper(final CharSequence helperText) { - cancelCaptionAnimator(); - this.helperText = helperText; - helperTextView.setText(helperText); - - // If helper is not already shown, show helper. - if (captionDisplayed != CAPTION_STATE_HELPER_TEXT) { - captionToShow = CAPTION_STATE_HELPER_TEXT; - } - updateCaptionViewsVisibility( - captionDisplayed, captionToShow, shouldAnimateCaptionView(helperTextView, helperText)); - } - - private void hideHelperText() { - cancelCaptionAnimator(); - - // Hide helper if it's shown. - if (captionDisplayed == CAPTION_STATE_HELPER_TEXT) { - captionToShow = CAPTION_STATE_NONE; - } - updateCaptionViewsVisibility( - captionDisplayed, captionToShow, shouldAnimateCaptionView(helperTextView, null)); - } - - void showError(final CharSequence errorText) { - cancelCaptionAnimator(); - this.errorText = errorText; - errorView.setText(errorText); - - // If error is not already shown, show error. - if (captionDisplayed != CAPTION_STATE_ERROR) { - captionToShow = CAPTION_STATE_ERROR; - } - updateCaptionViewsVisibility( - captionDisplayed, captionToShow, shouldAnimateCaptionView(errorView, errorText)); - } - - void hideError() { - errorText = null; - cancelCaptionAnimator(); - // Hide error if it's shown. - if (captionDisplayed == CAPTION_STATE_ERROR) { - // If helper text is enabled and not empty, show helper text in place of the error. - if (helperTextEnabled && !TextUtils.isEmpty(helperText)) { - captionToShow = CAPTION_STATE_HELPER_TEXT; - } else { - // Otherwise, just hide the error. - captionToShow = CAPTION_STATE_NONE; - } - } - updateCaptionViewsVisibility( - captionDisplayed, captionToShow, shouldAnimateCaptionView(errorView, null)); - } - - /** - * Check if the caption view should animate. Only animate the caption view if we're enabled, laid - * out, and have a different caption message. - * - * @param captionView The view that contains text for the caption underneath the text input area - * @param captionText The text for the caption view - * @return Whether the view should animate when setting the caption - */ - private boolean shouldAnimateCaptionView( - TextView captionView, @Nullable final CharSequence captionText) { - return ViewCompat.isLaidOut(spinnerView) - && spinnerView.isEnabled() - && (captionToShow != captionDisplayed - || captionView == null - || !TextUtils.equals(captionView.getText(), captionText)); - } - - private void updateCaptionViewsVisibility( - final @CaptionDisplayState int captionToHide, - final @CaptionDisplayState int captionToShow, - boolean animate) { - - if (animate) { - final AnimatorSet captionAnimator = new AnimatorSet(); - this.captionAnimator = captionAnimator; - List<Animator> captionAnimatorList = new ArrayList<>(); - - createCaptionAnimators( - captionAnimatorList, - helperTextEnabled, - helperTextView, - CAPTION_STATE_HELPER_TEXT, - captionToHide, - captionToShow); - - createCaptionAnimators( - captionAnimatorList, - errorEnabled, - errorView, - CAPTION_STATE_ERROR, - captionToHide, - captionToShow); - - AnimatorSetCompat.playTogether(captionAnimator, captionAnimatorList); - final TextView captionViewToHide = getCaptionViewFromDisplayState(captionToHide); - final TextView captionViewToShow = getCaptionViewFromDisplayState(captionToShow); - - captionAnimator.addListener( - new AnimatorListenerAdapter() { - @Override - public void onAnimationEnd(Animator animator) { - captionDisplayed = captionToShow; - IndicatorViewController.this.captionAnimator = null; - if (captionViewToHide != null) { - captionViewToHide.setVisibility(View.INVISIBLE); - if (captionToHide == CAPTION_STATE_ERROR && errorView != null) { - errorView.setText(null); - } - - if (captionViewToShow != null) { - captionViewToShow.setTranslationY(0f); - captionViewToShow.setAlpha(1f); - } - } - } - - @Override - public void onAnimationStart(Animator animator) { - if (captionViewToShow != null) { - captionViewToShow.setVisibility(VISIBLE); - } - } - }); - captionAnimator.start(); - } else { - setCaptionViewVisibilities(captionToHide, captionToShow); - } - spinnerView.updateSpinnerBackground(); - spinnerView.updateLabelState(animate); - spinnerView.updatespinnerBoxState(); - } - - private void setCaptionViewVisibilities( - @CaptionDisplayState int captionToHide, @CaptionDisplayState int captionToShow) { - if (captionToHide == captionToShow) { - return; - } - - if (captionToShow != CAPTION_STATE_NONE) { - TextView captionViewToShow = getCaptionViewFromDisplayState(captionToShow); - if (captionViewToShow != null) { - captionViewToShow.setVisibility(VISIBLE); - captionViewToShow.setAlpha(1f); - } - } - - if (captionToHide != CAPTION_STATE_NONE) { - TextView captionViewDisplayed = getCaptionViewFromDisplayState(captionToHide); - if (captionViewDisplayed != null) { - captionViewDisplayed.setVisibility(View.INVISIBLE); - // Only set the caption text to null if it's the error. - if (captionToHide == CAPTION_STATE_ERROR) { - captionViewDisplayed.setText(null); - } - } - } - captionDisplayed = captionToShow; - } - - private void createCaptionAnimators( - List<Animator> captionAnimatorList, - boolean captionEnabled, - TextView captionView, - @CaptionDisplayState int captionState, - @CaptionDisplayState int captionToHide, - @CaptionDisplayState int captionToShow) { - // If caption view is null or not enabled, do nothing. - if (captionView == null || !captionEnabled) { - return; - } - // If the caption view should be shown, set alpha to 1f. - if ((captionState == captionToShow) || (captionState == captionToHide)) { - captionAnimatorList.add( - createCaptionOpacityAnimator(captionView, captionToShow == captionState)); - if (captionToShow == captionState) { - captionAnimatorList.add(createCaptionTranslationYAnimator(captionView)); - } - } - } - - private ObjectAnimator createCaptionOpacityAnimator(TextView captionView, boolean display) { - float endValue = display ? 1f : 0f; - ObjectAnimator opacityAnimator = ObjectAnimator.ofFloat(captionView, View.ALPHA, endValue); - opacityAnimator.setDuration(CAPTION_OPACITY_FADE_ANIMATION_DURATION); - opacityAnimator.setInterpolator(AnimationUtils.INSTANCE.getLINEAR_INTERPOLATOR()); - return opacityAnimator; - } - - private ObjectAnimator createCaptionTranslationYAnimator(TextView captionView) { - ObjectAnimator translationYAnimator = - ObjectAnimator.ofFloat(captionView, TRANSLATION_Y, -captionTranslationYPx, 0f); - translationYAnimator.setDuration(CAPTION_TRANSLATE_Y_ANIMATION_DURATION); - translationYAnimator.setInterpolator(AnimationUtils.INSTANCE.getLINEAR_OUT_SLOW_IN_INTERPOLATOR()); - return translationYAnimator; - } - - private void cancelCaptionAnimator() { - if (captionAnimator != null) { - captionAnimator.cancel(); - } - } - - private boolean isCaptionView(@IndicatorIndex int index) { - return index == ERROR_INDEX || index == HELPER_INDEX; - } - - @Nullable - private TextView getCaptionViewFromDisplayState(@CaptionDisplayState int captionDisplayState) { - switch (captionDisplayState) { - case CAPTION_STATE_ERROR: - return errorView; - case CAPTION_STATE_HELPER_TEXT: - return helperTextView; - case CAPTION_STATE_NONE: - default: - // No caption displayed, fall out and return null. - return null; - } - } - - void adjustIndicatorPadding() { - if (canAdjustIndicatorPadding()) { - // Add padding to the indicators so that they match the EditText - ViewCompat.setPaddingRelative( - indicatorArea, - ViewCompat.getPaddingStart(spinnerView.getSpinner()), - 0, - ViewCompat.getPaddingEnd(spinnerView.getSpinner()), - 0); - } - } - - private boolean canAdjustIndicatorPadding() { - return indicatorArea != null && spinnerView.getSpinner() != null; - } - - private void addIndicator(TextView indicator, @IndicatorIndex int index) { - if (indicatorArea == null && captionArea == null) { - indicatorArea = new LinearLayout(context); - indicatorArea.setOrientation(LinearLayout.HORIZONTAL); - spinnerView.addView(indicatorArea, LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT); - - captionArea = new FrameLayout(context); - indicatorArea.addView( - captionArea, - -1, - new FrameLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT)); - - final Space spacer = new Space(context); - final LayoutParams spacerLp = new LinearLayout.LayoutParams(0, 0, 1f); - indicatorArea.addView(spacer, spacerLp); - - if (spinnerView.getSpinner() != null) { - adjustIndicatorPadding(); - } - } - - if (isCaptionView(index)) { - captionArea.setVisibility(VISIBLE); - captionArea.addView(indicator); - captionViewsAdded++; - } else { - indicatorArea.addView(indicator, index); - } - indicatorArea.setVisibility(VISIBLE); - indicatorsAdded++; - } - - private void removeIndicator(TextView indicator, @IndicatorIndex int index) { - if (indicatorArea == null) { - return; - } - - if (isCaptionView(index) && captionArea != null) { - captionViewsAdded--; - setViewGroupGoneIfEmpty(captionArea, captionViewsAdded); - captionArea.removeView(indicator); - } else { - indicatorArea.removeView(indicator); - } - indicatorsAdded--; - setViewGroupGoneIfEmpty(indicatorArea, indicatorsAdded); - } - - private void setViewGroupGoneIfEmpty(ViewGroup viewGroup, int indicatorsAdded) { - if (indicatorsAdded == 0) { - viewGroup.setVisibility(View.GONE); - } - } - - boolean isErrorEnabled() { - return errorEnabled; - } - - void setErrorEnabled(boolean enabled) { - // If the enabled state is the same as before, do nothing. - if (errorEnabled == enabled) { - return; - } - - // Otherwise, adjust enabled state. - cancelCaptionAnimator(); - - if (enabled) { - errorView = new AppCompatTextView(context); - errorView.setId(R.id.md_spinner_error); - if (typeface != null) { - errorView.setTypeface(typeface); - } - setErrorTextAppearance(errorTextAppearance); - setErrorViewTextColor(errorViewTextColor); - errorView.setVisibility(View.INVISIBLE); - ViewCompat.setAccessibilityLiveRegion(errorView, ViewCompat.ACCESSIBILITY_LIVE_REGION_POLITE); - addIndicator(errorView, ERROR_INDEX); - } else { - hideError(); - removeIndicator(errorView, ERROR_INDEX); - errorView = null; - spinnerView.updateSpinnerBackground(); - spinnerView.updatespinnerBoxState(); - } - errorEnabled = enabled; - } - - boolean isHelperTextEnabled() { - return helperTextEnabled; - } - - void setHelperTextEnabled(boolean enabled) { - // If the enabled state is the same as before, do nothing. - if (helperTextEnabled == enabled) { - return; - } - - // Otherwise, adjust enabled state. - cancelCaptionAnimator(); - - if (enabled) { - helperTextView = new AppCompatTextView(context); - helperTextView.setId(R.id.md_spinner_helper_text); - if (typeface != null) { - helperTextView.setTypeface(typeface); - } - helperTextView.setVisibility(View.INVISIBLE); - ViewCompat.setAccessibilityLiveRegion( - helperTextView, ViewCompat.ACCESSIBILITY_LIVE_REGION_POLITE); - setHelperTextAppearance(helperTextTextAppearance); - setHelperTextViewTextColor(helperTextViewTextColor); - addIndicator(helperTextView, HELPER_INDEX); - } else { - hideHelperText(); - removeIndicator(helperTextView, HELPER_INDEX); - helperTextView = null; - spinnerView.updateSpinnerBackground(); - spinnerView.updatespinnerBoxState(); - } - helperTextEnabled = enabled; - } - - boolean errorIsDisplayed() { - return isCaptionStateError(captionDisplayed); - } - - boolean errorShouldBeShown() { - return isCaptionStateError(captionToShow); - } - - private boolean isCaptionStateError(@CaptionDisplayState int captionState) { - return captionState == CAPTION_STATE_ERROR - && errorView != null - && !TextUtils.isEmpty(errorText); - } - - boolean helperTextIsDisplayed() { - return isCaptionStateHelperText(captionDisplayed); - } - - boolean helperTextShouldBeShown() { - return isCaptionStateHelperText(captionToShow); - } - - private boolean isCaptionStateHelperText(@CaptionDisplayState int captionState) { - return captionState == CAPTION_STATE_HELPER_TEXT - && helperTextView != null - && !TextUtils.isEmpty(helperText); - } - - CharSequence getErrorText() { - return errorText; - } - - CharSequence getHelperText() { - return helperText; - } - - @SuppressWarnings("ReferenceEquality") - // Matches the Typeface comparison in TextView - void setTypefaces(Typeface typeface) { - if (typeface != this.typeface) { - this.typeface = typeface; - setTextViewTypeface(errorView, typeface); - setTextViewTypeface(helperTextView, typeface); - } - } - - private void setTextViewTypeface(@Nullable TextView captionView, Typeface typeface) { - if (captionView != null) { - captionView.setTypeface(typeface); - } - } - - @ColorInt - int getErrorViewCurrentTextColor() { - return errorView != null ? errorView.getCurrentTextColor() : -1; - } - - @Nullable - ColorStateList getErrorViewTextColors() { - return errorView != null ? errorView.getTextColors() : null; - } - - void setErrorViewTextColor(ColorStateList errorViewTextColor) { - this.errorViewTextColor = errorViewTextColor; - if (errorView != null && errorViewTextColor != null) { - errorView.setTextColor(errorViewTextColor); - } - } - - void setErrorTextAppearance(@StyleRes int resId) { - this.errorTextAppearance = resId; - if (errorView != null) { - spinnerView.setTextAppearanceCompatWithErrorFallback(errorView, resId); - } - } - - @ColorInt - int getHelperTextViewCurrentTextColor() { - return helperTextView != null ? helperTextView.getCurrentTextColor() : -1; - } - - @Nullable - ColorStateList getHelperTextViewColors() { - return helperTextView != null ? helperTextView.getTextColors() : null; - } - - void setHelperTextViewTextColor(ColorStateList helperTextViewTextColor) { - this.helperTextViewTextColor = helperTextViewTextColor; - if (helperTextView != null && helperTextViewTextColor != null) { - helperTextView.setTextColor(helperTextViewTextColor); - } - } - - void setHelperTextAppearance(@StyleRes int resId) { - this.helperTextTextAppearance = resId; - if (helperTextView != null) { - TextViewCompat.setTextAppearance(helperTextView, resId); - } - } - - /** - * Values for indicator indices. Indicators are views below the text input area, like a caption - * (error text or helper text) or a character counter. - */ - @IntDef({ERROR_INDEX, HELPER_INDEX}) - @Retention(RetentionPolicy.SOURCE) - private @interface IndicatorIndex { - } - - /** - * Values for caption display state constants. There is either an error displayed, helper text - * displayed, or no caption. - */ - @IntDef({CAPTION_STATE_NONE, CAPTION_STATE_ERROR, CAPTION_STATE_HELPER_TEXT}) - @Retention(RetentionPolicy.SOURCE) - private @interface CaptionDisplayState { - } -} diff --git a/ui_spinner/src/main/java/de/kuschku/ui/spinner/MaterialSpinnerLayout.java b/ui_spinner/src/main/java/de/kuschku/ui/spinner/MaterialSpinnerLayout.java deleted file mode 100644 index 289f4bbac6b7df14194eaa399fe1f1906292cbed..0000000000000000000000000000000000000000 --- a/ui_spinner/src/main/java/de/kuschku/ui/spinner/MaterialSpinnerLayout.java +++ /dev/null @@ -1,1545 +0,0 @@ -/* - * Copyright (C) 2015 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package de.kuschku.ui.spinner; - -import android.content.Context; -import android.content.res.ColorStateList; -import android.content.res.TypedArray; -import android.graphics.Canvas; -import android.graphics.Color; -import android.graphics.PorterDuff; -import android.graphics.PorterDuffColorFilter; -import android.graphics.Rect; -import android.graphics.RectF; -import android.graphics.Typeface; -import android.graphics.drawable.Drawable; -import android.graphics.drawable.LayerDrawable; -import android.os.Build.VERSION; -import android.os.Build.VERSION_CODES; -import android.os.Parcel; -import android.os.Parcelable; -import android.text.TextUtils; -import android.util.AttributeSet; -import android.view.Gravity; -import android.view.View; -import android.view.ViewGroup; -import android.view.accessibility.AccessibilityEvent; -import android.widget.FrameLayout; -import android.widget.LinearLayout; -import android.widget.Spinner; -import android.widget.TextView; - -import androidx.annotation.ColorInt; -import androidx.annotation.ColorRes; -import androidx.annotation.DimenRes; -import androidx.annotation.IntDef; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import androidx.annotation.StyleRes; -import androidx.annotation.VisibleForTesting; -import androidx.appcompat.content.res.AppCompatResources; -import androidx.core.content.ContextCompat; -import androidx.core.graphics.drawable.DrawableCompat; -import androidx.core.view.GravityCompat; -import androidx.core.view.ViewCompat; -import androidx.core.widget.TextViewCompat; -import androidx.customview.view.AbsSavedState; - -import org.jetbrains.annotations.NotNull; - -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.util.LinkedHashSet; - -import de.kuschku.ui.color.MaterialColors; -import de.kuschku.ui.internal.CollapsingTextHelper; -import de.kuschku.ui.internal.DescendantOffsetUtils; -import de.kuschku.ui.resources.MaterialResources; -import de.kuschku.ui.shape.MaterialShapeDrawable; -import de.kuschku.ui.shape.ShapeAppearanceModel; - -import static de.kuschku.ui.internal.ThemeEnforcement.createThemedContext; - -/** - * Layout which wraps a {@link android.widget.Spinner}, or descendant to show a floating label when - * the hint is hidden. - * - * <p>Also supports: - * - * <ul> - * <li>Showing an error via {@link #setErrorEnabled(boolean)} and {@link #setError(CharSequence)} - * <li>Showing helper text via {@link #setHelperTextEnabled(boolean)} and {@link - * #setHelperText(CharSequence)} - * </ul> - * - * <p>An example usage is as so:</p> - * - * <pre> - * <de.kuschku.ui.spinner.MaterialSpinnerLayout - * android:layout_width="match_parent" - * android:layout_height="wrap_content" - * android:hint="@string/form_username"> - * - * <android.widget.Spinner - * android:layout_width="match_parent" - * android:layout_height="wrap_content"/> - * - * </de.kuschku.ui.spinner.MaterialSpinnerLayout> - * </pre> - * - * <p><strong>Note:</strong> The actual view hierarchy present under MaterialSpinnerLayout is - * <strong>NOT</strong> guaranteed to match the view hierarchy as written in XML. As a result, calls - * to getParent() on children of the MaterialSpinnerLayout -- such as a Spinner -- may not return the - * MaterialSpinnerLayout itself, but rather an intermediate View. If you need to access a View - * directly, set an {@code android:id} and use {@link View#findViewById(int)}. - */ -public class MaterialSpinnerLayout extends LinearLayout { - - public static final int BOX_BACKGROUND_NONE = 0; - public static final int BOX_BACKGROUND_FILLED = 1; - public static final int BOX_BACKGROUND_OUTLINE = 2; - private static final int DEF_STYLE_RES = R.style.Widget_Design_MaterialSpinnerLayout; - final CollapsingTextHelper collapsingTextHelper = new CollapsingTextHelper(this); - private final FrameLayout inputFrame; - private final IndicatorViewController indicatorViewController = new IndicatorViewController(this); - private final ShapeAppearanceModel shapeAppearanceModel; - private final ShapeAppearanceModel cornerAdjustedShapeAppearanceModel; - private final int boxLabelCutoutPaddingPx; - private final int boxCollapsedPaddingTopPx; - private final int boxStrokeWidthDefaultPx; - private final int boxStrokeWidthFocusedPx; - private final Rect tmpRect = new Rect(); - private final Rect tmpBoundsRect = new Rect(); - private final RectF tmpRectF = new RectF(); - private final LinkedHashSet<OnSpinnerAttachedListener> spinnerAttachedListeners = - new LinkedHashSet<>(); - @ColorInt - private final int defaultStrokeColor; - @ColorInt - private final int hoveredStrokeColor; - @ColorInt - private final int disabledFilledBackgroundColor; - @ColorInt - private final int hoveredFilledBackgroundColor; - @ColorInt - private final int disabledColor; - Spinner spinner; - private boolean hintEnabled; - private CharSequence hint; - private boolean isProvidingHint; - private MaterialShapeDrawable boxBackground; - private MaterialShapeDrawable boxUnderline; - @BoxBackgroundMode - private int boxBackgroundMode; - private int boxStrokeWidthPx; - @ColorInt - private int boxStrokeColor; - @ColorInt - private int boxBackgroundColor; - private Typeface typeface; - private ColorStateList defaultHintTextColor; - private ColorStateList focusedTextColor; - @ColorInt - private int focusedStrokeColor; - @ColorInt - private int defaultFilledBackgroundColor; - private boolean hintAnimationEnabled; - private boolean inDrawableStateChanged; - - public MaterialSpinnerLayout(Context context) { - this(context, null); - } - - public MaterialSpinnerLayout(Context context, @Nullable AttributeSet attrs) { - this(context, attrs, R.attr.md_materialSpinnerStyle); - } - - public MaterialSpinnerLayout(Context context, @Nullable AttributeSet attrs, int defStyleAttr) { - super(createThemedContext(context, attrs, defStyleAttr, DEF_STYLE_RES), attrs, defStyleAttr); - // Ensure we are using the correctly themed context rather than the context that was passed in. - context = getContext(); - - setOrientation(VERTICAL); - setWillNotDraw(false); - setAddStatesFromChildren(true); - - inputFrame = new FrameLayout(context); - inputFrame.setAddStatesFromChildren(true); - addView(inputFrame); - - collapsingTextHelper.setCollapsedTextGravity(Gravity.TOP | GravityCompat.START); - - final TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.MaterialSpinnerLayout, defStyleAttr, DEF_STYLE_RES); - - hintEnabled = a.getBoolean(R.styleable.MaterialSpinnerLayout_md_hintEnabled, true); - setHint(a.getText(R.styleable.MaterialSpinnerLayout_android_hint)); - hintAnimationEnabled = a.getBoolean(R.styleable.MaterialSpinnerLayout_md_hintAnimationEnabled, true); - - shapeAppearanceModel = new ShapeAppearanceModel(context, attrs, defStyleAttr, DEF_STYLE_RES); - cornerAdjustedShapeAppearanceModel = new ShapeAppearanceModel(shapeAppearanceModel); - - boxLabelCutoutPaddingPx = - context - .getResources() - .getDimensionPixelOffset(R.dimen.md_mtrl_spinner_box_label_cutout_padding); - boxCollapsedPaddingTopPx = - a.getDimensionPixelOffset(R.styleable.MaterialSpinnerLayout_md_boxCollapsedPaddingTop, 0); - - boxStrokeWidthDefaultPx = - context - .getResources() - .getDimensionPixelSize(R.dimen.md_mtrl_spinner_box_stroke_width_default); - boxStrokeWidthFocusedPx = - context - .getResources() - .getDimensionPixelSize(R.dimen.md_mtrl_spinner_box_stroke_width_focused); - boxStrokeWidthPx = boxStrokeWidthDefaultPx; - - float boxCornerRadiusTopStart = - a.getDimension(R.styleable.MaterialSpinnerLayout_md_boxCornerRadiusTopStart, -1f); - float boxCornerRadiusTopEnd = - a.getDimension(R.styleable.MaterialSpinnerLayout_md_boxCornerRadiusTopEnd, -1f); - float boxCornerRadiusBottomEnd = - a.getDimension(R.styleable.MaterialSpinnerLayout_md_boxCornerRadiusBottomEnd, -1f); - float boxCornerRadiusBottomStart = - a.getDimension(R.styleable.MaterialSpinnerLayout_md_boxCornerRadiusBottomStart, -1f); - if (boxCornerRadiusTopStart >= 0) { - shapeAppearanceModel.getTopLeftCorner().setCornerSize(boxCornerRadiusTopStart); - } - if (boxCornerRadiusTopEnd >= 0) { - shapeAppearanceModel.getTopRightCorner().setCornerSize(boxCornerRadiusTopEnd); - } - if (boxCornerRadiusBottomEnd >= 0) { - shapeAppearanceModel.getBottomRightCorner().setCornerSize(boxCornerRadiusBottomEnd); - } - if (boxCornerRadiusBottomStart >= 0) { - shapeAppearanceModel.getBottomLeftCorner().setCornerSize(boxCornerRadiusBottomStart); - } - adjustCornerSizeForStrokeWidth(); - - ColorStateList filledBackgroundColorStateList = - MaterialResources.getColorStateList( - context, a, R.styleable.MaterialSpinnerLayout_md_boxBackgroundColor); - if (filledBackgroundColorStateList != null) { - defaultFilledBackgroundColor = filledBackgroundColorStateList.getDefaultColor(); - boxBackgroundColor = defaultFilledBackgroundColor; - if (filledBackgroundColorStateList.isStateful()) { - disabledFilledBackgroundColor = - filledBackgroundColorStateList.getColorForState( - new int[]{-android.R.attr.state_enabled}, -1); - hoveredFilledBackgroundColor = - filledBackgroundColorStateList.getColorForState( - new int[]{android.R.attr.state_hovered}, -1); - } else { - ColorStateList mtrlFilledBackgroundColorStateList = - AppCompatResources.getColorStateList(context, R.color.md_mtrl_filled_background_color); - disabledFilledBackgroundColor = - mtrlFilledBackgroundColorStateList.getColorForState( - new int[]{-android.R.attr.state_enabled}, -1); - hoveredFilledBackgroundColor = - mtrlFilledBackgroundColorStateList.getColorForState( - new int[]{android.R.attr.state_hovered}, -1); - } - } else { - boxBackgroundColor = Color.TRANSPARENT; - defaultFilledBackgroundColor = Color.TRANSPARENT; - disabledFilledBackgroundColor = Color.TRANSPARENT; - hoveredFilledBackgroundColor = Color.TRANSPARENT; - } - - if (a.hasValue(R.styleable.MaterialSpinnerLayout_android_textColorHint)) { - defaultHintTextColor = - focusedTextColor = a.getColorStateList(R.styleable.MaterialSpinnerLayout_android_textColorHint); - } - - ColorStateList boxStrokeColorStateList = - MaterialResources.getColorStateList(context, a, R.styleable.MaterialSpinnerLayout_md_boxStrokeColor); - if (boxStrokeColorStateList != null && boxStrokeColorStateList.isStateful()) { - defaultStrokeColor = boxStrokeColorStateList.getDefaultColor(); - disabledColor = - boxStrokeColorStateList.getColorForState(new int[]{-android.R.attr.state_enabled}, -1); - hoveredStrokeColor = - boxStrokeColorStateList.getColorForState(new int[]{android.R.attr.state_hovered}, -1); - focusedStrokeColor = - boxStrokeColorStateList.getColorForState(new int[]{android.R.attr.state_focused}, -1); - } else { - // If attribute boxStrokeColor is not a color state list but only a single value, its value - // will be applied to the box's focus state. - focusedStrokeColor = - a.getColor(R.styleable.MaterialSpinnerLayout_md_boxStrokeColor, Color.TRANSPARENT); - defaultStrokeColor = - ContextCompat.getColor(context, R.color.md_mtrl_spinner_default_box_stroke_color); - disabledColor = ContextCompat.getColor(context, R.color.md_mtrl_spinner_disabled_color); - hoveredStrokeColor = - ContextCompat.getColor(context, R.color.md_mtrl_spinner_hovered_box_stroke_color); - } - - final int hintAppearance = a.getResourceId(R.styleable.MaterialSpinnerLayout_md_hintTextAppearance, -1); - if (hintAppearance != -1) { - setHintTextAppearance(a.getResourceId(R.styleable.MaterialSpinnerLayout_md_hintTextAppearance, 0)); - } - - final int errorTextAppearance = - a.getResourceId(R.styleable.MaterialSpinnerLayout_md_errorTextAppearance, 0); - final boolean errorEnabled = a.getBoolean(R.styleable.MaterialSpinnerLayout_md_errorEnabled, false); - - final int helperTextTextAppearance = - a.getResourceId(R.styleable.MaterialSpinnerLayout_md_helperTextTextAppearance, 0); - final boolean helperTextEnabled = - a.getBoolean(R.styleable.MaterialSpinnerLayout_md_helperTextEnabled, false); - final CharSequence helperText = a.getText(R.styleable.MaterialSpinnerLayout_md_helperText); - - setHelperTextEnabled(helperTextEnabled); - setHelperText(helperText); - setHelperTextTextAppearance(helperTextTextAppearance); - setErrorEnabled(errorEnabled); - setErrorTextAppearance(errorTextAppearance); - - if (a.hasValue(R.styleable.MaterialSpinnerLayout_md_errorTextColor)) { - setErrorTextColor(a.getColorStateList(R.styleable.MaterialSpinnerLayout_md_errorTextColor)); - } - if (a.hasValue(R.styleable.MaterialSpinnerLayout_md_helperTextTextColor)) { - setHelperTextColor(a.getColorStateList(R.styleable.MaterialSpinnerLayout_md_helperTextTextColor)); - } - if (a.hasValue(R.styleable.MaterialSpinnerLayout_md_hintTextColor)) { - setHintTextColor(a.getColorStateList(R.styleable.MaterialSpinnerLayout_md_hintTextColor)); - } - - setBoxBackgroundMode( - a.getInt(R.styleable.MaterialSpinnerLayout_md_boxBackgroundMode, BOX_BACKGROUND_NONE)); - a.recycle(); - - // For accessibility, consider MaterialSpinnerLayout itself to be a simple container for a - // Spinner, and do not expose it to accessibility services. - ViewCompat.setImportantForAccessibility(this, ViewCompat.IMPORTANT_FOR_ACCESSIBILITY_NO); - } - - private static void recursiveSetEnabled(final ViewGroup vg, final boolean enabled) { - for (int i = 0, count = vg.getChildCount(); i < count; i++) { - final View child = vg.getChildAt(i); - child.setEnabled(enabled); - if (child instanceof ViewGroup) { - recursiveSetEnabled((ViewGroup) child, enabled); - } - } - } - - @Override - public void addView(View child, int index, final ViewGroup.LayoutParams params) { - if (child instanceof Spinner) { - // Make sure that the Spinner is vertically at the bottom, so that it sits on the - // Spinner's underline - FrameLayout.LayoutParams flp = new FrameLayout.LayoutParams(params); - flp.gravity = Gravity.CENTER_VERTICAL | (flp.gravity & ~Gravity.VERTICAL_GRAVITY_MASK); - inputFrame.addView(child, flp); - - // Now use the Spinner's LayoutParams as our own and update them to make enough space - // for the label - inputFrame.setLayoutParams(params); - updateInputLayoutMargins(); - - setSpinner((Spinner) child); - } else { - // Carry on adding the View... - super.addView(child, index, params); - } - } - - @NonNull - private Drawable getBoxBackground() { - if (boxBackgroundMode == BOX_BACKGROUND_FILLED || boxBackgroundMode == BOX_BACKGROUND_OUTLINE) { - return boxBackground; - } - throw new IllegalStateException(); - } - - /** - * Get the box background mode (filled, outline, or none). - * - * <p>May be one of {@link #BOX_BACKGROUND_NONE}, {@link #BOX_BACKGROUND_FILLED}, or {@link - * #BOX_BACKGROUND_OUTLINE}. - */ - @BoxBackgroundMode - public int getBoxBackgroundMode() { - return boxBackgroundMode; - } - - /** - * Set the box background mode (filled, outline, or none). - * - * <p>May be one of {@link #BOX_BACKGROUND_NONE}, {@link #BOX_BACKGROUND_FILLED}, or {@link - * #BOX_BACKGROUND_OUTLINE}. - * - * <p>Note: This method defines MaterialSpinnerLayout's internal behavior (for example, it allows the - * hint to be displayed inline with the stroke in a cutout), but doesn't set all attributes that - * are set in the styles provided for the box background modes. To achieve the look of an outlined - * or filled text field, supplement this method with other methods that modify the box, such as - * {@link #setBoxStrokeColor(int)} and {@link #setBoxBackgroundColor(int)}. - * - * @param boxBackgroundMode box's background mode - * @throws IllegalArgumentException if boxBackgroundMode is not a @BoxBackgroundMode constant - */ - public void setBoxBackgroundMode(@BoxBackgroundMode int boxBackgroundMode) { - if (boxBackgroundMode == this.boxBackgroundMode) { - return; - } - this.boxBackgroundMode = boxBackgroundMode; - if (spinner != null) { - onApplyBoxBackgroundMode(); - } - } - - private void onApplyBoxBackgroundMode() { - assignBoxBackgroundByMode(); - setSpinnerBoxBackground(); - updatespinnerBoxState(); - if (boxBackgroundMode != BOX_BACKGROUND_NONE) { - updateInputLayoutMargins(); - } - } - - private void assignBoxBackgroundByMode() { - switch (boxBackgroundMode) { - case BOX_BACKGROUND_FILLED: - boxBackground = new MaterialShapeDrawable(shapeAppearanceModel); - boxUnderline = new MaterialShapeDrawable(); - break; - case BOX_BACKGROUND_OUTLINE: - if (hintEnabled && !(boxBackground instanceof CutoutDrawable)) { - boxBackground = new CutoutDrawable(shapeAppearanceModel); - } else { - boxBackground = new MaterialShapeDrawable(shapeAppearanceModel); - } - boxUnderline = null; - break; - case BOX_BACKGROUND_NONE: - boxBackground = null; - boxUnderline = null; - break; - default: - throw new IllegalArgumentException( - boxBackgroundMode + " is illegal; only @BoxBackgroundMode constants are supported."); - } - } - - private void setSpinnerBoxBackground() { - // Set the Spinner background to boxBackground if we should use that as the box background. - if (shouldUseSpinnerBackgroundForBoxBackground()) { - Object tag = spinner.getTag(R.id.md_spinner_background); - Drawable viewBackground; - if (tag instanceof Drawable) { - viewBackground = (Drawable) tag; - } else { - viewBackground = spinner.getBackground(); - spinner.setTag(R.id.md_spinner_background, viewBackground); - } - - Drawable finalBackground; - if (viewBackground != null) { - finalBackground = new LayerDrawable(new Drawable[]{ - boxBackground, - viewBackground - }); - } else { - finalBackground = boxBackground; - } - - ViewCompat.setBackground(spinner, finalBackground); - } - } - - private boolean shouldUseSpinnerBackgroundForBoxBackground() { - // When the text field's Spinner's background is null, use the Spinner's background for the - // box background. - return spinner != null - && boxBackground != null - && boxBackgroundMode != BOX_BACKGROUND_NONE; - } - - /** - * Returns the box's stroke color. - * - * @return the color used for the box's stroke - * @see #setBoxStrokeColor(int) - */ - public int getBoxStrokeColor() { - return focusedStrokeColor; - } - - /** - * Set the outline box's stroke color. - * - * <p>Calling this method when not in outline box mode will do nothing. - * - * @param boxStrokeColor the color to use for the box's stroke - * @see #getBoxStrokeColor() - */ - public void setBoxStrokeColor(@ColorInt int boxStrokeColor) { - if (focusedStrokeColor != boxStrokeColor) { - focusedStrokeColor = boxStrokeColor; - updatespinnerBoxState(); - } - } - - /** - * Set the resource used for the filled box's background color. - * - * @param boxBackgroundColorId the resource to use for the box's background color - */ - public void setBoxBackgroundColorResource(@ColorRes int boxBackgroundColorId) { - setBoxBackgroundColor(ContextCompat.getColor(getContext(), boxBackgroundColorId)); - } - - /** - * Returns the box's background color. - * - * @return the color used for the box's background - * @see #setBoxBackgroundColor(int) - */ - public int getBoxBackgroundColor() { - return boxBackgroundColor; - } - - /** - * Set the filled box's background color. - * - * @param boxBackgroundColor the color to use for the filled box's background - * @see #getBoxBackgroundColor() - */ - public void setBoxBackgroundColor(@ColorInt int boxBackgroundColor) { - if (this.boxBackgroundColor != boxBackgroundColor) { - this.boxBackgroundColor = boxBackgroundColor; - defaultFilledBackgroundColor = boxBackgroundColor; - applyBoxAttributes(); - } - } - - /** - * Set the resources used for the box's corner radii. - * - * @param boxCornerRadiusTopStartId the resource to use for the box's top start corner radius - * @param boxCornerRadiusTopEndId the resource to use for the box's top end corner radius - * @param boxCornerRadiusBottomEndId the resource to use for the box's bottom end corner radius - * @param boxCornerRadiusBottomStartId the resource to use for the box's bottom start corner - * radius - */ - public void setBoxCornerRadiiResources( - @DimenRes int boxCornerRadiusTopStartId, - @DimenRes int boxCornerRadiusTopEndId, - @DimenRes int boxCornerRadiusBottomEndId, - @DimenRes int boxCornerRadiusBottomStartId) { - setBoxCornerRadii( - getContext().getResources().getDimension(boxCornerRadiusTopStartId), - getContext().getResources().getDimension(boxCornerRadiusTopEndId), - getContext().getResources().getDimension(boxCornerRadiusBottomStartId), - getContext().getResources().getDimension(boxCornerRadiusBottomEndId)); - } - - /** - * Set the box's corner radii. - * - * @param boxCornerRadiusTopStart the value to use for the box's top start corner radius - * @param boxCornerRadiusTopEnd the value to use for the box's top end corner radius - * @param boxCornerRadiusBottomEnd the value to use for the box's bottom end corner radius - * @param boxCornerRadiusBottomStart the value to use for the box's bottom start corner radius - * @see #getBoxCornerRadiusTopStart() - * @see #getBoxCornerRadiusTopEnd() - * @see #getBoxCornerRadiusBottomEnd() - * @see #getBoxCornerRadiusBottomStart() - */ - public void setBoxCornerRadii( - float boxCornerRadiusTopStart, - float boxCornerRadiusTopEnd, - float boxCornerRadiusBottomStart, - float boxCornerRadiusBottomEnd) { - if (shapeAppearanceModel.getTopLeftCorner().getCornerSize() != boxCornerRadiusTopStart - || shapeAppearanceModel.getTopRightCorner().getCornerSize() != boxCornerRadiusTopEnd - || shapeAppearanceModel.getBottomRightCorner().getCornerSize() != boxCornerRadiusBottomEnd - || shapeAppearanceModel.getBottomLeftCorner().getCornerSize() - != boxCornerRadiusBottomStart) { - shapeAppearanceModel.getTopLeftCorner().setCornerSize(boxCornerRadiusTopStart); - shapeAppearanceModel.getTopRightCorner().setCornerSize(boxCornerRadiusTopEnd); - shapeAppearanceModel.getBottomRightCorner().setCornerSize(boxCornerRadiusBottomEnd); - shapeAppearanceModel.getBottomLeftCorner().setCornerSize(boxCornerRadiusBottomStart); - applyBoxAttributes(); - } - } - - /** - * Returns the box's top start corner radius. - * - * @return the value used for the box's top start corner radius - * @see #setBoxCornerRadii(float, float, float, float) - */ - public float getBoxCornerRadiusTopStart() { - return shapeAppearanceModel.getTopLeftCorner().getCornerSize(); - } - - /** - * Returns the box's top end corner radius. - * - * @return the value used for the box's top end corner radius - * @see #setBoxCornerRadii(float, float, float, float) - */ - public float getBoxCornerRadiusTopEnd() { - return shapeAppearanceModel.getTopRightCorner().getCornerSize(); - } - - /** - * Returns the box's bottom end corner radius. - * - * @return the value used for the box's bottom end corner radius - * @see #setBoxCornerRadii(float, float, float, float) - */ - public float getBoxCornerRadiusBottomEnd() { - return shapeAppearanceModel.getBottomLeftCorner().getCornerSize(); - } - - /** - * Returns the box's bottom start corner radius. - * - * @return the value used for the box's bottom start corner radius - * @see #setBoxCornerRadii(float, float, float, float) - */ - public float getBoxCornerRadiusBottomStart() { - return shapeAppearanceModel.getBottomRightCorner().getCornerSize(); - } - - /** - * Adjust the corner size based on the stroke width to maintain GradientDrawable's behavior. - * MaterialShapeDrawable internally adjusts the corner size so that the corner size does not - * depend on the stroke width. GradientDrawable does not account for stroke width, so this causes - * a visual diff when migrating from GradientDrawable to MaterialShapeDrawable. This method - * reverts the corner size adjustment in MaterialShapeDrawable to maintain the visual behavior - * from GradientDrawable for now. - */ - private void adjustCornerSizeForStrokeWidth() { - float strokeInset = boxBackgroundMode == BOX_BACKGROUND_OUTLINE ? boxStrokeWidthPx / 2f : 0; - if (strokeInset <= 0f) { - return; // Only adjust the corner size if there's a stroke inset. - } - - float cornerRadiusTopLeft = shapeAppearanceModel.getTopLeftCorner().getCornerSize(); - cornerAdjustedShapeAppearanceModel - .getTopLeftCorner() - .setCornerSize(cornerRadiusTopLeft + strokeInset); - - float cornerRadiusTopRight = shapeAppearanceModel.getTopRightCorner().getCornerSize(); - cornerAdjustedShapeAppearanceModel - .getTopRightCorner() - .setCornerSize(cornerRadiusTopRight + strokeInset); - - float cornerRadiusBottomRight = shapeAppearanceModel.getBottomRightCorner().getCornerSize(); - cornerAdjustedShapeAppearanceModel - .getBottomRightCorner() - .setCornerSize(cornerRadiusBottomRight + strokeInset); - - float cornerRadiusBottomLeft = shapeAppearanceModel.getBottomLeftCorner().getCornerSize(); - cornerAdjustedShapeAppearanceModel - .getBottomLeftCorner() - .setCornerSize(cornerRadiusBottomLeft + strokeInset); - - ensureCornerAdjustedShapeAppearanceModel(); - } - - private void ensureCornerAdjustedShapeAppearanceModel() { - if (boxBackgroundMode != BOX_BACKGROUND_NONE - && getBoxBackground() instanceof MaterialShapeDrawable) { - ((MaterialShapeDrawable) getBoxBackground()) - .setShapeAppearanceModel(cornerAdjustedShapeAppearanceModel); - } - } - - /** - * Returns the typeface used for the hint and any label views (such as counter and error views). - */ - @Nullable - public Typeface getTypeface() { - return typeface; - } - - /** - * Set the typeface to use for the hint and any label views (such as counter and error views). - * - * @param typeface typeface to use, or {@code null} to use the default. - */ - @SuppressWarnings("ReferenceEquality") // Matches the Typeface comparison in TextView - public void setTypeface(@Nullable Typeface typeface) { - if (typeface != this.typeface) { - this.typeface = typeface; - - collapsingTextHelper.setTypefaces(typeface); - indicatorViewController.setTypefaces(typeface); - } - } - - private void updateInputLayoutMargins() { - // Create/update the LayoutParams so that we can add enough top margin - // to the Spinner to make room for the label. - if (boxBackgroundMode != BOX_BACKGROUND_FILLED) { - final LayoutParams lp = (LayoutParams) inputFrame.getLayoutParams(); - final int newTopMargin = calculateLabelMarginTop(); - - if (newTopMargin != lp.topMargin) { - lp.topMargin = newTopMargin; - inputFrame.requestLayout(); - } - } - } - - @Override - public int getBaseline() { - if (spinner != null) { - return spinner.getBaseline() + getPaddingTop() + calculateLabelMarginTop(); - } else { - return super.getBaseline(); - } - } - - void updateLabelState(boolean animate) { - updateLabelState(animate, false); - } - - private void updateLabelState(boolean animate, boolean force) { - final boolean isEnabled = isEnabled(); - final boolean hasFocus = spinner != null && spinner.hasFocus(); - final boolean errorShouldBeShown = indicatorViewController.errorShouldBeShown(); - - // Set the expanded and collapsed labels to the default text color. - if (defaultHintTextColor != null) { - collapsingTextHelper.setCollapsedTextColor(defaultHintTextColor); - } - - // Set the collapsed and expanded label text colors based on the current state. - if (!isEnabled) { - collapsingTextHelper.setCollapsedTextColor(ColorStateList.valueOf(disabledColor)); - } else if (errorShouldBeShown) { - collapsingTextHelper.setCollapsedTextColor(indicatorViewController.getErrorViewTextColors()); - } else if (hasFocus && focusedTextColor != null) { - collapsingTextHelper.setCollapsedTextColor(focusedTextColor); - } // If none of these states apply, leave the expanded and collapsed colors as they are. - - // We should be showing the label so do so if it isn't already - if (isEnabled() && (hasFocus || errorShouldBeShown) && force) { - if (cutoutEnabled()) { - openCutout(); - } - } - } - - /** - * Returns the {@link Spinner} used for text input. - */ - @Nullable - public Spinner getSpinner() { - return spinner; - } - - private void setSpinner(Spinner spinner) { - // If we already have an Spinner, throw an exception - if (this.spinner != null) { - throw new IllegalArgumentException("We already have an Spinner, can only have one"); - } - - this.spinner = spinner; - onApplyBoxBackgroundMode(); - - final int spinnerGravity = this.spinner.getGravity(); - collapsingTextHelper.setCollapsedTextGravity( - Gravity.TOP | (spinnerGravity & ~Gravity.VERTICAL_GRAVITY_MASK)); - - updateSpinnerBackground(); - - indicatorViewController.adjustIndicatorPadding(); - dispatchOnSpinnerAttached(); - - // Update the label visibility with no animation, but force a state change - updateLabelState(false, true); - } - - private void setHintInternal(CharSequence hint) { - if (!TextUtils.equals(hint, this.hint)) { - this.hint = hint; - collapsingTextHelper.setText(hint); - // Reset the cutout to make room for a larger hint. - openCutout(); - } - } - - /** - * Returns the hint which is displayed in the floating label, if enabled. - * - * @return the hint, or null if there isn't one set, or the hint is not enabled. - */ - @Nullable - public CharSequence getHint() { - return hintEnabled ? hint : null; - } - - /** - * Set the hint to be displayed in the floating label, if enabled. - * - * @see #setHintEnabled(boolean) - */ - public void setHint(@Nullable CharSequence hint) { - if (hintEnabled) { - setHintInternal(hint); - sendAccessibilityEvent(AccessibilityEvent.TYPE_WINDOW_CONTENT_CHANGED); - } - } - - /** - * Returns whether the floating label functionality is enabled or not in this layout. - * - * @see #setHintEnabled(boolean) - */ - public boolean isHintEnabled() { - return hintEnabled; - } - - /** - * Sets whether the floating label functionality is enabled or not in this layout. - * - * <p>If enabled, any non-empty hint in the child Spinner will be moved into the floating hint, - * and its existing hint will be cleared. If disabled, then any non-empty floating hint in this - * layout will be moved into the Spinner, and this layout's hint will be cleared. - * - * @see #setHint(CharSequence) - * @see #isHintEnabled() - */ - public void setHintEnabled(boolean enabled) { - if (enabled != hintEnabled) { - hintEnabled = enabled; - if (!hintEnabled) { - // Ensures a child Spinner provides its internal hint, not this MaterialSpinnerLayout's. - isProvidingHint = false; - // Now clear out any set hint - setHintInternal(null); - } else { - isProvidingHint = true; - } - - // Now update the Spinner top margin - if (spinner != null) { - updateInputLayoutMargins(); - } - } - } - - /** - * Returns whether or not this layout is actively managing a child {@link Spinner}'s hint. - */ - boolean isProvidingHint() { - return isProvidingHint; - } - - /** - * Sets the collapsed hint text color, size, style from the specified TextAppearance resource. - */ - public void setHintTextAppearance(@StyleRes int resId) { - collapsingTextHelper.setCollapsedTextAppearance(resId); - focusedTextColor = collapsingTextHelper.getCollapsedTextColor(); - - if (spinner != null) { - updateLabelState(false); - // Text size might have changed so update the top margin - updateInputLayoutMargins(); - } - } - - /** - * Gets the collapsed hint text color. - */ - @Nullable - public ColorStateList getHintTextColor() { - return collapsingTextHelper.getCollapsedTextColor(); - } - - /** - * Sets the collapsed hint text color from the specified ColorStateList resource. - */ - public void setHintTextColor(@Nullable ColorStateList hintTextColor) { - if (collapsingTextHelper.getCollapsedTextColor() != hintTextColor) { - collapsingTextHelper.setCollapsedTextColor(hintTextColor); - focusedTextColor = hintTextColor; - - if (spinner != null) { - updateLabelState(false); - } - } - } - - /** - * Returns the text color used by the hint in both the collapsed and expanded states, or null if - * no color has been set. - */ - @Nullable - public ColorStateList getDefaultHintTextColor() { - return defaultHintTextColor; - } - - /** - * Sets the text color used by the hint in both the collapsed and expanded states. - */ - public void setDefaultHintTextColor(@Nullable ColorStateList textColor) { - defaultHintTextColor = textColor; - focusedTextColor = textColor; - - if (spinner != null) { - updateLabelState(false); - } - } - - /** - * Sets the text color and size for the error message from the specified TextAppearance resource. - */ - public void setErrorTextAppearance(@StyleRes int errorTextAppearance) { - indicatorViewController.setErrorTextAppearance(errorTextAppearance); - } - - /** - * Sets the text color used by the error message in all states. - */ - public void setErrorTextColor(@Nullable ColorStateList errorTextColor) { - indicatorViewController.setErrorViewTextColor(errorTextColor); - } - - /** - * Returns the text color used by the error message in current state. - */ - @ColorInt - public int getErrorCurrentTextColors() { - return indicatorViewController.getErrorViewCurrentTextColor(); - } - - /** - * Sets the text color and size for the helper text from the specified TextAppearance resource. - */ - public void setHelperTextTextAppearance(@StyleRes int helperTextTextAppearance) { - indicatorViewController.setHelperTextAppearance(helperTextTextAppearance); - } - - /** - * Sets the text color used by the helper text in all states. - */ - public void setHelperTextColor(@Nullable ColorStateList helperTextColor) { - indicatorViewController.setHelperTextViewTextColor(helperTextColor); - } - - /** - * Returns whether the error functionality is enabled or not in this layout. - * - * @see #setErrorEnabled(boolean) - */ - public boolean isErrorEnabled() { - return indicatorViewController.isErrorEnabled(); - } - - /** - * Whether the error functionality is enabled or not in this layout. Enabling this functionality - * before setting an error message via {@link #setError(CharSequence)}, will mean that this layout - * will not change size when an error is displayed. - */ - public void setErrorEnabled(boolean enabled) { - indicatorViewController.setErrorEnabled(enabled); - } - - /** - * Returns whether the helper text functionality is enabled or not in this layout. - * - * @see #setHelperTextEnabled(boolean) - */ - public boolean isHelperTextEnabled() { - return indicatorViewController.isHelperTextEnabled(); - } - - /** - * Whether the helper text functionality is enabled or not in this layout. Enabling this - * functionality before setting a helper message via {@link #setHelperText(CharSequence)} will - * mean that this layout will not change size when a helper message is displayed. - */ - public void setHelperTextEnabled(boolean enabled) { - indicatorViewController.setHelperTextEnabled(enabled); - } - - /** - * Returns the text color used by the helper text in the current states. - */ - @ColorInt - public int getHelperTextCurrentTextColor() { - return indicatorViewController.getHelperTextViewCurrentTextColor(); - } - - @Override - public void setEnabled(boolean enabled) { - // Since we're set to addStatesFromChildren, we need to make sure that we set all - // children to enabled/disabled otherwise any enabled children will wipe out our disabled - // drawable state - recursiveSetEnabled(this, enabled); - super.setEnabled(enabled); - } - - void setTextAppearanceCompatWithErrorFallback(TextView textView, @StyleRes int textAppearance) { - boolean useDefaultColor = false; - try { - TextViewCompat.setTextAppearance(textView, textAppearance); - - if (VERSION.SDK_INT >= VERSION_CODES.M - && textView.getTextColors().getDefaultColor() == Color.MAGENTA) { - // Caused by our theme not extending from Theme.Design*. On API 23 and - // above, unresolved theme attrs result in MAGENTA rather than an exception. - // Flag so that we use a decent default - useDefaultColor = true; - } - } catch (Exception e) { - // Caused by our theme not extending from Theme.Design*. Flag so that we use - // a decent default - useDefaultColor = true; - } - if (useDefaultColor) { - // Probably caused by our theme not extending from Theme.Design*. Instead - // we manually set something appropriate - TextViewCompat.setTextAppearance(textView, R.style.TextAppearance_AppCompat_Caption); - textView.setTextColor(ContextCompat.getColor(getContext(), R.color.md_design_error)); - } - } - - private int calculateLabelMarginTop() { - if (!hintEnabled) { - return 0; - } - - switch (boxBackgroundMode) { - case BOX_BACKGROUND_OUTLINE: - return (int) (collapsingTextHelper.getCollapsedTextHeight() / 2); - case BOX_BACKGROUND_FILLED: - case BOX_BACKGROUND_NONE: - return (int) collapsingTextHelper.getCollapsedTextHeight(); - default: - return 0; - } - } - - private Rect calculateCollapsedTextBounds(Rect rect) { - if (spinner == null) { - throw new IllegalStateException(); - } - Rect bounds = tmpBoundsRect; - - bounds.bottom = rect.bottom; - switch (boxBackgroundMode) { - case BOX_BACKGROUND_OUTLINE: - bounds.left = rect.left + spinner.getPaddingLeft(); - bounds.top = rect.top - calculateLabelMarginTop(); - bounds.right = rect.right - spinner.getPaddingRight(); - return bounds; - case BOX_BACKGROUND_FILLED: - bounds.left = rect.left + spinner.getPaddingLeft(); - bounds.top = rect.top + boxCollapsedPaddingTopPx; - bounds.right = rect.right - spinner.getPaddingRight(); - return bounds; - case BOX_BACKGROUND_NONE: - default: - bounds.left = rect.left + spinner.getPaddingLeft(); - bounds.top = getPaddingTop(); - bounds.right = rect.right - spinner.getPaddingRight(); - return bounds; - } - } - - /* - * Calculates the box background color that should be set. - * - * The filled text field has a surface layer with value {@code ?attr/colorSurface} underneath its - * background that is taken into account when calculating the background color. - */ - private int calculateBoxBackgroundColor() { - int backgroundColor = boxBackgroundColor; - if (boxBackgroundMode == BOX_BACKGROUND_FILLED) { - int surfaceLayerColor = MaterialColors.INSTANCE.getColor(this, R.attr.colorSurface, Color.TRANSPARENT); - backgroundColor = MaterialColors.INSTANCE.layer(surfaceLayerColor, boxBackgroundColor); - } - return backgroundColor; - } - - private void applyBoxAttributes() { - if (boxBackground == null) { - return; - } - - if (canDrawOutlineStroke()) { - boxBackground.setStroke(boxStrokeWidthPx, boxStrokeColor); - } - - boxBackground.setFillColor(ColorStateList.valueOf(calculateBoxBackgroundColor())); - applyBoxUnderlineAttributes(); - invalidate(); - } - - private void applyBoxUnderlineAttributes() { - // Exit if the underline is not being drawn by MaterialSpinnerLayout. - if (boxUnderline == null) { - return; - } - - if (canDrawStroke()) { - boxUnderline.setFillColor(ColorStateList.valueOf(boxStrokeColor)); - } - invalidate(); - } - - private boolean canDrawOutlineStroke() { - return boxBackgroundMode == BOX_BACKGROUND_OUTLINE && canDrawStroke(); - } - - private boolean canDrawStroke() { - return boxStrokeWidthPx > -1 && boxStrokeColor != Color.TRANSPARENT; - } - - void updateSpinnerBackground() { - // Only update the color filter for the legacy text field, since we can directly change the - // Paint colors of the MaterialShapeDrawable box background without having to use color filters. - if (spinner == null || boxBackgroundMode != BOX_BACKGROUND_NONE) { - return; - } - - Drawable spinnerBackground = spinner.getBackground(); - if (spinnerBackground == null) { - return; - } - - spinnerBackground = spinnerBackground.mutate(); - - if (indicatorViewController.errorShouldBeShown()) { - // Set a color filter for the error color - spinnerBackground.setColorFilter( - new PorterDuffColorFilter(indicatorViewController.getErrorViewCurrentTextColor(), PorterDuff.Mode.SRC_IN) - ); - } else { - // Else reset the color filter and refresh the drawable state so that the - // normal tint is used - DrawableCompat.clearColorFilter(spinnerBackground); - spinner.refreshDrawableState(); - } - } - - @Override - public Parcelable onSaveInstanceState() { - Parcelable superState = super.onSaveInstanceState(); - SavedState ss = new SavedState(superState); - if (indicatorViewController.errorShouldBeShown()) { - ss.error = getError(); - } - return ss; - } - - @Override - protected void onRestoreInstanceState(Parcelable state) { - if (!(state instanceof SavedState)) { - super.onRestoreInstanceState(state); - return; - } - SavedState ss = (SavedState) state; - super.onRestoreInstanceState(ss.getSuperState()); - setError(ss.error); - requestLayout(); - } - - /** - * Returns the error message that was set to be displayed with {@link #setError(CharSequence)}, or - * <code>null</code> if no error was set or if error displaying is not enabled. - * - * @see #setError(CharSequence) - */ - @Nullable - public CharSequence getError() { - return indicatorViewController.isErrorEnabled() ? indicatorViewController.getErrorText() : null; - } - - /** - * Sets an error message that will be displayed below our {@link Spinner}. If the {@code error} is - * {@code null}, the error message will be cleared. - * - * <p>If the error functionality has not been enabled via {@link #setErrorEnabled(boolean)}, then - * it will be automatically enabled if {@code error} is not empty. - * - * @param errorText Error message to display, or null to clear - * @see #getError() - */ - public void setError(@Nullable final CharSequence errorText) { - if (!indicatorViewController.isErrorEnabled()) { - if (TextUtils.isEmpty(errorText)) { - // If error isn't enabled, and the error is empty, just return - return; - } - // Else, we'll assume that they want to enable the error functionality - setErrorEnabled(true); - } - - if (!TextUtils.isEmpty(errorText)) { - indicatorViewController.showError(errorText); - } else { - indicatorViewController.hideError(); - } - } - - /** - * Returns the helper message that was set to be displayed with {@link - * #setHelperText(CharSequence)}, or <code>null</code> if no helper text was set or if helper text - * functionality is not enabled. - * - * @see #setHelperText(CharSequence) - */ - @Nullable - public CharSequence getHelperText() { - return indicatorViewController.isHelperTextEnabled() - ? indicatorViewController.getHelperText() - : null; - } - - /** - * Sets a helper message that will be displayed below the {@link Spinner}. If the {@code helper} - * is {@code null}, the helper text functionality will be disabled and the helper message will be - * hidden. - * - * <p>If the helper text functionality has not been enabled via {@link - * #setHelperTextEnabled(boolean)}, then it will be automatically enabled if {@code helper} is not - * empty. - * - * @param helperText Helper text to display - * @see #getHelperText() - */ - public void setHelperText(@Nullable final CharSequence helperText) { - // If helper text is null, disable helper if it's enabled. - if (TextUtils.isEmpty(helperText)) { - if (isHelperTextEnabled()) { - setHelperTextEnabled(false); - } - } else { - if (!isHelperTextEnabled()) { - setHelperTextEnabled(true); - } - indicatorViewController.showHelper(helperText); - } - } - - /** - * Returns whether any hint state changes, due to being focused or non-empty text, are animated. - * - * @see #setHintAnimationEnabled(boolean) - */ - public boolean isHintAnimationEnabled() { - return hintAnimationEnabled; - } - - /** - * Set whether any hint state changes, due to being focused or non-empty text, are animated. - * - * @see #isHintAnimationEnabled() - */ - public void setHintAnimationEnabled(boolean enabled) { - hintAnimationEnabled = enabled; - } - - /** - * Add a {@link OnSpinnerAttachedListener} that will be invoked when the edit text is attached, - * or from this method if the Spinner is already present. - * - * <p>Components that add a listener should take care to remove it when finished via {@link - * #removeOnSpinnerAttachedListener(OnSpinnerAttachedListener)}. - * - * @param listener listener to add - */ - public void addOnSpinnerAttachedListener(OnSpinnerAttachedListener listener) { - spinnerAttachedListeners.add(listener); - if (spinner != null) { - listener.onSpinnerAttached(); - } - } - - /** - * Remove the given {@link OnSpinnerAttachedListener} that was previously added via {@link - * #addOnSpinnerAttachedListener(OnSpinnerAttachedListener)}. - * - * @param listener listener to remove - */ - public void removeOnSpinnerAttachedListener(OnSpinnerAttachedListener listener) { - spinnerAttachedListeners.remove(listener); - } - - /** - * Remove all previously added {@link OnSpinnerAttachedListener}s. - */ - public void clearOnSpinnerAttachedListeners() { - spinnerAttachedListeners.clear(); - } - - private void dispatchOnSpinnerAttached() { - for (OnSpinnerAttachedListener listener : spinnerAttachedListeners) { - listener.onSpinnerAttached(); - } - } - - @Override - protected void onLayout(boolean changed, int left, int top, int right, int bottom) { - super.onLayout(changed, left, top, right, bottom); - - if (spinner != null) { - Rect rect = tmpRect; - DescendantOffsetUtils.getDescendantRect(this, spinner, rect); - updateBoxUnderlineBounds(rect); - - if (hintEnabled) { - collapsingTextHelper.setCollapsedBounds(calculateCollapsedTextBounds(rect)); - collapsingTextHelper.recalculate(); - - // If the label should be collapsed, set the cutout bounds on the CutoutDrawable to make - // sure it draws with a cutout in draw(). - if (cutoutEnabled()) { - openCutout(); - } - } - } - } - - private void updateBoxUnderlineBounds(Rect bounds) { - if (boxUnderline != null) { - int top = bounds.bottom - boxStrokeWidthFocusedPx; - boxUnderline.setBounds(bounds.left, top, bounds.right, bounds.bottom); - } - } - - @Override - public void draw(Canvas canvas) { - super.draw(canvas); - drawHint(canvas); - drawBoxUnderline(canvas); - } - - private void drawHint(Canvas canvas) { - if (hintEnabled) { - collapsingTextHelper.draw(canvas); - } - } - - private void drawBoxUnderline(Canvas canvas) { - if (boxUnderline != null) { - // Draw using the current boxStrokeWidth. - Rect underlineBounds = boxUnderline.getBounds(); - underlineBounds.top = underlineBounds.bottom - boxStrokeWidthPx; - boxUnderline.draw(canvas); - } - } - - private boolean cutoutEnabled() { - return hintEnabled && !TextUtils.isEmpty(hint) && boxBackground instanceof CutoutDrawable; - } - - private void openCutout() { - if (!cutoutEnabled()) { - return; - } - final RectF cutoutBounds = tmpRectF; - collapsingTextHelper.getCollapsedTextActualBounds(cutoutBounds); - applyCutoutPadding(cutoutBounds); - // Offset the cutout bounds by the MaterialSpinnerLayout's left padding to ensure that the cutout is - // inset relative to the MaterialSpinnerLayout's bounds. - cutoutBounds.offset(-getPaddingLeft(), 0); - ((CutoutDrawable) boxBackground).setCutout(cutoutBounds); - } - - private void closeCutout() { - if (cutoutEnabled()) { - ((CutoutDrawable) boxBackground).removeCutout(); - } - } - - private void applyCutoutPadding(RectF cutoutBounds) { - cutoutBounds.left -= boxLabelCutoutPaddingPx; - cutoutBounds.top -= boxLabelCutoutPaddingPx; - cutoutBounds.right += boxLabelCutoutPaddingPx; - cutoutBounds.bottom += boxLabelCutoutPaddingPx; - } - - @VisibleForTesting - boolean cutoutIsOpen() { - return cutoutEnabled() && ((CutoutDrawable) boxBackground).hasCutout(); - } - - @Override - protected void drawableStateChanged() { - if (inDrawableStateChanged) { - // Some of the calls below will update the drawable state of child views. Since we're - // using addStatesFromChildren we can get into infinite recursion, hence we'll just - // exit in this instance - return; - } - - inDrawableStateChanged = true; - - super.drawableStateChanged(); - - final int[] state = getDrawableState(); - boolean changed = collapsingTextHelper.setState(state); - - // Drawable state has changed so see if we need to update the label - updateLabelState(ViewCompat.isLaidOut(this) && isEnabled()); - updateSpinnerBackground(); - updatespinnerBoxState(); - - if (changed) { - invalidate(); - } - - inDrawableStateChanged = false; - } - - void updatespinnerBoxState() { - if (boxBackground == null || boxBackgroundMode == BOX_BACKGROUND_NONE) { - return; - } - - final boolean hasFocus = isFocused() || (spinner != null && spinner.hasFocus()); - final boolean isHovered = isHovered() || (spinner != null && spinner.isHovered()); - - // Update the text box's stroke color based on the current state. - if (!isEnabled()) { - boxStrokeColor = disabledColor; - } else if (indicatorViewController.errorShouldBeShown()) { - boxStrokeColor = indicatorViewController.getErrorViewCurrentTextColor(); - } else if (hasFocus) { - boxStrokeColor = focusedStrokeColor; - } else if (isHovered) { - boxStrokeColor = hoveredStrokeColor; - } else { - boxStrokeColor = defaultStrokeColor; - } - - // Update the text box's stroke width based on the current state. - if ((isHovered || hasFocus) && isEnabled()) { - boxStrokeWidthPx = boxStrokeWidthFocusedPx; - adjustCornerSizeForStrokeWidth(); - } else { - boxStrokeWidthPx = boxStrokeWidthDefaultPx; - adjustCornerSizeForStrokeWidth(); - } - - // Update the text box's background color based on the current state. - if (boxBackgroundMode == BOX_BACKGROUND_FILLED) { - if (!isEnabled()) { - boxBackgroundColor = disabledFilledBackgroundColor; - } else if (isHovered) { - boxBackgroundColor = hoveredFilledBackgroundColor; - } else { - boxBackgroundColor = defaultFilledBackgroundColor; - } - } - - applyBoxAttributes(); - } - - @VisibleForTesting - final boolean isHelperTextDisplayed() { - return indicatorViewController.helperTextIsDisplayed(); - } - - @VisibleForTesting - final int getHintCurrentCollapsedTextColor() { - return collapsingTextHelper.getCurrentCollapsedTextColor(); - } - - @VisibleForTesting - final float getHintCollapsedTextHeight() { - return collapsingTextHelper.getCollapsedTextHeight(); - } - - @VisibleForTesting - final int getErrorTextCurrentColor() { - return indicatorViewController.getErrorViewCurrentTextColor(); - } - - /** - * Values for box background mode. There is either a filled background, an outline background, or - * no background. - */ - @IntDef({BOX_BACKGROUND_NONE, BOX_BACKGROUND_FILLED, BOX_BACKGROUND_OUTLINE}) - @Retention(RetentionPolicy.SOURCE) - public @interface BoxBackgroundMode { - } - - /** - * Callback interface invoked when the view's {@link Spinner} is attached, or from {@link - * #addOnSpinnerAttachedListener(OnSpinnerAttachedListener)} if the edit text is already present. - * - * @see #addOnSpinnerAttachedListener(OnSpinnerAttachedListener) - */ - public interface OnSpinnerAttachedListener { - - /** - * Called when the {@link Spinner} is attached, or from {@link - * #addOnSpinnerAttachedListener(OnSpinnerAttachedListener)} if the edit text is already - * present. - */ - void onSpinnerAttached(); - } - - static class SavedState extends AbsSavedState { - public static final Creator<SavedState> CREATOR = - new ClassLoaderCreator<SavedState>() { - @Override - public SavedState createFromParcel(Parcel in, ClassLoader loader) { - return new SavedState(in, loader); - } - - @Override - public SavedState createFromParcel(Parcel in) { - return new SavedState(in, null); - } - - @Override - public SavedState[] newArray(int size) { - return new SavedState[size]; - } - }; - CharSequence error; - - SavedState(Parcelable superState) { - super(superState); - } - - SavedState(Parcel source, ClassLoader loader) { - super(source, loader); - error = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(source); - } - - @Override - public void writeToParcel(Parcel dest, int flags) { - super.writeToParcel(dest, flags); - TextUtils.writeToParcel(error, dest, flags); - } - - @NotNull - @Override - public String toString() { - return "MaterialSpinnerLayout.SavedState{" - + Integer.toHexString(System.identityHashCode(this)) - + " error=" - + error - + "}"; - } - } -} diff --git a/ui_spinner/src/main/res/color/md_design_box_stroke_color.xml b/ui_spinner/src/main/res/color/md_design_box_stroke_color.xml deleted file mode 100644 index 0050bc02f66891023a48f735a8af86b76ccc299f..0000000000000000000000000000000000000000 --- a/ui_spinner/src/main/res/color/md_design_box_stroke_color.xml +++ /dev/null @@ -1,18 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - Copyright (C) 2018 The Android Open Source Project - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - http://www.apache.org/licenses/LICENSE-2.0 - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. ---> -<selector xmlns:android="http://schemas.android.com/apk/res/android"> - <item android:color="@color/md_mtrl_spinner_focused_box_stroke_color" android:state_focused="true" /> - <item android:color="@color/md_mtrl_spinner_hovered_box_stroke_color" android:state_hovered="true" /> - <item android:color="@color/md_mtrl_spinner_disabled_color" android:state_enabled="false" /> - <item android:color="@color/md_mtrl_spinner_default_box_stroke_color" /> -</selector> diff --git a/ui_spinner/src/main/res/color/md_design_error.xml b/ui_spinner/src/main/res/color/md_design_error.xml deleted file mode 100644 index 691420f39a1a0f077f93a18444528b32682cbb1a..0000000000000000000000000000000000000000 --- a/ui_spinner/src/main/res/color/md_design_error.xml +++ /dev/null @@ -1,16 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - Copyright (C) 2016 The Android Open Source Project - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - http://www.apache.org/licenses/LICENSE-2.0 - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. ---> -<selector xmlns:android="http://schemas.android.com/apk/res/android"> - <item android:color="?android:attr/textColorTertiary" android:state_enabled="false" /> - <item android:color="?attr/colorError" /> -</selector> diff --git a/ui_spinner/src/main/res/color/md_mtrl_error.xml b/ui_spinner/src/main/res/color/md_mtrl_error.xml deleted file mode 100644 index d333a0177f680696468fd176b9512c0090edf463..0000000000000000000000000000000000000000 --- a/ui_spinner/src/main/res/color/md_mtrl_error.xml +++ /dev/null @@ -1,16 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - Copyright (C) 2018 The Android Open Source Project - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - http://www.apache.org/licenses/LICENSE-2.0 - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. ---> -<selector xmlns:android="http://schemas.android.com/apk/res/android"> - <item android:color="?attr/colorOnError" android:state_enabled="false" /> - <item android:color="?attr/colorError" /> -</selector> diff --git a/ui_spinner/src/main/res/color/md_mtrl_filled_background_color.xml b/ui_spinner/src/main/res/color/md_mtrl_filled_background_color.xml deleted file mode 100644 index e5c7701859430114efc268f7fa13ad13d08ea36a..0000000000000000000000000000000000000000 --- a/ui_spinner/src/main/res/color/md_mtrl_filled_background_color.xml +++ /dev/null @@ -1,20 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - Copyright (C) 2018 The Android Open Source Project - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. ---> -<selector xmlns:android="http://schemas.android.com/apk/res/android"> - <item android:alpha="0.16" android:color="?attr/colorOnSurface" android:state_hovered="true" /> - <item android:alpha="0.04" android:color="?attr/colorOnSurface" android:state_enabled="false" /> - <item android:alpha="0.12" android:color="?attr/colorOnSurface" /> -</selector> diff --git a/ui_spinner/src/main/res/color/md_mtrl_filled_stroke_color.xml b/ui_spinner/src/main/res/color/md_mtrl_filled_stroke_color.xml deleted file mode 100644 index 5eb07775cfbd42efefa2d31b3d2dda3cac0c2c0b..0000000000000000000000000000000000000000 --- a/ui_spinner/src/main/res/color/md_mtrl_filled_stroke_color.xml +++ /dev/null @@ -1,22 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - ~ Copyright 2018 The Android Open Source Project - ~ - ~ Licensed under the Apache License, Version 2.0 (the "License"); - ~ you may not use this file except in compliance with the License. - ~ You may obtain a copy of the License at - ~ - ~ https://www.apache.org/licenses/LICENSE-2.0 - ~ - ~ Unless required by applicable law or agreed to in writing, software - ~ distributed under the License is distributed on an "AS IS" BASIS, - ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - ~ See the License for the specific language governing permissions and - ~ limitations under the License. - --> -<selector xmlns:android="http://schemas.android.com/apk/res/android"> - <item android:color="?attr/colorPrimary" android:state_focused="true" /> - <!-- 4% overlay over 42% colorOnSurface --> - <item android:alpha="0.46" android:color="?attr/colorOnSurface" android:state_hovered="true" /> - <item android:alpha="0.38" android:color="?attr/colorOnSurface" android:state_enabled="false" /> - <item android:alpha="0.42" android:color="?attr/colorOnSurface" /> -</selector> diff --git a/ui_spinner/src/main/res/color/md_mtrl_indicator_text_color.xml b/ui_spinner/src/main/res/color/md_mtrl_indicator_text_color.xml deleted file mode 100644 index 60d9539a4978f9a007467ce5a0a8e78d343b1366..0000000000000000000000000000000000000000 --- a/ui_spinner/src/main/res/color/md_mtrl_indicator_text_color.xml +++ /dev/null @@ -1,16 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - Copyright (C) 2018 The Android Open Source Project - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - http://www.apache.org/licenses/LICENSE-2.0 - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. ---> -<selector xmlns:android="http://schemas.android.com/apk/res/android"> - <item android:alpha="0.38" android:color="?attr/colorOnSurface" android:state_enabled="false" /> - <item android:alpha="0.6" android:color="?attr/colorOnSurface" /> -</selector> diff --git a/ui_spinner/src/main/res/color/md_mtrl_outlined_stroke_color.xml b/ui_spinner/src/main/res/color/md_mtrl_outlined_stroke_color.xml deleted file mode 100644 index 91e5612fcc54fb32ae7b947974adef5f6a116669..0000000000000000000000000000000000000000 --- a/ui_spinner/src/main/res/color/md_mtrl_outlined_stroke_color.xml +++ /dev/null @@ -1,21 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - Copyright (C) 2018 The Android Open Source Project - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. ---> -<selector xmlns:android="http://schemas.android.com/apk/res/android"> - <item android:color="?attr/colorPrimary" android:state_focused="true" /> - <item android:alpha="0.87" android:color="?attr/colorOnSurface" android:state_hovered="true" /> - <item android:alpha="0.12" android:color="?attr/colorOnSurface" android:state_enabled="false" /> - <item android:alpha="0.38" android:color="?attr/colorOnSurface" /> -</selector> diff --git a/ui_spinner/src/main/res/values/_attrs.xml b/ui_spinner/src/main/res/values/_attrs.xml deleted file mode 100644 index 52a536002feaca6027b303e32a1c097eeb95f750..0000000000000000000000000000000000000000 --- a/ui_spinner/src/main/res/values/_attrs.xml +++ /dev/null @@ -1,21 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - ~ Copyright (C) 2017 The Android Open Source Project - ~ - ~ Licensed under the Apache License, Version 2.0 (the "License"); - ~ you may not use this file except in compliance with the License. - ~ You may obtain a copy of the License at - ~ - ~ http://www.apache.org/licenses/LICENSE-2.0 - ~ - ~ Unless required by applicable law or agreed to in writing, software - ~ distributed under the License is distributed on an "AS IS" BASIS, - ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - ~ See the License for the specific language governing permissions and - ~ limitations under the License. ---> -<resources> - <declare-styleable name="md_TextAppearance"> - <attr name="android:textSize" /> - <attr name="android:textColor" /> - </declare-styleable> -</resources> diff --git a/ui_spinner/src/main/res/values/color_attrs.xml b/ui_spinner/src/main/res/values/color_attrs.xml deleted file mode 100644 index c7f8ada1accdd7ca1f076563e6624ca472850a25..0000000000000000000000000000000000000000 --- a/ui_spinner/src/main/res/values/color_attrs.xml +++ /dev/null @@ -1,66 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - ~ Copyright (C) 2017 The Android Open Source Project - ~ - ~ Licensed under the Apache License, Version 2.0 (the "License"); - ~ you may not use this file except in compliance with the License. - ~ You may obtain a copy of the License at - ~ - ~ http://www.apache.org/licenses/LICENSE-2.0 - ~ - ~ Unless required by applicable law or agreed to in writing, software - ~ distributed under the License is distributed on an "AS IS" BASIS, - ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - ~ See the License for the specific language governing permissions and - ~ limitations under the License. ---> -<resources> - <!-- A tonal variation of the primary color. --> - <attr name="colorPrimaryVariant" format="color" /> - <!-- The secondary branding color for the app, usually a bright complement to the primary - branding color. --> - <attr name="colorSecondary" format="color" /> - <!-- A tonal variation of the secondary color. --> - <attr name="colorSecondaryVariant" format="color" /> - <!-- The color of surfaces such as cards, sheets, menus. --> - <attr name="colorSurface" format="color" /> - <!-- A color that passes accessibility guidelines for text/iconography when drawn on top of - primary. --> - <attr name="colorOnPrimary" format="color" /> - <!-- A color that passes accessibility guidelines for text/iconography when drawn on top of - secondary. --> - <attr name="colorOnSecondary" format="color" /> - <!-- A color that passes accessibility guidelines for text/iconography when drawn on top of - background. --> - <attr name="colorOnBackground" /> - <!-- A color that passes accessibility guidelines for text/iconography when drawn on top of - error. --> - <attr name="colorOnError" format="color" /> - <!-- A color that passes accessibility guidelines for text/iconography when drawn on top of - surface. --> - <attr name="colorOnSurface" format="color" /> - - <!-- Private color attributes that help facilitate switching these pre-23 compatibility - values for the light and dark themes. --> - <attr name="colorOnPrimaryDisabled" format="color" /> - <attr name="colorOnPrimaryEmphasisHighType" format="color" /> - <attr name="colorOnPrimaryEmphasisMedium" format="color" /> - <attr name="colorOnSurfaceDisabled" format="color" /> - <attr name="colorOnSurfaceEmphasisHighType" format="color" /> - <attr name="colorOnSurfaceEmphasisMedium" format="color" /> - - <!-- The scrim background that appears below modals and expanded navigation menus. - The background can either be a color or a bitmap drawable with tileMode set to repeat. --> - <attr name="scrimBackground" format="color|reference" /> - - <!-- Internal flag used to denote that a theme is a Theme.MaterialComponents theme or a - Theme.MaterialComponents.Bridge theme. --> - <attr name="isMaterialTheme" format="boolean" /> - - <!-- When set to true, the material selection controls will tint themselves according to - Material Theme colors. When set to false, Material Theme colors will - be ignored. This value should be set to false when using custom drawables - that should not be tinted. This value is ignored if a buttonTint is set. - Set this attribute on your styles for each selection control.--> - <attr name="useMaterialThemeColors" format="boolean" /> - -</resources> diff --git a/ui_spinner/src/main/res/values/internal_attrs.xml b/ui_spinner/src/main/res/values/internal_attrs.xml deleted file mode 100644 index 0f5a7e6871fdd108dc1f6aff6b8268e769697ec4..0000000000000000000000000000000000000000 --- a/ui_spinner/src/main/res/values/internal_attrs.xml +++ /dev/null @@ -1,54 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - ~ Copyright (C) 2017 The Android Open Source Project - ~ - ~ Licensed under the Apache License, Version 2.0 (the "License"); - ~ you may not use this file except in compliance with the License. - ~ You may obtain a copy of the License at - ~ - ~ http://www.apache.org/licenses/LICENSE-2.0 - ~ - ~ Unless required by applicable law or agreed to in writing, software - ~ distributed under the License is distributed on an "AS IS" BASIS, - ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - ~ See the License for the specific language governing permissions and - ~ limitations under the License. ---> -<resources> - - <attr name="materialThemeOverlay" format="reference" /> - - <declare-styleable name="ThemeEnforcement"> - <!-- Internal flag used to denote that a style uses new attributes defined by - Theme.MaterialComponents, and that the component should check via ThemeEnforcement that the - client's app theme inherits from Theme.MaterialComponents. - - Not all usages of new attributes are problematic in the context of a legacy app theme. You - should only use this flag if a particular usage is known to cause a visual glitch or crash. - For example, tinting a vector drawable with a non-existent theme attribute is known to - crash on pre-21 devices. --> - <attr name="md_enforceMaterialTheme" format="boolean" /> - <!-- Internal flag used to denote that a style requires that the textAppearance attribute is - specified and evaluates to a valid text appearance. --> - <attr name="md_enforceTextAppearance" format="boolean" /> - <!-- Attribute used to check that a component has a TextAppearance specified on it. --> - <attr name="android:textAppearance" /> - </declare-styleable> - - <declare-styleable name="ForegroundLinearLayout"> - <attr name="android:foreground" /> - <attr name="android:foregroundGravity" /> - <attr name="md_foregroundInsidePadding" format="boolean" /> - </declare-styleable> - - <declare-styleable name="ScrimInsetsFrameLayout"> - <attr name="md_insetForeground" format="color|reference" /> - </declare-styleable> - - <declare-styleable name="FlowLayout"> - <!-- Horizontal spacing between two items being laid out. --> - <attr name="md_itemSpacing" format="dimension" /> - <!-- Vertical Spacing between two lines of items being laid out. --> - <attr name="md_lineSpacing" format="dimension" /> - </declare-styleable> - -</resources> diff --git a/ui_spinner/src/main/res/values/internal_dimens.xml b/ui_spinner/src/main/res/values/internal_dimens.xml deleted file mode 100644 index 633cfac3d0a0f37e9d5d1644db679d91a4943ab8..0000000000000000000000000000000000000000 --- a/ui_spinner/src/main/res/values/internal_dimens.xml +++ /dev/null @@ -1,23 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - ~ Copyright (C) 2017 The Android Open Source Project - ~ - ~ Licensed under the Apache License, Version 2.0 (the "License"); - ~ you may not use this file except in compliance with the License. - ~ You may obtain a copy of the License at - ~ - ~ http://www.apache.org/licenses/LICENSE-2.0 - ~ - ~ Unless required by applicable law or agreed to in writing, software - ~ distributed under the License is distributed on an "AS IS" BASIS, - ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - ~ See the License for the specific language governing permissions and - ~ limitations under the License. ---> -<resources> - - <dimen name="md_design_navigation_icon_size">24dp</dimen> - <dimen name="md_design_navigation_icon_padding">32dp</dimen> - <dimen name="md_design_navigation_separator_vertical_padding">8dp</dimen> - <dimen name="md_design_navigation_padding_bottom">8dp</dimen> - -</resources> diff --git a/ui_spinner/src/main/res/values/shape_attrs.xml b/ui_spinner/src/main/res/values/shape_attrs.xml deleted file mode 100644 index a9719a2ad56d631ff7ea4d3e3906fdfd8ee26444..0000000000000000000000000000000000000000 --- a/ui_spinner/src/main/res/values/shape_attrs.xml +++ /dev/null @@ -1,72 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - ~ Copyright 2018 The Android Open Source Project - ~ - ~ Licensed under the Apache License, Version 2.0 (the "License"); - ~ you may not use this file except in compliance with the License. - ~ You may obtain a copy of the License at - ~ - ~ https://www.apache.org/licenses/LICENSE-2.0 - ~ - ~ Unless required by applicable law or agreed to in writing, software - ~ distributed under the License is distributed on an "AS IS" BASIS, - ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - ~ See the License for the specific language governing permissions and - ~ limitations under the License. - --> - -<resources> - - <attr name="md_shapeAppearanceSmallComponent" format="reference" /> - - <attr name="md_shapeAppearanceMediumComponent" format="reference" /> - - <!-- Shape appearance style reference for small components. --> - <attr name="md_shapeAppearanceLargeComponent" format="reference" /> - <!-- Shape appearance style reference for medium components. --> - <declare-styleable name="ShapeAppearance"> - <!-- Corner size to be used in the ShapeAppearance. All corners default to this value --> - <attr name="md_cornerSize" format="dimension" /> - <!-- Top left corner size to be used in the ShapeAppearance. --> - <attr name="md_cornerSizeTopLeft" format="dimension" /> - <!-- Top right corner size to be used in the ShapeAppearance. --> - <attr name="md_cornerSizeTopRight" format="dimension" /> - <!-- Bottom right corner size to be used in the ShapeAppearance. --> - <attr name="md_cornerSizeBottomRight" format="dimension" /> - <!-- Bottom left corner size to be used in the ShapeAppearance. --> - <attr name="md_cornerSizeBottomLeft" format="dimension" /> - - <!-- Corner family to be used in the ShapeAppearance. All corners default to this value --> - <attr name="md_cornerFamily" format="enum"> - <enum name="md_rounded" value="0" /> - <enum name="md_cut" value="1" /> - </attr> - <!-- Top left corner family to be used in the ShapeAppearance. --> - <attr name="md_cornerFamilyTopLeft" format="enum"> - <enum name="md_rounded" value="0" /> - <enum name="md_cut" value="1" /> - </attr> - <!-- Top right corner family to be used in the ShapeAppearance. --> - <attr name="md_cornerFamilyTopRight" format="enum"> - <enum name="md_rounded" value="0" /> - <enum name="md_cut" value="1" /> - </attr> - <!-- Bottom right corner family to be used in the ShapeAppearance. --> - <attr name="md_cornerFamilyBottomRight" format="enum"> - <enum name="md_rounded" value="0" /> - <enum name="md_cut" value="1" /> - </attr> - <!-- Bottom left corner family to be used in the ShapeAppearance. --> - <attr name="md_cornerFamilyBottomLeft" format="enum"> - <enum name="md_rounded" value="0" /> - <enum name="md_cut" value="1" /> - </attr> - </declare-styleable> - <!-- Shape appearance style reference for large components. --> - <declare-styleable name="MaterialShape"> - <!-- Shape appearance style reference to be used to construct a ShapeAppearanceModel. --> - <attr name="md_shapeAppearance" format="reference" /> - <!-- Shape appearance overlay style reference to be used to modify the shapeAppearance. --> - <attr name="md_shapeAppearanceOverlay" format="reference" /> - </declare-styleable> - -</resources> diff --git a/ui_spinner/src/main/res/values/shape_dimens.xml b/ui_spinner/src/main/res/values/shape_dimens.xml deleted file mode 100644 index 94eeefad196c4abbde3626992c46a7507d2d960e..0000000000000000000000000000000000000000 --- a/ui_spinner/src/main/res/values/shape_dimens.xml +++ /dev/null @@ -1,19 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - ~ Copyright 2018 The Android Open Source Project - ~ - ~ Licensed under the Apache License, Version 2.0 (the "License"); - ~ you may not use this file except in compliance with the License. - ~ You may obtain a copy of the License at - ~ - ~ https://www.apache.org/licenses/LICENSE-2.0 - ~ - ~ Unless required by applicable law or agreed to in writing, software - ~ distributed under the License is distributed on an "AS IS" BASIS, - ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - ~ See the License for the specific language governing permissions and - ~ limitations under the License. - --> - -<resources> - -</resources> diff --git a/ui_spinner/src/main/res/values/spinner_attrs.xml b/ui_spinner/src/main/res/values/spinner_attrs.xml deleted file mode 100644 index 481685362800db3c84b1707ffb378525fc612c0d..0000000000000000000000000000000000000000 --- a/ui_spinner/src/main/res/values/spinner_attrs.xml +++ /dev/null @@ -1,90 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - ~ Copyright 2018 The Android Open Source Project - ~ - ~ Licensed under the Apache License, Version 2.0 (the "License"); - ~ you may not use this file except in compliance with the License. - ~ You may obtain a copy of the License at - ~ - ~ https://www.apache.org/licenses/LICENSE-2.0 - ~ - ~ Unless required by applicable law or agreed to in writing, software - ~ distributed under the License is distributed on an "AS IS" BASIS, - ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - ~ See the License for the specific language governing permissions and - ~ limitations under the License. - --> -<resources> - - <!-- Style to use for spinnerLayout in the theme. --> - <attr name="md_materialSpinnerStyle" format="reference" /> - - <declare-styleable name="MaterialSpinnerLayout"> - <!-- The text color for input text. --> - <attr name="android:textColorHint" /> - - <!-- The hint to display in the floating label. --> - <attr name="android:hint" /> - <!-- Whether the layout's floating label functionality is enabled. --> - <attr name="md_hintEnabled" format="boolean" /> - <!-- Whether to animate hint state changes. --> - <attr name="md_hintAnimationEnabled" format="boolean" /> - <!-- TextAppearance of the hint in the collapsed floating label. --> - <attr name="md_hintTextAppearance" format="reference" /> - <!-- Text color of the hint in the collapsed floating label. - If set, this takes precedence over hintTextAppearance. --> - <attr name="md_hintTextColor" format="color" /> - - <!-- The text to display as helper text underneath the text input area. --> - <attr name="md_helperText" format="string" /> - <!-- Whether the layout's helper text functionality is enabled. --> - <attr name="md_helperTextEnabled" format="boolean" /> - <!-- TextAppearance of the helper text displayed underneath the text input area. --> - <attr name="md_helperTextTextAppearance" format="reference" /> - <!-- Text color of the helper text displayed underneath the text input area. - If set, this takes precedence over helperTextTextAppearance. --> - <attr name="md_helperTextTextColor" format="color" /> - - <!-- Whether the layout is laid out as if an error will be displayed. --> - <attr name="md_errorEnabled" format="boolean" /> - <!-- TextAppearance of any error message displayed. --> - <attr name="md_errorTextAppearance" format="reference" /> - <!-- Text color for any error message displayed. - If set, this takes precedence over errorTextAppearance. --> - <attr name="md_errorTextColor" format="color" /> - - <!-- Whether the text input area should be drawn as a filled box, an outline box, or not as a box.--> - <attr name="md_boxBackgroundMode"> - <!-- Specifies that there should be no box set on the text input area. --> - <enum name="md_none" value="0" /> - <!-- Filled box mode for the text input box. --> - <enum name="md_filled" value="1" /> - <!-- Outline box mode for the text input box. --> - <enum name="md_outline" value="2" /> - </attr> - <!-- Value to use for the EditText's collapsed top padding in box mode. --> - <attr name="md_boxCollapsedPaddingTop" format="dimension" /> - <!-- The value to use for the box's top start corner radius when in box mode. --> - <attr name="md_boxCornerRadiusTopStart" format="dimension" /> - <!-- The value to use for the box's top end corner radius when in box mode. --> - <attr name="md_boxCornerRadiusTopEnd" format="dimension" /> - <!-- The value to use for the box's bottom start corner radius when in box mode. --> - <attr name="md_boxCornerRadiusBottomStart" format="dimension" /> - <!-- The value to use for the box's bottom end corner radius when in box mode. --> - <attr name="md_boxCornerRadiusBottomEnd" format="dimension" /> - <!-- The color to use for the box's stroke when in outline box mode. --> - <attr name="md_boxStrokeColor" format="color" /> - <!-- The color to use for the box's background color when in filled box mode. --> - <attr name="md_boxBackgroundColor" format="color" /> - <!-- The value to use for the box's stroke when in outline box mode. --> - <attr name="md_boxStrokeWidth" format="dimension" /> - - <!-- Shape appearance style reference for MaterialSpinnerLayout. Attribute declaration is in the Shape - package. --> - <attr name="md_shapeAppearance" /> - <!-- Shape appearance overlay style reference for MaterialSpinnerLayout. To be used to augment - attributes declared in the shapeAppearance. Attribute declaration is in the Shape - package. --> - <attr name="md_shapeAppearanceOverlay" /> - </declare-styleable> - -</resources> diff --git a/ui_spinner/src/main/res/values/spinner_colors.xml b/ui_spinner/src/main/res/values/spinner_colors.xml deleted file mode 100644 index 9278eb23e096f6e2b85ebb5fb50979c4456250d0..0000000000000000000000000000000000000000 --- a/ui_spinner/src/main/res/values/spinner_colors.xml +++ /dev/null @@ -1,29 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - ~ Copyright 2018 The Android Open Source Project - ~ - ~ Licensed under the Apache License, Version 2.0 (the "License"); - ~ you may not use this file except in compliance with the License. - ~ You may obtain a copy of the License at - ~ - ~ https://www.apache.org/licenses/LICENSE-2.0 - ~ - ~ Unless required by applicable law or agreed to in writing, software - ~ distributed under the License is distributed on an "AS IS" BASIS, - ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - ~ See the License for the specific language governing permissions and - ~ limitations under the License. - --> -<resources> - - <!-- Color for the text field's disabled state: 12% black --> - <color name="md_mtrl_spinner_disabled_color">#1F000000</color> - <!-- Color for the text field's default box stroke: 42% black --> - <color name="md_mtrl_spinner_default_box_stroke_color">#6B000000</color> - <!-- Color for the text field's hovered box stroke: 87% black --> - <color name="md_mtrl_spinner_hovered_box_stroke_color">#DE000000</color> - <!-- Color for the text field's focused box stroke: transparent --> - <color name="md_mtrl_spinner_focused_box_stroke_color">#00000000</color> - <!-- Color for the text field's default box background: 4% black --> - <color name="md_mtrl_spinner_filled_box_default_background_color">#0A000000</color> - -</resources> diff --git a/ui_spinner/src/main/res/values/spinner_dimens.xml b/ui_spinner/src/main/res/values/spinner_dimens.xml deleted file mode 100644 index 3052d9798a42ce0db090c65d8eca3065220e378c..0000000000000000000000000000000000000000 --- a/ui_spinner/src/main/res/values/spinner_dimens.xml +++ /dev/null @@ -1,32 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - ~ Copyright 2018 The Android Open Source Project - ~ - ~ Licensed under the Apache License, Version 2.0 (the "License"); - ~ you may not use this file except in compliance with the License. - ~ You may obtain a copy of the License at - ~ - ~ https://www.apache.org/licenses/LICENSE-2.0 - ~ - ~ Unless required by applicable law or agreed to in writing, software - ~ distributed under the License is distributed on an "AS IS" BASIS, - ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - ~ See the License for the specific language governing permissions and - ~ limitations under the License. - --> -<resources> - <dimen name="md_design_spinner_caption_translate_y">5dp</dimen> - - <dimen name="md_mtrl_spinner_outline_box_expanded_padding">16dp</dimen> - <dimen name="md_mtrl_spinner_box_padding_end">12dp</dimen> - - <dimen name="md_mtrl_spinner_box_corner_radius_small">0dp</dimen> - <dimen name="md_mtrl_spinner_box_corner_radius_medium">4dp</dimen> - <dimen name="md_mtrl_spinner_box_stroke_width_default">1dp</dimen> - <dimen name="md_mtrl_spinner_box_stroke_width_focused">2dp</dimen> - <dimen name="md_mtrl_spinner_box_label_cutout_padding">4dp</dimen> - - <dimen name="md_mtrl_spinner_end_icon_padding_start">16dp</dimen> - <dimen name="md_mtrl_spinner_end_icon_padding_end">12dp</dimen> - <dimen name="md_mtrl_spinner_start_icon_padding_start">12dp</dimen> - <dimen name="md_mtrl_spinner_start_icon_padding_end">16dp</dimen> -</resources> diff --git a/ui_spinner/src/main/res/values/spinner_ids.xml b/ui_spinner/src/main/res/values/spinner_ids.xml deleted file mode 100644 index 53d5dae8a9b087f758b4449c6f91f50a2df9a4b6..0000000000000000000000000000000000000000 --- a/ui_spinner/src/main/res/values/spinner_ids.xml +++ /dev/null @@ -1,23 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - ~ Copyright 2018 The Android Open Source Project - ~ - ~ Licensed under the Apache License, Version 2.0 (the "License"); - ~ you may not use this file except in compliance with the License. - ~ You may obtain a copy of the License at - ~ - ~ https://www.apache.org/licenses/LICENSE-2.0 - ~ - ~ Unless required by applicable law or agreed to in writing, software - ~ distributed under the License is distributed on an "AS IS" BASIS, - ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - ~ See the License for the specific language governing permissions and - ~ limitations under the License. - --> -<resources> - - <item name="md_spinner_error" type="id" /> - <item name="md_spinner_helper_text" type="id" /> - - <item name="md_spinner_background" type="id" /> - -</resources> diff --git a/ui_spinner/src/main/res/values/spinner_styles.xml b/ui_spinner/src/main/res/values/spinner_styles.xml deleted file mode 100644 index 1a5a85094ed046a9b9754e79ed77de2c5d78e3d7..0000000000000000000000000000000000000000 --- a/ui_spinner/src/main/res/values/spinner_styles.xml +++ /dev/null @@ -1,180 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - ~ Copyright 2018 The Android Open Source Project - ~ - ~ Licensed under the Apache License, Version 2.0 (the "License"); - ~ you may not use this file except in compliance with the License. - ~ You may obtain a copy of the License at - ~ - ~ https://www.apache.org/licenses/LICENSE-2.0 - ~ - ~ Unless required by applicable law or agreed to in writing, software - ~ distributed under the License is distributed on an "AS IS" BASIS, - ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - ~ See the License for the specific language governing permissions and - ~ limitations under the License. - --> -<resources xmlns:tools="http://schemas.android.com/tools"> - - <style name="Widget.Design.MaterialSpinnerLayout" parent="android:Widget"> - <item name="materialThemeOverlay">@style/ThemeOverlay.Design.MaterialSpinner</item> - <item name="md_enforceMaterialTheme">false</item> - <item name="md_enforceTextAppearance">false</item> - - <item name="md_boxBackgroundMode">md_none</item> - <item name="md_boxStrokeColor">@color/md_design_box_stroke_color</item> - - <item name="md_errorTextAppearance">@style/TextAppearance.Design.Error</item> - <item name="md_helperTextTextAppearance">@style/TextAppearance.Design.HelperText</item> - <item name="md_hintTextAppearance">@style/TextAppearance.Design.Hint</item> - - <item name="md_errorTextColor">@null</item> - <item name="md_helperTextTextColor">@null</item> - <item name="md_hintTextColor">@null</item> - - <item name="md_shapeAppearance">@null</item> - <item name="md_shapeAppearanceOverlay">@null</item> - </style> - - <!-- Base style for spinnerLayout. You should use one of the sub-styles instead. --> - <style name="Base.Widget.MaterialSpinnerLayout" parent="Widget.Design.MaterialSpinnerLayout"> - <item name="md_enforceMaterialTheme">true</item> - <item name="md_enforceTextAppearance">true</item> - - <item name="md_boxBackgroundMode">md_outline</item> - <item name="md_boxBackgroundColor">@null</item> - <item name="md_boxCollapsedPaddingTop">0dp</item> - <item name="md_boxStrokeColor">@color/md_mtrl_outlined_stroke_color</item> - - <item name="md_errorTextAppearance">?attr/textAppearanceCaption</item> - <item name="md_helperTextTextAppearance">?attr/textAppearanceCaption</item> - <item name="md_hintTextAppearance">?attr/textAppearanceCaption</item> - - <item name="md_errorTextColor">@color/md_mtrl_error</item> - <item name="md_helperTextTextColor">@color/md_mtrl_indicator_text_color</item> - <!-- The color of the label when it is collapsed and the text field is active --> - <item name="md_hintTextColor">?attr/colorPrimary</item> - <!-- The color of the label in all other text field states (such as resting and disabled) --> - <item name="android:textColorHint">@color/md_mtrl_indicator_text_color</item> - - <item name="md_shapeAppearance">?attr/md_shapeAppearanceSmallComponent</item> - <item name="md_shapeAppearanceOverlay">@null</item> - - <item name="md_boxCornerRadiusBottomEnd">@dimen/md_mtrl_spinner_box_corner_radius_medium - </item> - <item name="md_boxCornerRadiusBottomStart">@dimen/md_mtrl_spinner_box_corner_radius_medium - </item> - <item name="md_boxCornerRadiusTopEnd">@dimen/md_mtrl_spinner_box_corner_radius_medium</item> - <item name="md_boxCornerRadiusTopStart">@dimen/md_mtrl_spinner_box_corner_radius_medium</item> - </style> - - <style name="Widget.MaterialSpinnerLayout.FilledBox" parent="Base.Widget.MaterialSpinnerLayout"> - <item name="materialThemeOverlay"> - @style/ThemeOverlay.MaterialSpinner.FilledBox - </item> - <item name="md_boxBackgroundMode">md_filled</item> - <item name="md_boxBackgroundColor">@color/md_mtrl_filled_background_color</item> - <item name="md_boxCollapsedPaddingTop">12dp</item> - <item name="md_boxStrokeColor">@color/md_mtrl_filled_stroke_color</item> - <item name="md_shapeAppearanceOverlay"> - @style/ShapeAppearanceOverlay.MaterialSpinnerLayout.FilledBox - </item> - </style> - - <style name="Widget.MaterialSpinnerLayout.FilledBox.Dense"> - <item name="materialThemeOverlay"> - @style/ThemeOverlay.MaterialSpinner.FilledBox.Dense - </item> - <item name="md_boxCollapsedPaddingTop">8dp</item> - </style> - - <style name="Widget.MaterialSpinnerLayout.OutlinedBox" parent="Base.Widget.MaterialSpinnerLayout"> - <item name="materialThemeOverlay"> - @style/ThemeOverlay.MaterialSpinner.OutlinedBox - </item> - <item name="md_boxCollapsedPaddingTop">0dp</item> - </style> - - <style name="Widget.MaterialSpinnerLayout.OutlinedBox.Dense"> - <item name="materialThemeOverlay"> - @style/ThemeOverlay.MaterialSpinner.OutlinedBox.Dense - </item> - </style> - - <!-- Base style for spinnerEditText. You should use one of the sub-styles instead. --> - <style name="Base.Widget.MaterialSpinner" parent=""> - <item name="android:background">@null</item> - <item name="android:paddingStart" tools:ignore="NewApi">12dp</item> - <item name="android:paddingEnd" tools:ignore="NewApi">12dp</item> - <item name="android:paddingLeft">12dp</item> - <item name="android:paddingRight">12dp</item> - <item name="android:paddingTop">16dp</item> - <item name="android:paddingBottom">16dp</item> - <item name="android:textAppearance">?attr/textAppearanceSubtitle1</item> - </style> - - <style name="Widget.MaterialSpinner.FilledBox" parent="Base.Widget.MaterialSpinner"> - <item name="android:paddingTop">28dp</item> - <item name="android:paddingBottom">12dp</item> - </style> - - <style name="Widget.MaterialSpinner.FilledBox.Dense"> - <item name="android:paddingTop">24dp</item> - <item name="android:paddingBottom">8dp</item> - </style> - - <style name="Widget.MaterialSpinner.OutlinedBox" parent="Base.Widget.MaterialSpinner" /> - - <style name="Widget.MaterialSpinner.OutlinedBox.Dense"> - <item name="android:paddingTop">13dp</item> - <item name="android:paddingBottom">13dp</item> - </style> - - <!-- Set of ThemeOverlays to be used internally in the spinnerLayout styles to automatically apply the correct spinnerEditText style to the spinnerEditText. --> - <style name="ThemeOverlay.Design.MaterialSpinner" parent="" /> - - <style name="ThemeOverlay.MaterialSpinner" parent="ThemeOverlay.Design.MaterialSpinner"> - <item name="colorControlActivated">?attr/colorPrimary</item> - </style> - - <style name="ThemeOverlay.MaterialSpinner.FilledBox"> - <item name="android:spinnerStyle">@style/Widget.MaterialSpinner.FilledBox</item> - <item name="spinnerStyle">@style/Widget.MaterialSpinner.FilledBox</item> - </style> - - <style name="ThemeOverlay.MaterialSpinner.FilledBox.Dense"> - <item name="android:spinnerStyle">@style/Widget.MaterialSpinner.FilledBox.Dense</item> - <item name="spinnerStyle">@style/Widget.MaterialSpinner.FilledBox.Dense</item> - </style> - - <style name="ThemeOverlay.MaterialSpinner.OutlinedBox"> - <item name="android:spinnerStyle">@style/Widget.MaterialSpinner.OutlinedBox</item> - <item name="spinnerStyle">@style/Widget.MaterialSpinner.OutlinedBox</item> - </style> - - <style name="ThemeOverlay.MaterialSpinner.OutlinedBox.Dense"> - <item name="android:spinnerStyle">@style/Widget.MaterialSpinner.OutlinedBox.Dense</item> - <item name="spinnerStyle">@style/Widget.MaterialSpinner.OutlinedBox.Dense</item> - </style> - - <style name="TextAppearance.Design.HelperText" parent="TextAppearance.AppCompat.Caption" /> - - <style name="TextAppearance.Design.Hint" parent="TextAppearance.AppCompat.Caption"> - <item name="android:textColor">?attr/colorControlActivated</item> - </style> - - <style name="TextAppearance.Design.Error" parent="TextAppearance.AppCompat.Caption"> - <item name="android:textColor">@color/md_design_error</item> - </style> - - <style name="TextAppearance.Design.Counter" parent="TextAppearance.AppCompat.Caption" /> - - <style name="TextAppearance.Design.Counter.Overflow" parent="TextAppearance.AppCompat.Caption"> - <item name="android:textColor">@color/md_design_error</item> - </style> - - <style name="ShapeAppearanceOverlay.MaterialSpinnerLayout.FilledBox" parent=""> - <item name="md_cornerSizeBottomLeft">@dimen/md_mtrl_spinner_box_corner_radius_small</item> - <item name="md_cornerSizeBottomRight">@dimen/md_mtrl_spinner_box_corner_radius_small</item> - </style> - -</resources> diff --git a/ui_spinner/src/main/res/values/typography_attrs.xml b/ui_spinner/src/main/res/values/typography_attrs.xml deleted file mode 100644 index d6197b320fb48f073263dbb212198659ceb3ae2c..0000000000000000000000000000000000000000 --- a/ui_spinner/src/main/res/values/typography_attrs.xml +++ /dev/null @@ -1,43 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - ~ Copyright (C) 2018 The Android Open Source Project - ~ - ~ Licensed under the Apache License, Version 2.0 (the "License"); - ~ you may not use this file except in compliance with the License. - ~ You may obtain a copy of the License at - ~ - ~ http://www.apache.org/licenses/LICENSE-2.0 - ~ - ~ Unless required by applicable law or agreed to in writing, software - ~ distributed under the License is distributed on an "AS IS" BASIS, - ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - ~ See the License for the specific language governing permissions and - ~ limitations under the License. ---> -<resources> - <!-- Text appearance for the Headline 1 style. --> - <attr name="textAppearanceHeadline1" format="reference" /> - <!-- Text appearance for the Headline 2 style. --> - <attr name="textAppearanceHeadline2" format="reference" /> - <!-- Text appearance for the Headline 3 style. --> - <attr name="textAppearanceHeadline3" format="reference" /> - <!-- Text appearance for the Headline 4 style. --> - <attr name="textAppearanceHeadline4" format="reference" /> - <!-- Text appearance for the Headline 5 style. --> - <attr name="textAppearanceHeadline5" format="reference" /> - <!-- Text appearance for the Headline 6 style. --> - <attr name="textAppearanceHeadline6" format="reference" /> - <!-- Text appearance for the Subtitle 1 style. --> - <attr name="textAppearanceSubtitle1" format="reference" /> - <!-- Text appearance for the Subtitle 2 style. --> - <attr name="textAppearanceSubtitle2" format="reference" /> - <!-- Text appearance for the Body 1 style. --> - <attr name="textAppearanceBody1" format="reference" /> - <!-- Text appearance for the Body 2 style. --> - <attr name="textAppearanceBody2" format="reference" /> - <!-- Text appearance for the Caption style. --> - <attr name="textAppearanceCaption" format="reference" /> - <!-- Text appearance for the Button style. --> - <attr name="textAppearanceButton" format="reference" /> - <!-- Text appearance for the Overline style. --> - <attr name="textAppearanceOverline" format="reference" /> -</resources> diff --git a/viewmodel/build.gradle.kts b/viewmodel/build.gradle.kts deleted file mode 100644 index 1fe56917c37e2e2b091bc8d4fc50a425cb2d33e5..0000000000000000000000000000000000000000 --- a/viewmodel/build.gradle.kts +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2018 Janne Mareike Koschinski - * Copyright (c) 2018 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -plugins { - id("com.android.library") - kotlin("android") -} - -android { - compileSdkVersion(29) - - defaultConfig { - minSdkVersion(20) - targetSdkVersion(29) - - consumerProguardFiles("proguard-rules.pro") - - // Disable test runner analytics - testInstrumentationRunnerArguments = mapOf( - "disableAnalytics" to "true" - ) - } - - lintOptions { - isWarningsAsErrors = true - setLintConfig(file("../lint.xml")) - } -} - -dependencies { - implementation(kotlin("stdlib", "1.3.72")) - - implementation("androidx.appcompat", "appcompat", "1.1.0") - withVersion("2.2.0") { - implementation("androidx.lifecycle", "lifecycle-extensions", version) - implementation("androidx.lifecycle", "lifecycle-reactivestreams", version) - } - - // Utility - implementation("io.reactivex.rxjava2", "rxandroid", "2.1.1") - implementation("io.reactivex.rxjava2", "rxjava", "2.2.12") - implementation("org.threeten", "threetenbp", "1.4.0", classifier = "no-tzdb") - implementation("org.jetbrains", "annotations", "17.0.0") - - implementation("javax.inject", "javax.inject", "1") - - // Quassel - implementation(project(":persistence")) - implementation(project(":lib")) { - exclude(group = "org.threeten", module = "threetenbp") - } - - testImplementation("junit", "junit", "4.12") -} diff --git a/viewmodel/proguard-rules.pro b/viewmodel/proguard-rules.pro deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/viewmodel/src/main/AndroidManifest.xml b/viewmodel/src/main/AndroidManifest.xml deleted file mode 100644 index 1fbf6cfbb4ab6535d757897a2b148ae054cd3b9c..0000000000000000000000000000000000000000 --- a/viewmodel/src/main/AndroidManifest.xml +++ /dev/null @@ -1,20 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - Quasseldroid - Quassel client for Android - - Copyright (c) 2019 Janne Mareike Koschinski - Copyright (c) 2019 The Quassel Project - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License version 3 as published - by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see <http://www.gnu.org/licenses/>. - --> - -<manifest package="de.kuschku.quasseldroid.viewmodel" /> diff --git a/viewmodel/src/main/java/de/kuschku/quasseldroid/Backend.kt b/viewmodel/src/main/java/de/kuschku/quasseldroid/Backend.kt deleted file mode 100644 index 6fa2d6c0d1e5c95de9997c0719cbec5557dd74b3..0000000000000000000000000000000000000000 --- a/viewmodel/src/main/java/de/kuschku/quasseldroid/Backend.kt +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid - -import de.kuschku.libquassel.connection.SocketAddress -import de.kuschku.libquassel.protocol.BufferId -import de.kuschku.libquassel.session.SessionManager - -interface Backend { - fun autoConnect( - ignoreConnectionState: Boolean = false, - ignoreSetting: Boolean = false, - ignoreErrors: Boolean = false, - connectionInfo: ConnectionInfo? = null - ) - - fun disconnect(forever: Boolean = false) - fun sessionManager(): SessionManager? - fun updateUserDataAndLogin(user: String, pass: String) - fun requestConnectNewNetwork() - - fun setCurrentBuffer(id: BufferId) - - data class ConnectionInfo( - val address: SocketAddress, - val username: String, - val password: String, - val requireSsl: Boolean, - val shouldReconnect: Boolean - ) -} diff --git a/viewmodel/src/main/java/de/kuschku/quasseldroid/util/emoji/EmojiData.kt b/viewmodel/src/main/java/de/kuschku/quasseldroid/util/emoji/EmojiData.kt deleted file mode 100644 index 1af17ba2123a4b31105315cba0f437b2011cf0e3..0000000000000000000000000000000000000000 --- a/viewmodel/src/main/java/de/kuschku/quasseldroid/util/emoji/EmojiData.kt +++ /dev/null @@ -1,1771 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.util.emoji - -import android.os.Build -import android.text.Editable -import de.kuschku.quasseldroid.viewmodel.data.AutoCompleteItem - -object EmojiData { - val rawEmojiMap = mapOf( - "umbrella_with_rain_drops" to "\u2614", - "coffee" to "\u2615", - "aries" to "\u2648", - "taurus" to "\u2649", - "sagittarius" to "\u2650", - "capricorn" to "\u2651", - "aquarius" to "\u2652", - "pisces" to "\u2653", - "anchor" to "\u2693", - "white_check_mark" to "\u2705", - "sparkles" to "\u2728", - "question" to "\u2753", - "grey_question" to "\u2754", - "grey_exclamation" to "\u2755", - "exclamation" to "\u2757", - "heavy_exclamation_mark" to "\u2757", - "heavy_plus_sign" to "\u2795", - "heavy_minus_sign" to "\u2796", - "heavy_division_sign" to "\u2797", - "hash" to "\u0023\uFE0F\u20E3", - "keycap_star" to "\u002A\uFE0F\u20E3", - "zero" to "\u0030\uFE0F\u20E3", - "one" to "\u0031\uFE0F\u20E3", - "two" to "\u0032\uFE0F\u20E3", - "three" to "\u0033\uFE0F\u20E3", - "four" to "\u0034\uFE0F\u20E3", - "five" to "\u0035\uFE0F\u20E3", - "six" to "\u0036\uFE0F\u20E3", - "seven" to "\u0037\uFE0F\u20E3", - "eight" to "\u0038\uFE0F\u20E3", - "nine" to "\u0039\uFE0F\u20E3", - "copyright" to "\u00A9\uFE0F", - "registered" to "\u00AE\uFE0F", - "mahjong" to "\uD83C\uDC04", - "black_joker" to "\uD83C\uDCCF", - "a" to "\uD83C\uDD70\uFE0F", - "b" to "\uD83C\uDD71\uFE0F", - "o2" to "\uD83C\uDD7E\uFE0F", - "parking" to "\uD83C\uDD7F\uFE0F", - "ab" to "\uD83C\uDD8E", - "cl" to "\uD83C\uDD91", - "cool" to "\uD83C\uDD92", - "free" to "\uD83C\uDD93", - "id" to "\uD83C\uDD94", - "new" to "\uD83C\uDD95", - "ng" to "\uD83C\uDD96", - "ok" to "\uD83C\uDD97", - "sos" to "\uD83C\uDD98", - "up" to "\uD83C\uDD99", - "vs" to "\uD83C\uDD9A", - "flag-ac" to "\uD83C\uDDE6\uD83C\uDDE8", - "flag-ad" to "\uD83C\uDDE6\uD83C\uDDE9", - "flag-ae" to "\uD83C\uDDE6\uD83C\uDDEA", - "flag-af" to "\uD83C\uDDE6\uD83C\uDDEB", - "flag-ag" to "\uD83C\uDDE6\uD83C\uDDEC", - "flag-ai" to "\uD83C\uDDE6\uD83C\uDDEE", - "flag-al" to "\uD83C\uDDE6\uD83C\uDDF1", - "flag-am" to "\uD83C\uDDE6\uD83C\uDDF2", - "flag-ao" to "\uD83C\uDDE6\uD83C\uDDF4", - "flag-aq" to "\uD83C\uDDE6\uD83C\uDDF6", - "flag-ar" to "\uD83C\uDDE6\uD83C\uDDF7", - "flag-as" to "\uD83C\uDDE6\uD83C\uDDF8", - "flag-at" to "\uD83C\uDDE6\uD83C\uDDF9", - "flag-au" to "\uD83C\uDDE6\uD83C\uDDFA", - "flag-aw" to "\uD83C\uDDE6\uD83C\uDDFC", - "flag-ax" to "\uD83C\uDDE6\uD83C\uDDFD", - "flag-az" to "\uD83C\uDDE6\uD83C\uDDFF", - "flag-ba" to "\uD83C\uDDE7\uD83C\uDDE6", - "flag-bb" to "\uD83C\uDDE7\uD83C\uDDE7", - "flag-bd" to "\uD83C\uDDE7\uD83C\uDDE9", - "flag-be" to "\uD83C\uDDE7\uD83C\uDDEA", - "flag-bf" to "\uD83C\uDDE7\uD83C\uDDEB", - "flag-bg" to "\uD83C\uDDE7\uD83C\uDDEC", - "flag-bh" to "\uD83C\uDDE7\uD83C\uDDED", - "flag-bi" to "\uD83C\uDDE7\uD83C\uDDEE", - "flag-bj" to "\uD83C\uDDE7\uD83C\uDDEF", - "flag-bl" to "\uD83C\uDDE7\uD83C\uDDF1", - "flag-bm" to "\uD83C\uDDE7\uD83C\uDDF2", - "flag-bn" to "\uD83C\uDDE7\uD83C\uDDF3", - "flag-bo" to "\uD83C\uDDE7\uD83C\uDDF4", - "flag-bq" to "\uD83C\uDDE7\uD83C\uDDF6", - "flag-br" to "\uD83C\uDDE7\uD83C\uDDF7", - "flag-bs" to "\uD83C\uDDE7\uD83C\uDDF8", - "flag-bt" to "\uD83C\uDDE7\uD83C\uDDF9", - "flag-bv" to "\uD83C\uDDE7\uD83C\uDDFB", - "flag-bw" to "\uD83C\uDDE7\uD83C\uDDFC", - "flag-by" to "\uD83C\uDDE7\uD83C\uDDFE", - "flag-bz" to "\uD83C\uDDE7\uD83C\uDDFF", - "flag-ca" to "\uD83C\uDDE8\uD83C\uDDE6", - "flag-cc" to "\uD83C\uDDE8\uD83C\uDDE8", - "flag-cd" to "\uD83C\uDDE8\uD83C\uDDE9", - "flag-cf" to "\uD83C\uDDE8\uD83C\uDDEB", - "flag-cg" to "\uD83C\uDDE8\uD83C\uDDEC", - "flag-ch" to "\uD83C\uDDE8\uD83C\uDDED", - "flag-ci" to "\uD83C\uDDE8\uD83C\uDDEE", - "flag-ck" to "\uD83C\uDDE8\uD83C\uDDF0", - "flag-cl" to "\uD83C\uDDE8\uD83C\uDDF1", - "flag-cm" to "\uD83C\uDDE8\uD83C\uDDF2", - "cn" to "\uD83C\uDDE8\uD83C\uDDF3", - "flag-cn" to "\uD83C\uDDE8\uD83C\uDDF3", - "flag-co" to "\uD83C\uDDE8\uD83C\uDDF4", - "flag-cp" to "\uD83C\uDDE8\uD83C\uDDF5", - "flag-cr" to "\uD83C\uDDE8\uD83C\uDDF7", - "flag-cu" to "\uD83C\uDDE8\uD83C\uDDFA", - "flag-cv" to "\uD83C\uDDE8\uD83C\uDDFB", - "flag-cw" to "\uD83C\uDDE8\uD83C\uDDFC", - "flag-cx" to "\uD83C\uDDE8\uD83C\uDDFD", - "flag-cy" to "\uD83C\uDDE8\uD83C\uDDFE", - "flag-cz" to "\uD83C\uDDE8\uD83C\uDDFF", - "de" to "\uD83C\uDDE9\uD83C\uDDEA", - "flag-de" to "\uD83C\uDDE9\uD83C\uDDEA", - "flag-dg" to "\uD83C\uDDE9\uD83C\uDDEC", - "flag-dj" to "\uD83C\uDDE9\uD83C\uDDEF", - "flag-dk" to "\uD83C\uDDE9\uD83C\uDDF0", - "flag-dm" to "\uD83C\uDDE9\uD83C\uDDF2", - "flag-do" to "\uD83C\uDDE9\uD83C\uDDF4", - "flag-dz" to "\uD83C\uDDE9\uD83C\uDDFF", - "flag-ea" to "\uD83C\uDDEA\uD83C\uDDE6", - "flag-ec" to "\uD83C\uDDEA\uD83C\uDDE8", - "flag-ee" to "\uD83C\uDDEA\uD83C\uDDEA", - "flag-eg" to "\uD83C\uDDEA\uD83C\uDDEC", - "flag-eh" to "\uD83C\uDDEA\uD83C\uDDED", - "flag-er" to "\uD83C\uDDEA\uD83C\uDDF7", - "es" to "\uD83C\uDDEA\uD83C\uDDF8", - "flag-es" to "\uD83C\uDDEA\uD83C\uDDF8", - "flag-et" to "\uD83C\uDDEA\uD83C\uDDF9", - "flag-eu" to "\uD83C\uDDEA\uD83C\uDDFA", - "flag-fi" to "\uD83C\uDDEB\uD83C\uDDEE", - "flag-fj" to "\uD83C\uDDEB\uD83C\uDDEF", - "flag-fk" to "\uD83C\uDDEB\uD83C\uDDF0", - "flag-fm" to "\uD83C\uDDEB\uD83C\uDDF2", - "flag-fo" to "\uD83C\uDDEB\uD83C\uDDF4", - "fr" to "\uD83C\uDDEB\uD83C\uDDF7", - "flag-fr" to "\uD83C\uDDEB\uD83C\uDDF7", - "flag-ga" to "\uD83C\uDDEC\uD83C\uDDE6", - "gb" to "\uD83C\uDDEC\uD83C\uDDE7", - "uk" to "\uD83C\uDDEC\uD83C\uDDE7", - "flag-gb" to "\uD83C\uDDEC\uD83C\uDDE7", - "flag-gd" to "\uD83C\uDDEC\uD83C\uDDE9", - "flag-ge" to "\uD83C\uDDEC\uD83C\uDDEA", - "flag-gf" to "\uD83C\uDDEC\uD83C\uDDEB", - "flag-gg" to "\uD83C\uDDEC\uD83C\uDDEC", - "flag-gh" to "\uD83C\uDDEC\uD83C\uDDED", - "flag-gi" to "\uD83C\uDDEC\uD83C\uDDEE", - "flag-gl" to "\uD83C\uDDEC\uD83C\uDDF1", - "flag-gm" to "\uD83C\uDDEC\uD83C\uDDF2", - "flag-gn" to "\uD83C\uDDEC\uD83C\uDDF3", - "flag-gp" to "\uD83C\uDDEC\uD83C\uDDF5", - "flag-gq" to "\uD83C\uDDEC\uD83C\uDDF6", - "flag-gr" to "\uD83C\uDDEC\uD83C\uDDF7", - "flag-gs" to "\uD83C\uDDEC\uD83C\uDDF8", - "flag-gt" to "\uD83C\uDDEC\uD83C\uDDF9", - "flag-gu" to "\uD83C\uDDEC\uD83C\uDDFA", - "flag-gw" to "\uD83C\uDDEC\uD83C\uDDFC", - "flag-gy" to "\uD83C\uDDEC\uD83C\uDDFE", - "flag-hk" to "\uD83C\uDDED\uD83C\uDDF0", - "flag-hm" to "\uD83C\uDDED\uD83C\uDDF2", - "flag-hn" to "\uD83C\uDDED\uD83C\uDDF3", - "flag-hr" to "\uD83C\uDDED\uD83C\uDDF7", - "flag-ht" to "\uD83C\uDDED\uD83C\uDDF9", - "flag-hu" to "\uD83C\uDDED\uD83C\uDDFA", - "flag-ic" to "\uD83C\uDDEE\uD83C\uDDE8", - "flag-id" to "\uD83C\uDDEE\uD83C\uDDE9", - "flag-ie" to "\uD83C\uDDEE\uD83C\uDDEA", - "flag-il" to "\uD83C\uDDEE\uD83C\uDDF1", - "flag-im" to "\uD83C\uDDEE\uD83C\uDDF2", - "flag-in" to "\uD83C\uDDEE\uD83C\uDDF3", - "flag-io" to "\uD83C\uDDEE\uD83C\uDDF4", - "flag-iq" to "\uD83C\uDDEE\uD83C\uDDF6", - "flag-ir" to "\uD83C\uDDEE\uD83C\uDDF7", - "flag-is" to "\uD83C\uDDEE\uD83C\uDDF8", - "it" to "\uD83C\uDDEE\uD83C\uDDF9", - "flag-it" to "\uD83C\uDDEE\uD83C\uDDF9", - "flag-je" to "\uD83C\uDDEF\uD83C\uDDEA", - "flag-jm" to "\uD83C\uDDEF\uD83C\uDDF2", - "flag-jo" to "\uD83C\uDDEF\uD83C\uDDF4", - "jp" to "\uD83C\uDDEF\uD83C\uDDF5", - "flag-jp" to "\uD83C\uDDEF\uD83C\uDDF5", - "flag-ke" to "\uD83C\uDDF0\uD83C\uDDEA", - "flag-kg" to "\uD83C\uDDF0\uD83C\uDDEC", - "flag-kh" to "\uD83C\uDDF0\uD83C\uDDED", - "flag-ki" to "\uD83C\uDDF0\uD83C\uDDEE", - "flag-km" to "\uD83C\uDDF0\uD83C\uDDF2", - "flag-kn" to "\uD83C\uDDF0\uD83C\uDDF3", - "flag-kp" to "\uD83C\uDDF0\uD83C\uDDF5", - "kr" to "\uD83C\uDDF0\uD83C\uDDF7", - "flag-kr" to "\uD83C\uDDF0\uD83C\uDDF7", - "flag-kw" to "\uD83C\uDDF0\uD83C\uDDFC", - "flag-ky" to "\uD83C\uDDF0\uD83C\uDDFE", - "flag-kz" to "\uD83C\uDDF0\uD83C\uDDFF", - "flag-la" to "\uD83C\uDDF1\uD83C\uDDE6", - "flag-lb" to "\uD83C\uDDF1\uD83C\uDDE7", - "flag-lc" to "\uD83C\uDDF1\uD83C\uDDE8", - "flag-li" to "\uD83C\uDDF1\uD83C\uDDEE", - "flag-lk" to "\uD83C\uDDF1\uD83C\uDDF0", - "flag-lr" to "\uD83C\uDDF1\uD83C\uDDF7", - "flag-ls" to "\uD83C\uDDF1\uD83C\uDDF8", - "flag-lt" to "\uD83C\uDDF1\uD83C\uDDF9", - "flag-lu" to "\uD83C\uDDF1\uD83C\uDDFA", - "flag-lv" to "\uD83C\uDDF1\uD83C\uDDFB", - "flag-ly" to "\uD83C\uDDF1\uD83C\uDDFE", - "flag-ma" to "\uD83C\uDDF2\uD83C\uDDE6", - "flag-mc" to "\uD83C\uDDF2\uD83C\uDDE8", - "flag-md" to "\uD83C\uDDF2\uD83C\uDDE9", - "flag-me" to "\uD83C\uDDF2\uD83C\uDDEA", - "flag-mf" to "\uD83C\uDDF2\uD83C\uDDEB", - "flag-mg" to "\uD83C\uDDF2\uD83C\uDDEC", - "flag-mh" to "\uD83C\uDDF2\uD83C\uDDED", - "flag-mk" to "\uD83C\uDDF2\uD83C\uDDF0", - "flag-ml" to "\uD83C\uDDF2\uD83C\uDDF1", - "flag-mm" to "\uD83C\uDDF2\uD83C\uDDF2", - "flag-mn" to "\uD83C\uDDF2\uD83C\uDDF3", - "flag-mo" to "\uD83C\uDDF2\uD83C\uDDF4", - "flag-mp" to "\uD83C\uDDF2\uD83C\uDDF5", - "flag-mq" to "\uD83C\uDDF2\uD83C\uDDF6", - "flag-mr" to "\uD83C\uDDF2\uD83C\uDDF7", - "flag-ms" to "\uD83C\uDDF2\uD83C\uDDF8", - "flag-mt" to "\uD83C\uDDF2\uD83C\uDDF9", - "flag-mu" to "\uD83C\uDDF2\uD83C\uDDFA", - "flag-mv" to "\uD83C\uDDF2\uD83C\uDDFB", - "flag-mw" to "\uD83C\uDDF2\uD83C\uDDFC", - "flag-mx" to "\uD83C\uDDF2\uD83C\uDDFD", - "flag-my" to "\uD83C\uDDF2\uD83C\uDDFE", - "flag-mz" to "\uD83C\uDDF2\uD83C\uDDFF", - "flag-na" to "\uD83C\uDDF3\uD83C\uDDE6", - "flag-nc" to "\uD83C\uDDF3\uD83C\uDDE8", - "flag-ne" to "\uD83C\uDDF3\uD83C\uDDEA", - "flag-nf" to "\uD83C\uDDF3\uD83C\uDDEB", - "flag-ng" to "\uD83C\uDDF3\uD83C\uDDEC", - "flag-ni" to "\uD83C\uDDF3\uD83C\uDDEE", - "flag-nl" to "\uD83C\uDDF3\uD83C\uDDF1", - "flag-no" to "\uD83C\uDDF3\uD83C\uDDF4", - "flag-np" to "\uD83C\uDDF3\uD83C\uDDF5", - "flag-nr" to "\uD83C\uDDF3\uD83C\uDDF7", - "flag-nu" to "\uD83C\uDDF3\uD83C\uDDFA", - "flag-nz" to "\uD83C\uDDF3\uD83C\uDDFF", - "flag-om" to "\uD83C\uDDF4\uD83C\uDDF2", - "flag-pa" to "\uD83C\uDDF5\uD83C\uDDE6", - "flag-pe" to "\uD83C\uDDF5\uD83C\uDDEA", - "flag-pf" to "\uD83C\uDDF5\uD83C\uDDEB", - "flag-pg" to "\uD83C\uDDF5\uD83C\uDDEC", - "flag-ph" to "\uD83C\uDDF5\uD83C\uDDED", - "flag-pk" to "\uD83C\uDDF5\uD83C\uDDF0", - "flag-pl" to "\uD83C\uDDF5\uD83C\uDDF1", - "flag-pm" to "\uD83C\uDDF5\uD83C\uDDF2", - "flag-pn" to "\uD83C\uDDF5\uD83C\uDDF3", - "flag-pr" to "\uD83C\uDDF5\uD83C\uDDF7", - "flag-ps" to "\uD83C\uDDF5\uD83C\uDDF8", - "flag-pt" to "\uD83C\uDDF5\uD83C\uDDF9", - "flag-pw" to "\uD83C\uDDF5\uD83C\uDDFC", - "flag-py" to "\uD83C\uDDF5\uD83C\uDDFE", - "flag-qa" to "\uD83C\uDDF6\uD83C\uDDE6", - "flag-re" to "\uD83C\uDDF7\uD83C\uDDEA", - "flag-ro" to "\uD83C\uDDF7\uD83C\uDDF4", - "flag-rs" to "\uD83C\uDDF7\uD83C\uDDF8", - "ru" to "\uD83C\uDDF7\uD83C\uDDFA", - "flag-ru" to "\uD83C\uDDF7\uD83C\uDDFA", - "flag-rw" to "\uD83C\uDDF7\uD83C\uDDFC", - "flag-sa" to "\uD83C\uDDF8\uD83C\uDDE6", - "flag-sb" to "\uD83C\uDDF8\uD83C\uDDE7", - "flag-sc" to "\uD83C\uDDF8\uD83C\uDDE8", - "flag-sd" to "\uD83C\uDDF8\uD83C\uDDE9", - "flag-se" to "\uD83C\uDDF8\uD83C\uDDEA", - "flag-sg" to "\uD83C\uDDF8\uD83C\uDDEC", - "flag-sh" to "\uD83C\uDDF8\uD83C\uDDED", - "flag-si" to "\uD83C\uDDF8\uD83C\uDDEE", - "flag-sj" to "\uD83C\uDDF8\uD83C\uDDEF", - "flag-sk" to "\uD83C\uDDF8\uD83C\uDDF0", - "flag-sl" to "\uD83C\uDDF8\uD83C\uDDF1", - "flag-sm" to "\uD83C\uDDF8\uD83C\uDDF2", - "flag-sn" to "\uD83C\uDDF8\uD83C\uDDF3", - "flag-so" to "\uD83C\uDDF8\uD83C\uDDF4", - "flag-sr" to "\uD83C\uDDF8\uD83C\uDDF7", - "flag-ss" to "\uD83C\uDDF8\uD83C\uDDF8", - "flag-st" to "\uD83C\uDDF8\uD83C\uDDF9", - "flag-sv" to "\uD83C\uDDF8\uD83C\uDDFB", - "flag-sx" to "\uD83C\uDDF8\uD83C\uDDFD", - "flag-sy" to "\uD83C\uDDF8\uD83C\uDDFE", - "flag-sz" to "\uD83C\uDDF8\uD83C\uDDFF", - "flag-ta" to "\uD83C\uDDF9\uD83C\uDDE6", - "flag-tc" to "\uD83C\uDDF9\uD83C\uDDE8", - "flag-td" to "\uD83C\uDDF9\uD83C\uDDE9", - "flag-tf" to "\uD83C\uDDF9\uD83C\uDDEB", - "flag-tg" to "\uD83C\uDDF9\uD83C\uDDEC", - "flag-th" to "\uD83C\uDDF9\uD83C\uDDED", - "flag-tj" to "\uD83C\uDDF9\uD83C\uDDEF", - "flag-tk" to "\uD83C\uDDF9\uD83C\uDDF0", - "flag-tl" to "\uD83C\uDDF9\uD83C\uDDF1", - "flag-tm" to "\uD83C\uDDF9\uD83C\uDDF2", - "flag-tn" to "\uD83C\uDDF9\uD83C\uDDF3", - "flag-to" to "\uD83C\uDDF9\uD83C\uDDF4", - "flag-tr" to "\uD83C\uDDF9\uD83C\uDDF7", - "flag-tt" to "\uD83C\uDDF9\uD83C\uDDF9", - "flag-tv" to "\uD83C\uDDF9\uD83C\uDDFB", - "flag-tw" to "\uD83C\uDDF9\uD83C\uDDFC", - "flag-tz" to "\uD83C\uDDF9\uD83C\uDDFF", - "flag-ua" to "\uD83C\uDDFA\uD83C\uDDE6", - "flag-ug" to "\uD83C\uDDFA\uD83C\uDDEC", - "flag-um" to "\uD83C\uDDFA\uD83C\uDDF2", - "flag-un" to "\uD83C\uDDFA\uD83C\uDDF3", - "us" to "\uD83C\uDDFA\uD83C\uDDF8", - "flag-us" to "\uD83C\uDDFA\uD83C\uDDF8", - "flag-uy" to "\uD83C\uDDFA\uD83C\uDDFE", - "flag-uz" to "\uD83C\uDDFA\uD83C\uDDFF", - "flag-va" to "\uD83C\uDDFB\uD83C\uDDE6", - "flag-vc" to "\uD83C\uDDFB\uD83C\uDDE8", - "flag-ve" to "\uD83C\uDDFB\uD83C\uDDEA", - "flag-vg" to "\uD83C\uDDFB\uD83C\uDDEC", - "flag-vi" to "\uD83C\uDDFB\uD83C\uDDEE", - "flag-vn" to "\uD83C\uDDFB\uD83C\uDDF3", - "flag-vu" to "\uD83C\uDDFB\uD83C\uDDFA", - "flag-wf" to "\uD83C\uDDFC\uD83C\uDDEB", - "flag-ws" to "\uD83C\uDDFC\uD83C\uDDF8", - "flag-xk" to "\uD83C\uDDFD\uD83C\uDDF0", - "flag-ye" to "\uD83C\uDDFE\uD83C\uDDEA", - "flag-yt" to "\uD83C\uDDFE\uD83C\uDDF9", - "flag-za" to "\uD83C\uDDFF\uD83C\uDDE6", - "flag-zm" to "\uD83C\uDDFF\uD83C\uDDF2", - "flag-zw" to "\uD83C\uDDFF\uD83C\uDDFC", - "koko" to "\uD83C\uDE01", - "sa" to "\uD83C\uDE02\uFE0F", - "u7121" to "\uD83C\uDE1A", - "u6307" to "\uD83C\uDE2F", - "u7981" to "\uD83C\uDE32", - "u7a7a" to "\uD83C\uDE33", - "u5408" to "\uD83C\uDE34", - "u6e80" to "\uD83C\uDE35", - "u6709" to "\uD83C\uDE36", - "u6708" to "\uD83C\uDE37\uFE0F", - "u7533" to "\uD83C\uDE38", - "u5272" to "\uD83C\uDE39", - "u55b6" to "\uD83C\uDE3A", - "ideograph_advantage" to "\uD83C\uDE50", - "accept" to "\uD83C\uDE51", - "cyclone" to "\uD83C\uDF00", - "foggy" to "\uD83C\uDF01", - "closed_umbrella" to "\uD83C\uDF02", - "night_with_stars" to "\uD83C\uDF03", - "sunrise_over_mountains" to "\uD83C\uDF04", - "sunrise" to "\uD83C\uDF05", - "city_sunset" to "\uD83C\uDF06", - "city_sunrise" to "\uD83C\uDF07", - "rainbow" to "\uD83C\uDF08", - "bridge_at_night" to "\uD83C\uDF09", - "ocean" to "\uD83C\uDF0A", - "volcano" to "\uD83C\uDF0B", - "milky_way" to "\uD83C\uDF0C", - "earth_africa" to "\uD83C\uDF0D", - "earth_americas" to "\uD83C\uDF0E", - "earth_asia" to "\uD83C\uDF0F", - "globe_with_meridians" to "\uD83C\uDF10", - "new_moon" to "\uD83C\uDF11", - "waxing_crescent_moon" to "\uD83C\uDF12", - "first_quarter_moon" to "\uD83C\uDF13", - "moon" to "\uD83C\uDF14", - "waxing_gibbous_moon" to "\uD83C\uDF14", - "full_moon" to "\uD83C\uDF15", - "waning_gibbous_moon" to "\uD83C\uDF16", - "last_quarter_moon" to "\uD83C\uDF17", - "waning_crescent_moon" to "\uD83C\uDF18", - "crescent_moon" to "\uD83C\uDF19", - "new_moon_with_face" to "\uD83C\uDF1A", - "first_quarter_moon_with_face" to "\uD83C\uDF1B", - "last_quarter_moon_with_face" to "\uD83C\uDF1C", - "full_moon_with_face" to "\uD83C\uDF1D", - "sun_with_face" to "\uD83C\uDF1E", - "star2" to "\uD83C\uDF1F", - "stars" to "\uD83C\uDF20", - "thermometer" to "\uD83C\uDF21\uFE0F", - "mostly_sunny" to "\uD83C\uDF24\uFE0F", - "sun_small_cloud" to "\uD83C\uDF24\uFE0F", - "barely_sunny" to "\uD83C\uDF25\uFE0F", - "sun_behind_cloud" to "\uD83C\uDF25\uFE0F", - "partly_sunny_rain" to "\uD83C\uDF26\uFE0F", - "sun_behind_rain_cloud" to "\uD83C\uDF26\uFE0F", - "rain_cloud" to "\uD83C\uDF27\uFE0F", - "snow_cloud" to "\uD83C\uDF28\uFE0F", - "lightning" to "\uD83C\uDF29\uFE0F", - "lightning_cloud" to "\uD83C\uDF29\uFE0F", - "tornado" to "\uD83C\uDF2A\uFE0F", - "tornado_cloud" to "\uD83C\uDF2A\uFE0F", - "fog" to "\uD83C\uDF2B\uFE0F", - "wind_blowing_face" to "\uD83C\uDF2C\uFE0F", - "hotdog" to "\uD83C\uDF2D", - "taco" to "\uD83C\uDF2E", - "burrito" to "\uD83C\uDF2F", - "chestnut" to "\uD83C\uDF30", - "seedling" to "\uD83C\uDF31", - "evergreen_tree" to "\uD83C\uDF32", - "deciduous_tree" to "\uD83C\uDF33", - "palm_tree" to "\uD83C\uDF34", - "cactus" to "\uD83C\uDF35", - "hot_pepper" to "\uD83C\uDF36\uFE0F", - "tulip" to "\uD83C\uDF37", - "cherry_blossom" to "\uD83C\uDF38", - "rose" to "\uD83C\uDF39", - "hibiscus" to "\uD83C\uDF3A", - "sunflower" to "\uD83C\uDF3B", - "blossom" to "\uD83C\uDF3C", - "corn" to "\uD83C\uDF3D", - "ear_of_rice" to "\uD83C\uDF3E", - "herb" to "\uD83C\uDF3F", - "four_leaf_clover" to "\uD83C\uDF40", - "maple_leaf" to "\uD83C\uDF41", - "fallen_leaf" to "\uD83C\uDF42", - "leaves" to "\uD83C\uDF43", - "mushroom" to "\uD83C\uDF44", - "tomato" to "\uD83C\uDF45", - "eggplant" to "\uD83C\uDF46", - "grapes" to "\uD83C\uDF47", - "melon" to "\uD83C\uDF48", - "watermelon" to "\uD83C\uDF49", - "tangerine" to "\uD83C\uDF4A", - "lemon" to "\uD83C\uDF4B", - "banana" to "\uD83C\uDF4C", - "pineapple" to "\uD83C\uDF4D", - "apple" to "\uD83C\uDF4E", - "green_apple" to "\uD83C\uDF4F", - "pear" to "\uD83C\uDF50", - "peach" to "\uD83C\uDF51", - "cherries" to "\uD83C\uDF52", - "strawberry" to "\uD83C\uDF53", - "hamburger" to "\uD83C\uDF54", - "pizza" to "\uD83C\uDF55", - "meat_on_bone" to "\uD83C\uDF56", - "poultry_leg" to "\uD83C\uDF57", - "rice_cracker" to "\uD83C\uDF58", - "rice_ball" to "\uD83C\uDF59", - "rice" to "\uD83C\uDF5A", - "curry" to "\uD83C\uDF5B", - "ramen" to "\uD83C\uDF5C", - "spaghetti" to "\uD83C\uDF5D", - "bread" to "\uD83C\uDF5E", - "fries" to "\uD83C\uDF5F", - "sweet_potato" to "\uD83C\uDF60", - "dango" to "\uD83C\uDF61", - "oden" to "\uD83C\uDF62", - "sushi" to "\uD83C\uDF63", - "fried_shrimp" to "\uD83C\uDF64", - "fish_cake" to "\uD83C\uDF65", - "icecream" to "\uD83C\uDF66", - "shaved_ice" to "\uD83C\uDF67", - "ice_cream" to "\uD83C\uDF68", - "doughnut" to "\uD83C\uDF69", - "cookie" to "\uD83C\uDF6A", - "chocolate_bar" to "\uD83C\uDF6B", - "candy" to "\uD83C\uDF6C", - "lollipop" to "\uD83C\uDF6D", - "custard" to "\uD83C\uDF6E", - "honey_pot" to "\uD83C\uDF6F", - "cake" to "\uD83C\uDF70", - "bento" to "\uD83C\uDF71", - "stew" to "\uD83C\uDF72", - "fried_egg" to "\uD83C\uDF73", - "cooking" to "\uD83C\uDF73", - "fork_and_knife" to "\uD83C\uDF74", - "tea" to "\uD83C\uDF75", - "sake" to "\uD83C\uDF76", - "wine_glass" to "\uD83C\uDF77", - "cocktail" to "\uD83C\uDF78", - "tropical_drink" to "\uD83C\uDF79", - "beer" to "\uD83C\uDF7A", - "beers" to "\uD83C\uDF7B", - "baby_bottle" to "\uD83C\uDF7C", - "knife_fork_plate" to "\uD83C\uDF7D\uFE0F", - "champagne" to "\uD83C\uDF7E", - "popcorn" to "\uD83C\uDF7F", - "ribbon" to "\uD83C\uDF80", - "gift" to "\uD83C\uDF81", - "birthday" to "\uD83C\uDF82", - "jack_o_lantern" to "\uD83C\uDF83", - "christmas_tree" to "\uD83C\uDF84", - "santa" to "\uD83C\uDF85", - "fireworks" to "\uD83C\uDF86", - "sparkler" to "\uD83C\uDF87", - "balloon" to "\uD83C\uDF88", - "tada" to "\uD83C\uDF89", - "confetti_ball" to "\uD83C\uDF8A", - "tanabata_tree" to "\uD83C\uDF8B", - "crossed_flags" to "\uD83C\uDF8C", - "bamboo" to "\uD83C\uDF8D", - "dolls" to "\uD83C\uDF8E", - "flags" to "\uD83C\uDF8F", - "wind_chime" to "\uD83C\uDF90", - "rice_scene" to "\uD83C\uDF91", - "school_satchel" to "\uD83C\uDF92", - "mortar_board" to "\uD83C\uDF93", - "medal" to "\uD83C\uDF96\uFE0F", - "reminder_ribbon" to "\uD83C\uDF97\uFE0F", - "studio_microphone" to "\uD83C\uDF99\uFE0F", - "level_slider" to "\uD83C\uDF9A\uFE0F", - "control_knobs" to "\uD83C\uDF9B\uFE0F", - "film_frames" to "\uD83C\uDF9E\uFE0F", - "admission_tickets" to "\uD83C\uDF9F\uFE0F", - "carousel_horse" to "\uD83C\uDFA0", - "ferris_wheel" to "\uD83C\uDFA1", - "roller_coaster" to "\uD83C\uDFA2", - "fishing_pole_and_fish" to "\uD83C\uDFA3", - "microphone" to "\uD83C\uDFA4", - "movie_camera" to "\uD83C\uDFA5", - "cinema" to "\uD83C\uDFA6", - "headphones" to "\uD83C\uDFA7", - "art" to "\uD83C\uDFA8", - "tophat" to "\uD83C\uDFA9", - "circus_tent" to "\uD83C\uDFAA", - "ticket" to "\uD83C\uDFAB", - "clapper" to "\uD83C\uDFAC", - "performing_arts" to "\uD83C\uDFAD", - "video_game" to "\uD83C\uDFAE", - "dart" to "\uD83C\uDFAF", - "slot_machine" to "\uD83C\uDFB0", - "8ball" to "\uD83C\uDFB1", - "game_die" to "\uD83C\uDFB2", - "bowling" to "\uD83C\uDFB3", - "flower_playing_cards" to "\uD83C\uDFB4", - "musical_note" to "\uD83C\uDFB5", - "notes" to "\uD83C\uDFB6", - "saxophone" to "\uD83C\uDFB7", - "guitar" to "\uD83C\uDFB8", - "musical_keyboard" to "\uD83C\uDFB9", - "trumpet" to "\uD83C\uDFBA", - "violin" to "\uD83C\uDFBB", - "musical_score" to "\uD83C\uDFBC", - "running_shirt_with_sash" to "\uD83C\uDFBD", - "tennis" to "\uD83C\uDFBE", - "ski" to "\uD83C\uDFBF", - "basketball" to "\uD83C\uDFC0", - "checkered_flag" to "\uD83C\uDFC1", - "snowboarder" to "\uD83C\uDFC2", - "woman-running" to "\uD83C\uDFC3\u200D\u2640\uFE0F", - "man-running" to "\uD83C\uDFC3\u200D\u2642\uFE0F", - "runner" to "\uD83C\uDFC3\u200D\u2642\uFE0F", - "running" to "\uD83C\uDFC3\u200D\u2642\uFE0F", - "woman-surfing" to "\uD83C\uDFC4\u200D\u2640\uFE0F", - "man-surfing" to "\uD83C\uDFC4\u200D\u2642\uFE0F", - "surfer" to "\uD83C\uDFC4\u200D\u2642\uFE0F", - "sports_medal" to "\uD83C\uDFC5", - "trophy" to "\uD83C\uDFC6", - "horse_racing" to "\uD83C\uDFC7", - "football" to "\uD83C\uDFC8", - "rugby_football" to "\uD83C\uDFC9", - "woman-swimming" to "\uD83C\uDFCA\u200D\u2640\uFE0F", - "man-swimming" to "\uD83C\uDFCA\u200D\u2642\uFE0F", - "swimmer" to "\uD83C\uDFCA\u200D\u2642\uFE0F", - "woman-lifting-weights" to "\uD83C\uDFCB\uFE0F\u200D\u2640\uFE0F", - "man-lifting-weights" to "\uD83C\uDFCB\uFE0F\u200D\u2642\uFE0F", - "weight_lifter" to "\uD83C\uDFCB\uFE0F\u200D\u2642\uFE0F", - "woman-golfing" to "\uD83C\uDFCC\uFE0F\u200D\u2640\uFE0F", - "man-golfing" to "\uD83C\uDFCC\uFE0F\u200D\u2642\uFE0F", - "golfer" to "\uD83C\uDFCC\uFE0F\u200D\u2642\uFE0F", - "racing_motorcycle" to "\uD83C\uDFCD\uFE0F", - "racing_car" to "\uD83C\uDFCE\uFE0F", - "cricket_bat_and_ball" to "\uD83C\uDFCF", - "volleyball" to "\uD83C\uDFD0", - "field_hockey_stick_and_ball" to "\uD83C\uDFD1", - "ice_hockey_stick_and_puck" to "\uD83C\uDFD2", - "table_tennis_paddle_and_ball" to "\uD83C\uDFD3", - "snow_capped_mountain" to "\uD83C\uDFD4\uFE0F", - "camping" to "\uD83C\uDFD5\uFE0F", - "beach_with_umbrella" to "\uD83C\uDFD6\uFE0F", - "building_construction" to "\uD83C\uDFD7\uFE0F", - "house_buildings" to "\uD83C\uDFD8\uFE0F", - "cityscape" to "\uD83C\uDFD9\uFE0F", - "derelict_house_building" to "\uD83C\uDFDA\uFE0F", - "classical_building" to "\uD83C\uDFDB\uFE0F", - "desert" to "\uD83C\uDFDC\uFE0F", - "desert_island" to "\uD83C\uDFDD\uFE0F", - "national_park" to "\uD83C\uDFDE\uFE0F", - "stadium" to "\uD83C\uDFDF\uFE0F", - "house" to "\uD83C\uDFE0", - "house_with_garden" to "\uD83C\uDFE1", - "office" to "\uD83C\uDFE2", - "post_office" to "\uD83C\uDFE3", - "european_post_office" to "\uD83C\uDFE4", - "hospital" to "\uD83C\uDFE5", - "bank" to "\uD83C\uDFE6", - "atm" to "\uD83C\uDFE7", - "hotel" to "\uD83C\uDFE8", - "love_hotel" to "\uD83C\uDFE9", - "convenience_store" to "\uD83C\uDFEA", - "school" to "\uD83C\uDFEB", - "department_store" to "\uD83C\uDFEC", - "factory" to "\uD83C\uDFED", - "izakaya_lantern" to "\uD83C\uDFEE", - "lantern" to "\uD83C\uDFEE", - "japanese_castle" to "\uD83C\uDFEF", - "european_castle" to "\uD83C\uDFF0", - "rainbow-flag" to "\uD83C\uDFF3\uFE0F\u200D\uD83C\uDF08", - "waving_white_flag" to "\uD83C\uDFF3\uFE0F", - "flag-england" to "\uD83C\uDFF4\uDB40\uDC67\uDB40\uDC62\uDB40\uDC65\uDB40\uDC6E\uDB40\uDC67\uDB40\uDC7F", - "flag-scotland" to "\uD83C\uDFF4\uDB40\uDC67\uDB40\uDC62\uDB40\uDC73\uDB40\uDC63\uDB40\uDC74\uDB40\uDC7F", - "flag-wales" to "\uD83C\uDFF4\uDB40\uDC67\uDB40\uDC62\uDB40\uDC77\uDB40\uDC6C\uDB40\uDC73\uDB40\uDC7F", - "waving_black_flag" to "\uD83C\uDFF4", - "rosette" to "\uD83C\uDFF5\uFE0F", - "label" to "\uD83C\uDFF7\uFE0F", - "badminton_racquet_and_shuttlecock" to "\uD83C\uDFF8", - "bow_and_arrow" to "\uD83C\uDFF9", - "amphora" to "\uD83C\uDFFA", - "skin-tone-2" to "\uD83C\uDFFB", - "skin-tone-3" to "\uD83C\uDFFC", - "skin-tone-4" to "\uD83C\uDFFD", - "skin-tone-5" to "\uD83C\uDFFE", - "skin-tone-6" to "\uD83C\uDFFF", - "rat" to "\uD83D\uDC00", - "mouse2" to "\uD83D\uDC01", - "ox" to "\uD83D\uDC02", - "water_buffalo" to "\uD83D\uDC03", - "cow2" to "\uD83D\uDC04", - "tiger2" to "\uD83D\uDC05", - "leopard" to "\uD83D\uDC06", - "rabbit2" to "\uD83D\uDC07", - "cat2" to "\uD83D\uDC08", - "dragon" to "\uD83D\uDC09", - "crocodile" to "\uD83D\uDC0A", - "whale2" to "\uD83D\uDC0B", - "snail" to "\uD83D\uDC0C", - "snake" to "\uD83D\uDC0D", - "racehorse" to "\uD83D\uDC0E", - "ram" to "\uD83D\uDC0F", - "goat" to "\uD83D\uDC10", - "sheep" to "\uD83D\uDC11", - "monkey" to "\uD83D\uDC12", - "rooster" to "\uD83D\uDC13", - "chicken" to "\uD83D\uDC14", - "dog2" to "\uD83D\uDC15", - "pig2" to "\uD83D\uDC16", - "boar" to "\uD83D\uDC17", - "elephant" to "\uD83D\uDC18", - "octopus" to "\uD83D\uDC19", - "shell" to "\uD83D\uDC1A", - "bug" to "\uD83D\uDC1B", - "ant" to "\uD83D\uDC1C", - "bee" to "\uD83D\uDC1D", - "honeybee" to "\uD83D\uDC1D", - "beetle" to "\uD83D\uDC1E", - "fish" to "\uD83D\uDC1F", - "tropical_fish" to "\uD83D\uDC20", - "blowfish" to "\uD83D\uDC21", - "turtle" to "\uD83D\uDC22", - "hatching_chick" to "\uD83D\uDC23", - "baby_chick" to "\uD83D\uDC24", - "hatched_chick" to "\uD83D\uDC25", - "bird" to "\uD83D\uDC26", - "penguin" to "\uD83D\uDC27", - "koala" to "\uD83D\uDC28", - "poodle" to "\uD83D\uDC29", - "dromedary_camel" to "\uD83D\uDC2A", - "camel" to "\uD83D\uDC2B", - "dolphin" to "\uD83D\uDC2C", - "flipper" to "\uD83D\uDC2C", - "mouse" to "\uD83D\uDC2D", - "cow" to "\uD83D\uDC2E", - "tiger" to "\uD83D\uDC2F", - "rabbit" to "\uD83D\uDC30", - "cat" to "\uD83D\uDC31", - "dragon_face" to "\uD83D\uDC32", - "whale" to "\uD83D\uDC33", - "horse" to "\uD83D\uDC34", - "monkey_face" to "\uD83D\uDC35", - "dog" to "\uD83D\uDC36", - "pig" to "\uD83D\uDC37", - "frog" to "\uD83D\uDC38", - "hamster" to "\uD83D\uDC39", - "wolf" to "\uD83D\uDC3A", - "bear" to "\uD83D\uDC3B", - "panda_face" to "\uD83D\uDC3C", - "pig_nose" to "\uD83D\uDC3D", - "feet" to "\uD83D\uDC3E", - "paw_prints" to "\uD83D\uDC3E", - "chipmunk" to "\uD83D\uDC3F\uFE0F", - "eyes" to "\uD83D\uDC40", - "eye-in-speech-bubble" to "\uD83D\uDC41\uFE0F\u200D\uD83D\uDDE8\uFE0F", - "eye" to "\uD83D\uDC41\uFE0F", - "ear" to "\uD83D\uDC42", - "nose" to "\uD83D\uDC43", - "lips" to "\uD83D\uDC44", - "tongue" to "\uD83D\uDC45", - "point_up_2" to "\uD83D\uDC46", - "point_down" to "\uD83D\uDC47", - "point_left" to "\uD83D\uDC48", - "point_right" to "\uD83D\uDC49", - "facepunch" to "\uD83D\uDC4A", - "punch" to "\uD83D\uDC4A", - "wave" to "\uD83D\uDC4B", - "ok_hand" to "\uD83D\uDC4C", - "+1" to "\uD83D\uDC4D", - "thumbsup" to "\uD83D\uDC4D", - "-1" to "\uD83D\uDC4E", - "thumbsdown" to "\uD83D\uDC4E", - "clap" to "\uD83D\uDC4F", - "open_hands" to "\uD83D\uDC50", - "crown" to "\uD83D\uDC51", - "womans_hat" to "\uD83D\uDC52", - "eyeglasses" to "\uD83D\uDC53", - "necktie" to "\uD83D\uDC54", - "shirt" to "\uD83D\uDC55", - "tshirt" to "\uD83D\uDC55", - "jeans" to "\uD83D\uDC56", - "dress" to "\uD83D\uDC57", - "kimono" to "\uD83D\uDC58", - "bikini" to "\uD83D\uDC59", - "womans_clothes" to "\uD83D\uDC5A", - "purse" to "\uD83D\uDC5B", - "handbag" to "\uD83D\uDC5C", - "pouch" to "\uD83D\uDC5D", - "mans_shoe" to "\uD83D\uDC5E", - "shoe" to "\uD83D\uDC5E", - "athletic_shoe" to "\uD83D\uDC5F", - "high_heel" to "\uD83D\uDC60", - "sandal" to "\uD83D\uDC61", - "boot" to "\uD83D\uDC62", - "footprints" to "\uD83D\uDC63", - "bust_in_silhouette" to "\uD83D\uDC64", - "busts_in_silhouette" to "\uD83D\uDC65", - "boy" to "\uD83D\uDC66", - "girl" to "\uD83D\uDC67", - "male-farmer" to "\uD83D\uDC68\u200D\uD83C\uDF3E", - "male-cook" to "\uD83D\uDC68\u200D\uD83C\uDF73", - "male-student" to "\uD83D\uDC68\u200D\uD83C\uDF93", - "male-singer" to "\uD83D\uDC68\u200D\uD83C\uDFA4", - "male-artist" to "\uD83D\uDC68\u200D\uD83C\uDFA8", - "male-teacher" to "\uD83D\uDC68\u200D\uD83C\uDFEB", - "male-factory-worker" to "\uD83D\uDC68\u200D\uD83C\uDFED", - "man-boy-boy" to "\uD83D\uDC68\u200D\uD83D\uDC66\u200D\uD83D\uDC66", - "man-boy" to "\uD83D\uDC68\u200D\uD83D\uDC66", - "man-girl-boy" to "\uD83D\uDC68\u200D\uD83D\uDC67\u200D\uD83D\uDC66", - "man-girl-girl" to "\uD83D\uDC68\u200D\uD83D\uDC67\u200D\uD83D\uDC67", - "man-girl" to "\uD83D\uDC68\u200D\uD83D\uDC67", - "man-man-boy" to "\uD83D\uDC68\u200D\uD83D\uDC68\u200D\uD83D\uDC66", - "man-man-boy-boy" to "\uD83D\uDC68\u200D\uD83D\uDC68\u200D\uD83D\uDC66\u200D\uD83D\uDC66", - "man-man-girl" to "\uD83D\uDC68\u200D\uD83D\uDC68\u200D\uD83D\uDC67", - "man-man-girl-boy" to "\uD83D\uDC68\u200D\uD83D\uDC68\u200D\uD83D\uDC67\u200D\uD83D\uDC66", - "man-man-girl-girl" to "\uD83D\uDC68\u200D\uD83D\uDC68\u200D\uD83D\uDC67\u200D\uD83D\uDC67", - "man-woman-boy" to "\uD83D\uDC68\u200D\uD83D\uDC69\u200D\uD83D\uDC66", - "family" to "\uD83D\uDC68\u200D\uD83D\uDC69\u200D\uD83D\uDC66", - "man-woman-boy-boy" to "\uD83D\uDC68\u200D\uD83D\uDC69\u200D\uD83D\uDC66\u200D\uD83D\uDC66", - "man-woman-girl" to "\uD83D\uDC68\u200D\uD83D\uDC69\u200D\uD83D\uDC67", - "man-woman-girl-boy" to "\uD83D\uDC68\u200D\uD83D\uDC69\u200D\uD83D\uDC67\u200D\uD83D\uDC66", - "man-woman-girl-girl" to "\uD83D\uDC68\u200D\uD83D\uDC69\u200D\uD83D\uDC67\u200D\uD83D\uDC67", - "male-technologist" to "\uD83D\uDC68\u200D\uD83D\uDCBB", - "male-office-worker" to "\uD83D\uDC68\u200D\uD83D\uDCBC", - "male-mechanic" to "\uD83D\uDC68\u200D\uD83D\uDD27", - "male-scientist" to "\uD83D\uDC68\u200D\uD83D\uDD2C", - "male-astronaut" to "\uD83D\uDC68\u200D\uD83D\uDE80", - "male-firefighter" to "\uD83D\uDC68\u200D\uD83D\uDE92", - "male-doctor" to "\uD83D\uDC68\u200D\u2695\uFE0F", - "male-judge" to "\uD83D\uDC68\u200D\u2696\uFE0F", - "male-pilot" to "\uD83D\uDC68\u200D\u2708\uFE0F", - "man-heart-man" to "\uD83D\uDC68\u200D\u2764\uFE0F\u200D\uD83D\uDC68", - "man-kiss-man" to "\uD83D\uDC68\u200D\u2764\uFE0F\u200D\uD83D\uDC8B\u200D\uD83D\uDC68", - "man" to "\uD83D\uDC68", - "female-farmer" to "\uD83D\uDC69\u200D\uD83C\uDF3E", - "female-cook" to "\uD83D\uDC69\u200D\uD83C\uDF73", - "female-student" to "\uD83D\uDC69\u200D\uD83C\uDF93", - "female-singer" to "\uD83D\uDC69\u200D\uD83C\uDFA4", - "female-artist" to "\uD83D\uDC69\u200D\uD83C\uDFA8", - "female-teacher" to "\uD83D\uDC69\u200D\uD83C\uDFEB", - "female-factory-worker" to "\uD83D\uDC69\u200D\uD83C\uDFED", - "woman-boy-boy" to "\uD83D\uDC69\u200D\uD83D\uDC66\u200D\uD83D\uDC66", - "woman-boy" to "\uD83D\uDC69\u200D\uD83D\uDC66", - "woman-girl-boy" to "\uD83D\uDC69\u200D\uD83D\uDC67\u200D\uD83D\uDC66", - "woman-girl-girl" to "\uD83D\uDC69\u200D\uD83D\uDC67\u200D\uD83D\uDC67", - "woman-girl" to "\uD83D\uDC69\u200D\uD83D\uDC67", - "woman-woman-boy" to "\uD83D\uDC69\u200D\uD83D\uDC69\u200D\uD83D\uDC66", - "woman-woman-boy-boy" to "\uD83D\uDC69\u200D\uD83D\uDC69\u200D\uD83D\uDC66\u200D\uD83D\uDC66", - "woman-woman-girl" to "\uD83D\uDC69\u200D\uD83D\uDC69\u200D\uD83D\uDC67", - "woman-woman-girl-boy" to "\uD83D\uDC69\u200D\uD83D\uDC69\u200D\uD83D\uDC67\u200D\uD83D\uDC66", - "woman-woman-girl-girl" to "\uD83D\uDC69\u200D\uD83D\uDC69\u200D\uD83D\uDC67\u200D\uD83D\uDC67", - "female-technologist" to "\uD83D\uDC69\u200D\uD83D\uDCBB", - "female-office-worker" to "\uD83D\uDC69\u200D\uD83D\uDCBC", - "female-mechanic" to "\uD83D\uDC69\u200D\uD83D\uDD27", - "female-scientist" to "\uD83D\uDC69\u200D\uD83D\uDD2C", - "female-astronaut" to "\uD83D\uDC69\u200D\uD83D\uDE80", - "female-firefighter" to "\uD83D\uDC69\u200D\uD83D\uDE92", - "female-doctor" to "\uD83D\uDC69\u200D\u2695\uFE0F", - "female-judge" to "\uD83D\uDC69\u200D\u2696\uFE0F", - "female-pilot" to "\uD83D\uDC69\u200D\u2708\uFE0F", - "woman-heart-man" to "\uD83D\uDC69\u200D\u2764\uFE0F\u200D\uD83D\uDC68", - "couple_with_heart" to "\uD83D\uDC69\u200D\u2764\uFE0F\u200D\uD83D\uDC68", - "woman-heart-woman" to "\uD83D\uDC69\u200D\u2764\uFE0F\u200D\uD83D\uDC69", - "woman-kiss-man" to "\uD83D\uDC69\u200D\u2764\uFE0F\u200D\uD83D\uDC8B\u200D\uD83D\uDC68", - "couplekiss" to "\uD83D\uDC69\u200D\u2764\uFE0F\u200D\uD83D\uDC8B\u200D\uD83D\uDC68", - "woman-kiss-woman" to "\uD83D\uDC69\u200D\u2764\uFE0F\u200D\uD83D\uDC8B\u200D\uD83D\uDC69", - "woman" to "\uD83D\uDC69", - "couple" to "\uD83D\uDC6B", - "man_and_woman_holding_hands" to "\uD83D\uDC6B", - "two_men_holding_hands" to "\uD83D\uDC6C", - "two_women_holding_hands" to "\uD83D\uDC6D", - "female-police-officer" to "\uD83D\uDC6E\u200D\u2640\uFE0F", - "male-police-officer" to "\uD83D\uDC6E\u200D\u2642\uFE0F", - "cop" to "\uD83D\uDC6E\u200D\u2642\uFE0F", - "woman-with-bunny-ears-partying" to "\uD83D\uDC6F\u200D\u2640\uFE0F", - "dancers" to "\uD83D\uDC6F\u200D\u2640\uFE0F", - "man-with-bunny-ears-partying" to "\uD83D\uDC6F\u200D\u2642\uFE0F", - "bride_with_veil" to "\uD83D\uDC70", - "blond-haired-woman" to "\uD83D\uDC71\u200D\u2640\uFE0F", - "blond-haired-man" to "\uD83D\uDC71\u200D\u2642\uFE0F", - "person_with_blond_hair" to "\uD83D\uDC71\u200D\u2642\uFE0F", - "man_with_gua_pi_mao" to "\uD83D\uDC72", - "woman-wearing-turban" to "\uD83D\uDC73\u200D\u2640\uFE0F", - "man-wearing-turban" to "\uD83D\uDC73\u200D\u2642\uFE0F", - "man_with_turban" to "\uD83D\uDC73\u200D\u2642\uFE0F", - "older_man" to "\uD83D\uDC74", - "older_woman" to "\uD83D\uDC75", - "baby" to "\uD83D\uDC76", - "female-construction-worker" to "\uD83D\uDC77\u200D\u2640\uFE0F", - "male-construction-worker" to "\uD83D\uDC77\u200D\u2642\uFE0F", - "construction_worker" to "\uD83D\uDC77\u200D\u2642\uFE0F", - "princess" to "\uD83D\uDC78", - "japanese_ogre" to "\uD83D\uDC79", - "japanese_goblin" to "\uD83D\uDC7A", - "ghost" to "\uD83D\uDC7B", - "angel" to "\uD83D\uDC7C", - "alien" to "\uD83D\uDC7D", - "space_invader" to "\uD83D\uDC7E", - "imp" to "\uD83D\uDC7F", - "skull" to "\uD83D\uDC80", - "woman-tipping-hand" to "\uD83D\uDC81\u200D\u2640\uFE0F", - "information_desk_person" to "\uD83D\uDC81\u200D\u2640\uFE0F", - "man-tipping-hand" to "\uD83D\uDC81\u200D\u2642\uFE0F", - "female-guard" to "\uD83D\uDC82\u200D\u2640\uFE0F", - "male-guard" to "\uD83D\uDC82\u200D\u2642\uFE0F", - "guardsman" to "\uD83D\uDC82\u200D\u2642\uFE0F", - "dancer" to "\uD83D\uDC83", - "lipstick" to "\uD83D\uDC84", - "nail_care" to "\uD83D\uDC85", - "woman-getting-massage" to "\uD83D\uDC86\u200D\u2640\uFE0F", - "massage" to "\uD83D\uDC86\u200D\u2640\uFE0F", - "man-getting-massage" to "\uD83D\uDC86\u200D\u2642\uFE0F", - "woman-getting-haircut" to "\uD83D\uDC87\u200D\u2640\uFE0F", - "haircut" to "\uD83D\uDC87\u200D\u2640\uFE0F", - "man-getting-haircut" to "\uD83D\uDC87\u200D\u2642\uFE0F", - "barber" to "\uD83D\uDC88", - "syringe" to "\uD83D\uDC89", - "pill" to "\uD83D\uDC8A", - "kiss" to "\uD83D\uDC8B", - "love_letter" to "\uD83D\uDC8C", - "ring" to "\uD83D\uDC8D", - "gem" to "\uD83D\uDC8E", - "bouquet" to "\uD83D\uDC90", - "wedding" to "\uD83D\uDC92", - "heartbeat" to "\uD83D\uDC93", - "broken_heart" to "\uD83D\uDC94", - "two_hearts" to "\uD83D\uDC95", - "sparkling_heart" to "\uD83D\uDC96", - "heartpulse" to "\uD83D\uDC97", - "cupid" to "\uD83D\uDC98", - "blue_heart" to "\uD83D\uDC99", - "green_heart" to "\uD83D\uDC9A", - "yellow_heart" to "\uD83D\uDC9B", - "purple_heart" to "\uD83D\uDC9C", - "gift_heart" to "\uD83D\uDC9D", - "revolving_hearts" to "\uD83D\uDC9E", - "heart_decoration" to "\uD83D\uDC9F", - "diamond_shape_with_a_dot_inside" to "\uD83D\uDCA0", - "bulb" to "\uD83D\uDCA1", - "anger" to "\uD83D\uDCA2", - "bomb" to "\uD83D\uDCA3", - "zzz" to "\uD83D\uDCA4", - "boom" to "\uD83D\uDCA5", - "collision" to "\uD83D\uDCA5", - "sweat_drops" to "\uD83D\uDCA6", - "droplet" to "\uD83D\uDCA7", - "dash" to "\uD83D\uDCA8", - "hankey" to "\uD83D\uDCA9", - "poop" to "\uD83D\uDCA9", - "shit" to "\uD83D\uDCA9", - "muscle" to "\uD83D\uDCAA", - "dizzy" to "\uD83D\uDCAB", - "speech_balloon" to "\uD83D\uDCAC", - "thought_balloon" to "\uD83D\uDCAD", - "white_flower" to "\uD83D\uDCAE", - "100" to "\uD83D\uDCAF", - "moneybag" to "\uD83D\uDCB0", - "currency_exchange" to "\uD83D\uDCB1", - "heavy_dollar_sign" to "\uD83D\uDCB2", - "credit_card" to "\uD83D\uDCB3", - "yen" to "\uD83D\uDCB4", - "dollar" to "\uD83D\uDCB5", - "euro" to "\uD83D\uDCB6", - "pound" to "\uD83D\uDCB7", - "money_with_wings" to "\uD83D\uDCB8", - "chart" to "\uD83D\uDCB9", - "seat" to "\uD83D\uDCBA", - "computer" to "\uD83D\uDCBB", - "briefcase" to "\uD83D\uDCBC", - "minidisc" to "\uD83D\uDCBD", - "floppy_disk" to "\uD83D\uDCBE", - "cd" to "\uD83D\uDCBF", - "dvd" to "\uD83D\uDCC0", - "file_folder" to "\uD83D\uDCC1", - "open_file_folder" to "\uD83D\uDCC2", - "page_with_curl" to "\uD83D\uDCC3", - "page_facing_up" to "\uD83D\uDCC4", - "date" to "\uD83D\uDCC5", - "calendar" to "\uD83D\uDCC6", - "card_index" to "\uD83D\uDCC7", - "chart_with_upwards_trend" to "\uD83D\uDCC8", - "chart_with_downwards_trend" to "\uD83D\uDCC9", - "bar_chart" to "\uD83D\uDCCA", - "clipboard" to "\uD83D\uDCCB", - "pushpin" to "\uD83D\uDCCC", - "round_pushpin" to "\uD83D\uDCCD", - "paperclip" to "\uD83D\uDCCE", - "straight_ruler" to "\uD83D\uDCCF", - "triangular_ruler" to "\uD83D\uDCD0", - "bookmark_tabs" to "\uD83D\uDCD1", - "ledger" to "\uD83D\uDCD2", - "notebook" to "\uD83D\uDCD3", - "notebook_with_decorative_cover" to "\uD83D\uDCD4", - "closed_book" to "\uD83D\uDCD5", - "book" to "\uD83D\uDCD6", - "open_book" to "\uD83D\uDCD6", - "green_book" to "\uD83D\uDCD7", - "blue_book" to "\uD83D\uDCD8", - "orange_book" to "\uD83D\uDCD9", - "books" to "\uD83D\uDCDA", - "name_badge" to "\uD83D\uDCDB", - "scroll" to "\uD83D\uDCDC", - "memo" to "\uD83D\uDCDD", - "pencil" to "\uD83D\uDCDD", - "telephone_receiver" to "\uD83D\uDCDE", - "pager" to "\uD83D\uDCDF", - "fax" to "\uD83D\uDCE0", - "satellite_antenna" to "\uD83D\uDCE1", - "loudspeaker" to "\uD83D\uDCE2", - "mega" to "\uD83D\uDCE3", - "outbox_tray" to "\uD83D\uDCE4", - "inbox_tray" to "\uD83D\uDCE5", - "package" to "\uD83D\uDCE6", - "e-mail" to "\uD83D\uDCE7", - "incoming_envelope" to "\uD83D\uDCE8", - "envelope_with_arrow" to "\uD83D\uDCE9", - "mailbox_closed" to "\uD83D\uDCEA", - "mailbox" to "\uD83D\uDCEB", - "mailbox_with_mail" to "\uD83D\uDCEC", - "mailbox_with_no_mail" to "\uD83D\uDCED", - "postbox" to "\uD83D\uDCEE", - "postal_horn" to "\uD83D\uDCEF", - "newspaper" to "\uD83D\uDCF0", - "iphone" to "\uD83D\uDCF1", - "calling" to "\uD83D\uDCF2", - "vibration_mode" to "\uD83D\uDCF3", - "mobile_phone_off" to "\uD83D\uDCF4", - "no_mobile_phones" to "\uD83D\uDCF5", - "signal_strength" to "\uD83D\uDCF6", - "camera" to "\uD83D\uDCF7", - "camera_with_flash" to "\uD83D\uDCF8", - "video_camera" to "\uD83D\uDCF9", - "tv" to "\uD83D\uDCFA", - "radio" to "\uD83D\uDCFB", - "vhs" to "\uD83D\uDCFC", - "film_projector" to "\uD83D\uDCFD\uFE0F", - "prayer_beads" to "\uD83D\uDCFF", - "twisted_rightwards_arrows" to "\uD83D\uDD00", - "repeat" to "\uD83D\uDD01", - "repeat_one" to "\uD83D\uDD02", - "arrows_clockwise" to "\uD83D\uDD03", - "arrows_counterclockwise" to "\uD83D\uDD04", - "low_brightness" to "\uD83D\uDD05", - "high_brightness" to "\uD83D\uDD06", - "mute" to "\uD83D\uDD07", - "speaker" to "\uD83D\uDD08", - "sound" to "\uD83D\uDD09", - "loud_sound" to "\uD83D\uDD0A", - "battery" to "\uD83D\uDD0B", - "electric_plug" to "\uD83D\uDD0C", - "mag" to "\uD83D\uDD0D", - "mag_right" to "\uD83D\uDD0E", - "lock_with_ink_pen" to "\uD83D\uDD0F", - "closed_lock_with_key" to "\uD83D\uDD10", - "key" to "\uD83D\uDD11", - "lock" to "\uD83D\uDD12", - "unlock" to "\uD83D\uDD13", - "bell" to "\uD83D\uDD14", - "no_bell" to "\uD83D\uDD15", - "bookmark" to "\uD83D\uDD16", - "link" to "\uD83D\uDD17", - "radio_button" to "\uD83D\uDD18", - "back" to "\uD83D\uDD19", - "end" to "\uD83D\uDD1A", - "on" to "\uD83D\uDD1B", - "soon" to "\uD83D\uDD1C", - "top" to "\uD83D\uDD1D", - "underage" to "\uD83D\uDD1E", - "keycap_ten" to "\uD83D\uDD1F", - "capital_abcd" to "\uD83D\uDD20", - "abcd" to "\uD83D\uDD21", - "1234" to "\uD83D\uDD22", - "symbols" to "\uD83D\uDD23", - "abc" to "\uD83D\uDD24", - "fire" to "\uD83D\uDD25", - "flashlight" to "\uD83D\uDD26", - "wrench" to "\uD83D\uDD27", - "hammer" to "\uD83D\uDD28", - "nut_and_bolt" to "\uD83D\uDD29", - "hocho" to "\uD83D\uDD2A", - "knife" to "\uD83D\uDD2A", - "gun" to "\uD83D\uDD2B", - "microscope" to "\uD83D\uDD2C", - "telescope" to "\uD83D\uDD2D", - "crystal_ball" to "\uD83D\uDD2E", - "six_pointed_star" to "\uD83D\uDD2F", - "beginner" to "\uD83D\uDD30", - "trident" to "\uD83D\uDD31", - "black_square_button" to "\uD83D\uDD32", - "white_square_button" to "\uD83D\uDD33", - "red_circle" to "\uD83D\uDD34", - "large_blue_circle" to "\uD83D\uDD35", - "large_orange_diamond" to "\uD83D\uDD36", - "large_blue_diamond" to "\uD83D\uDD37", - "small_orange_diamond" to "\uD83D\uDD38", - "small_blue_diamond" to "\uD83D\uDD39", - "small_red_triangle" to "\uD83D\uDD3A", - "small_red_triangle_down" to "\uD83D\uDD3B", - "arrow_up_small" to "\uD83D\uDD3C", - "arrow_down_small" to "\uD83D\uDD3D", - "om_symbol" to "\uD83D\uDD49\uFE0F", - "dove_of_peace" to "\uD83D\uDD4A\uFE0F", - "kaaba" to "\uD83D\uDD4B", - "mosque" to "\uD83D\uDD4C", - "synagogue" to "\uD83D\uDD4D", - "menorah_with_nine_branches" to "\uD83D\uDD4E", - "clock1" to "\uD83D\uDD50", - "clock2" to "\uD83D\uDD51", - "clock3" to "\uD83D\uDD52", - "clock4" to "\uD83D\uDD53", - "clock5" to "\uD83D\uDD54", - "clock6" to "\uD83D\uDD55", - "clock7" to "\uD83D\uDD56", - "clock8" to "\uD83D\uDD57", - "clock9" to "\uD83D\uDD58", - "clock10" to "\uD83D\uDD59", - "clock11" to "\uD83D\uDD5A", - "clock12" to "\uD83D\uDD5B", - "clock130" to "\uD83D\uDD5C", - "clock230" to "\uD83D\uDD5D", - "clock330" to "\uD83D\uDD5E", - "clock430" to "\uD83D\uDD5F", - "clock530" to "\uD83D\uDD60", - "clock630" to "\uD83D\uDD61", - "clock730" to "\uD83D\uDD62", - "clock830" to "\uD83D\uDD63", - "clock930" to "\uD83D\uDD64", - "clock1030" to "\uD83D\uDD65", - "clock1130" to "\uD83D\uDD66", - "clock1230" to "\uD83D\uDD67", - "candle" to "\uD83D\uDD6F\uFE0F", - "mantelpiece_clock" to "\uD83D\uDD70\uFE0F", - "hole" to "\uD83D\uDD73\uFE0F", - "man_in_business_suit_levitating" to "\uD83D\uDD74\uFE0F", - "female-detective" to "\uD83D\uDD75\uFE0F\u200D\u2640\uFE0F", - "male-detective" to "\uD83D\uDD75\uFE0F\u200D\u2642\uFE0F", - "sleuth_or_spy" to "\uD83D\uDD75\uFE0F\u200D\u2642\uFE0F", - "dark_sunglasses" to "\uD83D\uDD76\uFE0F", - "spider" to "\uD83D\uDD77\uFE0F", - "spider_web" to "\uD83D\uDD78\uFE0F", - "joystick" to "\uD83D\uDD79\uFE0F", - "man_dancing" to "\uD83D\uDD7A", - "linked_paperclips" to "\uD83D\uDD87\uFE0F", - "lower_left_ballpoint_pen" to "\uD83D\uDD8A\uFE0F", - "lower_left_fountain_pen" to "\uD83D\uDD8B\uFE0F", - "lower_left_paintbrush" to "\uD83D\uDD8C\uFE0F", - "lower_left_crayon" to "\uD83D\uDD8D\uFE0F", - "raised_hand_with_fingers_splayed" to "\uD83D\uDD90\uFE0F", - "middle_finger" to "\uD83D\uDD95", - "reversed_hand_with_middle_finger_extended" to "\uD83D\uDD95", - "spock-hand" to "\uD83D\uDD96", - "black_heart" to "\uD83D\uDDA4", - "desktop_computer" to "\uD83D\uDDA5\uFE0F", - "printer" to "\uD83D\uDDA8\uFE0F", - "three_button_mouse" to "\uD83D\uDDB1\uFE0F", - "trackball" to "\uD83D\uDDB2\uFE0F", - "frame_with_picture" to "\uD83D\uDDBC\uFE0F", - "card_index_dividers" to "\uD83D\uDDC2\uFE0F", - "card_file_box" to "\uD83D\uDDC3\uFE0F", - "file_cabinet" to "\uD83D\uDDC4\uFE0F", - "wastebasket" to "\uD83D\uDDD1\uFE0F", - "spiral_note_pad" to "\uD83D\uDDD2\uFE0F", - "spiral_calendar_pad" to "\uD83D\uDDD3\uFE0F", - "compression" to "\uD83D\uDDDC\uFE0F", - "old_key" to "\uD83D\uDDDD\uFE0F", - "rolled_up_newspaper" to "\uD83D\uDDDE\uFE0F", - "dagger_knife" to "\uD83D\uDDE1\uFE0F", - "speaking_head_in_silhouette" to "\uD83D\uDDE3\uFE0F", - "left_speech_bubble" to "\uD83D\uDDE8\uFE0F", - "right_anger_bubble" to "\uD83D\uDDEF\uFE0F", - "ballot_box_with_ballot" to "\uD83D\uDDF3\uFE0F", - "world_map" to "\uD83D\uDDFA\uFE0F", - "mount_fuji" to "\uD83D\uDDFB", - "tokyo_tower" to "\uD83D\uDDFC", - "statue_of_liberty" to "\uD83D\uDDFD", - "japan" to "\uD83D\uDDFE", - "moyai" to "\uD83D\uDDFF", - "grinning" to "\uD83D\uDE00", - "grin" to "\uD83D\uDE01", - "joy" to "\uD83D\uDE02", - "smiley" to "\uD83D\uDE03", - "smile" to "\uD83D\uDE04", - "sweat_smile" to "\uD83D\uDE05", - "laughing" to "\uD83D\uDE06", - "satisfied" to "\uD83D\uDE06", - "innocent" to "\uD83D\uDE07", - "smiling_imp" to "\uD83D\uDE08", - "wink" to "\uD83D\uDE09", - "blush" to "\uD83D\uDE0A", - "yum" to "\uD83D\uDE0B", - "relieved" to "\uD83D\uDE0C", - "heart_eyes" to "\uD83D\uDE0D", - "sunglasses" to "\uD83D\uDE0E", - "smirk" to "\uD83D\uDE0F", - "neutral_face" to "\uD83D\uDE10", - "expressionless" to "\uD83D\uDE11", - "unamused" to "\uD83D\uDE12", - "sweat" to "\uD83D\uDE13", - "pensive" to "\uD83D\uDE14", - "confused" to "\uD83D\uDE15", - "confounded" to "\uD83D\uDE16", - "kissing" to "\uD83D\uDE17", - "kissing_heart" to "\uD83D\uDE18", - "kissing_smiling_eyes" to "\uD83D\uDE19", - "kissing_closed_eyes" to "\uD83D\uDE1A", - "stuck_out_tongue" to "\uD83D\uDE1B", - "stuck_out_tongue_winking_eye" to "\uD83D\uDE1C", - "stuck_out_tongue_closed_eyes" to "\uD83D\uDE1D", - "disappointed" to "\uD83D\uDE1E", - "worried" to "\uD83D\uDE1F", - "angry" to "\uD83D\uDE20", - "rage" to "\uD83D\uDE21", - "cry" to "\uD83D\uDE22", - "persevere" to "\uD83D\uDE23", - "triumph" to "\uD83D\uDE24", - "disappointed_relieved" to "\uD83D\uDE25", - "frowning" to "\uD83D\uDE26", - "anguished" to "\uD83D\uDE27", - "fearful" to "\uD83D\uDE28", - "weary" to "\uD83D\uDE29", - "sleepy" to "\uD83D\uDE2A", - "tired_face" to "\uD83D\uDE2B", - "grimacing" to "\uD83D\uDE2C", - "sob" to "\uD83D\uDE2D", - "open_mouth" to "\uD83D\uDE2E", - "hushed" to "\uD83D\uDE2F", - "cold_sweat" to "\uD83D\uDE30", - "scream" to "\uD83D\uDE31", - "astonished" to "\uD83D\uDE32", - "flushed" to "\uD83D\uDE33", - "sleeping" to "\uD83D\uDE34", - "dizzy_face" to "\uD83D\uDE35", - "no_mouth" to "\uD83D\uDE36", - "mask" to "\uD83D\uDE37", - "smile_cat" to "\uD83D\uDE38", - "joy_cat" to "\uD83D\uDE39", - "smiley_cat" to "\uD83D\uDE3A", - "heart_eyes_cat" to "\uD83D\uDE3B", - "smirk_cat" to "\uD83D\uDE3C", - "kissing_cat" to "\uD83D\uDE3D", - "pouting_cat" to "\uD83D\uDE3E", - "crying_cat_face" to "\uD83D\uDE3F", - "scream_cat" to "\uD83D\uDE40", - "slightly_frowning_face" to "\uD83D\uDE41", - "slightly_smiling_face" to "\uD83D\uDE42", - "upside_down_face" to "\uD83D\uDE43", - "face_with_rolling_eyes" to "\uD83D\uDE44", - "woman-gesturing-no" to "\uD83D\uDE45\u200D\u2640\uFE0F", - "no_good" to "\uD83D\uDE45\u200D\u2640\uFE0F", - "man-gesturing-no" to "\uD83D\uDE45\u200D\u2642\uFE0F", - "woman-gesturing-ok" to "\uD83D\uDE46\u200D\u2640\uFE0F", - "ok_woman" to "\uD83D\uDE46\u200D\u2640\uFE0F", - "man-gesturing-ok" to "\uD83D\uDE46\u200D\u2642\uFE0F", - "woman-bowing" to "\uD83D\uDE47\u200D\u2640\uFE0F", - "man-bowing" to "\uD83D\uDE47\u200D\u2642\uFE0F", - "bow" to "\uD83D\uDE47\u200D\u2642\uFE0F", - "see_no_evil" to "\uD83D\uDE48", - "hear_no_evil" to "\uD83D\uDE49", - "speak_no_evil" to "\uD83D\uDE4A", - "woman-raising-hand" to "\uD83D\uDE4B\u200D\u2640\uFE0F", - "raising_hand" to "\uD83D\uDE4B\u200D\u2640\uFE0F", - "man-raising-hand" to "\uD83D\uDE4B\u200D\u2642\uFE0F", - "raised_hands" to "\uD83D\uDE4C", - "woman-frowning" to "\uD83D\uDE4D\u200D\u2640\uFE0F", - "person_frowning" to "\uD83D\uDE4D\u200D\u2640\uFE0F", - "man-frowning" to "\uD83D\uDE4D\u200D\u2642\uFE0F", - "woman-pouting" to "\uD83D\uDE4E\u200D\u2640\uFE0F", - "person_with_pouting_face" to "\uD83D\uDE4E\u200D\u2640\uFE0F", - "man-pouting" to "\uD83D\uDE4E\u200D\u2642\uFE0F", - "pray" to "\uD83D\uDE4F", - "rocket" to "\uD83D\uDE80", - "helicopter" to "\uD83D\uDE81", - "steam_locomotive" to "\uD83D\uDE82", - "railway_car" to "\uD83D\uDE83", - "bullettrain_side" to "\uD83D\uDE84", - "bullettrain_front" to "\uD83D\uDE85", - "train2" to "\uD83D\uDE86", - "metro" to "\uD83D\uDE87", - "light_rail" to "\uD83D\uDE88", - "station" to "\uD83D\uDE89", - "tram" to "\uD83D\uDE8A", - "train" to "\uD83D\uDE8B", - "bus" to "\uD83D\uDE8C", - "oncoming_bus" to "\uD83D\uDE8D", - "trolleybus" to "\uD83D\uDE8E", - "busstop" to "\uD83D\uDE8F", - "minibus" to "\uD83D\uDE90", - "ambulance" to "\uD83D\uDE91", - "fire_engine" to "\uD83D\uDE92", - "police_car" to "\uD83D\uDE93", - "oncoming_police_car" to "\uD83D\uDE94", - "taxi" to "\uD83D\uDE95", - "oncoming_taxi" to "\uD83D\uDE96", - "car" to "\uD83D\uDE97", - "red_car" to "\uD83D\uDE97", - "oncoming_automobile" to "\uD83D\uDE98", - "blue_car" to "\uD83D\uDE99", - "truck" to "\uD83D\uDE9A", - "articulated_lorry" to "\uD83D\uDE9B", - "tractor" to "\uD83D\uDE9C", - "monorail" to "\uD83D\uDE9D", - "mountain_railway" to "\uD83D\uDE9E", - "suspension_railway" to "\uD83D\uDE9F", - "mountain_cableway" to "\uD83D\uDEA0", - "aerial_tramway" to "\uD83D\uDEA1", - "ship" to "\uD83D\uDEA2", - "woman-rowing-boat" to "\uD83D\uDEA3\u200D\u2640\uFE0F", - "man-rowing-boat" to "\uD83D\uDEA3\u200D\u2642\uFE0F", - "rowboat" to "\uD83D\uDEA3\u200D\u2642\uFE0F", - "speedboat" to "\uD83D\uDEA4", - "traffic_light" to "\uD83D\uDEA5", - "vertical_traffic_light" to "\uD83D\uDEA6", - "construction" to "\uD83D\uDEA7", - "rotating_light" to "\uD83D\uDEA8", - "triangular_flag_on_post" to "\uD83D\uDEA9", - "door" to "\uD83D\uDEAA", - "no_entry_sign" to "\uD83D\uDEAB", - "smoking" to "\uD83D\uDEAC", - "no_smoking" to "\uD83D\uDEAD", - "put_litter_in_its_place" to "\uD83D\uDEAE", - "do_not_litter" to "\uD83D\uDEAF", - "potable_water" to "\uD83D\uDEB0", - "non-potable_water" to "\uD83D\uDEB1", - "bike" to "\uD83D\uDEB2", - "no_bicycles" to "\uD83D\uDEB3", - "woman-biking" to "\uD83D\uDEB4\u200D\u2640\uFE0F", - "man-biking" to "\uD83D\uDEB4\u200D\u2642\uFE0F", - "bicyclist" to "\uD83D\uDEB4\u200D\u2642\uFE0F", - "woman-mountain-biking" to "\uD83D\uDEB5\u200D\u2640\uFE0F", - "man-mountain-biking" to "\uD83D\uDEB5\u200D\u2642\uFE0F", - "mountain_bicyclist" to "\uD83D\uDEB5\u200D\u2642\uFE0F", - "woman-walking" to "\uD83D\uDEB6\u200D\u2640\uFE0F", - "man-walking" to "\uD83D\uDEB6\u200D\u2642\uFE0F", - "walking" to "\uD83D\uDEB6\u200D\u2642\uFE0F", - "no_pedestrians" to "\uD83D\uDEB7", - "children_crossing" to "\uD83D\uDEB8", - "mens" to "\uD83D\uDEB9", - "womens" to "\uD83D\uDEBA", - "restroom" to "\uD83D\uDEBB", - "baby_symbol" to "\uD83D\uDEBC", - "toilet" to "\uD83D\uDEBD", - "wc" to "\uD83D\uDEBE", - "shower" to "\uD83D\uDEBF", - "bath" to "\uD83D\uDEC0", - "bathtub" to "\uD83D\uDEC1", - "passport_control" to "\uD83D\uDEC2", - "customs" to "\uD83D\uDEC3", - "baggage_claim" to "\uD83D\uDEC4", - "left_luggage" to "\uD83D\uDEC5", - "couch_and_lamp" to "\uD83D\uDECB\uFE0F", - "sleeping_accommodation" to "\uD83D\uDECC", - "shopping_bags" to "\uD83D\uDECD\uFE0F", - "bellhop_bell" to "\uD83D\uDECE\uFE0F", - "bed" to "\uD83D\uDECF\uFE0F", - "place_of_worship" to "\uD83D\uDED0", - "octagonal_sign" to "\uD83D\uDED1", - "shopping_trolley" to "\uD83D\uDED2", - "hammer_and_wrench" to "\uD83D\uDEE0\uFE0F", - "shield" to "\uD83D\uDEE1\uFE0F", - "oil_drum" to "\uD83D\uDEE2\uFE0F", - "motorway" to "\uD83D\uDEE3\uFE0F", - "railway_track" to "\uD83D\uDEE4\uFE0F", - "motor_boat" to "\uD83D\uDEE5\uFE0F", - "small_airplane" to "\uD83D\uDEE9\uFE0F", - "airplane_departure" to "\uD83D\uDEEB", - "airplane_arriving" to "\uD83D\uDEEC", - "satellite" to "\uD83D\uDEF0\uFE0F", - "passenger_ship" to "\uD83D\uDEF3\uFE0F", - "scooter" to "\uD83D\uDEF4", - "motor_scooter" to "\uD83D\uDEF5", - "canoe" to "\uD83D\uDEF6", - "sled" to "\uD83D\uDEF7", - "flying_saucer" to "\uD83D\uDEF8", - "zipper_mouth_face" to "\uD83E\uDD10", - "money_mouth_face" to "\uD83E\uDD11", - "face_with_thermometer" to "\uD83E\uDD12", - "nerd_face" to "\uD83E\uDD13", - "thinking_face" to "\uD83E\uDD14", - "face_with_head_bandage" to "\uD83E\uDD15", - "robot_face" to "\uD83E\uDD16", - "hugging_face" to "\uD83E\uDD17", - "the_horns" to "\uD83E\uDD18", - "sign_of_the_horns" to "\uD83E\uDD18", - "call_me_hand" to "\uD83E\uDD19", - "raised_back_of_hand" to "\uD83E\uDD1A", - "left-facing_fist" to "\uD83E\uDD1B", - "right-facing_fist" to "\uD83E\uDD1C", - "handshake" to "\uD83E\uDD1D", - "hand_with_index_and_middle_fingers_crossed" to "\uD83E\uDD1E", - "i_love_you_hand_sign" to "\uD83E\uDD1F", - "face_with_cowboy_hat" to "\uD83E\uDD20", - "clown_face" to "\uD83E\uDD21", - "nauseated_face" to "\uD83E\uDD22", - "rolling_on_the_floor_laughing" to "\uD83E\uDD23", - "drooling_face" to "\uD83E\uDD24", - "lying_face" to "\uD83E\uDD25", - "woman-facepalming" to "\uD83E\uDD26\u200D\u2640\uFE0F", - "man-facepalming" to "\uD83E\uDD26\u200D\u2642\uFE0F", - "face_palm" to "\uD83E\uDD26", - "sneezing_face" to "\uD83E\uDD27", - "face_with_one_eyebrow_raised" to "\uD83E\uDD28", - "grinning_face_with_star_eyes" to "\uD83E\uDD29", - "grinning_face_with_one_large_and_one_small_eye" to "\uD83E\uDD2A", - "face_with_finger_covering_closed_lips" to "\uD83E\uDD2B", - "serious_face_with_symbols_covering_mouth" to "\uD83E\uDD2C", - "smiling_face_with_smiling_eyes_and_hand_covering_mouth" to "\uD83E\uDD2D", - "face_with_open_mouth_vomiting" to "\uD83E\uDD2E", - "shocked_face_with_exploding_head" to "\uD83E\uDD2F", - "pregnant_woman" to "\uD83E\uDD30", - "breast-feeding" to "\uD83E\uDD31", - "palms_up_together" to "\uD83E\uDD32", - "selfie" to "\uD83E\uDD33", - "prince" to "\uD83E\uDD34", - "man_in_tuxedo" to "\uD83E\uDD35", - "mother_christmas" to "\uD83E\uDD36", - "woman-shrugging" to "\uD83E\uDD37\u200D\u2640\uFE0F", - "man-shrugging" to "\uD83E\uDD37\u200D\u2642\uFE0F", - "shrug" to "\uD83E\uDD37", - "woman-cartwheeling" to "\uD83E\uDD38\u200D\u2640\uFE0F", - "man-cartwheeling" to "\uD83E\uDD38\u200D\u2642\uFE0F", - "person_doing_cartwheel" to "\uD83E\uDD38", - "woman-juggling" to "\uD83E\uDD39\u200D\u2640\uFE0F", - "man-juggling" to "\uD83E\uDD39\u200D\u2642\uFE0F", - "juggling" to "\uD83E\uDD39", - "fencer" to "\uD83E\uDD3A", - "woman-wrestling" to "\uD83E\uDD3C\u200D\u2640\uFE0F", - "man-wrestling" to "\uD83E\uDD3C\u200D\u2642\uFE0F", - "wrestlers" to "\uD83E\uDD3C", - "woman-playing-water-polo" to "\uD83E\uDD3D\u200D\u2640\uFE0F", - "man-playing-water-polo" to "\uD83E\uDD3D\u200D\u2642\uFE0F", - "water_polo" to "\uD83E\uDD3D", - "woman-playing-handball" to "\uD83E\uDD3E\u200D\u2640\uFE0F", - "man-playing-handball" to "\uD83E\uDD3E\u200D\u2642\uFE0F", - "handball" to "\uD83E\uDD3E", - "wilted_flower" to "\uD83E\uDD40", - "drum_with_drumsticks" to "\uD83E\uDD41", - "clinking_glasses" to "\uD83E\uDD42", - "tumbler_glass" to "\uD83E\uDD43", - "spoon" to "\uD83E\uDD44", - "goal_net" to "\uD83E\uDD45", - "first_place_medal" to "\uD83E\uDD47", - "second_place_medal" to "\uD83E\uDD48", - "third_place_medal" to "\uD83E\uDD49", - "boxing_glove" to "\uD83E\uDD4A", - "martial_arts_uniform" to "\uD83E\uDD4B", - "curling_stone" to "\uD83E\uDD4C", - "croissant" to "\uD83E\uDD50", - "avocado" to "\uD83E\uDD51", - "cucumber" to "\uD83E\uDD52", - "bacon" to "\uD83E\uDD53", - "potato" to "\uD83E\uDD54", - "carrot" to "\uD83E\uDD55", - "baguette_bread" to "\uD83E\uDD56", - "green_salad" to "\uD83E\uDD57", - "shallow_pan_of_food" to "\uD83E\uDD58", - "stuffed_flatbread" to "\uD83E\uDD59", - "egg" to "\uD83E\uDD5A", - "glass_of_milk" to "\uD83E\uDD5B", - "peanuts" to "\uD83E\uDD5C", - "kiwifruit" to "\uD83E\uDD5D", - "pancakes" to "\uD83E\uDD5E", - "dumpling" to "\uD83E\uDD5F", - "fortune_cookie" to "\uD83E\uDD60", - "takeout_box" to "\uD83E\uDD61", - "chopsticks" to "\uD83E\uDD62", - "bowl_with_spoon" to "\uD83E\uDD63", - "cup_with_straw" to "\uD83E\uDD64", - "coconut" to "\uD83E\uDD65", - "broccoli" to "\uD83E\uDD66", - "pie" to "\uD83E\uDD67", - "pretzel" to "\uD83E\uDD68", - "cut_of_meat" to "\uD83E\uDD69", - "sandwich" to "\uD83E\uDD6A", - "canned_food" to "\uD83E\uDD6B", - "crab" to "\uD83E\uDD80", - "lion_face" to "\uD83E\uDD81", - "scorpion" to "\uD83E\uDD82", - "turkey" to "\uD83E\uDD83", - "unicorn_face" to "\uD83E\uDD84", - "eagle" to "\uD83E\uDD85", - "duck" to "\uD83E\uDD86", - "bat" to "\uD83E\uDD87", - "shark" to "\uD83E\uDD88", - "owl" to "\uD83E\uDD89", - "fox_face" to "\uD83E\uDD8A", - "butterfly" to "\uD83E\uDD8B", - "deer" to "\uD83E\uDD8C", - "gorilla" to "\uD83E\uDD8D", - "lizard" to "\uD83E\uDD8E", - "rhinoceros" to "\uD83E\uDD8F", - "shrimp" to "\uD83E\uDD90", - "squid" to "\uD83E\uDD91", - "giraffe_face" to "\uD83E\uDD92", - "zebra_face" to "\uD83E\uDD93", - "hedgehog" to "\uD83E\uDD94", - "sauropod" to "\uD83E\uDD95", - "t-rex" to "\uD83E\uDD96", - "cricket" to "\uD83E\uDD97", - "cheese_wedge" to "\uD83E\uDDC0", - "face_with_monocle" to "\uD83E\uDDD0", - "adult" to "\uD83E\uDDD1", - "child" to "\uD83E\uDDD2", - "older_adult" to "\uD83E\uDDD3", - "bearded_person" to "\uD83E\uDDD4", - "person_with_headscarf" to "\uD83E\uDDD5", - "woman_in_steamy_room" to "\uD83E\uDDD6\u200D\u2640\uFE0F", - "man_in_steamy_room" to "\uD83E\uDDD6\u200D\u2642\uFE0F", - "person_in_steamy_room" to "\uD83E\uDDD6\u200D\u2642\uFE0F", - "woman_climbing" to "\uD83E\uDDD7\u200D\u2640\uFE0F", - "person_climbing" to "\uD83E\uDDD7\u200D\u2640\uFE0F", - "man_climbing" to "\uD83E\uDDD7\u200D\u2642\uFE0F", - "woman_in_lotus_position" to "\uD83E\uDDD8\u200D\u2640\uFE0F", - "person_in_lotus_position" to "\uD83E\uDDD8\u200D\u2640\uFE0F", - "man_in_lotus_position" to "\uD83E\uDDD8\u200D\u2642\uFE0F", - "female_mage" to "\uD83E\uDDD9\u200D\u2640\uFE0F", - "mage" to "\uD83E\uDDD9\u200D\u2640\uFE0F", - "male_mage" to "\uD83E\uDDD9\u200D\u2642\uFE0F", - "female_fairy" to "\uD83E\uDDDA\u200D\u2640\uFE0F", - "fairy" to "\uD83E\uDDDA\u200D\u2640\uFE0F", - "male_fairy" to "\uD83E\uDDDA\u200D\u2642\uFE0F", - "female_vampire" to "\uD83E\uDDDB\u200D\u2640\uFE0F", - "vampire" to "\uD83E\uDDDB\u200D\u2640\uFE0F", - "male_vampire" to "\uD83E\uDDDB\u200D\u2642\uFE0F", - "mermaid" to "\uD83E\uDDDC\u200D\u2640\uFE0F", - "merman" to "\uD83E\uDDDC\u200D\u2642\uFE0F", - "merperson" to "\uD83E\uDDDC\u200D\u2642\uFE0F", - "female_elf" to "\uD83E\uDDDD\u200D\u2640\uFE0F", - "male_elf" to "\uD83E\uDDDD\u200D\u2642\uFE0F", - "elf" to "\uD83E\uDDDD\u200D\u2642\uFE0F", - "female_genie" to "\uD83E\uDDDE\u200D\u2640\uFE0F", - "male_genie" to "\uD83E\uDDDE\u200D\u2642\uFE0F", - "genie" to "\uD83E\uDDDE\u200D\u2642\uFE0F", - "female_zombie" to "\uD83E\uDDDF\u200D\u2640\uFE0F", - "male_zombie" to "\uD83E\uDDDF\u200D\u2642\uFE0F", - "zombie" to "\uD83E\uDDDF\u200D\u2642\uFE0F", - "brain" to "\uD83E\uDDE0", - "orange_heart" to "\uD83E\uDDE1", - "billed_cap" to "\uD83E\uDDE2", - "scarf" to "\uD83E\uDDE3", - "gloves" to "\uD83E\uDDE4", - "coat" to "\uD83E\uDDE5", - "socks" to "\uD83E\uDDE6", - "bangbang" to "\u203C\uFE0F", - "interrobang" to "\u2049\uFE0F", - "tm" to "\u2122\uFE0F", - "information_source" to "\u2139\uFE0F", - "left_right_arrow" to "\u2194\uFE0F", - "arrow_up_down" to "\u2195\uFE0F", - "arrow_upper_left" to "\u2196\uFE0F", - "arrow_upper_right" to "\u2197\uFE0F", - "arrow_lower_right" to "\u2198\uFE0F", - "arrow_lower_left" to "\u2199\uFE0F", - "leftwards_arrow_with_hook" to "\u21A9\uFE0F", - "arrow_right_hook" to "\u21AA\uFE0F", - "watch" to "\u231A", - "hourglass" to "\u231B", - "keyboard" to "\u2328\uFE0F", - "eject" to "\u23CF\uFE0F", - "fast_forward" to "\u23E9", - "rewind" to "\u23EA", - "arrow_double_up" to "\u23EB", - "arrow_double_down" to "\u23EC", - "black_right_pointing_double_triangle_with_vertical_bar" to "\u23ED\uFE0F", - "black_left_pointing_double_triangle_with_vertical_bar" to "\u23EE\uFE0F", - "black_right_pointing_triangle_with_double_vertical_bar" to "\u23EF\uFE0F", - "alarm_clock" to "\u23F0", - "stopwatch" to "\u23F1\uFE0F", - "timer_clock" to "\u23F2\uFE0F", - "hourglass_flowing_sand" to "\u23F3", - "double_vertical_bar" to "\u23F8\uFE0F", - "black_square_for_stop" to "\u23F9\uFE0F", - "black_circle_for_record" to "\u23FA\uFE0F", - "m" to "\u24C2\uFE0F", - "black_small_square" to "\u25AA\uFE0F", - "white_small_square" to "\u25AB\uFE0F", - "arrow_forward" to "\u25B6\uFE0F", - "arrow_backward" to "\u25C0\uFE0F", - "white_medium_square" to "\u25FB\uFE0F", - "black_medium_square" to "\u25FC\uFE0F", - "white_medium_small_square" to "\u25FD", - "black_medium_small_square" to "\u25FE", - "sunny" to "\u2600\uFE0F", - "cloud" to "\u2601\uFE0F", - "umbrella" to "\u2602\uFE0F", - "snowman" to "\u2603\uFE0F", - "comet" to "\u2604\uFE0F", - "phone" to "\u260E\uFE0F", - "telephone" to "\u260E\uFE0F", - "ballot_box_with_check" to "\u2611\uFE0F", - "shamrock" to "\u2618\uFE0F", - "point_up" to "\u261D\uFE0F", - "skull_and_crossbones" to "\u2620\uFE0F", - "radioactive_sign" to "\u2622\uFE0F", - "biohazard_sign" to "\u2623\uFE0F", - "orthodox_cross" to "\u2626\uFE0F", - "star_and_crescent" to "\u262A\uFE0F", - "peace_symbol" to "\u262E\uFE0F", - "yin_yang" to "\u262F\uFE0F", - "wheel_of_dharma" to "\u2638\uFE0F", - "white_frowning_face" to "\u2639\uFE0F", - "relaxed" to "\u263A\uFE0F", - "female_sign" to "\u2640\uFE0F", - "male_sign" to "\u2642\uFE0F", - "gemini" to "\u264A", - "cancer" to "\u264B", - "leo" to "\u264C", - "virgo" to "\u264D", - "libra" to "\u264E", - "scorpius" to "\u264F", - "spades" to "\u2660\uFE0F", - "clubs" to "\u2663\uFE0F", - "hearts" to "\u2665\uFE0F", - "diamonds" to "\u2666\uFE0F", - "hotsprings" to "\u2668\uFE0F", - "recycle" to "\u267B\uFE0F", - "wheelchair" to "\u267F", - "hammer_and_pick" to "\u2692\uFE0F", - "crossed_swords" to "\u2694\uFE0F", - "staff_of_aesculapius" to "\u2695\uFE0F", - "scales" to "\u2696\uFE0F", - "alembic" to "\u2697\uFE0F", - "gear" to "\u2699\uFE0F", - "atom_symbol" to "\u269B\uFE0F", - "fleur_de_lis" to "\u269C\uFE0F", - "warning" to "\u26A0\uFE0F", - "zap" to "\u26A1", - "white_circle" to "\u26AA", - "black_circle" to "\u26AB", - "coffin" to "\u26B0\uFE0F", - "funeral_urn" to "\u26B1\uFE0F", - "soccer" to "\u26BD", - "baseball" to "\u26BE", - "snowman_without_snow" to "\u26C4", - "partly_sunny" to "\u26C5", - "thunder_cloud_and_rain" to "\u26C8\uFE0F", - "ophiuchus" to "\u26CE", - "pick" to "\u26CF\uFE0F", - "helmet_with_white_cross" to "\u26D1\uFE0F", - "chains" to "\u26D3\uFE0F", - "no_entry" to "\u26D4", - "shinto_shrine" to "\u26E9\uFE0F", - "church" to "\u26EA", - "mountain" to "\u26F0\uFE0F", - "umbrella_on_ground" to "\u26F1\uFE0F", - "fountain" to "\u26F2", - "golf" to "\u26F3", - "ferry" to "\u26F4\uFE0F", - "boat" to "\u26F5", - "sailboat" to "\u26F5", - "skier" to "\u26F7\uFE0F", - "ice_skate" to "\u26F8\uFE0F", - "woman-bouncing-ball" to "\u26F9\uFE0F\u200D\u2640\uFE0F", - "man-bouncing-ball" to "\u26F9\uFE0F\u200D\u2642\uFE0F", - "person_with_ball" to "\u26F9\uFE0F\u200D\u2642\uFE0F", - "tent" to "\u26FA", - "fuelpump" to "\u26FD", - "scissors" to "\u2702\uFE0F", - "airplane" to "\u2708\uFE0F", - "email" to "\u2709\uFE0F", - "envelope" to "\u2709\uFE0F", - "fist" to "\u270A", - "hand" to "\u270B", - "raised_hand" to "\u270B", - "v" to "\u270C\uFE0F", - "writing_hand" to "\u270D\uFE0F", - "pencil2" to "\u270F\uFE0F", - "black_nib" to "\u2712\uFE0F", - "heavy_check_mark" to "\u2714\uFE0F", - "heavy_multiplication_x" to "\u2716\uFE0F", - "latin_cross" to "\u271D\uFE0F", - "star_of_david" to "\u2721\uFE0F", - "eight_spoked_asterisk" to "\u2733\uFE0F", - "eight_pointed_black_star" to "\u2734\uFE0F", - "snowflake" to "\u2744\uFE0F", - "sparkle" to "\u2747\uFE0F", - "x" to "\u274C", - "negative_squared_cross_mark" to "\u274E", - "heavy_heart_exclamation_mark_ornament" to "\u2763\uFE0F", - "heart" to "\u2764\uFE0F", - "arrow_right" to "\u27A1\uFE0F", - "curly_loop" to "\u27B0", - "loop" to "\u27BF", - "arrow_heading_up" to "\u2934\uFE0F", - "arrow_heading_down" to "\u2935\uFE0F", - "arrow_left" to "\u2B05\uFE0F", - "arrow_up" to "\u2B06\uFE0F", - "arrow_down" to "\u2B07\uFE0F", - "black_large_square" to "\u2B1B", - "white_large_square" to "\u2B1C", - "star" to "\u2B50", - "o" to "\u2B55", - "wavy_dash" to "\u3030\uFE0F", - "part_alternation_mark" to "\u303D\uFE0F", - "congratulations" to "\u3297\uFE0F", - "secret" to "\u3299\uFE0F" - ) - - val emojiReplacementMap = mapOf( - // Aliases imported from IRCCloud and Slack - "like" to rawEmojiMap["+1"], - "doge" to rawEmojiMap["dog"], - "aubergine" to rawEmojiMap["eggplant"], - "gust_of_wind" to rawEmojiMap["dash"], - "party_popper" to rawEmojiMap["tada"], - "shock" to rawEmojiMap["scream"], - "atom" to rawEmojiMap["atom_symbol"], - "loudly_crying_face" to rawEmojiMap["sob"], - "sad_tears" to rawEmojiMap["sob"], - "bawl" to rawEmojiMap["sob"], - "ufo" to rawEmojiMap["flying_saucer"], - "throwing_up" to rawEmojiMap["face_with_open_mouth_vomiting"], - "being_sick" to rawEmojiMap["face_with_open_mouth_vomiting"], - "sh" to rawEmojiMap["face_with_finger_covering_closed_lips"], - "oops" to rawEmojiMap["smiling_face_with_smiling_eyes_and_hand_covering_mouth"], - "female_wizard" to rawEmojiMap["female_mage"], - "male_wizard" to rawEmojiMap["male_mage"], - "brontosaurus" to rawEmojiMap["sauropod"], - "diplodocus" to rawEmojiMap["sauropod"], - "tyrannosaurus" to rawEmojiMap["t-rex"], - "steak" to rawEmojiMap["cut_of_meat"], - "soup_tin" to rawEmojiMap["canned_food"], - "baseball_cap" to rawEmojiMap["billed_cap"], - "female_yoga" to rawEmojiMap["woman_in_lotus_position"], - "male_yoga" to rawEmojiMap["man_in_lotus_position"], - "female_sauna" to rawEmojiMap["woman_in_steamy_room"], - "male_sauna" to rawEmojiMap["man_in_steamy_room"], - "hijab" to rawEmojiMap["person_with_headscarf"], - "crazy_face" to rawEmojiMap["grinning_face_with_one_large_and_one_small_eye"], - "diamond" to rawEmojiMap["gem"], - "ladybird" to rawEmojiMap["beetle"], - "ladybug" to rawEmojiMap["beetle"], - "ladybeetle" to rawEmojiMap["beetle"], - "coccinellid" to rawEmojiMap["beetle"], - "cursing" to rawEmojiMap["serious_face_with_symbols_covering_mouth"], - "swearing" to rawEmojiMap["serious_face_with_symbols_covering_mouth"], - "fuck" to rawEmojiMap["serious_face_with_symbols_covering_mouth"], - "angry_swearing" to rawEmojiMap["serious_face_with_symbols_covering_mouth"], - "mad_swearing" to rawEmojiMap["serious_face_with_symbols_covering_mouth"], - "pissed_off" to rawEmojiMap["serious_face_with_symbols_covering_mouth"], - "angel_face" to rawEmojiMap["innocent"], - "smiling_devil" to rawEmojiMap["smiling_imp"], - "frowning_devil" to rawEmojiMap["imp"], - "mad_rage" to rawEmojiMap["rage"], - "angry_rage" to rawEmojiMap["rage"], - "mad" to rawEmojiMap["angry"], - "steam_train" to rawEmojiMap["steam_locomotive"] - ) - - val emojiAsciiMap = mapOf( - "<3" to rawEmojiMap["heart"], - "</3" to rawEmojiMap["broken_heart"], - ")" to rawEmojiMap["smiley"], - "')" to rawEmojiMap["smiley"], - "-)" to rawEmojiMap["disappointed"], - "(" to rawEmojiMap["cry"], - "_(" to rawEmojiMap["sob"], - ";)" to rawEmojiMap["wink"], - ";p" to rawEmojiMap["stuck_out_tongue_winking_eye"] - ) - - val processedEmojiMap = (rawEmojiMap + emojiReplacementMap).toList() - .groupBy(Pair<String, String?>::second, Pair<String, String?>::first) - .map { (replacement, shortCodes) -> - AutoCompleteItem.EmojiItem(shortCodes.sorted(), replacement ?: "") - } - - val conversionMap = mapOf( - "\u0030\u20E3" to "\uDBBA\uDC37", // ZERO - "\u0031\u20E3" to "\uDBBA\uDC2E", // ONE - "\u0032\u20E3" to "\uDBBA\uDC2F", // TWO - "\u0033\u20E3" to "\uDBBA\uDC30", // THREE - "\u0034\u20E3" to "\uDBBA\uDC31", // FOUR - "\u0035\u20E3" to "\uDBBA\uDC32", // FIVE - "\u0036\u20E3" to "\uDBBA\uDC33", // SIX - "\u0037\u20E3" to "\uDBBA\uDC34", // SEVEN - "\u0038\u20E3" to "\uDBBA\uDC35", // EIGHT - "\u0039\u20E3" to "\uDBBA\uDC36", // NINE - "\u0023\u20E3" to "\uDBBA\uDC2C", // HASH - "\u0030\uFE0F\u20E3" to "\uDBBA\uDC37", // ZERO - "\u0031\uFE0F\u20E3" to "\uDBBA\uDC2E", // ONE - "\u0032\uFE0F\u20E3" to "\uDBBA\uDC2F", // TWO - "\u0033\uFE0F\u20E3" to "\uDBBA\uDC30", // THREE - "\u0034\uFE0F\u20E3" to "\uDBBA\uDC31", // FOUR - "\u0035\uFE0F\u20E3" to "\uDBBA\uDC32", // FIVE - "\u0036\uFE0F\u20E3" to "\uDBBA\uDC33", // SIX - "\u0037\uFE0F\u20E3" to "\uDBBA\uDC34", // SEVEN - "\u0038\uFE0F\u20E3" to "\uDBBA\uDC35", // EIGHT - "\u0039\uFE0F\u20E3" to "\uDBBA\uDC36", // NINE - "\u0023\uFE0F\u20E3" to "\uDBBA\uDC2C", // HASH - "\u24C2\uFE0F" to "\u24c2", // M - "\u2139\uFE0F" to "\u2139", // INFORMATION_SOURCE - "\u3297\uFE0F" to "\u3297", // CONGRATULATIONS - "\u3299\uFE0F" to "\u3299" // SECRET - ) + if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) { - mapOf( - "\uD83C\uDDEF\uD83C\uDDF5" to "\uDBB9\uDCE5", // JP - "\uD83C\uDDF0\uD83C\uDDF7" to "\uDBB9\uDCEE", // KR - "\uD83C\uDDE9\uD83C\uDDEA" to "\uDBB9\uDCE8", // DE - "\uD83C\uDDE8\uD83C\uDDF3" to "\uDBB9\uDCED", // CN - "\uD83C\uDDFA\uD83C\uDDF8" to "\uDBB9\uDCE6", // US - "\uD83C\uDDEB\uD83C\uDDF7" to "\uDBB9\uDCE7", // FR - "\uD83C\uDDEA\uD83C\uDDF8" to "\uDBB9\uDCEB", // ES - "\uD83C\uDDEE\uD83C\uDDF9" to "\uDBB9\uDCE9", // IT - "\uD83C\uDDF7\uD83C\uDDFA" to "\uDBB9\uDCEC", // RU - "\uD83C\uDDEC\uD83C\uDDE7" to "\uDBB9\uDCEA" // GB - ) - } else emptyMap() - - val emojis = conversionMap.values.toSet() + rawEmojiMap.values.toSet() + "\u200d" + "\ufe0f" - - fun replaceShortCodes(source: Editable): Editable { - var result = source - for (emoji in processedEmojiMap) { - for (rawShortCode in emoji.shortCodes) { - val shortCode = ":$rawShortCode:" - var index: Int - while (true) { - index = result.indexOf(shortCode) - if (index == -1) break - - result = result.replace(index, index + shortCode.length, emoji.replacement) - } - } - } - return result - } -} diff --git a/viewmodel/src/main/java/de/kuschku/quasseldroid/util/helper/LiveDataHelper.kt b/viewmodel/src/main/java/de/kuschku/quasseldroid/util/helper/LiveDataHelper.kt deleted file mode 100644 index b2ebd431b89750250f22b1d56f5f54b271756ac4..0000000000000000000000000000000000000000 --- a/viewmodel/src/main/java/de/kuschku/quasseldroid/util/helper/LiveDataHelper.kt +++ /dev/null @@ -1,121 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ -@file:Suppress("NOTHING_TO_INLINE") - -package de.kuschku.quasseldroid.util.helper - -import androidx.annotation.MainThread -import androidx.lifecycle.* -import io.reactivex.Observable - -@MainThread -inline fun <X, Y> LiveData<X?>.safeSwitchMap( - crossinline func: (X) -> LiveData<Y>? -): LiveData<Y> { - val result = MediatorLiveData<Y>() - result.addSource( - this, object : Observer<X?> { - var mSource: LiveData<Y>? = null - - override fun onChanged(x: X?) { - val newLiveData = if (x == null) null else func(x) - if (mSource === newLiveData) { - return - } - mSource?.let(result::removeSource) - mSource = newLiveData - if (newLiveData != null) { - result.addSource(newLiveData) { y -> result.value = y } - } else { - result.value = null - } - } - }) - return result -} - -@MainThread -inline fun <X, Y> LiveData<X>.switchMapNotNull( - crossinline func: (X) -> LiveData<Y>? -): LiveData<Y> { - val result = MediatorLiveData<Y>() - result.addSource( - this, object : Observer<X> { - var mSource: LiveData<Y>? = null - - override fun onChanged(x: X?) { - val newLiveData = if (x == null) null else func(x) - if (mSource === newLiveData) { - return - } - mSource?.let(result::removeSource) - mSource = newLiveData - if (newLiveData != null) { - result.addSource(newLiveData) { y -> result.value = y } - } else { - result.value = null - } - } - }) - return result -} - -@MainThread -inline fun <X, Y> LiveData<out X?>.map( - crossinline func: (X) -> Y? -): LiveData<Y?> { - val result = MediatorLiveData<Y?>() - result.addSource(this) { x -> - result.value = if (x == null) null else func.invoke(x) - } - return result -} - -@MainThread -inline fun <X> LiveData<X?>.or( - default: X -): LiveData<X> { - val result = object : MediatorLiveData<X>() { - override fun getValue() = super.getValue() ?: default - } - result.addSource(this) { x -> - result.value = x ?: default - } - return result -} - -inline fun <T> LiveData<T>.observeSticky(lifecycleOwner: LifecycleOwner, observer: Observer<T>) { - observe(lifecycleOwner, observer) - observer.onChanged(value) -} - -inline fun <T> LiveData<T>.observeForeverSticky(observer: Observer<T>) { - observeForever(observer) - observer.onChanged(value) -} - -inline fun <T> LiveData<T>.toObservable(lifecycleOwner: LifecycleOwner): Observable<T> = - Observable.fromPublisher(LiveDataReactiveStreams.toPublisher(lifecycleOwner, this)) - - -inline operator fun <T> LiveData<T>.invoke() = value - -inline operator fun <T, U> LiveData<T?>.invoke(f: (T) -> U?) = value?.let(f) - -inline fun <T, U> LiveData<T>.let(f: (T) -> U?) = value?.let(f) diff --git a/viewmodel/src/main/java/de/kuschku/quasseldroid/util/helper/LiveDataZipHelper.kt b/viewmodel/src/main/java/de/kuschku/quasseldroid/util/helper/LiveDataZipHelper.kt deleted file mode 100644 index b36edb44f239b633bd7eb84c093efd774857a772..0000000000000000000000000000000000000000 --- a/viewmodel/src/main/java/de/kuschku/quasseldroid/util/helper/LiveDataZipHelper.kt +++ /dev/null @@ -1,107 +0,0 @@ -/* - * Copyright (C) 2017 Mitchell Skaggs, Keturah Gadson, Ethan Holtgrieve, Nathan Skelton, - * Pattonville School District - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - */ -package de.kuschku.quasseldroid.util.helper - -import androidx.lifecycle.LiveData -import androidx.lifecycle.MediatorLiveData - - -/** - * This function creates a [LiveData] of a [Pair] of the two types provided. The resulting LiveData - * is updated whenever either input LiveData updates and both LiveData have updated at least once - * before. - * - * If the zip of A and B is C, and A and B are updated in this pattern: `AABA`, C would be updated - * twice (once with the second A value and first B value, and once with the third A value and first - * B value). - * - * @param a the first LiveData - * @param b the second LiveData - * @author Mitchell Skaggs - */ -fun <A, B> zipLiveData(a: LiveData<A>, b: LiveData<B>): LiveData<Pair<A, B>> { - return MediatorLiveData<Pair<A, B>>().apply { - var lastA: A? = null - var lastB: B? = null - - fun update() { - val localLastA = lastA - val localLastB = lastB - if (localLastA != null && localLastB != null) - this.value = Pair(localLastA, localLastB) - } - - addSource(a) { - lastA = it - update() - } - addSource(b) { - lastB = it - update() - } - } -} - -fun <A, B, C> zipLiveData(a: LiveData<A>, b: LiveData<B>, - c: LiveData<C>): LiveData<Triple<A, B, C>> { - return MediatorLiveData<Triple<A, B, C>>().apply { - var lastA: A? = null - var lastB: B? = null - var lastC: C? = null - - fun update() { - val localLastA = lastA - val localLastB = lastB - val localLastC = lastC - if (localLastA != null && localLastB != null && localLastC != null) - this.value = Triple(localLastA, localLastB, localLastC) - } - - addSource(a) { - lastA = it - update() - } - addSource(b) { - lastB = it - update() - } - addSource(c) { - lastC = it - update() - } - } -} - -/** - * This is merely an extension function for [zipLiveData]. - * - * @see zipLiveData - * @author Mitchell Skaggs - */ -fun <A, B> LiveData<A>.zip(b: LiveData<B>): LiveData<Pair<A, B>> = - zipLiveData(this, b) - -/** - * This is merely an extension function for [zipLiveData]. - * - * @see zipLiveData - * @author Mitchell Skaggs - */ -fun <A, B, C> LiveData<A>.zip(b: LiveData<B>, - c: LiveData<C>): LiveData<Triple<A, B, C>> = - zipLiveData(this, b, c) diff --git a/viewmodel/src/main/java/de/kuschku/quasseldroid/util/helper/ObservableHelper.kt b/viewmodel/src/main/java/de/kuschku/quasseldroid/util/helper/ObservableHelper.kt deleted file mode 100644 index 1969f1146be550f5a53c099ae6323efc199abdf2..0000000000000000000000000000000000000000 --- a/viewmodel/src/main/java/de/kuschku/quasseldroid/util/helper/ObservableHelper.kt +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ -@file:Suppress("NOTHING_TO_INLINE") - -package de.kuschku.quasseldroid.util.helper - -import androidx.lifecycle.LiveData -import androidx.lifecycle.LiveDataReactiveStreams -import de.kuschku.libquassel.util.compatibility.HandlerService -import io.reactivex.* -import io.reactivex.schedulers.Schedulers - -inline fun <T> Observable<T>.toLiveData( - strategy: BackpressureStrategy = BackpressureStrategy.LATEST, - handlerService: HandlerService? = null, - scheduler: Scheduler = handlerService?.scheduler ?: Schedulers.computation() -): LiveData<T> = - LiveDataReactiveStreams.fromPublisher(subscribeOn(scheduler).toFlowable(strategy)) - -inline fun <T> Maybe<T>.toLiveData( - handlerService: HandlerService? = null, - scheduler: Scheduler = handlerService?.scheduler ?: Schedulers.computation() -): LiveData<T> = - LiveDataReactiveStreams.fromPublisher(subscribeOn(scheduler).toFlowable()) - -inline fun <T> Flowable<T>.toLiveData( - handlerService: HandlerService? = null, - scheduler: Scheduler = handlerService?.scheduler ?: Schedulers.computation() -): LiveData<T> = LiveDataReactiveStreams.fromPublisher(subscribeOn(scheduler)) diff --git a/viewmodel/src/main/java/de/kuschku/quasseldroid/viewmodel/ArchiveViewModel.kt b/viewmodel/src/main/java/de/kuschku/quasseldroid/viewmodel/ArchiveViewModel.kt deleted file mode 100644 index 69acffe05ad6f697746518b654d0b94c231cfc9b..0000000000000000000000000000000000000000 --- a/viewmodel/src/main/java/de/kuschku/quasseldroid/viewmodel/ArchiveViewModel.kt +++ /dev/null @@ -1,86 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.viewmodel - -import android.os.Bundle -import de.kuschku.libquassel.protocol.BufferId -import de.kuschku.libquassel.protocol.NetworkId -import de.kuschku.libquassel.util.helper.safeValue -import io.reactivex.subjects.BehaviorSubject - -open class ArchiveViewModel : QuasselViewModel() { - val bufferViewConfigId = BehaviorSubject.createDefault(-1) - val visibleExpandedNetworks = BehaviorSubject.createDefault(emptyMap<NetworkId, Boolean>()) - val temporarilyExpandedNetworks = BehaviorSubject.createDefault(emptyMap<NetworkId, Boolean>()) - val permanentlyExpandedNetworks = BehaviorSubject.createDefault(emptyMap<NetworkId, Boolean>()) - val selectedBufferId = BehaviorSubject.createDefault(BufferId.MAX_VALUE) - - fun onSaveInstanceState(outState: Bundle) { - outState.putInt( - KEY_BUFFER_VIEW_CONFIG_ID, - bufferViewConfigId.safeValue) - outState.putSerializable( - KEY_VISIBLE_EXPANDED_NETWORKS, - HashMap(visibleExpandedNetworks.safeValue)) - outState.putSerializable( - KEY_TEMPORARILY_EXPANDED_NETWORKS, - HashMap(temporarilyExpandedNetworks.safeValue)) - outState.putSerializable( - KEY_PERMANENTLY_EXPANDED_NETWORKS, - HashMap(permanentlyExpandedNetworks.safeValue)) - outState.putInt( - KEY_SELECTED_BUFFER_ID, - selectedBufferId.safeValue.id) - } - - fun onRestoreInstanceState(savedInstanceState: Bundle) { - if (savedInstanceState.containsKey(KEY_BUFFER_VIEW_CONFIG_ID)) - bufferViewConfigId.onNext(savedInstanceState.getInt(KEY_BUFFER_VIEW_CONFIG_ID)) - if (savedInstanceState.containsKey(KEY_VISIBLE_EXPANDED_NETWORKS)) { - visibleExpandedNetworks.onNext( - savedInstanceState.getSerializable(KEY_VISIBLE_EXPANDED_NETWORKS) as? HashMap<NetworkId, Boolean> - ?: emptyMap() - ) - } - if (savedInstanceState.containsKey(KEY_TEMPORARILY_EXPANDED_NETWORKS)) { - temporarilyExpandedNetworks.onNext( - savedInstanceState.getSerializable(KEY_TEMPORARILY_EXPANDED_NETWORKS) as? HashMap<NetworkId, Boolean> - ?: emptyMap() - ) - } - if (savedInstanceState.containsKey(KEY_PERMANENTLY_EXPANDED_NETWORKS)) { - permanentlyExpandedNetworks.onNext( - savedInstanceState.getSerializable(KEY_PERMANENTLY_EXPANDED_NETWORKS) as? HashMap<NetworkId, Boolean> - ?: emptyMap() - ) - } - - if (savedInstanceState.containsKey(KEY_SELECTED_BUFFER_ID)) - selectedBufferId.onNext(BufferId(savedInstanceState.getInt(KEY_SELECTED_BUFFER_ID))) - } - - companion object { - const val KEY_BUFFER_VIEW_CONFIG_ID = "model_archive_bufferViewConfigId" - const val KEY_VISIBLE_EXPANDED_NETWORKS = "model_archive_visibleExpandedNetworks" - const val KEY_TEMPORARILY_EXPANDED_NETWORKS = "model_archive_temporarilyExpandedNetworks" - const val KEY_PERMANENTLY_EXPANDED_NETWORKS = "model_archive_permanentlyExpandedNetworks" - const val KEY_SELECTED_BUFFER_ID = "model_archive_selectedBufferId" - } -} diff --git a/viewmodel/src/main/java/de/kuschku/quasseldroid/viewmodel/ChatViewModel.kt b/viewmodel/src/main/java/de/kuschku/quasseldroid/viewmodel/ChatViewModel.kt deleted file mode 100644 index dd800dfad356e319368b53b631c4f96770f5c6f5..0000000000000000000000000000000000000000 --- a/viewmodel/src/main/java/de/kuschku/quasseldroid/viewmodel/ChatViewModel.kt +++ /dev/null @@ -1,205 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.viewmodel - -import android.os.Bundle -import de.kuschku.libquassel.protocol.BufferId -import de.kuschku.libquassel.protocol.MsgId -import de.kuschku.libquassel.protocol.NetworkId -import de.kuschku.libquassel.util.Optional -import de.kuschku.libquassel.util.helper.safeValue -import de.kuschku.quasseldroid.viewmodel.data.FormattedMessage -import io.reactivex.subjects.BehaviorSubject -import io.reactivex.subjects.PublishSubject - -open class ChatViewModel : QuasselViewModel() { - val selectedMessages = BehaviorSubject.createDefault(emptyMap<MsgId, FormattedMessage>()) - val bufferSearch = BehaviorSubject.createDefault("") - val expandedMessages = BehaviorSubject.createDefault(emptySet<MsgId>()) - val bufferId = BehaviorSubject.createDefault(BufferId.MAX_VALUE) - val bufferViewConfigId = BehaviorSubject.createDefault(-1) - val recentlySentMessages = BehaviorSubject.createDefault(emptyList<CharSequence>()) - val recentlySentMessageIndex = BehaviorSubject.createDefault(-1) - val inputCache = BehaviorSubject.createDefault<CharSequence>("") - val showHidden = BehaviorSubject.createDefault(false) - val bufferSearchTemporarilyVisible = BehaviorSubject.createDefault(false) - val expandedNetworks = BehaviorSubject.createDefault(emptyMap<NetworkId, Boolean>()) - val selectedBufferId = BehaviorSubject.createDefault(BufferId.MAX_VALUE) - - val chatToJoin = BehaviorSubject.createDefault(Optional.empty<Pair<NetworkId, String>>()) - - val stateReset = BehaviorSubject.create<Unit>() - val bufferOpened = PublishSubject.create<Unit>() - - val loadKey = BehaviorSubject.create<MsgId>() - - fun onSaveInstanceState(outState: Bundle) { - /* - outState.putSerializable( - KEY_SELECTED_MESSAGES, - HashMap(selectedMessages.value)) - */ - outState.putString( - KEY_BUFFER_SEARCH, - bufferSearch.safeValue) - outState.putLongArray( - KEY_EXPANDED_MESSAGES, - expandedMessages.safeValue.map(MsgId::id).toLongArray()) - outState.putInt( - KEY_BUFFER_ID, - bufferId.safeValue.id) - outState.putInt( - KEY_BUFFER_VIEW_CONFIG_ID, - bufferViewConfigId.safeValue) - outState.putCharSequenceArray( - KEY_RECENTLY_SENT_MESSAGES, - recentlySentMessages.safeValue.toTypedArray()) - outState.putBoolean( - KEY_SHOW_HIDDEN, - showHidden.safeValue) - outState.putBoolean( - KEY_BUFFER_SEARCH_TEMPORARILY_VISIBLE, - bufferSearchTemporarilyVisible.safeValue) - outState.putSerializable( - KEY_EXPANDED_NETWORKS, - HashMap(expandedNetworks.safeValue)) - outState.putInt( - KEY_SELECTED_BUFFER_ID, - selectedBufferId.safeValue.id) - } - - fun onRestoreInstanceState(savedInstanceState: Bundle) { - /* - if (savedInstanceState.containsKey(KEY_SELECTED_MESSAGES)) { - selectedMessages.onNext( - savedInstanceState.getSerializable(KEY_SELECTED_MESSAGES) as? HashMap<MsgId, FormattedMessage> - ?: emptyMap() - ) - } - */ - - if (savedInstanceState.containsKey(KEY_BUFFER_SEARCH)) - bufferSearch.onNext(savedInstanceState.getString(KEY_BUFFER_SEARCH, null)) - - if (savedInstanceState.containsKey(KEY_EXPANDED_MESSAGES)) - expandedMessages.onNext(savedInstanceState.getLongArray(KEY_EXPANDED_MESSAGES)?.map(::MsgId)?.toSet().orEmpty()) - - if (savedInstanceState.containsKey(KEY_BUFFER_ID)) - bufferId.onNext(BufferId(savedInstanceState.getInt(KEY_BUFFER_ID))) - - if (savedInstanceState.containsKey(KEY_BUFFER_VIEW_CONFIG_ID)) - bufferViewConfigId.onNext(savedInstanceState.getInt(KEY_BUFFER_VIEW_CONFIG_ID)) - - if (savedInstanceState.containsKey(KEY_RECENTLY_SENT_MESSAGES)) - recentlySentMessages.onNext(savedInstanceState.getCharSequenceArray(KEY_RECENTLY_SENT_MESSAGES)?.toList().orEmpty()) - - if (savedInstanceState.containsKey(KEY_SHOW_HIDDEN)) - showHidden.onNext(savedInstanceState.getBoolean(KEY_SHOW_HIDDEN)) - - if (savedInstanceState.containsKey(KEY_BUFFER_SEARCH_TEMPORARILY_VISIBLE)) - bufferSearchTemporarilyVisible.onNext(savedInstanceState.getBoolean( - KEY_BUFFER_SEARCH_TEMPORARILY_VISIBLE)) - - if (savedInstanceState.containsKey(KEY_EXPANDED_NETWORKS)) { - expandedNetworks.onNext( - savedInstanceState.getSerializable(KEY_EXPANDED_NETWORKS) as? HashMap<NetworkId, Boolean> - ?: emptyMap() - ) - } - - if (savedInstanceState.containsKey(KEY_SELECTED_BUFFER_ID)) - selectedBufferId.onNext(BufferId(savedInstanceState.getInt(KEY_SELECTED_BUFFER_ID))) - } - - fun resetAccount() { - bufferViewConfigId.onNext(-1) - selectedMessages.onNext(emptyMap()) - expandedMessages.onNext(emptySet()) - recentlySentMessages.onNext(emptyList()) - stateReset.onNext(Unit) - } - - fun selectedMessagesToggle(key: MsgId, value: FormattedMessage): Int { - val set = selectedMessages.safeValue - val result = if (set.containsKey(key)) set - key else set + Pair(key, value) - selectedMessages.onNext(result) - return result.size - } - - fun addRecentlySentMessage(message: CharSequence) { - recentlySentMessages.onNext( - listOf(message) + recentlySentMessages.safeValue - .orEmpty() - .filter { it != message } - .take(MAX_RECENT_MESSAGES - 1) - ) - } - - private fun recentMessagesChange(change: Int) { - recentlySentMessageIndex.onNext(recentMessagesChangeInternal( - recentlySentMessageIndex.safeValue, - recentlySentMessages.safeValue.size, - change - )) - } - - fun recentMessagesValue() = - if (recentlySentMessageIndex.safeValue == -1) inputCache.safeValue - else recentlySentMessages.safeValue[recentlySentMessageIndex.safeValue] - - fun recentMessagesIndexDown(content: CharSequence): CharSequence { - if (recentlySentMessageIndex.safeValue == -1) { - inputCache.onNext(content) - } - recentMessagesChange(+1) - return recentMessagesValue() - } - - fun recentMessagesIndexUp(): CharSequence? { - if (recentlySentMessageIndex.safeValue > -1) { - recentMessagesChange(-1) - } - return recentMessagesValue() - } - - fun recentMessagesIndexReset(): CharSequence? { - recentlySentMessageIndex.onNext(-1) - return recentMessagesValue() - } - - companion object { - const val KEY_SELECTED_MESSAGES = "model_chat_selectedMessages" - const val KEY_BUFFER_SEARCH = "model_chat_bufferSearch" - const val KEY_EXPANDED_MESSAGES = "model_chat_expandedMessages" - const val KEY_BUFFER_ID = "model_chat_bufferId" - const val KEY_BUFFER_VIEW_CONFIG_ID = "model_chat_bufferViewConfigId" - const val KEY_RECENTLY_SENT_MESSAGES = "model_chat_recentlySentMessages" - const val KEY_SHOW_HIDDEN = "model_chat_showHidden" - const val KEY_BUFFER_SEARCH_TEMPORARILY_VISIBLE = "model_chat_bufferSearchTemporarilyVisible" - const val KEY_EXPANDED_NETWORKS = "model_chat_expandedNetworks" - const val KEY_SELECTED_BUFFER_ID = "model_chat_selectedBufferId" - - const val MAX_RECENT_MESSAGES = 20 - - fun recentMessagesChangeInternal(current: Int, size: Int, change: Int) = - if (current + change < 0 || size == 0) -1 - else (size + current + change) % size - } -} diff --git a/viewmodel/src/main/java/de/kuschku/quasseldroid/viewmodel/EditorViewModel.kt b/viewmodel/src/main/java/de/kuschku/quasseldroid/viewmodel/EditorViewModel.kt deleted file mode 100644 index e09e6f9bbd720cc63d91cb81ab5f2f2286108a0a..0000000000000000000000000000000000000000 --- a/viewmodel/src/main/java/de/kuschku/quasseldroid/viewmodel/EditorViewModel.kt +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.viewmodel - -import androidx.lifecycle.ViewModel -import io.reactivex.Observable -import io.reactivex.subjects.BehaviorSubject - -class EditorViewModel : ViewModel() { - val lastWord = BehaviorSubject.create<Observable<Pair<String, IntRange>>>() -} diff --git a/viewmodel/src/main/java/de/kuschku/quasseldroid/viewmodel/QuasselViewModel.kt b/viewmodel/src/main/java/de/kuschku/quasseldroid/viewmodel/QuasselViewModel.kt deleted file mode 100644 index 9ff2869233dfc90c28277a28d24dd998230d9efb..0000000000000000000000000000000000000000 --- a/viewmodel/src/main/java/de/kuschku/quasseldroid/viewmodel/QuasselViewModel.kt +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.viewmodel - -import androidx.lifecycle.ViewModel -import de.kuschku.libquassel.util.Optional -import de.kuschku.quasseldroid.Backend -import io.reactivex.Observable -import io.reactivex.subjects.BehaviorSubject - -open class QuasselViewModel : ViewModel() { - val backendWrapper = BehaviorSubject.createDefault(Observable.empty<Optional<Backend>>()) -} diff --git a/viewmodel/src/main/java/de/kuschku/quasseldroid/viewmodel/QueryCreateViewModel.kt b/viewmodel/src/main/java/de/kuschku/quasseldroid/viewmodel/QueryCreateViewModel.kt deleted file mode 100644 index 770bf6b24d48d33ac5fd20624c347f33761b8626..0000000000000000000000000000000000000000 --- a/viewmodel/src/main/java/de/kuschku/quasseldroid/viewmodel/QueryCreateViewModel.kt +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.viewmodel - -import androidx.lifecycle.ViewModel -import de.kuschku.libquassel.protocol.NetworkId -import io.reactivex.subjects.BehaviorSubject - -class QueryCreateViewModel : ViewModel() { - val networkId = BehaviorSubject.createDefault(NetworkId(0)) - val nickName = BehaviorSubject.createDefault("") -} diff --git a/viewmodel/src/main/java/de/kuschku/quasseldroid/viewmodel/data/AutoCompleteItem.kt b/viewmodel/src/main/java/de/kuschku/quasseldroid/viewmodel/data/AutoCompleteItem.kt deleted file mode 100644 index 825debb9a93d7a1fde7b109ed62c8f302db73779..0000000000000000000000000000000000000000 --- a/viewmodel/src/main/java/de/kuschku/quasseldroid/viewmodel/data/AutoCompleteItem.kt +++ /dev/null @@ -1,157 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.viewmodel.data - -import android.graphics.drawable.Drawable -import de.kuschku.libquassel.quassel.BufferInfo -import de.kuschku.libquassel.quassel.syncables.interfaces.INetwork - -sealed class AutoCompleteItem(open val name: String, val suffix: String, private val type: Int) : - Comparable<AutoCompleteItem> { - override fun compareTo(other: AutoCompleteItem) = when { - this.type != other.type -> this.type.compareTo(other.type) - else -> this.name.compareTo(other.name) - } - - override fun equals(other: Any?): Boolean { - if (this === other) return true - if (other !is AutoCompleteItem) return false - - if (name != other.name) return false - if (suffix != other.suffix) return false - if (type != other.type) return false - - return true - } - - override fun hashCode(): Int { - var result = name.hashCode() - result = 31 * result + suffix.hashCode() - result = 31 * result + type - return result - } - - - data class UserItem( - val nick: String, - val hostMask: String, - val modes: String, - val lowestMode: Int, - val realname: CharSequence, - val away: Boolean, - val self: Boolean, - val networkCasemapping: String?, - val avatarUrls: List<Avatar> = emptyList(), - val fallbackDrawable: Drawable? = null, - val displayNick: CharSequence? = null - ) : AutoCompleteItem(nick, ": ", 0) { - override fun equals(other: Any?): Boolean { - if (this === other) return true - if (javaClass != other?.javaClass) return false - - other as UserItem - - if (nick != other.nick) return false - if (hostMask != other.hostMask) return false - if (modes != other.modes) return false - if (lowestMode != other.lowestMode) return false - if (realname != other.realname) return false - if (away != other.away) return false - if (self != other.self) return false - if (networkCasemapping != other.networkCasemapping) return false - if (avatarUrls != other.avatarUrls) return false - if (displayNick != other.displayNick) return false - - return true - } - - override fun hashCode(): Int { - var result = nick.hashCode() - result = 31 * result + hostMask.hashCode() - result = 31 * result + modes.hashCode() - result = 31 * result + lowestMode - result = 31 * result + realname.hashCode() - result = 31 * result + away.hashCode() - result = 31 * result + self.hashCode() - result = 31 * result + (networkCasemapping?.hashCode() ?: 0) - result = 31 * result + avatarUrls.hashCode() - result = 31 * result + (displayNick?.hashCode() ?: 0) - return result - } - } - - data class AliasItem( - val alias: String?, - val expansion: String? - ) : AutoCompleteItem(alias ?: "", " ", 1) - - data class ChannelItem( - val info: BufferInfo, - val network: INetwork.NetworkInfo, - val bufferStatus: BufferStatus, - val description: CharSequence, - val icon: Drawable? = null - ) : AutoCompleteItem(info.bufferName ?: "", " ", 2) { - override fun equals(other: Any?): Boolean { - if (this === other) return true - if (javaClass != other?.javaClass) return false - - other as ChannelItem - - if (info != other.info) return false - if (network != other.network) return false - if (bufferStatus != other.bufferStatus) return false - if (description != other.description) return false - - return true - } - - override fun hashCode(): Int { - var result = info.hashCode() - result = 31 * result + network.hashCode() - result = 31 * result + bufferStatus.hashCode() - result = 31 * result + description.hashCode() - return result - } - } - - data class EmojiItem( - val shortCodes: List<String>, - val replacement: String - ) : AutoCompleteItem(replacement, " ", 3) { - override fun equals(other: Any?): Boolean { - if (this === other) return true - if (javaClass != other?.javaClass) return false - - other as EmojiItem - - if (shortCodes != other.shortCodes) return false - if (replacement != other.replacement) return false - - return true - } - - override fun hashCode(): Int { - var result = shortCodes.hashCode() - result = 31 * result + replacement.hashCode() - return result - } - } -} diff --git a/viewmodel/src/main/java/de/kuschku/quasseldroid/viewmodel/data/Avatar.kt b/viewmodel/src/main/java/de/kuschku/quasseldroid/viewmodel/data/Avatar.kt deleted file mode 100644 index d8a3effcb44f3ac2d06ca9be023b9753fd8ad3f4..0000000000000000000000000000000000000000 --- a/viewmodel/src/main/java/de/kuschku/quasseldroid/viewmodel/data/Avatar.kt +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.viewmodel.data - -import java.io.Serializable - -sealed class Avatar : Serializable { - data class NativeAvatar(val url: String) : Avatar() - data class IRCCloudAvatar(val url: String) : Avatar() - data class GravatarAvatar(val url: String) : Avatar() - data class MatrixAvatar(val userId: String, val size: Int?) : Avatar() -} diff --git a/viewmodel/src/main/java/de/kuschku/quasseldroid/viewmodel/data/BufferData.kt b/viewmodel/src/main/java/de/kuschku/quasseldroid/viewmodel/data/BufferData.kt deleted file mode 100644 index 2b2a18a0f74e0a1f82e40e7b374303c032c65a8b..0000000000000000000000000000000000000000 --- a/viewmodel/src/main/java/de/kuschku/quasseldroid/viewmodel/data/BufferData.kt +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.viewmodel.data - -import de.kuschku.libquassel.quassel.BufferInfo -import de.kuschku.libquassel.quassel.syncables.IrcUser -import de.kuschku.libquassel.quassel.syncables.Network - -data class BufferData( - val info: BufferInfo? = null, - val network: Network? = null, - val description: String? = null, - val userCount: Int = 0, - val ircUser: IrcUser? = null -) diff --git a/viewmodel/src/main/java/de/kuschku/quasseldroid/viewmodel/data/BufferHiddenState.kt b/viewmodel/src/main/java/de/kuschku/quasseldroid/viewmodel/data/BufferHiddenState.kt deleted file mode 100644 index 63159cc94884966803008d8aaaddf1ae6d403140..0000000000000000000000000000000000000000 --- a/viewmodel/src/main/java/de/kuschku/quasseldroid/viewmodel/data/BufferHiddenState.kt +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.viewmodel.data - -enum class BufferHiddenState { - VISIBLE, - HIDDEN_TEMPORARY, - HIDDEN_PERMANENT -} diff --git a/viewmodel/src/main/java/de/kuschku/quasseldroid/viewmodel/data/BufferListItem.kt b/viewmodel/src/main/java/de/kuschku/quasseldroid/viewmodel/data/BufferListItem.kt deleted file mode 100644 index 23c584d877edc10c7a4010ddf39742ba23f92303..0000000000000000000000000000000000000000 --- a/viewmodel/src/main/java/de/kuschku/quasseldroid/viewmodel/data/BufferListItem.kt +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.viewmodel.data - -data class BufferListItem( - val props: BufferProps, - val state: BufferState -) diff --git a/viewmodel/src/main/java/de/kuschku/quasseldroid/viewmodel/data/BufferProps.kt b/viewmodel/src/main/java/de/kuschku/quasseldroid/viewmodel/data/BufferProps.kt deleted file mode 100644 index 3994546abfe490e572c1234cb83b6524e5b89435..0000000000000000000000000000000000000000 --- a/viewmodel/src/main/java/de/kuschku/quasseldroid/viewmodel/data/BufferProps.kt +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.viewmodel.data - -import android.graphics.drawable.Drawable -import de.kuschku.libquassel.protocol.Buffer_Activities -import de.kuschku.libquassel.protocol.Message_Types -import de.kuschku.libquassel.quassel.BufferInfo -import de.kuschku.libquassel.quassel.syncables.IrcUser -import de.kuschku.libquassel.quassel.syncables.interfaces.INetwork - -data class BufferProps( - val info: BufferInfo, - val network: INetwork.NetworkInfo, - val networkConnectionState: INetwork.ConnectionState, - val bufferStatus: BufferStatus, - val description: CharSequence, - val activity: Message_Types, - val highlights: Int = 0, - val bufferActivity: Buffer_Activities = BufferInfo.Activity.of( - BufferInfo.Activity.NoActivity - ), - val name: CharSequence = "", - val ircUser: IrcUser? = null, - val avatarUrls: List<Avatar> = emptyList(), - val fallbackDrawable: Drawable? = null, - val matchMode: MatchMode = MatchMode.EXACT -) { - override fun equals(other: Any?): Boolean { - if (this === other) return true - if (javaClass != other?.javaClass) return false - - other as BufferProps - - if (info != other.info) return false - if (network != other.network) return false - if (networkConnectionState != other.networkConnectionState) return false - if (bufferStatus != other.bufferStatus) return false - if (description != other.description) return false - if (activity != other.activity) return false - if (highlights != other.highlights) return false - if (bufferActivity != other.bufferActivity) return false - if (ircUser != other.ircUser) return false - if (avatarUrls != other.avatarUrls) return false - - return true - } - - override fun hashCode(): Int { - var result = info.hashCode() - result = 31 * result + network.hashCode() - result = 31 * result + networkConnectionState.hashCode() - result = 31 * result + bufferStatus.hashCode() - result = 31 * result + description.hashCode() - result = 31 * result + activity.hashCode() - result = 31 * result + highlights - result = 31 * result + bufferActivity.hashCode() - result = 31 * result + (ircUser?.hashCode() ?: 0) - result = 31 * result + avatarUrls.hashCode() - return result - } -} diff --git a/viewmodel/src/main/java/de/kuschku/quasseldroid/viewmodel/data/BufferState.kt b/viewmodel/src/main/java/de/kuschku/quasseldroid/viewmodel/data/BufferState.kt deleted file mode 100644 index baf20dababf94d03a732fdf88159074a5455c85f..0000000000000000000000000000000000000000 --- a/viewmodel/src/main/java/de/kuschku/quasseldroid/viewmodel/data/BufferState.kt +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.viewmodel.data - -data class BufferState( - val networkExpanded: Boolean, - val selected: Boolean, - val showHandle: Boolean -) diff --git a/viewmodel/src/main/java/de/kuschku/quasseldroid/viewmodel/data/BufferStatus.kt b/viewmodel/src/main/java/de/kuschku/quasseldroid/viewmodel/data/BufferStatus.kt deleted file mode 100644 index 8267e2ced7446cc9592f5c89ee4594a58b74d81c..0000000000000000000000000000000000000000 --- a/viewmodel/src/main/java/de/kuschku/quasseldroid/viewmodel/data/BufferStatus.kt +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.viewmodel.data - -enum class BufferStatus(val value: UByte) { - ONLINE(0u), - AWAY(1u), - OFFLINE(2u); - - companion object { - private val map = values().associateBy { it.value } - fun of(value: UByte) = map[value] - } -} diff --git a/viewmodel/src/main/java/de/kuschku/quasseldroid/viewmodel/data/FormattedMessage.kt b/viewmodel/src/main/java/de/kuschku/quasseldroid/viewmodel/data/FormattedMessage.kt deleted file mode 100644 index ee21342caaa34486f44ae6ca31958fd3ef9a59c8..0000000000000000000000000000000000000000 --- a/viewmodel/src/main/java/de/kuschku/quasseldroid/viewmodel/data/FormattedMessage.kt +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.viewmodel.data - -import android.graphics.drawable.Drawable -import de.kuschku.quasseldroid.persistence.models.MessageData -import java.io.Serializable - -class FormattedMessage( - val original: MessageData, - val time: CharSequence, - val dayChange: CharSequence? = null, - val name: CharSequence? = null, - val content: CharSequence? = null, - val combined: CharSequence, - val fallbackDrawable: Drawable? = null, - val realName: CharSequence? = null, - val avatarUrls: List<Avatar> = emptyList(), - val urls: List<String> = emptyList(), - val hasDayChange: Boolean, - val isSelected: Boolean, - val isExpanded: Boolean, - val isMarkerLine: Boolean, - val hasSpoilers: Boolean -) : Serializable { - override fun equals(other: Any?): Boolean { - if (this === other) return true - if (javaClass != other?.javaClass) return false - - other as FormattedMessage - - if (original != other.original) return false - if (time != other.time) return false - if (dayChange != other.dayChange) return false - if (name != other.name) return false - if (content != other.content) return false - if (combined != other.combined) return false - if (realName != other.realName) return false - if (avatarUrls != other.avatarUrls) return false - if (urls != other.urls) return false - if (hasDayChange != other.hasDayChange) return false - if (isSelected != other.isSelected) return false - if (isExpanded != other.isExpanded) return false - if (isMarkerLine != other.isMarkerLine) return false - - return true - } - - override fun hashCode(): Int { - var result = original.hashCode() - result = 31 * result + time.hashCode() - result = 31 * result + (dayChange?.hashCode() ?: 0) - result = 31 * result + (name?.hashCode() ?: 0) - result = 31 * result + (content?.hashCode() ?: 0) - result = 31 * result + combined.hashCode() - result = 31 * result + (realName?.hashCode() ?: 0) - result = 31 * result + avatarUrls.hashCode() - result = 31 * result + urls.hashCode() - result = 31 * result + hasDayChange.hashCode() - result = 31 * result + isSelected.hashCode() - result = 31 * result + isExpanded.hashCode() - result = 31 * result + isMarkerLine.hashCode() - return result - } -} diff --git a/viewmodel/src/main/java/de/kuschku/quasseldroid/viewmodel/data/IrcUserItem.kt b/viewmodel/src/main/java/de/kuschku/quasseldroid/viewmodel/data/IrcUserItem.kt deleted file mode 100644 index d593c47925ffe22ee846b0c5da62dff8b5a8f7a8..0000000000000000000000000000000000000000 --- a/viewmodel/src/main/java/de/kuschku/quasseldroid/viewmodel/data/IrcUserItem.kt +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.viewmodel.data - -import android.graphics.drawable.Drawable -import de.kuschku.libquassel.protocol.NetworkId - -data class IrcUserItem( - val networkId: NetworkId, - val nick: String, - val modes: String, - val lowestMode: Int, - val realname: CharSequence, - val hostmask: String, - val away: Boolean, - val self: Boolean, - val networkCasemapping: String?, - val avatarUrls: List<Avatar> = emptyList(), - val initial: String? = "", - val fallbackDrawable: Drawable? = null, - val displayNick: CharSequence? = null -) diff --git a/viewmodel/src/main/java/de/kuschku/quasseldroid/viewmodel/data/MatchMode.kt b/viewmodel/src/main/java/de/kuschku/quasseldroid/viewmodel/data/MatchMode.kt deleted file mode 100644 index bd0411d9e407df6dabb4d3c7e3807883d16a345d..0000000000000000000000000000000000000000 --- a/viewmodel/src/main/java/de/kuschku/quasseldroid/viewmodel/data/MatchMode.kt +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.viewmodel.data - -enum class MatchMode(val priority: Int) { - EXACT(0), - START(1), - CONTAINS(2); -} diff --git a/viewmodel/src/main/java/de/kuschku/quasseldroid/viewmodel/data/SelectedBufferItem.kt b/viewmodel/src/main/java/de/kuschku/quasseldroid/viewmodel/data/SelectedBufferItem.kt deleted file mode 100644 index 0cb07bd950fb129301ec0da90ea2e617152deb2a..0000000000000000000000000000000000000000 --- a/viewmodel/src/main/java/de/kuschku/quasseldroid/viewmodel/data/SelectedBufferItem.kt +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.viewmodel.data - -import de.kuschku.libquassel.quassel.BufferInfo -import de.kuschku.libquassel.quassel.syncables.interfaces.INetwork - -data class SelectedBufferItem( - val info: BufferInfo? = null, - val connectionState: INetwork.ConnectionState = INetwork.ConnectionState.Disconnected, - val joined: Boolean = false, - val hiddenState: BufferHiddenState = BufferHiddenState.VISIBLE -) diff --git a/viewmodel/src/main/java/de/kuschku/quasseldroid/viewmodel/helper/ArchiveViewModelHelper.kt b/viewmodel/src/main/java/de/kuschku/quasseldroid/viewmodel/helper/ArchiveViewModelHelper.kt deleted file mode 100644 index eb90bf2fd8b6a172de94586862fc16dbd5348691..0000000000000000000000000000000000000000 --- a/viewmodel/src/main/java/de/kuschku/quasseldroid/viewmodel/helper/ArchiveViewModelHelper.kt +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.viewmodel.helper - -import de.kuschku.libquassel.protocol.BufferId -import de.kuschku.libquassel.quassel.syncables.BufferViewConfig -import de.kuschku.libquassel.util.Optional -import de.kuschku.libquassel.util.helper.flatMapSwitchMap -import de.kuschku.libquassel.util.helper.mapSwitchMap -import de.kuschku.quasseldroid.viewmodel.ArchiveViewModel -import de.kuschku.quasseldroid.viewmodel.QuasselViewModel -import de.kuschku.quasseldroid.viewmodel.data.BufferHiddenState -import io.reactivex.Observable -import javax.inject.Inject - -open class ArchiveViewModelHelper @Inject constructor( - val archive: ArchiveViewModel, - quassel: QuasselViewModel -) : QuasselViewModelHelper(quassel) { - val bufferViewConfig = bufferViewManager.flatMapSwitchMap { manager -> - archive.bufferViewConfigId.map { id -> - Optional.ofNullable(manager.bufferViewConfig(id)) - }.mapSwitchMap(BufferViewConfig::liveUpdates) - } - - fun processArchiveBufferList( - bufferListType: BufferHiddenState, - showHandle: Boolean, - filtered: Observable<Pair<Map<BufferId, Int>, Int>> - ) = filterBufferList( - processBufferList( - bufferViewConfig, - filtered, - bufferListType = bufferListType, - showAllNetworks = false - ), - when (bufferListType) { - BufferHiddenState.VISIBLE -> archive.visibleExpandedNetworks - BufferHiddenState.HIDDEN_TEMPORARY -> archive.temporarilyExpandedNetworks - BufferHiddenState.HIDDEN_PERMANENT -> archive.permanentlyExpandedNetworks - }, - archive.selectedBufferId, - showHandle - ) - - val selectedBuffer = processSelectedBuffer(bufferViewConfig, archive.selectedBufferId) -} diff --git a/viewmodel/src/main/java/de/kuschku/quasseldroid/viewmodel/helper/ChatViewModelHelper.kt b/viewmodel/src/main/java/de/kuschku/quasseldroid/viewmodel/helper/ChatViewModelHelper.kt deleted file mode 100644 index 1458f0e23700f88138c216ddaf2791ff752f4189..0000000000000000000000000000000000000000 --- a/viewmodel/src/main/java/de/kuschku/quasseldroid/viewmodel/helper/ChatViewModelHelper.kt +++ /dev/null @@ -1,187 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.viewmodel.helper - -import de.kuschku.libquassel.protocol.BufferId -import de.kuschku.libquassel.protocol.Buffer_Type -import de.kuschku.libquassel.quassel.BufferInfo -import de.kuschku.libquassel.quassel.syncables.BufferViewConfig -import de.kuschku.libquassel.quassel.syncables.IrcChannel -import de.kuschku.libquassel.quassel.syncables.IrcUser -import de.kuschku.libquassel.util.Optional -import de.kuschku.libquassel.util.flag.hasFlag -import de.kuschku.libquassel.util.helper.* -import de.kuschku.quasseldroid.viewmodel.ChatViewModel -import de.kuschku.quasseldroid.viewmodel.QuasselViewModel -import de.kuschku.quasseldroid.viewmodel.data.BufferData -import de.kuschku.quasseldroid.viewmodel.data.IrcUserItem -import io.reactivex.Observable -import java.util.concurrent.TimeUnit -import javax.inject.Inject - -open class ChatViewModelHelper @Inject constructor( - val chat: ChatViewModel, - quassel: QuasselViewModel -) : QuasselViewModelHelper(quassel) { - val bufferViewConfig = bufferViewManager.flatMapSwitchMap { manager -> - chat.bufferViewConfigId.map { id -> - Optional.ofNullable(manager.bufferViewConfig(id)) - }.mapSwitchMap(BufferViewConfig::liveUpdates) - } - - val network = combineLatest(bufferSyncer, networks, chat.bufferId) - .map { (syncer, networks, buffer) -> - Optional.ofNullable(syncer.orNull()?.bufferInfo(buffer)?.let { networks[it.networkId] }) - } - - /** - * An observable of the changes of the markerline, as pairs of `(old, new)` - */ - val markerLine = connectedSession.mapSwitchMap { currentSession -> - chat.bufferId.safeSwitchMap { currentBuffer -> - // Get a stream of the latest marker line - currentSession.bufferSyncer.liveMarkerLine(currentBuffer) - } - } - - val bufferData = combineLatest(connectedSession, chat.bufferId) - .safeSwitchMap { (sessionOptional, id) -> - val session = sessionOptional.orNull() - val bufferSyncer = session?.bufferSyncer - if (bufferSyncer != null) { - session.liveNetworks().safeSwitchMap { networks -> - bufferSyncer.liveBufferInfos().safeSwitchMap { - val info = bufferSyncer.bufferInfo(id) - val network = networks[info?.networkId] - if (info == null || network == null) { - Observable.just(BufferData()) - } else { - when (info.type.toInt()) { - BufferInfo.Type.QueryBuffer.toInt() -> { - network.liveIrcUser(info.bufferName).safeSwitchMap { - it.updates().map { user -> - BufferData( - info = info, - network = network, - description = user.realName(), - ircUser = - if (user == IrcUser.NULL) null - else user - ) - } - } - } - BufferInfo.Type.ChannelBuffer.toInt() -> { - network.liveIrcChannel( - info.bufferName - ).safeSwitchMap { channel -> - channel.updates().map { - BufferData( - info = info, - network = network, - description = it.topic(), - userCount = it.userCount() - ) - } - } - } - BufferInfo.Type.StatusBuffer.toInt() -> { - network.liveConnectionState().map { - BufferData( - info = info, - network = network - ) - } - } - else -> Observable.just( - BufferData( - description = "type is unknown: ${info.type.toInt()}" - ) - ) - } - } - } - } - } else { - Observable.just(BufferData()) - } - } - val bufferDataThrottled = - bufferData.distinctUntilChanged().throttleLast(100, TimeUnit.MILLISECONDS) - - val nickData: Observable<List<IrcUserItem>> = combineLatest(connectedSession, chat.bufferId) - .safeSwitchMap { (sessionOptional, buffer) -> - val session = sessionOptional.orNull() - val bufferSyncer = session?.bufferSyncer - val bufferInfo = bufferSyncer?.bufferInfo(buffer) - if (bufferInfo?.type?.hasFlag(Buffer_Type.ChannelBuffer) == true) { - session.liveNetworks().safeSwitchMap { networks -> - val network = networks[bufferInfo.networkId] - network?.liveIrcChannel(bufferInfo.bufferName)?.switchMapNullable(IrcChannel.NULL) { ircChannel -> - ircChannel?.liveIrcUsers()?.safeSwitchMap { users -> - combineLatest<IrcUserItem>( - users.mapNotNull<IrcUser, Observable<IrcUserItem>> { - it.updates().map { user -> - val userModes = ircChannel.userModes(user) - val prefixModes = network.prefixModes() - - val lowestMode = userModes.asSequence().mapNotNull { - prefixModes.indexOf(it) - }.min() ?: prefixModes.size - - IrcUserItem( - bufferInfo.networkId, - user.nick(), - network.modesToPrefixes(userModes), - lowestMode, - user.realName(), - user.hostMask(), - user.isAway(), - user.network().isMyNick(user.nick()), - network.support("CASEMAPPING") - ) - } - }.toList() - ) - } ?: Observable.just(emptyList()) - } ?: Observable.just(emptyList()) - } - } else { - Observable.just(emptyList()) - } - } - val nickDataThrottled = - nickData.distinctUntilChanged().throttleLast(100, TimeUnit.MILLISECONDS) - - val selectedBuffer = processSelectedBuffer(bufferViewConfig, chat.selectedBufferId) - - fun processChatBufferList( - filtered: Observable<Pair<Map<BufferId, Int>, Int>> - ) = filterBufferList( - processBufferList( - bufferViewConfig, - filtered, - bufferSearch = chat.bufferSearch - ), - chat.expandedNetworks, - chat.selectedBufferId, - showHandle = false - ) -} diff --git a/viewmodel/src/main/java/de/kuschku/quasseldroid/viewmodel/helper/EditorViewModelHelper.kt b/viewmodel/src/main/java/de/kuschku/quasseldroid/viewmodel/helper/EditorViewModelHelper.kt deleted file mode 100644 index cdc936775dad0a0d8dd882126da213334dc11be2..0000000000000000000000000000000000000000 --- a/viewmodel/src/main/java/de/kuschku/quasseldroid/viewmodel/helper/EditorViewModelHelper.kt +++ /dev/null @@ -1,199 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.viewmodel.helper - -import de.kuschku.libquassel.protocol.BufferId -import de.kuschku.libquassel.protocol.Buffer_Type -import de.kuschku.libquassel.quassel.syncables.AliasManager -import de.kuschku.libquassel.quassel.syncables.IrcChannel -import de.kuschku.libquassel.quassel.syncables.IrcUser -import de.kuschku.libquassel.quassel.syncables.Network -import de.kuschku.libquassel.session.ISession -import de.kuschku.libquassel.util.Optional -import de.kuschku.libquassel.util.flag.hasFlag -import de.kuschku.libquassel.util.helper.combineLatest -import de.kuschku.libquassel.util.helper.mapNullable -import de.kuschku.libquassel.util.helper.nullIf -import de.kuschku.libquassel.util.helper.safeSwitchMap -import de.kuschku.quasseldroid.util.emoji.EmojiData -import de.kuschku.quasseldroid.viewmodel.ChatViewModel -import de.kuschku.quasseldroid.viewmodel.EditorViewModel -import de.kuschku.quasseldroid.viewmodel.QuasselViewModel -import de.kuschku.quasseldroid.viewmodel.data.AutoCompleteItem -import de.kuschku.quasseldroid.viewmodel.data.BufferStatus -import io.reactivex.Observable -import java.util.concurrent.TimeUnit -import javax.inject.Inject - -open class EditorViewModelHelper @Inject constructor( - val editor: EditorViewModel, - chat: ChatViewModel, - quassel: QuasselViewModel -) : ChatViewModelHelper(chat, quassel) { - val rawAutoCompleteData: Observable<Triple<Optional<ISession>, BufferId, Pair<String, IntRange>>> = - combineLatest( - connectedSession, - chat.bufferId, - editor.lastWord.safeSwitchMap { - it - }.distinctUntilChanged() - ) - - val autoCompleteData: Observable<Pair<String, List<AutoCompleteItem>>> = rawAutoCompleteData - .distinctUntilChanged() - .debounce(300, TimeUnit.MILLISECONDS) - .safeSwitchMap { (sessionOptional, id, lastWord) -> - val session = sessionOptional.orNull() - val bufferSyncer = session?.bufferSyncer - val bufferInfo = bufferSyncer?.bufferInfo(id) - if (bufferSyncer != null) { - session.liveNetworks().safeSwitchMap { networks -> - bufferSyncer.liveBufferInfos().safeSwitchMap { infos -> - session.aliasManager.updates().map(AliasManager::aliasList).safeSwitchMap { aliases -> - val network = networks[bufferInfo?.networkId] ?: Network.NULL - val ircChannel = if (bufferInfo?.type?.hasFlag(Buffer_Type.ChannelBuffer) == true) { - network.ircChannel(bufferInfo.bufferName) ?: IrcChannel.NULL - } else IrcChannel.NULL - ircChannel.liveIrcUsers().safeSwitchMap { users -> - fun filterStart(name: String): Boolean { - return name.trimStart(*IGNORED_CHARS) - .startsWith( - lastWord.first.trimStart(*IGNORED_CHARS), - ignoreCase = true - ) - } - - fun filter(name: String): Boolean { - return name.trim(*IGNORED_CHARS) - .contains( - lastWord.first.trim(*IGNORED_CHARS), - ignoreCase = true - ) - } - - fun processResults(results: List<Observable<out AutoCompleteItem>>) = - combineLatest<AutoCompleteItem>(results) - .map { list -> - Pair( - lastWord.first, - list.sorted() - ) - } - - fun getAliases() = aliases.filter { - filterStart(it.name ?: "") - }.map { - Observable.just(AutoCompleteItem.AliasItem( - "/${it.name}", - it.expansion - )) - } - - fun getBuffers() = infos.values.filter { - filterStart(it.bufferName ?: "") - }.filter { - it.type.toInt() == Buffer_Type.ChannelBuffer.toInt() - }.mapNotNull { info -> - networks[info.networkId]?.let { info to it } - }.map { (info, network) -> - network.liveIrcChannel( - info.bufferName - ).safeSwitchMap { channel -> - channel.updates().mapNullable(IrcChannel.NULL) { - AutoCompleteItem.ChannelItem( - info = info, - network = network.networkInfo(), - bufferStatus = when (it) { - null -> BufferStatus.OFFLINE - else -> BufferStatus.ONLINE - }, - description = it?.topic() ?: "" - ) - } - } - } - - fun getUsers(): Set<IrcUser> = when { - bufferInfo?.type?.hasFlag(Buffer_Type.ChannelBuffer) == true -> - users - bufferInfo?.type?.hasFlag(Buffer_Type.QueryBuffer) == true -> - network.ircUser(bufferInfo.bufferName).nullIf { it == IrcUser.NULL }?.let { - setOf(it) - } ?: emptySet() - else -> - emptySet() - } - - fun getNicks() = getUsers().filter { - filterStart(it.nick()) - }.map<IrcUser, Observable<AutoCompleteItem.UserItem>> { - it.updates().map { user -> - val userModes = ircChannel.userModes(user) - val prefixModes = network.prefixModes() - - val lowestMode = userModes.mapNotNull(prefixModes::indexOf).min() - ?: prefixModes.size - - AutoCompleteItem.UserItem( - user.nick(), - user.hostMask(), - network.modesToPrefixes(userModes), - lowestMode, - user.realName(), - user.isAway(), - user.network().isMyNick(user.nick()), - network.support("CASEMAPPING") - ) - } - } - - fun getEmojis() = EmojiData.processedEmojiMap.filter { - it.shortCodes.any { - it.contains(lastWord.first.trim(':')) - } - }.map { - Observable.just(it) - } - - processResults( - when (lastWord.first.firstOrNull()) { - '/' -> getAliases() - '@' -> getNicks() - '#' -> getBuffers() - ':' -> getEmojis() - else -> getAliases() + getNicks() + getBuffers() + getEmojis() - } - ) - } - } - } - } - } else { - Observable.just(Pair(lastWord.first, emptyList())) - } - } - - companion object { - val IGNORED_CHARS = charArrayOf( - '!', '"', '$', '%', '&', '\'', '(', ')', '*', '+', ',', '-', '.', '/', ':', ';', '<', '=', - '>', '?', '@', '[', '\\', ']', '^', '_', '`', '{', '|', '}', '~' - ) - } -} diff --git a/viewmodel/src/main/java/de/kuschku/quasseldroid/viewmodel/helper/QuasselViewModelHelper.kt b/viewmodel/src/main/java/de/kuschku/quasseldroid/viewmodel/helper/QuasselViewModelHelper.kt deleted file mode 100644 index 7da568231819088980fba43c72de3c47f3b1886b..0000000000000000000000000000000000000000 --- a/viewmodel/src/main/java/de/kuschku/quasseldroid/viewmodel/helper/QuasselViewModelHelper.kt +++ /dev/null @@ -1,535 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.viewmodel.helper - -import de.kuschku.libquassel.connection.ConnectionState -import de.kuschku.libquassel.connection.Features -import de.kuschku.libquassel.protocol.* -import de.kuschku.libquassel.quassel.BufferInfo -import de.kuschku.libquassel.quassel.syncables.* -import de.kuschku.libquassel.quassel.syncables.interfaces.INetwork -import de.kuschku.libquassel.session.ISession -import de.kuschku.libquassel.session.SessionManager -import de.kuschku.libquassel.ssl.X509Helper -import de.kuschku.libquassel.util.Optional -import de.kuschku.libquassel.util.flag.and -import de.kuschku.libquassel.util.flag.hasFlag -import de.kuschku.libquassel.util.flag.minus -import de.kuschku.libquassel.util.helper.* -import de.kuschku.libquassel.util.irc.IrcCaseMappers -import de.kuschku.quasseldroid.Backend -import de.kuschku.quasseldroid.viewmodel.QuasselViewModel -import de.kuschku.quasseldroid.viewmodel.data.* -import io.reactivex.Observable -import javax.inject.Inject -import javax.net.ssl.SSLPeerUnverifiedException - -open class QuasselViewModelHelper @Inject constructor( - val quassel: QuasselViewModel -) { - val backend = quassel.backendWrapper.safeSwitchMap { it } - val sessionManager = backend.mapMapNullable(Backend::sessionManager) - val connectedSession = sessionManager.mapSwitchMap(SessionManager::connectedSession) - val rpcHandler = connectedSession.mapMap(ISession::rpcHandler) - val ircListHelper = connectedSession.mapMap(ISession::ircListHelper) - val features = sessionManager.mapSwitchMap { manager -> - manager.state.safeSwitchMap { state -> - if (state != ConnectionState.CONNECTED) { - Observable.just(Pair(false, Features.empty())) - } else { - manager.connectedSession.map { - Pair(true, it.features) - } - } - } - }.mapOrElse(Pair(false, Features.empty())) - val clientFeatures = features.map { (connected, features) -> - Pair(connected, features.client) - } - val negotiatedFeatures = features.map { (connected, features) -> - Pair(connected, features.negotiated) - } - val coreFeatures = features.map { (connected, features) -> - Pair(connected, features.core) - } - - val connectionProgress = sessionManager.mapSwitchMap(SessionManager::connectionProgress) - .mapOrElse(Triple(ConnectionState.DISCONNECTED, 0, 0)) - - val bufferViewManager = connectedSession.mapMap(ISession::bufferViewManager) - - val errors = sessionManager.safeSwitchMap { - it.orNull()?.errors ?: Observable.empty() - } - - val sslSession = connectedSession.flatMapSwitchMap(ISession::sslSession) - val peerCertificateChain = sslSession.mapMapNullable { - try { - it.peerCertificateChain.mapNotNull(X509Helper::convert) - } catch (ignored: SSLPeerUnverifiedException) { - null - } - }.mapOrElse(emptyList()) - val leafCertificate = peerCertificateChain.map { Optional.ofNullable(it.firstOrNull()) } - - val coreInfo = connectedSession.mapMap(ISession::coreInfo).mapSwitchMap(CoreInfo::liveInfo) - val coreInfoClients = coreInfo.mapMap(CoreInfo.CoreData::sessionConnectedClientData) - .mapOrElse(emptyList()) - - val networkConfig = connectedSession.mapMap(ISession::networkConfig) - - val ignoreListManager = connectedSession.mapMap(ISession::ignoreListManager) - - val highlightRuleManager = connectedSession.mapMap(ISession::highlightRuleManager) - - val aliasManager = connectedSession.mapMap(ISession::aliasManager) - - val networks = connectedSession.safeSwitchMap { - it.map(ISession::liveNetworks).orElse(Observable.just(emptyMap())) - } - - val identities = connectedSession.safeSwitchMap { - it.map(ISession::liveIdentities).orElse(Observable.just(emptyMap())) - } - - val bufferSyncer = connectedSession.mapMap(ISession::bufferSyncer) - val allBuffers = bufferSyncer.mapSwitchMap { - it.liveBufferInfos().map(Map<BufferId, BufferInfo>::values) - }.mapOrElse(emptyList()) - - val lag: Observable<Long> = connectedSession.mapSwitchMap(ISession::lag).mapOrElse(0) - - val bufferViewConfigs = bufferViewManager.mapSwitchMap { manager -> - manager.liveBufferViewConfigs().map { ids -> - ids.mapNotNull { id -> - manager.bufferViewConfig(id) - }.sortedWith(BufferViewConfig.NameComparator) - } - }.mapOrElse(emptyList()) - - val bufferViewConfigMap = bufferViewManager.safeSwitchMap { - it.map { manager -> - manager.liveBufferViewConfigs().map { - it.mapNotNull(manager::bufferViewConfig).associateBy(BufferViewConfig::bufferViewId) - } - }.orElse(Observable.empty()) - } - - /** - * Builds a buffer list for a given bufferViewConfig - */ - fun processBufferList( - bufferViewConfig: Observable<Optional<BufferViewConfig>>, - filteredTypes: Observable<Pair<Map<BufferId, Int>, Int>>, - bufferSearch: Observable<String> = Observable.just(""), - bufferListType: BufferHiddenState = BufferHiddenState.VISIBLE, - showAllNetworks: Boolean = true - ): Observable<Pair<BufferViewConfig?, List<BufferProps>>> = - combineLatest(connectedSession, bufferViewConfig, filteredTypes, bufferSearch) - .safeSwitchMap { (sessionOptional, configOptional, rawFiltered, bufferSearch) -> - val session = sessionOptional.orNull() - val bufferView = configOptional.orNull() - val (filtered, defaultFiltered) = rawFiltered - val search = bufferSearch.trim() - if (session != null && bufferView != null) { - bufferView.liveUpdates().safeSwitchMap { config -> - val minimumActivity = config.minimumActivity() - - combineLatest<Collection<BufferId>>(listOf( - config.liveBuffers(), - config.liveTemporarilyRemovedBuffers(), - config.liveRemovedBuffers() - )).safeSwitchMap { (ids, temp, perm) -> - val bufferIds = if (search.isNotBlank()) { - ids + temp + perm - } else when (bufferListType) { - BufferHiddenState.VISIBLE -> ids - BufferHiddenState.HIDDEN_TEMPORARY -> temp - ids - BufferHiddenState.HIDDEN_PERMANENT -> perm - temp - ids - } - - combineLatest( - session.bufferSyncer.liveBufferInfos(), - session.liveNetworks() - ).safeSwitchMap { (bufferInfos, networks) -> - val prefiltered = bufferIds.asSequence().mapNotNull { id -> - bufferInfos[id] - }.filter { - search.isBlank() || - it.type.hasFlag(Buffer_Type.StatusBuffer) || - it.bufferName?.contains(search, ignoreCase = true) == true - } - - fun transformIds( - ids: Sequence<BufferInfo> - ): Sequence<Observable<BufferProps>> = ids.mapNotNull { - val network = networks[it.networkId] - if (network == null) { - null - } else { - it to network - } - }.mapNotNull<Pair<BufferInfo, Network>, Observable<BufferProps>> { (info, network) -> - session.bufferSyncer.liveActivity(info.bufferId).safeSwitchMap { activity -> - session.bufferSyncer.liveHighlightCount(info.bufferId).map { highlights -> - Pair(activity, highlights) - } - }.safeSwitchMap { (rawActivity, highlights) -> - val name = info.bufferName?.trim() ?: "" - val matchMode = when { - name.equals(search, ignoreCase = true) -> MatchMode.EXACT - name.startsWith(search, ignoreCase = true) -> MatchMode.START - else -> MatchMode.CONTAINS - } - val activity = rawActivity - Message_Type.of(filtered[info.bufferId]?.toUInt() - ?: defaultFiltered.toUInt()) - when (info.type.toInt()) { - BufferInfo.Type.QueryBuffer.toInt() -> { - network.liveNetworkInfo().safeSwitchMap { networkInfo -> - network.liveConnectionState().safeSwitchMap { connectionState -> - network.liveIrcUser(info.bufferName).safeSwitchMap { - it.updates().mapNullable(IrcUser.NULL) { user -> - BufferProps( - info = info, - network = networkInfo, - networkConnectionState = connectionState, - bufferStatus = when { - user == null -> BufferStatus.OFFLINE - user.isAway() -> BufferStatus.AWAY - else -> BufferStatus.ONLINE - }, - description = user?.realName() ?: "", - activity = activity, - highlights = highlights, - bufferActivity = when { - highlights > 0 -> - Buffer_Activity.of(Buffer_Activity.Highlight) - activity hasFlag Message_Type.Plain || - activity hasFlag Message_Type.Notice || - activity hasFlag Message_Type.Action -> - Buffer_Activity.of(Buffer_Activity.NewMessage) - activity.isNotEmpty() -> - Buffer_Activity.of(Buffer_Activity.OtherActivity) - else -> - Buffer_Activity.of(Buffer_Activity.NoActivity) - }, - ircUser = user, - matchMode = matchMode - ) - } - } - } - } - } - BufferInfo.Type.ChannelBuffer.toInt() -> { - network.liveNetworkInfo().safeSwitchMap { networkInfo -> - network.liveConnectionState().safeSwitchMap { connectionState -> - network.liveIrcChannel(info.bufferName).safeSwitchMap { channel -> - channel.updates().mapNullable(IrcChannel.NULL) { - BufferProps( - info = info, - network = networkInfo, - networkConnectionState = connectionState, - bufferStatus = when (it) { - null -> BufferStatus.OFFLINE - else -> BufferStatus.ONLINE - }, - description = it?.topic() ?: "", - activity = activity, - highlights = highlights, - bufferActivity = when { - highlights > 0 -> - Buffer_Activity.of(Buffer_Activity.Highlight) - activity hasFlag Message_Type.Plain || - activity hasFlag Message_Type.Notice || - activity hasFlag Message_Type.Action -> - Buffer_Activity.of(Buffer_Activity.NewMessage) - activity.isNotEmpty() -> - Buffer_Activity.of(Buffer_Activity.OtherActivity) - else -> - Buffer_Activity.of(Buffer_Activity.NoActivity) - }, - matchMode = matchMode - ) - } - } - } - } - } - BufferInfo.Type.StatusBuffer.toInt() -> { - network.liveNetworkInfo().safeSwitchMap { networkInfo -> - network.liveConnectionState().map { connectionState -> - BufferProps( - info = info, - network = networkInfo, - networkConnectionState = connectionState, - bufferStatus = BufferStatus.OFFLINE, - description = "", - activity = activity, - highlights = highlights, - bufferActivity = when { - highlights > 0 -> - Buffer_Activity.of(Buffer_Activity.Highlight) - activity hasFlag Message_Type.Plain || - activity hasFlag Message_Type.Notice || - activity hasFlag Message_Type.Action -> - Buffer_Activity.of(Buffer_Activity.NewMessage) - activity.isNotEmpty() -> - Buffer_Activity.of(Buffer_Activity.OtherActivity) - else -> - Buffer_Activity.of(Buffer_Activity.NoActivity) - }, - matchMode = matchMode - ) - } - } - } - else -> Observable.empty() - } - } - } - - /** - * Takes a list of buffers and determines if the status buffers for the networks - * each buffer belongs to exist, if not, adds pseudo-buffers for them. - */ - /** - * Takes a list of buffers and determines if the status buffers for the networks - * each buffer belongs to exist, if not, adds pseudo-buffers for them. - */ - fun missingStatusBuffers( - buffers: Sequence<BufferInfo> - ): Sequence<Observable<BufferProps>> { - val totalNetworks = - if (showAllNetworks && search.isEmpty()) networks.keys - else buffers.filter { - !it.type.hasFlag(Buffer_Type.StatusBuffer) - }.map { - it.networkId - }.toList() - - val availableNetworks = buffers.filter { - it.type.hasFlag(Buffer_Type.StatusBuffer) - }.map { - it.networkId - }.toList() - - val wantedNetworks = if (!config.networkId().isValidId()) totalNetworks - else listOf(config.networkId()) - - val missingNetworks = wantedNetworks - availableNetworks - - return missingNetworks.asSequence().filter { - !config.networkId().isValidId() || config.networkId() == it - }.filter { - config.allowedBufferTypes().hasFlag(Buffer_Type.StatusBuffer) - }.mapNotNull { - networks[it] - }.filter { - !config.hideInactiveNetworks() || it.isConnected() - }.mapNotNull<Network, Observable<BufferProps>> { network -> - network.liveNetworkInfo().safeSwitchMap { networkInfo -> - network.liveConnectionState().map { connectionState -> - BufferProps( - info = BufferInfo( - bufferId = BufferId(-networkInfo.networkId.id), - networkId = networkInfo.networkId, - groupId = 0, - bufferName = networkInfo.networkName, - type = Buffer_Type.of(Buffer_Type.StatusBuffer) - ), - network = networkInfo, - networkConnectionState = connectionState, - bufferStatus = BufferStatus.OFFLINE, - description = "", - activity = Message_Type.of(), - highlights = 0 - ) - } - } - } - } - - val buffers = transformIds(prefiltered) + missingStatusBuffers(prefiltered) - combineLatest(buffers.toList()).map { list -> - val wantedNetworks = list.filter { - !it.info.type.hasFlag(Buffer_Type.StatusBuffer) - }.map { - it.info.networkId - }.toList() - - list.asSequence().filter { - // Only show the currently selected network - !config.networkId().isValidId() || - config.networkId() == it.info.networkId - }.filter { - // Only show buffers which are allowed, or network status buffers - (!config.networkId().isValidId() && it.info.type.hasFlag(Buffer_Type.StatusBuffer)) || - (config.allowedBufferTypes() and it.info.type).isNotEmpty() - }.filter { - // If we’re searching for buffers, only include the networks with results - search.isEmpty() || - it.info.networkId in wantedNetworks - }.filter { - // If the config is set to hide inactive networks, only show initialized - // networks - !config.hideInactiveNetworks() || - it.networkConnectionState == INetwork.ConnectionState.Initialized - }.filter { - // If the config is set to hide inactive buffers, only show ones that are - // online or are network status buffers - !config.hideInactiveBuffers() || - it.bufferStatus != BufferStatus.OFFLINE || - it.info.type.hasFlag(Buffer_Type.StatusBuffer) - }.filter { - // Only show buffers which fulfill the minimum activity requirement or are - // network status buffers - minimumActivity.toInt() <= it.bufferActivity.toInt() || - it.info.type.hasFlag(Buffer_Type.StatusBuffer) - }.let { - // If the config is set to sort buffers, they are sorted by matchmode, and - // within of each match mode, by name (case insensitive) - if (config.sortAlphabetically()) - it.sortedBy { IrcCaseMappers.unicode.toLowerCaseNullable(it.info.bufferName) } - .sortedBy { it.matchMode.priority } - else it - }.sortedBy { props -> - !props.info.type.hasFlag(Buffer_Type.StatusBuffer) - }.sortedWith(compareBy(String.CASE_INSENSITIVE_ORDER) { props -> - props.network.networkName - }).distinctBy { - it.info.bufferId - }.toList() - }.map { - Pair<BufferViewConfig?, List<BufferProps>>(config, it) - } - } - } - } - } else { - Observable.just(Pair<BufferViewConfig?, List<BufferProps>>(null, emptyList())) - } - } - - /** - * Prepares a buffer list for display by configuring the current expansion and selection state as - * well as UI elements - */ - fun filterBufferList( - buffers: Observable<Pair<BufferViewConfig?, List<BufferProps>>>, - expandedNetworks: Observable<Map<NetworkId, Boolean>>, - selected: Observable<BufferId>, - showHandle: Boolean - ) = - combineLatest( - buffers, - expandedNetworks, - selected - ).map { (info, expandedNetworks, selected) -> - val (config, list) = info ?: Pair(null, emptyList()) - list.asSequence().map { props -> - BufferListItem( - props, - BufferState( - networkExpanded = expandedNetworks[props.network.networkId] - ?: (props.networkConnectionState == INetwork.ConnectionState.Initialized), - selected = selected == props.info.bufferId, - showHandle = showHandle && (config?.sortAlphabetically() == false) - ) - ) - }.filter { (props, state) -> - (props.info.type.hasFlag(BufferInfo.Type.StatusBuffer) || state.networkExpanded) - }.toList() - } - - fun processSelectedBuffer( - bufferViewConfigObservable: Observable<Optional<BufferViewConfig>>, - selectedBufferId: Observable<BufferId> - ) = combineLatest(connectedSession, selectedBufferId, bufferViewConfigObservable) - .safeSwitchMap { (sessionOptional, buffer, bufferViewConfigOptional) -> - val session = sessionOptional.orNull() - val bufferViewConfig = bufferViewConfigOptional.orNull() - val bufferSyncer = session?.bufferSyncer - if (bufferSyncer != null && bufferViewConfig != null) { - bufferHiddenState(bufferViewConfig, buffer).safeSwitchMap { bufferHiddenState -> - session.liveNetworks().safeSwitchMap { networks -> - val info = if (!buffer.isValidId()) networks[NetworkId(-buffer.id)]?.let { - BufferInfo( - bufferId = buffer, - networkId = it.networkId(), - groupId = 0, - bufferName = it.networkName(), - type = Buffer_Type.of(Buffer_Type.StatusBuffer) - ) - } else bufferSyncer.bufferInfo(buffer) - if (info != null) { - val network = networks[info.networkId] - when (info.type.enabledValues().firstOrNull()) { - Buffer_Type.StatusBuffer -> { - network?.liveConnectionState()?.map { - SelectedBufferItem( - info, - connectionState = it, - hiddenState = bufferHiddenState - ) - } ?: Observable.just(SelectedBufferItem(info)) - } - Buffer_Type.ChannelBuffer -> { - network?.liveIrcChannel(info.bufferName)?.mapNullable(IrcChannel.NULL) { - SelectedBufferItem( - info, - joined = it != null, - hiddenState = bufferHiddenState - ) - } ?: Observable.just(SelectedBufferItem( - info, - hiddenState = bufferHiddenState - )) - } - else -> - Observable.just(SelectedBufferItem( - info, - hiddenState = bufferHiddenState - )) - } - } else { - Observable.just(SelectedBufferItem()) - } - } - } - } else { - Observable.just(SelectedBufferItem()) - } - } - - fun bufferHiddenState(bufferViewConfig: BufferViewConfig, - bufferId: BufferId): Observable<BufferHiddenState> = - combineLatest(bufferViewConfig.liveBuffers(), - bufferViewConfig.liveTemporarilyRemovedBuffers(), - bufferViewConfig.liveRemovedBuffers()) - .map { (visible, temp, perm) -> - when (bufferId) { - in visible -> BufferHiddenState.VISIBLE - in temp -> BufferHiddenState.HIDDEN_TEMPORARY - in perm -> BufferHiddenState.HIDDEN_PERMANENT - else -> BufferHiddenState.HIDDEN_PERMANENT - } - } -} diff --git a/viewmodel/src/main/java/de/kuschku/quasseldroid/viewmodel/helper/QueryCreateViewModelHelper.kt b/viewmodel/src/main/java/de/kuschku/quasseldroid/viewmodel/helper/QueryCreateViewModelHelper.kt deleted file mode 100644 index 1ec2d7646a2bcfab16e78ae936630eca98f7e6bb..0000000000000000000000000000000000000000 --- a/viewmodel/src/main/java/de/kuschku/quasseldroid/viewmodel/helper/QueryCreateViewModelHelper.kt +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.viewmodel.helper - -import de.kuschku.quasseldroid.viewmodel.QuasselViewModel -import de.kuschku.quasseldroid.viewmodel.QueryCreateViewModel -import javax.inject.Inject - -open class QueryCreateViewModelHelper @Inject constructor( - val queryCreate: QueryCreateViewModel, - quassel: QuasselViewModel -) : QuasselViewModelHelper(quassel) diff --git a/viewmodel/src/test/java/de/kuschku/quasseldroid/viewmodel/ChatViewModelTest.kt b/viewmodel/src/test/java/de/kuschku/quasseldroid/viewmodel/ChatViewModelTest.kt deleted file mode 100644 index 063d14a1d0dc324cbf4af4e4cb648e67d3cf6886..0000000000000000000000000000000000000000 --- a/viewmodel/src/test/java/de/kuschku/quasseldroid/viewmodel/ChatViewModelTest.kt +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.quasseldroid.viewmodel - -import de.kuschku.quasseldroid.viewmodel.ChatViewModel.Companion.recentMessagesChangeInternal -import org.junit.Assert.assertEquals -import org.junit.Test - -class ChatViewModelTest { - @Test - fun testRecentMessagesChange() { - assertEquals(recentMessagesChangeInternal(0, 0, -1), -1) - assertEquals(recentMessagesChangeInternal(0, 0, +1), -1) - assertEquals(recentMessagesChangeInternal(-1, 0, -1), -1) - assertEquals(recentMessagesChangeInternal(-1, 0, +1), -1) - assertEquals(recentMessagesChangeInternal(1, 0, -1), -1) - assertEquals(recentMessagesChangeInternal(1, 0, +1), -1) - - - assertEquals(recentMessagesChangeInternal(0, 5, -1), -1) - assertEquals(recentMessagesChangeInternal(0, 5, +1), 1) - - assertEquals(recentMessagesChangeInternal(1, 5, -1), 0) - assertEquals(recentMessagesChangeInternal(1, 5, +1), 2) - - assertEquals(recentMessagesChangeInternal(4, 5, -1), 3) - assertEquals(recentMessagesChangeInternal(4, 5, +1), 0) - } -}