From 8f21b8b689daf4bb776942327fcdae6923a6bcb5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ensar=20Saraj=C4=8Di=C4=87?= Date: Fri, 4 Aug 2023 08:39:02 +0200 Subject: [PATCH] Remove alias for commons R class --- .../launcher/activities/MainActivity.kt | 3 +-- .../launcher/activities/SettingsActivity.kt | 15 +++++++-------- .../launcher/adapters/WidgetsAdapter.kt | 7 +++---- .../launcher/dialogs/RenameItemDialog.kt | 11 +++++------ .../launcher/fragments/AllAppsFragment.kt | 3 +-- .../launcher/views/HomeScreenGrid.kt | 13 ++++++------- .../launcher/views/MyAppWidgetResizeFrame.kt | 3 +-- gradle.properties | 1 + 8 files changed, 25 insertions(+), 31 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/launcher/activities/MainActivity.kt b/app/src/main/kotlin/com/simplemobiletools/launcher/activities/MainActivity.kt index 084ac01..bd5b038 100644 --- a/app/src/main/kotlin/com/simplemobiletools/launcher/activities/MainActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/launcher/activities/MainActivity.kt @@ -50,7 +50,6 @@ import com.simplemobiletools.launcher.models.AppLauncher import com.simplemobiletools.launcher.models.HiddenIcon import com.simplemobiletools.launcher.models.HomeScreenGridItem import kotlin.math.abs -import com.simplemobiletools.commons.R as CommonsR class MainActivity : SimpleActivity(), FlingListener { private var mTouchDownX = -1 @@ -691,7 +690,7 @@ class MainActivity : SimpleActivity(), FlingListener { startActivity(this) } } catch (e: ActivityNotFoundException) { - toast(CommonsR.string.no_app_found) + toast(com.simplemobiletools.commons.R.string.no_app_found) } catch (e: Exception) { showErrorToast(e) } diff --git a/app/src/main/kotlin/com/simplemobiletools/launcher/activities/SettingsActivity.kt b/app/src/main/kotlin/com/simplemobiletools/launcher/activities/SettingsActivity.kt index 7981ca4..d3d21ea 100644 --- a/app/src/main/kotlin/com/simplemobiletools/launcher/activities/SettingsActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/launcher/activities/SettingsActivity.kt @@ -18,7 +18,6 @@ import com.simplemobiletools.launcher.helpers.MIN_COLUMN_COUNT import com.simplemobiletools.launcher.helpers.MIN_ROW_COUNT import java.util.Locale import kotlin.system.exitProcess -import com.simplemobiletools.commons.R as CommonsR class SettingsActivity : SimpleActivity() { @@ -74,7 +73,7 @@ class SettingsActivity : SimpleActivity() { private fun refreshMenuItems() { binding.settingsToolbar.menu.apply { - findItem(R.id.more_apps_from_us).isVisible = !resources.getBoolean(CommonsR.bool.hide_google_relations) + findItem(R.id.more_apps_from_us).isVisible = !resources.getBoolean(com.simplemobiletools.commons.R.bool.hide_google_relations) } } @@ -116,7 +115,7 @@ class SettingsActivity : SimpleActivity() { binding.settingsDrawerColumnCountHolder.setOnClickListener { val items = ArrayList() for (i in 1..MAX_COLUMN_COUNT) { - items.add(RadioItem(i, resources.getQuantityString(CommonsR.plurals.column_counts, i, i))) + items.add(RadioItem(i, resources.getQuantityString(com.simplemobiletools.commons.R.plurals.column_counts, i, i))) } RadioGroupDialog(this, items, currentColumnCount) { @@ -144,7 +143,7 @@ class SettingsActivity : SimpleActivity() { binding.settingsHomeScreenRowCountHolder.setOnClickListener { val items = ArrayList() for (i in MIN_ROW_COUNT..MAX_ROW_COUNT) { - items.add(RadioItem(i, resources.getQuantityString(CommonsR.plurals.row_counts, i, i))) + items.add(RadioItem(i, resources.getQuantityString(com.simplemobiletools.commons.R.plurals.row_counts, i, i))) } RadioGroupDialog(this, items, currentRowCount) { @@ -163,7 +162,7 @@ class SettingsActivity : SimpleActivity() { binding.settingsHomeScreenColumnCountHolder.setOnClickListener { val items = ArrayList() for (i in MIN_COLUMN_COUNT..MAX_COLUMN_COUNT) { - items.add(RadioItem(i, resources.getQuantityString(CommonsR.plurals.column_counts, i, i))) + items.add(RadioItem(i, resources.getQuantityString(com.simplemobiletools.commons.R.plurals.column_counts, i, i))) } RadioGroupDialog(this, items, currentColumnCount) { @@ -194,9 +193,9 @@ class SettingsActivity : SimpleActivity() { val licenses = 0L val faqItems = ArrayList() - if (!resources.getBoolean(CommonsR.bool.hide_google_relations)) { - faqItems.add(FAQItem(CommonsR.string.faq_2_title_commons, CommonsR.string.faq_2_text_commons)) - faqItems.add(FAQItem(CommonsR.string.faq_6_title_commons, CommonsR.string.faq_6_text_commons)) + if (!resources.getBoolean(com.simplemobiletools.commons.R.bool.hide_google_relations)) { + faqItems.add(FAQItem(com.simplemobiletools.commons.R.string.faq_2_title_commons, com.simplemobiletools.commons.R.string.faq_2_text_commons)) + faqItems.add(FAQItem(com.simplemobiletools.commons.R.string.faq_6_title_commons, com.simplemobiletools.commons.R.string.faq_6_text_commons)) } startAboutActivity(R.string.app_name, licenses, BuildConfig.VERSION_NAME, faqItems, true) diff --git a/app/src/main/kotlin/com/simplemobiletools/launcher/adapters/WidgetsAdapter.kt b/app/src/main/kotlin/com/simplemobiletools/launcher/adapters/WidgetsAdapter.kt index ee7e973..ca76ea8 100644 --- a/app/src/main/kotlin/com/simplemobiletools/launcher/adapters/WidgetsAdapter.kt +++ b/app/src/main/kotlin/com/simplemobiletools/launcher/adapters/WidgetsAdapter.kt @@ -18,7 +18,6 @@ import com.simplemobiletools.launcher.interfaces.WidgetsFragmentListener import com.simplemobiletools.launcher.models.WidgetsListItem import com.simplemobiletools.launcher.models.WidgetsListItemsHolder import com.simplemobiletools.launcher.models.WidgetsListSection -import com.simplemobiletools.commons.R as CommonsR class WidgetsAdapter( val activity: SimpleActivity, @@ -74,7 +73,7 @@ class WidgetsAdapter( binding.widgetListItemsHolder.addView(widgetPreview.root) val endMargin = if (index == listItem.widgets.size - 1) { - activity.resources.getDimension(CommonsR.dimen.medium_margin).toInt() + activity.resources.getDimension(com.simplemobiletools.commons.R.dimen.medium_margin).toInt() } else { 0 } @@ -86,7 +85,7 @@ class WidgetsAdapter( widgetPreview.widgetSize.apply { text = if (widget.isShortcut) { - activity.getString(CommonsR.string.shortcut) + activity.getString(com.simplemobiletools.commons.R.string.shortcut) } else { "${widget.widthCells} x ${widget.heightCells}" } @@ -94,7 +93,7 @@ class WidgetsAdapter( } (widgetPreview.widgetImage.layoutParams as RelativeLayout.LayoutParams).apply { - marginStart = activity.resources.getDimension(CommonsR.dimen.activity_margin).toInt() + marginStart = activity.resources.getDimension(com.simplemobiletools.commons.R.dimen.activity_margin).toInt() marginEnd = endMargin width = imageSize height = imageSize diff --git a/app/src/main/kotlin/com/simplemobiletools/launcher/dialogs/RenameItemDialog.kt b/app/src/main/kotlin/com/simplemobiletools/launcher/dialogs/RenameItemDialog.kt index ed73dae..d6473c7 100644 --- a/app/src/main/kotlin/com/simplemobiletools/launcher/dialogs/RenameItemDialog.kt +++ b/app/src/main/kotlin/com/simplemobiletools/launcher/dialogs/RenameItemDialog.kt @@ -7,7 +7,6 @@ import com.simplemobiletools.commons.helpers.ensureBackgroundThread import com.simplemobiletools.launcher.databinding.DialogRenameItemBinding import com.simplemobiletools.launcher.extensions.homeScreenGridItemsDB import com.simplemobiletools.launcher.models.HomeScreenGridItem -import com.simplemobiletools.commons.R as CommonsR class RenameItemDialog(val activity: Activity, val item: HomeScreenGridItem, val callback: () -> Unit) { @@ -17,10 +16,10 @@ class RenameItemDialog(val activity: Activity, val item: HomeScreenGridItem, val binding.renameItemEdittext.setText(item.title) activity.getAlertDialogBuilder() - .setPositiveButton(CommonsR.string.ok, null) - .setNegativeButton(CommonsR.string.cancel, null) + .setPositiveButton(com.simplemobiletools.commons.R.string.ok, null) + .setNegativeButton(com.simplemobiletools.commons.R.string.cancel, null) .apply { - activity.setupDialogStuff(view, this, CommonsR.string.rename) { alertDialog -> + activity.setupDialogStuff(view, this, com.simplemobiletools.commons.R.string.rename) { alertDialog -> alertDialog.showKeyboard(binding.renameItemEdittext) alertDialog.getButton(AlertDialog.BUTTON_POSITIVE).setOnClickListener { val newTitle = binding.renameItemEdittext.value @@ -31,11 +30,11 @@ class RenameItemDialog(val activity: Activity, val item: HomeScreenGridItem, val callback() alertDialog.dismiss() } else { - activity.toast(CommonsR.string.unknown_error_occurred) + activity.toast(com.simplemobiletools.commons.R.string.unknown_error_occurred) } } } else { - activity.toast(CommonsR.string.value_cannot_be_empty) + activity.toast(com.simplemobiletools.commons.R.string.value_cannot_be_empty) } } } diff --git a/app/src/main/kotlin/com/simplemobiletools/launcher/fragments/AllAppsFragment.kt b/app/src/main/kotlin/com/simplemobiletools/launcher/fragments/AllAppsFragment.kt index 743e666..b8c37f3 100644 --- a/app/src/main/kotlin/com/simplemobiletools/launcher/fragments/AllAppsFragment.kt +++ b/app/src/main/kotlin/com/simplemobiletools/launcher/fragments/AllAppsFragment.kt @@ -19,7 +19,6 @@ import com.simplemobiletools.launcher.helpers.ITEM_TYPE_ICON import com.simplemobiletools.launcher.interfaces.AllAppsListener import com.simplemobiletools.launcher.models.AppLauncher import com.simplemobiletools.launcher.models.HomeScreenGridItem -import com.simplemobiletools.commons.R as CommonsR class AllAppsFragment(context: Context, attributeSet: AttributeSet) : MyFragment(context, attributeSet), AllAppsListener { private var lastTouchCoords = Pair(0f, 0f) @@ -166,7 +165,7 @@ class AllAppsFragment(context: Context, attributeSet: AttributeSet) : MyFragment } } - binding.allAppsGrid.setPadding(0, 0, resources.getDimension(CommonsR.dimen.medium_margin).toInt(), bottomListPadding) + binding.allAppsGrid.setPadding(0, 0, resources.getDimension(com.simplemobiletools.commons.R.dimen.medium_margin).toInt(), bottomListPadding) binding.allAppsFastscroller.setPadding(leftListPadding, 0, rightListPadding, 0) hasTopPadding = addTopPadding diff --git a/app/src/main/kotlin/com/simplemobiletools/launcher/views/HomeScreenGrid.kt b/app/src/main/kotlin/com/simplemobiletools/launcher/views/HomeScreenGrid.kt index 8f9b708..1670ae2 100644 --- a/app/src/main/kotlin/com/simplemobiletools/launcher/views/HomeScreenGrid.kt +++ b/app/src/main/kotlin/com/simplemobiletools/launcher/views/HomeScreenGrid.kt @@ -41,7 +41,6 @@ import kotlin.math.abs import kotlin.math.floor import kotlin.math.max import kotlin.math.min -import com.simplemobiletools.commons.R as CommonsR class HomeScreenGrid(context: Context, attrs: AttributeSet, defStyle: Int) : RelativeLayout(context, attrs, defStyle) { constructor(context: Context, attrs: AttributeSet) : this(context, attrs, 0) @@ -57,8 +56,8 @@ class HomeScreenGrid(context: Context, attrs: AttributeSet, defStyle: Int) : Rel private var extraYMargin = 0 private var iconMargin = (context.resources.getDimension(R.dimen.icon_side_margin) * 5 / columnCount).toInt() - private var labelSideMargin = context.resources.getDimension(CommonsR.dimen.small_margin).toInt() - private var roundedCornerRadius = context.resources.getDimension(CommonsR.dimen.activity_margin) + private var labelSideMargin = context.resources.getDimension(com.simplemobiletools.commons.R.dimen.small_margin).toInt() + private var roundedCornerRadius = context.resources.getDimension(com.simplemobiletools.commons.R.dimen.activity_margin) private var pageIndicatorRadius = context.resources.getDimension(R.dimen.page_indicator_dot_radius) private var pageIndicatorMargin = context.resources.getDimension(R.dimen.page_indicator_margin) private var textPaint: TextPaint @@ -119,13 +118,13 @@ class HomeScreenGrid(context: Context, attrs: AttributeSet, defStyle: Int) : Rel textPaint = TextPaint(Paint.ANTI_ALIAS_FLAG).apply { color = Color.WHITE - textSize = context.resources.getDimension(CommonsR.dimen.smaller_text_size) + textSize = context.resources.getDimension(com.simplemobiletools.commons.R.dimen.smaller_text_size) setShadowLayer(2f, 0f, 0f, Color.BLACK) } dragShadowCirclePaint = Paint(Paint.ANTI_ALIAS_FLAG).apply { - color = context.resources.getColor(CommonsR.color.hint_white) - strokeWidth = context.resources.getDimension(CommonsR.dimen.small_margin) + color = context.resources.getColor(com.simplemobiletools.commons.R.color.hint_white) + strokeWidth = context.resources.getDimension(com.simplemobiletools.commons.R.dimen.small_margin) style = Paint.Style.STROKE } @@ -137,7 +136,7 @@ class HomeScreenGrid(context: Context, attrs: AttributeSet, defStyle: Int) : Rel style = Paint.Style.FILL } - val sideMargin = context.resources.getDimension(CommonsR.dimen.normal_margin).toInt() + val sideMargin = context.resources.getDimension(com.simplemobiletools.commons.R.dimen.normal_margin).toInt() sideMargins.apply { top = context.statusBarHeight bottom = context.navigationBarHeight diff --git a/app/src/main/kotlin/com/simplemobiletools/launcher/views/MyAppWidgetResizeFrame.kt b/app/src/main/kotlin/com/simplemobiletools/launcher/views/MyAppWidgetResizeFrame.kt index 98f2ea4..c115637 100644 --- a/app/src/main/kotlin/com/simplemobiletools/launcher/views/MyAppWidgetResizeFrame.kt +++ b/app/src/main/kotlin/com/simplemobiletools/launcher/views/MyAppWidgetResizeFrame.kt @@ -13,7 +13,6 @@ import com.simplemobiletools.launcher.extensions.config import com.simplemobiletools.launcher.extensions.getCellCount import com.simplemobiletools.launcher.helpers.MAX_CLICK_DURATION import com.simplemobiletools.launcher.models.HomeScreenGridItem -import com.simplemobiletools.commons.R as CommonsR @SuppressLint("ViewConstructor") class MyAppWidgetResizeFrame(context: Context, attrs: AttributeSet, defStyle: Int) : RelativeLayout(context, attrs, defStyle) { @@ -49,7 +48,7 @@ class MyAppWidgetResizeFrame(context: Context, attrs: AttributeSet, defStyle: In resizeWidgetLinePaint = Paint(Paint.ANTI_ALIAS_FLAG).apply { color = Color.WHITE - strokeWidth = context.resources.getDimension(CommonsR.dimen.tiny_margin) + strokeWidth = context.resources.getDimension(com.simplemobiletools.commons.R.dimen.tiny_margin) style = Paint.Style.STROKE } diff --git a/gradle.properties b/gradle.properties index dbb7bf7..b2d106e 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,2 +1,3 @@ android.enableJetifier=true android.useAndroidX=true +android.nonTransitiveRClass=true