Remove alias for commons R class

This commit is contained in:
Ensar Sarajčić 2023-08-04 08:39:02 +02:00
parent 36558b8949
commit 8f21b8b689
8 changed files with 25 additions and 31 deletions

View file

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

View file

@ -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<RadioItem>()
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<RadioItem>()
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<RadioItem>()
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<FAQItem>()
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)

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -1,2 +1,3 @@
android.enableJetifier=true
android.useAndroidX=true
android.nonTransitiveRClass=true