From 2dd06c82a1929a2644bae8f9850ccaa0a32c4161 Mon Sep 17 00:00:00 2001 From: Adolfo Santiago Date: Wed, 6 Jul 2022 17:33:31 +0200 Subject: [PATCH] Update dependencies New version of ExoPlayer has the statistics turned off by default. The app now works with Kotlin 1.7.0. Some changes were necessary in order to start using that Kotlin version. The rest of dependencies are routine. --- .../java/com/keylesspalace/tusky/AccountActivity.kt | 1 + .../com/keylesspalace/tusky/EditProfileActivity.kt | 2 ++ .../java/com/keylesspalace/tusky/ViewMediaActivity.kt | 7 ++++--- .../com/keylesspalace/tusky/adapter/StickerAdapater.kt | 4 ++-- .../tusky/components/preference/PreferencesFragment.kt | 8 ++++---- .../com/keylesspalace/tusky/fragment/ChatsFragment.kt | 10 +++++----- .../keylesspalace/tusky/fragment/ViewVideoFragment.kt | 1 + husky/versions.gradle | 10 +++++----- 8 files changed, 24 insertions(+), 19 deletions(-) diff --git a/husky/app/src/main/java/com/keylesspalace/tusky/AccountActivity.kt b/husky/app/src/main/java/com/keylesspalace/tusky/AccountActivity.kt index 9deb2e1..22ae7c9 100644 --- a/husky/app/src/main/java/com/keylesspalace/tusky/AccountActivity.kt +++ b/husky/app/src/main/java/com/keylesspalace/tusky/AccountActivity.kt @@ -346,6 +346,7 @@ class AccountActivity : BottomSheetActivity(), ActionButtonActivity, HasAndroidI .setAction(R.string.action_retry) { viewModel.refresh() } .show() } + else -> {} } } viewModel.relationshipData.observe(this) { diff --git a/husky/app/src/main/java/com/keylesspalace/tusky/EditProfileActivity.kt b/husky/app/src/main/java/com/keylesspalace/tusky/EditProfileActivity.kt index f9b2c5a..94d5b60 100644 --- a/husky/app/src/main/java/com/keylesspalace/tusky/EditProfileActivity.kt +++ b/husky/app/src/main/java/com/keylesspalace/tusky/EditProfileActivity.kt @@ -164,6 +164,7 @@ class EditProfileActivity : BaseActivity(), Injectable { snackbar.show() } + else -> {} } } @@ -186,6 +187,7 @@ class EditProfileActivity : BaseActivity(), Injectable { } } } + else -> {} } } diff --git a/husky/app/src/main/java/com/keylesspalace/tusky/ViewMediaActivity.kt b/husky/app/src/main/java/com/keylesspalace/tusky/ViewMediaActivity.kt index b40adb1..1e68576 100644 --- a/husky/app/src/main/java/com/keylesspalace/tusky/ViewMediaActivity.kt +++ b/husky/app/src/main/java/com/keylesspalace/tusky/ViewMediaActivity.kt @@ -178,13 +178,14 @@ class ViewMediaActivity : BaseActivity(), ViewImageFragment.PhotoActionsListener return false } - override fun onPrepareOptionsMenu(menu: Menu?): Boolean { - menu?.findItem(R.id.action_share_media)?.isEnabled = !isCreating + override fun onPrepareOptionsMenu(menu: Menu): Boolean { + menu.findItem(R.id.action_share_media)?.isEnabled = !isCreating if(attachments != null) { val isStatus = attachments!!.any { it.statusId != null && it.statusUrl != null } - menu?.findItem(R.id.action_open_status)?.isVisible = isStatus + menu.findItem(R.id.action_open_status)?.isVisible = isStatus } + return true } diff --git a/husky/app/src/main/java/com/keylesspalace/tusky/adapter/StickerAdapater.kt b/husky/app/src/main/java/com/keylesspalace/tusky/adapter/StickerAdapater.kt index eec2952..db43876 100644 --- a/husky/app/src/main/java/com/keylesspalace/tusky/adapter/StickerAdapater.kt +++ b/husky/app/src/main/java/com/keylesspalace/tusky/adapter/StickerAdapater.kt @@ -105,7 +105,7 @@ class StickerAdapter( Glide.with(holder.itemView) .load(( url ?: "" ) + stickers[position]) .thumbnail() - .into(holder.itemView) + .into(holder.itemView as AppCompatImageButton) } override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): SingleViewHolder { @@ -114,4 +114,4 @@ class StickerAdapter( return SingleViewHolder(view) } } -} \ No newline at end of file +} diff --git a/husky/app/src/main/java/com/keylesspalace/tusky/components/preference/PreferencesFragment.kt b/husky/app/src/main/java/com/keylesspalace/tusky/components/preference/PreferencesFragment.kt index fe4b812..1b4ce6f 100644 --- a/husky/app/src/main/java/com/keylesspalace/tusky/components/preference/PreferencesFragment.kt +++ b/husky/app/src/main/java/com/keylesspalace/tusky/components/preference/PreferencesFragment.kt @@ -402,12 +402,12 @@ class PreferencesFragment : PreferenceFragmentCompat(), Injectable { private fun updateHttpProxySummary() { val sharedPreferences = preferenceManager.sharedPreferences - val httpProxyEnabled = sharedPreferences.getBoolean(PrefKeys.HTTP_PROXY_ENABLED, false) - val httpServer = sharedPreferences.getNonNullString(PrefKeys.HTTP_PROXY_SERVER, "") + val httpProxyEnabled = sharedPreferences?.getBoolean(PrefKeys.HTTP_PROXY_ENABLED, false) ?: false + val httpServer = sharedPreferences?.getNonNullString(PrefKeys.HTTP_PROXY_SERVER, "") ?: "" try { - val httpPort = sharedPreferences.getNonNullString(PrefKeys.HTTP_PROXY_PORT, "-1") - .toInt() + val httpPort = sharedPreferences?.getNonNullString(PrefKeys.HTTP_PROXY_PORT, "-1") + ?.toInt() ?: -1 if(httpProxyEnabled && httpServer.isNotBlank() && httpPort > 0 && httpPort < 65535) { httpProxyPref?.summary = "$httpServer:$httpPort" diff --git a/husky/app/src/main/java/com/keylesspalace/tusky/fragment/ChatsFragment.kt b/husky/app/src/main/java/com/keylesspalace/tusky/fragment/ChatsFragment.kt index a51cbad..7c8e41c 100644 --- a/husky/app/src/main/java/com/keylesspalace/tusky/fragment/ChatsFragment.kt +++ b/husky/app/src/main/java/com/keylesspalace/tusky/fragment/ChatsFragment.kt @@ -159,7 +159,7 @@ class ChatsFragment : BaseFragment(), Injectable, RefreshableFragment, Reselecta override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) - val preferences = PreferenceManager.getDefaultSharedPreferences(activity) + val preferences = PreferenceManager.getDefaultSharedPreferences(requireContext()) val statusDisplayOptions = StatusDisplayOptions( animateAvatars = preferences.getBoolean(PrefKeys.ANIMATE_GIF_AVATARS, false), @@ -325,7 +325,7 @@ class ChatsFragment : BaseFragment(), Injectable, RefreshableFragment, Reselecta * guaranteed to be set until then. */ /* Use a modified scroll listener that both loads more statuses as it goes, and hides * the follow button on down-scroll. */ - val preferences = PreferenceManager.getDefaultSharedPreferences(context) + val preferences = PreferenceManager.getDefaultSharedPreferences(requireContext()) hideFab = preferences.getBoolean("fabHide", false) scrollListener = object : EndlessOnScrollListener(layoutManager) { override fun onScrolled(view: RecyclerView, dx: Int, dy: Int) { @@ -393,7 +393,7 @@ class ChatsFragment : BaseFragment(), Injectable, RefreshableFragment, Reselecta */ private fun onPreferenceChanged(key: String) { - val sharedPreferences = PreferenceManager.getDefaultSharedPreferences(context) + val sharedPreferences = PreferenceManager.getDefaultSharedPreferences(requireContext()) when (key) { "fabHide" -> { hideFab = sharedPreferences.getBoolean("fabHide", false) @@ -722,7 +722,7 @@ class ChatsFragment : BaseFragment(), Injectable, RefreshableFragment, Reselecta * Auto dispose observable on pause */ private fun startUpdateTimestamp() { - val preferences = PreferenceManager.getDefaultSharedPreferences(activity) + val preferences = PreferenceManager.getDefaultSharedPreferences(requireContext()) val useAbsoluteTime = preferences.getBoolean("absoluteTimeView", false) if (!useAbsoluteTime) { Observable.interval(1, TimeUnit.MINUTES) @@ -778,4 +778,4 @@ class ChatsFragment : BaseFragment(), Injectable, RefreshableFragment, Reselecta bottomSheetActivity.openChat(it) } } -} \ No newline at end of file +} diff --git a/husky/app/src/main/java/com/keylesspalace/tusky/fragment/ViewVideoFragment.kt b/husky/app/src/main/java/com/keylesspalace/tusky/fragment/ViewVideoFragment.kt index 361bcdc..a3f7516 100644 --- a/husky/app/src/main/java/com/keylesspalace/tusky/fragment/ViewVideoFragment.kt +++ b/husky/app/src/main/java/com/keylesspalace/tusky/fragment/ViewVideoFragment.kt @@ -125,6 +125,7 @@ class ViewVideoFragment : ViewMediaFragment() { } exoPlayer = ExoPlayer.Builder(requireActivity()) + .setUsePlatformDiagnostics(false) .setTrackSelector(trackSelector) .build() .also { player -> diff --git a/husky/versions.gradle b/husky/versions.gradle index 652efd5..a6781fd 100644 --- a/husky/versions.gradle +++ b/husky/versions.gradle @@ -1,5 +1,5 @@ // Kotlin version -ext.kotlin_version = "1.6.21" +ext.kotlin_version = "1.7.0" // Dependencies versions def versions = [:] @@ -22,22 +22,22 @@ versions.coreKtx = "1.8.0" versions.dagger = "2.42" versions.emoji = "1.1.0" versions.exifInterface = "1.3.3" -versions.exoplayer = "2.17.1" +versions.exoplayer = "2.18.0" versions.filemojiCompat = "1.0.17" versions.flexbox = "2.0.1" -versions.fragmentKtx = "1.4.1" +versions.fragmentKtx = "1.5.0" versions.fragmentviewbindingdelegateKt = "1.0.0" versions.glide = "4.13.2" versions.glideImage = "1.8.1" versions.glidePluginAnimation = "2.23.0" versions.kotlinx = "1.6.3" -versions.lifecycle = "2.4.1" +versions.lifecycle = "2.5.0" versions.markdownEdit = "1.0.0" versions.materialDesign = "1.6.1" versions.materialDrawer = "8.4.5" versions.materialDrawerTypeface = "3.0.1.4.original-kotlin@aar" versions.pagingRuntimeKtx = "2.1.2" -versions.preferenceKtx = "1.1.1" +versions.preferenceKtx = "1.2.0" versions.okhttpVersion = "4.10.0" versions.recyclerView = "1.2.1" versions.retrofit = "2.9.0"