Clean up some companion object usages
This commit is contained in:
parent
02b430a5bf
commit
ec4e631760
24 changed files with 87 additions and 138 deletions
|
@ -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"
|
||||||
|
|
|
@ -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 {
|
|
||||||
const val INSTALL_REQUEST_CODE = 500
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private const val INSTALL_REQUEST_CODE = 500
|
||||||
|
|
|
@ -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"
|
||||||
|
|
|
@ -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 {
|
|
||||||
const val PKGNAME_KEY = "pkg_name"
|
|
||||||
|
|
||||||
private const val URL_EXTENSION_COMMITS = "https://github.com/tachiyomiorg/tachiyomi-extensions/commits/master"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private const val PKGNAME_KEY = "pkg_name"
|
||||||
|
private const val URL_EXTENSION_COMMITS = "https://github.com/tachiyomiorg/tachiyomi-extensions/commits/master"
|
||||||
|
|
|
@ -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 {
|
|
||||||
const val SOURCE_ID = "source_id"
|
|
||||||
const val LASTOPENPREFERENCE_KEY = "last_open_preference"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private const val SOURCE_ID = "source_id"
|
||||||
|
private const val LASTOPENPREFERENCE_KEY = "last_open_preference"
|
||||||
|
|
|
@ -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 {
|
|
||||||
const val MANGA_KEY = "oldManga"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private const val MANGA_KEY = "oldManga"
|
||||||
|
|
|
@ -74,8 +74,6 @@ class GlobalSearchAdapter(val controller: GlobalSearchController) :
|
||||||
interface OnTitleClickListener {
|
interface OnTitleClickListener {
|
||||||
fun onTitleClick(source: CatalogueSource)
|
fun onTitleClick(source: CatalogueSource)
|
||||||
}
|
}
|
||||||
|
|
||||||
private companion object {
|
|
||||||
const val HOLDER_BUNDLE_KEY = "holder_bundle"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private const val HOLDER_BUNDLE_KEY = "holder_bundle"
|
||||||
|
|
|
@ -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 {
|
|
||||||
const val CATEGORY_KEY = "CategoryRenameDialog.category"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private const val CATEGORY_KEY = "CategoryRenameDialog.category"
|
||||||
|
|
|
@ -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.
|
|
||||||
const val KEY_ITEM_MAX = "DownloadCustomChaptersDialog.int.maxChapters"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Key to retrieve max chapters from bundle on process death.
|
||||||
|
private const val KEY_ITEM_MAX = "DownloadCustomChaptersDialog.int.maxChapters"
|
||||||
|
|
|
@ -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 {
|
|
||||||
const val MANGA_KEY = "manga"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private const val MANGA_KEY = "manga"
|
||||||
|
|
|
@ -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 {
|
|
||||||
const val KEY_ITEM_TRACK = "SetTrackChaptersDialog.item.track"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private const val KEY_ITEM_TRACK = "SetTrackChaptersDialog.item.track"
|
||||||
|
|
|
@ -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 {
|
|
||||||
const val KEY_ITEM_TRACK = "SetTrackScoreDialog.item.track"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private const val KEY_ITEM_TRACK = "SetTrackScoreDialog.item.track"
|
||||||
|
|
|
@ -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 {
|
|
||||||
const val KEY_ITEM_TRACK = "SetTrackStatusDialog.item.track"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private const val KEY_ITEM_TRACK = "SetTrackStatusDialog.item.track"
|
||||||
|
|
|
@ -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 {
|
|
||||||
const val KEY_SERVICE = "service_id"
|
|
||||||
const val KEY_CURRENT_URL = "current_url"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private const val KEY_SERVICE = "service_id"
|
||||||
|
private const val KEY_CURRENT_URL = "current_url"
|
||||||
|
|
|
@ -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 {
|
|
||||||
const val TAG_SEARCH_CONTROLLER = "track_search_controller"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private const val TAG_SEARCH_CONTROLLER = "track_search_controller"
|
||||||
|
|
|
@ -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 {
|
|
||||||
const val BODY_KEY = "NewUpdateDialogController.body"
|
|
||||||
const val URL_KEY = "NewUpdateDialogController.key"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private const val BODY_KEY = "NewUpdateDialogController.body"
|
||||||
|
private const val URL_KEY = "NewUpdateDialogController.key"
|
||||||
|
|
|
@ -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 strokeColor = Color.rgb(45, 45, 45)
|
|
||||||
|
|
||||||
// A span object with text outlining properties
|
|
||||||
val spanOutline = OutlineSpan(
|
|
||||||
strokeColor = strokeColor,
|
|
||||||
strokeWidth = 4f
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private val fillColor = Color.rgb(235, 235, 235)
|
||||||
|
private val strokeColor = Color.rgb(45, 45, 45)
|
||||||
|
|
||||||
|
// A span object with text outlining properties
|
||||||
|
private val spanOutline = OutlineSpan(
|
||||||
|
strokeColor = strokeColor,
|
||||||
|
strokeWidth = 4f
|
||||||
|
)
|
||||||
|
|
|
@ -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 **/
|
|
||||||
const val ALPHA_MASK: Long = 0xFF000000
|
|
||||||
|
|
||||||
/** Integer mask of red value **/
|
|
||||||
const val RED_MASK: Long = 0x00FF0000
|
|
||||||
|
|
||||||
/** Integer mask of green value **/
|
|
||||||
const val GREEN_MASK: Long = 0x0000FF00
|
|
||||||
|
|
||||||
/** Integer mask of blue value **/
|
|
||||||
const val BLUE_MASK: Long = 0x000000FF
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Integer mask of alpha value **/
|
||||||
|
private const val ALPHA_MASK: Long = 0xFF000000
|
||||||
|
|
||||||
|
/** Integer mask of red value **/
|
||||||
|
private const val RED_MASK: Long = 0x00FF0000
|
||||||
|
|
||||||
|
/** Integer mask of green value **/
|
||||||
|
private const val GREEN_MASK: Long = 0x0000FF00
|
||||||
|
|
||||||
|
/** Integer mask of blue value **/
|
||||||
|
private const val BLUE_MASK: Long = 0x000000FF
|
||||||
|
|
|
@ -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.
|
|
||||||
*/
|
|
||||||
const val PAGE_VIEW = 0
|
|
||||||
|
|
||||||
/**
|
|
||||||
* View holder type of a chapter transition view.
|
|
||||||
*/
|
|
||||||
const val TRANSITION_VIEW = 1
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* View holder type of a chapter page view.
|
||||||
|
*/
|
||||||
|
private const val PAGE_VIEW = 0
|
||||||
|
|
||||||
|
/**
|
||||||
|
* View holder type of a chapter transition view.
|
||||||
|
*/
|
||||||
|
private const val TRANSITION_VIEW = 1
|
||||||
|
|
|
@ -314,11 +314,9 @@ open class WebtoonRecyclerView @JvmOverloads constructor(
|
||||||
return super.onTouchEvent(ev)
|
return super.onTouchEvent(ev)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private companion object {
|
|
||||||
const val ANIMATOR_DURATION_TIME = 200
|
|
||||||
const val MIN_RATE = 0.5f
|
|
||||||
const val DEFAULT_RATE = 1f
|
|
||||||
const val MAX_SCALE_RATE = 3f
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private const val ANIMATOR_DURATION_TIME = 200
|
||||||
|
private const val MIN_RATE = 0.5f
|
||||||
|
private const val DEFAULT_RATE = 1f
|
||||||
|
private const val MAX_SCALE_RATE = 3f
|
||||||
|
|
|
@ -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 {
|
|
||||||
const val CLEAR_CACHE_KEY = "pref_clear_cache_key"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private const val CLEAR_CACHE_KEY = "pref_clear_cache_key"
|
||||||
|
|
|
@ -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 {
|
|
||||||
const val CODE_BACKUP_DIR = 503
|
|
||||||
const val CODE_BACKUP_CREATE = 504
|
|
||||||
const val CODE_BACKUP_RESTORE = 505
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private const val KEY_URI = "RestoreBackupDialog.uri"
|
||||||
|
private const val KEY_TYPE = "RestoreBackupDialog.type"
|
||||||
|
|
||||||
|
private const val CODE_BACKUP_DIR = 503
|
||||||
|
private const val CODE_BACKUP_CREATE = 504
|
||||||
|
private const val CODE_BACKUP_RESTORE = 505
|
||||||
|
|
|
@ -269,8 +269,6 @@ class SettingsDownloadController : SettingsController() {
|
||||||
.create()
|
.create()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private companion object {
|
|
||||||
const val DOWNLOAD_DIR = 104
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private const val DOWNLOAD_DIR = 104
|
||||||
|
|
|
@ -77,8 +77,6 @@ class SettingsSearchAdapter(val controller: SettingsSearchController) :
|
||||||
interface OnTitleClickListener {
|
interface OnTitleClickListener {
|
||||||
fun onTitleClick(ctrl: SettingsController)
|
fun onTitleClick(ctrl: SettingsController)
|
||||||
}
|
}
|
||||||
|
|
||||||
private companion object {
|
|
||||||
const val HOLDER_BUNDLE_KEY = "holder_bundle"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private const val HOLDER_BUNDLE_KEY = "holder_bundle"
|
||||||
|
|
Reference in a new issue