diff --git a/app/k9mail/src/main/java/com/fsck/k9/external/MessageInfoHolder.java b/app/k9mail/src/main/java/com/fsck/k9/external/MessageInfoHolder.java index a1142f9bd..16f7bc573 100644 --- a/app/k9mail/src/main/java/com/fsck/k9/external/MessageInfoHolder.java +++ b/app/k9mail/src/main/java/com/fsck/k9/external/MessageInfoHolder.java @@ -1,5 +1,6 @@ package com.fsck.k9.external; + import java.util.Date; import android.content.Context; @@ -7,13 +8,13 @@ import android.text.SpannableStringBuilder; import com.fsck.k9.Account; import com.fsck.k9.K9; -import com.fsck.k9.R; import com.fsck.k9.helper.Contacts; import com.fsck.k9.helper.MessageHelper; import com.fsck.k9.mail.Address; import com.fsck.k9.mail.Flag; import com.fsck.k9.mail.Message.RecipientType; import com.fsck.k9.mailstore.LocalMessage; +import com.fsck.k9.ui.R; class MessageInfoHolder { public Date compareDate; diff --git a/app/k9mail/src/main/java/com/fsck/k9/notification/K9NotificationResourceProvider.kt b/app/k9mail/src/main/java/com/fsck/k9/notification/K9NotificationResourceProvider.kt index 033030e8d..aac16b241 100644 --- a/app/k9mail/src/main/java/com/fsck/k9/notification/K9NotificationResourceProvider.kt +++ b/app/k9mail/src/main/java/com/fsck/k9/notification/K9NotificationResourceProvider.kt @@ -1,7 +1,7 @@ package com.fsck.k9.notification import android.content.Context -import com.fsck.k9.R +import com.fsck.k9.ui.R class K9NotificationResourceProvider(private val context: Context) : NotificationResourceProvider { override val iconWarning: Int = R.drawable.notification_icon_warning diff --git a/app/k9mail/src/main/java/com/fsck/k9/resources/K9AutocryptStringProvider.kt b/app/k9mail/src/main/java/com/fsck/k9/resources/K9AutocryptStringProvider.kt index a24958e15..411ad4eab 100644 --- a/app/k9mail/src/main/java/com/fsck/k9/resources/K9AutocryptStringProvider.kt +++ b/app/k9mail/src/main/java/com/fsck/k9/resources/K9AutocryptStringProvider.kt @@ -1,8 +1,8 @@ package com.fsck.k9.resources import android.content.Context -import com.fsck.k9.R import com.fsck.k9.autocrypt.AutocryptStringProvider +import com.fsck.k9.ui.R class K9AutocryptStringProvider(private val context: Context) : AutocryptStringProvider { override fun transferMessageSubject(): String = context.getString(R.string.ac_transfer_msg_subject) diff --git a/app/k9mail/src/main/java/com/fsck/k9/resources/K9CoreResourceProvider.kt b/app/k9mail/src/main/java/com/fsck/k9/resources/K9CoreResourceProvider.kt index 270736c3e..d2ec95094 100644 --- a/app/k9mail/src/main/java/com/fsck/k9/resources/K9CoreResourceProvider.kt +++ b/app/k9mail/src/main/java/com/fsck/k9/resources/K9CoreResourceProvider.kt @@ -2,8 +2,8 @@ package com.fsck.k9.resources import android.content.Context import com.fsck.k9.CoreResourceProvider -import com.fsck.k9.R import com.fsck.k9.notification.PushNotificationState +import com.fsck.k9.ui.R class K9CoreResourceProvider(private val context: Context) : CoreResourceProvider { override fun defaultSignature(): String = context.getString(R.string.default_signature) diff --git a/app/k9mail/src/main/java/com/fsck/k9/widget/list/MessageListRemoteViewFactory.java b/app/k9mail/src/main/java/com/fsck/k9/widget/list/MessageListRemoteViewFactory.java index 3d9af2ea2..5ebc41157 100644 --- a/app/k9mail/src/main/java/com/fsck/k9/widget/list/MessageListRemoteViewFactory.java +++ b/app/k9mail/src/main/java/com/fsck/k9/widget/list/MessageListRemoteViewFactory.java @@ -147,7 +147,7 @@ public class MessageListRemoteViewFactory implements RemoteViewsService.RemoteVi @Override public RemoteViews getLoadingView() { RemoteViews loadingView = new RemoteViews(context.getPackageName(), R.layout.message_list_widget_loading); - loadingView.setTextViewText(R.id.loadingText, context.getString(R.string.mail_list_widget_loading)); + loadingView.setTextViewText(R.id.loadingText, context.getString(com.fsck.k9.ui.R.string.mail_list_widget_loading)); loadingView.setViewVisibility(R.id.loadingText, View.VISIBLE); return loadingView; } diff --git a/app/k9mail/src/main/java/com/fsck/k9/widget/list/MessageListWidgetProvider.java b/app/k9mail/src/main/java/com/fsck/k9/widget/list/MessageListWidgetProvider.java index f6c799b7e..c7a9ac007 100644 --- a/app/k9mail/src/main/java/com/fsck/k9/widget/list/MessageListWidgetProvider.java +++ b/app/k9mail/src/main/java/com/fsck/k9/widget/list/MessageListWidgetProvider.java @@ -46,7 +46,7 @@ public class MessageListWidgetProvider extends AppWidgetProvider { private void updateAppWidget(Context context, AppWidgetManager appWidgetManager, int appWidgetId) { RemoteViews views = new RemoteViews(context.getPackageName(), R.layout.message_list_widget_layout); - views.setTextViewText(R.id.folder, context.getString(R.string.integrated_inbox_title)); + views.setTextViewText(R.id.folder, context.getString(com.fsck.k9.ui.R.string.integrated_inbox_title)); Intent intent = new Intent(context, MessageListWidgetService.class); intent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, appWidgetId); diff --git a/app/k9mail/src/main/java/com/fsck/k9/widget/unread/UnreadWidgetConfigurationActivity.kt b/app/k9mail/src/main/java/com/fsck/k9/widget/unread/UnreadWidgetConfigurationActivity.kt index d3a617f9d..fa1662b0d 100644 --- a/app/k9mail/src/main/java/com/fsck/k9/widget/unread/UnreadWidgetConfigurationActivity.kt +++ b/app/k9mail/src/main/java/com/fsck/k9/widget/unread/UnreadWidgetConfigurationActivity.kt @@ -6,6 +6,7 @@ import com.fsck.k9.R import com.fsck.k9.ui.base.K9Activity import com.fsck.k9.ui.fragmentTransaction import timber.log.Timber +import com.fsck.k9.ui.R as UiR /** * Activity to select an account for the unread widget. @@ -15,7 +16,7 @@ class UnreadWidgetConfigurationActivity : K9Activity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setLayout(R.layout.activity_unread_widget_configuration) - setTitle(R.string.unread_widget_select_account) + setTitle(UiR.string.unread_widget_select_account) var appWidgetId = AppWidgetManager.INVALID_APPWIDGET_ID val extras = intent.extras diff --git a/app/k9mail/src/main/java/com/fsck/k9/widget/unread/UnreadWidgetConfigurationFragment.kt b/app/k9mail/src/main/java/com/fsck/k9/widget/unread/UnreadWidgetConfigurationFragment.kt index 92a3a7564..5c9a19f73 100644 --- a/app/k9mail/src/main/java/com/fsck/k9/widget/unread/UnreadWidgetConfigurationFragment.kt +++ b/app/k9mail/src/main/java/com/fsck/k9/widget/unread/UnreadWidgetConfigurationFragment.kt @@ -18,6 +18,7 @@ import com.fsck.k9.search.SearchAccount import com.fsck.k9.ui.choosefolder.ChooseFolderActivity import com.takisoft.preferencex.PreferenceFragmentCompat import org.koin.android.ext.android.inject +import com.fsck.k9.ui.R as UiR class UnreadWidgetConfigurationFragment : PreferenceFragmentCompat() { private val preferences: Preferences by inject() @@ -48,7 +49,7 @@ class UnreadWidgetConfigurationFragment : PreferenceFragmentCompat() { unreadFolderEnabled = findPreference(PREFERENCE_UNREAD_FOLDER_ENABLED)!! unreadFolderEnabled.onPreferenceChangeListener = Preference.OnPreferenceChangeListener { _, _ -> - unreadFolder.summary = getString(R.string.unread_widget_folder_summary) + unreadFolder.summary = getString(UiR.string.unread_widget_folder_summary) selectedFolderId = null selectedFolderDisplayName = null true @@ -116,7 +117,7 @@ class UnreadWidgetConfigurationFragment : PreferenceFragmentCompat() { selectedAccountUuid = accountUuid selectedFolderId = null selectedFolderDisplayName = null - unreadFolder.summary = getString(R.string.unread_widget_folder_summary) + unreadFolder.summary = getString(UiR.string.unread_widget_folder_summary) if (SearchAccount.UNIFIED_INBOX == selectedAccountUuid) { handleSearchAccount() } else { @@ -126,7 +127,7 @@ class UnreadWidgetConfigurationFragment : PreferenceFragmentCompat() { private fun handleSearchAccount() { if (SearchAccount.UNIFIED_INBOX == selectedAccountUuid) { - unreadAccount.setSummary(R.string.unread_widget_unified_inbox_account_summary) + unreadAccount.setSummary(UiR.string.unread_widget_unified_inbox_account_summary) } unreadFolderEnabled.isEnabled = false unreadFolderEnabled.isChecked = false @@ -168,10 +169,10 @@ class UnreadWidgetConfigurationFragment : PreferenceFragmentCompat() { private fun validateWidget(): Boolean { if (selectedAccountUuid == null) { - Toast.makeText(requireContext(), R.string.unread_widget_account_not_selected, Toast.LENGTH_LONG).show() + Toast.makeText(requireContext(), UiR.string.unread_widget_account_not_selected, Toast.LENGTH_LONG).show() return false } else if (unreadFolderEnabled.isChecked && selectedFolderId == null) { - Toast.makeText(requireContext(), R.string.unread_widget_folder_not_selected, Toast.LENGTH_LONG).show() + Toast.makeText(requireContext(), UiR.string.unread_widget_folder_not_selected, Toast.LENGTH_LONG).show() return false } return true diff --git a/app/k9mail/src/main/java/com/fsck/k9/widget/unread/UnreadWidgetDataProvider.kt b/app/k9mail/src/main/java/com/fsck/k9/widget/unread/UnreadWidgetDataProvider.kt index 4766a43be..78df3d9cf 100644 --- a/app/k9mail/src/main/java/com/fsck/k9/widget/unread/UnreadWidgetDataProvider.kt +++ b/app/k9mail/src/main/java/com/fsck/k9/widget/unread/UnreadWidgetDataProvider.kt @@ -4,7 +4,6 @@ import android.content.Context import android.content.Intent import com.fsck.k9.Account import com.fsck.k9.Preferences -import com.fsck.k9.R import com.fsck.k9.activity.MessageList import com.fsck.k9.controller.MessagingController import com.fsck.k9.mailstore.FolderRepository @@ -13,6 +12,7 @@ import com.fsck.k9.search.SearchAccount import com.fsck.k9.ui.folders.FolderNameFormatterFactory import com.fsck.k9.ui.messagelist.DefaultFolderProvider import timber.log.Timber +import com.fsck.k9.ui.R as UiR class UnreadWidgetDataProvider( private val context: Context, @@ -68,7 +68,7 @@ class UnreadWidgetDataProvider( val accountName = account.displayName val folderDisplayName = getFolderDisplayName(account, folderId) - val title = context.getString(R.string.unread_widget_title, accountName, folderDisplayName) + val title = context.getString(UiR.string.unread_widget_title, accountName, folderDisplayName) val unreadCount = messagingController.getFolderUnreadMessageCount(account, folderId) diff --git a/app/ui/legacy/src/main/java/com/fsck/k9/account/AccountCreator.kt b/app/ui/legacy/src/main/java/com/fsck/k9/account/AccountCreator.kt index e3f49d16a..db6c0824d 100644 --- a/app/ui/legacy/src/main/java/com/fsck/k9/account/AccountCreator.kt +++ b/app/ui/legacy/src/main/java/com/fsck/k9/account/AccountCreator.kt @@ -3,9 +3,9 @@ package com.fsck.k9.account import android.content.res.Resources import com.fsck.k9.Account.DeletePolicy import com.fsck.k9.Preferences +import com.fsck.k9.core.R import com.fsck.k9.mail.ConnectionSecurity import com.fsck.k9.preferences.Protocols -import com.fsck.k9.ui.R import com.fsck.k9.ui.helper.MaterialColors /** diff --git a/app/ui/legacy/src/main/java/com/fsck/k9/ui/K9Drawer.kt b/app/ui/legacy/src/main/java/com/fsck/k9/ui/K9Drawer.kt index 7a8e4feaa..33ea62825 100644 --- a/app/ui/legacy/src/main/java/com/fsck/k9/ui/K9Drawer.kt +++ b/app/ui/legacy/src/main/java/com/fsck/k9/ui/K9Drawer.kt @@ -56,6 +56,8 @@ import org.koin.androidx.viewmodel.ext.android.viewModel import org.koin.core.component.KoinComponent import org.koin.core.component.inject import org.koin.core.parameter.parametersOf +import com.fsck.k9.core.R as CoreR +import com.mikepenz.materialdrawer.R as MaterialDrawerR private const val UNREAD_SYMBOL = "\u2B24" private const val STARRED_SYMBOL = "\u2605" @@ -466,8 +468,8 @@ class K9Drawer(private val parent: MessageList, savedInstanceState: Bundle?) : K } private fun getDarkThemeAccentColor(color: Int): Int { - val lightColors = resources.getIntArray(R.array.account_colors) - val darkColors = resources.getIntArray(R.array.drawer_account_accent_color_dark_theme) + val lightColors = resources.getIntArray(CoreR.array.account_colors) + val darkColors = resources.getIntArray(CoreR.array.drawer_account_accent_color_dark_theme) val index = lightColors.indexOf(color) return if (index == -1) color else darkColors[index] } @@ -537,11 +539,11 @@ class K9Drawer(private val parent: MessageList, savedInstanceState: Bundle?) : K private fun Context.obtainDrawerTextColor(): Int { val styledAttributes = obtainStyledAttributes( null, - R.styleable.MaterialDrawerSliderView, - R.attr.materialDrawerStyle, - R.style.Widget_MaterialDrawerStyle + MaterialDrawerR.styleable.MaterialDrawerSliderView, + MaterialDrawerR.attr.materialDrawerStyle, + MaterialDrawerR.style.Widget_MaterialDrawerStyle ) - val textColor = styledAttributes.getColor(R.styleable.MaterialDrawerSliderView_materialDrawerPrimaryText, 0) + val textColor = styledAttributes.getColor(MaterialDrawerR.styleable.MaterialDrawerSliderView_materialDrawerPrimaryText, 0) styledAttributes.recycle() return textColor diff --git a/app/ui/legacy/src/main/java/com/fsck/k9/ui/settings/account/OpenPgpAppSelectDialog.java b/app/ui/legacy/src/main/java/com/fsck/k9/ui/settings/account/OpenPgpAppSelectDialog.java index 18af4fcf6..512f385dd 100644 --- a/app/ui/legacy/src/main/java/com/fsck/k9/ui/settings/account/OpenPgpAppSelectDialog.java +++ b/app/ui/legacy/src/main/java/com/fsck/k9/ui/settings/account/OpenPgpAppSelectDialog.java @@ -110,8 +110,8 @@ public class OpenPgpAppSelectDialog extends K9Activity { Context context = getActivity(); OpenPgpProviderEntry noneEntry = new OpenPgpProviderEntry(null, - context.getString(R.string.openpgp_list_preference_none), - getResources().getDrawable(R.drawable.ic_action_cancel_launchersize_light)); + context.getString(org.openintents.openpgp.R.string.openpgp_list_preference_none), + getResources().getDrawable(org.openintents.openpgp.R.drawable.ic_action_cancel_launchersize_light)); openPgpProviderList.add(noneEntry); // search for OpenPGP providers... @@ -144,8 +144,9 @@ public class OpenPgpAppSelectDialog extends K9Activity { Drawable icon = resolveInfo.activityInfo.loadIcon(context.getPackageManager()); String marketName = String.valueOf(resolveInfo.activityInfo.applicationInfo .loadLabel(context.getPackageManager())); - String simpleName = String.format(context.getString(R.string - .openpgp_install_openkeychain_via), marketName); + String simpleName = String.format( + context.getString(org.openintents.openpgp.R.string.openpgp_install_openkeychain_via), + marketName); openPgpProviderList.add(new OpenPgpProviderEntry(OPENKEYCHAIN_PACKAGE, simpleName, icon, marketIntent)); } diff --git a/app/ui/legacy/src/main/java/com/fsck/k9/ui/settings/general/GeneralSettingsFragment.kt b/app/ui/legacy/src/main/java/com/fsck/k9/ui/settings/general/GeneralSettingsFragment.kt index f8d31ccab..bf27905f4 100644 --- a/app/ui/legacy/src/main/java/com/fsck/k9/ui/settings/general/GeneralSettingsFragment.kt +++ b/app/ui/legacy/src/main/java/com/fsck/k9/ui/settings/general/GeneralSettingsFragment.kt @@ -14,6 +14,7 @@ import com.google.android.material.snackbar.Snackbar import com.takisoft.preferencex.PreferenceFragmentCompat import org.koin.android.ext.android.inject import org.koin.androidx.viewmodel.ext.android.viewModel +import com.fsck.k9.core.R as CoreR class GeneralSettingsFragment : PreferenceFragmentCompat() { private val viewModel: GeneralSettingsViewModel by viewModel() @@ -74,7 +75,7 @@ class GeneralSettingsFragment : PreferenceFragmentCompat() { (findPreference(PREFERENCE_THEME) as? ListPreference)?.apply { if (Build.VERSION.SDK_INT < 28) { setEntries(R.array.theme_entries_legacy) - setEntryValues(R.array.theme_values_legacy) + setEntryValues(CoreR.array.theme_values_legacy) } } } diff --git a/app/ui/legacy/src/main/java/com/fsck/k9/ui/settings/general/LanguagePreference.kt b/app/ui/legacy/src/main/java/com/fsck/k9/ui/settings/general/LanguagePreference.kt index f83487f81..8884c2f73 100644 --- a/app/ui/legacy/src/main/java/com/fsck/k9/ui/settings/general/LanguagePreference.kt +++ b/app/ui/legacy/src/main/java/com/fsck/k9/ui/settings/general/LanguagePreference.kt @@ -5,7 +5,7 @@ import android.content.Context import android.util.AttributeSet import androidx.core.content.res.TypedArrayUtils import androidx.preference.ListPreference -import com.fsck.k9.ui.R +import com.fsck.k9.core.R class LanguagePreference @JvmOverloads diff --git a/app/ui/legacy/src/test/java/com/fsck/k9/ui/K9DrawerTest.kt b/app/ui/legacy/src/test/java/com/fsck/k9/ui/K9DrawerTest.kt index 48c04348c..7db67cbf5 100644 --- a/app/ui/legacy/src/test/java/com/fsck/k9/ui/K9DrawerTest.kt +++ b/app/ui/legacy/src/test/java/com/fsck/k9/ui/K9DrawerTest.kt @@ -1,6 +1,7 @@ package com.fsck.k9.ui import com.fsck.k9.RobolectricTest +import com.fsck.k9.core.R import org.junit.Assert.assertEquals import org.junit.Test import org.robolectric.RuntimeEnvironment diff --git a/gradle.properties b/gradle.properties index 3628962fa..2d5e8441c 100644 --- a/gradle.properties +++ b/gradle.properties @@ -2,3 +2,4 @@ android.useAndroidX=true android.enableJetifier=false org.gradle.jvmargs=-Xmx1400m org.gradle.parallel=true +android.nonTransitiveRClass=true