Skip to content
This repository was archived by the owner on Jul 16, 2024. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,14 @@
package io.goooler.demoapp.base.util

import android.app.Activity
import android.content.ContentUris
import android.content.Context
import android.content.ContextWrapper
import android.content.Intent
import android.graphics.Color
import android.graphics.drawable.GradientDrawable
import android.media.AudioManager
import android.net.Uri
import android.os.Build
import android.os.Bundle
import android.os.Looper
Expand All @@ -29,7 +31,6 @@ import android.widget.TextView
import androidx.annotation.ColorInt
import androidx.annotation.IdRes
import androidx.annotation.IntRange
import androidx.annotation.LayoutRes
import androidx.annotation.MainThread
import androidx.annotation.Px
import androidx.core.content.getSystemService
Expand All @@ -38,8 +39,6 @@ import androidx.core.content.pm.ShortcutManagerCompat
import androidx.core.os.bundleOf
import androidx.core.text.parseAsHtml
import androidx.core.text.toSpannable
import androidx.databinding.DataBindingUtil
import androidx.databinding.ViewDataBinding
import androidx.fragment.app.Fragment
import androidx.fragment.app.FragmentActivity
import androidx.fragment.app.FragmentManager
Expand Down Expand Up @@ -125,6 +124,8 @@ fun String.isValidFilename(): Boolean {
return !filenameRegex.matcher(this).find() && "." != this && ".." != this
}

fun Uri.withAppendedId(id: Long): Uri = ContentUris.withAppendedId(this, id)

@OptIn(ExperimentalContracts::class)
fun CharSequence?.isNotNullOrEmpty(): Boolean {
contract {
Expand Down Expand Up @@ -661,7 +662,3 @@ fun FragmentActivity.replaceFragment(
) {
supportFragmentManager.replaceFragment(fragment, containerViewId, isAddToBackStack, tag)
}

@MainThread
inline fun <reified T : ViewDataBinding> Activity.binding(@LayoutRes resId: Int): Lazy<T> =
lazy(LazyThreadSafetyMode.NONE) { DataBindingUtil.setContentView(this, resId) }
Comment on lines -664 to -667
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missed this in #75

Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ fun TextView.hideTextInputLayoutErrorOnTextChange(textInputLayout: TextInputLayo
doAfterTextChanged { textInputLayout.error = null }
}

inline fun <reified T> DiffUtil.ItemCallback<T>.asConfig(): AsyncDifferConfig<T> {
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missed this in #58

inline fun <reified T : Any> DiffUtil.ItemCallback<T>.asConfig(): AsyncDifferConfig<T> {
return AsyncDifferConfig.Builder(this)
.setBackgroundThreadExecutor(Dispatchers.Default.asExecutor())
.build()
Expand Down