Merge pull request #6320 from thundernest/non-transitive_R

Enable `nonTransitiveRClass=true`
This commit is contained in:
cketti 2022-09-26 17:03:24 +02:00 committed by GitHub
commit cfb0026863
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
16 changed files with 36 additions and 27 deletions

View file

@ -1,5 +1,6 @@
package com.fsck.k9.external; package com.fsck.k9.external;
import java.util.Date; import java.util.Date;
import android.content.Context; import android.content.Context;
@ -7,13 +8,13 @@ import android.text.SpannableStringBuilder;
import com.fsck.k9.Account; import com.fsck.k9.Account;
import com.fsck.k9.K9; import com.fsck.k9.K9;
import com.fsck.k9.R;
import com.fsck.k9.helper.Contacts; import com.fsck.k9.helper.Contacts;
import com.fsck.k9.helper.MessageHelper; import com.fsck.k9.helper.MessageHelper;
import com.fsck.k9.mail.Address; import com.fsck.k9.mail.Address;
import com.fsck.k9.mail.Flag; import com.fsck.k9.mail.Flag;
import com.fsck.k9.mail.Message.RecipientType; import com.fsck.k9.mail.Message.RecipientType;
import com.fsck.k9.mailstore.LocalMessage; import com.fsck.k9.mailstore.LocalMessage;
import com.fsck.k9.ui.R;
class MessageInfoHolder { class MessageInfoHolder {
public Date compareDate; public Date compareDate;

View file

@ -1,7 +1,7 @@
package com.fsck.k9.notification package com.fsck.k9.notification
import android.content.Context import android.content.Context
import com.fsck.k9.R import com.fsck.k9.ui.R
class K9NotificationResourceProvider(private val context: Context) : NotificationResourceProvider { class K9NotificationResourceProvider(private val context: Context) : NotificationResourceProvider {
override val iconWarning: Int = R.drawable.notification_icon_warning override val iconWarning: Int = R.drawable.notification_icon_warning

View file

@ -1,8 +1,8 @@
package com.fsck.k9.resources package com.fsck.k9.resources
import android.content.Context import android.content.Context
import com.fsck.k9.R
import com.fsck.k9.autocrypt.AutocryptStringProvider import com.fsck.k9.autocrypt.AutocryptStringProvider
import com.fsck.k9.ui.R
class K9AutocryptStringProvider(private val context: Context) : AutocryptStringProvider { class K9AutocryptStringProvider(private val context: Context) : AutocryptStringProvider {
override fun transferMessageSubject(): String = context.getString(R.string.ac_transfer_msg_subject) override fun transferMessageSubject(): String = context.getString(R.string.ac_transfer_msg_subject)

View file

@ -2,8 +2,8 @@ package com.fsck.k9.resources
import android.content.Context import android.content.Context
import com.fsck.k9.CoreResourceProvider import com.fsck.k9.CoreResourceProvider
import com.fsck.k9.R
import com.fsck.k9.notification.PushNotificationState import com.fsck.k9.notification.PushNotificationState
import com.fsck.k9.ui.R
class K9CoreResourceProvider(private val context: Context) : CoreResourceProvider { class K9CoreResourceProvider(private val context: Context) : CoreResourceProvider {
override fun defaultSignature(): String = context.getString(R.string.default_signature) override fun defaultSignature(): String = context.getString(R.string.default_signature)

View file

@ -147,7 +147,7 @@ public class MessageListRemoteViewFactory implements RemoteViewsService.RemoteVi
@Override @Override
public RemoteViews getLoadingView() { public RemoteViews getLoadingView() {
RemoteViews loadingView = new RemoteViews(context.getPackageName(), R.layout.message_list_widget_loading); 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); loadingView.setViewVisibility(R.id.loadingText, View.VISIBLE);
return loadingView; return loadingView;
} }

View file

@ -46,7 +46,7 @@ public class MessageListWidgetProvider extends AppWidgetProvider {
private void updateAppWidget(Context context, AppWidgetManager appWidgetManager, int appWidgetId) { private void updateAppWidget(Context context, AppWidgetManager appWidgetManager, int appWidgetId) {
RemoteViews views = new RemoteViews(context.getPackageName(), R.layout.message_list_widget_layout); 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 intent = new Intent(context, MessageListWidgetService.class);
intent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, appWidgetId); intent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, appWidgetId);

View file

@ -6,6 +6,7 @@ import com.fsck.k9.R
import com.fsck.k9.ui.base.K9Activity import com.fsck.k9.ui.base.K9Activity
import com.fsck.k9.ui.fragmentTransaction import com.fsck.k9.ui.fragmentTransaction
import timber.log.Timber import timber.log.Timber
import com.fsck.k9.ui.R as UiR
/** /**
* Activity to select an account for the unread widget. * Activity to select an account for the unread widget.
@ -15,7 +16,7 @@ class UnreadWidgetConfigurationActivity : K9Activity() {
override fun onCreate(savedInstanceState: Bundle?) { override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState) super.onCreate(savedInstanceState)
setLayout(R.layout.activity_unread_widget_configuration) 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 var appWidgetId = AppWidgetManager.INVALID_APPWIDGET_ID
val extras = intent.extras val extras = intent.extras

View file

@ -18,6 +18,7 @@ import com.fsck.k9.search.SearchAccount
import com.fsck.k9.ui.choosefolder.ChooseFolderActivity import com.fsck.k9.ui.choosefolder.ChooseFolderActivity
import com.takisoft.preferencex.PreferenceFragmentCompat import com.takisoft.preferencex.PreferenceFragmentCompat
import org.koin.android.ext.android.inject import org.koin.android.ext.android.inject
import com.fsck.k9.ui.R as UiR
class UnreadWidgetConfigurationFragment : PreferenceFragmentCompat() { class UnreadWidgetConfigurationFragment : PreferenceFragmentCompat() {
private val preferences: Preferences by inject() private val preferences: Preferences by inject()
@ -48,7 +49,7 @@ class UnreadWidgetConfigurationFragment : PreferenceFragmentCompat() {
unreadFolderEnabled = findPreference(PREFERENCE_UNREAD_FOLDER_ENABLED)!! unreadFolderEnabled = findPreference(PREFERENCE_UNREAD_FOLDER_ENABLED)!!
unreadFolderEnabled.onPreferenceChangeListener = Preference.OnPreferenceChangeListener { _, _ -> unreadFolderEnabled.onPreferenceChangeListener = Preference.OnPreferenceChangeListener { _, _ ->
unreadFolder.summary = getString(R.string.unread_widget_folder_summary) unreadFolder.summary = getString(UiR.string.unread_widget_folder_summary)
selectedFolderId = null selectedFolderId = null
selectedFolderDisplayName = null selectedFolderDisplayName = null
true true
@ -116,7 +117,7 @@ class UnreadWidgetConfigurationFragment : PreferenceFragmentCompat() {
selectedAccountUuid = accountUuid selectedAccountUuid = accountUuid
selectedFolderId = null selectedFolderId = null
selectedFolderDisplayName = 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) { if (SearchAccount.UNIFIED_INBOX == selectedAccountUuid) {
handleSearchAccount() handleSearchAccount()
} else { } else {
@ -126,7 +127,7 @@ class UnreadWidgetConfigurationFragment : PreferenceFragmentCompat() {
private fun handleSearchAccount() { private fun handleSearchAccount() {
if (SearchAccount.UNIFIED_INBOX == selectedAccountUuid) { 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.isEnabled = false
unreadFolderEnabled.isChecked = false unreadFolderEnabled.isChecked = false
@ -168,10 +169,10 @@ class UnreadWidgetConfigurationFragment : PreferenceFragmentCompat() {
private fun validateWidget(): Boolean { private fun validateWidget(): Boolean {
if (selectedAccountUuid == null) { 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 return false
} else if (unreadFolderEnabled.isChecked && selectedFolderId == null) { } 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 false
} }
return true return true

View file

@ -4,7 +4,6 @@ import android.content.Context
import android.content.Intent import android.content.Intent
import com.fsck.k9.Account import com.fsck.k9.Account
import com.fsck.k9.Preferences import com.fsck.k9.Preferences
import com.fsck.k9.R
import com.fsck.k9.activity.MessageList import com.fsck.k9.activity.MessageList
import com.fsck.k9.controller.MessagingController import com.fsck.k9.controller.MessagingController
import com.fsck.k9.mailstore.FolderRepository 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.folders.FolderNameFormatterFactory
import com.fsck.k9.ui.messagelist.DefaultFolderProvider import com.fsck.k9.ui.messagelist.DefaultFolderProvider
import timber.log.Timber import timber.log.Timber
import com.fsck.k9.ui.R as UiR
class UnreadWidgetDataProvider( class UnreadWidgetDataProvider(
private val context: Context, private val context: Context,
@ -68,7 +68,7 @@ class UnreadWidgetDataProvider(
val accountName = account.displayName val accountName = account.displayName
val folderDisplayName = getFolderDisplayName(account, folderId) 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) val unreadCount = messagingController.getFolderUnreadMessageCount(account, folderId)

View file

@ -3,9 +3,9 @@ package com.fsck.k9.account
import android.content.res.Resources import android.content.res.Resources
import com.fsck.k9.Account.DeletePolicy import com.fsck.k9.Account.DeletePolicy
import com.fsck.k9.Preferences import com.fsck.k9.Preferences
import com.fsck.k9.core.R
import com.fsck.k9.mail.ConnectionSecurity import com.fsck.k9.mail.ConnectionSecurity
import com.fsck.k9.preferences.Protocols import com.fsck.k9.preferences.Protocols
import com.fsck.k9.ui.R
import com.fsck.k9.ui.helper.MaterialColors import com.fsck.k9.ui.helper.MaterialColors
/** /**

View file

@ -56,6 +56,8 @@ import org.koin.androidx.viewmodel.ext.android.viewModel
import org.koin.core.component.KoinComponent import org.koin.core.component.KoinComponent
import org.koin.core.component.inject import org.koin.core.component.inject
import org.koin.core.parameter.parametersOf 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 UNREAD_SYMBOL = "\u2B24"
private const val STARRED_SYMBOL = "\u2605" 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 { private fun getDarkThemeAccentColor(color: Int): Int {
val lightColors = resources.getIntArray(R.array.account_colors) val lightColors = resources.getIntArray(CoreR.array.account_colors)
val darkColors = resources.getIntArray(R.array.drawer_account_accent_color_dark_theme) val darkColors = resources.getIntArray(CoreR.array.drawer_account_accent_color_dark_theme)
val index = lightColors.indexOf(color) val index = lightColors.indexOf(color)
return if (index == -1) color else darkColors[index] 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 { private fun Context.obtainDrawerTextColor(): Int {
val styledAttributes = obtainStyledAttributes( val styledAttributes = obtainStyledAttributes(
null, null,
R.styleable.MaterialDrawerSliderView, MaterialDrawerR.styleable.MaterialDrawerSliderView,
R.attr.materialDrawerStyle, MaterialDrawerR.attr.materialDrawerStyle,
R.style.Widget_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() styledAttributes.recycle()
return textColor return textColor

View file

@ -110,8 +110,8 @@ public class OpenPgpAppSelectDialog extends K9Activity {
Context context = getActivity(); Context context = getActivity();
OpenPgpProviderEntry noneEntry = new OpenPgpProviderEntry(null, OpenPgpProviderEntry noneEntry = new OpenPgpProviderEntry(null,
context.getString(R.string.openpgp_list_preference_none), context.getString(org.openintents.openpgp.R.string.openpgp_list_preference_none),
getResources().getDrawable(R.drawable.ic_action_cancel_launchersize_light)); getResources().getDrawable(org.openintents.openpgp.R.drawable.ic_action_cancel_launchersize_light));
openPgpProviderList.add(noneEntry); openPgpProviderList.add(noneEntry);
// search for OpenPGP providers... // search for OpenPGP providers...
@ -144,8 +144,9 @@ public class OpenPgpAppSelectDialog extends K9Activity {
Drawable icon = resolveInfo.activityInfo.loadIcon(context.getPackageManager()); Drawable icon = resolveInfo.activityInfo.loadIcon(context.getPackageManager());
String marketName = String.valueOf(resolveInfo.activityInfo.applicationInfo String marketName = String.valueOf(resolveInfo.activityInfo.applicationInfo
.loadLabel(context.getPackageManager())); .loadLabel(context.getPackageManager()));
String simpleName = String.format(context.getString(R.string String simpleName = String.format(
.openpgp_install_openkeychain_via), marketName); context.getString(org.openintents.openpgp.R.string.openpgp_install_openkeychain_via),
marketName);
openPgpProviderList.add(new OpenPgpProviderEntry(OPENKEYCHAIN_PACKAGE, simpleName, openPgpProviderList.add(new OpenPgpProviderEntry(OPENKEYCHAIN_PACKAGE, simpleName,
icon, marketIntent)); icon, marketIntent));
} }

View file

@ -14,6 +14,7 @@ import com.google.android.material.snackbar.Snackbar
import com.takisoft.preferencex.PreferenceFragmentCompat import com.takisoft.preferencex.PreferenceFragmentCompat
import org.koin.android.ext.android.inject import org.koin.android.ext.android.inject
import org.koin.androidx.viewmodel.ext.android.viewModel import org.koin.androidx.viewmodel.ext.android.viewModel
import com.fsck.k9.core.R as CoreR
class GeneralSettingsFragment : PreferenceFragmentCompat() { class GeneralSettingsFragment : PreferenceFragmentCompat() {
private val viewModel: GeneralSettingsViewModel by viewModel() private val viewModel: GeneralSettingsViewModel by viewModel()
@ -74,7 +75,7 @@ class GeneralSettingsFragment : PreferenceFragmentCompat() {
(findPreference(PREFERENCE_THEME) as? ListPreference)?.apply { (findPreference(PREFERENCE_THEME) as? ListPreference)?.apply {
if (Build.VERSION.SDK_INT < 28) { if (Build.VERSION.SDK_INT < 28) {
setEntries(R.array.theme_entries_legacy) setEntries(R.array.theme_entries_legacy)
setEntryValues(R.array.theme_values_legacy) setEntryValues(CoreR.array.theme_values_legacy)
} }
} }
} }

View file

@ -5,7 +5,7 @@ import android.content.Context
import android.util.AttributeSet import android.util.AttributeSet
import androidx.core.content.res.TypedArrayUtils import androidx.core.content.res.TypedArrayUtils
import androidx.preference.ListPreference import androidx.preference.ListPreference
import com.fsck.k9.ui.R import com.fsck.k9.core.R
class LanguagePreference class LanguagePreference
@JvmOverloads @JvmOverloads

View file

@ -1,6 +1,7 @@
package com.fsck.k9.ui package com.fsck.k9.ui
import com.fsck.k9.RobolectricTest import com.fsck.k9.RobolectricTest
import com.fsck.k9.core.R
import org.junit.Assert.assertEquals import org.junit.Assert.assertEquals
import org.junit.Test import org.junit.Test
import org.robolectric.RuntimeEnvironment import org.robolectric.RuntimeEnvironment

View file

@ -2,3 +2,4 @@ android.useAndroidX=true
android.enableJetifier=false android.enableJetifier=false
org.gradle.jvmargs=-Xmx1400m org.gradle.jvmargs=-Xmx1400m
org.gradle.parallel=true org.gradle.parallel=true
android.nonTransitiveRClass=true