Initial commit.

This commit is contained in:
Erik C. Thauvin 2016-08-24 19:05:38 -07:00
commit 548759c61e
90 changed files with 5692 additions and 0 deletions

10
.gitignore vendored Normal file
View file

@ -0,0 +1,10 @@
*.iml
.gradle
/local.properties
/.idea/workspace.xml
/.idea/libraries
.DS_Store
/build
/captures
Thumbs.db
ehthumbs.db

1
.idea/.name generated Normal file
View file

@ -0,0 +1 @@
TESRemoteProgrammer

22
.idea/compiler.xml generated Normal file
View file

@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CompilerConfiguration">
<option name="DEFAULT_COMPILER" value="Javac" />
<resourceExtensions />
<wildcardResourcePatterns>
<entry name="!?*.java" />
<entry name="!?*.form" />
<entry name="!?*.class" />
<entry name="!?*.groovy" />
<entry name="!?*.scala" />
<entry name="!?*.flex" />
<entry name="!?*.kt" />
<entry name="!?*.clj" />
</wildcardResourcePatterns>
<annotationProcessing>
<profile default="true" name="Default" enabled="false">
<processorPath useClasspath="true" />
</profile>
</annotationProcessing>
</component>
</project>

View file

@ -0,0 +1,6 @@
<component name="CopyrightManager">
<copyright>
<option name="myName" value="Erik's Copyright Notice" />
<option name="notice" value="&amp;#36;file.fileName&#10;&#10;Copyright &amp;#36;today.year Erik C. Thauvin (erik@thauvin.net)&#10;&#10;Licensed under the Apache License, Version 2.0 (the &quot;License&quot;);&#10;you may not use this file except in compliance with the License.&#10;You may obtain a copy of the License at&#10;&#10; http://www.apache.org/licenses/LICENSE-2.0&#10;&#10;Unless required by applicable law or agreed to in writing, software&#10;distributed under the License is distributed on an &quot;AS IS&quot; BASIS,&#10;WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.&#10;See the License for the specific language governing permissions and&#10;limitations under the License." />
</copyright>
</component>

15
.idea/copyright/profiles_settings.xml generated Normal file
View file

@ -0,0 +1,15 @@
<component name="CopyrightManager">
<settings default="">
<module2copyright>
<element module="Source" copyright="Erik's Copyright Notice" />
</module2copyright>
<LanguageOptions name="JAVA">
<option name="fileTypeOverride" value="3" />
<option name="addBlankAfter" value="false" />
</LanguageOptions>
<LanguageOptions name="Kotlin">
<option name="fileTypeOverride" value="3" />
<option name="addBlankAfter" value="false" />
</LanguageOptions>
</settings>
</component>

6
.idea/encodings.xml generated Normal file
View file

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Encoding">
<file url="PROJECT" charset="UTF-8" />
</component>
</project>

23
.idea/gradle.xml generated Normal file
View file

@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="GradleSettings">
<option name="linkedExternalProjectsSettings">
<GradleProjectSettings>
<option name="distributionType" value="DEFAULT_WRAPPED" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="modules">
<set>
<option value="$PROJECT_DIR$" />
<option value="$PROJECT_DIR$/app" />
</set>
</option>
<option name="myModules">
<set>
<option value="$PROJECT_DIR$" />
<option value="$PROJECT_DIR$/app" />
</set>
</option>
</GradleProjectSettings>
</option>
</component>
</project>

46
.idea/misc.xml generated Normal file
View file

@ -0,0 +1,46 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="EntryPointsManager">
<entry_points version="2.0" />
</component>
<component name="NullableNotNullManager">
<option name="myDefaultNullable" value="android.support.annotation.Nullable" />
<option name="myDefaultNotNull" value="android.support.annotation.NonNull" />
<option name="myNullables">
<value>
<list size="4">
<item index="0" class="java.lang.String" itemvalue="org.jetbrains.annotations.Nullable" />
<item index="1" class="java.lang.String" itemvalue="javax.annotation.Nullable" />
<item index="2" class="java.lang.String" itemvalue="edu.umd.cs.findbugs.annotations.Nullable" />
<item index="3" class="java.lang.String" itemvalue="android.support.annotation.Nullable" />
</list>
</value>
</option>
<option name="myNotNulls">
<value>
<list size="4">
<item index="0" class="java.lang.String" itemvalue="org.jetbrains.annotations.NotNull" />
<item index="1" class="java.lang.String" itemvalue="javax.annotation.Nonnull" />
<item index="2" class="java.lang.String" itemvalue="edu.umd.cs.findbugs.annotations.NonNull" />
<item index="3" class="java.lang.String" itemvalue="android.support.annotation.NonNull" />
</list>
</value>
</option>
</component>
<component name="ProjectLevelVcsManager" settingsEditedManually="false">
<OptionsSetting value="true" id="Add" />
<OptionsSetting value="true" id="Remove" />
<OptionsSetting value="true" id="Checkout" />
<OptionsSetting value="true" id="Update" />
<OptionsSetting value="true" id="Status" />
<OptionsSetting value="true" id="Edit" />
<ConfirmationsSetting value="0" id="Add" />
<ConfirmationsSetting value="0" id="Remove" />
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_7" assert-keyword="true" jdk-15="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/build/classes" />
</component>
<component name="ProjectType">
<option name="id" value="Android" />
</component>
</project>

9
.idea/modules.xml generated Normal file
View file

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/TESRemoteProgrammer.iml" filepath="$PROJECT_DIR$/TESRemoteProgrammer.iml" />
<module fileurl="file://$PROJECT_DIR$/app/app.iml" filepath="$PROJECT_DIR$/app/app.iml" />
</modules>
</component>
</project>

12
.idea/runConfigurations.xml generated Normal file
View file

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="RunConfigurationProducerService">
<option name="ignoredProducers">
<set>
<option value="org.jetbrains.plugins.gradle.execution.test.runner.AllInPackageGradleConfigurationProducer" />
<option value="org.jetbrains.plugins.gradle.execution.test.runner.TestClassGradleConfigurationProducer" />
<option value="org.jetbrains.plugins.gradle.execution.test.runner.TestMethodGradleConfigurationProducer" />
</set>
</option>
</component>
</project>

3
.idea/scopes/Source.xml generated Normal file
View file

@ -0,0 +1,3 @@
<component name="DependencyValidationManager">
<scope name="Source" pattern="file[app]:src/main/java/*.kt||file[app]:src/main/java/*.java" />
</component>

202
LICENSE.txt Normal file
View file

@ -0,0 +1,202 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

5
README.md Normal file
View file

@ -0,0 +1,5 @@
# Telephone Entry System Remote Programmer for Android
![License](http://img.shields.io/:license-apache-blue.svg?style=flat-square)](http://www.apache.org/licenses/LICENSE-2.0.html)
[![VersionEye Logo](/images/feature_graphic.png | width=800)]

1
app/.gitignore vendored Normal file
View file

@ -0,0 +1 @@
/build

56
app/build.gradle Normal file
View file

@ -0,0 +1,56 @@
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
android {
compileSdkVersion 24
buildToolsVersion "24.0.1"
defaultConfig {
applicationId "net.thauvin.erik.android.tesremoteprogrammer"
minSdkVersion 23
targetSdkVersion 24
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
sourceSets {
main.java.srcDirs += 'src/main/kotlin'
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:support-v13:24.1.1'
compile 'com.android.support:appcompat-v7:24.1.1'
compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
compile 'org.jetbrains.anko:anko-sdk23:0.9'
compile 'org.jetbrains.anko:anko-appcompat-v7:0.9'
compile 'org.jetbrains.anko:anko-support-v4:0.9'
compile 'org.jetbrains.anko:anko-design:0.9'
compile 'com.android.support:design:24.1.1'
compile group: 'com.google.code.gson', name: 'gson', version: '2.7'
// https://github.com/JakeWharton/ViewPagerIndicator
compile 'fr.avianey.com.viewpagerindicator:library:2.4.1.1@aar'
// https://github.com/hotchemi/PermissionsDispatcher
compile 'com.github.hotchemi:permissionsdispatcher:2.1.3'
kapt 'com.github.hotchemi:permissionsdispatcher-processor:2.1.3'
}
repositories {
mavenCentral()
}
kapt {
generateStubs = true
}

17
app/proguard-rules.pro vendored Normal file
View file

@ -0,0 +1,17 @@
# Add project specific ProGuard rules here.
# By default, the flags in this file are appended to flags specified
# in C:\Users\erik\AppData\Local\Android\android-sdk/tools/proguard/proguard-android.txt
# You can edit the include path and order by changing the proguardFiles
# directive in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# Add any project specific keep options here:
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}

View file

@ -0,0 +1,31 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="net.thauvin.erik.android.tesremoteprogrammer">
<uses-permission android:name="android.permission.CALL_PHONE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<application
android:allowBackup="true"
android:fullBackupContent="@xml/mybackupscheme"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity
android:name=".MainActivity"
android:screenOrientation="portrait">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".ProgrammingActivity"
android:screenOrientation="portrait" />
<activity
android:name=".StepsActivity"
android:screenOrientation="landscape" />
</application>
</manifest>

View file

@ -0,0 +1,385 @@
/*
* MainActivity.kt
*
* Copyright 2016 Erik C. Thauvin (erik@thauvin.net)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package net.thauvin.erik.android.tesremoteprogrammer
import android.Manifest
import android.app.Activity
import android.app.AlertDialog
import android.content.Context
import android.content.Intent
import android.graphics.Typeface
import android.os.Bundle
import android.support.v7.app.AppCompatActivity
import android.text.Html
import android.text.InputFilter
import android.text.InputType
import android.text.TextUtils
import android.text.method.LinkMovementMethod
import android.util.TypedValue
import android.view.Menu
import android.view.MenuItem
import android.view.inputmethod.EditorInfo
import android.view.inputmethod.InputMethodManager
import android.widget.AdapterView
import android.widget.ArrayAdapter
import android.widget.EditText
import android.widget.TextView
import com.google.gson.Gson
import com.google.gson.JsonSyntaxException
import net.thauvin.erik.android.tesremoteprogrammer.models.Config
import net.thauvin.erik.android.tesremoteprogrammer.models.Configurations
import net.thauvin.erik.android.tesremoteprogrammer.util.Dtmf
import net.thauvin.erik.android.tesremoteprogrammer.util.plural
import org.jetbrains.anko.*
import org.jetbrains.anko.design.textInputLayout
import permissions.dispatcher.NeedsPermission
import permissions.dispatcher.RuntimePermissions
import java.io.FileNotFoundException
import java.io.InputStreamReader
import java.io.ObjectInputStream
import java.io.ObjectOutputStream
import java.util.*
@RuntimePermissions
class MainActivity : AppCompatActivity(), AnkoLogger {
lateinit var config: Config
val configurations_data = "configurations.dat"
val current_config_data = "config.dat"
val read_request_code = 42
companion object {
val PAUSE = ','
}
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
if (requestCode == read_request_code && resultCode == Activity.RESULT_OK) {
if (data != null) {
MainActivityPermissionsDispatcher.validateConfigWithCheck(this, data)
}
}
}
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
val fields = arrayListOf<EditText>()
loadConfig()
verticalLayout {
padding = dip(20)
textView {
text = config.params.name.toUpperCase()
bottomPadding = dip(5)
typeface = Typeface.DEFAULT_BOLD
setTextSize(TypedValue.COMPLEX_UNIT_DIP, 24f)
isFocusableInTouchMode = true
singleLine = true
ellipsize = TextUtils.TruncateAt.END
}
textInputLayout {
horizontalPadding = dip(40)
val phone = editText() {
lparams(width = matchParent)
inputType = InputType.TYPE_CLASS_PHONE
hint = getString(R.string.hint_phone_number)
if (config.params.phone.isNotBlank()) {
setText(config.params.phone)
}
setCompoundDrawablesWithIntrinsicBounds(0, 0, R.drawable.ic_call_black_24dp, 0)
setOnFocusChangeListener { view, hasFocus ->
if (!hasFocus) {
config.params.phone = (view as EditText).text.toString()
saveConfig()
}
}
}
fields.add(phone)
}
textInputLayout {
horizontalPadding = dip(40)
val masterCode = editText() {
lparams(width = matchParent)
inputType = InputType.TYPE_CLASS_NUMBER or InputType.TYPE_NUMBER_VARIATION_PASSWORD
hint = getString(R.string.hint_master_code)
filters = arrayOf(InputFilter.LengthFilter(config.params.size))
setCompoundDrawablesWithIntrinsicBounds(0, 0, R.drawable.ic_verified_user_black_24dp, 0)
imeOptions = EditorInfo.IME_ACTION_DONE
if (config.params.master.isNotBlank()) {
setText(config.params.master)
}
setOnFocusChangeListener { view, hasFocus ->
if (!hasFocus) {
config.params.master = (view as EditText).text.toString()
saveConfig()
}
}
setOnEditorActionListener { v, id, event ->
if (id == EditorInfo.IME_ACTION_DONE) {
clearFocus()
val imm = getSystemService(Context.INPUT_METHOD_SERVICE) as InputMethodManager
imm.hideSoftInputFromWindow(windowToken, 0)
true
} else {
false
}
}
}
fields.add(masterCode)
}
textView {
topPadding = dip(10)
text = getString(R.string.programming_heading)
setTextSize(TypedValue.COMPLEX_UNIT_DIP, 18f)
typeface = Typeface.DEFAULT_BOLD
}.lparams(width = matchParent)
val opts = config.opts.sorted()
val titles = arrayListOf<String>()
opts.all {
titles.add(it.title)
}
listView {
adapter = ArrayAdapter<String>(this@MainActivity, android.R.layout.simple_list_item_1, titles)
isTextFilterEnabled = true
isScrollbarFadingEnabled = false
onItemClickListener = AdapterView.OnItemClickListener { parent, v, position, id ->
if (validateFields(fields, config.params.size)) {
startActivity<ProgrammingActivity>(
"net.thauvin.erik.android.tesremoteprogrammer.models.Params" to config.params,
"net.thauvin.erik.android.tesremoteprogrammer.models.Option" to opts[position])
}
}
}.lparams(width = matchParent)
}
}
override fun onCreateOptionsMenu(menu: Menu?): Boolean {
menuInflater.inflate(R.menu.menu_main, menu)
return true
}
override fun onOptionsItemSelected(item: MenuItem?): Boolean {
when (item?.itemId) {
R.id.action_about -> {
val alert = alert {
title(R.string.app_name)
message(Html.fromHtml(
getString(R.string.about_message, BuildConfig.VERSION_NAME)))
icon(R.mipmap.ic_launcher)
okButton {}
}.show()
(alert.dialog?.findViewById(android.R.id.message) as TextView)
.movementMethod = LinkMovementMethod.getInstance()
}
R.id.action_config -> {
val configs = loadConfigurations().configs
val keys = configs.keys
val checked = keys.indexOf(config.params.name)
val alert = AlertDialog.Builder(this)
alert.setTitle(R.string.action_config)
alert.setSingleChoiceItems(keys.toTypedArray(), checked,
{ dialogInterface, i ->
if (i != checked) {
config = configs.getOrElse(keys.elementAt(i), defaultValue = { config })
saveConfig()
this.recreate()
}
dialogInterface.dismiss()
})
alert.setNegativeButton(android.R.string.cancel,
{ dialogInterface, i ->
dialogInterface.dismiss()
})
alert.setNeutralButton(R.string.dialog_import,
{ dialogInterface, i ->
dialogInterface.dismiss()
val intent = Intent(Intent.ACTION_GET_CONTENT)
intent.addCategory(Intent.CATEGORY_OPENABLE)
intent.type = "application/json"
startActivityForResult(intent, read_request_code)
})
alert.show()
}
}
return super.onOptionsItemSelected(item)
}
override fun onRequestPermissionsResult(requestCode: Int,
permissions: Array<out String>,
grantResults: IntArray) {
super.onRequestPermissionsResult(requestCode, permissions, grantResults)
MainActivityPermissionsDispatcher.onRequestPermissionsResult(this, requestCode, grantResults)
}
fun loadConfigurations(): Configurations {
try {
ObjectInputStream(openFileInput(configurations_data)).use {
return it.readObject() as Configurations
}
} catch (ex: FileNotFoundException) {
return Configurations()
}
}
fun loadConfig() {
try {
ObjectInputStream(openFileInput(current_config_data)).use {
config = it.readObject() as Config
}
} catch (ex: FileNotFoundException) {
config = Gson().fromJson(InputStreamReader(resources.openRawResource(R.raw.dks_1802_epd)),
Config::class.java)
saveConfig()
}
}
fun saveConfigurations(confs: Configurations) {
ObjectOutputStream(openFileOutput(configurations_data, Context.MODE_PRIVATE)).use {
it.writeObject(confs)
}
}
fun saveConfig() {
val confs = loadConfigurations()
confs.configs.put(config.params.name, config)
saveConfigurations(confs)
ObjectOutputStream(openFileOutput(current_config_data, Context.MODE_PRIVATE)).use {
it.writeObject(config)
}
}
@NeedsPermission(Manifest.permission.WRITE_EXTERNAL_STORAGE)
fun validateConfig(intent: Intent) {
val errors = StringBuilder()
val tmp: Config? = try {
Gson().fromJson(InputStreamReader(contentResolver.openInputStream(intent.data)),
Config::class.java)
} catch (jse: JsonSyntaxException) {
val cause = jse.cause
if (cause != null) {
errors.append(cause.message)
} else {
errors.append(jse.message)
}
null
}
if (tmp != null) {
with(tmp) {
if (params.name.isBlank()) {
errors.append(getString(R.string.validate_missing_param, "name"))
}
if (params.size < 1) {
errors.append(getString(R.string.validate_invalid_param, "size"))
}
if (params.star.isBlank()) {
errors.append(getString(R.string.validate_missing_param, "star"))
}
if (opts.size == 0) {
errors.append(getString(R.string.validate_missing_ops))
}
opts.forEachIndexed { i, option ->
if (option.fields.size == 0) {
errors.append(getString(R.string.validate_missing_fields, i + 1))
}
option.fields.forEachIndexed { j, field ->
if (field.size <= 0) {
errors.append(getString(R.string.validate_invalid_attr, i + 1, j + 1, "size"))
}
if (!field.alpha) {
if (field.min >= 0 || field.max >= 0) {
if (field.max < 1) {
errors.append(getString(R.string.validate_invalid_attr, i + 1, j + 1, "max"))
} else if (field.min < 0) {
errors.append(getString(R.string.validate_invalid_attr, i + 1, j + 1, "min"))
} else if (field.min > field.max) {
errors.append(getString(R.string.validate_invalid_attr, i + 1, j + 1, "max/min"))
}
}
}
}
val blank = "\\0"
val dtmf = Dtmf.mock(option, blank)
if (!Dtmf.validate(dtmf, "${MainActivity.PAUSE}${params.star}${params.hash}$blank")) {
errors.append(getString(R.string.validate_invalid_dtmf, i + 1, dtmf.replace(blank, "&#10003;")))
}
}
}
if (errors.length == 0) {
config = tmp
saveConfig()
recreate()
}
}
if (errors.length > 0) {
alert {
title(R.string.alert_config_error)
message(Html.fromHtml("$errors"))
cancelButton { }
}.show()
}
}
fun validateFields(fields: ArrayList<EditText>, size: Int): Boolean {
var isValid = true
fields.forEach {
if (it.text.isNullOrBlank()) {
it.error = getString(R.string.error_required)
isValid = false
}
}
if (size > 0 && (fields[1].text.length != size)) {
isValid = false
fields[1].error = getString(R.string.error_invalid_size, size,
getString(R.string.error_digit).plural(size))
}
return isValid
}
}

View file

@ -0,0 +1,232 @@
/*
* ProgrammingActivity.kt
*
* Copyright 2016 Erik C. Thauvin (erik@thauvin.net)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package net.thauvin.erik.android.tesremoteprogrammer
import android.Manifest
import android.content.Context
import android.content.res.ColorStateList
import android.graphics.Color
import android.graphics.Typeface
import android.os.Bundle
import android.support.design.widget.Snackbar
import android.support.v7.app.AppCompatActivity
import android.text.InputFilter
import android.text.InputType
import android.text.TextUtils
import android.text.method.DigitsKeyListener
import android.util.TypedValue
import android.view.Gravity.*
import android.view.inputmethod.EditorInfo
import android.view.inputmethod.InputMethodManager
import android.widget.EditText
import net.thauvin.erik.android.tesremoteprogrammer.filters.AlphaFilter
import net.thauvin.erik.android.tesremoteprogrammer.filters.MinMaxFilter
import net.thauvin.erik.android.tesremoteprogrammer.models.Option
import net.thauvin.erik.android.tesremoteprogrammer.models.Params
import net.thauvin.erik.android.tesremoteprogrammer.util.Dtmf
import net.thauvin.erik.android.tesremoteprogrammer.util.plural
import net.thauvin.erik.android.tesremoteprogrammer.widget.ScrollAwareFABBehavior
import org.jetbrains.anko.*
import org.jetbrains.anko.design.coordinatorLayout
import org.jetbrains.anko.design.floatingActionButton
import org.jetbrains.anko.design.textInputLayout
import org.jetbrains.anko.support.v4.nestedScrollView
import permissions.dispatcher.NeedsPermission
import permissions.dispatcher.RuntimePermissions
import java.util.*
@RuntimePermissions
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 fields = arrayListOf<EditText>()
coordinatorLayout {
textView {
padding = dip(20)
text = option.title
setTextSize(TypedValue.COMPLEX_UNIT_DIP, 20f)
typeface = Typeface.DEFAULT_BOLD
isFocusableInTouchMode = true
singleLine = true
ellipsize = TextUtils.TruncateAt.END
}
nestedScrollView {
topPadding = dip(55)
horizontalPadding = dip(20)
verticalLayout {
lparams(width = matchParent, height = wrapContent)
val it = option.fields.iterator()
while (it.hasNext()) {
val field = it.next()
textInputLayout {
horizontalPadding = dip(40)
lparams(width = matchParent)
val inputFilters: ArrayList<InputFilter> = ArrayList()
val editText = editText() {
hint = field.hint
if (field.alpha) {
inputType = InputType.TYPE_CLASS_TEXT or InputType.TYPE_TEXT_FLAG_CAP_CHARACTERS
inputFilters.add(AlphaFilter())
} else {
inputType = InputType.TYPE_CLASS_NUMBER
keyListener = DigitsKeyListener.getInstance("0,1,2,3,4,5,6,7,8,9" +
if (field.hash) ",${params.hash}" else "")
if (field.max != -1 && field.min != -1) {
inputFilters.add(MinMaxFilter(field.min, field.max, field.size))
}
}
if (field.size != -1) {
inputFilters.add(InputFilter.LengthFilter(field.size))
}
if (inputFilters.isNotEmpty()) {
filters = inputFilters.toTypedArray()
}
if (!it.hasNext()) {
imeOptions = EditorInfo.IME_ACTION_DONE
setOnEditorActionListener { v, id, event ->
if (id == EditorInfo.IME_ACTION_DONE) {
clearFocus()
val imm = getSystemService(Context.INPUT_METHOD_SERVICE) as InputMethodManager
imm.hideSoftInputFromWindow(windowToken, 0)
true
} else {
false
}
}
}
}
fields.add(editText)
}
}
}
}.lparams(width = matchParent, height = matchParent)
floatingActionButton {
imageResource = R.drawable.ic_menu_dialpad_lt
if (!option.nodial) {
backgroundTintList = ColorStateList.valueOf(Color.GRAY)
}
onClick {
if (validateFields(fields, option)) {
val dtmf = Dtmf.build(params.master, params.star, option, fields)
if (Dtmf.validate(dtmf, "${MainActivity.PAUSE}${params.star}${params.hash}")) {
startActivity<StepsActivity>(
StepsActivity.EXTRA_STEPS to "$dtmf${MainActivity.PAUSE}${params.end}".split(','))
} 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) {
if (option.nodial) {
gravity = BOTTOM or END
rightMargin = dip(16)
} else {
gravity = BOTTOM or START
leftMargin = dip(16)
}
bottomMargin = dip(16)
elevation = dip(6).toFloat()
behavior = ScrollAwareFABBehavior()
}
if (!option.nodial) {
floatingActionButton {
imageResource = R.drawable.fab_ic_call
onClick {
if (validateFields(fields, option)) {
val dtmf = Dtmf.build(params.master, params.star, option, fields)
if (Dtmf.validate(dtmf, "${MainActivity.PAUSE}${params.star}${params.hash}")) {
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) {
gravity = BOTTOM or END
bottomMargin = dip(16)
rightMargin = dip(16)
elevation = dip(6).toFloat()
behavior = ScrollAwareFABBehavior()
}
}
}
}
override fun onRequestPermissionsResult(requestCode: Int,
permissions: Array<out String>,
grantResults: IntArray) {
super.onRequestPermissionsResult(requestCode, permissions, grantResults)
ProgrammingActivityPermissionsDispatcher.onRequestPermissionsResult(this, requestCode, grantResults)
}
@NeedsPermission(Manifest.permission.CALL_PHONE)
fun call(phone: String, dtmf: String) {
info("$phone${MainActivity.PAUSE}${MainActivity.PAUSE}$dtmf")
makeCall("$phone${MainActivity.PAUSE}${MainActivity.PAUSE}$dtmf")
}
fun validateFields(fields: ArrayList<EditText>, option: Option): Boolean {
var isValid = true
fields.forEachIndexed { i, v ->
if (v.text.isNullOrBlank()) {
v.error = getString(R.string.error_required)
isValid = false
} else {
val size = option.fields[i].size
if (!option.fields[i].alpha && size > 0 && (v.length() != size)) {
v.error = getString(R.string.error_invalid_size, size,
getString(R.string.error_digit).plural(size))
isValid = false
}
}
}
return isValid
}
}

View file

@ -0,0 +1,74 @@
/*
* StepsActivity.java
*
* Copyright 2016 Erik C. Thauvin (erik@thauvin.net)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package net.thauvin.erik.android.tesremoteprogrammer;
import android.app.Fragment;
import android.app.FragmentManager;
import android.os.Bundle;
import android.support.v13.app.FragmentStatePagerAdapter;
import android.support.v4.app.FragmentActivity;
import android.support.v4.view.PagerAdapter;
import android.support.v4.view.ViewPager;
import com.viewpagerindicator.UnderlinePageIndicator;
import java.util.ArrayList;
public class StepsActivity extends FragmentActivity {
public static final String EXTRA_STEPS = "steps";
private final ArrayList<String> steps = new ArrayList<>();
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_steps);
steps.clear();
steps.addAll(getIntent().getExtras().getStringArrayList(EXTRA_STEPS));
final ViewPager pager = (ViewPager) findViewById(R.id.pager);
final PagerAdapter pagerAdapter = new StepsAdapter(getFragmentManager(), steps);
pager.setAdapter(pagerAdapter);
final UnderlinePageIndicator pageIndicator = (UnderlinePageIndicator) findViewById(R.id.indicator);
pageIndicator.setViewPager(pager, pager.getCurrentItem() - 1);
pageIndicator.setFades(false);
}
private class StepsAdapter extends FragmentStatePagerAdapter {
private final ArrayList<String> stepsArray = new ArrayList<>();
public StepsAdapter(FragmentManager fm, ArrayList<String> steps) {
super(fm);
stepsArray.clear();
stepsArray.addAll(steps);
}
@Override
public Fragment getItem(int position) {
return StepsFragment.create(position, stepsArray);
}
@Override
public int getCount() {
return stepsArray.size();
}
}
}

View file

@ -0,0 +1,67 @@
/*
* StepsFragment.java
*
* Copyright 2016 Erik C. Thauvin (erik@thauvin.net)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package net.thauvin.erik.android.tesremoteprogrammer;
import android.app.Fragment;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import java.util.ArrayList;
public class StepsFragment extends Fragment {
public static final String ARG_PAGE = "page";
private static final ArrayList<String> stepsArray = new ArrayList<>();
private int pageNumber;
public StepsFragment() {
}
public static StepsFragment create(int pageNumber, ArrayList<String> steps) {
final StepsFragment fragment = new StepsFragment();
Bundle args = new Bundle();
args.putInt(ARG_PAGE, pageNumber);
fragment.setArguments(args);
stepsArray.clear();
stepsArray.addAll(steps);
return fragment;
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
pageNumber = getArguments().getInt(ARG_PAGE);
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
final ViewGroup rootView = (ViewGroup) inflater
.inflate(R.layout.fragment_steps, container, false);
((TextView) rootView.findViewById(R.id.frag_steps_title)).setText(
getString(R.string.title_template_step, pageNumber + 1, stepsArray.size()));
((TextView) rootView.findViewById(R.id.frag_steps)).setText(stepsArray.get(pageNumber));
return rootView;
}
}

View file

@ -0,0 +1,51 @@
/*
* AlphaFilter.kt
*
* Copyright 2016 Erik C. Thauvin (erik@thauvin.net)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package net.thauvin.erik.android.tesremoteprogrammer.filters
import android.text.InputFilter
import android.text.SpannableStringBuilder
import android.text.Spanned
class AlphaFilter : InputFilter {
override fun filter(source: CharSequence,
start: Int,
end: Int,
dest: Spanned,
dstart: Int,
dend: Int): CharSequence? {
if (source is SpannableStringBuilder) {
for (i in end - 1 downTo start) {
val c = source[i]
if (!c.isLetterOrDigit() && !Character.isSpaceChar(c)) {
source.delete(i, i + 1)
}
}
return source
} else {
val sb = StringBuilder()
for (i in start..end - 1) {
val c = source[i]
if (c.isLetterOrDigit() || Character.isSpaceChar(c)) {
sb.append(c.toUpperCase())
}
}
return sb.toString()
}
}
}

View file

@ -0,0 +1,42 @@
/*
* MinMaxFilter.kt
*
* Copyright 2016 Erik C. Thauvin (erik@thauvin.net)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package net.thauvin.erik.android.tesremoteprogrammer.filters
import android.text.InputFilter
import android.text.Spanned
class MinMaxFilter : InputFilter {
private var min: Int = 0
private var max: Int = 0
private var size: Int = 0
constructor(min: Int, max: Int, size: Int) {
this.min = min
this.max = max
this.size = size
}
override fun filter(source: CharSequence, start: Int, end: Int, dest: Spanned, dstart: Int, dend: Int): CharSequence? {
val input = (dest.toString() + source.toString()).toInt()
val len = dest.length + source.length
if ((min > 0 && size > 1 && len < size && input == 0) || input in IntRange(min, max)) {
return null
}
return ""
}
}

View file

@ -0,0 +1,46 @@
/*
* Config.kt
*
* Copyright 2016 Erik C. Thauvin (erik@thauvin.net)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package net.thauvin.erik.android.tesremoteprogrammer.models
import android.os.Parcel
import android.os.Parcelable
import java.io.Serializable
data class Config(var params: Params, var opts: List<Option>) : Parcelable, Serializable {
companion object {
private @JvmStatic val serialVersionUID: Long = 1
@JvmField val CREATOR: Parcelable.Creator<Config> = object : Parcelable.Creator<Config> {
override fun createFromParcel(source: Parcel): Config = Config(source)
override fun newArray(size: Int): Array<Config?> = arrayOfNulls(size)
}
}
constructor() : this (Params(), emptyList<Option>())
constructor(source: Parcel) : this(
source.readParcelable<Params>(Params::class.java.classLoader),
source.createTypedArrayList(Option.CREATOR))
override fun describeContents() = 0
override fun writeToParcel(dest: Parcel?, flags: Int) {
dest?.writeParcelable(params, 0)
dest?.writeTypedList(opts)
}
}

View file

@ -0,0 +1,29 @@
/*
* Configurations.kt
*
* Copyright 2016 Erik C. Thauvin (erik@thauvin.net)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package net.thauvin.erik.android.tesremoteprogrammer.models
import java.io.Serializable
import java.util.*
class Configurations : Serializable {
companion object {
private @JvmStatic val serialVersionUID: Long = 1
}
val configs = HashMap<String, Config>()
}

View file

@ -0,0 +1,60 @@
/*
* Field.kt
*
* Copyright 2016 Erik C. Thauvin (erik@thauvin.net)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package net.thauvin.erik.android.tesremoteprogrammer.models
import android.os.Parcel
import android.os.Parcelable
import java.io.Serializable
data class Field(var hint: String,
var alpha: Boolean,
val hash: Boolean,
var size: Int,
var min: Int,
var max: Int) : Parcelable, Serializable {
companion object {
private @JvmStatic val serialVersionUID: Long = 1
@JvmField val CREATOR: Parcelable.Creator<Field> = object : Parcelable.Creator<Field> {
override fun createFromParcel(source: Parcel): Field = Field(source)
override fun newArray(size: Int): Array<Field?> = arrayOfNulls(size)
}
}
constructor() : this("", false, false, -1, -1, -1)
constructor(source: Parcel) : this(
source.readString(),
1.equals(source.readInt()),
1.equals(source.readInt()),
source.readInt(),
source.readInt(),
source.readInt())
override fun describeContents() = 0
override fun writeToParcel(dest: Parcel?, flags: Int) {
dest?.writeString(hint)
dest?.writeInt((if (alpha) 1 else 0))
dest?.writeInt((if (hash) 1 else 0))
dest?.writeInt(size)
dest?.writeInt(min)
dest?.writeInt(max)
}
}

View file

@ -0,0 +1,58 @@
/*
* Option.kt
*
* Copyright 2016 Erik C. Thauvin (erik@thauvin.net)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package net.thauvin.erik.android.tesremoteprogrammer.models
import android.os.Parcel
import android.os.Parcelable
import java.io.Serializable
data class Option(var title: String,
var fields: List<Field>,
var nodial: Boolean,
var dtmf: String) : Parcelable, Serializable, Comparable<Option> {
companion object {
private @JvmStatic val serialVersionUID: Long = 1
@JvmField val CREATOR: Parcelable.Creator<Option> = object : Parcelable.Creator<Option> {
override fun createFromParcel(source: Parcel): Option = Option(source)
override fun newArray(size: Int): Array<Option?> = arrayOfNulls(size)
}
}
constructor() : this("", emptyList(), false, "")
constructor(source: Parcel) : this(
source.readString(),
source.createTypedArrayList(Field.CREATOR),
1.equals(source.readInt()),
source.readString())
override fun compareTo(other: Option): Int {
return title.compareTo(other.title)
}
override fun describeContents() = 0
override fun writeToParcel(dest: Parcel?, flags: Int) {
dest?.writeString(title)
dest?.writeTypedList(fields)
dest?.writeInt((if (nodial) 1 else 0))
dest?.writeString(dtmf)
}
}

View file

@ -0,0 +1,63 @@
/*
* Params.kt
*
* Copyright 2016 Erik C. Thauvin (erik@thauvin.net)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package net.thauvin.erik.android.tesremoteprogrammer.models
import android.os.Parcel
import android.os.Parcelable
import java.io.Serializable
data class Params(var name: String,
var phone: String,
var master: String,
var size: Int,
var star: String,
var hash: String,
var end: String) : Parcelable, Serializable {
companion object {
private @JvmStatic val serialVersionUID: Long = 1
@JvmField val CREATOR: Parcelable.Creator<Params> = object : Parcelable.Creator<Params> {
override fun createFromParcel(source: Parcel): Params = Params(source)
override fun newArray(size: Int): Array<Params?> = arrayOfNulls(size)
}
}
constructor() : this("", "", "", -1, "", "", "")
constructor(source: Parcel) : this(
source.readString(),
source.readString(),
source.readString(),
source.readInt(),
source.readString(),
source.readString(),
source.readString())
override fun describeContents() = 0
override fun writeToParcel(dest: Parcel?, flags: Int) {
dest?.writeString(name)
dest?.writeString(phone)
dest?.writeString(master)
dest?.writeInt(size)
dest?.writeString(star)
dest?.writeString(hash)
dest?.writeString(end)
}
}

View file

@ -0,0 +1,123 @@
/*
* Dtmf.kt
*
* Copyright 2016 Erik C. Thauvin (erik@thauvin.net)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package net.thauvin.erik.android.tesremoteprogrammer.util
import android.widget.EditText
import net.thauvin.erik.android.tesremoteprogrammer.MainActivity
import net.thauvin.erik.android.tesremoteprogrammer.models.Option
import java.util.*
class Dtmf {
companion object {
private val DTMF_MASTER = "[MASTER]"
private val DTMF_FIELD = "[FIELD:%1\$d]"
private fun alphaToDigits(text: String, star: String): String {
val result = StringBuffer()
text.toUpperCase().forEach { c ->
when (c) {
'A' -> result.append("2$star${MainActivity.PAUSE}")
'B' -> result.append("22$star${MainActivity.PAUSE}")
'C' -> result.append("2222$star${MainActivity.PAUSE}")
'D' -> result.append("3$star${MainActivity.PAUSE}")
'E' -> result.append("33$star${MainActivity.PAUSE}")
'F' -> result.append("333$star${MainActivity.PAUSE}")
'G' -> result.append("4$star${MainActivity.PAUSE}")
'H' -> result.append("44$star${MainActivity.PAUSE}")
'I' -> result.append("444$star${MainActivity.PAUSE}")
'J' -> result.append("5$star${MainActivity.PAUSE}")
'K' -> result.append("55$star${MainActivity.PAUSE}")
'L' -> result.append("555$star${MainActivity.PAUSE}")
'M' -> result.append("6$star${MainActivity.PAUSE}")
'N' -> result.append("66$star${MainActivity.PAUSE}")
'O' -> result.append("666$star${MainActivity.PAUSE}")
'P' -> result.append("7$star${MainActivity.PAUSE}")
'Q' -> result.append("77$star${MainActivity.PAUSE}")
'R' -> result.append("777$star${MainActivity.PAUSE}")
'S' -> result.append("7777$star${MainActivity.PAUSE}")
'T' -> result.append("8$star${MainActivity.PAUSE}")
'U' -> result.append("88$star${MainActivity.PAUSE}")
'V' -> result.append("888$star${MainActivity.PAUSE}")
'W' -> result.append("9$star${MainActivity.PAUSE}")
'X' -> result.append("99$star${MainActivity.PAUSE}")
'Y' -> result.append("999$star${MainActivity.PAUSE}")
'Z' -> result.append("9999$star${MainActivity.PAUSE}")
'0' -> result.append("0$star${MainActivity.PAUSE}")
'1' -> result.append("11$star${MainActivity.PAUSE}")
'2' -> result.append("2222$star${MainActivity.PAUSE}")
'3' -> result.append("3333$star${MainActivity.PAUSE}")
'4' -> result.append("4444$star${MainActivity.PAUSE}")
'5' -> result.append("5555$star${MainActivity.PAUSE}")
'6' -> result.append("6666$star${MainActivity.PAUSE}")
'7' -> result.append("77777$star${MainActivity.PAUSE}")
'8' -> result.append("8888$star${MainActivity.PAUSE}")
'9' -> result.append("99999$star${MainActivity.PAUSE}")
' ' -> result.append("1$star${MainActivity.PAUSE}")
}
}
return result.toString()
}
fun build(master: String,
star: String,
option: Option,
fields: ArrayList<EditText>): String {
val replace = arrayListOf(Pair("$DTMF_MASTER", master))
fields.forEachIndexed { i, field ->
replace.add(Pair(DTMF_FIELD.format(i + 1),
if (option.fields[i].alpha) {
alphaToDigits(field.text.toString(), star)
} else {
field.text.toString()
}))
}
return option.dtmf.replaceAll(replace.toTypedArray())
}
fun validate(dtmf: String, extra: String): Boolean {
dtmf.forEach {
if (!(it.isDigit() || it.equals(',') || extra.contains(it))) {
return false
}
}
return true
}
fun mock(option: Option, blank: String): String {
val replace = arrayListOf(Pair("$DTMF_MASTER", blank))
option.fields.forEachIndexed { i, field ->
replace.add(Pair(DTMF_FIELD.format(i + 1), blank))
}
return option.dtmf.replaceAll(replace.toTypedArray())
}
}
}

View file

@ -0,0 +1,56 @@
/*
* Strings.kt
*
* Copyright 2016 Erik C. Thauvin (erik@thauvin.net)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package net.thauvin.erik.android.tesremoteprogrammer.util
fun String.plural(size: Int): String {
val consonants = "bcdfghjklmnpqrstvwxz"
if (size > 1 && this.length > 2) {
if ((this.endsWith("o", true) || this.endsWith("s", true)) &&
consonants.contains(this[this.length - 2], true)) {
return this + "es"
}
if (this.endsWith("y", true) &&
consonants.contains(this[this.length - 2], true)) {
return this + "ies"
}
}
return this + "s"
}
fun String.replaceAll(replace: Array<Pair<String, String>>): String {
val result = StringBuilder(this)
var offset: Int
replace.forEach {
with(it) {
if (first.isNotEmpty()) {
offset = result.indexOf(first)
while (offset != -1) {
result.replace(offset, first.length + offset, second)
offset = result.indexOf(first, offset + second.length)
}
}
}
}
return result.toString()
}

View file

@ -0,0 +1,49 @@
/*
* ScrollAwareFABBehavior.kt
*
* Copyright 2016 Erik C. Thauvin (erik@thauvin.net)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package net.thauvin.erik.android.tesremoteprogrammer.widget
import android.support.design.widget.CoordinatorLayout
import android.support.design.widget.FloatingActionButton
import android.support.v4.view.ViewCompat
import android.view.View
class ScrollAwareFABBehavior() : FloatingActionButton.Behavior() {
override fun onStartNestedScroll(coordinatorLayout: CoordinatorLayout?,
child: FloatingActionButton?,
directTargetChild: View?,
target: View?,
nestedScrollAxes: Int): Boolean {
return nestedScrollAxes == ViewCompat.SCROLL_AXIS_VERTICAL ||
super.onStartNestedScroll(coordinatorLayout, child, directTargetChild, target, nestedScrollAxes)
}
override fun onNestedScroll(coordinatorLayout: CoordinatorLayout?,
child: FloatingActionButton?,
target: View?,
dxConsumed: Int,
dyConsumed: Int,
dxUnconsumed: Int,
dyUnconsumed: Int) {
super.onNestedScroll(coordinatorLayout, child, target, dxConsumed, dyConsumed, dxUnconsumed, dyUnconsumed)
if (dyConsumed > 0 && child!!.visibility == View.VISIBLE) {
child.hide()
} else if (dyConsumed < 0 && child!!.visibility != View.VISIBLE) {
child.show()
}
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 572 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 326 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 390 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 438 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 244 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 272 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 681 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 408 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 893 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 445 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 670 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 574 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 225 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 634 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 905 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 758 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 788 B

View file

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<android.support.v4.view.ViewPager xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/pager"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"/>
<com.viewpagerindicator.UnderlinePageIndicator
android:id="@+id/indicator"
style="@style/UnderlinePageIndicator"
android:layout_width="match_parent"
android:layout_height="5dp" />
</LinearLayout>

View file

@ -0,0 +1,35 @@
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/content"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="16dp"
android:weightSum="1"
android:orientation="vertical">
<TextView
android:id="@+id/frag_steps_title"
style="?android:textAppearanceLarge"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="16dp"
android:textStyle="bold" />
<TextView
android:id="@+id/frag_steps"
style="?android:textAppearanceLarge"
android:layout_width="match_parent"
android:layout_height="0dp"
android:lineSpacingMultiplier="1.2"
android:gravity="center"
android:text=""
android:layout_weight="0.8"
android:textSize="78sp" />
</LinearLayout>
</ScrollView>

View file

@ -0,0 +1,15 @@
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
tools:context=".MainActivity">
<item
android:id="@+id/action_config"
android:orderInCategory="100"
android:title="@string/action_config"
app:showAsAction="never" />
<item
android:id="@+id/action_about"
android:orderInCategory="101"
android:title="@string/action_about"
app:showAsAction="never" />
</menu>

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

View file

@ -0,0 +1,272 @@
{
"params": {
"name": "DKS 1802-EPD",
"star": "*",
"hash": "#",
"end": "0 + #",
"size": 4
},
"opts": [
{
"title": "Set Relay Strike Time",
"fields": [
{
"hint": "Relay (1 or 2)",
"min": 1,
"max": 2,
"size": 1
},
{
"hint": "Strike Time (00=1/4...99 seconds)",
"min": 0,
"max": 99,
"size": 2
}
],
"dtmf": "*03[MASTER],[FIELD:1]*,[FIELD:2]*"
},
{
"title": "Set Open Tone On/Off",
"fields": [
{
"hint": "1=ON 0=OFF",
"min": 0,
"max": 1,
"size": 1
}
],
"dtmf": "*17[MASTER],[FIELD:1]*"
},
{
"title": "Set Talk Time",
"fields": [
{
"hint": "001-255 seconds",
"min": 1,
"max": 255,
"size": 3
}
],
"dtmf": "*08[MASTER],[FIELD:1]*"
},
{
"title": "Set Number of Rings to Answer",
"fields": [
{
"hint": "Number of Rings",
"min": 1,
"max": 99,
"size": 2
}
],
"dtmf": "*18[MASTER],[FIELD:1]*"
},
{
"title": "Set PBX Line Access Code",
"fields": [
{
"hint": "Line Access Code Number",
"min": 1,
"max": 9,
"size": 1
}
],
"dtmf": "*21[MASTER],[FIELD:1]*"
},
{
"title": "Delete 4-Digit Entry Code",
"fields": [
{
"hint": "Entry Code",
"size": 4
}
],
"dtmf": "*14[MASTER],[FIELD:1]*"
},
{
"title": "Add 4-Digit Entry Code",
"fields": [
{
"hint": "Entry Code",
"size": 4
}
],
"dtmf": "*02[MASTER],[FIELD:1]*"
},
{
"title": "Add Name",
"fields": [
{
"hint": "Directory Code",
"size": 3
},
{
"hint": "Name",
"alpha": true,
"size": 11
}
],
"nodial": true,
"dtmf": "*66[MASTER],[FIELD:1]*,[FIELD:2]*"
},
{
"title": "Add 7-digit Phone Number",
"fields": [
{
"hint": "Directory Code",
"size": 3
},
{
"hint": "Phone Number",
"hash": true,
"size": 7
}
],
"dtmf": "*01[MASTER],[FIELD:1]*,[FIELD:2]*"
},
{
"title": "Set Area Codes",
"fields": [
{
"hint": "2-Digit Area Code Ref Number",
"min": 1,
"max" : 15,
"size": 2
},
{
"hint": "Area Code (e.g. 1800 or #800)",
"hash" : true,
"size": 4,
"min": 1,
"max": 15
}
],
"dtmf": "*24[MASTER],[FIELD:1]*,[FIELD:2]*"
},
{
"title": "Add Phone Number w/ Area Code",
"fields": [
{
"hint": "Directory Code",
"size": 3
},
{
"hint": "Area Code",
"size": 2,
"min": 1,
"max": 15
},
{
"hint": "Phone Number",
"hash": true,
"size": 7
}
],
"dtmf": "*41[MASTER],[FIELD:1]*,[FIELD:2]*,[FIELD:3]*"
},
{
"title": "Remote Relay Activation",
"fields": [
{
"hint": "Open=9, Hold=8, Release=7, 1hr=6",
"size": 1,
"min": 6,
"max": 9
}
],
"dtmf": "*16[MASTER],[FIELD:1]*"
},
{
"title": "Set Welcome Message",
"fields": [
{
"hint": "Message (Line 1)",
"size": 16,
"alpha" : true
},
{
"hint": "Message (Line 2)",
"size": 16,
"alpha" : true
},
{
"hint": "Message (Line 3)",
"size": 16,
"alpha" : true
}
],
"nodial": true,
"dtmf": "*80[MASTER],[FIELD:1]*,[FIELD:2]*,[FIELD:3]*"
},
{
"title": "Set Instruction Message",
"fields": [
{
"hint": "Message (Line 1)",
"size": 16,
"alpha" : true
},
{
"hint": "Message (Line 2)",
"size": 16,
"alpha" : true
},
{
"hint": "Message (Line 3)",
"size": 16,
"alpha" : true
}
],
"nodial": true,
"dtmf": "*81[MASTER],[FIELD:1]*,[FIELD:2]*,[FIELD:3]*"
},
{
"title": "Set Time Clock",
"fields": [
{
"hint": "Hour (01..12)",
"size": 2,
"min": 1,
"max": 12
},
{
"hint": "Minutes (00..59)",
"size": 2,
"min": 0,
"max": 59
},
{
"hint": "AM=0 PM=1",
"size": 1,
"min": 0,
"max": 1
},
{
"hint": "Month (01..12)",
"size": 2,
"min": 1,
"max": 12
},
{
"hint": "Day of Month (01..31)",
"size": 2,
"min": 1,
"max": 31
},
{
"hint": "Year (Even=00, Odd=01)",
"size": 2,
"min": 0,
"max": 1
},
{
"hint": "Day of Week (Sun=1..Sat=7)",
"size": 1,
"min": 1,
"max": 7
}
],
"dtmf": "*33[MASTER],[FIELD:1][FIELD:2]*,[FIELD:3]*,[FIELD:4]*,[FIELD:5]*,[FIELD:6]*,[FIELD:7]*"
}
]
}

View file

@ -0,0 +1,6 @@
<resources>
<!-- Example customization of dimensions originally defined in res/values/dimens.xml
(such as screen margins) for screens with more than 820dp of available width. This
would include 7" and 10" devices in landscape (~960dp and ~1280dp respectively). -->
<dimen name="activity_horizontal_margin">64dp</dimen>
</resources>

View file

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="colorPrimary">#3F51B5</color>
<color name="colorPrimaryDark">#303F9F</color>
<color name="colorAccent">#3F51B5</color>
</resources>

View file

@ -0,0 +1,5 @@
<resources>
<!-- Default screen margins, per the Android Design guidelines. -->
<dimen name="activity_horizontal_margin">16dp</dimen>
<dimen name="activity_vertical_margin">16dp</dimen>
</resources>

View file

@ -0,0 +1,23 @@
<resources xmlns:xliff="http://schemas.android.com/tools">
<string name="about_message">&lt;p>&lt;b>Version <xliff:g id="type">%1$s</xliff:g>&lt;/b>&lt;/p>&lt;p>Developed by &lt;a href=\"http://erik.thauvin.net/\">&lt;b>Erik C. Thauvin&lt;/b>&lt;/a>. See all my apps &lt;a href=\"http://mobile.thauvin.net/android/\">&lt;b>here&lt;/b>&lt;/a>.&lt;/p>&lt;a href=\"http://m.thauvin.net/android\">&lt;b>m.thauvin.net/android&lt;/b>&lt;/a></string>
<string name="action_about">About</string>
<string name="action_config">Configurations</string>
<string name="alert_config_error">Configuration Errors</string>
<string name="app_name">TES Remote Programmer</string>
<string name="dialog_import">Import</string>
<string name="error_digit">digit</string>
<string name="error_invalid_dtmf">Invalid DTMF: <xliff:g id="type">%1$s</xliff:g></string>
<string name="error_invalid_field">Missing or invalid fields data.</string>
<string name="error_invalid_size">Invalid: <xliff:g id="size">%1$d</xliff:g> <xliff:g id="type">%2$s</xliff:g> required</string>
<string name="error_required">Required</string>
<string name="hint_master_code">Master Code</string>
<string name="hint_phone_number">Phone Number</string>
<string name="programming_heading">PROGRAMMING</string>
<string name="title_template_step">Step <xliff:g id="step_number">%1$d</xliff:g> of <xliff:g id="steps_count">%2$d</xliff:g></string>
<string name="validate_invalid_attr">&lt;p>&lt;b>opts[<xliff:g id="opts">%1$d</xliff:g>]&lt;/b>, &lt;b>fields[<xliff:g id="field">%2$d</xliff:g>]&lt;/b>: &lt;font color=\"red\"><xliff:g id="attr">%3$s</xliff:g>&lt;/font> invalid</string>
<string name="validate_invalid_dtmf">&lt;p>&lt;b>opts[<xliff:g id="opts">%1$d</xliff:g>]&lt;/b>, &lt;font color=\"red\">dtmf&lt;/font> invalid:&lt;br>&#160;&#160;&#160;&#160;&lt;font color=\"red\">&lt;small><xliff:g id="dtmf">%2$s</xliff:g>&lt;/small>&lt;/font>&lt;/p></string>
<string name="validate_invalid_param">&lt;p>&lt;b>params&lt;/b>: &lt;font color=\"red\"><xliff:g id="param">%1$s</xliff:g>&lt;/font> invalid&lt;/p></string>
<string name="validate_missing_fields">&lt;p>&lt;b>opts[<xliff:g id="opts">%1$d</xliff:g>]&lt;/b>: &lt;font color=\"red\">fields&lt;/font> missing</string>
<string name="validate_missing_param">&lt;p>&lt;p>&lt;b>params&lt;/b>: &lt;font color=\"red\"><xliff:g id="param">%1$s</xliff:g>&lt;/font> missing&lt;/p></string>
<string name="validate_missing_ops">&lt;font color=\"red\">opts&lt;/font> missing.</string>
</resources>

View file

@ -0,0 +1,13 @@
<resources>
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
</style>
<style name="UnderlinePageIndicator">
<item name="selectedColor">@color/colorAccent</item>
</style>
</resources>

View file

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<full-backup-content>
<include domain="file" path="configurations.dat"/>
<include domain="file" path="config.dat"/>
</full-backup-content>

25
build.gradle Normal file
View file

@ -0,0 +1,25 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext.kotlin_version = '1.0.3'
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.1.2'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}

18
gradle.properties Normal file
View file

@ -0,0 +1,18 @@
# Project-wide Gradle settings.
# IDE (e.g. Android Studio) users:
# Gradle settings configured through the IDE *will override*
# any settings specified in this file.
# For more details on how to configure your build environment visit
# http://www.gradle.org/docs/current/userguide/build_environment.html
# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
# Default value: -Xmx10248m -XX:MaxPermSize=256m
# org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true

BIN
gradle/wrapper/gradle-wrapper.jar vendored Normal file

Binary file not shown.

View file

@ -0,0 +1,6 @@
#Mon Dec 28 10:00:20 PST 2015
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.10-all.zip

160
gradlew vendored Normal file
View file

@ -0,0 +1,160 @@
#!/usr/bin/env bash
##############################################################################
##
## Gradle start up script for UN*X
##
##############################################################################
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS=""
APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"
warn ( ) {
echo "$*"
}
die ( ) {
echo
echo "$*"
echo
exit 1
}
# OS specific support (must be 'true' or 'false').
cygwin=false
msys=false
darwin=false
case "`uname`" in
CYGWIN* )
cygwin=true
;;
Darwin* )
darwin=true
;;
MINGW* )
msys=true
;;
esac
# Attempt to set APP_HOME
# Resolve links: $0 may be a link
PRG="$0"
# Need this for relative symlinks.
while [ -h "$PRG" ] ; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
PRG="$link"
else
PRG=`dirname "$PRG"`"/$link"
fi
done
SAVED="`pwd`"
cd "`dirname \"$PRG\"`/" >/dev/null
APP_HOME="`pwd -P`"
cd "$SAVED" >/dev/null
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
# Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables
JAVACMD="$JAVA_HOME/jre/sh/java"
else
JAVACMD="$JAVA_HOME/bin/java"
fi
if [ ! -x "$JAVACMD" ] ; then
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
else
JAVACMD="java"
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
# Increase the maximum file descriptors if we can.
if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
MAX_FD_LIMIT=`ulimit -H -n`
if [ $? -eq 0 ] ; then
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
MAX_FD="$MAX_FD_LIMIT"
fi
ulimit -n $MAX_FD
if [ $? -ne 0 ] ; then
warn "Could not set maximum file descriptor limit: $MAX_FD"
fi
else
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
fi
fi
# For Darwin, add options to specify how the application appears in the dock
if $darwin; then
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
fi
# For Cygwin, switch paths to Windows format before running java
if $cygwin ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
JAVACMD=`cygpath --unix "$JAVACMD"`
# We build the pattern for arguments to be converted via cygpath
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
SEP=""
for dir in $ROOTDIRSRAW ; do
ROOTDIRS="$ROOTDIRS$SEP$dir"
SEP="|"
done
OURCYGPATTERN="(^($ROOTDIRS))"
# Add a user-defined pattern to the cygpath arguments
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
fi
# Now convert the arguments - kludge to limit ourselves to /bin/sh
i=0
for arg in "$@" ; do
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
else
eval `echo args$i`="\"$arg\""
fi
i=$((i+1))
done
case $i in
(0) set -- ;;
(1) set -- "$args0" ;;
(2) set -- "$args0" "$args1" ;;
(3) set -- "$args0" "$args1" "$args2" ;;
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
esac
fi
# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
function splitJvmOpts() {
JVM_OPTS=("$@")
}
eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"

90
gradlew.bat vendored Normal file
View file

@ -0,0 +1,90 @@
@if "%DEBUG%" == "" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
@rem
@rem ##########################################################################
@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS=
set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto init
echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto init
echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:init
@rem Get command-line arguments, handling Windowz variants
if not "%OS%" == "Windows_NT" goto win9xME_args
if "%@eval[2+2]" == "4" goto 4NT_args
:win9xME_args
@rem Slurp the command line arguments.
set CMD_LINE_ARGS=
set _SKIP=2
:win9xME_args_slurp
if "x%~1" == "x" goto execute
set CMD_LINE_ARGS=%*
goto execute
:4NT_args
@rem Get arguments from the 4NT Shell from JP Software
set CMD_LINE_ARGS=%$
:execute
@rem Setup the command line
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
:end
@rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd
:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
exit /b 1
:mainEnd
if "%OS%"=="Windows_NT" endlocal
:omega

BIN
images/1802-epd.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 52 KiB

BIN
images/1802-epd.skp Normal file

Binary file not shown.

3033
images/feature_graphic.pdn Normal file

File diff suppressed because one or more lines are too long

BIN
images/feature_graphic.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 903 KiB

BIN
images/gate.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 262 KiB

161
images/promo_graphic.pdn Normal file

File diff suppressed because one or more lines are too long

BIN
images/promo_graphic.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 47 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 65 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 87 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 74 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 84 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 89 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 35 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 MiB

BIN
images/web_hi_res_512.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 40 KiB

1
settings.gradle Normal file
View file

@ -0,0 +1 @@
include ':app'