From ddb1fa9981812cfbdb4af461d3375327c4757dcf Mon Sep 17 00:00:00 2001 From: Yash-Garg Date: Tue, 27 Sep 2022 20:22:58 +0530 Subject: [PATCH] refactor: switch to gradle version catalogues and .kts buildscripts chore: format all files using spotlessApply refactor: move all deps of :app to version catalog refactor: change some name stuff for versions chore: enable coreLibraryDesugaring cleanup: remove hidden-api stuff from this branch for now fix: use correct naming for sourceSets fix: add restriction bypass lib and fix receiver name --- .gitattributes | 1 + .gitignore | 11 +- .idea/codeStyles/Project.xml | 166 ---------------- .idea/codeStyles/codeStyleConfig.xml | 5 - .idea/encodings.xml | 6 - .idea/inspectionProfiles/ktlint.xml | 7 - .../inspectionProfiles/profiles_settings.xml | 6 - .idea/kotlinc.xml | 8 - .idea/misc.xml | 4 - .idea/runConfigurations.xml | 12 -- .idea/vcs.xml | 6 - app/build.gradle | 184 ------------------ app/build.gradle.kts | 184 ++++++++++++++++++ app/proguard-rules.pro | 2 +- app/src/apiNougat/AndroidManifest.xml | 5 +- app/src/apiOreo/AndroidManifest.xml | 5 +- app/src/main/AndroidManifest.xml | 5 +- .../e/blisslauncher/core/KotlinUtils.kt | 2 +- .../e/blisslauncher/core/blur/BlurDrawable.kt | 12 +- .../core/blur/BlurViewDelegate.kt | 85 ++++---- .../core/blur/BlurWallpaperFilter.kt | 38 ++-- .../core/blur/BlurWallpaperProvider.kt | 98 +++++----- .../core/blur/ShaderBlurDrawable.kt | 36 ++-- .../core/blur/WallpaperFilter.kt | 2 +- .../core/customviews/BlurBackgroundView.kt | 13 +- .../core/customviews/BlurLayout.kt | 6 +- .../core/customviews/DockGridLayout.kt | 18 +- .../core/customviews/SwipeSearchContainer.kt | 8 +- .../pageindicators/PageIndicator.kt | 6 +- .../pageindicators/PageIndicatorDots.kt | 103 +++++----- .../blisslauncher/core/utils/DepthManager.kt | 19 +- .../core/utils/SingletonHolder.kt | 6 +- .../core/wallpaper/WallpaperColorsCompat.kt | 14 +- .../core/wallpaper/WallpaperManagerCompat.kt | 14 +- .../features/launcher/LauncherActivity.java | 3 +- .../features/widgets/DefaultWidgets.kt | 6 +- app/src/main/res/anim/enter.xml | 2 +- app/src/main/res/anim/leave.xml | 2 +- app/src/main/res/anim/wobble.xml | 2 +- app/src/main/res/anim/wobble_reverse.xml | 2 +- .../btn_background_add_widget_rounded.xml | 2 +- .../main/res/drawable/btn_rounded_corner.xml | 2 +- app/src/main/res/drawable/dot_off.xml | 2 +- app/src/main/res/drawable/dot_on.xml | 2 +- .../res/drawable/folder_title_text_cursor.xml | 2 +- app/src/main/res/drawable/folder_window.xml | 2 +- app/src/main/res/drawable/gap.xml | 2 +- .../drawable/item_suggestion_background.xml | 2 +- .../item_widget_bottom_round_corner.xml | 2 +- .../drawable/item_widget_top_round_corner.xml | 2 +- app/src/main/res/drawable/search_widget.xml | 2 +- .../main/res/drawable/widget_resize_frame.xml | 2 +- .../drawable/widget_resize_thumb_handle.xml | 2 +- app/src/main/res/layout/activity_main.xml | 2 +- .../res/layout/activity_widget_picker.xml | 2 +- app/src/main/res/layout/app_view.xml | 2 +- app/src/main/res/layout/calendar_icon.xml | 2 +- app/src/main/res/layout/item_added_widget.xml | 2 +- app/src/main/res/layout/item_all_widget.xml | 2 +- .../main/res/layout/item_weather_forecast.xml | 2 +- app/src/main/res/layout/layout_used_apps.xml | 2 +- .../layout/layout_widget_host_container.xml | 2 +- app/src/main/res/layout/widgets_page.xml | 2 +- app/src/main/res/values-de/strings.xml | 2 +- app/src/main/res/values-es/strings.xml | 2 +- app/src/main/res/values-fr/strings.xml | 2 +- app/src/main/res/values-it/strings.xml | 2 +- app/src/main/res/values-pl/strings.xml | 2 +- app/src/main/res/values-ro/strings.xml | 2 +- app/src/main/res/values-v26/bools.xml | 2 +- app/src/main/res/values/bools.xml | 2 +- app/src/main/res/values/dimens.xml | 2 +- app/src/main/res/values/ids.xml | 2 +- app/src/main/res/values/row_column_count.xml | 2 +- app/src/main/res/values/strings.xml | 2 +- build-logic/.gitignore | 3 + build-logic/kotlin-plugins/build.gradle.kts | 27 +++ .../e/blisslauncher/gradle/SpotlessPlugin.kt | 44 +++++ build-logic/settings.gradle.kts | 23 +++ build.gradle | 56 ------ build.gradle.kts | 15 ++ buildSrc/build.gradle.kts | 8 +- .../e/blisslauncher/buildsrc/Dependencies.kt | 131 ------------- .../e/blisslauncher/buildsrc/Versions.kt | 7 + data/build.gradle | 48 ----- data/build.gradle.kts | 52 +++++ data/proguard-rules.pro | 2 +- data/src/main/AndroidManifest.xml | 3 +- .../e/blisslauncher/data/ExampleUnitTest.kt | 3 +- domain/build.gradle | 30 --- domain/build.gradle.kts | 33 ++++ domain/proguard-rules.pro | 2 +- domain/src/main/AndroidManifest.xml | 2 +- .../domain/executors/PostExecutionThread.kt | 2 +- .../domain/executors/ThreadExecutor.kt | 2 +- .../domain/interactors/Interactor.kt | 8 +- .../e/blisslauncher/domain/ExampleUnitTest.kt | 3 +- gradle.properties | 4 - gradle/libs.versions.toml | 76 ++++++++ gradle/wrapper/gradle-wrapper.properties | 2 +- settings.gradle | 3 - settings.gradle.kts | 31 +++ 102 files changed, 798 insertions(+), 1006 deletions(-) create mode 100644 .gitattributes delete mode 100644 .idea/codeStyles/Project.xml delete mode 100644 .idea/codeStyles/codeStyleConfig.xml delete mode 100644 .idea/encodings.xml delete mode 100644 .idea/inspectionProfiles/ktlint.xml delete mode 100644 .idea/inspectionProfiles/profiles_settings.xml delete mode 100644 .idea/kotlinc.xml delete mode 100644 .idea/misc.xml delete mode 100644 .idea/runConfigurations.xml delete mode 100644 .idea/vcs.xml delete mode 100755 app/build.gradle create mode 100644 app/build.gradle.kts create mode 100644 build-logic/.gitignore create mode 100644 build-logic/kotlin-plugins/build.gradle.kts create mode 100644 build-logic/kotlin-plugins/src/main/kotlin/foundation/e/blisslauncher/gradle/SpotlessPlugin.kt create mode 100644 build-logic/settings.gradle.kts delete mode 100755 build.gradle create mode 100644 build.gradle.kts delete mode 100644 buildSrc/src/main/java/foundation/e/blisslauncher/buildsrc/Dependencies.kt create mode 100644 buildSrc/src/main/java/foundation/e/blisslauncher/buildsrc/Versions.kt delete mode 100644 data/build.gradle create mode 100644 data/build.gradle.kts delete mode 100644 domain/build.gradle create mode 100644 domain/build.gradle.kts create mode 100644 gradle/libs.versions.toml delete mode 100755 settings.gradle create mode 100644 settings.gradle.kts diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000000..94f480de94 --- /dev/null +++ b/.gitattributes @@ -0,0 +1 @@ +* text=auto eol=lf \ No newline at end of file diff --git a/.gitignore b/.gitignore index ee30082981..7312c41b3c 100755 --- a/.gitignore +++ b/.gitignore @@ -36,16 +36,7 @@ build/ # IntelliJ *iml -.idea/workspace.xml -.idea/libraries -.idea/caches -.idea/navEditor.xml -.idea/tasks.xml -.idea/modules.xml -.idea/assetWizardSettings.xml -.idea/markdown-navigator* -.idea/compiler.xml -.idea/jarRepositories.xml +.idea/ projectFilesBackup/ gradle.xml diff --git a/.idea/codeStyles/Project.xml b/.idea/codeStyles/Project.xml deleted file mode 100644 index 0b7502afca..0000000000 --- a/.idea/codeStyles/Project.xml +++ /dev/null @@ -1,166 +0,0 @@ - - - - - - - - - - - - - - - - - - - -
- - - - xmlns:android - - ^$ - - - -
-
- - - - xmlns:.* - - ^$ - - - BY_NAME - -
-
- - - - .*:id - - http://schemas.android.com/apk/res/android - - - -
-
- - - - .*:name - - http://schemas.android.com/apk/res/android - - - -
-
- - - - name - - ^$ - - - -
-
- - - - style - - ^$ - - - -
-
- - - - .* - - ^$ - - - BY_NAME - -
-
- - - - .* - - http://schemas.android.com/apk/res/android - - - ANDROID_ATTRIBUTE_ORDER - -
-
- - - - .* - - .* - - - BY_NAME - -
-
-
-
- - - - -
-
\ No newline at end of file diff --git a/.idea/codeStyles/codeStyleConfig.xml b/.idea/codeStyles/codeStyleConfig.xml deleted file mode 100644 index 79ee123c2b..0000000000 --- a/.idea/codeStyles/codeStyleConfig.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - \ No newline at end of file diff --git a/.idea/encodings.xml b/.idea/encodings.xml deleted file mode 100644 index 97626ba454..0000000000 --- a/.idea/encodings.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/.idea/inspectionProfiles/ktlint.xml b/.idea/inspectionProfiles/ktlint.xml deleted file mode 100644 index ff4779898c..0000000000 --- a/.idea/inspectionProfiles/ktlint.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - - \ No newline at end of file diff --git a/.idea/inspectionProfiles/profiles_settings.xml b/.idea/inspectionProfiles/profiles_settings.xml deleted file mode 100644 index 30d5fbc6c8..0000000000 --- a/.idea/inspectionProfiles/profiles_settings.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - \ No newline at end of file diff --git a/.idea/kotlinc.xml b/.idea/kotlinc.xml deleted file mode 100644 index 78eb99429f..0000000000 --- a/.idea/kotlinc.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml deleted file mode 100644 index 58918f5033..0000000000 --- a/.idea/misc.xml +++ /dev/null @@ -1,4 +0,0 @@ - - - - \ No newline at end of file diff --git a/.idea/runConfigurations.xml b/.idea/runConfigurations.xml deleted file mode 100644 index 7f68460d8b..0000000000 --- a/.idea/runConfigurations.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml deleted file mode 100644 index 35eb1ddfbb..0000000000 --- a/.idea/vcs.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/app/build.gradle b/app/build.gradle deleted file mode 100755 index 25bc981e09..0000000000 --- a/app/build.gradle +++ /dev/null @@ -1,184 +0,0 @@ -import foundation.e.blisslauncher.buildsrc.Libs -import foundation.e.blisslauncher.buildsrc.Versions - -apply plugin: 'com.android.application' -apply plugin: 'kotlin-android' -apply plugin: 'kotlin-kapt' -apply plugin: 'kotlin-android-extensions' - -// Manifest version information! -def versionMajor = 1 -def versionMinor = 4 -def versionPatch = 2 - -Properties localProps = new Properties() -File localPropsFile = project.rootProject.file('local.properties') -if (localPropsFile.exists()) { - localProps.load(localPropsFile.newDataInputStream()) -} -def appendDebugSuffix = (localProps.getProperty('appendDebugSuffix') ?: "true").toBoolean() -def keyStorePath = localProps.getProperty('keyStorePath') ?: "/keystore/debug.keystore" -def keyStorePassword = localProps.getProperty('keyStorePassword') ?: "android" -def signingKeyAlias = localProps.getProperty('keyAlias') ?: "androiddebugkey" -def signingKeyPassword = localProps.getProperty('keyPassword') ?: "android" - -android { - compileSdkVersion Versions.compile_sdk - defaultConfig { - applicationId "foundation.e.blisslauncher" - minSdkVersion Versions.min_sdk - targetSdkVersion Versions.target_sdk - versionCode versionMajor * 1000000 + versionMinor * 1000 + versionPatch - versionName "${versionMajor}.${versionMinor}.${versionPatch}" - testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" - - renderscriptTargetApi 28 - renderscriptSupportModeEnabled true - } - buildTypes { - release { - minifyEnabled false - proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' - signingConfig signingConfigs.debug - } - debug { - if (appendDebugSuffix) { - applicationIdSuffix '.debug' - } - signingConfig signingConfigs.debug - } - - applicationVariants.all { variant -> - variant.outputs.all { output -> - outputFileName = "BlissLauncher-${variant.versionName}-${variant.getFlavorName()}-${variant.buildType.name}.apk" - } - } - } - - signingConfigs { - debug { - storeFile file(getRootDir().path + keyStorePath) - storePassword keyStorePassword - keyAlias signingKeyAlias - keyPassword signingKeyPassword - } - } - - flavorDimensions "api" - productFlavors { - apiNougat { - dimension "api" - minSdkVersion 24 - } - apiOreo { - dimension "api" - minSdkVersion 26 - targetSdkVersion 28 - } - apiQ { - dimension "api" - minSdkVersion 29 - targetSdkVersion 29 - } - apiR { - dimension "api" - minSdkVersion 29 - targetSdkVersion 29 - } - apiS { - dimension "api" - minSdkVersion 29 - targetSdkVersion 29 - } - } - - // Always show the result of every unit test, even if it passes. - testOptions.unitTests.all { - testLogging { - events 'passed', 'skipped', 'failed', 'standardOut', 'standardError' - } - } - compileOptions { - targetCompatibility 1.8 - sourceCompatibility 1.8 - } - - lintOptions { - abortOnError false - } - - sourceSets { - apiQ { - java.srcDirs = ['src/apiOreo/java/foundation/e'] - res.srcDirs = ['src/apiOreo/res'] - } - apiR { - java.srcDirs = ['src/apiOreo/java/foundation/e'] - res.srcDirs = ['src/apiOreo/res'] - } - apiS { - java.srcDirs = ['src/apiOreo/java/foundation/e'] - res.srcDirs = ['src/apiOreo/res'] - } - } -} - -dependencies { - implementation 'me.relex:circleindicator:2.1.4' - - apiNougatImplementation 'org.cyanogenmod:platform.sdk:6.0' - apiOreoImplementation files('libs/lineage-sdk-oreo.jar') - apiQImplementation files('libs/lineage-sdk-q.jar') - apiRImplementation files('libs/lineage-sdk-r.jar') - apiSImplementation files('libs/e-ui-sdk-s.jar') - - debugImplementation 'com.amitshekhar.android:debug-db:1.0.4' - - implementation 'org.greenrobot:eventbus:3.1.1' - - // Support Libs - implementation Libs.AndroidX.appcompat - implementation Libs.AndroidX.recyclerview - - // Rx Java and Android - implementation Libs.RxJava.rxAndroid - implementation Libs.RxJava.rxJava - implementation 'com.jakewharton.rxbinding3:rxbinding:3.0.0' - - // Retrofit - implementation Libs.Retrofit.retrofit - implementation Libs.Retrofit.gsonConverter - implementation Libs.Retrofit.retrofit_rxjava_adapter - - // Okhttp - implementation Libs.OkHttp.okhttp - implementation Libs.OkHttp.loggingInterceptor - - // Rx Relay - implementation "com.jakewharton.rxrelay2:rxrelay:2.1.1" - - implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" - - // Blur Library - implementation 'com.hoko:hoko-blur:1.3.4' - - // Room - implementation Libs.AndroidX.Room.runtime - kapt Libs.AndroidX.Room.compiler - - // Apache Commons - implementation Libs.ApacheCommons.commonsLang - - // Unit test dependencies - testImplementation Libs.junit - testImplementation Libs.robolectric - testImplementation "org.mockito:mockito-core:2.19.0" - testImplementation Libs.AndroidX.Test.archCoreTesting - - // Instrumentation tests dependencies - androidTestImplementation Libs.junit - androidTestImplementation Libs.AndroidX.Test.espressoCore - androidTestImplementation Libs.AndroidX.Test.runner - androidTestImplementation Libs.AndroidX.Test.rules - implementation 'androidx.localbroadcastmanager:localbroadcastmanager:1.0.0' -} diff --git a/app/build.gradle.kts b/app/build.gradle.kts new file mode 100644 index 0000000000..a45e26a132 --- /dev/null +++ b/app/build.gradle.kts @@ -0,0 +1,184 @@ +@file:Suppress("DSL_SCOPE_VIOLATION", "UnstableApiUsage") + +import foundation.e.blisslauncher.buildsrc.Versions +import java.util.* + +plugins { + alias(libs.plugins.android.application) + alias(libs.plugins.kotlin.android) + alias(libs.plugins.kotlin.kapt) + alias(libs.plugins.refine) +} + +// Manifest version information +val versionMajor = 1 +val versionMinor = 4 +val versionPatch = 2 + +val localProps = Properties() +val localPropsFile = project.rootProject.file("local.properties") + +if (localPropsFile.exists()) { + localProps.load(localPropsFile.inputStream()) +} + +val appendDebugSuffix = (localProps.getProperty("appendDebugSuffix") ?: "true").toBoolean() +val keyStorePath = localProps.getProperty("keyStorePath") ?: "/keystore/debug.keystore" +val keyStorePassword = localProps.getProperty("keyStorePassword") ?: "android" +val signingKeyAlias = localProps.getProperty("keyAlias") ?: "androiddebugkey" +val signingKeyPassword = localProps.getProperty("keyPassword") ?: "android" + +android { + namespace = "foundation.e.blisslauncher" + compileSdk = Versions.COMPILE_SDK + + defaultConfig { + applicationId = "foundation.e.blisslauncher" + minSdk = Versions.MIN_SDK + targetSdk = Versions.TARGET_SDK + + versionCode = versionMajor * 100_00_00 + versionMinor * 10_00 + versionPatch + versionName = "${versionMajor}.${versionMinor}.${versionPatch}" + + testInstrumentationRunner = "android.support.test.runner.AndroidJUnitRunner" + renderscriptTargetApi = 28 + renderscriptSupportModeEnabled = true + setProperty("archivesBaseName", "BlissLauncher-v$versionName") + } + + buildTypes { + release { + isMinifyEnabled = false + proguardFiles(getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro") + signingConfig = signingConfigs.getByName("debug") + } + + debug { + if (appendDebugSuffix) { + applicationIdSuffix = ".debug" + } + signingConfig = signingConfigs.getByName("debug") + } + } + + signingConfigs { + getByName("debug") { + storeFile = file(rootDir.path + keyStorePath) + storePassword = keyStorePassword + keyAlias = signingKeyAlias + keyPassword = signingKeyPassword + } + } + + flavorDimensions.add("api") + productFlavors { + create("apiNougat") { + dimension = "api" + minSdk = 24 + } + + create("apiOreo") { + dimension = "api" + minSdk = 26 + targetSdk = 28 + } + + create("apiQ") { + dimension = "api" + minSdk = 29 + targetSdk = 29 + } + + create("apiR") { + dimension = "api" + minSdk = 29 + targetSdk = 29 + } + + create("apiS") { + dimension = "api" + minSdk = 29 + targetSdk = 29 + } + } + + // Always show the result of every unit test, even if it passes. + testOptions.unitTests.all { test -> + test.testLogging { events("passed", "skipped", "failed", "standardOut", "standardError") } + } + + compileOptions { + isCoreLibraryDesugaringEnabled = true + sourceCompatibility = JavaVersion.VERSION_1_8 + targetCompatibility = JavaVersion.VERSION_1_8 + } + + kotlinOptions { jvmTarget = "1.8" } + + buildFeatures { viewBinding = true } + + lint { abortOnError = false } + + sourceSets { + getByName("apiQ") { + java.srcDir("src/apiOreo/java") + res.srcDir("src/apiOreo/res") + } + + getByName("apiR") { + java.srcDir("src/apiOreo/java") + res.srcDir("src/apiOreo/res") + } + + getByName("apiS") { + java.srcDir("src/apiOreo/java") + res.srcDir("src/apiOreo/res") + } + } +} + +dependencies { + "apiNougatImplementation"("org.cyanogenmod:platform.sdk:6.0") + "apiOreoImplementation"(files("libs/lineage-sdk-oreo.jar")) + "apiQImplementation"(files("libs/lineage-sdk-q.jar")) + "apiRImplementation"(files("libs/lineage-sdk-r.jar")) + "apiSImplementation"(files("libs/e-ui-sdk-s.jar")) + + // Support Libs + implementation(libs.androidx.appcompat) + implementation(libs.androidx.recyclerview) + implementation(libs.androidx.localbroadcast) + + // Rx Java and Android + implementation(libs.rx.android) + implementation(libs.rx.binding) + implementation(libs.rx.java) + implementation(libs.rx.relay) + + // Room + implementation(libs.androidx.room.runtime) + kapt(libs.androidx.room.compiler) + + // Retrofit + implementation(libs.retrofit) + implementation(libs.retrofit.gson.converter) + implementation(libs.retrofit.rxjava.adapter) + + // Okhttp + implementation(libs.okhttp) + implementation(libs.okhttp.logging) + + // Misc. + implementation(libs.hoko.blur) + implementation(libs.apache.commons) + implementation(libs.kotlin.stdlib.jdk7) + implementation(libs.greenrobot.eventbus) + implementation(libs.circleindicator) + implementation(libs.restriction.bypass) + debugImplementation(libs.debug.db) + coreLibraryDesugaring(libs.tools.desugar) + + // Testing dependencies + testImplementation(libs.bundles.testing.unit) + testImplementation(libs.bundles.testing.android) +} diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro index 58c971f50f..659879c720 100755 --- a/app/proguard-rules.pro +++ b/app/proguard-rules.pro @@ -2,7 +2,7 @@ # By default, the flags in this file are appended to flags specified # in /home/simple/Android/Sdk/tools/proguard/proguard-android.txt # You can edit the include path and order by changing the proguardFiles -# directive in build.gradle. +# directive in build.gradle.kts. # # For more details, see # http://developer.android.com/guide/developing/tools/proguard.html diff --git a/app/src/apiNougat/AndroidManifest.xml b/app/src/apiNougat/AndroidManifest.xml index eeec77436c..7739a89d5a 100755 --- a/app/src/apiNougat/AndroidManifest.xml +++ b/app/src/apiNougat/AndroidManifest.xml @@ -1,6 +1,5 @@ - + - \ No newline at end of file + diff --git a/app/src/apiOreo/AndroidManifest.xml b/app/src/apiOreo/AndroidManifest.xml index 8db74c0f64..800360dae3 100755 --- a/app/src/apiOreo/AndroidManifest.xml +++ b/app/src/apiOreo/AndroidManifest.xml @@ -1,6 +1,5 @@ - + - \ No newline at end of file + diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 775eeffc6d..b63ec53e7e 100755 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -1,7 +1,6 @@ + xmlns:tools="http://schemas.android.com/tools"> --> - + Iterable.safeForEach(action: (T) -> Unit) { val tmp = ArrayList() tmp.addAll(this) for (element in tmp) action(element) -} \ No newline at end of file +} diff --git a/app/src/main/java/foundation/e/blisslauncher/core/blur/BlurDrawable.kt b/app/src/main/java/foundation/e/blisslauncher/core/blur/BlurDrawable.kt index 38caeddb83..52a19e33fd 100644 --- a/app/src/main/java/foundation/e/blisslauncher/core/blur/BlurDrawable.kt +++ b/app/src/main/java/foundation/e/blisslauncher/core/blur/BlurDrawable.kt @@ -61,10 +61,11 @@ class BlurDrawable internal constructor(private val blurWallpaperProvider: BlurW setBlurBounds(left.toFloat(), top.toFloat(), right.toFloat(), bottom.toFloat()) fun setBlurBounds(left: Float, top: Float, right: Float, bottom: Float) { - if (blurBounds.left != left || - blurBounds.top != top || - blurBounds.right != right || - blurBounds.bottom != bottom + if ( + blurBounds.left != left || + blurBounds.top != top || + blurBounds.right != right || + blurBounds.bottom != bottom ) { blurBounds.set(left, top, right, bottom) } @@ -81,8 +82,7 @@ class BlurDrawable internal constructor(private val blurWallpaperProvider: BlurW invalidateSelf() } - override fun setColorFilter(colorFilter: ColorFilter?) { - } + override fun setColorFilter(colorFilter: ColorFilter?) {} fun startListening() = blurWallpaperProvider.addListener(this) diff --git a/app/src/main/java/foundation/e/blisslauncher/core/blur/BlurViewDelegate.kt b/app/src/main/java/foundation/e/blisslauncher/core/blur/BlurViewDelegate.kt index e2d4c72518..295a530bbf 100644 --- a/app/src/main/java/foundation/e/blisslauncher/core/blur/BlurViewDelegate.kt +++ b/app/src/main/java/foundation/e/blisslauncher/core/blur/BlurViewDelegate.kt @@ -14,10 +14,8 @@ import foundation.e.blisslauncher.R import foundation.e.blisslauncher.core.customviews.HorizontalPager import foundation.e.blisslauncher.core.utils.OffsetParent -class BlurViewDelegate( - private val view: View, - attrs: AttributeSet? = null -) : View.OnAttachStateChangeListener, BlurWallpaperProvider.Listener { +class BlurViewDelegate(private val view: View, attrs: AttributeSet? = null) : + View.OnAttachStateChangeListener, BlurWallpaperProvider.Listener { private val context = view.context private val blurWallpaperProvider by lazy { BlurWallpaperProvider.getInstance(context) } @@ -27,15 +25,13 @@ class BlurViewDelegate( private val blurDrawableCallback by lazy { object : Drawable.Callback { - override fun unscheduleDrawable(who: Drawable, what: Runnable) { - } + override fun unscheduleDrawable(who: Drawable, what: Runnable) {} override fun invalidateDrawable(who: Drawable) { view.post(view::invalidate) } - override fun scheduleDrawable(who: Drawable, what: Runnable, `when`: Long) { - } + override fun scheduleDrawable(who: Drawable, what: Runnable, `when`: Long) {} } } @@ -53,31 +49,35 @@ class BlurViewDelegate( private var parentOffsetY = 0f private val onGlobalLayoutListener = ViewTreeObserver.OnGlobalLayoutListener { updateBounds() } - private val onScrollChangedListener = ViewTreeObserver.OnScrollChangedListener { - isScrolling = true - view.invalidate() - } - private val onOffsetChangeListener = object : OffsetParent.OnOffsetChangeListener { - override fun onOffsetChange() { - computeParentOffset() + private val onScrollChangedListener = + ViewTreeObserver.OnScrollChangedListener { + isScrolling = true + view.invalidate() + } + private val onOffsetChangeListener = + object : OffsetParent.OnOffsetChangeListener { + override fun onOffsetChange() { + computeParentOffset() + } } - } var blurCornerRadius = 0f - val outlineProvider = object : ViewOutlineProvider() { - override fun getOutline(view: View, outline: Outline) { - outline.setRoundRect(0, 0, view.width, view.height, blurCornerRadius) + val outlineProvider = + object : ViewOutlineProvider() { + override fun getOutline(view: View, outline: Outline) { + outline.setRoundRect(0, 0, view.width, view.height, blurCornerRadius) + } } - } var overlayColor: Int = 0 set(value) { field = value overlayPaint.color = value } - private val overlayPaint = Paint(Paint.FILTER_BITMAP_FLAG or Paint.ANTI_ALIAS_FLAG).apply { - blendMode = BlendMode.OVERLAY - } + private val overlayPaint = + Paint(Paint.FILTER_BITMAP_FLAG or Paint.ANTI_ALIAS_FLAG).apply { + blendMode = BlendMode.OVERLAY + } init { createFullBlurDrawable() @@ -85,14 +85,8 @@ class BlurViewDelegate( if (attrs != null) { val a = context.obtainStyledAttributes(attrs, R.styleable.BlurLayout) - blurCornerRadius = a.getDimension( - R.styleable.BlurLayout_blurCornerRadius, - 0f - ) - overlayColor = a.getColor( - R.styleable.BlurLayout_blurOverlayColor, - 0 - ) + blurCornerRadius = a.getDimension(R.styleable.BlurLayout_blurCornerRadius, 0f) + overlayColor = a.getColor(R.styleable.BlurLayout_blurOverlayColor, 0) a.recycle() } } @@ -125,8 +119,10 @@ class BlurViewDelegate( } if (overlayColor != 0) { canvas.drawRect( - view.left.toFloat(), view.top.toFloat(), - view.right.toFloat(), view.bottom.toFloat(), + view.left.toFloat(), + view.top.toFloat(), + view.right.toFloat(), + view.bottom.toFloat(), overlayPaint ) } @@ -134,11 +130,12 @@ class BlurViewDelegate( private fun createFullBlurDrawable() { fullBlurDrawable?.let { if (view.isAttachedToWindow) it.stopListening() } - fullBlurDrawable = blurWallpaperProvider.createBlurDrawable().apply { - callback = blurDrawableCallback - setBounds(view.left, view.top, view.right, view.bottom) - if (view.isAttachedToWindow) startListening() - } + fullBlurDrawable = + blurWallpaperProvider.createBlurDrawable().apply { + callback = blurDrawableCallback + setBounds(view.left, view.top, view.right, view.bottom) + if (view.isAttachedToWindow) startListening() + } } override fun onEnabledChanged() { @@ -163,7 +160,12 @@ class BlurViewDelegate( } val right = left + view.width val bottom = top + view.height - fullBlurDrawable?.setBlurBounds(left.toFloat(), top.toFloat(), right.toFloat(), bottom.toFloat()) + fullBlurDrawable?.setBlurBounds( + left.toFloat(), + top.toFloat(), + right.toFloat(), + bottom.toFloat() + ) view.invalidate() this.offsetParents = offsetParents computeScrollOffset() @@ -199,6 +201,9 @@ class BlurViewDelegate( } private fun updateOffsets() { - fullBlurDrawable?.setOffsets(previousScrollX.toFloat() + parentOffsetX, previousScrollY.toFloat() + parentOffsetY) + fullBlurDrawable?.setOffsets( + previousScrollX.toFloat() + parentOffsetX, + previousScrollY.toFloat() + parentOffsetY + ) } } diff --git a/app/src/main/java/foundation/e/blisslauncher/core/blur/BlurWallpaperFilter.kt b/app/src/main/java/foundation/e/blisslauncher/core/blur/BlurWallpaperFilter.kt index 6c1df95761..b075661a84 100644 --- a/app/src/main/java/foundation/e/blisslauncher/core/blur/BlurWallpaperFilter.kt +++ b/app/src/main/java/foundation/e/blisslauncher/core/blur/BlurWallpaperFilter.kt @@ -16,24 +16,26 @@ class BlurWallpaperFilter(private val context: Context) : WallpaperFilter - if (error == null) { - this@BlurWallpaperProvider.wallpapers = result - runOnMainThread(::notifyWallpaperChanged) - wallpaper.recycle() - } else { - if (error is OutOfMemoryError) { - runOnMainThread { - Toast.makeText(context, context.getString(R.string.toast_failed), Toast.LENGTH_LONG).show() - notifyWallpaperChanged() + applyTask = + wallpaperFilter.apply(wallpaper).setCallback { result, error -> + if (error == null) { + this@BlurWallpaperProvider.wallpapers = result + runOnMainThread(::notifyWallpaperChanged) + wallpaper.recycle() + } else { + if (error is OutOfMemoryError) { + runOnMainThread { + Toast.makeText( + context, + context.getString(R.string.toast_failed), + Toast.LENGTH_LONG + ) + .show() + notifyWallpaperChanged() + } } + wallpaper.recycle() } - wallpaper.recycle() } - } applyTask = null if (updatePending) { updatePending = false @@ -146,11 +151,7 @@ class BlurWallpaperProvider(val context: Context) { private fun applyVibrancy(wallpaper: Bitmap?): Bitmap { val width = wallpaper!!.width val height = wallpaper.height - val bitmap = Bitmap.createBitmap( - width, - height, - Bitmap.Config.ARGB_8888 - ) + val bitmap = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888) val canvas = Canvas() canvas.setBitmap(bitmap) val colorMatrix = ColorMatrix() @@ -163,8 +164,7 @@ class BlurWallpaperProvider(val context: Context) { } private fun scaleAndCropToScreenSize(wallpaper: Bitmap): Bitmap { - val wm = - context.getSystemService(Context.WINDOW_SERVICE) as WindowManager + val wm = context.getSystemService(Context.WINDOW_SERVICE) as WindowManager val display = wm.defaultDisplay display.getRealMetrics(displayMetrics) val width = displayMetrics.widthPixels @@ -175,12 +175,9 @@ class BlurWallpaperProvider(val context: Context) { if (upscaleFactor <= 0) { return wallpaper } - val scaledWidth = - max(width.toFloat(), wallpaper.width * upscaleFactor).toInt() - val scaledHeight = - max(height.toFloat(), wallpaper.height * upscaleFactor).toInt() - val scaledWallpaper = - Bitmap.createScaledBitmap(wallpaper, scaledWidth, scaledHeight, false) + val scaledWidth = max(width.toFloat(), wallpaper.width * upscaleFactor).toInt() + val scaledHeight = max(height.toFloat(), wallpaper.height * upscaleFactor).toInt() + val scaledWallpaper = Bitmap.createScaledBitmap(wallpaper, scaledWidth, scaledHeight, false) val navigationBarHeight = 0 /*if (BlissLauncher.getApplication(context).getDeviceProfile().hasSoftNavigationBar(context)) { @@ -190,17 +187,12 @@ class BlurWallpaperProvider(val context: Context) { } }*/ val y: Int - y = if (scaledWallpaper.height > height) { - (scaledWallpaper.height - height) / 2 - } else 0 - - return Bitmap.createBitmap( - scaledWallpaper, - 0, - y, - width, - height - navigationBarHeight - ) + y = + if (scaledWallpaper.height > height) { + (scaledWallpaper.height - height) / 2 + } else 0 + + return Bitmap.createBitmap(scaledWallpaper, 0, y, width, height - navigationBarHeight) } fun addListener(listener: Listener) { @@ -231,7 +223,9 @@ class BlurWallpaperProvider(val context: Context) { }*/ companion object : - SingletonHolder(ensureOnMainThread(useApplicationContext(::BlurWallpaperProvider))) { + SingletonHolder( + ensureOnMainThread(useApplicationContext(::BlurWallpaperProvider)) + ) { var isEnabled: Boolean = false private var sEnabledFlag: Int = 0 diff --git a/app/src/main/java/foundation/e/blisslauncher/core/blur/ShaderBlurDrawable.kt b/app/src/main/java/foundation/e/blisslauncher/core/blur/ShaderBlurDrawable.kt index 27d906d196..fc38be1f99 100644 --- a/app/src/main/java/foundation/e/blisslauncher/core/blur/ShaderBlurDrawable.kt +++ b/app/src/main/java/foundation/e/blisslauncher/core/blur/ShaderBlurDrawable.kt @@ -12,7 +12,8 @@ import android.graphics.Shader import android.graphics.drawable.Drawable import foundation.e.blisslauncher.core.DeviceProfile -class ShaderBlurDrawable internal constructor(private val blurWallpaperProvider: BlurWallpaperProvider) : +class ShaderBlurDrawable +internal constructor(private val blurWallpaperProvider: BlurWallpaperProvider) : Drawable(), BlurWallpaperProvider.Listener { private var blurAlpha = 255 @@ -50,12 +51,13 @@ class ShaderBlurDrawable internal constructor(private val blurWallpaperProvider: blurBitmap = blurWallpaperProvider.placeholder } blurBitmap = - if (blurBitmap!!.height >= blurBounds.bottom && - blurBitmap!!.width >= blurBounds.right + if ( + blurBitmap!!.height >= blurBounds.bottom && blurBitmap!!.width >= blurBounds.right ) { Bitmap.createBitmap( blurBitmap!!, - blurBounds.left.toInt(), blurBounds.top.toInt(), + blurBounds.left.toInt(), + blurBounds.top.toInt(), blurBounds.right.toInt() - blurBounds.left.toInt(), blurBounds.bottom.toInt() - blurBounds.top.toInt() ) @@ -63,19 +65,21 @@ class ShaderBlurDrawable internal constructor(private val blurWallpaperProvider: blurBitmap } - //setupBlurPath() + // setupBlurPath() - //canvas.translate(0f, -1500f) + // canvas.translate(0f, -1500f) if (noRadius) { canvas.drawRect( - 0f, 0f, - blurBounds.right - blurBounds.left, blurBounds.bottom - blurBounds.top, + 0f, + 0f, + blurBounds.right - blurBounds.left, + blurBounds.bottom - blurBounds.top, blurPaint ) } else { canvas.drawPath(DeviceProfile.path, blurPaint) } - //canvas.translate(0f, 1500f) + // canvas.translate(0f, 1500f) } override fun setAlpha(alpha: Int) { @@ -104,10 +108,11 @@ class ShaderBlurDrawable internal constructor(private val blurWallpaperProvider: setBlurBounds(left.toFloat(), top.toFloat(), right.toFloat(), bottom.toFloat()) fun setBlurBounds(left: Float, top: Float, right: Float, bottom: Float) { - if (blurBounds.left != left || - blurBounds.top != top || - blurBounds.right != right || - blurBounds.bottom != bottom + if ( + blurBounds.left != left || + blurBounds.top != top || + blurBounds.right != right || + blurBounds.bottom != bottom ) { blurBounds.set(left, top, right, bottom) blurPathValid = false @@ -120,10 +125,9 @@ class ShaderBlurDrawable internal constructor(private val blurWallpaperProvider: invalidateSelf() } - override fun setColorFilter(colorFilter: ColorFilter?) { - } + override fun setColorFilter(colorFilter: ColorFilter?) {} fun startListening() = blurWallpaperProvider.addListener(this) fun stopListening() = blurWallpaperProvider.removeListener(this) -} \ No newline at end of file +} diff --git a/app/src/main/java/foundation/e/blisslauncher/core/blur/WallpaperFilter.kt b/app/src/main/java/foundation/e/blisslauncher/core/blur/WallpaperFilter.kt index 07fd3db646..ebd04151d8 100644 --- a/app/src/main/java/foundation/e/blisslauncher/core/blur/WallpaperFilter.kt +++ b/app/src/main/java/foundation/e/blisslauncher/core/blur/WallpaperFilter.kt @@ -54,4 +54,4 @@ interface WallpaperFilter { } } } -} \ No newline at end of file +} diff --git a/app/src/main/java/foundation/e/blisslauncher/core/customviews/BlurBackgroundView.kt b/app/src/main/java/foundation/e/blisslauncher/core/customviews/BlurBackgroundView.kt index 7774143e13..9e09c6351b 100644 --- a/app/src/main/java/foundation/e/blisslauncher/core/customviews/BlurBackgroundView.kt +++ b/app/src/main/java/foundation/e/blisslauncher/core/customviews/BlurBackgroundView.kt @@ -10,8 +10,8 @@ import foundation.e.blisslauncher.core.blur.BlurWallpaperProvider import foundation.e.blisslauncher.core.blur.ShaderBlurDrawable import foundation.e.blisslauncher.core.runOnMainThread -class BlurBackgroundView(context: Context, attrs: AttributeSet?) : View(context, attrs), Insettable, - BlurWallpaperProvider.Listener { +class BlurBackgroundView(context: Context, attrs: AttributeSet?) : + View(context, attrs), Insettable, BlurWallpaperProvider.Listener { private val blurWallpaperProvider by lazy { BlurWallpaperProvider.getInstance(context) } @@ -20,15 +20,13 @@ class BlurBackgroundView(context: Context, attrs: AttributeSet?) : View(context, private val blurDrawableCallback by lazy { object : Drawable.Callback { - override fun unscheduleDrawable(who: Drawable, what: Runnable) { - } + override fun unscheduleDrawable(who: Drawable, what: Runnable) {} override fun invalidateDrawable(who: Drawable) { runOnMainThread { invalidate() } } - override fun scheduleDrawable(who: Drawable, what: Runnable, `when`: Long) { - } + override fun scheduleDrawable(who: Drawable, what: Runnable, `when`: Long) {} } } @@ -66,7 +64,8 @@ class BlurBackgroundView(context: Context, attrs: AttributeSet?) : View(context, private fun createFullBlurDrawable() { fullBlurDrawable?.let { if (isAttachedToWindow) it.stopListening() } - fullBlurDrawable = blurWallpaperProvider.createDrawable().apply { + fullBlurDrawable = + blurWallpaperProvider.createDrawable().apply { callback = blurDrawableCallback setBounds(left, top, right, bottom) if (isAttachedToWindow) startListening() diff --git a/app/src/main/java/foundation/e/blisslauncher/core/customviews/BlurLayout.kt b/app/src/main/java/foundation/e/blisslauncher/core/customviews/BlurLayout.kt index ca66de1bf6..9a64ecf1ce 100644 --- a/app/src/main/java/foundation/e/blisslauncher/core/customviews/BlurLayout.kt +++ b/app/src/main/java/foundation/e/blisslauncher/core/customviews/BlurLayout.kt @@ -6,10 +6,8 @@ import android.util.AttributeSet import android.widget.FrameLayout import foundation.e.blisslauncher.core.blur.BlurViewDelegate -open class BlurLayout @JvmOverloads constructor( - context: Context, - attrs: AttributeSet? = null -) : FrameLayout(context, attrs) { +open class BlurLayout @JvmOverloads constructor(context: Context, attrs: AttributeSet? = null) : + FrameLayout(context, attrs) { private val delegate = BlurViewDelegate(this, attrs) diff --git a/app/src/main/java/foundation/e/blisslauncher/core/customviews/DockGridLayout.kt b/app/src/main/java/foundation/e/blisslauncher/core/customviews/DockGridLayout.kt index 6a6d6549c3..b823e18336 100755 --- a/app/src/main/java/foundation/e/blisslauncher/core/customviews/DockGridLayout.kt +++ b/app/src/main/java/foundation/e/blisslauncher/core/customviews/DockGridLayout.kt @@ -9,11 +9,10 @@ import foundation.e.blisslauncher.BlissLauncher import foundation.e.blisslauncher.core.blur.BlurViewDelegate import foundation.e.blisslauncher.core.utils.OffsetParent -class DockGridLayout @JvmOverloads constructor( - private val mContext: Context, - attrs: AttributeSet? = null, - defStyleAttr: Int = 0 -) : GridLayout(mContext, attrs, defStyleAttr), Insettable, OffsetParent { +class DockGridLayout +@JvmOverloads +constructor(private val mContext: Context, attrs: AttributeSet? = null, defStyleAttr: Int = 0) : + GridLayout(mContext, attrs, defStyleAttr), Insettable, OffsetParent { private val offsetParentDelegate = OffsetParent.OffsetParentDelegate() @@ -35,12 +34,13 @@ class DockGridLayout @JvmOverloads constructor( override fun setInsets(insets: Rect) { val deviceProfile = BlissLauncher.getApplication(mContext).deviceProfile - val lp = - layoutParams as InsettableRelativeLayout.LayoutParams + val lp = layoutParams as InsettableRelativeLayout.LayoutParams lp.height = deviceProfile.hotseatCellHeightPx + insets.bottom setPadding( - deviceProfile.iconDrawablePaddingPx / 2, 0, - deviceProfile.iconDrawablePaddingPx / 2, insets.bottom + deviceProfile.iconDrawablePaddingPx / 2, + 0, + deviceProfile.iconDrawablePaddingPx / 2, + insets.bottom ) layoutParams = lp } diff --git a/app/src/main/java/foundation/e/blisslauncher/core/customviews/SwipeSearchContainer.kt b/app/src/main/java/foundation/e/blisslauncher/core/customviews/SwipeSearchContainer.kt index 5c9654746d..4ab6c9a0ad 100644 --- a/app/src/main/java/foundation/e/blisslauncher/core/customviews/SwipeSearchContainer.kt +++ b/app/src/main/java/foundation/e/blisslauncher/core/customviews/SwipeSearchContainer.kt @@ -5,10 +5,10 @@ import android.util.AttributeSet import android.widget.FrameLayout import foundation.e.blisslauncher.core.utils.OffsetParent -class SwipeSearchContainer @JvmOverloads constructor( - context: Context, - attrs: AttributeSet? = null -) : FrameLayout(context, attrs), OffsetParent { +class SwipeSearchContainer +@JvmOverloads +constructor(context: Context, attrs: AttributeSet? = null) : + FrameLayout(context, attrs), OffsetParent { private val offsetParentDelegate = OffsetParent.OffsetParentDelegate() diff --git a/app/src/main/java/foundation/e/blisslauncher/core/customviews/pageindicators/PageIndicator.kt b/app/src/main/java/foundation/e/blisslauncher/core/customviews/pageindicators/PageIndicator.kt index d75d080011..0b3146254f 100644 --- a/app/src/main/java/foundation/e/blisslauncher/core/customviews/pageindicators/PageIndicator.kt +++ b/app/src/main/java/foundation/e/blisslauncher/core/customviews/pageindicators/PageIndicator.kt @@ -1,10 +1,8 @@ package foundation.e.blisslauncher.core.customviews.pageindicators -/** - * Base class for a page indicator. - */ +/** Base class for a page indicator. */ interface PageIndicator { fun setScroll(currentScroll: Int, totalScroll: Int) fun setActiveMarker(activePage: Int) fun setMarkersCount(numMarkers: Int) -} \ No newline at end of file +} diff --git a/app/src/main/java/foundation/e/blisslauncher/core/customviews/pageindicators/PageIndicatorDots.kt b/app/src/main/java/foundation/e/blisslauncher/core/customviews/pageindicators/PageIndicatorDots.kt index eb032fcb00..fb74eb46ab 100644 --- a/app/src/main/java/foundation/e/blisslauncher/core/customviews/pageindicators/PageIndicatorDots.kt +++ b/app/src/main/java/foundation/e/blisslauncher/core/customviews/pageindicators/PageIndicatorDots.kt @@ -20,8 +20,8 @@ import foundation.e.blisslauncher.R import kotlin.math.abs /** - * [PageIndicator] which shows dots per page. The active page is shown with the current - * accent color. + * [PageIndicator] which shows dots per page. The active page is shown with the current accent + * color. */ class PageIndicatorDots(context: Context?, attrs: AttributeSet?, defStyleAttr: Int) : View(context, attrs, defStyleAttr), PageIndicator { @@ -33,13 +33,10 @@ class PageIndicatorDots(context: Context?, attrs: AttributeSet?, defStyleAttr: I private var mNumPages = 0 private var mActivePage = 0 /** - * The current position of the active dot including the animation progress. - * For ex: - * 0.0 => Active dot is at position 0 - * 0.33 => Active dot is at position 0 and is moving towards 1 - * 0.50 => Active dot is at position [0, 1] - * 0.77 => Active dot has left position 0 and is collapsing towards position 1 - * 1.0 => Active dot is at position 1 + * The current position of the active dot including the animation progress. For ex: 0.0 => + * Active dot is at position 0 0.33 => Active dot is at position 0 and is moving towards 1 0.50 + * => Active dot is at position [0, 1] 0.77 => Active dot has left position 0 and is collapsing + * towards position 1 1.0 => Active dot is at position 1 */ private var mCurrentPosition = 0f private var mFinalPosition = 0f @@ -60,13 +57,17 @@ class PageIndicatorDots(context: Context?, attrs: AttributeSet?, defStyleAttr: I val pageToLeft = currentScroll / scrollPerPage val pageToLeftScroll = pageToLeft * scrollPerPage val pageToRightScroll = pageToLeftScroll + scrollPerPage - val scrollThreshold = - SHIFT_THRESHOLD * scrollPerPage + val scrollThreshold = SHIFT_THRESHOLD * scrollPerPage when { - currentScroll < pageToLeftScroll + scrollThreshold -> { // scroll is within the left page's threshold + currentScroll < + pageToLeftScroll + + scrollThreshold -> { // scroll is within the left page's threshold animateToPosition(pageToLeft.toFloat()) } - currentScroll > pageToRightScroll - scrollThreshold -> { // scroll is far enough from left page to go to the right page + currentScroll > + pageToRightScroll - + scrollThreshold -> { // scroll is far enough from left page to go to the + // right page animateToPosition(pageToLeft + 1.toFloat()) } else -> { // scroll is between left and right page @@ -83,15 +84,13 @@ class PageIndicatorDots(context: Context?, attrs: AttributeSet?, defStyleAttr: I } if (mAnimator == null && mCurrentPosition.compareTo(mFinalPosition) != 0) { val positionForThisAnim = - if (mCurrentPosition > mFinalPosition) mCurrentPosition - SHIFT_PER_ANIMATION else mCurrentPosition + SHIFT_PER_ANIMATION - mAnimator = ObjectAnimator.ofFloat( - this, - CURRENT_POSITION, - positionForThisAnim - ).apply { - addListener(AnimationCycleListener()) - duration = ANIMATION_DURATION - } + if (mCurrentPosition > mFinalPosition) mCurrentPosition - SHIFT_PER_ANIMATION + else mCurrentPosition + SHIFT_PER_ANIMATION + mAnimator = + ObjectAnimator.ofFloat(this, CURRENT_POSITION, positionForThisAnim).apply { + addListener(AnimationCycleListener()) + duration = ANIMATION_DURATION + } mAnimator?.start() } } @@ -106,8 +105,8 @@ class PageIndicatorDots(context: Context?, attrs: AttributeSet?, defStyleAttr: I } /** - * Sets up up the page indicator to play the entry animation. - * [.playEntryAnimation] must be called after this. + * Sets up up the page indicator to play the entry animation. [.playEntryAnimation] must be + * called after this. */ fun prepareEntryAnimation() { mEntryAnimationRadiusFactors = FloatArray(mNumPages) @@ -121,15 +120,12 @@ class PageIndicatorDots(context: Context?, attrs: AttributeSet?, defStyleAttr: I invalidate() return } - val interpolator: Interpolator = - OvershootInterpolator(ENTER_ANIMATION_OVERSHOOT_TENSION) + val interpolator: Interpolator = OvershootInterpolator(ENTER_ANIMATION_OVERSHOOT_TENSION) val animSet = AnimatorSet() for (i in 0 until count) { - val anim = ValueAnimator.ofFloat(0f, 1f) - .setDuration(ENTER_ANIMATION_DURATION.toLong()) + val anim = ValueAnimator.ofFloat(0f, 1f).setDuration(ENTER_ANIMATION_DURATION.toLong()) anim!!.addUpdateListener { animation -> - mEntryAnimationRadiusFactors!![i] = - (animation!!.animatedValue as Float) + mEntryAnimationRadiusFactors!![i] = (animation!!.animatedValue as Float) invalidate() } anim.interpolator = interpolator @@ -137,13 +133,15 @@ class PageIndicatorDots(context: Context?, attrs: AttributeSet?, defStyleAttr: I ENTER_ANIMATION_START_DELAY + ENTER_ANIMATION_STAGGERED_DELAY * i.toLong() animSet.play(anim) } - animSet.addListener(object : AnimatorListenerAdapter() { - override fun onAnimationEnd(animation: Animator?) { - mEntryAnimationRadiusFactors = null - invalidateOutline() - invalidate() + animSet.addListener( + object : AnimatorListenerAdapter() { + override fun onAnimationEnd(animation: Animator?) { + mEntryAnimationRadiusFactors = null + invalidateOutline() + invalidate() + } } - }) + ) animSet.start() } @@ -163,13 +161,13 @@ class PageIndicatorDots(context: Context?, attrs: AttributeSet?, defStyleAttr: I heightMeasureSpec: Int ) { // Add extra spacing of mDotRadius on all sides so that entry animation could be run. val width = - if (MeasureSpec.getMode(widthMeasureSpec) == MeasureSpec.EXACTLY) MeasureSpec.getSize( - widthMeasureSpec - ) else ((mNumPages * 3 + 2) * mDotRadius).toInt() + if (MeasureSpec.getMode(widthMeasureSpec) == MeasureSpec.EXACTLY) + MeasureSpec.getSize(widthMeasureSpec) + else ((mNumPages * 3 + 2) * mDotRadius).toInt() val height = - if (MeasureSpec.getMode(heightMeasureSpec) == MeasureSpec.EXACTLY) MeasureSpec.getSize( - heightMeasureSpec - ) else (4 * mDotRadius).toInt() + if (MeasureSpec.getMode(heightMeasureSpec) == MeasureSpec.EXACTLY) + MeasureSpec.getSize(heightMeasureSpec) + else (4 * mDotRadius).toInt() setMeasuredDimension(width, height) } @@ -215,8 +213,7 @@ class PageIndicatorDots(context: Context?, attrs: AttributeSet?, defStyleAttr: I sTempRect!!.top = height * 0.5f - mDotRadius sTempRect.bottom = height * 0.5f + mDotRadius sTempRect.left = startX + startCircle * circleGap - sTempRect.right = - sTempRect.left + diameter + sTempRect.right = sTempRect.left + diameter if (delta < SHIFT_PER_ANIMATION) { // dot is capturing the right circle. sTempRect.right += delta * circleGap * 2 } else { // Dot is leaving the left circle. @@ -226,10 +223,8 @@ class PageIndicatorDots(context: Context?, attrs: AttributeSet?, defStyleAttr: I } if (mIsRtl) { val rectWidth = sTempRect.width() - sTempRect.right = - width - sTempRect.left - sTempRect.left = - sTempRect.right - rectWidth + sTempRect.right = width - sTempRect.left + sTempRect.left = sTempRect.right - rectWidth } return sTempRect } @@ -249,9 +244,7 @@ class PageIndicatorDots(context: Context?, attrs: AttributeSet?, defStyleAttr: I } } - /** - * Listener for keep running the animation until the final state is reached. - */ + /** Listener for keep running the animation until the final state is reached. */ private inner class AnimationCycleListener : AnimatorListenerAdapter() { private var mCancelled = false override fun onAnimationCancel(animation: Animator?) { @@ -277,9 +270,7 @@ class PageIndicatorDots(context: Context?, attrs: AttributeSet?, defStyleAttr: I private const val ENTER_ANIMATION_OVERSHOOT_TENSION = 4.9f private val sTempRect: RectF? = RectF() private val CURRENT_POSITION: Property = - object : Property( - Float::class.java, "current_position" - ) { + object : Property(Float::class.java, "current_position") { override fun get(obj: PageIndicatorDots): Float { return obj.mCurrentPosition } @@ -298,6 +289,6 @@ class PageIndicatorDots(context: Context?, attrs: AttributeSet?, defStyleAttr: I outlineProvider = MyOutlineProver() mActiveColor = resources.getColor(R.color.dot_on_color) mInActiveColor = resources.getColor(R.color.dot_on_color) - //mIsRtl = Utilities.isRtl(getResources()) + // mIsRtl = Utilities.isRtl(getResources()) } -} \ No newline at end of file +} diff --git a/app/src/main/java/foundation/e/blisslauncher/core/utils/DepthManager.kt b/app/src/main/java/foundation/e/blisslauncher/core/utils/DepthManager.kt index a184932853..55eef0900c 100644 --- a/app/src/main/java/foundation/e/blisslauncher/core/utils/DepthManager.kt +++ b/app/src/main/java/foundation/e/blisslauncher/core/utils/DepthManager.kt @@ -8,18 +8,21 @@ import foundation.e.blisslauncher.features.launcher.LauncherActivity class DepthManager(private val launcher: LauncherActivity) { private val wallpaperManager = launcher.getSystemService(WallpaperManager::class.java)!! - private val setWallpaperZoomOut = WallpaperManager::class.java.getMethod( - "setWallpaperZoomOut", IBinder::class.java, Float::class.java) + private val setWallpaperZoomOut = + WallpaperManager::class + .java + .getMethod("setWallpaperZoomOut", IBinder::class.java, Float::class.java) init { - launcher.rootView.addOnAttachStateChangeListener(object : View.OnAttachStateChangeListener { - override fun onViewAttachedToWindow(v: View) { - updateDepth() - } + launcher.rootView.addOnAttachStateChangeListener( + object : View.OnAttachStateChangeListener { + override fun onViewAttachedToWindow(v: View) { + updateDepth() + } - override fun onViewDetachedFromWindow(v: View) { + override fun onViewDetachedFromWindow(v: View) {} } - }) + ) } fun updateDepth() { diff --git a/app/src/main/java/foundation/e/blisslauncher/core/utils/SingletonHolder.kt b/app/src/main/java/foundation/e/blisslauncher/core/utils/SingletonHolder.kt index 7e58554df7..e6c6b3713a 100644 --- a/app/src/main/java/foundation/e/blisslauncher/core/utils/SingletonHolder.kt +++ b/app/src/main/java/foundation/e/blisslauncher/core/utils/SingletonHolder.kt @@ -8,8 +8,7 @@ import java.util.concurrent.ExecutionException open class SingletonHolder(creator: (A) -> T) { private var creator: ((A) -> T)? = creator - @Volatile - private var instance: T? = null + @Volatile private var instance: T? = null open fun getInstance(arg: A): T { val i = instance @@ -48,6 +47,7 @@ fun ensureOnMainThread(creator: (A) -> T): (A) -> T { } } } + fun useApplicationContext(creator: (Context) -> T): (Context) -> T { return { it -> creator(it.applicationContext) } -} \ No newline at end of file +} diff --git a/app/src/main/java/foundation/e/blisslauncher/core/wallpaper/WallpaperColorsCompat.kt b/app/src/main/java/foundation/e/blisslauncher/core/wallpaper/WallpaperColorsCompat.kt index 98430cc69d..76c37b8070 100644 --- a/app/src/main/java/foundation/e/blisslauncher/core/wallpaper/WallpaperColorsCompat.kt +++ b/app/src/main/java/foundation/e/blisslauncher/core/wallpaper/WallpaperColorsCompat.kt @@ -17,23 +17,15 @@ package foundation.e.blisslauncher.core.wallpaper import androidx.annotation.IntDef -data class WallpaperColorsCompat( - val primaryColor: Int, - @ColorsHints val colorHints: Int -) { +data class WallpaperColorsCompat(val primaryColor: Int, @ColorsHints val colorHints: Int) { companion object { const val HINT_SUPPORTS_DARK_TEXT = 0x1 const val HINT_SUPPORTS_DARK_THEME = 0x2 - @IntDef( - value = [HINT_SUPPORTS_DARK_TEXT, HINT_SUPPORTS_DARK_THEME], - flag = true - ) - @Retention( - AnnotationRetention.SOURCE - ) + @IntDef(value = [HINT_SUPPORTS_DARK_TEXT, HINT_SUPPORTS_DARK_THEME], flag = true) + @Retention(AnnotationRetention.SOURCE) annotation class ColorsHints } } diff --git a/app/src/main/java/foundation/e/blisslauncher/core/wallpaper/WallpaperManagerCompat.kt b/app/src/main/java/foundation/e/blisslauncher/core/wallpaper/WallpaperManagerCompat.kt index c0b588ab1f..4ccb598e06 100644 --- a/app/src/main/java/foundation/e/blisslauncher/core/wallpaper/WallpaperManagerCompat.kt +++ b/app/src/main/java/foundation/e/blisslauncher/core/wallpaper/WallpaperManagerCompat.kt @@ -37,8 +37,10 @@ class WallpaperManagerCompat(val context: Context) { var wallpaperColors: WallpaperColorsCompat? = null private set - val colorHints get() = wallpaperColors?.colorHints ?: 0 - val supportsDarkTheme get() = (colorHints and HINT_SUPPORTS_DARK_THEME) != 0 + val colorHints + get() = wallpaperColors?.colorHints ?: 0 + val supportsDarkTheme + get() = (colorHints and HINT_SUPPORTS_DARK_THEME) != 0 private var wcColorHintsMethod: Method? = null @@ -85,9 +87,7 @@ class WallpaperManagerCompat(val context: Context) { } private fun notifyChange() { - listeners.toTypedArray().forEach { - it.onColorsChanged() - } + listeners.toTypedArray().forEach { it.onColorsChanged() } } interface OnColorsChangedListener { @@ -95,5 +95,7 @@ class WallpaperManagerCompat(val context: Context) { } companion object : - SingletonHolder(ensureOnMainThread(useApplicationContext(::WallpaperManagerCompat))) + SingletonHolder( + ensureOnMainThread(useApplicationContext(::WallpaperManagerCompat)) + ) } diff --git a/app/src/main/java/foundation/e/blisslauncher/features/launcher/LauncherActivity.java b/app/src/main/java/foundation/e/blisslauncher/features/launcher/LauncherActivity.java index 30ff2d7505..3115be8770 100755 --- a/app/src/main/java/foundation/e/blisslauncher/features/launcher/LauncherActivity.java +++ b/app/src/main/java/foundation/e/blisslauncher/features/launcher/LauncherActivity.java @@ -1480,8 +1480,7 @@ public class LauncherActivity extends AppCompatActivity implements findViewById(R.id.edit_widgets_button).setOnClickListener( view -> startActivity(new Intent(this, WidgetsActivity.class))); - if (WeatherUtils.isWeatherServiceAvailable( - this)) { + if (WeatherUtils.isWeatherServiceAvailable(this)) { startService(new Intent(this, WeatherSourceListenerService.class)); startService(new Intent(this, DeviceStatusService.class)); } diff --git a/app/src/main/java/foundation/e/blisslauncher/features/widgets/DefaultWidgets.kt b/app/src/main/java/foundation/e/blisslauncher/features/widgets/DefaultWidgets.kt index 62d66603b4..a4048cc7a0 100644 --- a/app/src/main/java/foundation/e/blisslauncher/features/widgets/DefaultWidgets.kt +++ b/app/src/main/java/foundation/e/blisslauncher/features/widgets/DefaultWidgets.kt @@ -4,8 +4,10 @@ import android.content.ComponentName import foundation.e.blisslauncher.features.weather.WeatherAppWidgetProvider object DefaultWidgets { - val ecloudWidget = ComponentName("foundation.e.drive", "foundation.e.drive.widgets.EDriveWidget") - val privacyWidget = ComponentName("foundation.e.advancedprivacy", "foundation.e.privacycentralapp.Widget") + val ecloudWidget = + ComponentName("foundation.e.drive", "foundation.e.drive.widgets.EDriveWidget") + val privacyWidget = + ComponentName("foundation.e.advancedprivacy", "foundation.e.privacycentralapp.Widget") val weatherWidget = WeatherAppWidgetProvider.COMPONENT_NAME val widgets = setOf(ecloudWidget, privacyWidget) diff --git a/app/src/main/res/anim/enter.xml b/app/src/main/res/anim/enter.xml index 31024e220c..a59dcf51af 100755 --- a/app/src/main/res/anim/enter.xml +++ b/app/src/main/res/anim/enter.xml @@ -3,4 +3,4 @@ android:duration="@android:integer/config_longAnimTime" android:fromXDelta="100%p" android:toXDelta="0%p"> - \ No newline at end of file + diff --git a/app/src/main/res/anim/leave.xml b/app/src/main/res/anim/leave.xml index 06668d78c1..32a6f4a7c6 100755 --- a/app/src/main/res/anim/leave.xml +++ b/app/src/main/res/anim/leave.xml @@ -3,4 +3,4 @@ android:duration="@android:integer/config_longAnimTime" android:fromXDelta="0%p" android:toXDelta="-100%p"> - \ No newline at end of file + diff --git a/app/src/main/res/anim/wobble.xml b/app/src/main/res/anim/wobble.xml index 4dbe1718ec..dbe93d9894 100755 --- a/app/src/main/res/anim/wobble.xml +++ b/app/src/main/res/anim/wobble.xml @@ -6,4 +6,4 @@ android:pivotY="50%" android:repeatCount="infinite" android:repeatMode="reverse" - android:toDegrees="2" /> \ No newline at end of file + android:toDegrees="2" /> diff --git a/app/src/main/res/anim/wobble_reverse.xml b/app/src/main/res/anim/wobble_reverse.xml index 92330781bd..e3bf3c23a3 100755 --- a/app/src/main/res/anim/wobble_reverse.xml +++ b/app/src/main/res/anim/wobble_reverse.xml @@ -6,4 +6,4 @@ android:pivotY="50%" android:repeatCount="infinite" android:repeatMode="reverse" - android:toDegrees="-2" /> \ No newline at end of file + android:toDegrees="-2" /> diff --git a/app/src/main/res/drawable/btn_background_add_widget_rounded.xml b/app/src/main/res/drawable/btn_background_add_widget_rounded.xml index ec8ad249b7..7b6fd83c88 100644 --- a/app/src/main/res/drawable/btn_background_add_widget_rounded.xml +++ b/app/src/main/res/drawable/btn_background_add_widget_rounded.xml @@ -6,4 +6,4 @@ - \ No newline at end of file + diff --git a/app/src/main/res/drawable/btn_rounded_corner.xml b/app/src/main/res/drawable/btn_rounded_corner.xml index f7fcbf4ff7..010eb10ff8 100644 --- a/app/src/main/res/drawable/btn_rounded_corner.xml +++ b/app/src/main/res/drawable/btn_rounded_corner.xml @@ -7,4 +7,4 @@ - \ No newline at end of file + diff --git a/app/src/main/res/drawable/dot_off.xml b/app/src/main/res/drawable/dot_off.xml index 442bf74197..dcc40c2143 100755 --- a/app/src/main/res/drawable/dot_off.xml +++ b/app/src/main/res/drawable/dot_off.xml @@ -4,4 +4,4 @@ android:innerRadius="0dp" android:thickness="6dp"> - \ No newline at end of file + diff --git a/app/src/main/res/drawable/dot_on.xml b/app/src/main/res/drawable/dot_on.xml index b82015e30e..f20cf38fd7 100755 --- a/app/src/main/res/drawable/dot_on.xml +++ b/app/src/main/res/drawable/dot_on.xml @@ -4,4 +4,4 @@ android:innerRadius="0dp" android:thickness="6dp"> - \ No newline at end of file + diff --git a/app/src/main/res/drawable/folder_title_text_cursor.xml b/app/src/main/res/drawable/folder_title_text_cursor.xml index cd74bcd239..dc9df35ea5 100644 --- a/app/src/main/res/drawable/folder_title_text_cursor.xml +++ b/app/src/main/res/drawable/folder_title_text_cursor.xml @@ -2,4 +2,4 @@ - \ No newline at end of file + diff --git a/app/src/main/res/drawable/folder_window.xml b/app/src/main/res/drawable/folder_window.xml index a6e5b64f1a..475540dd9d 100755 --- a/app/src/main/res/drawable/folder_window.xml +++ b/app/src/main/res/drawable/folder_window.xml @@ -6,4 +6,4 @@ - \ No newline at end of file + diff --git a/app/src/main/res/drawable/gap.xml b/app/src/main/res/drawable/gap.xml index d081f3a245..996b6fde6e 100755 --- a/app/src/main/res/drawable/gap.xml +++ b/app/src/main/res/drawable/gap.xml @@ -4,4 +4,4 @@ - \ No newline at end of file + diff --git a/app/src/main/res/drawable/item_suggestion_background.xml b/app/src/main/res/drawable/item_suggestion_background.xml index 9239afef1f..aa1c2581a9 100755 --- a/app/src/main/res/drawable/item_suggestion_background.xml +++ b/app/src/main/res/drawable/item_suggestion_background.xml @@ -2,4 +2,4 @@ - \ No newline at end of file + diff --git a/app/src/main/res/drawable/item_widget_bottom_round_corner.xml b/app/src/main/res/drawable/item_widget_bottom_round_corner.xml index dd3694e790..03c5c147c7 100755 --- a/app/src/main/res/drawable/item_widget_bottom_round_corner.xml +++ b/app/src/main/res/drawable/item_widget_bottom_round_corner.xml @@ -6,4 +6,4 @@ android:topRightRadius="0dp" android:bottomLeftRadius="12dp" android:bottomRightRadius="12dp"/> - \ No newline at end of file + diff --git a/app/src/main/res/drawable/item_widget_top_round_corner.xml b/app/src/main/res/drawable/item_widget_top_round_corner.xml index 41b1b578ae..bb76445d41 100755 --- a/app/src/main/res/drawable/item_widget_top_round_corner.xml +++ b/app/src/main/res/drawable/item_widget_top_round_corner.xml @@ -6,4 +6,4 @@ android:bottomRightRadius="0dp" android:topLeftRadius="12dp" android:topRightRadius="12dp"/> - \ No newline at end of file + diff --git a/app/src/main/res/drawable/search_widget.xml b/app/src/main/res/drawable/search_widget.xml index 48c355e3e2..46562502c4 100755 --- a/app/src/main/res/drawable/search_widget.xml +++ b/app/src/main/res/drawable/search_widget.xml @@ -7,4 +7,4 @@ - \ No newline at end of file + diff --git a/app/src/main/res/drawable/widget_resize_frame.xml b/app/src/main/res/drawable/widget_resize_frame.xml index ee3b9e82f1..de9910081a 100644 --- a/app/src/main/res/drawable/widget_resize_frame.xml +++ b/app/src/main/res/drawable/widget_resize_frame.xml @@ -4,4 +4,4 @@ - \ No newline at end of file + diff --git a/app/src/main/res/drawable/widget_resize_thumb_handle.xml b/app/src/main/res/drawable/widget_resize_thumb_handle.xml index f72d24e4d7..d863565c93 100644 --- a/app/src/main/res/drawable/widget_resize_thumb_handle.xml +++ b/app/src/main/res/drawable/widget_resize_thumb_handle.xml @@ -130,4 +130,4 @@ - \ No newline at end of file + diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml index 6be9af4983..2b31b02c32 100755 --- a/app/src/main/res/layout/activity_main.xml +++ b/app/src/main/res/layout/activity_main.xml @@ -112,4 +112,4 @@ android:indeterminateTint="?workspaceTextColor" android:visibility="gone" /> - \ No newline at end of file + diff --git a/app/src/main/res/layout/activity_widget_picker.xml b/app/src/main/res/layout/activity_widget_picker.xml index ae816672f5..f614b8a25d 100644 --- a/app/src/main/res/layout/activity_widget_picker.xml +++ b/app/src/main/res/layout/activity_widget_picker.xml @@ -2,4 +2,4 @@ \ No newline at end of file + android:layout_height="wrap_content" /> diff --git a/app/src/main/res/layout/app_view.xml b/app/src/main/res/layout/app_view.xml index f58d542a23..e277efde93 100755 --- a/app/src/main/res/layout/app_view.xml +++ b/app/src/main/res/layout/app_view.xml @@ -55,4 +55,4 @@ - \ No newline at end of file + diff --git a/app/src/main/res/layout/calendar_icon.xml b/app/src/main/res/layout/calendar_icon.xml index 3e34eabd19..92203c03cc 100755 --- a/app/src/main/res/layout/calendar_icon.xml +++ b/app/src/main/res/layout/calendar_icon.xml @@ -27,4 +27,4 @@ android:gravity="center_horizontal" android:textColor="#000" /> - \ No newline at end of file + diff --git a/app/src/main/res/layout/item_added_widget.xml b/app/src/main/res/layout/item_added_widget.xml index 9bbac8acbf..72eba2a8e6 100644 --- a/app/src/main/res/layout/item_added_widget.xml +++ b/app/src/main/res/layout/item_added_widget.xml @@ -32,4 +32,4 @@ android:layout_alignParentEnd="true" android:padding="6dp" android:src="@drawable/ic_add_widget_green_24dp" /> - \ No newline at end of file + diff --git a/app/src/main/res/layout/item_all_widget.xml b/app/src/main/res/layout/item_all_widget.xml index d48de2203d..b61d77c0d9 100644 --- a/app/src/main/res/layout/item_all_widget.xml +++ b/app/src/main/res/layout/item_all_widget.xml @@ -23,4 +23,4 @@ android:layout_marginRight="16dp" android:layout_toEndOf="@+id/widget_icon" android:textColor="#000" /> - \ No newline at end of file + diff --git a/app/src/main/res/layout/item_weather_forecast.xml b/app/src/main/res/layout/item_weather_forecast.xml index d9649759ff..ca4ec955a3 100644 --- a/app/src/main/res/layout/item_weather_forecast.xml +++ b/app/src/main/res/layout/item_weather_forecast.xml @@ -36,4 +36,4 @@ android:textAppearance="?android:attr/textAppearanceSmallInverse" android:textColor="?widgetPrimaryTextColor" /> - \ No newline at end of file + diff --git a/app/src/main/res/layout/layout_used_apps.xml b/app/src/main/res/layout/layout_used_apps.xml index 0f215c84ef..8240d99ecf 100755 --- a/app/src/main/res/layout/layout_used_apps.xml +++ b/app/src/main/res/layout/layout_used_apps.xml @@ -37,4 +37,4 @@ android:textColor="?workspaceTextColor" android:textSize="16sp" /> - \ No newline at end of file + diff --git a/app/src/main/res/layout/layout_widget_host_container.xml b/app/src/main/res/layout/layout_widget_host_container.xml index 4ba5f8056b..2e86796fa8 100644 --- a/app/src/main/res/layout/layout_widget_host_container.xml +++ b/app/src/main/res/layout/layout_widget_host_container.xml @@ -24,4 +24,4 @@ android:layout_gravity="center_horizontal|bottom" android:src="@drawable/widget_resize_thumb_handle" /> - \ No newline at end of file + diff --git a/app/src/main/res/layout/widgets_page.xml b/app/src/main/res/layout/widgets_page.xml index d894ac4a83..34f5daa0bf 100755 --- a/app/src/main/res/layout/widgets_page.xml +++ b/app/src/main/res/layout/widgets_page.xml @@ -108,4 +108,4 @@ android:text="Max" android:textColor="@color/white" /> - \ No newline at end of file + diff --git a/app/src/main/res/values-de/strings.xml b/app/src/main/res/values-de/strings.xml index ce5e497f9c..699d8ae219 100644 --- a/app/src/main/res/values-de/strings.xml +++ b/app/src/main/res/values-de/strings.xml @@ -143,4 +143,4 @@ Benutzerdefinierten Standort in den Einstellungen von Wetter festlegen. Berechtigung nicht erteilt Karten - \ No newline at end of file + diff --git a/app/src/main/res/values-es/strings.xml b/app/src/main/res/values-es/strings.xml index c720f8c9f4..8f6542c590 100644 --- a/app/src/main/res/values-es/strings.xml +++ b/app/src/main/res/values-es/strings.xml @@ -133,4 +133,4 @@ Mostrar al minimizar Seleccione esta opción para alternar entre los iconos estándar (Color) y los alternativos (Blanco) Mapas - \ No newline at end of file + diff --git a/app/src/main/res/values-fr/strings.xml b/app/src/main/res/values-fr/strings.xml index 3a0e95eeed..1251ae7dd0 100644 --- a/app/src/main/res/values-fr/strings.xml +++ b/app/src/main/res/values-fr/strings.xml @@ -142,4 +142,4 @@ Autorisation refusée Le widget n\'est pas redimensionnable Cartes - \ No newline at end of file + diff --git a/app/src/main/res/values-it/strings.xml b/app/src/main/res/values-it/strings.xml index 1035559d7d..c49219ebc0 100644 --- a/app/src/main/res/values-it/strings.xml +++ b/app/src/main/res/values-it/strings.xml @@ -143,4 +143,4 @@ Imposta una posizione predefinita nelle impostazioni meteo. Autorizzazione rifiutata Il widget non è riscalabile - \ No newline at end of file + diff --git a/app/src/main/res/values-pl/strings.xml b/app/src/main/res/values-pl/strings.xml index a6b3daec93..3ea04e700d 100644 --- a/app/src/main/res/values-pl/strings.xml +++ b/app/src/main/res/values-pl/strings.xml @@ -1,2 +1,2 @@ - \ No newline at end of file + diff --git a/app/src/main/res/values-ro/strings.xml b/app/src/main/res/values-ro/strings.xml index a6b3daec93..3ea04e700d 100644 --- a/app/src/main/res/values-ro/strings.xml +++ b/app/src/main/res/values-ro/strings.xml @@ -1,2 +1,2 @@ - \ No newline at end of file + diff --git a/app/src/main/res/values-v26/bools.xml b/app/src/main/res/values-v26/bools.xml index 3eabcb40f9..7cb264dac1 100644 --- a/app/src/main/res/values-v26/bools.xml +++ b/app/src/main/res/values-v26/bools.xml @@ -1,4 +1,4 @@ false - \ No newline at end of file + diff --git a/app/src/main/res/values/bools.xml b/app/src/main/res/values/bools.xml index e8eb8f791b..8b4b500578 100644 --- a/app/src/main/res/values/bools.xml +++ b/app/src/main/res/values/bools.xml @@ -1,4 +1,4 @@ true - \ No newline at end of file + diff --git a/app/src/main/res/values/dimens.xml b/app/src/main/res/values/dimens.xml index 54be3054ab..47cef0b373 100755 --- a/app/src/main/res/values/dimens.xml +++ b/app/src/main/res/values/dimens.xml @@ -13,4 +13,4 @@ @dimen/dp_12 @dimen/dp_8 200dp - \ No newline at end of file + diff --git a/app/src/main/res/values/ids.xml b/app/src/main/res/values/ids.xml index add7ded471..dcd5b3fe47 100755 --- a/app/src/main/res/values/ids.xml +++ b/app/src/main/res/values/ids.xml @@ -5,4 +5,4 @@ - \ No newline at end of file + diff --git a/app/src/main/res/values/row_column_count.xml b/app/src/main/res/values/row_column_count.xml index abb1d6ed54..3c9a253484 100755 --- a/app/src/main/res/values/row_column_count.xml +++ b/app/src/main/res/values/row_column_count.xml @@ -1,4 +1,4 @@ 4 - \ No newline at end of file + diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 0692a34423..1c0e249228 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -177,4 +177,4 @@ Dock is already full No more room in page Maps - \ No newline at end of file + diff --git a/build-logic/.gitignore b/build-logic/.gitignore new file mode 100644 index 0000000000..72e330e39b --- /dev/null +++ b/build-logic/.gitignore @@ -0,0 +1,3 @@ +.gradle/* +build/* +**/build/* \ No newline at end of file diff --git a/build-logic/kotlin-plugins/build.gradle.kts b/build-logic/kotlin-plugins/build.gradle.kts new file mode 100644 index 0000000000..6b0fd869f7 --- /dev/null +++ b/build-logic/kotlin-plugins/build.gradle.kts @@ -0,0 +1,27 @@ +@file:Suppress("UnstableApiUsage", "DSL_SCOPE_VIOLATION") + +import org.jetbrains.kotlin.gradle.tasks.KotlinCompile + +plugins { `kotlin-dsl` } + +dependencies { implementation(libs.build.spotless) } + +afterEvaluate { + tasks.withType().configureEach { + sourceCompatibility = JavaVersion.VERSION_1_8.toString() + targetCompatibility = JavaVersion.VERSION_1_8.toString() + } + + tasks.withType().configureEach { + kotlinOptions { jvmTarget = JavaVersion.VERSION_1_8.toString() } + } +} + +gradlePlugin { + plugins { + register("spotless") { + id = "foundation.e.blisslauncher.spotless" + implementationClass = "foundation.e.blisslauncher.gradle.SpotlessPlugin" + } + } +} diff --git a/build-logic/kotlin-plugins/src/main/kotlin/foundation/e/blisslauncher/gradle/SpotlessPlugin.kt b/build-logic/kotlin-plugins/src/main/kotlin/foundation/e/blisslauncher/gradle/SpotlessPlugin.kt new file mode 100644 index 0000000000..3f694da538 --- /dev/null +++ b/build-logic/kotlin-plugins/src/main/kotlin/foundation/e/blisslauncher/gradle/SpotlessPlugin.kt @@ -0,0 +1,44 @@ +package foundation.e.blisslauncher.gradle + +import com.diffplug.gradle.spotless.SpotlessExtension +import com.diffplug.gradle.spotless.SpotlessPlugin +import org.gradle.api.Plugin +import org.gradle.api.Project +import org.gradle.kotlin.dsl.apply +import org.gradle.kotlin.dsl.getByType + +@Suppress("Unused") +class SpotlessPlugin : Plugin { + + override fun apply(project: Project) { + project.pluginManager.apply(SpotlessPlugin::class) + project.extensions.getByType().run { + java { + target("**/*.java") + removeUnusedImports() + } + + kotlin { + ktfmt().kotlinlangStyle() + target("**/*.kt") + targetExclude("**/build/") + trimTrailingWhitespace() + endWithNewline() + } + + kotlinGradle { + ktfmt().kotlinlangStyle() + target("**/*.gradle.kts") + targetExclude("**/build/") + } + + format("xml") { + target("**/*.xml") + targetExclude("**/build/", ".idea/") + trimTrailingWhitespace() + indentWithSpaces() + endWithNewline() + } + } + } +} diff --git a/build-logic/settings.gradle.kts b/build-logic/settings.gradle.kts new file mode 100644 index 0000000000..26334040ad --- /dev/null +++ b/build-logic/settings.gradle.kts @@ -0,0 +1,23 @@ +@file:Suppress("UnstableApiUsage") + +rootProject.name = "build-logic" + +enableFeaturePreview("VERSION_CATALOGS") + +pluginManagement { + repositories { + mavenCentral() + google() + gradlePluginPortal() + } +} + +dependencyResolutionManagement { + repositories { + google() + mavenCentral() + versionCatalogs { create("libs") { from(files("../gradle/libs.versions.toml")) } } + } +} + +include("kotlin-plugins") diff --git a/build.gradle b/build.gradle deleted file mode 100755 index b1fe21614e..0000000000 --- a/build.gradle +++ /dev/null @@ -1,56 +0,0 @@ -// Top-level build file where you can add configuration options common to all sub-projects/modules. -import foundation.e.blisslauncher.buildsrc.Libs - -buildscript { - ext.kotlin_version = '1.3.61' - repositories { - google() - jcenter() - maven { - url 'https://maven.fabric.io/public' - } - } - dependencies { - classpath Libs.androidGradlePlugin - - classpath Libs.Kotlin.gradlePlugin - classpath Libs.Kotlin.extensions - - classpath Libs.Google.fabricPlugin - classpath Libs.Google.gmsGoogleServices - - } -} - -plugins { - id "com.diffplug.gradle.spotless" version "3.14.0" - id 'com.github.ben-manes.versions' version "0.25.0" -} - -allprojects { - repositories { - google() - jcenter() - maven { url 'https://jitpack.io' } - mavenCentral() - } -} - -subprojects { - apply plugin: 'com.diffplug.gradle.spotless' - spotless { - java { - target '**/*.java' - removeUnusedImports() // removes any unused imports - } - kotlin { - target "**/*.kt" - ktlint() - } - kotlinGradle { - // same as kotlin, but for .gradle.kts files (defaults to '*.gradle.kts') - target '*.gradle.kts', 'additionalScripts/*.gradle.kts' - ktlint() - } - } -} diff --git a/build.gradle.kts b/build.gradle.kts new file mode 100644 index 0000000000..726e3478e1 --- /dev/null +++ b/build.gradle.kts @@ -0,0 +1,15 @@ +// Top-level build file where you can add configuration options common to all sub-projects/modules. +@file:Suppress("DSL_SCOPE_VIOLATION", "UnstableApiUsage") + +plugins { + alias(libs.plugins.android.application) apply false + alias(libs.plugins.android.library) apply false + alias(libs.plugins.kotlin.android) apply false + alias(libs.plugins.kotlin.kapt) apply false + alias(libs.plugins.google.services) apply false + alias(libs.plugins.refine) apply false + alias(libs.plugins.benmanes.versions) apply false + id("foundation.e.blisslauncher.spotless") +} + +val clean by tasks.existing(Delete::class) { delete(rootProject.buildDir) } diff --git a/buildSrc/build.gradle.kts b/buildSrc/build.gradle.kts index 445e21f767..90df4cd752 100644 --- a/buildSrc/build.gradle.kts +++ b/buildSrc/build.gradle.kts @@ -1,7 +1,3 @@ -repositories { - jcenter() -} +repositories { mavenCentral() } -plugins { - `kotlin-dsl` -} \ No newline at end of file +plugins { `kotlin-dsl` } diff --git a/buildSrc/src/main/java/foundation/e/blisslauncher/buildsrc/Dependencies.kt b/buildSrc/src/main/java/foundation/e/blisslauncher/buildsrc/Dependencies.kt deleted file mode 100644 index 17beb3676b..0000000000 --- a/buildSrc/src/main/java/foundation/e/blisslauncher/buildsrc/Dependencies.kt +++ /dev/null @@ -1,131 +0,0 @@ -package foundation.e.blisslauncher.buildsrc - -object Versions { - const val compile_sdk = 31 - const val min_sdk = 24 - const val target_sdk = 29 - const val android_gradle_plugin = "3.5.0" - const val kotlin = "1.3.41" - const val timber = "4.7.1" - const val junit = "4.12" - const val robolectric = "4.3" - const val mockK = "1.9.3" - const val firebase_core = "17.1.0" - const val crashlytics = "2.10.1" - const val google_services = "4.3.0" - const val fabric = "1.31.0" - const val okhttp = "4.1.0" - const val retrofit = "2.6.1" - const val dagger = "2.24" - const val rxjava = "2.2.11" - const val rxandroid = "2.1.1" - const val rxkotlin = "2.4.0" - const val ktlint = "0.34.2" -} - -object Libs { - const val androidGradlePlugin = "com.android.tools.build:gradle:${Versions.android_gradle_plugin}" - - const val timber = "com.jakewharton.timber:timber:${Versions.timber}" - - const val junit = "junit:junit:${Versions.junit}" - const val robolectric = "org.robolectric:robolectric:${Versions.robolectric}" - const val mockK = "io.mockk:mockk:${Versions.mockK}" - - object ApacheCommons { - const val commonsLang = "org.apache.commons:commons-lang3:3.12.0" - } - - object Google { - const val firebaseCore = "com.google.firebase:firebase-core:${Versions.firebase_core}" - const val crashlytics = "com.crashlytics.sdk.android:crashlytics:${Versions.crashlytics}" - const val gmsGoogleServices = "com.google.gms:google-services:${Versions.google_services}" - const val fabricPlugin = "io.fabric.tools:gradle:${Versions.fabric}" - } - - object Kotlin { - const val stdlib = "org.jetbrains.kotlin:kotlin-stdlib-jdk8:${Versions.kotlin}" - const val reflect = "org.jetbrains.kotlin:kotlin-reflect:${Versions.kotlin}" - const val gradlePlugin = "org.jetbrains.kotlin:kotlin-gradle-plugin:${Versions.kotlin}" - const val extensions = "org.jetbrains.kotlin:kotlin-android-extensions:${Versions.kotlin}" - } - - object AndroidX { - const val appcompat = "androidx.appcompat:appcompat:1.4.1" - const val collection = "androidx.collection:collection-ktx:1.1.0" - const val palette = "androidx.palette:palette:1.0.0" - const val recyclerview = "androidx.recyclerview:recyclerview:1.1.0-beta03" - - object Navigation { - private const val version = "2.2.0-alpha01" - const val fragment = "androidx.navigation:navigation-fragment-ktx:$version" - const val ui = "androidx.navigation:navigation-ui-ktx:$version" - const val safeArgs = "androidx.navigation:navigation-safe-args-gradle-plugin:$version" - } - - object Fragment { - private const val version = "1.2.0-alpha02" - const val fragment = "androidx.fragment:fragment:$version" - const val fragmentKtx = "androidx.fragment:fragment-ktx:$version" - } - - object Test { - private const val version = "1.2.0" - const val core = "androidx.test:core:$version" - const val runner = "androidx.test:runner:$version" - const val rules = "androidx.test:rules:$version" - - const val espressoCore = "androidx.test.espresso:espresso-core:3.2.0" - const val espressoContrib = "androidx.test.espresso:espresso-contrib:3.2.0" - const val espressoIntents = "androidx.test.espresso:espresso-intents:3.2.0" - const val archCoreTesting = "androidx.arch.core:core-testing:2.0.1" - - } - - const val preference = "androidx.preference:preference:1.1.0-rc01" - - const val constraintlayout = "androidx.constraintlayout:constraintlayout:2.0.0-beta2" - - const val coreKtx = "androidx.core:core-ktx:1.2.0-alpha03" - - object Lifecycle { - private const val version = "2.2.0-alpha03" - const val extensions = "androidx.lifecycle:lifecycle-extensions:$version" - const val compiler = "androidx.lifecycle:lifecycle-compiler:$version" - const val viewmodel = "androidx.lifecycle:lifecycle-viewmodel-ktx:$version" - } - - object Room { - private const val version = "2.2.0-beta01" - const val common = "androidx.room:room-common:$version" - const val runtime = "androidx.room:room-runtime:$version" - const val compiler = "androidx.room:room-compiler:$version" - const val ktx = "androidx.room:room-ktx:$version" - const val testing = "androidx.room:room-testing:$version" - } - } - - object RxJava { - const val rxJava = "io.reactivex.rxjava2:rxjava:${Versions.rxjava}" - const val rxAndroid = "io.reactivex.rxjava2:rxandroid:${Versions.rxandroid}" - const val rxKotlin = "io.reactivex.rxjava2:rxkotlin:${Versions.rxkotlin}" - } - - object Dagger { - const val dagger = "com.google.dagger:dagger:${Versions.dagger}" - const val androidSupport = "com.google.dagger:dagger-android-support:${Versions.dagger}" - const val compiler = "com.google.dagger:dagger-compiler:${Versions.dagger}" - const val androidProcessor = "com.google.dagger:dagger-android-processor:${Versions.dagger}" - } - - object Retrofit { - const val retrofit = "com.squareup.retrofit2:retrofit:${Versions.retrofit}" - const val retrofit_rxjava_adapter = "com.squareup.retrofit2:adapter-rxjava2:${Versions.retrofit}" - const val gsonConverter = "com.squareup.retrofit2:converter-gson:${Versions.retrofit}" - } - - object OkHttp { - const val okhttp = "com.squareup.okhttp3:okhttp:${Versions.okhttp}" - const val loggingInterceptor = "com.squareup.okhttp3:logging-interceptor:${Versions.okhttp}" - } -} \ No newline at end of file diff --git a/buildSrc/src/main/java/foundation/e/blisslauncher/buildsrc/Versions.kt b/buildSrc/src/main/java/foundation/e/blisslauncher/buildsrc/Versions.kt new file mode 100644 index 0000000000..2e9305a3c5 --- /dev/null +++ b/buildSrc/src/main/java/foundation/e/blisslauncher/buildsrc/Versions.kt @@ -0,0 +1,7 @@ +package foundation.e.blisslauncher.buildsrc + +object Versions { + const val COMPILE_SDK = 31 + const val MIN_SDK = 24 + const val TARGET_SDK = 29 +} diff --git a/data/build.gradle b/data/build.gradle deleted file mode 100644 index 2e3d8bef1a..0000000000 --- a/data/build.gradle +++ /dev/null @@ -1,48 +0,0 @@ -import foundation.e.blisslauncher.buildsrc.Libs -import foundation.e.blisslauncher.buildsrc.Versions - -apply plugin: 'com.android.library' -apply plugin: 'kotlin-android' -apply plugin: 'kotlin-kapt' - -android { - compileSdkVersion Versions.compile_sdk - defaultConfig { - minSdkVersion Versions.min_sdk - - testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" - consumerProguardFiles 'consumer-rules.pro' - } - - compileOptions { - sourceCompatibility JavaVersion.VERSION_1_8 - targetCompatibility JavaVersion.VERSION_1_8 - } - - testOptions { - unitTests { - includeAndroidResources = true - - all { - minHeapSize = "64m" - maxHeapSize = "128m" - } - } - } -} - -dependencies { - implementation fileTree(dir: 'libs', include: ['*.jar']) - implementation Libs.Kotlin.stdlib - implementation Libs.AndroidX.appcompat - implementation Libs.AndroidX.coreKtx - - implementation Libs.AndroidX.Room.runtime - kapt Libs.AndroidX.Room.compiler - - kapt Libs.Dagger.compiler - - testImplementation Libs.junit - testImplementation Libs.robolectric - testImplementation Libs.mockK -} diff --git a/data/build.gradle.kts b/data/build.gradle.kts new file mode 100644 index 0000000000..a033c6bae2 --- /dev/null +++ b/data/build.gradle.kts @@ -0,0 +1,52 @@ +@file:Suppress("UnstableApiUsage", "DSL_SCOPE_VIOLATION") + +import foundation.e.blisslauncher.buildsrc.Versions + +plugins { + alias(libs.plugins.android.library) + alias(libs.plugins.kotlin.android) + alias(libs.plugins.kotlin.kapt) +} + +android { + namespace = "foundation.e.blisslauncher.data" + compileSdk = Versions.COMPILE_SDK + + defaultConfig { + minSdk = Versions.MIN_SDK + + testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" + consumerProguardFiles("consumer-rules.pro") + } + + compileOptions { + sourceCompatibility = JavaVersion.VERSION_1_8 + targetCompatibility = JavaVersion.VERSION_1_8 + } + + testOptions { + unitTests { + isIncludeAndroidResources = true + all { + it.minHeapSize = "64m" + it.maxHeapSize = "128m" + } + } + } +} + +dependencies { + implementation(fileTree(mapOf("dir" to "libs", "include" to listOf("*.jar")))) + implementation(libs.kotlin.stdlib.jdk8) + implementation(libs.androidx.appcompat) + implementation(libs.androidx.core.ktx) + + implementation(libs.androidx.room.runtime) + kapt(libs.androidx.room.compiler) + + kapt(libs.dagger.compiler) + + testImplementation(libs.junit) + testImplementation(libs.robolectric) + testImplementation(libs.mockk) +} diff --git a/data/proguard-rules.pro b/data/proguard-rules.pro index f1b424510d..2f9dc5a47e 100644 --- a/data/proguard-rules.pro +++ b/data/proguard-rules.pro @@ -1,6 +1,6 @@ # Add project specific ProGuard rules here. # You can control the set of applied configuration files using the -# proguardFiles setting in build.gradle. +# proguardFiles setting in build.gradle.kts. # # For more details, see # http://developer.android.com/guide/developing/tools/proguard.html diff --git a/data/src/main/AndroidManifest.xml b/data/src/main/AndroidManifest.xml index 3cc832571a..cc947c5679 100644 --- a/data/src/main/AndroidManifest.xml +++ b/data/src/main/AndroidManifest.xml @@ -1,2 +1 @@ - + diff --git a/data/src/test/java/foundation/e/blisslauncher/data/ExampleUnitTest.kt b/data/src/test/java/foundation/e/blisslauncher/data/ExampleUnitTest.kt index 1ed56b7767..eb7c58612d 100644 --- a/data/src/test/java/foundation/e/blisslauncher/data/ExampleUnitTest.kt +++ b/data/src/test/java/foundation/e/blisslauncher/data/ExampleUnitTest.kt @@ -1,8 +1,7 @@ package foundation.e.blisslauncher.data -import org.junit.Test - import org.junit.Assert +import org.junit.Test /** * Example local unit test, which will execute on the development machine (host). diff --git a/domain/build.gradle b/domain/build.gradle deleted file mode 100644 index dcca293e86..0000000000 --- a/domain/build.gradle +++ /dev/null @@ -1,30 +0,0 @@ -import foundation.e.blisslauncher.buildsrc.Libs -import foundation.e.blisslauncher.buildsrc.Versions - -apply plugin: 'com.android.library' -apply plugin: 'kotlin-android' -apply plugin: 'kotlin-kapt' - -android { - compileSdkVersion Versions.compile_sdk - - defaultConfig { - minSdkVersion Versions.min_sdk - targetSdkVersion Versions.target_sdk - } - - compileOptions { - sourceCompatibility 1.8 - targetCompatibility 1.8 - } -} - -dependencies { - implementation Libs.Kotlin.stdlib - - kapt Libs.Dagger.compiler - - implementation Libs.RxJava.rxKotlin - implementation Libs.timber - testImplementation Libs.junit -} diff --git a/domain/build.gradle.kts b/domain/build.gradle.kts new file mode 100644 index 0000000000..421e841d87 --- /dev/null +++ b/domain/build.gradle.kts @@ -0,0 +1,33 @@ +@file:Suppress("UnstableApiUsage", "DSL_SCOPE_VIOLATION") + +import foundation.e.blisslauncher.buildsrc.Versions + +plugins { + alias(libs.plugins.android.library) + alias(libs.plugins.kotlin.android) + alias(libs.plugins.kotlin.kapt) +} + +android { + namespace = "foundation.e.blisslauncher.domain" + compileSdk = Versions.COMPILE_SDK + + defaultConfig { + minSdk = Versions.MIN_SDK + targetSdk = Versions.TARGET_SDK + } + + compileOptions { + sourceCompatibility = JavaVersion.VERSION_1_8 + targetCompatibility = JavaVersion.VERSION_1_8 + } +} + +dependencies { + implementation(libs.kotlin.stdlib.jdk8) + kapt(libs.dagger.compiler) + + implementation(libs.rx.kotlin) + implementation(libs.timber) + testImplementation(libs.junit) +} diff --git a/domain/proguard-rules.pro b/domain/proguard-rules.pro index f1b424510d..2f9dc5a47e 100644 --- a/domain/proguard-rules.pro +++ b/domain/proguard-rules.pro @@ -1,6 +1,6 @@ # Add project specific ProGuard rules here. # You can control the set of applied configuration files using the -# proguardFiles setting in build.gradle. +# proguardFiles setting in build.gradle.kts. # # For more details, see # http://developer.android.com/guide/developing/tools/proguard.html diff --git a/domain/src/main/AndroidManifest.xml b/domain/src/main/AndroidManifest.xml index d405b99707..cc947c5679 100644 --- a/domain/src/main/AndroidManifest.xml +++ b/domain/src/main/AndroidManifest.xml @@ -1 +1 @@ - \ No newline at end of file + diff --git a/domain/src/main/java/foundation/e/blisslauncher/domain/executors/PostExecutionThread.kt b/domain/src/main/java/foundation/e/blisslauncher/domain/executors/PostExecutionThread.kt index ba8ed2ca00..3a80de7b12 100644 --- a/domain/src/main/java/foundation/e/blisslauncher/domain/executors/PostExecutionThread.kt +++ b/domain/src/main/java/foundation/e/blisslauncher/domain/executors/PostExecutionThread.kt @@ -4,4 +4,4 @@ import io.reactivex.Scheduler interface PostExecutionThread { val scheduler: Scheduler -} \ No newline at end of file +} diff --git a/domain/src/main/java/foundation/e/blisslauncher/domain/executors/ThreadExecutor.kt b/domain/src/main/java/foundation/e/blisslauncher/domain/executors/ThreadExecutor.kt index f2b27ad31b..8c42d06923 100644 --- a/domain/src/main/java/foundation/e/blisslauncher/domain/executors/ThreadExecutor.kt +++ b/domain/src/main/java/foundation/e/blisslauncher/domain/executors/ThreadExecutor.kt @@ -2,4 +2,4 @@ package foundation.e.blisslauncher.domain.executors import java.util.concurrent.Executor -interface ThreadExecutor : Executor \ No newline at end of file +interface ThreadExecutor : Executor diff --git a/domain/src/main/java/foundation/e/blisslauncher/domain/interactors/Interactor.kt b/domain/src/main/java/foundation/e/blisslauncher/domain/interactors/Interactor.kt index 144ad143f1..341a3d9784 100644 --- a/domain/src/main/java/foundation/e/blisslauncher/domain/interactors/Interactor.kt +++ b/domain/src/main/java/foundation/e/blisslauncher/domain/interactors/Interactor.kt @@ -22,7 +22,8 @@ abstract class FlowableInteractor : Interactor

, Disposable { protected abstract fun buildObservable(params: P? = null): Flowable operator fun invoke(params: P, onNext: (next: T) -> Unit = {}, onComplete: () -> Unit = {}) { - disposables += this.buildObservable(params) + disposables += + this.buildObservable(params) .subscribeOn(Schedulers.from(threadExecutor)) .observeOn(postExecutionThread.scheduler) .subscribe(onNext, Timber::w, onComplete) @@ -40,7 +41,8 @@ abstract class CompletableInteractor : Interactor

, Disposable { protected abstract fun buildObservable(params: P? = null): Completable operator fun invoke(params: P, onComplete: () -> Unit = {}) { - disposables += this.buildObservable(params) + disposables += + this.buildObservable(params) .subscribeOn(Schedulers.from(threadExecutor)) .observeOn(postExecutionThread.scheduler) .subscribe(onComplete, Timber::w) @@ -49,4 +51,4 @@ abstract class CompletableInteractor : Interactor

, Disposable { override fun dispose() = disposables.dispose() override fun isDisposed(): Boolean = disposables.isDisposed -} \ No newline at end of file +} diff --git a/domain/src/test/java/foundation/e/blisslauncher/domain/ExampleUnitTest.kt b/domain/src/test/java/foundation/e/blisslauncher/domain/ExampleUnitTest.kt index 7c5a7b55e6..16b0202319 100644 --- a/domain/src/test/java/foundation/e/blisslauncher/domain/ExampleUnitTest.kt +++ b/domain/src/test/java/foundation/e/blisslauncher/domain/ExampleUnitTest.kt @@ -1,8 +1,7 @@ package foundation.e.blisslauncher.domain -import org.junit.Test - import org.junit.Assert.assertEquals +import org.junit.Test /** * Example local unit test, which will execute on the development machine (host). diff --git a/gradle.properties b/gradle.properties index 4b862715dc..a9492dd990 100644 --- a/gradle.properties +++ b/gradle.properties @@ -15,10 +15,6 @@ org.gradle.parallel=true org.gradle.configureondemand=true org.gradle.caching=true -# Enable D8 desugar / R8 -android.enableD8.desugaring=true -android.enableR8=true - # AndroidX android.useAndroidX=true android.enableJetifier=true diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml new file mode 100644 index 0000000000..0c239eca93 --- /dev/null +++ b/gradle/libs.versions.toml @@ -0,0 +1,76 @@ +[versions] +agp = "7.3.0" +axCore = "1.2.0-alpha03" +axAppcompat = "1.4.1" +axTest = "1.2.0" +dagger = "2.24" +kotlin = "1.7.10" +okhttp = "4.1.0" +refine = "3.1.1" +retrofit = "2.6.1" +room = "2.2.0-beta01" +spotless = "6.11.0" + +[libraries] +androidx-core-ktx = { module = "androidx.core:core-ktx", version.ref = "axCore" } +androidx-appcompat = { module = "androidx.appcompat:appcompat", version.ref = "axAppcompat" } +androidx-recyclerview = "androidx.recyclerview:recyclerview:1.1.0-beta03" +androidx-room-runtime = { module = "androidx.room:room-runtime", version.ref = "room" } +androidx-room-compiler = { module = "androidx.room:room-compiler", version.ref = "room" } +androidx-test-runner = { module = "androidx.test:runner", version.ref = "axTest" } +androidx-test-rules = { module = "androidx.test:rules", version.ref = "axTest" } +androidx-localbroadcast = "androidx.localbroadcastmanager:localbroadcastmanager:1.0.0" +apache-commons = "org.apache.commons:commons-lang3:3.12.0" + +build-spotless = { module = "com.diffplug.spotless:spotless-plugin-gradle", version.ref = "spotless" } + +dagger-compiler = { module = "com.google.dagger:dagger-compiler", version.ref = "dagger" } +dagger-android-processor = { module = "com.google.dagger:dagger-android-processor", version.ref = "dagger" } + +greenrobot-eventbus = "org.greenrobot:eventbus:3.1.1" +hoko-blur = "com.hoko:hoko-blur:1.3.4" + +kotlin-stdlib-jdk7 = { module = "org.jetbrains.kotlin:kotlin-stdlib-jdk7", version.ref = "kotlin" } +kotlin-stdlib-jdk8 = { module = "org.jetbrains.kotlin:kotlin-stdlib-jdk8", version.ref = "kotlin" } + +okhttp = { module = "com.squareup.okhttp3:okhttp", version.ref = "okhttp" } +okhttp-logging = { module = "com.squareup.okhttp3:logging-interceptor", version.ref = "okhttp" } + +refine-annotation = { module = "dev.rikka.tools.refine:annotation", version.ref = "refine" } +refine-annotation-processor = { module = "dev.rikka.tools.refine:annotation-processor", version.ref = "refine" } +refine-runtime = { module = "dev.rikka.tools.refine:runtime", version.ref = "refine" } + +retrofit = { module = "com.squareup.retrofit2:retrofit", version.ref = "retrofit" } +retrofit-rxjava-adapter = { module = "com.squareup.retrofit2:adapter-rxjava2", version.ref = "retrofit" } +retrofit-gson-converter = { module = "com.squareup.retrofit2:converter-gson", version.ref = "retrofit" } + +rx-android = "io.reactivex.rxjava2:rxandroid:2.1.1" +rx-binding = "com.jakewharton.rxbinding3:rxbinding:3.0.0" +rx-java = "io.reactivex.rxjava2:rxjava:2.2.11" +rx-kotlin = "io.reactivex.rxjava2:rxkotlin:2.4.0" +rx-relay = "com.jakewharton.rxrelay2:rxrelay:2.1.1" + +arch-core = "androidx.arch.core:core-testing:2.0.1" +debug-db = "com.amitshekhar.android:debug-db:1.0.4" +circleindicator = "me.relex:circleindicator:2.1.4" +espresso-core = "androidx.test.espresso:espresso-core:3.2.0" +junit = "junit:junit:4.12" +mockk = "io.mockk:mockk:1.9.3" +mockito-core = "org.mockito:mockito-core:2.19.0" +robolectric = "org.robolectric:robolectric:4.3" +tools-desugar = "com.android.tools:desugar_jdk_libs:1.1.5" +timber = "com.jakewharton.timber:timber:4.7.1" +restriction-bypass = "com.github.ChickenHook:RestrictionBypass:2.2" + +[plugins] +android-application = { id = "com.android.application", version.ref = "agp" } +android-library = { id = "com.android.library", version.ref = "agp" } +benmanes-versions = "com.github.ben-manes.versions:0.25.0" +google-services = "com.google.gms.google-services:4.3.0" +refine = { id = "dev.rikka.tools.refine", version.ref = "refine" } +kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" } +kotlin-kapt = { id = "org.jetbrains.kotlin.kapt", version.ref = "kotlin" } + +[bundles] +testing-unit = ["arch-core", "junit", "robolectric", "mockito-core"] +testing-android = ["junit", "espresso-core", "androidx-test-runner", "androidx-test-rules"] \ No newline at end of file diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index fd7090066b..418b2159cb 100755 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-bin.zip diff --git a/settings.gradle b/settings.gradle deleted file mode 100755 index e70334ca2e..0000000000 --- a/settings.gradle +++ /dev/null @@ -1,3 +0,0 @@ -include ':app' -include ':data' -include ':domain' \ No newline at end of file diff --git a/settings.gradle.kts b/settings.gradle.kts new file mode 100644 index 0000000000..1bbbd5c604 --- /dev/null +++ b/settings.gradle.kts @@ -0,0 +1,31 @@ +@file:Suppress("UnstableApiUsage", "JcenterRepositoryObsolete") + +pluginManagement { + repositories { + includeBuild("build-logic") + gradlePluginPortal() + google() + maven("https://maven.fabric.io/public") + mavenCentral() + jcenter() + } +} + +dependencyResolutionManagement { + repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS) + repositories { + google() + maven("https://maven.fabric.io/public") + mavenCentral() + jcenter() + maven("https://jitpack.io") + } +} + +enableFeaturePreview("VERSION_CATALOGS") + +enableFeaturePreview("TYPESAFE_PROJECT_ACCESSORS") + +include(":app", ":data", ":domain") + +rootProject.name = "blisslauncher" -- GitLab