From e7ae215ab035c76143282cc315a45b4626aca7d4 Mon Sep 17 00:00:00 2001 From: mhmdanas <6daf084a-8eaf-40fb-86c7-8500077c3b69@anonaddy.me> Date: Wed, 28 Apr 2021 00:28:36 +0300 Subject: [PATCH 1/3] Fix some warnings --- .../newpipe/local/subscription/SubscriptionFragment.kt | 2 +- .../newpipe/local/subscription/dialog/FeedGroupDialog.kt | 5 +++-- .../schabi/newpipe/local/subscription/item/PickerIconItem.kt | 2 -- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/app/src/main/java/org/schabi/newpipe/local/subscription/SubscriptionFragment.kt b/app/src/main/java/org/schabi/newpipe/local/subscription/SubscriptionFragment.kt index f8a6f0f4d..16bdb6a13 100644 --- a/app/src/main/java/org/schabi/newpipe/local/subscription/SubscriptionFragment.kt +++ b/app/src/main/java/org/schabi/newpipe/local/subscription/SubscriptionFragment.kt @@ -207,7 +207,7 @@ class SubscriptionFragment : BaseStateFragment() { super.onActivityResult(requestCode, resultCode, data) if (data != null && data.data != null && resultCode == Activity.RESULT_OK) { if (requestCode == REQUEST_EXPORT_CODE) { - val exportFile = Utils.getFileForUri(data.data!!) + val exportFile = Utils.getFileForUri(data.data!!)!! if (!exportFile.parentFile.canWrite() || !exportFile.parentFile.canRead()) { Toast.makeText(activity, R.string.invalid_directory, Toast.LENGTH_SHORT).show() } else { 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 2918bcd66..cb0c5fe35 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 @@ -9,6 +9,7 @@ import android.view.View import android.view.ViewGroup import android.view.inputmethod.InputMethodManager import android.widget.Toast +import androidx.core.content.ContextCompat import androidx.core.content.getSystemService import androidx.core.os.bundleOf import androidx.core.view.isGone @@ -127,7 +128,7 @@ class FeedGroupDialog : DialogFragment(), BackPressable { if (android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.LOLLIPOP) { // KitKat doesn't apply container's theme to content - val contrastColor = ColorStateList.valueOf(resources.getColor(R.color.contrastColor)) + val contrastColor = ColorStateList.valueOf(ContextCompat.getColor(requireContext(), R.color.contrastColor)) searchLayoutBinding.toolbarSearchEditText.setTextColor(contrastColor) searchLayoutBinding.toolbarSearchEditText.setHintTextColor(contrastColor.withAlpha(128)) ImageViewCompat.setImageTintList(searchLayoutBinding.toolbarSearchClearIcon, contrastColor) @@ -385,7 +386,7 @@ class FeedGroupDialog : DialogFragment(), BackPressable { private fun setupIconPicker() { val groupAdapter = GroupAdapter() - groupAdapter.addAll(FeedGroupIcon.values().map { PickerIconItem(requireContext(), it) }) + groupAdapter.addAll(FeedGroupIcon.values().map { PickerIconItem(it) }) feedGroupCreateBinding.iconSelector.apply { layoutManager = GridLayoutManager(requireContext(), 7, RecyclerView.VERTICAL, false) diff --git a/app/src/main/java/org/schabi/newpipe/local/subscription/item/PickerIconItem.kt b/app/src/main/java/org/schabi/newpipe/local/subscription/item/PickerIconItem.kt index 1b55d2e85..b4232f666 100644 --- a/app/src/main/java/org/schabi/newpipe/local/subscription/item/PickerIconItem.kt +++ b/app/src/main/java/org/schabi/newpipe/local/subscription/item/PickerIconItem.kt @@ -1,6 +1,5 @@ package org.schabi.newpipe.local.subscription.item -import android.content.Context import android.view.View import androidx.annotation.DrawableRes import com.xwray.groupie.viewbinding.BindableItem @@ -9,7 +8,6 @@ import org.schabi.newpipe.databinding.PickerIconItemBinding import org.schabi.newpipe.local.subscription.FeedGroupIcon class PickerIconItem( - context: Context, val icon: FeedGroupIcon ) : BindableItem() { @DrawableRes From 2c1df5f875d479e5e23603d29308e451ac55a685 Mon Sep 17 00:00:00 2001 From: mhmdanas <6daf084a-8eaf-40fb-86c7-8500077c3b69@anonaddy.me> Date: Fri, 30 Apr 2021 01:02:46 +0300 Subject: [PATCH 2/3] Actually fix the parentFile warning --- .../newpipe/local/subscription/SubscriptionFragment.kt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/org/schabi/newpipe/local/subscription/SubscriptionFragment.kt b/app/src/main/java/org/schabi/newpipe/local/subscription/SubscriptionFragment.kt index 16bdb6a13..d3f80e214 100644 --- a/app/src/main/java/org/schabi/newpipe/local/subscription/SubscriptionFragment.kt +++ b/app/src/main/java/org/schabi/newpipe/local/subscription/SubscriptionFragment.kt @@ -207,8 +207,9 @@ class SubscriptionFragment : BaseStateFragment() { super.onActivityResult(requestCode, resultCode, data) if (data != null && data.data != null && resultCode == Activity.RESULT_OK) { if (requestCode == REQUEST_EXPORT_CODE) { - val exportFile = Utils.getFileForUri(data.data!!)!! - if (!exportFile.parentFile.canWrite() || !exportFile.parentFile.canRead()) { + val exportFile = Utils.getFileForUri(data.data!!) + val parentFile = exportFile.parentFile!! + if (!parentFile.canWrite() || !parentFile.canRead()) { Toast.makeText(activity, R.string.invalid_directory, Toast.LENGTH_SHORT).show() } else { activity.startService( From 7f6674a0e6641f2cb47b68fdde72ca320250b013 Mon Sep 17 00:00:00 2001 From: mhmdanas <6daf084a-8eaf-40fb-86c7-8500077c3b69@anonaddy.me> Date: Fri, 30 Apr 2021 01:02:57 +0300 Subject: [PATCH 3/3] Remove strings without default values --- app/src/main/res/values-kmr/strings.xml | 3 +-- app/src/main/res/values-lv/strings.xml | 3 +-- app/src/main/res/values-sr/strings.xml | 3 +-- 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/app/src/main/res/values-kmr/strings.xml b/app/src/main/res/values-kmr/strings.xml index 8f03299b1..bdc7fe406 100644 --- a/app/src/main/res/values-kmr/strings.xml +++ b/app/src/main/res/values-kmr/strings.xml @@ -200,7 +200,6 @@ Dîrok Destûrê bixwînin NewPipe nermalava kopîleft libre ye: Hûn dikarin li gorî kêfa xwe bikar bînin, parve bikin û baştir bikin. Bi taybetî hûn dikarin wê di bin mercên Lîsansa Giştî ya GNU ya Giştî ya ku ji hêla Weqfa Nermalava Azad ve hatî weşandin de, an guhertoya 3 ya Lîsansê, an jî (li gorî vebijarka we) guhertoyek paşîn ji nû ve belav bikin û / an biguherînin. - Mezinahî kirin Zelal Hênikkirin Parzûn @@ -664,4 +663,4 @@ Derbar Mîhengên Serlêdanê kilît bikin - \ No newline at end of file + diff --git a/app/src/main/res/values-lv/strings.xml b/app/src/main/res/values-lv/strings.xml index 6a45130e1..e8a9cca29 100644 --- a/app/src/main/res/values-lv/strings.xml +++ b/app/src/main/res/values-lv/strings.xml @@ -277,7 +277,6 @@ Fails izdzēsts Atsaukt Labākā izšķirtspēja - Maina izmēru Notīrīt Atsvaidzināt Filtrēt @@ -690,4 +689,4 @@ Šis video ir ierobežots ar vecumu. \nŅemot vērā jauno YouTube politiku ar vecuma ierobežotiem videoklipiem, Newpipe nevar piekļūt šim videoklipam. Nakts Motīvs - \ No newline at end of file + diff --git a/app/src/main/res/values-sr/strings.xml b/app/src/main/res/values-sr/strings.xml index b3b90b95e..2080f4d34 100644 --- a/app/src/main/res/values-sr/strings.xml +++ b/app/src/main/res/values-sr/strings.xml @@ -489,7 +489,6 @@ Укључи / искључи услугу, која је тренутно изабрана: Превуците за преуређивање Опис - Повезани стримови Коментари Проверите да ли већ постоји проблем који говори о вашем паду апликације. Када правите дупликате карата, одузимате нам време које бисмо могли потрошити на исправљање стварне грешке. Пријави на GitHub-у @@ -690,4 +689,4 @@ Прикажи детаље о каналу Повезани предмети - \ No newline at end of file +