diff --git a/app/src/main/java/org/schabi/newpipe/local/feed/FeedFragment.kt b/app/src/main/java/org/schabi/newpipe/local/feed/FeedFragment.kt index e4d10fb61..825b36045 100644 --- a/app/src/main/java/org/schabi/newpipe/local/feed/FeedFragment.kt +++ b/app/src/main/java/org/schabi/newpipe/local/feed/FeedFragment.kt @@ -29,6 +29,7 @@ import android.view.MenuItem import android.view.View import android.view.ViewGroup import androidx.appcompat.app.AlertDialog +import androidx.core.content.edit import androidx.core.os.bundleOf import androidx.core.view.isVisible import androidx.lifecycle.Observer @@ -142,9 +143,9 @@ class FeedFragment : BaseListFragment() { AlertDialog.Builder(requireContext()) .setMessage(R.string.feed_use_dedicated_fetch_method_help_text) .setNeutralButton(enableDisableButtonText) { _, _ -> - sharedPreferences.edit() - .putBoolean(getString(R.string.feed_use_dedicated_fetch_method_key), !usingDedicatedMethod) - .apply() + sharedPreferences.edit { + putBoolean(getString(R.string.feed_use_dedicated_fetch_method_key), !usingDedicatedMethod) + } } .setPositiveButton(resources.getString(R.string.finish), null) .create() @@ -255,8 +256,9 @@ class FeedFragment : BaseListFragment() { oldestSubscriptionUpdate = loadedState.oldestUpdate - refresh_subtitle_text.isVisible = loadedState.notLoadedCount > 0 - if (loadedState.notLoadedCount > 0) { + val loadedCount = loadedState.notLoadedCount > 0 + refresh_subtitle_text.isVisible = loadedCount + if (loadedCount) { refresh_subtitle_text.text = getString(R.string.feed_subscription_not_loaded_count, loadedState.notLoadedCount) } diff --git a/app/src/main/java/org/schabi/newpipe/local/subscription/dialog/FeedGroupDialog.kt b/app/src/main/java/org/schabi/newpipe/local/subscription/dialog/FeedGroupDialog.kt index 28ffa6265..9f82aefb7 100644 --- a/app/src/main/java/org/schabi/newpipe/local/subscription/dialog/FeedGroupDialog.kt +++ b/app/src/main/java/org/schabi/newpipe/local/subscription/dialog/FeedGroupDialog.kt @@ -3,7 +3,6 @@ package org.schabi.newpipe.local.subscription.dialog import android.app.Dialog import android.os.Bundle import android.os.Parcelable -import android.text.TextUtils import android.view.LayoutInflater import android.view.View import android.view.ViewGroup @@ -225,7 +224,7 @@ class FeedGroupDialog : DialogFragment(), BackPressable { } toolbar_search_clear.setOnClickListener { - if (TextUtils.isEmpty(toolbar_search_edit_text.text)) { + if (toolbar_search_edit_text.text.isEmpty()) { hideSearch() return@setOnClickListener }