Cleanup.
This commit is contained in:
parent
8f06802253
commit
c38894eaf0
5 changed files with 32 additions and 18 deletions
|
@ -34,6 +34,7 @@ android {
|
||||||
ext {
|
ext {
|
||||||
anko_version = '0.10.8'
|
anko_version = '0.10.8'
|
||||||
support_version = "28.0.0"
|
support_version = "28.0.0"
|
||||||
|
perms_dispatch_version = "3.3.2"
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
|
@ -44,6 +45,7 @@ dependencies {
|
||||||
implementation "com.android.support:support-v13:$support_version"
|
implementation "com.android.support:support-v13:$support_version"
|
||||||
implementation "com.android.support:appcompat-v7:$support_version"
|
implementation "com.android.support:appcompat-v7:$support_version"
|
||||||
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
|
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
|
||||||
|
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
|
||||||
implementation "org.jetbrains.anko:anko-sdk23:$anko_version"
|
implementation "org.jetbrains.anko:anko-sdk23:$anko_version"
|
||||||
implementation "org.jetbrains.anko:anko-appcompat-v7:$anko_version"
|
implementation "org.jetbrains.anko:anko-appcompat-v7:$anko_version"
|
||||||
implementation "org.jetbrains.anko:anko-support-v4:$anko_version"
|
implementation "org.jetbrains.anko:anko-support-v4:$anko_version"
|
||||||
|
@ -55,10 +57,10 @@ dependencies {
|
||||||
implementation 'fr.avianey.com.viewpagerindicator:library:2.4.1.1@aar'
|
implementation 'fr.avianey.com.viewpagerindicator:library:2.4.1.1@aar'
|
||||||
|
|
||||||
// https://github.com/hotchemi/PermissionsDispatcher
|
// https://github.com/hotchemi/PermissionsDispatcher
|
||||||
// Version 4.x does not work.
|
// Version 4.x needs AndroidX
|
||||||
implementation 'com.github.hotchemi:permissionsdispatcher:3.3.1'
|
//noinspection GradleDependency
|
||||||
kapt 'com.github.hotchemi:permissionsdispatcher-processor:3.3.1'
|
implementation "com.github.hotchemi:permissionsdispatcher:$perms_dispatch_version"
|
||||||
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
|
kapt "com.github.hotchemi:permissionsdispatcher-processor:$perms_dispatch_version"
|
||||||
|
|
||||||
// https://github.com/eggheadgames/android-about-box
|
// https://github.com/eggheadgames/android-about-box
|
||||||
implementation 'com.github.eggheadgames:android-about-box:1.3.2'
|
implementation 'com.github.eggheadgames:android-about-box:1.3.2'
|
||||||
|
|
|
@ -138,9 +138,8 @@ class MainActivity : AppCompatActivity(), AnkoLogger {
|
||||||
author = "Erik C. Thauvin"
|
author = "Erik C. Thauvin"
|
||||||
|
|
||||||
extraTitle = "Last Update"
|
extraTitle = "Last Update"
|
||||||
extra = DateFormat.getDateInstance(DateFormat.LONG, Locale.getDefault()).format(
|
extra = DateFormat.getDateInstance(DateFormat.LONG, Locale.getDefault())
|
||||||
Date(BuildConfig.TIMESTAMP)
|
.format(Date(BuildConfig.TIMESTAMP)).toString()
|
||||||
).toString()
|
|
||||||
|
|
||||||
emailAddress = "erik@thauvin.net"
|
emailAddress = "erik@thauvin.net"
|
||||||
emailSubject = "${getString(R.string.app_name)} ${BuildConfig.VERSION_NAME} Support"
|
emailSubject = "${getString(R.string.app_name)} ${BuildConfig.VERSION_NAME} Support"
|
||||||
|
@ -158,7 +157,8 @@ class MainActivity : AppCompatActivity(), AnkoLogger {
|
||||||
webHomePage = "https://thauv.in/TESRemote"
|
webHomePage = "https://thauv.in/TESRemote"
|
||||||
|
|
||||||
privacyHtmlPath = "https://m.thauvin.net/apps-privacy.shtml"
|
privacyHtmlPath = "https://m.thauvin.net/apps-privacy.shtml"
|
||||||
acknowledgmentHtmlPath = "https://m.thauvin.net/android/TESRemoteProgrammer/licenses.shtml"
|
acknowledgmentHtmlPath =
|
||||||
|
"https://m.thauvin.net/android/TESRemoteProgrammer/licenses.shtml"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -258,7 +258,8 @@ class MainActivity : AppCompatActivity(), AnkoLogger {
|
||||||
textInputLayout {
|
textInputLayout {
|
||||||
horizontalPadding = dip(40)
|
horizontalPadding = dip(40)
|
||||||
val editText = textInputEditText {
|
val editText = textInputEditText {
|
||||||
inputType = InputType.TYPE_CLASS_NUMBER or InputType.TYPE_NUMBER_VARIATION_PASSWORD
|
inputType = InputType.TYPE_CLASS_NUMBER or
|
||||||
|
InputType.TYPE_NUMBER_VARIATION_PASSWORD
|
||||||
hint = getString(R.string.hint_master_code)
|
hint = getString(R.string.hint_master_code)
|
||||||
filters = arrayOf(InputFilter.LengthFilter(size))
|
filters = arrayOf(InputFilter.LengthFilter(size))
|
||||||
setCompoundDrawablesWithIntrinsicBounds(
|
setCompoundDrawablesWithIntrinsicBounds(
|
||||||
|
@ -283,7 +284,8 @@ class MainActivity : AppCompatActivity(), AnkoLogger {
|
||||||
setOnEditorActionListener { _, id, _ ->
|
setOnEditorActionListener { _, id, _ ->
|
||||||
if (id == EditorInfo.IME_ACTION_DONE) {
|
if (id == EditorInfo.IME_ACTION_DONE) {
|
||||||
clearFocus()
|
clearFocus()
|
||||||
val imm = getSystemService(Context.INPUT_METHOD_SERVICE) as InputMethodManager
|
val imm = getSystemService(Context.INPUT_METHOD_SERVICE)
|
||||||
|
as InputMethodManager
|
||||||
imm.hideSoftInputFromWindow(windowToken, 0)
|
imm.hideSoftInputFromWindow(windowToken, 0)
|
||||||
true
|
true
|
||||||
} else {
|
} else {
|
||||||
|
@ -321,8 +323,10 @@ class MainActivity : AppCompatActivity(), AnkoLogger {
|
||||||
if (validateFields(fields)) {
|
if (validateFields(fields)) {
|
||||||
saveConfig()
|
saveConfig()
|
||||||
startActivity<ProgrammingActivity>(
|
startActivity<ProgrammingActivity>(
|
||||||
"net.thauvin.erik.android.tesremoteprogrammer.models.Params" to config.params,
|
"net.thauvin.erik.android.tesremoteprogrammer.models.Params" to
|
||||||
"net.thauvin.erik.android.tesremoteprogrammer.models.Option" to opts[position]
|
config.params,
|
||||||
|
"net.thauvin.erik.android.tesremoteprogrammer.models.Option" to
|
||||||
|
opts[position]
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -77,8 +77,12 @@ class ProgrammingActivity : AppCompatActivity(), AnkoLogger {
|
||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
super.onCreate(savedInstanceState)
|
super.onCreate(savedInstanceState)
|
||||||
|
|
||||||
val params: Params = intent.extras!!.getParcelable("net.thauvin.erik.android.tesremoteprogrammer.models.Params")
|
val params: Params = intent.extras!!.getParcelable(
|
||||||
val option: Option = intent.extras!!.getParcelable("net.thauvin.erik.android.tesremoteprogrammer.models.Option")
|
"net.thauvin.erik.android.tesremoteprogrammer.models.Params"
|
||||||
|
)
|
||||||
|
val option: Option = intent.extras!!.getParcelable(
|
||||||
|
"net.thauvin.erik.android.tesremoteprogrammer.models.Option"
|
||||||
|
)
|
||||||
val fields = arrayListOf<EditText>()
|
val fields = arrayListOf<EditText>()
|
||||||
|
|
||||||
coordinatorLayout {
|
coordinatorLayout {
|
||||||
|
@ -352,7 +356,8 @@ class ProgrammingActivity : AppCompatActivity(), AnkoLogger {
|
||||||
isValid = false
|
isValid = false
|
||||||
} else if (!validateSize(
|
} else if (!validateSize(
|
||||||
v.length(),
|
v.length(),
|
||||||
if ((!type.isDKS() && !zeros) && min >= 0) min.toString().length else minSize,
|
if ((!type.isDKS() && !zeros) && min >= 0)
|
||||||
|
min.toString().length else minSize,
|
||||||
size
|
size
|
||||||
)) {
|
)) {
|
||||||
if (minSize > 0) {
|
if (minSize > 0) {
|
||||||
|
|
|
@ -35,7 +35,8 @@ class StepsActivity : FragmentActivity() {
|
||||||
super.onCreate(savedInstanceState)
|
super.onCreate(savedInstanceState)
|
||||||
setContentView(R.layout.activity_steps)
|
setContentView(R.layout.activity_steps)
|
||||||
|
|
||||||
pager.adapter = StepsAdapter(fragmentManager, intent.extras.getStringArrayList(EXTRA_STEPS))
|
val steps = intent?.extras?.getStringArrayList(EXTRA_STEPS) ?: arrayListOf()
|
||||||
|
pager.adapter = StepsAdapter(fragmentManager, steps)
|
||||||
indicator.setViewPager(pager, pager.currentItem - 1)
|
indicator.setViewPager(pager, pager.currentItem - 1)
|
||||||
indicator.fades = false
|
indicator.fades = false
|
||||||
}
|
}
|
||||||
|
|
|
@ -88,7 +88,8 @@ class Dtmf {
|
||||||
return result.toString()
|
return result.toString()
|
||||||
}
|
}
|
||||||
|
|
||||||
fun isValidType(type: String): Boolean = type.equals(DKS, true) || type.equals(LINEAR, true)
|
fun isValidType(type: String): Boolean =
|
||||||
|
type.equals(DKS, true) || type.equals(LINEAR, true)
|
||||||
|
|
||||||
private fun linearAlphaToDigits(text: String): String {
|
private fun linearAlphaToDigits(text: String): String {
|
||||||
val result = StringBuffer()
|
val result = StringBuffer()
|
||||||
|
@ -179,7 +180,8 @@ class Dtmf {
|
||||||
|
|
||||||
fun validate(dtmf: String, extra: String, nodial: Boolean): Boolean {
|
fun validate(dtmf: String, extra: String, nodial: Boolean): Boolean {
|
||||||
dtmf.split(MainActivity.PAUSE).forEach { s ->
|
dtmf.split(MainActivity.PAUSE).forEach { s ->
|
||||||
if (!(nodial && s.endsWith(MainActivity.QUOTE) && s.startsWith(MainActivity.QUOTE))) {
|
if (!(nodial && s.endsWith(MainActivity.QUOTE) &&
|
||||||
|
s.startsWith(MainActivity.QUOTE))) {
|
||||||
s.forEach { ch ->
|
s.forEach { ch ->
|
||||||
if (!(ch.isDigit() || ch == ',' || extra.contains(ch))) {
|
if (!(ch.isDigit() || ch == ',' || extra.contains(ch))) {
|
||||||
return false
|
return false
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue