Remove alised import for commons R class

This commit is contained in:
Ensar Sarajčić 2023-08-04 08:43:55 +02:00
parent 109f8aafb7
commit f0737fa83c
14 changed files with 37 additions and 49 deletions

View File

@ -4,7 +4,6 @@ import android.content.Intent
import com.simplemobiletools.commons.dialogs.PermissionRequiredDialog
import com.simplemobiletools.commons.extensions.openNotificationSettings
import com.simplemobiletools.voicerecorder.services.RecorderService
import com.simplemobiletools.commons.R as CommonsR
class BackgroundRecordActivity : SimpleActivity() {
companion object {
@ -27,7 +26,7 @@ class BackgroundRecordActivity : SimpleActivity() {
}
}
} else {
PermissionRequiredDialog(this, CommonsR.string.allow_notifications_voice_recorder, { openNotificationSettings() })
PermissionRequiredDialog(this, com.simplemobiletools.commons.R.string.allow_notifications_voice_recorder, { openNotificationSettings() })
}
}
}

View File

@ -22,7 +22,6 @@ import me.grantland.widget.AutofitHelper
import org.greenrobot.eventbus.EventBus
import org.greenrobot.eventbus.Subscribe
import org.greenrobot.eventbus.ThreadMode
import com.simplemobiletools.commons.R as CommonsR
class MainActivity : SimpleActivity() {
@ -52,7 +51,7 @@ class MainActivity : SimpleActivity() {
if (it) {
tryInitVoiceRecorder()
} else {
toast(CommonsR.string.no_audio_permissions)
toast(com.simplemobiletools.commons.R.string.no_audio_permissions)
finish()
}
}
@ -111,7 +110,7 @@ class MainActivity : SimpleActivity() {
private fun refreshMenuItems() {
binding.mainMenu.getToolbar().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)
}
}
@ -162,18 +161,18 @@ class MainActivity : SimpleActivity() {
private fun setupViewPager() {
binding.mainTabsHolder.removeAllTabs()
var tabDrawables = arrayOf(CommonsR.drawable.ic_microphone_vector, R.drawable.ic_headset_vector)
var tabDrawables = arrayOf(com.simplemobiletools.commons.R.drawable.ic_microphone_vector, R.drawable.ic_headset_vector)
var tabLabels = arrayOf(R.string.recorder, R.string.player)
if (config.useRecycleBin) {
tabDrawables += CommonsR.drawable.ic_delete_vector
tabLabels += CommonsR.string.recycle_bin
tabDrawables += com.simplemobiletools.commons.R.drawable.ic_delete_vector
tabLabels += com.simplemobiletools.commons.R.string.recycle_bin
}
tabDrawables.forEachIndexed { i, drawableId ->
binding.mainTabsHolder.newTab().setCustomView(CommonsR.layout.bottom_tablayout_item).apply {
customView?.findViewById<ImageView>(CommonsR.id.tab_item_icon)?.setImageDrawable(getDrawable(drawableId))
customView?.findViewById<TextView>(CommonsR.id.tab_item_label)?.setText(tabLabels[i])
AutofitHelper.create(customView?.findViewById(CommonsR.id.tab_item_label))
binding.mainTabsHolder.newTab().setCustomView(com.simplemobiletools.commons.R.layout.bottom_tablayout_item).apply {
customView?.findViewById<ImageView>(com.simplemobiletools.commons.R.id.tab_item_icon)?.setImageDrawable(getDrawable(drawableId))
customView?.findViewById<TextView>(com.simplemobiletools.commons.R.id.tab_item_label)?.setText(tabLabels[i])
AutofitHelper.create(customView?.findViewById(com.simplemobiletools.commons.R.id.tab_item_label))
binding.mainTabsHolder.addTab(this)
}
}
@ -232,12 +231,12 @@ class MainActivity : SimpleActivity() {
val faqItems = arrayListOf(
FAQItem(R.string.faq_1_title, R.string.faq_1_text),
FAQItem(CommonsR.string.faq_9_title_commons, CommonsR.string.faq_9_text_commons)
FAQItem(com.simplemobiletools.commons.R.string.faq_9_title_commons, com.simplemobiletools.commons.R.string.faq_9_text_commons)
)
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

@ -20,7 +20,6 @@ import com.simplemobiletools.voicerecorder.models.Events
import org.greenrobot.eventbus.EventBus
import java.util.Locale
import kotlin.system.exitProcess
import com.simplemobiletools.commons.R as CommonsR
class SettingsActivity : SimpleActivity() {
private var recycleBinContentSize = 0
@ -215,9 +214,9 @@ class SettingsActivity : SimpleActivity() {
binding.settingsEmptyRecycleBinHolder.setOnClickListener {
if (recycleBinContentSize == 0) {
toast(CommonsR.string.recycle_bin_empty)
toast(com.simplemobiletools.commons.R.string.recycle_bin_empty)
} else {
ConfirmationDialog(this, "", CommonsR.string.empty_recycle_bin_confirmation, CommonsR.string.yes, CommonsR.string.no) {
ConfirmationDialog(this, "", com.simplemobiletools.commons.R.string.empty_recycle_bin_confirmation, com.simplemobiletools.commons.R.string.yes, com.simplemobiletools.commons.R.string.no) {
emptyTheRecycleBin()
recycleBinContentSize = 0
binding.settingsEmptyRecycleBinSize.text = 0.formatSize()

View File

@ -15,7 +15,6 @@ import com.simplemobiletools.voicerecorder.R
import com.simplemobiletools.voicerecorder.databinding.WidgetRecordDisplayConfigBinding
import com.simplemobiletools.voicerecorder.extensions.config
import com.simplemobiletools.voicerecorder.helpers.MyWidgetRecordDisplayProvider
import com.simplemobiletools.commons.R as CommonsR
class WidgetRecordDisplayConfigureActivity : SimpleActivity() {
private var mWidgetAlpha = 0f
@ -70,7 +69,7 @@ class WidgetRecordDisplayConfigureActivity : SimpleActivity() {
private fun initVariables() {
mWidgetColor = config.widgetBgColor
if (mWidgetColor == resources.getColor(R.color.default_widget_bg_color) && config.isUsingSystemTheme) {
mWidgetColor = resources.getColor(CommonsR.color.you_primary_color, theme)
mWidgetColor = resources.getColor(com.simplemobiletools.commons.R.color.you_primary_color, theme)
}
mWidgetAlpha = Color.alpha(mWidgetColor) / 255.toFloat()

View File

@ -23,7 +23,6 @@ import com.simplemobiletools.voicerecorder.interfaces.RefreshRecordingsListener
import com.simplemobiletools.voicerecorder.models.Events
import com.simplemobiletools.voicerecorder.models.Recording
import org.greenrobot.eventbus.EventBus
import com.simplemobiletools.commons.R as CommonsR
class RecordingsAdapter(
activity: SimpleActivity,
@ -139,7 +138,7 @@ class RecordingsAdapter(
}
val baseString = if (activity.config.useRecycleBin) {
CommonsR.string.move_to_recycle_bin_confirmation
com.simplemobiletools.commons.R.string.move_to_recycle_bin_confirmation
} else {
R.string.delete_recordings_confirmation
}

View File

@ -18,7 +18,6 @@ import com.simplemobiletools.voicerecorder.interfaces.RefreshRecordingsListener
import com.simplemobiletools.voicerecorder.models.Events
import com.simplemobiletools.voicerecorder.models.Recording
import org.greenrobot.eventbus.EventBus
import com.simplemobiletools.commons.R as CommonsR
class TrashAdapter(
activity: SimpleActivity,
@ -189,7 +188,7 @@ class TrashAdapter(
PopupMenu(contextTheme, view, Gravity.END).apply {
inflate(getActionMenuId())
menu.findItem(R.id.cab_select_all).isVisible = false
menu.findItem(R.id.cab_restore).title = resources.getString(CommonsR.string.restore_this_file)
menu.findItem(R.id.cab_restore).title = resources.getString(com.simplemobiletools.commons.R.string.restore_this_file)
setOnMenuItemClickListener { item ->
val recordingId = recording.id
when (item.itemId) {

View File

@ -6,7 +6,6 @@ import com.simplemobiletools.commons.extensions.beGoneIf
import com.simplemobiletools.commons.extensions.getAlertDialogBuilder
import com.simplemobiletools.commons.extensions.setupDialogStuff
import com.simplemobiletools.voicerecorder.databinding.DialogDeleteConfirmationBinding
import com.simplemobiletools.commons.R as CommonsR
class DeleteConfirmationDialog(
private val activity: Activity,
@ -23,8 +22,8 @@ class DeleteConfirmationDialog(
binding.deleteRememberTitle.text = message
binding.skipTheRecycleBinCheckbox.beGoneIf(!showSkipRecycleBinOption)
activity.getAlertDialogBuilder()
.setPositiveButton(CommonsR.string.yes) { _, _ -> dialogConfirmed() }
.setNegativeButton(CommonsR.string.no, null)
.setPositiveButton(com.simplemobiletools.commons.R.string.yes) { _, _ -> dialogConfirmed() }
.setNegativeButton(com.simplemobiletools.commons.R.string.no, null)
.apply {
activity.setupDialogStuff(view, this) { alertDialog ->
dialog = alertDialog

View File

@ -14,7 +14,6 @@ import com.simplemobiletools.voicerecorder.models.Events
import com.simplemobiletools.voicerecorder.models.Recording
import org.greenrobot.eventbus.EventBus
import java.io.File
import com.simplemobiletools.commons.R as CommonsR
class RenameRecordingDialog(val activity: BaseSimpleActivity, val recording: Recording, val callback: () -> Unit) {
init {
@ -24,20 +23,20 @@ class RenameRecordingDialog(val activity: BaseSimpleActivity, val recording: Rec
val view = binding.root
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.renameRecordingTitle)
alertDialog.getButton(AlertDialog.BUTTON_POSITIVE).setOnClickListener {
val newTitle = binding.renameRecordingTitle.value
if (newTitle.isEmpty()) {
activity.toast(CommonsR.string.empty_name)
activity.toast(com.simplemobiletools.commons.R.string.empty_name)
return@setOnClickListener
}
if (!newTitle.isAValidFilename()) {
activity.toast(CommonsR.string.invalid_name)
activity.toast(com.simplemobiletools.commons.R.string.invalid_name)
return@setOnClickListener
}

View File

@ -29,7 +29,6 @@ import org.greenrobot.eventbus.ThreadMode
import java.util.Stack
import java.util.Timer
import java.util.TimerTask
import com.simplemobiletools.commons.R as CommonsR
class PlayerFragment(context: Context, attributeSet: AttributeSet) : MyViewPagerFragment(context, attributeSet), RefreshRecordingsListener {
private val FAST_FORWARD_SKIP_MS = 10000
@ -154,7 +153,7 @@ class PlayerFragment(context: Context, attributeSet: AttributeSet) : MyViewPager
R.string.no_recordings_in_folder_found
}
} else {
CommonsR.string.no_items_found
com.simplemobiletools.commons.R.string.no_items_found
}
binding.recordingsPlaceholder.text = context.getString(stringId)
@ -319,7 +318,7 @@ class PlayerFragment(context: Context, attributeSet: AttributeSet) : MyViewPager
}
private fun getToggleButtonIcon(isPlaying: Boolean): Drawable {
val drawable = if (isPlaying) CommonsR.drawable.ic_pause_vector else CommonsR.drawable.ic_play_vector
val drawable = if (isPlaying) com.simplemobiletools.commons.R.drawable.ic_pause_vector else com.simplemobiletools.commons.R.drawable.ic_play_vector
return resources.getColoredDrawableWithColor(drawable, context.getProperPrimaryColor().getContrastColor())
}

View File

@ -19,7 +19,6 @@ import org.greenrobot.eventbus.Subscribe
import org.greenrobot.eventbus.ThreadMode
import java.util.Timer
import java.util.TimerTask
import com.simplemobiletools.commons.R as CommonsR
class RecorderFragment(context: Context, attributeSet: AttributeSet) : MyViewPagerFragment(context, attributeSet) {
private var status = RECORDING_STOPPED
@ -59,7 +58,7 @@ class RecorderFragment(context: Context, attributeSet: AttributeSet) : MyViewPag
if (granted) {
toggleRecording()
} else {
PermissionRequiredDialog(context as BaseSimpleActivity, CommonsR.string.allow_notifications_voice_recorder, {
PermissionRequiredDialog(context as BaseSimpleActivity, com.simplemobiletools.commons.R.string.allow_notifications_voice_recorder, {
(context as BaseSimpleActivity).openNotificationSettings()
})
}
@ -90,7 +89,7 @@ class RecorderFragment(context: Context, attributeSet: AttributeSet) : MyViewPag
}
binding.togglePauseButton.apply {
setImageDrawable(resources.getColoredDrawableWithColor(CommonsR.drawable.ic_pause_vector, properPrimaryColor.getContrastColor()))
setImageDrawable(resources.getColoredDrawableWithColor(com.simplemobiletools.commons.R.drawable.ic_pause_vector, properPrimaryColor.getContrastColor()))
background.applyColorFilter(properPrimaryColor)
}
@ -104,7 +103,7 @@ class RecorderFragment(context: Context, attributeSet: AttributeSet) : MyViewPag
private fun getToggleButtonIcon(): Drawable {
val drawable =
if (status == RECORDING_RUNNING || status == RECORDING_PAUSED) CommonsR.drawable.ic_stop_vector else CommonsR.drawable.ic_microphone_vector
if (status == RECORDING_RUNNING || status == RECORDING_PAUSED) com.simplemobiletools.commons.R.drawable.ic_stop_vector else com.simplemobiletools.commons.R.drawable.ic_microphone_vector
return resources.getColoredDrawableWithColor(drawable, context.getProperPrimaryColor().getContrastColor())
}

View File

@ -14,7 +14,6 @@ import com.simplemobiletools.voicerecorder.models.Recording
import org.greenrobot.eventbus.EventBus
import org.greenrobot.eventbus.Subscribe
import org.greenrobot.eventbus.ThreadMode
import com.simplemobiletools.commons.R as CommonsR
class TrashFragment(context: Context, attributeSet: AttributeSet) : MyViewPagerFragment(context, attributeSet), RefreshRecordingsListener {
private var itemsIgnoringSearch = ArrayList<Recording>()
@ -67,9 +66,9 @@ class TrashFragment(context: Context, attributeSet: AttributeSet) : MyViewPagerF
binding.trashPlaceholder.beVisibleIf(recordings.isEmpty())
if (recordings.isEmpty()) {
val stringId = if (lastSearchQuery.isEmpty()) {
CommonsR.string.recycle_bin_empty
com.simplemobiletools.commons.R.string.recycle_bin_empty
} else {
CommonsR.string.no_items_found
com.simplemobiletools.commons.R.string.no_items_found
}
binding.trashPlaceholder.text = context.getString(stringId)

View File

@ -14,7 +14,6 @@ import com.simplemobiletools.voicerecorder.R
import com.simplemobiletools.voicerecorder.activities.BackgroundRecordActivity
import com.simplemobiletools.voicerecorder.extensions.config
import com.simplemobiletools.voicerecorder.extensions.drawableToBitmap
import com.simplemobiletools.commons.R as CommonsR
class MyWidgetRecordDisplayProvider : AppWidgetProvider() {
private val OPEN_APP_INTENT_ID = 1
@ -58,7 +57,7 @@ class MyWidgetRecordDisplayProvider : AppWidgetProvider() {
}
private fun getColoredIcon(context: Context, color: Int, alpha: Int): Bitmap {
val drawable = context.resources.getColoredDrawableWithColor(CommonsR.drawable.ic_microphone_vector, color, alpha)
val drawable = context.resources.getColoredDrawableWithColor(com.simplemobiletools.commons.R.drawable.ic_microphone_vector, color, alpha)
return context.drawableToBitmap(drawable)
}
}

View File

@ -30,7 +30,6 @@ import com.simplemobiletools.voicerecorder.recorder.Recorder
import org.greenrobot.eventbus.EventBus
import java.io.File
import java.util.*
import com.simplemobiletools.commons.R as CommonsR
class RecorderService : Service() {
companion object {
@ -196,7 +195,7 @@ class RecorderService : Service() {
val newUri = contentResolver.insert(audioCollection, newSongDetails)
if (newUri == null) {
toast(CommonsR.string.unknown_error_occurred)
toast(com.simplemobiletools.commons.R.string.unknown_error_occurred)
return
}
@ -258,7 +257,7 @@ class RecorderService : Service() {
}
var priority = Notification.PRIORITY_DEFAULT
var icon = CommonsR.drawable.ic_microphone_vector
var icon = com.simplemobiletools.commons.R.drawable.ic_microphone_vector
var title = label
var visibility = NotificationCompat.VISIBILITY_PUBLIC
var text = getString(R.string.recording)

View File

@ -19,3 +19,4 @@ android.useAndroidX=true
android.enableJetifier=true
# Kotlin code style for this project: "official" or "obsolete":
kotlin.code.style=official
android.nonTransitiveRClass=true