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 {
|
||||
anko_version = '0.10.8'
|
||||
support_version = "28.0.0"
|
||||
perms_dispatch_version = "3.3.2"
|
||||
}
|
||||
|
||||
dependencies {
|
||||
|
@ -44,6 +45,7 @@ dependencies {
|
|||
implementation "com.android.support:support-v13:$support_version"
|
||||
implementation "com.android.support:appcompat-v7:$support_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-appcompat-v7:$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'
|
||||
|
||||
// https://github.com/hotchemi/PermissionsDispatcher
|
||||
// Version 4.x does not work.
|
||||
implementation 'com.github.hotchemi:permissionsdispatcher:3.3.1'
|
||||
kapt 'com.github.hotchemi:permissionsdispatcher-processor:3.3.1'
|
||||
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
|
||||
// Version 4.x needs AndroidX
|
||||
//noinspection GradleDependency
|
||||
implementation "com.github.hotchemi:permissionsdispatcher:$perms_dispatch_version"
|
||||
kapt "com.github.hotchemi:permissionsdispatcher-processor:$perms_dispatch_version"
|
||||
|
||||
// https://github.com/eggheadgames/android-about-box
|
||||
implementation 'com.github.eggheadgames:android-about-box:1.3.2'
|
||||
|
|
|
@ -138,9 +138,8 @@ class MainActivity : AppCompatActivity(), AnkoLogger {
|
|||
author = "Erik C. Thauvin"
|
||||
|
||||
extraTitle = "Last Update"
|
||||
extra = DateFormat.getDateInstance(DateFormat.LONG, Locale.getDefault()).format(
|
||||
Date(BuildConfig.TIMESTAMP)
|
||||
).toString()
|
||||
extra = DateFormat.getDateInstance(DateFormat.LONG, Locale.getDefault())
|
||||
.format(Date(BuildConfig.TIMESTAMP)).toString()
|
||||
|
||||
emailAddress = "erik@thauvin.net"
|
||||
emailSubject = "${getString(R.string.app_name)} ${BuildConfig.VERSION_NAME} Support"
|
||||
|
@ -158,7 +157,8 @@ class MainActivity : AppCompatActivity(), AnkoLogger {
|
|||
webHomePage = "https://thauv.in/TESRemote"
|
||||
|
||||
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 {
|
||||
horizontalPadding = dip(40)
|
||||
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)
|
||||
filters = arrayOf(InputFilter.LengthFilter(size))
|
||||
setCompoundDrawablesWithIntrinsicBounds(
|
||||
|
@ -283,7 +284,8 @@ class MainActivity : AppCompatActivity(), AnkoLogger {
|
|||
setOnEditorActionListener { _, id, _ ->
|
||||
if (id == EditorInfo.IME_ACTION_DONE) {
|
||||
clearFocus()
|
||||
val imm = getSystemService(Context.INPUT_METHOD_SERVICE) as InputMethodManager
|
||||
val imm = getSystemService(Context.INPUT_METHOD_SERVICE)
|
||||
as InputMethodManager
|
||||
imm.hideSoftInputFromWindow(windowToken, 0)
|
||||
true
|
||||
} else {
|
||||
|
@ -321,8 +323,10 @@ class MainActivity : AppCompatActivity(), AnkoLogger {
|
|||
if (validateFields(fields)) {
|
||||
saveConfig()
|
||||
startActivity<ProgrammingActivity>(
|
||||
"net.thauvin.erik.android.tesremoteprogrammer.models.Params" to config.params,
|
||||
"net.thauvin.erik.android.tesremoteprogrammer.models.Option" to opts[position]
|
||||
"net.thauvin.erik.android.tesremoteprogrammer.models.Params" to
|
||||
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?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
|
||||
val params: Params = intent.extras!!.getParcelable("net.thauvin.erik.android.tesremoteprogrammer.models.Params")
|
||||
val option: Option = intent.extras!!.getParcelable("net.thauvin.erik.android.tesremoteprogrammer.models.Option")
|
||||
val params: Params = intent.extras!!.getParcelable(
|
||||
"net.thauvin.erik.android.tesremoteprogrammer.models.Params"
|
||||
)
|
||||
val option: Option = intent.extras!!.getParcelable(
|
||||
"net.thauvin.erik.android.tesremoteprogrammer.models.Option"
|
||||
)
|
||||
val fields = arrayListOf<EditText>()
|
||||
|
||||
coordinatorLayout {
|
||||
|
@ -352,7 +356,8 @@ class ProgrammingActivity : AppCompatActivity(), AnkoLogger {
|
|||
isValid = false
|
||||
} else if (!validateSize(
|
||||
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
|
||||
)) {
|
||||
if (minSize > 0) {
|
||||
|
|
|
@ -35,7 +35,8 @@ class StepsActivity : FragmentActivity() {
|
|||
super.onCreate(savedInstanceState)
|
||||
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.fades = false
|
||||
}
|
||||
|
|
|
@ -88,7 +88,8 @@ class Dtmf {
|
|||
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 {
|
||||
val result = StringBuffer()
|
||||
|
@ -179,7 +180,8 @@ class Dtmf {
|
|||
|
||||
fun validate(dtmf: String, extra: String, nodial: Boolean): Boolean {
|
||||
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 ->
|
||||
if (!(ch.isDigit() || ch == ',' || extra.contains(ch))) {
|
||||
return false
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue