From 973237dff9bf8366e3de30e71a3ecbb63ec96392 Mon Sep 17 00:00:00 2001 From: TacoTheDank Date: Mon, 8 Jun 2020 17:11:06 -0400 Subject: [PATCH] Make a bunch of objects and vals const --- .../fragment/KeyboardShortcutsFragment.java | 4 ++-- .../activity/ColorPickerDialogActivity.kt | 2 +- .../twidere/activity/ComposeActivity.kt | 2 +- .../twidere/activity/DataExportActivity.kt | 2 +- .../twidere/activity/DataImportActivity.kt | 4 ++-- ...KeyboardShortcutPreferenceCompatActivity.kt | 4 ++-- .../twidere/activity/MediaViewerActivity.kt | 8 ++++---- .../twidere/activity/QuickSearchBarActivity.kt | 8 ++++---- .../twidere/activity/SettingsActivity.kt | 6 +++--- .../twidere/activity/SignInActivity.kt | 4 ++-- .../twidere/activity/WebLinkHandlerActivity.kt | 2 +- .../twidere/adapter/ParcelableGroupsAdapter.kt | 2 +- .../adapter/ParcelableUserListsAdapter.kt | 2 +- .../twidere/adapter/SupportTabsAdapter.kt | 2 +- .../twidere/adapter/VariousItemsAdapter.kt | 8 ++++---- .../adapter/iface/ILoadMoreSupportAdapter.kt | 2 +- .../twidere/app/TwidereApplication.kt | 2 +- .../fragment/AccountsManagerFragment.kt | 2 +- .../fragment/AddStatusFilterDialogFragment.kt | 2 +- .../twidere/fragment/BasePreferenceFragment.kt | 4 ++-- .../fragment/CreateUserBlockDialogFragment.kt | 2 +- .../fragment/CreateUserMuteDialogFragment.kt | 2 +- .../DeleteUserListMembersDialogFragment.kt | 2 +- .../DestroyFriendshipDialogFragment.kt | 2 +- ...estroyUserListSubscriptionDialogFragment.kt | 2 +- .../fragment/HostMappingsListFragment.kt | 8 ++++---- .../fragment/ReportUserSpamDialogFragment.kt | 2 +- .../mariotaku/twidere/fragment/UserFragment.kt | 4 ++-- .../fragment/UserProfileEditorFragment.kt | 18 +++++++++--------- .../fragment/drafts/DraftsListFragment.kt | 2 +- .../status/DestroyStatusDialogFragment.kt | 2 +- .../status/FavoriteConfirmDialogFragment.kt | 2 +- .../fragment/status/PinStatusDialogFragment.kt | 2 +- .../status/RetweetQuoteDialogFragment.kt | 2 +- .../twidere/fragment/status/StatusFragment.kt | 12 ++++++------ .../status/UnpinStatusDialogFragment.kt | 2 +- .../twidere/menu/AccountActionProvider.kt | 2 +- .../service/LengthyOperationsService.kt | 2 +- .../twidere/task/ProgressSaveFileTask.kt | 2 +- .../twidere/task/twitter/UpdateStatusTask.kt | 2 +- .../mariotaku/twidere/util/ErrorInfoStore.kt | 16 ++++++++-------- .../org/mariotaku/twidere/util/LinkCreator.kt | 4 ++-- .../twidere/util/MultiSelectEventHandler.kt | 2 +- .../twidere/util/UserColorNameManager.kt | 2 +- .../mariotaku/twidere/util/net/SystemHosts.kt | 2 +- .../mariotaku/twidere/util/net/TwidereDns.kt | 2 +- .../premium/SyncStatusViewController.kt | 2 +- .../holder/status/DetailStatusViewHolder.kt | 10 +++++----- 48 files changed, 93 insertions(+), 93 deletions(-) diff --git a/twidere/src/main/java/org/mariotaku/twidere/fragment/KeyboardShortcutsFragment.java b/twidere/src/main/java/org/mariotaku/twidere/fragment/KeyboardShortcutsFragment.java index f0a3d88d0..866fc293e 100644 --- a/twidere/src/main/java/org/mariotaku/twidere/fragment/KeyboardShortcutsFragment.java +++ b/twidere/src/main/java/org/mariotaku/twidere/fragment/KeyboardShortcutsFragment.java @@ -95,8 +95,8 @@ public class KeyboardShortcutsFragment extends BasePreferenceFragment implements protected void onClick() { final Context context = getContext(); final Intent intent = new Intent(context, KeyboardShortcutPreferenceCompatActivity.class); - intent.putExtra(KeyboardShortcutPreferenceCompatActivity.Companion.getEXTRA_CONTEXT_TAG(), mContextTag); - intent.putExtra(KeyboardShortcutPreferenceCompatActivity.Companion.getEXTRA_KEY_ACTION(), mAction); + intent.putExtra(KeyboardShortcutPreferenceCompatActivity.EXTRA_CONTEXT_TAG, mContextTag); + intent.putExtra(KeyboardShortcutPreferenceCompatActivity.EXTRA_KEY_ACTION, mAction); context.startActivity(intent); } diff --git a/twidere/src/main/kotlin/org/mariotaku/twidere/activity/ColorPickerDialogActivity.kt b/twidere/src/main/kotlin/org/mariotaku/twidere/activity/ColorPickerDialogActivity.kt index 2b249da20..ef81b00f4 100644 --- a/twidere/src/main/kotlin/org/mariotaku/twidere/activity/ColorPickerDialogActivity.kt +++ b/twidere/src/main/kotlin/org/mariotaku/twidere/activity/ColorPickerDialogActivity.kt @@ -69,7 +69,7 @@ class ColorPickerDialogActivity : BaseActivity(), Callback { companion object { - val RESULT_CLEARED = -2 + const val RESULT_CLEARED = -2 } } diff --git a/twidere/src/main/kotlin/org/mariotaku/twidere/activity/ComposeActivity.kt b/twidere/src/main/kotlin/org/mariotaku/twidere/activity/ComposeActivity.kt index 56b1e1e74..fd45ea95e 100644 --- a/twidere/src/main/kotlin/org/mariotaku/twidere/activity/ComposeActivity.kt +++ b/twidere/src/main/kotlin/org/mariotaku/twidere/activity/ComposeActivity.kt @@ -1924,7 +1924,7 @@ class ComposeActivity : BaseActivity(), OnMenuItemClickListener, OnClickListener } companion object { - val ALPHA_FULL = 1.0f + const val ALPHA_FULL = 1.0f } } diff --git a/twidere/src/main/kotlin/org/mariotaku/twidere/activity/DataExportActivity.kt b/twidere/src/main/kotlin/org/mariotaku/twidere/activity/DataExportActivity.kt index 3af8d9165..5da57add7 100644 --- a/twidere/src/main/kotlin/org/mariotaku/twidere/activity/DataExportActivity.kt +++ b/twidere/src/main/kotlin/org/mariotaku/twidere/activity/DataExportActivity.kt @@ -134,7 +134,7 @@ class DataExportActivity : BaseActivity(), DataExportImportTypeSelectorDialogFra } companion object { - private val FRAGMENT_TAG = "import_settings_dialog" + private const val FRAGMENT_TAG = "import_settings_dialog" } } diff --git a/twidere/src/main/kotlin/org/mariotaku/twidere/activity/DataImportActivity.kt b/twidere/src/main/kotlin/org/mariotaku/twidere/activity/DataImportActivity.kt index 7d2826064..925033912 100644 --- a/twidere/src/main/kotlin/org/mariotaku/twidere/activity/DataImportActivity.kt +++ b/twidere/src/main/kotlin/org/mariotaku/twidere/activity/DataImportActivity.kt @@ -140,7 +140,7 @@ class DataImportActivity : BaseActivity(), DataExportImportTypeSelectorDialogFra } companion object { - private val FRAGMENT_TAG = "import_settings_dialog" + private const val FRAGMENT_TAG = "import_settings_dialog" } } @@ -185,7 +185,7 @@ class DataImportActivity : BaseActivity(), DataExportImportTypeSelectorDialogFra companion object { - private val FRAGMENT_TAG = "read_settings_data_dialog" + private const val FRAGMENT_TAG = "read_settings_data_dialog" } } diff --git a/twidere/src/main/kotlin/org/mariotaku/twidere/activity/KeyboardShortcutPreferenceCompatActivity.kt b/twidere/src/main/kotlin/org/mariotaku/twidere/activity/KeyboardShortcutPreferenceCompatActivity.kt index 786cbeac4..40c2d645e 100644 --- a/twidere/src/main/kotlin/org/mariotaku/twidere/activity/KeyboardShortcutPreferenceCompatActivity.kt +++ b/twidere/src/main/kotlin/org/mariotaku/twidere/activity/KeyboardShortcutPreferenceCompatActivity.kt @@ -119,7 +119,7 @@ class KeyboardShortcutPreferenceCompatActivity : BaseActivity(), OnClickListener companion object { - val EXTRA_CONTEXT_TAG = "context_tag" - val EXTRA_KEY_ACTION = "key_action" + const val EXTRA_CONTEXT_TAG = "context_tag" + const val EXTRA_KEY_ACTION = "key_action" } } diff --git a/twidere/src/main/kotlin/org/mariotaku/twidere/activity/MediaViewerActivity.kt b/twidere/src/main/kotlin/org/mariotaku/twidere/activity/MediaViewerActivity.kt index c48e7f883..e1713162f 100644 --- a/twidere/src/main/kotlin/org/mariotaku/twidere/activity/MediaViewerActivity.kt +++ b/twidere/src/main/kotlin/org/mariotaku/twidere/activity/MediaViewerActivity.kt @@ -635,10 +635,10 @@ class MediaViewerActivity : BaseActivity(), IMediaViewerActivity, MediaSwipeClos companion object { - private val REQUEST_SHARE_MEDIA = 201 - private val REQUEST_PERMISSION_SAVE_MEDIA = 202 - private val REQUEST_PERMISSION_SHARE_MEDIA = 203 - private val REQUEST_SELECT_SAVE_MEDIA = 204 + private const val REQUEST_SHARE_MEDIA = 201 + private const val REQUEST_PERMISSION_SAVE_MEDIA = 202 + private const val REQUEST_PERMISSION_SHARE_MEDIA = 203 + private const val REQUEST_SELECT_SAVE_MEDIA = 204 @RequiresApi(Build.VERSION_CODES.JELLY_BEAN) const val FLAG_SYSTEM_UI_HIDE_BARS = View.SYSTEM_UI_FLAG_HIDE_NAVIGATION or diff --git a/twidere/src/main/kotlin/org/mariotaku/twidere/activity/QuickSearchBarActivity.kt b/twidere/src/main/kotlin/org/mariotaku/twidere/activity/QuickSearchBarActivity.kt index 17dea97c6..91551eb84 100644 --- a/twidere/src/main/kotlin/org/mariotaku/twidere/activity/QuickSearchBarActivity.kt +++ b/twidere/src/main/kotlin/org/mariotaku/twidere/activity/QuickSearchBarActivity.kt @@ -538,10 +538,10 @@ class QuickSearchBarActivity : BaseActivity(), OnClickListener, LoaderCallbacks< companion object { - internal val VIEW_TYPE_SEARCH_HISTORY = 0 - internal val VIEW_TYPE_SAVED_SEARCH = 1 - internal val VIEW_TYPE_USER_SUGGESTION_ITEM = 2 - internal val VIEW_TYPE_USER_SCREEN_NAME = 3 + internal const val VIEW_TYPE_SEARCH_HISTORY = 0 + internal const val VIEW_TYPE_SAVED_SEARCH = 1 + internal const val VIEW_TYPE_USER_SUGGESTION_ITEM = 2 + internal const val VIEW_TYPE_USER_SCREEN_NAME = 3 } } diff --git a/twidere/src/main/kotlin/org/mariotaku/twidere/activity/SettingsActivity.kt b/twidere/src/main/kotlin/org/mariotaku/twidere/activity/SettingsActivity.kt index c0b2863fa..2a145c3c6 100644 --- a/twidere/src/main/kotlin/org/mariotaku/twidere/activity/SettingsActivity.kt +++ b/twidere/src/main/kotlin/org/mariotaku/twidere/activity/SettingsActivity.kt @@ -349,8 +349,8 @@ class SettingsActivity : BaseActivity(), OnItemClickListener, OnPreferenceStartF companion object { - val VIEW_TYPE_PREFERENCE_ENTRY = 0 - val VIEW_TYPE_HEADER_ENTRY = 1 + const val VIEW_TYPE_PREFERENCE_ENTRY = 0 + const val VIEW_TYPE_HEADER_ENTRY = 1 } } @@ -424,7 +424,7 @@ class SettingsActivity : BaseActivity(), OnItemClickListener, OnPreferenceStartF companion object { - private val RESULT_SETTINGS_CHANGED = 10 + private const val RESULT_SETTINGS_CHANGED = 10 fun setShouldRecreate(activity: Activity) { if (activity !is SettingsActivity) return diff --git a/twidere/src/main/kotlin/org/mariotaku/twidere/activity/SignInActivity.kt b/twidere/src/main/kotlin/org/mariotaku/twidere/activity/SignInActivity.kt index a583c05fb..276f0485d 100644 --- a/twidere/src/main/kotlin/org/mariotaku/twidere/activity/SignInActivity.kt +++ b/twidere/src/main/kotlin/org/mariotaku/twidere/activity/SignInActivity.kt @@ -1189,8 +1189,8 @@ class SignInActivity : BaseActivity(), OnClickListener, TextWatcher, const val REQUEST_BROWSER_TWITTER_SIGN_IN = 101 const val REQUEST_BROWSER_MASTODON_SIGN_IN = 102 - private val FRAGMENT_TAG_SIGN_IN_PROGRESS = "sign_in_progress" - private val EXTRA_API_LAST_CHANGE = "api_last_change" + private const val FRAGMENT_TAG_SIGN_IN_PROGRESS = "sign_in_progress" + private const val EXTRA_API_LAST_CHANGE = "api_last_change" @Throws(IOException::class) internal fun detectAccountType(twitter: MicroBlog, user: User, type: String?): Pair { diff --git a/twidere/src/main/kotlin/org/mariotaku/twidere/activity/WebLinkHandlerActivity.kt b/twidere/src/main/kotlin/org/mariotaku/twidere/activity/WebLinkHandlerActivity.kt index 87c223b91..c409f3911 100644 --- a/twidere/src/main/kotlin/org/mariotaku/twidere/activity/WebLinkHandlerActivity.kt +++ b/twidere/src/main/kotlin/org/mariotaku/twidere/activity/WebLinkHandlerActivity.kt @@ -366,7 +366,7 @@ class WebLinkHandlerActivity : Activity() { "photo", "album", "paipai", "q", "userview", "dialogue") - private val AUTHORITY_TWITTER_COM = "twitter.com" + private const val AUTHORITY_TWITTER_COM = "twitter.com" private fun regulateTwitterUri(data: Uri): Uri { diff --git a/twidere/src/main/kotlin/org/mariotaku/twidere/adapter/ParcelableGroupsAdapter.kt b/twidere/src/main/kotlin/org/mariotaku/twidere/adapter/ParcelableGroupsAdapter.kt index b50f04e20..5075f74cf 100644 --- a/twidere/src/main/kotlin/org/mariotaku/twidere/adapter/ParcelableGroupsAdapter.kt +++ b/twidere/src/main/kotlin/org/mariotaku/twidere/adapter/ParcelableGroupsAdapter.kt @@ -142,6 +142,6 @@ class ParcelableGroupsAdapter( companion object { - val ITEM_VIEW_TYPE_USER_LIST = 2 + const val ITEM_VIEW_TYPE_USER_LIST = 2 } } diff --git a/twidere/src/main/kotlin/org/mariotaku/twidere/adapter/ParcelableUserListsAdapter.kt b/twidere/src/main/kotlin/org/mariotaku/twidere/adapter/ParcelableUserListsAdapter.kt index 30464845a..b52022311 100644 --- a/twidere/src/main/kotlin/org/mariotaku/twidere/adapter/ParcelableUserListsAdapter.kt +++ b/twidere/src/main/kotlin/org/mariotaku/twidere/adapter/ParcelableUserListsAdapter.kt @@ -122,7 +122,7 @@ class ParcelableUserListsAdapter( companion object { - val ITEM_VIEW_TYPE_USER_LIST = 2 + const val ITEM_VIEW_TYPE_USER_LIST = 2 fun createUserListViewHolder(adapter: IUserListsAdapter<*>, inflater: LayoutInflater, diff --git a/twidere/src/main/kotlin/org/mariotaku/twidere/adapter/SupportTabsAdapter.kt b/twidere/src/main/kotlin/org/mariotaku/twidere/adapter/SupportTabsAdapter.kt index 89fe86f3e..0c31c4f9c 100644 --- a/twidere/src/main/kotlin/org/mariotaku/twidere/adapter/SupportTabsAdapter.kt +++ b/twidere/src/main/kotlin/org/mariotaku/twidere/adapter/SupportTabsAdapter.kt @@ -162,6 +162,6 @@ class SupportTabsAdapter( companion object { - private val EXTRA_ADAPTER_POSITION = "adapter_position" + private const val EXTRA_ADAPTER_POSITION = "adapter_position" } } diff --git a/twidere/src/main/kotlin/org/mariotaku/twidere/adapter/VariousItemsAdapter.kt b/twidere/src/main/kotlin/org/mariotaku/twidere/adapter/VariousItemsAdapter.kt index 9829e9e60..0c11646a1 100644 --- a/twidere/src/main/kotlin/org/mariotaku/twidere/adapter/VariousItemsAdapter.kt +++ b/twidere/src/main/kotlin/org/mariotaku/twidere/adapter/VariousItemsAdapter.kt @@ -112,9 +112,9 @@ class VariousItemsAdapter( companion object { - val VIEW_TYPE_STATUS = 1 - val VIEW_TYPE_USER = 2 - val VIEW_TYPE_USER_LIST = 3 - val VIEW_TYPE_HASHTAG = 4 + const val VIEW_TYPE_STATUS = 1 + const val VIEW_TYPE_USER = 2 + const val VIEW_TYPE_USER_LIST = 3 + const val VIEW_TYPE_HASHTAG = 4 } } diff --git a/twidere/src/main/kotlin/org/mariotaku/twidere/adapter/iface/ILoadMoreSupportAdapter.kt b/twidere/src/main/kotlin/org/mariotaku/twidere/adapter/iface/ILoadMoreSupportAdapter.kt index af1fce26b..3f9877dcd 100644 --- a/twidere/src/main/kotlin/org/mariotaku/twidere/adapter/iface/ILoadMoreSupportAdapter.kt +++ b/twidere/src/main/kotlin/org/mariotaku/twidere/adapter/iface/ILoadMoreSupportAdapter.kt @@ -36,7 +36,7 @@ interface ILoadMoreSupportAdapter { annotation class IndicatorPosition companion object { - val ITEM_VIEW_TYPE_LOAD_INDICATOR = 0 + const val ITEM_VIEW_TYPE_LOAD_INDICATOR = 0 const val NONE: Long = 0 const val START: Long = 1 diff --git a/twidere/src/main/kotlin/org/mariotaku/twidere/app/TwidereApplication.kt b/twidere/src/main/kotlin/org/mariotaku/twidere/app/TwidereApplication.kt index 490ccd1c9..142cd7307 100644 --- a/twidere/src/main/kotlin/org/mariotaku/twidere/app/TwidereApplication.kt +++ b/twidere/src/main/kotlin/org/mariotaku/twidere/app/TwidereApplication.kt @@ -329,7 +329,7 @@ class TwidereApplication : Application(), OnSharedPreferenceChangeListener { companion object { - private val KEY_KEYBOARD_SHORTCUT_INITIALIZED = "keyboard_shortcut_initialized" + private const val KEY_KEYBOARD_SHORTCUT_INITIALIZED = "keyboard_shortcut_initialized" var instance: TwidereApplication? = null private set diff --git a/twidere/src/main/kotlin/org/mariotaku/twidere/fragment/AccountsManagerFragment.kt b/twidere/src/main/kotlin/org/mariotaku/twidere/fragment/AccountsManagerFragment.kt index 052d6953c..b87fe9f65 100644 --- a/twidere/src/main/kotlin/org/mariotaku/twidere/fragment/AccountsManagerFragment.kt +++ b/twidere/src/main/kotlin/org/mariotaku/twidere/fragment/AccountsManagerFragment.kt @@ -241,6 +241,6 @@ class AccountsManagerFragment : BaseFragment(), LoaderManager.LoaderCallbacks
  • (), LoaderCa companion object { - private val FRAGMENT_TAG_DELETING_DRAFTS = "deleting_drafts" + private const val FRAGMENT_TAG_DELETING_DRAFTS = "deleting_drafts" } } } diff --git a/twidere/src/main/kotlin/org/mariotaku/twidere/fragment/status/DestroyStatusDialogFragment.kt b/twidere/src/main/kotlin/org/mariotaku/twidere/fragment/status/DestroyStatusDialogFragment.kt index 4b7542f0f..07f5a44d9 100644 --- a/twidere/src/main/kotlin/org/mariotaku/twidere/fragment/status/DestroyStatusDialogFragment.kt +++ b/twidere/src/main/kotlin/org/mariotaku/twidere/fragment/status/DestroyStatusDialogFragment.kt @@ -38,7 +38,7 @@ class DestroyStatusDialogFragment : AbsSimpleStatusOperationDialogFragment() { companion object { - val FRAGMENT_TAG = "destroy_status" + const val FRAGMENT_TAG = "destroy_status" fun show(fm: FragmentManager, status: ParcelableStatus): DestroyStatusDialogFragment { val args = Bundle() diff --git a/twidere/src/main/kotlin/org/mariotaku/twidere/fragment/status/FavoriteConfirmDialogFragment.kt b/twidere/src/main/kotlin/org/mariotaku/twidere/fragment/status/FavoriteConfirmDialogFragment.kt index d6083178c..00ada3547 100644 --- a/twidere/src/main/kotlin/org/mariotaku/twidere/fragment/status/FavoriteConfirmDialogFragment.kt +++ b/twidere/src/main/kotlin/org/mariotaku/twidere/fragment/status/FavoriteConfirmDialogFragment.kt @@ -103,7 +103,7 @@ class FavoriteConfirmDialogFragment : AbsStatusDialogFragment() { companion object { - val FRAGMENT_TAG = "favorite_confirm" + const val FRAGMENT_TAG = "favorite_confirm" fun show(fm: FragmentManager, accountKey: UserKey, statusId: String, status: ParcelableStatus? = null): FavoriteConfirmDialogFragment { diff --git a/twidere/src/main/kotlin/org/mariotaku/twidere/fragment/status/PinStatusDialogFragment.kt b/twidere/src/main/kotlin/org/mariotaku/twidere/fragment/status/PinStatusDialogFragment.kt index 57bb93c1f..112aa4fea 100644 --- a/twidere/src/main/kotlin/org/mariotaku/twidere/fragment/status/PinStatusDialogFragment.kt +++ b/twidere/src/main/kotlin/org/mariotaku/twidere/fragment/status/PinStatusDialogFragment.kt @@ -41,7 +41,7 @@ class PinStatusDialogFragment : AbsSimpleStatusOperationDialogFragment() { companion object { - val FRAGMENT_TAG = "pin_status" + const val FRAGMENT_TAG = "pin_status" fun show(fm: FragmentManager, status: ParcelableStatus): PinStatusDialogFragment { val args = Bundle() diff --git a/twidere/src/main/kotlin/org/mariotaku/twidere/fragment/status/RetweetQuoteDialogFragment.kt b/twidere/src/main/kotlin/org/mariotaku/twidere/fragment/status/RetweetQuoteDialogFragment.kt index 5dbb1f463..55bb298ad 100644 --- a/twidere/src/main/kotlin/org/mariotaku/twidere/fragment/status/RetweetQuoteDialogFragment.kt +++ b/twidere/src/main/kotlin/org/mariotaku/twidere/fragment/status/RetweetQuoteDialogFragment.kt @@ -344,7 +344,7 @@ class RetweetQuoteDialogFragment : AbsStatusDialogFragment() { companion object { private const val FRAGMENT_TAG = "retweet_quote" - private val showProtectedConfirm = false + private const val showProtectedConfirm = false fun show(fm: FragmentManager, accountKey: UserKey, statusId: String, status: ParcelableStatus? = null, text: String? = null): diff --git a/twidere/src/main/kotlin/org/mariotaku/twidere/fragment/status/StatusFragment.kt b/twidere/src/main/kotlin/org/mariotaku/twidere/fragment/status/StatusFragment.kt index b450c9dd7..d7183d6ea 100644 --- a/twidere/src/main/kotlin/org/mariotaku/twidere/fragment/status/StatusFragment.kt +++ b/twidere/src/main/kotlin/org/mariotaku/twidere/fragment/status/StatusFragment.kt @@ -955,12 +955,12 @@ class StatusFragment : BaseFragment(), LoaderCallbacks