mirror of
https://github.com/Kunzisoft/KeePassDX.git
synced 2025-12-04 15:49:33 +01:00
Removed sdk checks on TextFieldView.kt
Removed SDK checks that will always resolve to true now. Since we are updating min sdk to 19, these checks are no longer necessary.
This commit is contained in:
@@ -63,13 +63,12 @@ open class TextFieldView @JvmOverloads constructor(context: Context,
|
||||
4f,
|
||||
resources.displayMetrics
|
||||
).toInt()
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
|
||||
it.marginStart = TypedValue.applyDimension(
|
||||
TypedValue.COMPLEX_UNIT_DIP,
|
||||
4f,
|
||||
resources.displayMetrics
|
||||
).toInt()
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
protected val valueView = AppCompatTextView(context).apply {
|
||||
@@ -88,14 +87,12 @@ open class TextFieldView @JvmOverloads constructor(context: Context,
|
||||
8f,
|
||||
resources.displayMetrics
|
||||
).toInt()
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
|
||||
it.marginStart = TypedValue.applyDimension(
|
||||
TypedValue.COMPLEX_UNIT_DIP,
|
||||
8f,
|
||||
resources.displayMetrics
|
||||
).toInt()
|
||||
}
|
||||
}
|
||||
setTextIsSelectable(true)
|
||||
}
|
||||
private var showButton = AppCompatImageButton(
|
||||
@@ -128,24 +125,22 @@ open class TextFieldView @JvmOverloads constructor(context: Context,
|
||||
id = copyButtonId
|
||||
layoutParams = (layoutParams as LayoutParams?)?.also {
|
||||
it.addRule(ALIGN_PARENT_RIGHT)
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
|
||||
it.addRule(ALIGN_PARENT_END)
|
||||
}
|
||||
}
|
||||
}
|
||||
showButton.apply {
|
||||
id = showButtonId
|
||||
layoutParams = (layoutParams as LayoutParams?)?.also {
|
||||
if (copyButton.isVisible) {
|
||||
it.addRule(LEFT_OF, copyButtonId)
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
|
||||
|
||||
it.addRule(START_OF, copyButtonId)
|
||||
}
|
||||
|
||||
} else {
|
||||
it.addRule(ALIGN_PARENT_RIGHT)
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
|
||||
|
||||
it.addRule(ALIGN_PARENT_END)
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -153,18 +148,14 @@ open class TextFieldView @JvmOverloads constructor(context: Context,
|
||||
id = labelViewId
|
||||
layoutParams = (layoutParams as LayoutParams?)?.also {
|
||||
it.addRule(LEFT_OF, showButtonId)
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
|
||||
it.addRule(START_OF, showButtonId)
|
||||
}
|
||||
}
|
||||
}
|
||||
valueView.apply {
|
||||
id = valueViewId
|
||||
layoutParams = (layoutParams as LayoutParams?)?.also {
|
||||
it.addRule(LEFT_OF, showButtonId)
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
|
||||
it.addRule(START_OF, showButtonId)
|
||||
}
|
||||
it.addRule(BELOW, labelViewId)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user