Clean up some companion object usages

This commit is contained in:
arkon 2021-09-05 14:34:29 -04:00
parent 02b430a5bf
commit ec4e631760
24 changed files with 87 additions and 138 deletions

View File

@ -178,8 +178,6 @@ open class App : Application(), LifecycleObserver, ImageLoaderFactory {
} }
} }
} }
}
companion object {
private const val ACTION_DISABLE_INCOGNITO_MODE = "tachi.action.DISABLE_INCOGNITO_MODE" private const val ACTION_DISABLE_INCOGNITO_MODE = "tachi.action.DISABLE_INCOGNITO_MODE"
}
}

View File

@ -45,8 +45,6 @@ class ExtensionInstallActivity : Activity() {
val extensionManager = Injekt.get<ExtensionManager>() val extensionManager = Injekt.get<ExtensionManager>()
extensionManager.setInstallationResult(downloadId, success) extensionManager.setInstallationResult(downloadId, success)
} }
}
private companion object { private const val INSTALL_REQUEST_CODE = 500
const val INSTALL_REQUEST_CODE = 500
}
}

View File

@ -33,13 +33,11 @@ class ExtensionTrustDialog<T>(bundle: Bundle? = null) : DialogController(bundle)
.create() .create()
} }
private companion object {
const val SIGNATURE_KEY = "signature_key"
const val PKGNAME_KEY = "pkgname_key"
}
interface Listener { interface Listener {
fun trustSignature(signatureHash: String) fun trustSignature(signatureHash: String)
fun uninstallExtension(pkgName: String) fun uninstallExtension(pkgName: String)
} }
} }
private const val SIGNATURE_KEY = "signature_key"
private const val PKGNAME_KEY = "pkgname_key"

View File

@ -235,10 +235,7 @@ class ExtensionDetailsController(bundle: Bundle? = null) :
activity!!.theme.resolveAttribute(R.attr.preferenceTheme, tv, true) activity!!.theme.resolveAttribute(R.attr.preferenceTheme, tv, true)
return ContextThemeWrapper(activity, tv.resourceId) return ContextThemeWrapper(activity, tv.resourceId)
} }
}
private companion object { private const val PKGNAME_KEY = "pkg_name"
const val PKGNAME_KEY = "pkg_name"
private const val URL_EXTENSION_COMMITS = "https://github.com/tachiyomiorg/tachiyomi-extensions/commits/master" private const val URL_EXTENSION_COMMITS = "https://github.com/tachiyomiorg/tachiyomi-extensions/commits/master"
}
}

View File

@ -167,9 +167,7 @@ class SourcePreferencesController(bundle: Bundle? = null) :
// [key] isn't useful since there may be duplicates // [key] isn't useful since there may be duplicates
return preferenceScreen!!.getPreference(lastOpenPreferencePosition!!) as T return preferenceScreen!!.getPreference(lastOpenPreferencePosition!!) as T
} }
}
private companion object { private const val SOURCE_ID = "source_id"
const val SOURCE_ID = "source_id" private const val LASTOPENPREFERENCE_KEY = "last_open_preference"
const val LASTOPENPREFERENCE_KEY = "last_open_preference"
}
}

View File

@ -37,8 +37,6 @@ class SourceSearchController(
override fun onItemLongClick(position: Int) { override fun onItemLongClick(position: Int) {
view?.let { super.onItemClick(it, position) } view?.let { super.onItemClick(it, position) }
} }
}
private companion object { private const val MANGA_KEY = "oldManga"
const val MANGA_KEY = "oldManga"
}
}

View File

@ -74,8 +74,6 @@ class GlobalSearchAdapter(val controller: GlobalSearchController) :
interface OnTitleClickListener { interface OnTitleClickListener {
fun onTitleClick(source: CatalogueSource) fun onTitleClick(source: CatalogueSource)
} }
}
private companion object { private const val HOLDER_BUNDLE_KEY = "holder_bundle"
const val HOLDER_BUNDLE_KEY = "holder_bundle"
}
}

View File

@ -78,8 +78,6 @@ class CategoryRenameDialog<T>(bundle: Bundle? = null) : DialogController(bundle)
interface Listener { interface Listener {
fun renameCategory(category: Category, name: String) fun renameCategory(category: Category, name: String)
} }
}
private companion object { private const val CATEGORY_KEY = "CategoryRenameDialog.category"
const val CATEGORY_KEY = "CategoryRenameDialog.category"
}
}

View File

@ -69,9 +69,7 @@ class DownloadCustomChaptersDialog<T> : DialogController
interface Listener { interface Listener {
fun downloadCustomChapters(amount: Int) fun downloadCustomChapters(amount: Int)
} }
}
private companion object {
// Key to retrieve max chapters from bundle on process death. // Key to retrieve max chapters from bundle on process death.
const val KEY_ITEM_MAX = "DownloadCustomChaptersDialog.int.maxChapters" private const val KEY_ITEM_MAX = "DownloadCustomChaptersDialog.int.maxChapters"
}
}

View File

@ -37,8 +37,6 @@ class SetChapterSettingsDialog(bundle: Bundle? = null) : DialogController(bundle
.setNegativeButton(android.R.string.cancel, null) .setNegativeButton(android.R.string.cancel, null)
.create() .create()
} }
}
private companion object { private const val MANGA_KEY = "manga"
const val MANGA_KEY = "manga"
}
}

View File

@ -65,8 +65,6 @@ class SetTrackChaptersDialog<T> : DialogController
interface Listener { interface Listener {
fun setChaptersRead(item: TrackItem, chaptersRead: Int) fun setChaptersRead(item: TrackItem, chaptersRead: Int)
} }
}
private companion object { private const val KEY_ITEM_TRACK = "SetTrackChaptersDialog.item.track"
const val KEY_ITEM_TRACK = "SetTrackChaptersDialog.item.track"
}
}

View File

@ -65,8 +65,6 @@ class SetTrackScoreDialog<T> : DialogController
interface Listener { interface Listener {
fun setScore(item: TrackItem, score: Int) fun setScore(item: TrackItem, score: Int)
} }
}
private companion object { private const val KEY_ITEM_TRACK = "SetTrackScoreDialog.item.track"
const val KEY_ITEM_TRACK = "SetTrackScoreDialog.item.track"
}
}

View File

@ -54,8 +54,6 @@ class SetTrackStatusDialog<T> : DialogController
interface Listener { interface Listener {
fun setStatus(item: TrackItem, selection: Int) fun setStatus(item: TrackItem, selection: Int)
} }
}
private companion object { private const val KEY_ITEM_TRACK = "SetTrackStatusDialog.item.track"
const val KEY_ITEM_TRACK = "SetTrackStatusDialog.item.track"
}
}

View File

@ -189,9 +189,7 @@ class TrackSearchDialog : DialogController {
binding.message.text = message ?: binding.message.context.getString(R.string.unknown_error) binding.message.text = message ?: binding.message.context.getString(R.string.unknown_error)
adapter?.items = emptyList() adapter?.items = emptyList()
} }
}
private companion object { private const val KEY_SERVICE = "service_id"
const val KEY_SERVICE = "service_id" private const val KEY_CURRENT_URL = "current_url"
const val KEY_CURRENT_URL = "current_url"
}
}

View File

@ -226,8 +226,6 @@ class TrackSheet(
fun getSearchDialog(): TrackSearchDialog? { fun getSearchDialog(): TrackSearchDialog? {
return controller.router.getControllerWithTag(TAG_SEARCH_CONTROLLER) as? TrackSearchDialog return controller.router.getControllerWithTag(TAG_SEARCH_CONTROLLER) as? TrackSearchDialog
} }
}
private companion object { private const val TAG_SEARCH_CONTROLLER = "track_search_controller"
const val TAG_SEARCH_CONTROLLER = "track_search_controller"
}
}

View File

@ -30,9 +30,7 @@ class NewUpdateDialogController(bundle: Bundle? = null) : DialogController(bundl
.setNegativeButton(R.string.update_check_ignore, null) .setNegativeButton(R.string.update_check_ignore, null)
.create() .create()
} }
}
private companion object { private const val BODY_KEY = "NewUpdateDialogController.body"
const val BODY_KEY = "NewUpdateDialogController.body" private const val URL_KEY = "NewUpdateDialogController.key"
const val URL_KEY = "NewUpdateDialogController.key"
}
}

View File

@ -40,15 +40,13 @@ class PageIndicatorTextView(
super.setText(finalText, BufferType.SPANNABLE) super.setText(finalText, BufferType.SPANNABLE)
} }
}
private companion object {
private val fillColor = Color.rgb(235, 235, 235) private val fillColor = Color.rgb(235, 235, 235)
private val strokeColor = Color.rgb(45, 45, 45) private val strokeColor = Color.rgb(45, 45, 45)
// A span object with text outlining properties // A span object with text outlining properties
val spanOutline = OutlineSpan( private val spanOutline = OutlineSpan(
strokeColor = strokeColor, strokeColor = strokeColor,
strokeWidth = 4f strokeWidth = 4f
) )
}
}

View File

@ -219,18 +219,16 @@ class ReaderColorFilterSettings @JvmOverloads constructor(context: Context, attr
val updatedColor = (color shl bitShift) or (currentColor and mask.inv().toInt()) val updatedColor = (color shl bitShift) or (currentColor and mask.inv().toInt())
preferences.colorFilterValue().set(updatedColor) preferences.colorFilterValue().set(updatedColor)
} }
}
private companion object {
/** Integer mask of alpha value **/ /** Integer mask of alpha value **/
const val ALPHA_MASK: Long = 0xFF000000 private const val ALPHA_MASK: Long = 0xFF000000
/** Integer mask of red value **/ /** Integer mask of red value **/
const val RED_MASK: Long = 0x00FF0000 private const val RED_MASK: Long = 0x00FF0000
/** Integer mask of green value **/ /** Integer mask of green value **/
const val GREEN_MASK: Long = 0x0000FF00 private const val GREEN_MASK: Long = 0x0000FF00
/** Integer mask of blue value **/ /** Integer mask of blue value **/
const val BLUE_MASK: Long = 0x000000FF private const val BLUE_MASK: Long = 0x000000FF
}
}

View File

@ -183,16 +183,14 @@ class WebtoonAdapter(val viewer: WebtoonViewer) : RecyclerView.Adapter<RecyclerV
return newItems.size return newItems.size
} }
} }
}
private companion object {
/** /**
* View holder type of a chapter page view. * View holder type of a chapter page view.
*/ */
const val PAGE_VIEW = 0 private const val PAGE_VIEW = 0
/** /**
* View holder type of a chapter transition view. * View holder type of a chapter transition view.
*/ */
const val TRANSITION_VIEW = 1 private const val TRANSITION_VIEW = 1
}
}

View File

@ -314,11 +314,9 @@ open class WebtoonRecyclerView @JvmOverloads constructor(
return super.onTouchEvent(ev) return super.onTouchEvent(ev)
} }
} }
}
private companion object { private const val ANIMATOR_DURATION_TIME = 200
const val ANIMATOR_DURATION_TIME = 200 private const val MIN_RATE = 0.5f
const val MIN_RATE = 0.5f private const val DEFAULT_RATE = 1f
const val DEFAULT_RATE = 1f private const val MAX_SCALE_RATE = 3f
const val MAX_SCALE_RATE = 3f
}
}

View File

@ -243,8 +243,6 @@ class SettingsAdvancedController : SettingsController() {
db.deleteHistoryNoLastRead().executeAsBlocking() db.deleteHistoryNoLastRead().executeAsBlocking()
activity?.toast(R.string.clear_database_completed) activity?.toast(R.string.clear_database_completed)
} }
}
private companion object { private const val CLEAR_CACHE_KEY = "pref_clear_cache_key"
const val CLEAR_CACHE_KEY = "pref_clear_cache_key"
}
}

View File

@ -329,16 +329,12 @@ class SettingsBackupController : SettingsController() {
.create() .create()
} }
} }
private companion object {
const val KEY_URI = "RestoreBackupDialog.uri"
const val KEY_TYPE = "RestoreBackupDialog.type"
} }
} }
private companion object { private const val KEY_URI = "RestoreBackupDialog.uri"
const val CODE_BACKUP_DIR = 503 private const val KEY_TYPE = "RestoreBackupDialog.type"
const val CODE_BACKUP_CREATE = 504
const val CODE_BACKUP_RESTORE = 505 private const val CODE_BACKUP_DIR = 503
} private const val CODE_BACKUP_CREATE = 504
} private const val CODE_BACKUP_RESTORE = 505

View File

@ -269,8 +269,6 @@ class SettingsDownloadController : SettingsController() {
.create() .create()
} }
} }
}
private companion object { private const val DOWNLOAD_DIR = 104
const val DOWNLOAD_DIR = 104
}
}

View File

@ -77,8 +77,6 @@ class SettingsSearchAdapter(val controller: SettingsSearchController) :
interface OnTitleClickListener { interface OnTitleClickListener {
fun onTitleClick(ctrl: SettingsController) fun onTitleClick(ctrl: SettingsController)
} }
}
private companion object { private const val HOLDER_BUNDLE_KEY = "holder_bundle"
const val HOLDER_BUNDLE_KEY = "holder_bundle"
}
}