Android Studio 2.3.3 and Anko 0.10.1 updates.
This commit is contained in:
parent
d942c45d31
commit
7c3443a66a
7 changed files with 88 additions and 67 deletions
7
.idea/inspectionProfiles/Project_Default.xml
generated
Normal file
7
.idea/inspectionProfiles/Project_Default.xml
generated
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
<component name="InspectionProjectProfileManager">
|
||||||
|
<profile version="1.0">
|
||||||
|
<option name="myName" value="Project Default" />
|
||||||
|
<option name="myLocal" value="true" />
|
||||||
|
<inspection_tool class="AndroidLintNewerVersionAvailable" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||||
|
</profile>
|
||||||
|
</component>
|
7
.idea/inspectionProfiles/profiles_settings.xml
generated
Normal file
7
.idea/inspectionProfiles/profiles_settings.xml
generated
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
<component name="InspectionProjectProfileManager">
|
||||||
|
<settings>
|
||||||
|
<option name="PROJECT_PROFILE" value="Project Default" />
|
||||||
|
<option name="USE_PROJECT_PROFILE" value="true" />
|
||||||
|
<version value="1.0" />
|
||||||
|
</settings>
|
||||||
|
</component>
|
|
@ -1,10 +1,11 @@
|
||||||
apply plugin: 'com.android.application'
|
apply plugin: 'com.android.application'
|
||||||
apply plugin: 'kotlin-android'
|
apply plugin: 'kotlin-android'
|
||||||
apply plugin: 'kotlin-android-extensions'
|
apply plugin: 'kotlin-android-extensions'
|
||||||
|
apply plugin: 'kotlin-kapt'
|
||||||
|
|
||||||
android {
|
android {
|
||||||
compileSdkVersion 25
|
compileSdkVersion 25
|
||||||
buildToolsVersion "25.0.2"
|
buildToolsVersion "26.0.0"
|
||||||
|
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
applicationId "net.thauvin.erik.android.tesremoteprogrammer"
|
applicationId "net.thauvin.erik.android.tesremoteprogrammer"
|
||||||
|
@ -33,12 +34,12 @@ dependencies {
|
||||||
compile 'com.android.support:support-v13:25.3.1'
|
compile 'com.android.support:support-v13:25.3.1'
|
||||||
compile 'com.android.support:appcompat-v7:25.3.1'
|
compile 'com.android.support:appcompat-v7:25.3.1'
|
||||||
compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
|
compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
|
||||||
compile 'org.jetbrains.anko:anko-sdk23:0.9.1'
|
compile 'org.jetbrains.anko:anko-sdk23:0.10.1'
|
||||||
compile 'org.jetbrains.anko:anko-appcompat-v7:0.9.1'
|
compile 'org.jetbrains.anko:anko-appcompat-v7:0.10.1'
|
||||||
compile 'org.jetbrains.anko:anko-support-v4:0.9.1'
|
compile 'org.jetbrains.anko:anko-support-v4:0.10.1'
|
||||||
compile 'org.jetbrains.anko:anko-design:0.9.1'
|
compile 'org.jetbrains.anko:anko-design:0.10.1'
|
||||||
compile 'com.android.support:design:25.3.1'
|
compile 'com.android.support:design:25.3.1'
|
||||||
compile group: 'com.google.code.gson', name: 'gson', version: '2.7'
|
compile group: 'com.google.code.gson', name: 'gson', version: '2.8.1'
|
||||||
|
|
||||||
// https://github.com/JakeWharton/ViewPagerIndicator
|
// https://github.com/JakeWharton/ViewPagerIndicator
|
||||||
compile 'fr.avianey.com.viewpagerindicator:library:2.4.1.1@aar'
|
compile 'fr.avianey.com.viewpagerindicator:library:2.4.1.1@aar'
|
||||||
|
|
|
@ -22,6 +22,7 @@ import android.app.Activity
|
||||||
import android.app.AlertDialog
|
import android.app.AlertDialog
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
|
import android.graphics.Color
|
||||||
import android.graphics.Typeface
|
import android.graphics.Typeface
|
||||||
import android.os.Build
|
import android.os.Build
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
|
@ -38,7 +39,6 @@ import android.view.inputmethod.InputMethodManager
|
||||||
import android.widget.AdapterView
|
import android.widget.AdapterView
|
||||||
import android.widget.ArrayAdapter
|
import android.widget.ArrayAdapter
|
||||||
import android.widget.EditText
|
import android.widget.EditText
|
||||||
import android.widget.TextView
|
|
||||||
import com.google.gson.Gson
|
import com.google.gson.Gson
|
||||||
import com.google.gson.JsonSyntaxException
|
import com.google.gson.JsonSyntaxException
|
||||||
import net.thauvin.erik.android.tesremoteprogrammer.models.Config
|
import net.thauvin.erik.android.tesremoteprogrammer.models.Config
|
||||||
|
@ -143,8 +143,8 @@ class MainActivity : AppCompatActivity(), AnkoLogger {
|
||||||
|
|
||||||
if (errors.isNotEmpty()) {
|
if (errors.isNotEmpty()) {
|
||||||
alert {
|
alert {
|
||||||
title(R.string.alert_config_error)
|
title = getString(R.string.alert_config_error)
|
||||||
message(fromHtml("$errors"))
|
message = fromHtml("$errors")
|
||||||
cancelButton { }
|
cancelButton { }
|
||||||
}.show()
|
}.show()
|
||||||
}
|
}
|
||||||
|
@ -283,15 +283,24 @@ class MainActivity : AppCompatActivity(), AnkoLogger {
|
||||||
when (item?.itemId) {
|
when (item?.itemId) {
|
||||||
R.id.action_about -> {
|
R.id.action_about -> {
|
||||||
val alert = alert {
|
val alert = alert {
|
||||||
title(R.string.app_name)
|
title = getString(R.string.app_name)
|
||||||
message(fromHtml(getString(R.string.about_message, BuildConfig.VERSION_NAME,
|
icon = getDrawable(R.mipmap.ic_launcher)
|
||||||
SimpleDateFormat("yyyy-MM-dd", Locale.US).format(Date(BuildConfig.TIMESTAMP)))))
|
customView {
|
||||||
icon(R.mipmap.ic_launcher)
|
linearLayout {
|
||||||
|
topPadding = dip(16)
|
||||||
|
rightPadding = topPadding
|
||||||
|
leftPadding = topPadding * 2
|
||||||
|
textView(fromHtml(getString(R.string.about_message,
|
||||||
|
BuildConfig.VERSION_NAME,
|
||||||
|
SimpleDateFormat("yyyy-MM-dd", Locale.US).format(Date(BuildConfig.TIMESTAMP))))) {
|
||||||
|
movementMethod = LinkMovementMethod.getInstance()
|
||||||
|
setTextSize(TypedValue.COMPLEX_UNIT_DIP, 18f)
|
||||||
|
setTextColor(Color.BLACK)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
okButton {}
|
okButton {}
|
||||||
}.show()
|
}.show()
|
||||||
|
|
||||||
(alert.dialog?.findViewById(android.R.id.message) as TextView)
|
|
||||||
.movementMethod = LinkMovementMethod.getInstance()
|
|
||||||
}
|
}
|
||||||
R.id.action_confs -> {
|
R.id.action_confs -> {
|
||||||
val confs = loadConfigurations().configs.toSortedMap()
|
val confs = loadConfigurations().configs.toSortedMap()
|
||||||
|
|
|
@ -59,8 +59,8 @@ import java.util.*
|
||||||
class ProgrammingActivity : AppCompatActivity(), AnkoLogger {
|
class ProgrammingActivity : AppCompatActivity(), AnkoLogger {
|
||||||
val empty = ""
|
val empty = ""
|
||||||
|
|
||||||
inline fun ViewManager.autofitTextView(theme: Int = 0, init: AutoResizeTextView.() -> Unit) = ankoView({ AutoResizeTextView(it) }, theme, init)
|
inline fun ViewManager.autofitTextView(theme: Int = 0, init: AutoResizeTextView.() -> Unit) = ankoView(::AutoResizeTextView, theme, init)
|
||||||
inline fun ViewManager.textInputEditText(theme: Int = 0, init: TextInputEditText.() -> Unit) = ankoView({ TextInputEditText(it) }, theme, init)
|
inline fun ViewManager.textInputEditText(theme: Int = 0, init: TextInputEditText.() -> Unit) = ankoView(::TextInputEditText, theme, init)
|
||||||
|
|
||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
super.onCreate(savedInstanceState)
|
super.onCreate(savedInstanceState)
|
||||||
|
@ -109,7 +109,7 @@ class ProgrammingActivity : AppCompatActivity(), AnkoLogger {
|
||||||
|
|
||||||
val inputFilters: ArrayList<InputFilter> = ArrayList()
|
val inputFilters: ArrayList<InputFilter> = ArrayList()
|
||||||
|
|
||||||
val editText = textInputEditText() {
|
val editText = textInputEditText {
|
||||||
hint = field!!.hint
|
hint = field!!.hint
|
||||||
|
|
||||||
if (field.alpha) {
|
if (field.alpha) {
|
||||||
|
@ -171,35 +171,6 @@ class ProgrammingActivity : AppCompatActivity(), AnkoLogger {
|
||||||
if (!option.nodial) {
|
if (!option.nodial) {
|
||||||
backgroundTintList = ColorStateList.valueOf(Color.GRAY)
|
backgroundTintList = ColorStateList.valueOf(Color.GRAY)
|
||||||
}
|
}
|
||||||
|
|
||||||
onClick {
|
|
||||||
if (validateFields(params.type, fields, option)) {
|
|
||||||
val dtmf = Dtmf.build(params.type, params.master, params.ack, option, fields)
|
|
||||||
if (Dtmf.validate(dtmf, "${MainActivity.PAUSE}${params.ack}${params.alt}", option.nodial)) {
|
|
||||||
val begin = if (params.begin.isNotBlank()) {
|
|
||||||
"${params.begin}${MainActivity.PAUSE}"
|
|
||||||
} else {
|
|
||||||
empty
|
|
||||||
}
|
|
||||||
|
|
||||||
val end = if (params.end.isNotBlank()) {
|
|
||||||
"${MainActivity.PAUSE}${params.end}"
|
|
||||||
} else {
|
|
||||||
empty
|
|
||||||
}
|
|
||||||
|
|
||||||
startActivity<StepsActivity>(
|
|
||||||
StepsActivity.EXTRA_STEPS to "$begin${dtmf.replace(MainActivity.QUOTE, empty)}$end".split(MainActivity.PAUSE))
|
|
||||||
} else {
|
|
||||||
Snackbar.make(this@coordinatorLayout,
|
|
||||||
getString(R.string.error_invalid_dtmf, dtmf),
|
|
||||||
Snackbar.LENGTH_LONG).show()
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
Snackbar.make(this@coordinatorLayout, R.string.error_invalid_field,
|
|
||||||
Snackbar.LENGTH_LONG).show()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}.lparams(width = wrapContent, height = wrapContent) {
|
}.lparams(width = wrapContent, height = wrapContent) {
|
||||||
if (option.nodial) {
|
if (option.nodial) {
|
||||||
gravity = BOTTOM or END
|
gravity = BOTTOM or END
|
||||||
|
@ -212,6 +183,33 @@ class ProgrammingActivity : AppCompatActivity(), AnkoLogger {
|
||||||
bottomMargin = dip(16)
|
bottomMargin = dip(16)
|
||||||
elevation = dip(6).toFloat()
|
elevation = dip(6).toFloat()
|
||||||
behavior = ScrollAwareFABBehavior()
|
behavior = ScrollAwareFABBehavior()
|
||||||
|
}.setOnClickListener {
|
||||||
|
if (validateFields(params.type, fields, option)) {
|
||||||
|
val dtmf = Dtmf.build(params.type, params.master, params.ack, option, fields)
|
||||||
|
if (Dtmf.validate(dtmf, "${MainActivity.PAUSE}${params.ack}${params.alt}", option.nodial)) {
|
||||||
|
val begin = if (params.begin.isNotBlank()) {
|
||||||
|
"${params.begin}${MainActivity.PAUSE}"
|
||||||
|
} else {
|
||||||
|
empty
|
||||||
|
}
|
||||||
|
|
||||||
|
val end = if (params.end.isNotBlank()) {
|
||||||
|
"${MainActivity.PAUSE}${params.end}"
|
||||||
|
} else {
|
||||||
|
empty
|
||||||
|
}
|
||||||
|
|
||||||
|
startActivity<StepsActivity>(
|
||||||
|
StepsActivity.EXTRA_STEPS to "$begin${dtmf.replace(MainActivity.QUOTE, empty)}$end".split(MainActivity.PAUSE))
|
||||||
|
} else {
|
||||||
|
Snackbar.make(this@coordinatorLayout,
|
||||||
|
getString(R.string.error_invalid_dtmf, dtmf),
|
||||||
|
Snackbar.LENGTH_LONG).show()
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
Snackbar.make(this@coordinatorLayout, R.string.error_invalid_field,
|
||||||
|
Snackbar.LENGTH_LONG).show()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -219,28 +217,27 @@ class ProgrammingActivity : AppCompatActivity(), AnkoLogger {
|
||||||
if (!option.nodial) {
|
if (!option.nodial) {
|
||||||
floatingActionButton {
|
floatingActionButton {
|
||||||
imageResource = R.drawable.fab_ic_call
|
imageResource = R.drawable.fab_ic_call
|
||||||
onClick {
|
|
||||||
if (validateFields(params.type, fields, option)) {
|
|
||||||
val dtmf = Dtmf.build(params.type, params.master, params.ack, option, fields)
|
|
||||||
if (Dtmf.validate(dtmf, "${MainActivity.PAUSE}${params.ack}${params.alt}", option.nodial)) {
|
|
||||||
ProgrammingActivityPermissionsDispatcher.callWithCheck(
|
|
||||||
this@ProgrammingActivity, params.phone, dtmf)
|
|
||||||
} else {
|
|
||||||
Snackbar.make(this@coordinatorLayout,
|
|
||||||
getString(R.string.error_invalid_dtmf, dtmf),
|
|
||||||
Snackbar.LENGTH_LONG).show()
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
Snackbar.make(this@coordinatorLayout, R.string.error_invalid_field,
|
|
||||||
Snackbar.LENGTH_LONG).show()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}.lparams(width = wrapContent, height = wrapContent) {
|
}.lparams(width = wrapContent, height = wrapContent) {
|
||||||
gravity = BOTTOM or END
|
gravity = BOTTOM or END
|
||||||
bottomMargin = dip(16)
|
bottomMargin = dip(16)
|
||||||
rightMargin = dip(16)
|
rightMargin = dip(16)
|
||||||
elevation = dip(6).toFloat()
|
elevation = dip(6).toFloat()
|
||||||
behavior = ScrollAwareFABBehavior()
|
behavior = ScrollAwareFABBehavior()
|
||||||
|
}.setOnClickListener {
|
||||||
|
if (validateFields(params.type, fields, option)) {
|
||||||
|
val dtmf = Dtmf.build(params.type, params.master, params.ack, option, fields)
|
||||||
|
if (Dtmf.validate(dtmf, "${MainActivity.PAUSE}${params.ack}${params.alt}", option.nodial)) {
|
||||||
|
ProgrammingActivityPermissionsDispatcher.callWithCheck(
|
||||||
|
this@ProgrammingActivity, params.phone, dtmf)
|
||||||
|
} else {
|
||||||
|
Snackbar.make(this@coordinatorLayout,
|
||||||
|
getString(R.string.error_invalid_dtmf, dtmf),
|
||||||
|
Snackbar.LENGTH_LONG).show()
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
Snackbar.make(this@coordinatorLayout, R.string.error_invalid_field,
|
||||||
|
Snackbar.LENGTH_LONG).show()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<resources xmlns:xliff="http://schemas.android.com/tools">
|
<resources xmlns:xliff="http://schemas.android.com/tools">
|
||||||
<string name="about_message"><p><b>Version <xliff:g id="type">%1$s</xliff:g></b> <small>(<xliff:g id="date">%2$s</xliff:g>)</small></p><p>Developed by <a href=\"http://erik.thauvin.net/\"><b>Erik C. Thauvin</b></a>. See all my apps <a href=\"http://mobile.thauvin.net/android/\"><b>here</b></a>.</p><a href=\"http://thauv.in/TESRemote\"><b>thauv.in/TESRemote</b></a></string>
|
<string name="about_message"><p><b>Version <xliff:g id="type">%1$s</xliff:g></b> <small>(<xliff:g id="date">%2$s</xliff:g>)</small></p><p>Developed by <a href=\"https://erik.thauvin.net/\"><b>Erik C. Thauvin</b></a>. See all my apps <a href=\"http://mobile.thauvin.net/android/\"><b>here</b></a>.</p><a href=\"http://thauv.in/TESRemote\"><b>thauv.in/TESRemote</b></a></string>
|
||||||
<string name="action_about">About</string>
|
<string name="action_about">About</string>
|
||||||
<string name="action_config">Configurations</string>
|
<string name="action_config">Configurations</string>
|
||||||
<string name="alert_config_error">Configuration Errors</string>
|
<string name="alert_config_error">Configuration Errors</string>
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
||||||
|
|
||||||
buildscript {
|
buildscript {
|
||||||
ext.kotlin_version = '1.1.1'
|
ext.kotlin_version = '1.1.3-2'
|
||||||
repositories {
|
repositories {
|
||||||
jcenter()
|
jcenter()
|
||||||
}
|
}
|
||||||
dependencies {
|
dependencies {
|
||||||
classpath 'com.android.tools.build:gradle:2.3.1'
|
classpath 'com.android.tools.build:gradle:2.3.3'
|
||||||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
||||||
|
|
||||||
// NOTE: Do not place your application dependencies here; they belong
|
// NOTE: Do not place your application dependencies here; they belong
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue