mirror of
https://github.com/Aviortheking/Neo-Store.git
synced 2025-06-16 04:19:19 +00:00
Update: Move to androidx.material/appcompat
Auto Format of code
This commit is contained in:
@ -44,7 +44,7 @@ class DefaultInstaller(context: Context) : BaseInstaller(context) {
|
||||
}
|
||||
}
|
||||
|
||||
private fun mDefaultUninstaller(packageName: String){
|
||||
private fun mDefaultUninstaller(packageName: String) {
|
||||
val uri = Uri.fromParts("package", packageName, null)
|
||||
val intent = Intent()
|
||||
intent.data = uri
|
||||
|
@ -13,11 +13,11 @@ import android.util.Base64
|
||||
import android.view.MenuItem
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.widget.EditText
|
||||
import android.widget.FrameLayout
|
||||
import androidx.appcompat.app.AlertDialog
|
||||
import androidx.fragment.app.DialogFragment
|
||||
import com.google.android.material.circularreveal.CircularRevealFrameLayout
|
||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder
|
||||
import com.google.android.material.textfield.TextInputEditText
|
||||
import com.looker.droidify.R
|
||||
import com.looker.droidify.database.Database
|
||||
import com.looker.droidify.entity.Repository
|
||||
@ -57,11 +57,11 @@ class EditRepositoryFragment() : ScreenFragment() {
|
||||
}
|
||||
|
||||
private class Layout(view: View) {
|
||||
val address = view.findViewById<EditText>(R.id.address)!!
|
||||
val address = view.findViewById<TextInputEditText>(R.id.address)!!
|
||||
val addressMirror = view.findViewById<View>(R.id.address_mirror)!!
|
||||
val fingerprint = view.findViewById<EditText>(R.id.fingerprint)!!
|
||||
val username = view.findViewById<EditText>(R.id.username)!!
|
||||
val password = view.findViewById<EditText>(R.id.password)!!
|
||||
val fingerprint = view.findViewById<TextInputEditText>(R.id.fingerprint)!!
|
||||
val username = view.findViewById<TextInputEditText>(R.id.username)!!
|
||||
val password = view.findViewById<TextInputEditText>(R.id.password)!!
|
||||
val overlay = view.findViewById<View>(R.id.overlay)!!
|
||||
val skip = view.findViewById<View>(R.id.skip)!!
|
||||
}
|
||||
@ -99,7 +99,7 @@ class EditRepositoryFragment() : ScreenFragment() {
|
||||
true
|
||||
}
|
||||
|
||||
val content = view.findViewById<FrameLayout>(R.id.fragment_content)!!
|
||||
val content = view.findViewById<CircularRevealFrameLayout>(R.id.fragment_content)!!
|
||||
errorColorFilter = PorterDuffColorFilter(
|
||||
content.context
|
||||
.getColorFromAttr(R.attr.colorError).defaultColor, PorterDuff.Mode.SRC_IN
|
||||
|
@ -22,8 +22,8 @@ import android.view.Gravity
|
||||
import android.view.MotionEvent
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.widget.*
|
||||
import androidx.appcompat.content.res.AppCompatResources
|
||||
import androidx.appcompat.widget.LinearLayoutCompat
|
||||
import androidx.core.content.res.ResourcesCompat
|
||||
import androidx.core.net.toUri
|
||||
import androidx.core.text.HtmlCompat
|
||||
@ -33,8 +33,11 @@ import androidx.recyclerview.widget.RecyclerView
|
||||
import coil.load
|
||||
import com.google.android.material.button.MaterialButton
|
||||
import com.google.android.material.card.MaterialCardView
|
||||
import com.google.android.material.circularreveal.CircularRevealFrameLayout
|
||||
import com.google.android.material.divider.MaterialDivider
|
||||
import com.google.android.material.imageview.ShapeableImageView
|
||||
import com.google.android.material.progressindicator.LinearProgressIndicator
|
||||
import com.google.android.material.snackbar.Snackbar
|
||||
import com.google.android.material.switchmaterial.SwitchMaterial
|
||||
import com.google.android.material.textview.MaterialTextView
|
||||
import com.looker.droidify.R
|
||||
@ -49,7 +52,6 @@ import com.looker.droidify.utility.Utils
|
||||
import com.looker.droidify.utility.extension.android.*
|
||||
import com.looker.droidify.utility.extension.resources.*
|
||||
import com.looker.droidify.utility.extension.text.*
|
||||
import com.looker.droidify.widget.ClickableMovementMethod
|
||||
import com.looker.droidify.widget.StableRecyclerAdapter
|
||||
import java.lang.ref.WeakReference
|
||||
import java.util.*
|
||||
@ -323,12 +325,12 @@ class ProductAdapter(private val callbacks: Callbacks, private val columns: Int)
|
||||
|
||||
private class HeaderViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) {
|
||||
val icon = itemView.findViewById<ShapeableImageView>(R.id.icon)!!
|
||||
val name = itemView.findViewById<TextView>(R.id.name)!!
|
||||
val packageName = itemView.findViewById<TextView>(R.id.package_name)!!
|
||||
val name = itemView.findViewById<MaterialTextView>(R.id.name)!!
|
||||
val packageName = itemView.findViewById<MaterialTextView>(R.id.package_name)!!
|
||||
val action = itemView.findViewById<MaterialButton>(R.id.action)!!
|
||||
val statusLayout = itemView.findViewById<View>(R.id.status_layout)!!
|
||||
val status = itemView.findViewById<TextView>(R.id.status)!!
|
||||
val progress = itemView.findViewById<ProgressBar>(R.id.progress)!!
|
||||
val status = itemView.findViewById<MaterialTextView>(R.id.status)!!
|
||||
val progress = itemView.findViewById<LinearProgressIndicator>(R.id.progress)!!
|
||||
|
||||
val progressIcon: Drawable
|
||||
val defaultIcon: Drawable
|
||||
@ -340,7 +342,6 @@ class ProductAdapter(private val callbacks: Callbacks, private val columns: Int)
|
||||
|
||||
init {
|
||||
action.apply {
|
||||
setTextSizeScaled(15)
|
||||
setTextColor(action.context.getColorFromAttr(R.attr.colorOnPrimary))
|
||||
height = itemView.resources.sizeScaled(48)
|
||||
}
|
||||
@ -351,7 +352,7 @@ class ProductAdapter(private val callbacks: Callbacks, private val columns: Int)
|
||||
}
|
||||
|
||||
private class ReleaseInfoViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) {
|
||||
val targetBlock = itemView.findViewById<LinearLayout>(R.id.sdk_block)!!
|
||||
val targetBlock = itemView.findViewById<LinearLayoutCompat>(R.id.sdk_block)!!
|
||||
val divider1 = itemView.findViewById<MaterialDivider>(R.id.divider1)!!
|
||||
val targetSdk = itemView.findViewById<MaterialTextView>(R.id.sdk)!!
|
||||
val version = itemView.findViewById<MaterialTextView>(R.id.version)!!
|
||||
@ -369,16 +370,17 @@ class ProductAdapter(private val callbacks: Callbacks, private val columns: Int)
|
||||
}
|
||||
|
||||
private class SectionViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) {
|
||||
val title = itemView.findViewById<TextView>(R.id.title)!!
|
||||
val title = itemView.findViewById<MaterialTextView>(R.id.title)!!
|
||||
val icon = itemView.findViewById<ShapeableImageView>(R.id.icon)!!
|
||||
}
|
||||
|
||||
private class ExpandViewHolder(context: Context) : RecyclerView.ViewHolder(TextView(context)) {
|
||||
val text: TextView
|
||||
get() = itemView as TextView
|
||||
private class ExpandViewHolder(context: Context) :
|
||||
RecyclerView.ViewHolder(MaterialTextView(context)) {
|
||||
val text: MaterialTextView
|
||||
get() = itemView as MaterialTextView
|
||||
|
||||
init {
|
||||
itemView as TextView
|
||||
itemView as MaterialTextView
|
||||
itemView.typeface = TypefaceExtra.medium
|
||||
itemView.setTextSizeScaled(14)
|
||||
itemView.setTextColor(itemView.context.getColorFromAttr(android.R.attr.textColor))
|
||||
@ -402,16 +404,16 @@ class ProductAdapter(private val callbacks: Callbacks, private val columns: Int)
|
||||
}
|
||||
}
|
||||
|
||||
private class TextViewHolder(context: Context) : RecyclerView.ViewHolder(TextView(context)) {
|
||||
val text: TextView
|
||||
get() = itemView as TextView
|
||||
private class TextViewHolder(context: Context) :
|
||||
RecyclerView.ViewHolder(MaterialTextView(context)) {
|
||||
val text: MaterialTextView
|
||||
get() = itemView as MaterialTextView
|
||||
|
||||
init {
|
||||
itemView as TextView
|
||||
itemView as MaterialTextView
|
||||
itemView.setTextSizeScaled(15)
|
||||
itemView.setTextColor(itemView.context.getColorFromAttr(android.R.attr.textColor))
|
||||
itemView.resources.sizeScaled(16).let { itemView.setPadding(it, it, it, it) }
|
||||
itemView.movementMethod = ClickableMovementMethod
|
||||
itemView.layoutParams = RecyclerView.LayoutParams(
|
||||
RecyclerView.LayoutParams.MATCH_PARENT,
|
||||
RecyclerView.LayoutParams.WRAP_CONTENT
|
||||
@ -437,8 +439,8 @@ class ProductAdapter(private val callbacks: Callbacks, private val columns: Int)
|
||||
}
|
||||
|
||||
val icon = itemView.findViewById<ShapeableImageView>(R.id.icon)!!
|
||||
val text = itemView.findViewById<TextView>(R.id.text)!!
|
||||
val link = itemView.findViewById<TextView>(R.id.link)!!
|
||||
val text = itemView.findViewById<MaterialTextView>(R.id.text)!!
|
||||
val link = itemView.findViewById<MaterialTextView>(R.id.link)!!
|
||||
|
||||
init {
|
||||
val margin = measurement.invalidate(itemView.resources) {
|
||||
@ -461,7 +463,7 @@ class ProductAdapter(private val callbacks: Callbacks, private val columns: Int)
|
||||
}
|
||||
|
||||
val icon = itemView.findViewById<ShapeableImageView>(R.id.icon)!!
|
||||
val text = itemView.findViewById<TextView>(R.id.text)!!
|
||||
val text = itemView.findViewById<MaterialTextView>(R.id.text)!!
|
||||
|
||||
init {
|
||||
val margin = measurement.invalidate(itemView.resources) {
|
||||
@ -478,7 +480,7 @@ class ProductAdapter(private val callbacks: Callbacks, private val columns: Int)
|
||||
}
|
||||
|
||||
private class ScreenshotViewHolder(context: Context) :
|
||||
RecyclerView.ViewHolder(FrameLayout(context)) {
|
||||
RecyclerView.ViewHolder(CircularRevealFrameLayout(context)) {
|
||||
val image: ShapeableImageView
|
||||
|
||||
val placeholder: Drawable
|
||||
@ -487,7 +489,7 @@ class ProductAdapter(private val callbacks: Callbacks, private val columns: Int)
|
||||
var gridCount = -1
|
||||
|
||||
init {
|
||||
itemView as FrameLayout
|
||||
itemView as CircularRevealFrameLayout
|
||||
itemView.foreground =
|
||||
AppCompatResources.getDrawable(itemView.context, R.drawable.bg_item_rounded_ripple)
|
||||
val surfaceColor =
|
||||
@ -503,17 +505,12 @@ class ProductAdapter(private val callbacks: Callbacks, private val columns: Int)
|
||||
}
|
||||
|
||||
val radius = image.context.resources.getDimension(R.dimen.shape_medium_corner)
|
||||
|
||||
val shapeAppearanceModel = image.shapeAppearanceModel.toBuilder()
|
||||
.setAllCornerSizes(radius)
|
||||
.build()
|
||||
image.shapeAppearanceModel = shapeAppearanceModel
|
||||
image.setBackgroundColor(surfaceColor)
|
||||
itemView.addView(
|
||||
image,
|
||||
FrameLayout.LayoutParams.MATCH_PARENT,
|
||||
FrameLayout.LayoutParams.WRAP_CONTENT
|
||||
)
|
||||
itemView.addView(image)
|
||||
itemView.layoutParams = RecyclerView.LayoutParams(
|
||||
RecyclerView.LayoutParams.MATCH_PARENT,
|
||||
RecyclerView.LayoutParams.WRAP_CONTENT
|
||||
@ -528,13 +525,13 @@ class ProductAdapter(private val callbacks: Callbacks, private val columns: Int)
|
||||
private class ReleaseViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) {
|
||||
val dateFormat = DateFormat.getDateFormat(itemView.context)!!
|
||||
|
||||
val version = itemView.findViewById<TextView>(R.id.version)!!
|
||||
val status = itemView.findViewById<TextView>(R.id.status)!!
|
||||
val source = itemView.findViewById<TextView>(R.id.source)!!
|
||||
val added = itemView.findViewById<TextView>(R.id.added)!!
|
||||
val size = itemView.findViewById<TextView>(R.id.size)!!
|
||||
val signature = itemView.findViewById<TextView>(R.id.signature)!!
|
||||
val compatibility = itemView.findViewById<TextView>(R.id.compatibility)!!
|
||||
val version = itemView.findViewById<MaterialTextView>(R.id.version)!!
|
||||
val status = itemView.findViewById<MaterialTextView>(R.id.status)!!
|
||||
val source = itemView.findViewById<MaterialTextView>(R.id.source)!!
|
||||
val added = itemView.findViewById<MaterialTextView>(R.id.added)!!
|
||||
val size = itemView.findViewById<MaterialTextView>(R.id.size)!!
|
||||
val signature = itemView.findViewById<MaterialTextView>(R.id.signature)!!
|
||||
val compatibility = itemView.findViewById<MaterialTextView>(R.id.compatibility)!!
|
||||
|
||||
val statefulViews: Sequence<View>
|
||||
get() = sequenceOf(
|
||||
@ -565,15 +562,15 @@ class ProductAdapter(private val callbacks: Callbacks, private val columns: Int)
|
||||
}
|
||||
|
||||
private class EmptyViewHolder(context: Context) :
|
||||
RecyclerView.ViewHolder(LinearLayout(context)) {
|
||||
val packageName: TextView
|
||||
RecyclerView.ViewHolder(LinearLayoutCompat(context)) {
|
||||
val packageName: MaterialTextView
|
||||
|
||||
init {
|
||||
itemView as LinearLayout
|
||||
itemView.orientation = LinearLayout.VERTICAL
|
||||
itemView as LinearLayoutCompat
|
||||
itemView.orientation = LinearLayoutCompat.VERTICAL
|
||||
itemView.gravity = Gravity.CENTER
|
||||
itemView.resources.sizeScaled(20).let { itemView.setPadding(it, it, it, it) }
|
||||
val title = TextView(itemView.context)
|
||||
val title = MaterialTextView(itemView.context)
|
||||
title.gravity = Gravity.CENTER
|
||||
title.typeface = TypefaceExtra.light
|
||||
title.setTextColor(context.getColorFromAttr(R.attr.colorPrimary))
|
||||
@ -581,17 +578,17 @@ class ProductAdapter(private val callbacks: Callbacks, private val columns: Int)
|
||||
title.setText(R.string.application_not_found)
|
||||
itemView.addView(
|
||||
title,
|
||||
LinearLayout.LayoutParams.MATCH_PARENT,
|
||||
LinearLayout.LayoutParams.WRAP_CONTENT
|
||||
LinearLayoutCompat.LayoutParams.MATCH_PARENT,
|
||||
LinearLayoutCompat.LayoutParams.WRAP_CONTENT
|
||||
)
|
||||
val packageName = TextView(itemView.context)
|
||||
val packageName = MaterialTextView(itemView.context)
|
||||
packageName.gravity = Gravity.CENTER
|
||||
packageName.setTextColor(context.getColorFromAttr(R.attr.colorPrimary))
|
||||
packageName.setTextSizeScaled(18)
|
||||
itemView.addView(
|
||||
packageName,
|
||||
LinearLayout.LayoutParams.MATCH_PARENT,
|
||||
LinearLayout.LayoutParams.WRAP_CONTENT
|
||||
LinearLayoutCompat.LayoutParams.MATCH_PARENT,
|
||||
LinearLayoutCompat.LayoutParams.WRAP_CONTENT
|
||||
)
|
||||
itemView.layoutParams = RecyclerView.LayoutParams(
|
||||
RecyclerView.LayoutParams.MATCH_PARENT,
|
||||
@ -1103,12 +1100,12 @@ class ProductAdapter(private val callbacks: Callbacks, private val columns: Int)
|
||||
itemView.setOnClickListener {
|
||||
val linkItem = items[adapterPosition] as Item.LinkItem
|
||||
if (linkItem.uri?.let { callbacks.onUriClick(it, false) } != true) {
|
||||
linkItem.displayLink?.let { copyLinkToClipboard(itemView.context, it) }
|
||||
linkItem.displayLink?.let { copyLinkToClipboard(itemView, it) }
|
||||
}
|
||||
}
|
||||
itemView.setOnLongClickListener {
|
||||
val linkItem = items[adapterPosition] as Item.LinkItem
|
||||
linkItem.displayLink?.let { copyLinkToClipboard(itemView.context, it) }
|
||||
linkItem.displayLink?.let { copyLinkToClipboard(itemView, it) }
|
||||
true
|
||||
}
|
||||
}
|
||||
@ -1262,7 +1259,7 @@ class ProductAdapter(private val callbacks: Callbacks, private val columns: Int)
|
||||
context.startActivity(Intent(Intent.ACTION_VIEW, product?.source?.toUri()))
|
||||
}
|
||||
holder.dev.setOnLongClickListener {
|
||||
product?.source?.let { copyLinkToClipboard(context, it) }
|
||||
product?.source?.let { copyLinkToClipboard(holder.dev, it) }
|
||||
true
|
||||
}
|
||||
}
|
||||
@ -1552,15 +1549,11 @@ class ProductAdapter(private val callbacks: Callbacks, private val columns: Int)
|
||||
return builder
|
||||
}
|
||||
|
||||
private fun copyLinkToClipboard(context: Context, link: String) {
|
||||
private fun copyLinkToClipboard(view: View, link: String) {
|
||||
val clipboardManager =
|
||||
context.getSystemService(Context.CLIPBOARD_SERVICE) as ClipboardManager
|
||||
view.context.getSystemService(Context.CLIPBOARD_SERVICE) as ClipboardManager
|
||||
clipboardManager.setPrimaryClip(ClipData.newPlainText(null, link))
|
||||
Toast.makeText(
|
||||
context,
|
||||
context.getString(R.string.link_copied_to_clipboard),
|
||||
Toast.LENGTH_SHORT
|
||||
).show()
|
||||
Snackbar.make(view, R.string.link_copied_to_clipboard, Snackbar.LENGTH_SHORT).show()
|
||||
}
|
||||
|
||||
private class LinkSpan(private val url: String, productAdapter: ProductAdapter) :
|
||||
|
@ -9,13 +9,13 @@ import android.os.Bundle
|
||||
import android.provider.Settings
|
||||
import android.view.MenuItem
|
||||
import android.view.View
|
||||
import android.widget.FrameLayout
|
||||
import androidx.appcompat.app.AlertDialog
|
||||
import androidx.fragment.app.DialogFragment
|
||||
import androidx.lifecycle.lifecycleScope
|
||||
import androidx.recyclerview.widget.GridLayoutManager
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import com.google.android.material.circularreveal.CircularRevealFrameLayout
|
||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder
|
||||
import com.looker.droidify.R
|
||||
import com.looker.droidify.content.ProductPreferences
|
||||
@ -108,7 +108,7 @@ class ProductFragment() : ScreenFragment(), ProductAdapter.Callbacks {
|
||||
}
|
||||
}
|
||||
|
||||
val content = view.findViewById<FrameLayout>(R.id.fragment_content)!!
|
||||
val content = view.findViewById<CircularRevealFrameLayout>(R.id.fragment_content)!!
|
||||
content.addView(RecyclerView(content.context).apply {
|
||||
id = android.R.id.list
|
||||
val columns = (resources.configuration.screenWidthDp / 120).coerceIn(3, 5)
|
||||
@ -129,7 +129,7 @@ class ProductFragment() : ScreenFragment(), ProductAdapter.Callbacks {
|
||||
?.let(adapter::restoreState)
|
||||
layoutManagerState = savedInstanceState?.getParcelable(STATE_LAYOUT_MANAGER)
|
||||
recyclerView = this
|
||||
}, FrameLayout.LayoutParams.MATCH_PARENT, FrameLayout.LayoutParams.MATCH_PARENT)
|
||||
})
|
||||
|
||||
var first = true
|
||||
productDisposable = Observable.just(Unit)
|
||||
|
@ -7,13 +7,13 @@ import android.view.Gravity
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.view.animation.AnimationUtils
|
||||
import android.widget.FrameLayout
|
||||
import android.widget.ProgressBar
|
||||
import android.widget.TextView
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import coil.load
|
||||
import coil.transform.RoundedCornersTransformation
|
||||
import com.google.android.material.circularreveal.CircularRevealFrameLayout
|
||||
import com.google.android.material.imageview.ShapeableImageView
|
||||
import com.google.android.material.progressindicator.CircularProgressIndicator
|
||||
import com.google.android.material.textview.MaterialTextView
|
||||
import com.looker.droidify.R
|
||||
import com.looker.droidify.content.Preferences
|
||||
import com.looker.droidify.database.Database
|
||||
@ -32,9 +32,9 @@ class ProductsAdapter(private val onClick: (ProductItem) -> Unit) :
|
||||
enum class ViewType { PRODUCT, LOADING, EMPTY }
|
||||
|
||||
private class ProductViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) {
|
||||
val name = itemView.findViewById<TextView>(R.id.name)!!
|
||||
val status = itemView.findViewById<TextView>(R.id.status)!!
|
||||
val summary = itemView.findViewById<TextView>(R.id.summary)!!
|
||||
val name = itemView.findViewById<MaterialTextView>(R.id.name)!!
|
||||
val status = itemView.findViewById<MaterialTextView>(R.id.status)!!
|
||||
val summary = itemView.findViewById<MaterialTextView>(R.id.summary)!!
|
||||
val icon = itemView.findViewById<ShapeableImageView>(R.id.icon)!!
|
||||
|
||||
val progressIcon: Drawable
|
||||
@ -48,14 +48,11 @@ class ProductsAdapter(private val onClick: (ProductItem) -> Unit) :
|
||||
}
|
||||
|
||||
private class LoadingViewHolder(context: Context) :
|
||||
RecyclerView.ViewHolder(FrameLayout(context)) {
|
||||
RecyclerView.ViewHolder(CircularRevealFrameLayout(context)) {
|
||||
init {
|
||||
itemView as FrameLayout
|
||||
val progressBar = ProgressBar(itemView.context)
|
||||
itemView.addView(progressBar, FrameLayout.LayoutParams(
|
||||
FrameLayout.LayoutParams.WRAP_CONTENT,
|
||||
FrameLayout.LayoutParams.WRAP_CONTENT
|
||||
).apply { gravity = Gravity.CENTER })
|
||||
itemView as CircularRevealFrameLayout
|
||||
val progressBar = CircularProgressIndicator(itemView.context)
|
||||
itemView.addView(progressBar)
|
||||
itemView.layoutParams = RecyclerView.LayoutParams(
|
||||
RecyclerView.LayoutParams.MATCH_PARENT,
|
||||
RecyclerView.LayoutParams.MATCH_PARENT
|
||||
@ -63,12 +60,13 @@ class ProductsAdapter(private val onClick: (ProductItem) -> Unit) :
|
||||
}
|
||||
}
|
||||
|
||||
private class EmptyViewHolder(context: Context) : RecyclerView.ViewHolder(TextView(context)) {
|
||||
val text: TextView
|
||||
get() = itemView as TextView
|
||||
private class EmptyViewHolder(context: Context) :
|
||||
RecyclerView.ViewHolder(MaterialTextView(context)) {
|
||||
val text: MaterialTextView
|
||||
get() = itemView as MaterialTextView
|
||||
|
||||
init {
|
||||
itemView as TextView
|
||||
itemView as MaterialTextView
|
||||
itemView.gravity = Gravity.CENTER
|
||||
itemView.resources.sizeScaled(20).let { itemView.setPadding(it, it, it, it) }
|
||||
itemView.typeface = TypefaceExtra.light
|
||||
|
@ -2,9 +2,9 @@ package com.looker.droidify.screen
|
||||
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.widget.TextView
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import com.google.android.material.switchmaterial.SwitchMaterial
|
||||
import com.google.android.material.textview.MaterialTextView
|
||||
import com.looker.droidify.R
|
||||
import com.looker.droidify.database.Database
|
||||
import com.looker.droidify.entity.Repository
|
||||
@ -19,7 +19,7 @@ class RepositoriesAdapter(
|
||||
enum class ViewType { REPOSITORY }
|
||||
|
||||
private class ViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) {
|
||||
val name = itemView.findViewById<TextView>(R.id.name)!!
|
||||
val name = itemView.findViewById<MaterialTextView>(R.id.name)!!
|
||||
val enabled = itemView.findViewById<SwitchMaterial>(R.id.enabled)!!
|
||||
|
||||
var listenSwitch = true
|
||||
|
@ -6,9 +6,9 @@ import android.view.LayoutInflater
|
||||
import android.view.MenuItem
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.widget.FrameLayout
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import com.google.android.material.circularreveal.CircularRevealFrameLayout
|
||||
import com.looker.droidify.R
|
||||
import com.looker.droidify.database.CursorOwner
|
||||
import com.looker.droidify.service.Connection
|
||||
@ -26,7 +26,7 @@ class RepositoriesFragment : ScreenFragment(), CursorOwner.Callback {
|
||||
savedInstanceState: Bundle?
|
||||
): View {
|
||||
val view = inflater.inflate(R.layout.fragment, container, false).apply {
|
||||
val content = findViewById<FrameLayout>(R.id.fragment_content)!!
|
||||
val content = findViewById<CircularRevealFrameLayout>(R.id.fragment_content)!!
|
||||
content.addView(RecyclerView(content.context).apply {
|
||||
id = android.R.id.list
|
||||
layoutManager = LinearLayoutManager(context)
|
||||
@ -38,7 +38,7 @@ class RepositoriesFragment : ScreenFragment(), CursorOwner.Callback {
|
||||
syncConnection.binder?.setEnabled(repository, isEnabled) == true
|
||||
})
|
||||
recyclerView = this
|
||||
}, FrameLayout.LayoutParams.MATCH_PARENT, FrameLayout.LayoutParams.MATCH_PARENT)
|
||||
})
|
||||
}
|
||||
this.toolbar = view.findViewById(R.id.toolbar)
|
||||
return view
|
||||
|
@ -8,10 +8,10 @@ import android.text.style.TypefaceSpan
|
||||
import android.view.MenuItem
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.widget.FrameLayout
|
||||
import android.widget.LinearLayout
|
||||
import android.widget.TextView
|
||||
import androidx.appcompat.widget.LinearLayoutCompat
|
||||
import androidx.core.widget.NestedScrollView
|
||||
import com.google.android.material.circularreveal.CircularRevealFrameLayout
|
||||
import com.google.android.material.textview.MaterialTextView
|
||||
import com.looker.droidify.R
|
||||
import com.looker.droidify.database.Database
|
||||
import com.looker.droidify.service.Connection
|
||||
@ -39,7 +39,7 @@ class RepositoryFragment() : ScreenFragment() {
|
||||
private val repositoryId: Long
|
||||
get() = requireArguments().getLong(EXTRA_REPOSITORY_ID)
|
||||
|
||||
private var layout: LinearLayout? = null
|
||||
private var layout: LinearLayoutCompat? = null
|
||||
|
||||
private val syncConnection = Connection(SyncService::class.java)
|
||||
private var repositoryDisposable: Disposable? = null
|
||||
@ -76,17 +76,13 @@ class RepositoryFragment() : ScreenFragment() {
|
||||
}
|
||||
}
|
||||
|
||||
val content = view.findViewById<FrameLayout>(R.id.fragment_content)!!
|
||||
val content = view.findViewById<CircularRevealFrameLayout>(R.id.fragment_content)!!
|
||||
val scroll = NestedScrollView(content.context)
|
||||
scroll.id = android.R.id.list
|
||||
scroll.isFillViewport = true
|
||||
content.addView(
|
||||
scroll,
|
||||
FrameLayout.LayoutParams.MATCH_PARENT,
|
||||
FrameLayout.LayoutParams.MATCH_PARENT
|
||||
)
|
||||
val layout = LinearLayout(scroll.context)
|
||||
layout.orientation = LinearLayout.VERTICAL
|
||||
content.addView(scroll)
|
||||
val layout = LinearLayoutCompat(scroll.context)
|
||||
layout.orientation = LinearLayoutCompat.VERTICAL
|
||||
resources.sizeScaled(8).let { layout.setPadding(0, it, 0, it) }
|
||||
this.layout = layout
|
||||
scroll.addView(
|
||||
@ -164,12 +160,12 @@ class RepositoryFragment() : ScreenFragment() {
|
||||
}
|
||||
}
|
||||
|
||||
private fun LinearLayout.addTitleText(titleResId: Int, text: CharSequence) {
|
||||
private fun LinearLayoutCompat.addTitleText(titleResId: Int, text: CharSequence) {
|
||||
if (text.isNotEmpty()) {
|
||||
val layout = inflate(R.layout.title_text_item)
|
||||
val titleView = layout.findViewById<TextView>(R.id.title)!!
|
||||
val titleView = layout.findViewById<MaterialTextView>(R.id.title)!!
|
||||
titleView.setText(titleResId)
|
||||
val textView = layout.findViewById<TextView>(R.id.text)!!
|
||||
val textView = layout.findViewById<MaterialTextView>(R.id.text)!!
|
||||
textView.text = text
|
||||
addView(layout)
|
||||
}
|
||||
|
@ -5,11 +5,11 @@ import android.os.Bundle
|
||||
import android.os.Parcel
|
||||
import android.view.ViewGroup
|
||||
import android.view.inputmethod.InputMethodManager
|
||||
import android.widget.FrameLayout
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import androidx.appcompat.widget.Toolbar
|
||||
import androidx.fragment.app.Fragment
|
||||
import androidx.lifecycle.lifecycleScope
|
||||
import com.google.android.material.circularreveal.CircularRevealFrameLayout
|
||||
import com.looker.droidify.R
|
||||
import com.looker.droidify.content.Preferences
|
||||
import com.looker.droidify.database.CursorOwner
|
||||
@ -74,7 +74,7 @@ abstract class ScreenActivity : AppCompatActivity() {
|
||||
super.onCreate(savedInstanceState)
|
||||
|
||||
addContentView(
|
||||
FrameLayout(this).apply { id = R.id.main_content },
|
||||
CircularRevealFrameLayout(this).apply { id = R.id.main_content },
|
||||
ViewGroup.LayoutParams(
|
||||
ViewGroup.LayoutParams.MATCH_PARENT,
|
||||
ViewGroup.LayoutParams.MATCH_PARENT
|
||||
|
@ -9,14 +9,17 @@ import android.text.InputType
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.view.WindowManager
|
||||
import android.widget.*
|
||||
import androidx.appcompat.app.AlertDialog
|
||||
import androidx.appcompat.widget.LinearLayoutCompat
|
||||
import androidx.core.net.toUri
|
||||
import androidx.core.widget.NestedScrollView
|
||||
import androidx.fragment.app.DialogFragment
|
||||
import androidx.fragment.app.Fragment
|
||||
import com.google.android.material.circularreveal.CircularRevealFrameLayout
|
||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder
|
||||
import com.google.android.material.switchmaterial.SwitchMaterial
|
||||
import com.google.android.material.textfield.TextInputEditText
|
||||
import com.google.android.material.textview.MaterialTextView
|
||||
import com.looker.droidify.BuildConfig
|
||||
import com.looker.droidify.R
|
||||
import com.looker.droidify.content.Preferences
|
||||
@ -34,7 +37,7 @@ class SettingsFragment : ScreenFragment() {
|
||||
screenActivity.onToolbarCreated(toolbar)
|
||||
toolbar.setTitle(R.string.settings)
|
||||
|
||||
val content = view.findViewById<FrameLayout>(R.id.fragment_content)!!
|
||||
val content = view.findViewById<CircularRevealFrameLayout>(R.id.fragment_content)!!
|
||||
val scroll = NestedScrollView(content.context)
|
||||
scroll.id = R.id.preferences_list
|
||||
scroll.isFillViewport = true
|
||||
@ -43,14 +46,14 @@ class SettingsFragment : ScreenFragment() {
|
||||
ViewGroup.LayoutParams.MATCH_PARENT,
|
||||
ViewGroup.LayoutParams.MATCH_PARENT
|
||||
)
|
||||
val scrollLayout = FrameLayout(content.context)
|
||||
val scrollLayout = CircularRevealFrameLayout(content.context)
|
||||
scroll.addView(
|
||||
scrollLayout,
|
||||
ViewGroup.LayoutParams.MATCH_PARENT,
|
||||
ViewGroup.LayoutParams.WRAP_CONTENT
|
||||
)
|
||||
val preferences = LinearLayout(scrollLayout.context)
|
||||
preferences.orientation = LinearLayout.VERTICAL
|
||||
val preferences = LinearLayoutCompat(scrollLayout.context)
|
||||
preferences.orientation = LinearLayoutCompat.VERTICAL
|
||||
scrollLayout.addView(
|
||||
preferences,
|
||||
ViewGroup.LayoutParams.MATCH_PARENT,
|
||||
@ -134,9 +137,9 @@ class SettingsFragment : ScreenFragment() {
|
||||
updatePreference(null)
|
||||
}
|
||||
|
||||
private fun LinearLayout.addText(title: String, summary: String) {
|
||||
val text = TextView(context)
|
||||
val subText = TextView(context)
|
||||
private fun LinearLayoutCompat.addText(title: String, summary: String) {
|
||||
val text = MaterialTextView(context)
|
||||
val subText = MaterialTextView(context)
|
||||
text.text = title
|
||||
subText.text = summary
|
||||
text.textSize = 16F
|
||||
@ -145,13 +148,13 @@ class SettingsFragment : ScreenFragment() {
|
||||
resources.sizeScaled(16).let { subText.setPadding(it, 5, 5, 25) }
|
||||
addView(
|
||||
text,
|
||||
LinearLayout.LayoutParams.MATCH_PARENT,
|
||||
LinearLayout.LayoutParams.WRAP_CONTENT
|
||||
LinearLayoutCompat.LayoutParams.MATCH_PARENT,
|
||||
LinearLayoutCompat.LayoutParams.WRAP_CONTENT
|
||||
)
|
||||
addView(
|
||||
subText,
|
||||
LinearLayout.LayoutParams.MATCH_PARENT,
|
||||
LinearLayout.LayoutParams.WRAP_CONTENT
|
||||
LinearLayoutCompat.LayoutParams.MATCH_PARENT,
|
||||
LinearLayoutCompat.LayoutParams.WRAP_CONTENT
|
||||
)
|
||||
}
|
||||
|
||||
@ -187,8 +190,11 @@ class SettingsFragment : ScreenFragment() {
|
||||
}
|
||||
}
|
||||
|
||||
private fun LinearLayout.addCategory(title: String, callback: LinearLayout.() -> Unit) {
|
||||
val text = TextView(context)
|
||||
private fun LinearLayoutCompat.addCategory(
|
||||
title: String,
|
||||
callback: LinearLayoutCompat.() -> Unit
|
||||
) {
|
||||
val text = MaterialTextView(context)
|
||||
text.typeface = TypefaceExtra.medium
|
||||
text.setTextSizeScaled(14)
|
||||
text.setTextColor(text.context.getColorFromAttr(android.R.attr.colorAccent))
|
||||
@ -196,13 +202,13 @@ class SettingsFragment : ScreenFragment() {
|
||||
resources.sizeScaled(16).let { text.setPadding(it, it, it, 0) }
|
||||
addView(
|
||||
text,
|
||||
LinearLayout.LayoutParams.MATCH_PARENT,
|
||||
LinearLayout.LayoutParams.WRAP_CONTENT
|
||||
LinearLayoutCompat.LayoutParams.MATCH_PARENT,
|
||||
LinearLayoutCompat.LayoutParams.WRAP_CONTENT
|
||||
)
|
||||
callback()
|
||||
}
|
||||
|
||||
private fun <T> LinearLayout.addPreference(
|
||||
private fun <T> LinearLayoutCompat.addPreference(
|
||||
key: Preferences.Key<T>, title: String,
|
||||
summaryProvider: () -> String, dialogProvider: ((Context) -> AlertDialog)?
|
||||
): Preference<T> {
|
||||
@ -212,7 +218,7 @@ class SettingsFragment : ScreenFragment() {
|
||||
return preference
|
||||
}
|
||||
|
||||
private fun LinearLayout.addSwitch(
|
||||
private fun LinearLayoutCompat.addSwitch(
|
||||
key: Preferences.Key<Boolean>,
|
||||
title: String,
|
||||
summary: String
|
||||
@ -223,22 +229,21 @@ class SettingsFragment : ScreenFragment() {
|
||||
preference.setCallback { preference.check.isChecked = Preferences[key] }
|
||||
}
|
||||
|
||||
private fun <T> LinearLayout.addEdit(
|
||||
private fun <T> LinearLayoutCompat.addEdit(
|
||||
key: Preferences.Key<T>, title: String, valueToString: (T) -> String,
|
||||
stringToValue: (String) -> T?, configureEdit: (EditText) -> Unit
|
||||
stringToValue: (String) -> T?, configureEdit: (TextInputEditText) -> Unit
|
||||
) {
|
||||
addPreference(key, title, { valueToString(Preferences[key]) }) { it ->
|
||||
val scroll = NestedScrollView(it)
|
||||
scroll.resources.sizeScaled(20).let { scroll.setPadding(it, 0, it, 0) }
|
||||
val edit = EditText(it)
|
||||
val edit = TextInputEditText(it)
|
||||
configureEdit(edit)
|
||||
edit.id = android.R.id.edit
|
||||
edit.setTextSizeScaled(16)
|
||||
edit.resources.sizeScaled(16)
|
||||
.let { edit.setPadding(edit.paddingLeft, it, edit.paddingRight, it) }
|
||||
edit.setText(valueToString(Preferences[key]))
|
||||
edit.hint = edit.text.toString()
|
||||
edit.setSelection(edit.text.length)
|
||||
edit.text?.let { editable -> edit.setSelection(editable.length) }
|
||||
edit.requestFocus()
|
||||
scroll.addView(
|
||||
edit,
|
||||
@ -260,11 +265,11 @@ class SettingsFragment : ScreenFragment() {
|
||||
}
|
||||
}
|
||||
|
||||
private fun LinearLayout.addEditString(key: Preferences.Key<String>, title: String) {
|
||||
private fun LinearLayoutCompat.addEditString(key: Preferences.Key<String>, title: String) {
|
||||
addEdit(key, title, { it }, { it }, { })
|
||||
}
|
||||
|
||||
private fun LinearLayout.addEditInt(
|
||||
private fun LinearLayoutCompat.addEditInt(
|
||||
key: Preferences.Key<Int>,
|
||||
title: String,
|
||||
range: IntRange?
|
||||
@ -280,7 +285,7 @@ class SettingsFragment : ScreenFragment() {
|
||||
}
|
||||
}
|
||||
|
||||
private fun <T : Preferences.Enumeration<T>> LinearLayout.addEnumeration(
|
||||
private fun <T : Preferences.Enumeration<T>> LinearLayoutCompat.addEnumeration(
|
||||
key: Preferences.Key<T>,
|
||||
title: String,
|
||||
valueToString: (T) -> String
|
||||
@ -310,8 +315,8 @@ class SettingsFragment : ScreenFragment() {
|
||||
private val dialogProvider: ((Context) -> AlertDialog)?
|
||||
) {
|
||||
val view = parent.inflate(R.layout.preference_item)
|
||||
val title = view.findViewById<TextView>(R.id.title)!!
|
||||
val summary = view.findViewById<TextView>(R.id.summary)!!
|
||||
val title = view.findViewById<MaterialTextView>(R.id.title)!!
|
||||
val summary = view.findViewById<MaterialTextView>(R.id.summary)!!
|
||||
val check = view.findViewById<SwitchMaterial>(R.id.check)!!
|
||||
|
||||
private var callback: (() -> Unit)? = null
|
||||
|
@ -6,16 +6,17 @@ import android.os.Bundle
|
||||
import android.view.*
|
||||
import android.view.animation.AccelerateInterpolator
|
||||
import android.view.animation.DecelerateInterpolator
|
||||
import android.widget.*
|
||||
import androidx.appcompat.widget.SearchView
|
||||
import androidx.fragment.app.Fragment
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import androidx.viewpager2.adapter.FragmentStateAdapter
|
||||
import androidx.viewpager2.widget.ViewPager2
|
||||
import com.google.android.material.circularreveal.CircularRevealFrameLayout
|
||||
import com.google.android.material.imageview.ShapeableImageView
|
||||
import com.google.android.material.tabs.TabLayout
|
||||
import com.google.android.material.tabs.TabLayoutMediator
|
||||
import com.google.android.material.textview.MaterialTextView
|
||||
import com.looker.droidify.R
|
||||
import com.looker.droidify.content.Preferences
|
||||
import com.looker.droidify.database.Database
|
||||
@ -48,7 +49,7 @@ class TabsFragment : ScreenFragment() {
|
||||
val tabs = view.findViewById<TabLayout>(R.id.tabs)!!
|
||||
val sectionLayout = view.findViewById<ViewGroup>(R.id.section_layout)!!
|
||||
val sectionChange = view.findViewById<View>(R.id.section_change)!!
|
||||
val sectionName = view.findViewById<TextView>(R.id.section_name)!!
|
||||
val sectionName = view.findViewById<MaterialTextView>(R.id.section_name)!!
|
||||
val sectionIcon = view.findViewById<ShapeableImageView>(R.id.section_icon)!!
|
||||
}
|
||||
|
||||
@ -176,7 +177,7 @@ class TabsFragment : ScreenFragment() {
|
||||
searchQuery = savedInstanceState?.getString(STATE_SEARCH_QUERY).orEmpty()
|
||||
productFragments.forEach { it.setSearchQuery(searchQuery) }
|
||||
|
||||
val toolbarExtra = view.findViewById<FrameLayout>(R.id.toolbar_extra)!!
|
||||
val toolbarExtra = view.findViewById<CircularRevealFrameLayout>(R.id.toolbar_extra)!!
|
||||
toolbarExtra.addView(toolbarExtra.inflate(R.layout.tabs_toolbar))
|
||||
val layout = Layout(view)
|
||||
this.layout = layout
|
||||
@ -197,7 +198,7 @@ class TabsFragment : ScreenFragment() {
|
||||
}
|
||||
}
|
||||
|
||||
val content = view.findViewById<FrameLayout>(R.id.fragment_content)!!
|
||||
val content = view.findViewById<CircularRevealFrameLayout>(R.id.fragment_content)!!
|
||||
|
||||
viewPager = ViewPager2(content.context).apply {
|
||||
id = R.id.fragment_pager
|
||||
@ -208,11 +209,7 @@ class TabsFragment : ScreenFragment() {
|
||||
.Source.values()[position]
|
||||
)
|
||||
}
|
||||
content.addView(
|
||||
this,
|
||||
FrameLayout.LayoutParams.MATCH_PARENT,
|
||||
FrameLayout.LayoutParams.MATCH_PARENT
|
||||
)
|
||||
content.addView(this)
|
||||
registerOnPageChangeCallback(pageChangeCallback)
|
||||
offscreenPageLimit = 1
|
||||
}
|
||||
@ -263,7 +260,7 @@ class TabsFragment : ScreenFragment() {
|
||||
background = context.getDrawableCompat(R.drawable.background_border)
|
||||
backgroundTintList = context.getColorFromAttr(R.attr.colorSurface)
|
||||
elevation = resources.sizeScaled(4).toFloat()
|
||||
content.addView(this, FrameLayout.LayoutParams.MATCH_PARENT, 0)
|
||||
content.addView(this)
|
||||
val margins = resources.sizeScaled(8)
|
||||
(layoutParams as ViewGroup.MarginLayoutParams).setMargins(margins, margins, margins, 0)
|
||||
visibility = View.GONE
|
||||
@ -516,12 +513,12 @@ class TabsFragment : ScreenFragment() {
|
||||
enum class ViewType { SECTION }
|
||||
|
||||
private class SectionViewHolder(context: Context) :
|
||||
RecyclerView.ViewHolder(TextView(context)) {
|
||||
val title: TextView
|
||||
get() = itemView as TextView
|
||||
RecyclerView.ViewHolder(MaterialTextView(context)) {
|
||||
val title: MaterialTextView
|
||||
get() = itemView as MaterialTextView
|
||||
|
||||
init {
|
||||
itemView as TextView
|
||||
itemView as MaterialTextView
|
||||
itemView.gravity = Gravity.CENTER_VERTICAL
|
||||
itemView.resources.sizeScaled(16).let { itemView.setPadding(it, 0, it, 0) }
|
||||
itemView.setTextColor(context.getColorFromAttr(android.R.attr.textColor))
|
||||
|
@ -13,10 +13,10 @@ import android.util.Xml
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.widget.TextView
|
||||
import androidx.core.content.ContextCompat
|
||||
import coil.util.CoilUtils
|
||||
import com.google.android.material.imageview.ShapeableImageView
|
||||
import com.google.android.material.textview.MaterialTextView
|
||||
import com.looker.droidify.utility.extension.android.Android
|
||||
import org.xmlpull.v1.XmlPullParser
|
||||
import kotlin.math.roundToInt
|
||||
@ -88,7 +88,7 @@ fun Resources.sizeScaled(size: Int): Int {
|
||||
return (size * displayMetrics.density).roundToInt()
|
||||
}
|
||||
|
||||
fun TextView.setTextSizeScaled(size: Int) {
|
||||
fun MaterialTextView.setTextSizeScaled(size: Int) {
|
||||
val realSize = (size * resources.displayMetrics.scaledDensity).roundToInt()
|
||||
setTextSize(TypedValue.COMPLEX_UNIT_PX, realSize.toFloat())
|
||||
}
|
||||
|
@ -1,67 +0,0 @@
|
||||
package com.looker.droidify.widget
|
||||
|
||||
import android.text.Selection
|
||||
import android.text.Spannable
|
||||
import android.text.method.MovementMethod
|
||||
import android.text.style.ClickableSpan
|
||||
import android.view.KeyEvent
|
||||
import android.view.MotionEvent
|
||||
import android.widget.TextView
|
||||
|
||||
object ClickableMovementMethod : MovementMethod {
|
||||
override fun initialize(widget: TextView, text: Spannable) {
|
||||
Selection.removeSelection(text)
|
||||
}
|
||||
|
||||
override fun onTouchEvent(widget: TextView, text: Spannable, event: MotionEvent): Boolean {
|
||||
val action = event.action
|
||||
val down = action == MotionEvent.ACTION_DOWN
|
||||
val up = action == MotionEvent.ACTION_UP
|
||||
return (down || up) && run {
|
||||
val x = event.x.toInt() - widget.totalPaddingLeft + widget.scrollX
|
||||
val y = event.y.toInt() - widget.totalPaddingTop + widget.scrollY
|
||||
val layout = widget.layout
|
||||
val line = layout.getLineForVertical(y)
|
||||
val offset = layout.getOffsetForHorizontal(line, x.toFloat())
|
||||
val span = text.getSpans(offset, offset, ClickableSpan::class.java)?.firstOrNull()
|
||||
if (span != null) {
|
||||
if (down) {
|
||||
Selection.setSelection(text, text.getSpanStart(span), text.getSpanEnd(span))
|
||||
} else {
|
||||
span.onClick(widget)
|
||||
}
|
||||
true
|
||||
} else {
|
||||
Selection.removeSelection(text)
|
||||
false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun onKeyDown(
|
||||
widget: TextView,
|
||||
text: Spannable,
|
||||
keyCode: Int,
|
||||
event: KeyEvent
|
||||
): Boolean = false
|
||||
|
||||
override fun onKeyUp(
|
||||
widget: TextView,
|
||||
text: Spannable,
|
||||
keyCode: Int,
|
||||
event: KeyEvent
|
||||
): Boolean = false
|
||||
|
||||
override fun onKeyOther(view: TextView, text: Spannable, event: KeyEvent): Boolean = false
|
||||
override fun onTakeFocus(widget: TextView, text: Spannable, direction: Int) = Unit
|
||||
override fun onTrackballEvent(widget: TextView, text: Spannable, event: MotionEvent): Boolean =
|
||||
false
|
||||
|
||||
override fun onGenericMotionEvent(
|
||||
widget: TextView,
|
||||
text: Spannable,
|
||||
event: MotionEvent
|
||||
): Boolean = false
|
||||
|
||||
override fun canSelectArbitrarily(): Boolean = false
|
||||
}
|
Reference in New Issue
Block a user