Remove Unused Dependency

Reduce usage of appcompat
This commit is contained in:
LooKeR
2022-03-01 15:17:09 +05:30
parent e6d204eea4
commit 5dfd04e8dc
21 changed files with 112 additions and 113 deletions

View File

@ -22,9 +22,9 @@ import android.view.Gravity
import android.view.MotionEvent
import android.view.View
import android.view.ViewGroup
import android.widget.LinearLayout
import androidx.annotation.DrawableRes
import androidx.annotation.StringRes
import androidx.appcompat.widget.LinearLayoutCompat
import androidx.core.content.res.ResourcesCompat
import androidx.core.net.toUri
import androidx.core.text.HtmlCompat
@ -349,7 +349,7 @@ class AppDetailAdapter(private val callbacks: Callbacks) :
this.defaultIcon = Utils.getDefaultApplicationIcon(icon.context)
}
val targetBlock = itemView.findViewById<LinearLayoutCompat>(R.id.sdk_block)!!
val targetBlock = itemView.findViewById<LinearLayout>(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)!!
@ -507,12 +507,12 @@ class AppDetailAdapter(private val callbacks: Callbacks) :
}
private class EmptyViewHolder(context: Context) :
RecyclerView.ViewHolder(LinearLayoutCompat(context)) {
RecyclerView.ViewHolder(LinearLayout(context)) {
val packageName: MaterialTextView
init {
itemView as LinearLayoutCompat
itemView.orientation = LinearLayoutCompat.VERTICAL
itemView as LinearLayout
itemView.orientation = LinearLayout.VERTICAL
itemView.gravity = Gravity.CENTER
itemView.resources.sizeScaled(20).let { itemView.setPadding(it, it, it, it) }
val title = MaterialTextView(itemView.context)
@ -523,8 +523,8 @@ class AppDetailAdapter(private val callbacks: Callbacks) :
title.setText(R.string.application_not_found)
itemView.addView(
title,
LinearLayoutCompat.LayoutParams.MATCH_PARENT,
LinearLayoutCompat.LayoutParams.WRAP_CONTENT
LinearLayout.LayoutParams.MATCH_PARENT,
LinearLayout.LayoutParams.WRAP_CONTENT
)
val packageName = MaterialTextView(itemView.context)
packageName.gravity = Gravity.CENTER
@ -532,8 +532,8 @@ class AppDetailAdapter(private val callbacks: Callbacks) :
packageName.setTextSizeScaled(18)
itemView.addView(
packageName,
LinearLayoutCompat.LayoutParams.MATCH_PARENT,
LinearLayoutCompat.LayoutParams.WRAP_CONTENT
LinearLayout.LayoutParams.MATCH_PARENT,
LinearLayout.LayoutParams.WRAP_CONTENT
)
itemView.layoutParams = RecyclerView.LayoutParams(
RecyclerView.LayoutParams.MATCH_PARENT,

View File

@ -11,8 +11,8 @@ import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.view.WindowManager
import android.widget.LinearLayout
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
@ -119,7 +119,7 @@ abstract class PrefsNavFragmentX : Fragment() {
}
}
protected fun LinearLayoutCompat.addText(title: String, summary: String, url: String) {
protected fun LinearLayout.addText(title: String, summary: String, url: String) {
val text = MaterialTextView(context)
val subText = MaterialTextView(context)
text.text = title
@ -132,21 +132,21 @@ abstract class PrefsNavFragmentX : Fragment() {
}
addView(
text,
LinearLayoutCompat.LayoutParams.MATCH_PARENT,
LinearLayoutCompat.LayoutParams.WRAP_CONTENT
LinearLayout.LayoutParams.MATCH_PARENT,
LinearLayout.LayoutParams.WRAP_CONTENT
)
addView(
subText,
LinearLayoutCompat.LayoutParams.MATCH_PARENT,
LinearLayoutCompat.LayoutParams.WRAP_CONTENT
LinearLayout.LayoutParams.MATCH_PARENT,
LinearLayout.LayoutParams.WRAP_CONTENT
)
text.setOnClickListener { openURI(url.toUri()) }
subText.setOnClickListener { openURI(url.toUri()) }
}
protected inline fun LinearLayoutCompat.addCategory(
protected inline fun LinearLayout.addCategory(
title: String,
callback: LinearLayoutCompat.() -> Unit,
callback: LinearLayout.() -> Unit,
) {
val text = MaterialTextView(context)
text.typeface = TypefaceExtra.medium
@ -156,13 +156,13 @@ abstract class PrefsNavFragmentX : Fragment() {
resources.sizeScaled(16).let { text.setPadding(it, it, it, 0) }
addView(
text,
LinearLayoutCompat.LayoutParams.MATCH_PARENT,
LinearLayoutCompat.LayoutParams.WRAP_CONTENT
LinearLayout.LayoutParams.MATCH_PARENT,
LinearLayout.LayoutParams.WRAP_CONTENT
)
callback()
}
protected fun <T> LinearLayoutCompat.addPreference(
protected fun <T> LinearLayout.addPreference(
key: Preferences.Key<T>, title: String,
summaryProvider: () -> String, dialogProvider: ((Context) -> AlertDialog)?,
): Preference<T> {
@ -172,7 +172,7 @@ abstract class PrefsNavFragmentX : Fragment() {
return preference
}
protected fun LinearLayoutCompat.addSwitch(
protected fun LinearLayout.addSwitch(
key: Preferences.Key<Boolean>,
title: String,
summary: String,
@ -183,7 +183,7 @@ abstract class PrefsNavFragmentX : Fragment() {
preference.setCallback { preference.check.isChecked = Preferences[key] }
}
protected fun <T> LinearLayoutCompat.addEdit(
protected fun <T> LinearLayout.addEdit(
key: Preferences.Key<T>, title: String, valueToString: (T) -> String,
stringToValue: (String) -> T?, configureEdit: (TextInputEditText) -> Unit,
) {
@ -219,11 +219,11 @@ abstract class PrefsNavFragmentX : Fragment() {
}
}
protected fun LinearLayoutCompat.addEditString(key: Preferences.Key<String>, title: String) {
protected fun LinearLayout.addEditString(key: Preferences.Key<String>, title: String) {
addEdit(key, title, { it }, { it }, { })
}
protected fun LinearLayoutCompat.addEditInt(
protected fun LinearLayout.addEditInt(
key: Preferences.Key<Int>,
title: String,
range: IntRange?,
@ -239,7 +239,7 @@ abstract class PrefsNavFragmentX : Fragment() {
}
}
protected fun <T : Preferences.Enumeration<T>> LinearLayoutCompat.addEnumeration(
protected fun <T : Preferences.Enumeration<T>> LinearLayout.addEnumeration(
key: Preferences.Key<T>,
title: String,
valueToString: (T) -> String,
@ -260,7 +260,7 @@ abstract class PrefsNavFragmentX : Fragment() {
}
}
protected fun <T> LinearLayoutCompat.addList(
protected fun <T> LinearLayout.addList(
key: Preferences.Key<T>,
title: String,
values: List<T>,

View File

@ -1,7 +1,7 @@
package com.looker.droidify.ui.fragments
import android.view.ViewGroup
import androidx.appcompat.widget.LinearLayoutCompat
import android.widget.LinearLayout
import com.google.android.material.circularreveal.CircularRevealFrameLayout
import com.looker.droidify.BuildConfig
import com.looker.droidify.R
@ -10,8 +10,8 @@ import com.looker.droidify.content.Preferences
class PrefsOtherFragment : PrefsNavFragmentX() {
override fun setupPrefs(scrollLayout: CircularRevealFrameLayout) {
val preferences = LinearLayoutCompat(scrollLayout.context)
preferences.orientation = LinearLayoutCompat.VERTICAL
val preferences = LinearLayout(scrollLayout.context)
preferences.orientation = LinearLayout.VERTICAL
scrollLayout.addView(
preferences,
ViewGroup.LayoutParams.MATCH_PARENT,

View File

@ -1,7 +1,7 @@
package com.looker.droidify.ui.fragments
import android.view.ViewGroup
import androidx.appcompat.widget.LinearLayoutCompat
import android.widget.LinearLayout
import com.google.android.material.circularreveal.CircularRevealFrameLayout
import com.looker.droidify.R
import com.looker.droidify.content.Preferences
@ -9,8 +9,8 @@ import com.looker.droidify.content.Preferences
class PrefsUpdatesFragment : PrefsNavFragmentX() {
override fun setupPrefs(scrollLayout: CircularRevealFrameLayout) {
val preferences = LinearLayoutCompat(scrollLayout.context)
preferences.orientation = LinearLayoutCompat.VERTICAL
val preferences = LinearLayout(scrollLayout.context)
preferences.orientation = LinearLayout.VERTICAL
scrollLayout.addView(
preferences,
ViewGroup.LayoutParams.MATCH_PARENT,

View File

@ -1,7 +1,7 @@
package com.looker.droidify.ui.fragments
import android.view.ViewGroup
import androidx.appcompat.widget.LinearLayoutCompat
import android.widget.LinearLayout
import com.google.android.material.circularreveal.CircularRevealFrameLayout
import com.looker.droidify.R
import com.looker.droidify.content.Preferences
@ -12,8 +12,8 @@ import com.looker.droidify.utility.Utils.translateLocale
class PrefsUserFragment : PrefsNavFragmentX() {
override fun setupPrefs(scrollLayout: CircularRevealFrameLayout) {
val preferences = LinearLayoutCompat(scrollLayout.context)
preferences.orientation = LinearLayoutCompat.VERTICAL
val preferences = LinearLayout(scrollLayout.context)
preferences.orientation = LinearLayout.VERTICAL
scrollLayout.addView(
preferences,
ViewGroup.LayoutParams.MATCH_PARENT,