Fix some warnings

This commit is contained in:
mhmdanas 2021-04-28 00:28:36 +03:00
parent e52048c69e
commit e7ae215ab0
3 changed files with 4 additions and 5 deletions

View file

@ -207,7 +207,7 @@ class SubscriptionFragment : BaseStateFragment<SubscriptionState>() {
super.onActivityResult(requestCode, resultCode, data) super.onActivityResult(requestCode, resultCode, data)
if (data != null && data.data != null && resultCode == Activity.RESULT_OK) { if (data != null && data.data != null && resultCode == Activity.RESULT_OK) {
if (requestCode == REQUEST_EXPORT_CODE) { if (requestCode == REQUEST_EXPORT_CODE) {
val exportFile = Utils.getFileForUri(data.data!!) val exportFile = Utils.getFileForUri(data.data!!)!!
if (!exportFile.parentFile.canWrite() || !exportFile.parentFile.canRead()) { if (!exportFile.parentFile.canWrite() || !exportFile.parentFile.canRead()) {
Toast.makeText(activity, R.string.invalid_directory, Toast.LENGTH_SHORT).show() Toast.makeText(activity, R.string.invalid_directory, Toast.LENGTH_SHORT).show()
} else { } else {

View file

@ -9,6 +9,7 @@ import android.view.View
import android.view.ViewGroup import android.view.ViewGroup
import android.view.inputmethod.InputMethodManager import android.view.inputmethod.InputMethodManager
import android.widget.Toast import android.widget.Toast
import androidx.core.content.ContextCompat
import androidx.core.content.getSystemService import androidx.core.content.getSystemService
import androidx.core.os.bundleOf import androidx.core.os.bundleOf
import androidx.core.view.isGone 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) { if (android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.LOLLIPOP) {
// KitKat doesn't apply container's theme to <include> content // KitKat doesn't apply container's theme to <include> 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.setTextColor(contrastColor)
searchLayoutBinding.toolbarSearchEditText.setHintTextColor(contrastColor.withAlpha(128)) searchLayoutBinding.toolbarSearchEditText.setHintTextColor(contrastColor.withAlpha(128))
ImageViewCompat.setImageTintList(searchLayoutBinding.toolbarSearchClearIcon, contrastColor) ImageViewCompat.setImageTintList(searchLayoutBinding.toolbarSearchClearIcon, contrastColor)
@ -385,7 +386,7 @@ class FeedGroupDialog : DialogFragment(), BackPressable {
private fun setupIconPicker() { private fun setupIconPicker() {
val groupAdapter = GroupAdapter<GroupieViewHolder>() val groupAdapter = GroupAdapter<GroupieViewHolder>()
groupAdapter.addAll(FeedGroupIcon.values().map { PickerIconItem(requireContext(), it) }) groupAdapter.addAll(FeedGroupIcon.values().map { PickerIconItem(it) })
feedGroupCreateBinding.iconSelector.apply { feedGroupCreateBinding.iconSelector.apply {
layoutManager = GridLayoutManager(requireContext(), 7, RecyclerView.VERTICAL, false) layoutManager = GridLayoutManager(requireContext(), 7, RecyclerView.VERTICAL, false)

View file

@ -1,6 +1,5 @@
package org.schabi.newpipe.local.subscription.item package org.schabi.newpipe.local.subscription.item
import android.content.Context
import android.view.View import android.view.View
import androidx.annotation.DrawableRes import androidx.annotation.DrawableRes
import com.xwray.groupie.viewbinding.BindableItem import com.xwray.groupie.viewbinding.BindableItem
@ -9,7 +8,6 @@ import org.schabi.newpipe.databinding.PickerIconItemBinding
import org.schabi.newpipe.local.subscription.FeedGroupIcon import org.schabi.newpipe.local.subscription.FeedGroupIcon
class PickerIconItem( class PickerIconItem(
context: Context,
val icon: FeedGroupIcon val icon: FeedGroupIcon
) : BindableItem<PickerIconItemBinding>() { ) : BindableItem<PickerIconItemBinding>() {
@DrawableRes @DrawableRes