Reorganize and group modules

This commit is contained in:
MM20
2022-12-13 17:37:26 +01:00
parent bac24baad2
commit 3f8880a90a
995 changed files with 501 additions and 298 deletions
+1
View File
@@ -0,0 +1 @@
/build
+142
View File
@@ -0,0 +1,142 @@
import java.text.SimpleDateFormat
import java.util.*
plugins {
id("com.android.application")
id("kotlin-android")
}
android {
packagingOptions {
resources.excludes.add("META-INF/DEPENDENCIES")
resources.excludes.add("META-INF/LICENSE")
resources.excludes.add("META-INF/LICENSE.txt")
resources.excludes.add("META-INF/license.txt")
resources.excludes.add("META-INF/NOTICE")
resources.excludes.add("META-INF/NOTICE.txt")
resources.excludes.add("META-INF/notice.txt")
resources.excludes.add("META-INF/ASL2.0")
resources.excludes.add("META-INF/LICENSE.md")
resources.excludes.add("META-INF/NOTICE.md")
}
compileSdk = sdk.versions.compileSdk.get().toInt()
defaultConfig {
applicationId = "de.mm20.launcher2"
minSdk = sdk.versions.minSdk.get().toInt()
targetSdk = sdk.versions.targetSdk.get().toInt()
versionCode = versionCodeDate()
versionName = "1.19.1"
signingConfig = signingConfigs.getByName("debug")
}
buildTypes {
release {
applicationIdSuffix = ".release"
postprocessing {
isRemoveUnusedCode = true
isObfuscate = false
isOptimizeCode = true
}
versionNameSuffix = "-" + buildTime()
}
debug {
applicationIdSuffix = ".debug"
// Jetpack Compose is unusably laggy in debug builds, it's ridiculous
// This somehow seems to resolve that issue.
isDebuggable = false
}
}
configurations.all {
//Fixes Error: Duplicate class: com.google.common.util.concurrent.ListenableFuture
exclude(group = "com.google.guava", module = "listenablefuture")
exclude(group = "org.apache.httpcomponents", module = "httpclient")
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = JavaVersion.VERSION_1_8.toString()
}
lint {
abortOnError = false
}
namespace = "de.mm20.launcher2"
}
fun buildTime(): String {
val df = SimpleDateFormat("yyyyMMdd")
return df.format(Date())
}
fun versionCodeDate(): Int {
val df = SimpleDateFormat("yyyyMMdd00")
return df.format(Date()).toInt()
}
dependencies {
implementation(libs.bundles.kotlin)
//Android Jetpack
implementation(libs.androidx.appcompat)
implementation(libs.androidx.cardview)
implementation(libs.androidx.browser)
implementation(libs.androidx.palette)
implementation(libs.androidx.core)
implementation(libs.androidx.exifinterface)
implementation(libs.materialcomponents.core)
implementation(libs.androidx.constraintlayout)
implementation(libs.bundles.androidx.lifecycle)
implementation(libs.androidx.work)
implementation(libs.coil.core)
implementation(libs.coil.svg)
implementation(libs.koin.android)
implementation(project(":services:accounts"))
implementation(project(":data:applications"))
implementation(project(":data:appshortcuts"))
implementation(project(":services:backup"))
implementation(project(":services:badges"))
implementation(project(":core:base"))
implementation(project(":data:calculator"))
implementation(project(":data:calendar"))
implementation(project(":data:contacts"))
implementation(project(":core:crashreporter"))
implementation(project(":data:currencies"))
implementation(project(":data:customattrs"))
implementation(project(":data:favorites"))
implementation(project(":data:files"))
implementation(project(":libs:g-services"))
implementation(project(":core:i18n"))
implementation(project(":services:icons"))
implementation(project(":core:ktx"))
implementation(project(":libs:ms-services"))
implementation(project(":services:music"))
implementation(project(":libs:nextcloud"))
implementation(project(":data:notifications"))
implementation(project(":libs:owncloud"))
implementation(project(":core:permissions"))
implementation(project(":core:preferences"))
implementation(project(":services:search"))
implementation(project(":data:unitconverter"))
implementation(project(":app:ui"))
implementation(project(":data:weather"))
implementation(project(":data:websites"))
implementation(project(":data:widgets"))
implementation(project(":data:wikipedia"))
implementation(project(":core:database"))
implementation(project(":data:search-actions"))
// Uncomment this if you want annoying notifications in your debug builds yelling at you how terrible your code is
//debugImplementation(libs.leakcanary)
}
+21
View File
@@ -0,0 +1,21 @@
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.kts.kts.kts.kts.kts.kts.kts.kts.kts.kts.kts.kts.kts.kts.kts.kts.kts.kts.kts.kts.kts.kts.kts.kts.kts.kts.kts.kts.kts.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}
# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable
# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
+59
View File
@@ -0,0 +1,59 @@
{
"project_info": {
"project_number": "1080818269583",
"firebase_url": "https://quaesitio-1523049861646.firebaseio.com",
"project_id": "quaesitio-1523049861646",
"storage_bucket": "quaesitio-1523049861646.appspot.com"
},
"client": [
{
"client_info": {
"mobilesdk_app_id": "1:1080818269583:android:c37c9bbefdd27e04",
"android_client_info": {
"package_name": "de.mm20.launcher2.debug"
}
},
"oauth_client": [
{
"client_id": "1080818269583-br291p34djunaf9katvhomj5u5qcvr8c.apps.googleusercontent.com",
"client_type": 1,
"android_info": {
"package_name": "de.mm20.launcher2.debug",
"certificate_hash": "af1d5f4a72fbaf9fce328142d1ed4a3ea4e77574"
}
},
{
"client_id": "1080818269583-4nll59hn87841bivhi9actpijmvpn6r0.apps.googleusercontent.com",
"client_type": 3
},
{
"client_id": "1080818269583-36kh12cv92opc17pa49umltcih0qfh2q.apps.googleusercontent.com",
"client_type": 3
}
],
"api_key": [
{
"current_key": "AIzaSyDmEgLMLFnwYQviEE05mCg8kD6ik0gcWw4"
}
],
"services": {
"analytics_service": {
"status": 1
},
"appinvite_service": {
"status": 2,
"other_platform_oauth_client": [
{
"client_id": "1080818269583-4nll59hn87841bivhi9actpijmvpn6r0.apps.googleusercontent.com",
"client_type": 3
}
]
},
"ads_service": {
"status": 2
}
}
}
],
"configuration_version": "1"
}
@@ -0,0 +1,21 @@
package de.mm20.launcher2.debug
import android.os.StrictMode
import android.util.Log
class Debug {
init {
Log.d("MM20", "MM20Launcher2 is running in debug mode.")
StrictMode.setThreadPolicy(StrictMode.ThreadPolicy.Builder()
.detectAll()
.penaltyLog()
.build())
StrictMode.setVmPolicy(StrictMode.VmPolicy.Builder()
.detectAll()
.penaltyLog()
.build())
}
companion object {
const val DEBUG_MODE = true
}
}
+4
View File
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<bool name="debug">true</bool>
</resources>
+64
View File
@@ -0,0 +1,64 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">
<uses-permission android:name="android.permission.SET_ALARM" />
<uses-permission android:name="com.android.alarm.permission.SET_ALARM" />
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.READ_CALENDAR" />
<uses-permission android:name="android.permission.WRITE_CALENDAR" />
<uses-permission android:name="android.permission.READ_CONTACTS" />
<uses-permission android:name="android.permission.WRITE_CONTACTS" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.ACCESS_MEDIA_LOCATION" />
<uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES" />
<uses-permission android:name="android.permission.INTERACT_ACROSS_PROFILES" />
<uses-permission android:name="android.permission.EXPAND_STATUS_BAR" />
<uses-permission
android:name="android.permission.QUERY_ALL_PACKAGES"
tools:ignore="QueryAllPackagesPermission" />
<uses-permission android:name="android.permission.REQUEST_DELETE_PACKAGES" />
<uses-permission android:name="android.permission.VIBRATE" />
<application
android:name=".LauncherApplication"
android:allowBackup="true"
android:crossProfile="true"
android:fullBackupContent="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:requestLegacyExternalStorage="true"
android:supportsRtl="true"
android:theme="@style/LauncherTheme"
android:usesCleartextTraffic="true"
tools:ignore="GoogleAppIndexingWarning">
<activity
android:name=".activity.AddItemActivity"
android:exported="true"
android:theme="@android:style/Theme.NoDisplay">
<intent-filter>
<action android:name="android.content.pm.action.CONFIRM_PIN_SHORTCUT" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<provider
android:name=".content.GenericFileProvider"
android:authorities="${applicationId}.fileprovider"
android:exported="false"
android:grantUriPermissions="true">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/provider_paths" />
</provider>
</application>
</manifest>
@@ -0,0 +1,100 @@
package de.mm20.launcher2
import android.app.Application
import coil.ImageLoader
import coil.ImageLoaderFactory
import coil.decode.SvgDecoder
import de.mm20.launcher2.accounts.accountsModule
import de.mm20.launcher2.applications.applicationsModule
import de.mm20.launcher2.appshortcuts.appShortcutsModule
import de.mm20.launcher2.backup.backupModule
import de.mm20.launcher2.badges.badgesModule
import de.mm20.launcher2.calculator.calculatorModule
import de.mm20.launcher2.calendar.calendarModule
import de.mm20.launcher2.contacts.contactsModule
import de.mm20.launcher2.data.customattrs.customAttrsModule
import de.mm20.launcher2.debug.Debug
import de.mm20.launcher2.favorites.favoritesModule
import de.mm20.launcher2.files.filesModule
import de.mm20.launcher2.icons.iconsModule
import de.mm20.launcher2.music.musicModule
import de.mm20.launcher2.search.searchModule
import de.mm20.launcher2.unitconverter.unitConverterModule
import de.mm20.launcher2.websites.websitesModule
import de.mm20.launcher2.widgets.widgetsModule
import de.mm20.launcher2.wikipedia.wikipediaModule
import de.mm20.launcher2.database.databaseModule
import de.mm20.launcher2.notifications.notificationsModule
import de.mm20.launcher2.permissions.permissionsModule
import de.mm20.launcher2.preferences.preferencesModule
import de.mm20.launcher2.searchactions.searchActionsModule
import de.mm20.launcher2.weather.weatherModule
import kotlinx.coroutines.*
import org.koin.android.ext.koin.androidContext
import org.koin.android.ext.koin.androidLogger
import org.koin.core.context.startKoin
import org.koin.core.logger.Level
import java.text.Collator
import kotlin.coroutines.CoroutineContext
class LauncherApplication : Application(), CoroutineScope, ImageLoaderFactory {
override val coroutineContext: CoroutineContext
get() = Dispatchers.Main + SupervisorJob()
override fun onCreate() {
super.onCreate()
Debug()
startKoin {
androidLogger(if (BuildConfig.DEBUG) Level.ERROR else Level.NONE)
androidContext(this@LauncherApplication)
modules(
listOf(
accountsModule,
applicationsModule,
appShortcutsModule,
calculatorModule,
backupModule,
badgesModule,
calendarModule,
contactsModule,
customAttrsModule,
databaseModule,
favoritesModule,
filesModule,
iconsModule,
musicModule,
notificationsModule,
permissionsModule,
preferencesModule,
searchModule,
searchActionsModule,
unitConverterModule,
weatherModule,
websitesModule,
widgetsModule,
wikipediaModule
)
)
}
}
override fun newImageLoader(): ImageLoader {
return ImageLoader.Builder(applicationContext)
.components {
add(SvgDecoder.Factory())
}
.crossfade(true)
.crossfade(200)
.build()
}
companion object {
val collator: Collator by lazy {
Collator.getInstance().apply { strength = Collator.SECONDARY }
}
}
}
@@ -0,0 +1,24 @@
package de.mm20.launcher2.activity
import android.app.Activity
import android.content.Context
import android.content.pm.LauncherApps
import android.os.Bundle
import de.mm20.launcher2.favorites.FavoritesRepository
import de.mm20.launcher2.search.data.AppShortcut
import de.mm20.launcher2.search.data.LauncherShortcut
import org.koin.android.ext.android.inject
class AddItemActivity : Activity() {
val favoritesRepository: FavoritesRepository by inject()
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
val shortcut = AppShortcut.fromPinRequestIntent(this, intent)
if (shortcut != null) {
favoritesRepository.pinItem(shortcut)
}
finish()
}
}
@@ -0,0 +1,5 @@
package de.mm20.launcher2.content
import androidx.core.content.FileProvider
class GenericFileProvider: FileProvider()
@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:state_enabled="true"
android:state_pressed="true">
<set>
<objectAnimator
android:duration="@android:integer/config_shortAnimTime"
android:propertyName="translationZ"
android:valueTo="7dp"
android:valueType="floatType"/>
</set>
</item>
<item>
<set>
<objectAnimator
android:duration="@android:integer/config_shortAnimTime"
android:propertyName="translationZ"
android:valueTo="0"
android:valueType="floatType"/>
</set>
</item>
</selector>
Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 692 B

File diff suppressed because one or more lines are too long
Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

+7
View File
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<declare-styleable name="PreferencesView">
<attr name="preferenceScreen" format="reference" />
</declare-styleable>
</resources>
+5
View File
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<bool name="is_dark_theme">false</bool>
<bool name="debug">false</bool>
</resources>
@@ -0,0 +1,3 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
</resources>
+5
View File
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<integer name="config_columnCount">4</integer>
<integer name="config_toolbarSlots">1</integer>
</resources>
+11
View File
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="Theme.AppCompat.NoDisplay" parent="Theme.AppCompat">
<item name="android:windowBackground">@null</item>
<item name="android:windowContentOverlay">@null</item>
<item name="android:windowIsTranslucent">true</item>
<item name="android:windowAnimationStyle">@null</item>
<item name="android:windowDisablePreview">true</item>
<item name="android:windowNoDisplay">true</item>
</style>
</resources>
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<paths>
<external-path name="external_files" path="." />
<root-path name="external_storage" path="/storage/" />
<cache-path
name="cache"
path="."/>
</paths>
@@ -0,0 +1,14 @@
package de.mm20.launcher2.debug
import android.content.Context
import android.content.res.Resources
import android.os.StrictMode
import android.util.Log
import de.mm20.launcher2.R
// This class does nothing in release builds
class Debug() {
companion object {
const val DEBUG_MODE = false
}
}