Create a separate Gradle module for the message list widget

This commit is contained in:
cketti 2022-10-17 17:52:11 +02:00
parent cb64dd5953
commit c9d89657b0
21 changed files with 72 additions and 21 deletions

View file

@ -7,6 +7,7 @@ if (rootProject.testCoverage) {
dependencies {
implementation project(":app:ui:legacy")
implementation project(":app:ui:message-list-widget")
implementation project(":app:core")
implementation project(":app:storage")
implementation project(":app:crypto-openpgp")

View file

@ -315,7 +315,7 @@
</receiver>
<receiver
android:name=".widget.list.MessageListWidgetProvider"
android:name="app.k9mail.ui.widget.list.MessageListWidgetProvider"
android:icon="@drawable/message_list_widget_preview"
android:label="@string/mail_list_widget_text"
android:exported="false">
@ -336,11 +336,6 @@
</intent-filter>
</receiver>
<service
android:name=".widget.list.MessageListWidgetService"
android:enabled="true"
android:permission="android.permission.BIND_REMOTEVIEWS" />
<service
android:name=".notification.NotificationActionService"
android:enabled="true"/>

View file

@ -1,5 +1,7 @@
package com.fsck.k9
import app.k9mail.ui.widget.list.MessageListWidgetUpdateListener
import app.k9mail.ui.widget.list.messageListWidgetModule
import com.fsck.k9.auth.createOAuthConfigurationProvider
import com.fsck.k9.backends.backendsModule
import com.fsck.k9.controller.ControllerExtension
@ -10,8 +12,6 @@ import com.fsck.k9.preferences.K9StoragePersister
import com.fsck.k9.preferences.StoragePersister
import com.fsck.k9.resources.resourcesModule
import com.fsck.k9.storage.storageModule
import com.fsck.k9.widget.list.MessageListWidgetUpdateListener
import com.fsck.k9.widget.list.messageListWidgetModule
import com.fsck.k9.widget.unread.UnreadWidgetUpdateListener
import com.fsck.k9.widget.unread.unreadWidgetModule
import org.koin.core.qualifier.named

View file

@ -0,0 +1,44 @@
apply plugin: 'com.android.library'
apply plugin: 'org.jetbrains.kotlin.android'
dependencies {
implementation project(":app:ui:legacy")
implementation project(":app:core")
implementation "com.jakewharton.timber:timber:${versions.timber}"
}
android {
namespace 'app.k9mail.ui.widget.list'
compileSdkVersion buildConfig.compileSdk
buildToolsVersion buildConfig.buildTools
defaultConfig {
minSdkVersion buildConfig.minSdk
targetSdkVersion buildConfig.robolectricSdk
}
buildTypes {
debug {
manifestPlaceholders = ['appAuthRedirectScheme': 'FIXME: override this in your app project']
}
release {
manifestPlaceholders = ['appAuthRedirectScheme': 'FIXME: override this in your app project']
}
}
lintOptions {
abortOnError false
lintConfig file("$rootProject.projectDir/config/lint/lint.xml")
}
compileOptions {
sourceCompatibility javaVersion
targetCompatibility javaVersion
}
kotlinOptions {
jvmTarget = kotlinJvmVersion
}
}

View file

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<application>
<service
android:name=".MessageListWidgetService"
android:enabled="true"
android:permission="android.permission.BIND_REMOTEVIEWS" />
</application>
</manifest>

View file

@ -1,4 +1,4 @@
package com.fsck.k9.widget.list
package app.k9mail.ui.widget.list
import org.koin.dsl.module

View file

@ -1,4 +1,4 @@
package com.fsck.k9.widget.list
package app.k9mail.ui.widget.list
import com.fsck.k9.Account.SortType
import com.fsck.k9.search.LocalSearch

View file

@ -1,4 +1,4 @@
package com.fsck.k9.widget.list
package app.k9mail.ui.widget.list
import android.net.Uri

View file

@ -1,4 +1,4 @@
package com.fsck.k9.widget.list
package app.k9mail.ui.widget.list
import android.net.Uri
import com.fsck.k9.Account

View file

@ -1,4 +1,4 @@
package com.fsck.k9.widget.list
package app.k9mail.ui.widget.list
import com.fsck.k9.Account
import com.fsck.k9.Account.SortType

View file

@ -1,4 +1,4 @@
package com.fsck.k9.widget.list
package app.k9mail.ui.widget.list
import android.content.Context
import android.content.Intent
@ -11,7 +11,6 @@ import android.widget.RemoteViewsService.RemoteViewsFactory
import androidx.core.content.ContextCompat
import com.fsck.k9.Account.SortType
import com.fsck.k9.K9
import com.fsck.k9.R
import com.fsck.k9.search.LocalSearch
import com.fsck.k9.search.SearchAccount
import org.koin.core.component.KoinComponent

View file

@ -1,4 +1,4 @@
package com.fsck.k9.widget.list
package app.k9mail.ui.widget.list
import android.app.PendingIntent
import android.appwidget.AppWidgetManager
@ -8,15 +8,15 @@ import android.content.Context
import android.content.Intent
import android.net.Uri
import android.widget.RemoteViews
import com.fsck.k9.R
import com.fsck.k9.activity.MessageCompose
import com.fsck.k9.activity.MessageList
import com.fsck.k9.activity.MessageList.Companion.intentDisplaySearch
import com.fsck.k9.helper.PendingIntentCompat.FLAG_IMMUTABLE
import com.fsck.k9.helper.PendingIntentCompat.FLAG_MUTABLE
import com.fsck.k9.search.SearchAccount.Companion.createUnifiedInboxAccount
import com.fsck.k9.ui.R as UiR
class MessageListWidgetProvider : AppWidgetProvider() {
open class MessageListWidgetProvider : AppWidgetProvider() {
override fun onUpdate(context: Context, appWidgetManager: AppWidgetManager, appWidgetIds: IntArray) {
for (appWidgetId in appWidgetIds) {
updateAppWidget(context, appWidgetManager, appWidgetId)
@ -26,7 +26,7 @@ class MessageListWidgetProvider : AppWidgetProvider() {
private fun updateAppWidget(context: Context, appWidgetManager: AppWidgetManager, appWidgetId: Int) {
val views = RemoteViews(context.packageName, R.layout.message_list_widget_layout)
views.setTextViewText(R.id.folder, context.getString(com.fsck.k9.ui.R.string.integrated_inbox_title))
views.setTextViewText(R.id.folder, context.getString(UiR.string.integrated_inbox_title))
val intent = Intent(context, MessageListWidgetService::class.java).apply {
putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, appWidgetId)

View file

@ -1,4 +1,4 @@
package com.fsck.k9.widget.list
package app.k9mail.ui.widget.list
import android.content.Intent
import android.widget.RemoteViewsService

View file

@ -1,4 +1,4 @@
package com.fsck.k9.widget.list
package app.k9mail.ui.widget.list
import android.content.Context
import com.fsck.k9.Account

View file

@ -2,6 +2,7 @@ include ':app:k9mail'
include ':app:ui:base'
include ':app:ui:setup'
include ':app:ui:legacy'
include ':app:ui:message-list-widget'
include ':app:core'
include ':app:storage'
include ':app:crypto-openpgp'