Enable nonTransitiveRClass=true

This commit is contained in:
cketti 2022-09-20 15:22:34 +02:00
parent ecf52376ec
commit 3dc9dd2629
16 changed files with 36 additions and 27 deletions

View file

@ -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;

View file

@ -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

View file

@ -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)

View file

@ -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)

View file

@ -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;
}

View file

@ -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);

View file

@ -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

View file

@ -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

View file

@ -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)

View file

@ -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
/**

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.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

View file

@ -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));
}

View file

@ -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)
}
}
}

View file

@ -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

View file

@ -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

View file

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