diff --git a/.gitignore b/.gitignore
index 1ee9933..2a182d8 100644
--- a/.gitignore
+++ b/.gitignore
@@ -41,3 +41,6 @@ captures/
*.jks
.DS_Store
+
+signing.properties
+credentials.tar
diff --git a/.travis.yml b/.travis.yml
new file mode 100644
index 0000000..c536331
--- /dev/null
+++ b/.travis.yml
@@ -0,0 +1,65 @@
+# Possible Issues:
+#
+# .gradlw permission denied:
+# git update-index --chmod=+x gradlew //http://stackoverflow.com/questions/33820638/travis-yml-gradlew-permission-denied
+
+language: android
+dist: trusty
+
+android:
+ components:
+ - tools # to get the new `repository-11.xml`
+ - platform-tools
+ - tools # to install Android SDK tools 25.1.x (x = 6 right now)
+ - build-tools-29.0.2
+ - android-29
+ - extra-google-m2repository
+ - extra-android-m2repository
+ licenses:
+ - 'android-sdk-preview-license-.+'
+ - 'android-sdk-license-.+'
+ - 'google-gdk-license-.+'
+
+jobs:
+ include:
+ - stage: buildDefault
+ if: (type IN (push))
+ before_install:
+ - openssl aes-256-cbc -K $encrypted_ff9a2399977b_key -iv $encrypted_ff9a2399977b_iv -in credentials.tar.enc -out credentials.tar -d
+ - tar xvf credentials.tar
+ - mkdir "$ANDROID_HOME/licenses" || true
+ - echo -e "\n8933bad161af4178b1185d1a37fbf41ea5269c55\nd56f5187479451eabf01fb78af6dfcb131a6481e" > "$ANDROID_HOME/licenses/android-sdk-license"
+ - echo -e "\n504667f4c0de7af1a06de9f4b1727b84351f2910" > "$ANDROID_HOME/licenses/android-sdk-preview-license"
+ script:
+ - ./gradlew clean :app:assemble --stacktrace
+ deploy:
+ - provider: releases
+ api_key:
+ secure: "SmQRgiyIuHV4CX0kPdFq0pvAo5fKELb3nloPfbSW1T2i4okntfM0Mx5XGwpS+QTkZRl4ZeiyLynPMI6JAQ2fDvtqzaEZsOyudiYNS2uVc8JCs8hCg+fBC/5ZNaG2hHUNGhczj0/Tn/m+52DSzz/DsGZLIWkFpaNw7VuzkHVAajH1RpZ22TswCReUUK
+ Pi2JJ/AiBcOQXVOc8afBVI+ciR5FytElNVmL/Kee11KFVh8/OKOgsXRwIZpkxu9WGkpFyZR3+E2lSJmBO/Tm4vNMEjNJIQKBRoujVR5exnJxYXQTcy1uMT0hkGI55gQfMOdGn1VavoImih9A8/QfR9Oxiwm/DWYXAwIozCNlqi6Ebzx5MkRuEEEyqB91Xhj37WsnA
+ P3YEwBupuxrySLdXp8nLqaU44389N/GeVn8hf8tTpERBPygGAvWmFg/Dtj01J9AokpcJm1f2jd+1II81uo0h3thS5UWCkoNb46Z5qW02chVvYnEnwr+n/wZxz1Xem0gLwV8SBIVxmFiPUzM2aAkWPhULqFkefWwTqDTL3rsQWl4Z41mnoQKK2B1qMsRq938hCIqDQ
+ pE8fHWykOmDOiUCHy5VhGp0oP09cjPMRZvQIZSqR53kjNHsQjJLXXWdHViS+OecGuU1NafND8A6VavkRWUeTDYp3E3p1X33wkwJGtAk="
+ file_glob: true
+ file:
+ - 'app/build/outputs/apk/release/*.apk'
+ skip_cleanup: true
+ on:
+ branch: master
+ tags: true
+
+before_cache:
+ - rm -f $HOME/.gradle/caches/modules-2/modules-2.lock
+ - rm -fr $HOME/.gradle/caches/*/plugin-resolution/
+
+cache:
+ directories:
+ - $HOME/.gradle/caches/
+ - $HOME/.gradle/wrapper/
+
+notifications:
+ slack:
+ secure: "RYZvoEgWQNu5fJdLoNcBJ/htE0/aYi6ORLdih25g4R8EUHYhucFRMu1K0VEyxWErCSei4anyq5mxlnOjL/SIhNo3HrS/Jzu0uirj2jWsAYtzOfxtrfzsY3S6f0CFjS2f3bbbgXwAu+3NVLMYkMB7HigB7pCDP2Cs+7B9Z37NUuMsf063BUFtOQklzH
+ vRQDOULhN+yMmOFhP9Ivd4NtXnQySFHfu593CP7w3trzfH9zGy+7pYc3NV0xoX+jwy62s6E71MH3wOQBrZxLfdCtOsKWbS2kYT7M8kqEoqK6P1yCp0ZeexN3NZbIuGNISTjcaOR31lZLVZP6a/04xwO9/NNXVTeiq193xfRHxJrz0n8bC6rXzYlvALWwQYUxOzPgy
+ AEc8vbYKSGGPWOU86/T36/UXgOG+aCg/VAt/+ftZqVH4eB7yuM9NMICOHvTCMWm4IcHb41DQLwG6FfdcgOLW8m/YWuFSdWTbJJuCzPzzkCaVpYxEg3M1qfrWauoHgkUlyMESEf2dHU9BlvegPuJAFC/6TI8b63WDr87/4DvMZnK4GWtEqpfo7+EJ8fTQg95QMB8ku
+ qyJSVCn8MOINK/736qF2xrh31FDyK1ulp7wxwkoXQlg4vHTAQLiRfqObdTDUBjOkxpDPj1Fuh0b55w3rJ+b1f+UJqDpkvjuLJwFBZLg="
+ email: false
diff --git a/CHANGELOG b/CHANGELOG
new file mode 100644
index 0000000..927196e
--- /dev/null
+++ b/CHANGELOG
@@ -0,0 +1,10 @@
+# Releases
+
+## v1.3.0
+* update to SDK 29
+* update launcher icon
+* update application id to `at.favre.mtcdialer`
+* add CI build
+
+## v1.2.2
+ * initial release (fork version) -> https://github.com/f1xpl/MtcDialer/releases
diff --git a/LICENSE b/LICENSE
new file mode 100644
index 0000000..d776e6f
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,201 @@
+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 2019 Patrick Favre-Bulle
+
+ 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.
diff --git a/README.md b/README.md
index e11a531..49875da 100644
--- a/README.md
+++ b/README.md
@@ -1,21 +1,27 @@
-#Preconditions:
+# MCTD Dailer
-####Google Services needs to be updated and active (it is recommended to use the newest version from Play Store)
+Make hands-free phone calls on MTCD (Microntek) head unit.
-#How to use it:
-####1. Install and run the app.
->*First run (after device boot) can take a while to connect to Microntek Bluetooth Service (Phonebook needs to be fetched), so please be patient.*
+[![GitHub release](https://img.shields.io/github/release/patrickfav/MtcDialer.svg)](https://github.com/patrickfav/MtcDialer/releases/latest)
+[![Build Status](https://travis-ci.org/patrickfav/MtcDialer.svg?branch=master)](https://travis-ci.org/patrickfav/MtcDialer)
-####2. When a connection to the Bluetooth Service is established, then the Google Speech Recognition activity should appear. It means that application is ready to go.
+## Preconditions
-#Speech input:
+* Google Services needs to be updated and active (it is recommended to use the newest version from Play Store)
+
+## How to use it
+1. Install and run the app. *First run (after device boot) can take a while to connect to Microntek Bluetooth Service (Phonebook needs to be fetched), so please be patient.*
+
+2. When a connection to the Bluetooth Service is established, then the Google Speech Recognition activity should appear. It means that application is ready to go.
+
+## Speech input
To make a call just say a name of the contact stored in your PhoneBook, e.g. "Mom" or "Britney Spears" (if you have one :D) or say some digits, e.g. "One One One Seven Six Five Four Two Zero".
If the name of a contact has been found in your PhoneBook or provided digits input is valid phone number, then MtcDialer will try to make a call.
-#Integration with Google Voice Assistant (Google Now, "Ok, Google"):
+## Integration with Google Voice Assistant (Google Now, "Ok, Google"):
There is possibility to set the MtcDialer as a default Google Voice Assistant dialer app. Just do it in Google app settings.
-#Integration with MtcdTools:
+## Integration with MtcdTools
MtcDialer is a regular app. In order to use it with MtcdTools just declare a Launch Action for MtcDialer. Then you bind the action to the desired key or execute it by a voice command.
diff --git a/app/build.gradle b/app/build.gradle
index 3729254..2d3ecd4 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -1,29 +1,53 @@
apply plugin: 'com.android.application'
+Properties localProps = getSigningProperties()
+
android {
- compileSdkVersion 25
- buildToolsVersion '25.0.0'
+ compileSdkVersion rootProject.ext.compileSdkVersion
+ buildToolsVersion rootProject.ext.buildToolsVersion
+
+ signingConfigs {
+ release {
+ storeFile file(localProps.getProperty('RELEASE_KEYSTORE_PATH','fillhere'))
+ storePassword localProps.getProperty('RELEASE_KEYSTORE_PW','')
+ keyAlias localProps.getProperty('RELEASE_KEY_ALIAS','')
+ keyPassword localProps.getProperty('RELEASE_KEY_PW','')
+ }
+ }
+
defaultConfig {
- applicationId "com.f1x.mtcdialer"
- minSdkVersion 21
- targetSdkVersion 25
- versionCode 1
- versionName "1.2.2"
+ applicationId "at.favre.mtcdialer"
+
+ minSdkVersion rootProject.ext.minSdkVersion
+ targetSdkVersion rootProject.ext.targetSdkVersion
+ versionCode rootProject.ext.versionCode
+ versionName rootProject.ext.versionNameApp
+
+ archivesBaseName = "$applicationId-$versionName"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
+
+ compileOptions {
+ encoding "UTF-8"
+ sourceCompatibility rootProject.ext.javaVersion
+ targetCompatibility rootProject.ext.javaVersion
+ }
+
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
+ signingConfig signingConfigs.release
}
}
}
dependencies {
- compile fileTree(dir: 'libs', include: ['*.jar'])
- androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
+ api 'com.android.support:appcompat-v7:28.0.0'
+
+ testImplementation "junit:junit:$rootProject.ext.dependencies.junit"
+
+ androidTestImplementation(group: 'com.android.support.test.espresso', name: 'espresso-core', version: rootProject.ext.dependencies.espresso, {
exclude group: 'com.android.support', module: 'support-annotations'
})
- compile 'com.android.support:appcompat-v7:25.1.1'
- testCompile 'junit:junit:4.12'
}
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 120bb97..af14871 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -34,6 +34,8 @@
+
+
\ No newline at end of file
diff --git a/app/src/main/ic_launcher-web.png b/app/src/main/ic_launcher-web.png
deleted file mode 100644
index d28d49b..0000000
Binary files a/app/src/main/ic_launcher-web.png and /dev/null differ
diff --git a/app/src/main/java/android/microntek/mtcser/BTServiceInf.java b/app/src/main/java/android/microntek/mtcser/BTServiceInf.java
index 2b3d896..b97c0da 100644
--- a/app/src/main/java/android/microntek/mtcser/BTServiceInf.java
+++ b/app/src/main/java/android/microntek/mtcser/BTServiceInf.java
@@ -115,7 +115,7 @@ public long getNowDevAddr() throws RemoteException {
Parcel _reply = Parcel.obtain();
try {
_data.writeInterfaceToken("android.microntek.mtcser.BTServiceInf");
- this.mRemote.transact(7, _data, _reply, 0);
+ this.mRemote.transact(11, _data, _reply, 0);
_reply.readException();
long _result = _reply.readLong();
return _result;
@@ -130,7 +130,7 @@ public String getNowDevName() throws RemoteException {
Parcel _reply = Parcel.obtain();
try {
_data.writeInterfaceToken("android.microntek.mtcser.BTServiceInf");
- this.mRemote.transact(8, _data, _reply, 0);
+ this.mRemote.transact(12, _data, _reply, 0);
_reply.readException();
String _result = _reply.readString();
return _result;
@@ -145,7 +145,7 @@ public void avPlayPause() throws RemoteException {
Parcel _reply = Parcel.obtain();
try {
_data.writeInterfaceToken("android.microntek.mtcser.BTServiceInf");
- this.mRemote.transact(9, _data, _reply, 0);
+ this.mRemote.transact(15, _data, _reply, 0);
_reply.readException();
} finally {
_reply.recycle();
@@ -158,7 +158,7 @@ public void avPlayStop() throws RemoteException {
Parcel _reply = Parcel.obtain();
try {
_data.writeInterfaceToken("android.microntek.mtcser.BTServiceInf");
- this.mRemote.transact(10, _data, _reply, 0);
+ this.mRemote.transact(16, _data, _reply, 0);
_reply.readException();
} finally {
_reply.recycle();
@@ -171,7 +171,7 @@ public void avPlayPrev() throws RemoteException {
Parcel _reply = Parcel.obtain();
try {
_data.writeInterfaceToken("android.microntek.mtcser.BTServiceInf");
- this.mRemote.transact(11, _data, _reply, 0);
+ this.mRemote.transact(17, _data, _reply, 0);
_reply.readException();
} finally {
_reply.recycle();
@@ -184,7 +184,7 @@ public void avPlayNext() throws RemoteException {
Parcel _reply = Parcel.obtain();
try {
_data.writeInterfaceToken("android.microntek.mtcser.BTServiceInf");
- this.mRemote.transact(12, _data, _reply, 0);
+ this.mRemote.transact(18, _data, _reply, 0);
_reply.readException();
} finally {
_reply.recycle();
@@ -197,7 +197,7 @@ public void answerCall() throws RemoteException {
Parcel _reply = Parcel.obtain();
try {
_data.writeInterfaceToken("android.microntek.mtcser.BTServiceInf");
- this.mRemote.transact(13, _data, _reply, 0);
+ this.mRemote.transact(19, _data, _reply, 0);
_reply.readException();
} finally {
_reply.recycle();
@@ -210,7 +210,7 @@ public void hangupCall() throws RemoteException {
Parcel _reply = Parcel.obtain();
try {
_data.writeInterfaceToken("android.microntek.mtcser.BTServiceInf");
- this.mRemote.transact(14, _data, _reply, 0);
+ this.mRemote.transact(20, _data, _reply, 0);
_reply.readException();
} finally {
_reply.recycle();
@@ -223,7 +223,7 @@ public void rejectCall() throws RemoteException {
Parcel _reply = Parcel.obtain();
try {
_data.writeInterfaceToken("android.microntek.mtcser.BTServiceInf");
- this.mRemote.transact(15, _data, _reply, 0);
+ this.mRemote.transact(21, _data, _reply, 0);
_reply.readException();
} finally {
_reply.recycle();
@@ -236,7 +236,7 @@ public void switchVoice() throws RemoteException {
Parcel _reply = Parcel.obtain();
try {
_data.writeInterfaceToken("android.microntek.mtcser.BTServiceInf");
- this.mRemote.transact(16, _data, _reply, 0);
+ this.mRemote.transact(26, _data, _reply, 0);
_reply.readException();
} finally {
_reply.recycle();
@@ -249,7 +249,7 @@ public void syncPhonebook() throws RemoteException {
Parcel _reply = Parcel.obtain();
try {
_data.writeInterfaceToken("android.microntek.mtcser.BTServiceInf");
- this.mRemote.transact(17, _data, _reply, 0);
+ this.mRemote.transact(27, _data, _reply, 0);
_reply.readException();
} finally {
_reply.recycle();
@@ -262,7 +262,7 @@ public String getModuleName() throws RemoteException {
Parcel _reply = Parcel.obtain();
try {
_data.writeInterfaceToken("android.microntek.mtcser.BTServiceInf");
- this.mRemote.transact(18, _data, _reply, 0);
+ this.mRemote.transact(28, _data, _reply, 0);
_reply.readException();
String _result = _reply.readString();
return _result;
@@ -277,7 +277,7 @@ public String getModulePassword() throws RemoteException {
Parcel _reply = Parcel.obtain();
try {
_data.writeInterfaceToken("android.microntek.mtcser.BTServiceInf");
- this.mRemote.transact(19, _data, _reply, 0);
+ this.mRemote.transact(29, _data, _reply, 0);
_reply.readException();
String _result = _reply.readString();
return _result;
@@ -293,7 +293,7 @@ public void setModuleName(String name) throws RemoteException {
try {
_data.writeInterfaceToken("android.microntek.mtcser.BTServiceInf");
_data.writeString(name);
- this.mRemote.transact(20, _data, _reply, 0);
+ this.mRemote.transact(30, _data, _reply, 0);
_reply.readException();
} finally {
_reply.recycle();
@@ -307,7 +307,7 @@ public void setModulePassword(String password) throws RemoteException {
try {
_data.writeInterfaceToken("android.microntek.mtcser.BTServiceInf");
_data.writeString(password);
- this.mRemote.transact(21, _data, _reply, 0);
+ this.mRemote.transact(31, _data, _reply, 0);
_reply.readException();
} finally {
_reply.recycle();
@@ -325,7 +325,7 @@ public void setAutoConnect(boolean auto) throws RemoteException {
i = 1;
}
_data.writeInt(i);
- this.mRemote.transact(22, _data, _reply, 0);
+ this.mRemote.transact(32, _data, _reply, 0);
_reply.readException();
} finally {
_reply.recycle();
@@ -339,7 +339,7 @@ public boolean getAutoConnect() throws RemoteException {
Parcel _reply = Parcel.obtain();
try {
_data.writeInterfaceToken("android.microntek.mtcser.BTServiceInf");
- this.mRemote.transact(23, _data, _reply, 0);
+ this.mRemote.transact(33, _data, _reply, 0);
_reply.readException();
if (_reply.readInt() != 0) {
_result = true;
@@ -364,7 +364,7 @@ public void setAutoAnswer(boolean auto) throws RemoteException {
i = 1;
}
_data.writeInt(i);
- this.mRemote.transact(24, _data, _reply, 0);
+ this.mRemote.transact(34, _data, _reply, 0);
_reply.readException();
} finally {
_reply.recycle();
@@ -378,7 +378,7 @@ public boolean getAutoAnswer() throws RemoteException {
Parcel _reply = Parcel.obtain();
try {
_data.writeInterfaceToken("android.microntek.mtcser.BTServiceInf");
- this.mRemote.transact(25, _data, _reply, 0);
+ this.mRemote.transact(35, _data, _reply, 0);
_reply.readException();
if (_reply.readInt() != 0) {
_result = true;
@@ -399,7 +399,7 @@ public void connectBT(String mac) throws RemoteException {
try {
_data.writeInterfaceToken("android.microntek.mtcser.BTServiceInf");
_data.writeString(mac);
- this.mRemote.transact(26, _data, _reply, 0);
+ this.mRemote.transact(36, _data, _reply, 0);
_reply.readException();
} finally {
_reply.recycle();
@@ -413,7 +413,7 @@ public void disconnectBT(String mac) throws RemoteException {
try {
_data.writeInterfaceToken("android.microntek.mtcser.BTServiceInf");
_data.writeString(mac);
- this.mRemote.transact(27, _data, _reply, 0);
+ this.mRemote.transact(37, _data, _reply, 0);
_reply.readException();
} finally {
_reply.recycle();
@@ -427,7 +427,7 @@ public void connectOBD(String mac) throws RemoteException {
try {
_data.writeInterfaceToken("android.microntek.mtcser.BTServiceInf");
_data.writeString(mac);
- this.mRemote.transact(28, _data, _reply, 0);
+ this.mRemote.transact(38, _data, _reply, 0);
_reply.readException();
} finally {
_reply.recycle();
@@ -441,7 +441,7 @@ public void disconnectOBD(String mac) throws RemoteException {
try {
_data.writeInterfaceToken("android.microntek.mtcser.BTServiceInf");
_data.writeString(mac);
- this.mRemote.transact(29, _data, _reply, 0);
+ this.mRemote.transact(39, _data, _reply, 0);
_reply.readException();
} finally {
_reply.recycle();
@@ -455,7 +455,7 @@ public void deleteOBD(String mac) throws RemoteException {
try {
_data.writeInterfaceToken("android.microntek.mtcser.BTServiceInf");
_data.writeString(mac);
- this.mRemote.transact(30, _data, _reply, 0);
+ this.mRemote.transact(40, _data, _reply, 0);
_reply.readException();
} finally {
_reply.recycle();
@@ -469,7 +469,7 @@ public void deleteBT(String mac) throws RemoteException {
try {
_data.writeInterfaceToken("android.microntek.mtcser.BTServiceInf");
_data.writeString(mac);
- this.mRemote.transact(31, _data, _reply, 0);
+ this.mRemote.transact(41, _data, _reply, 0);
_reply.readException();
} finally {
_reply.recycle();
@@ -482,7 +482,7 @@ public void syncMatchList() throws RemoteException {
Parcel _reply = Parcel.obtain();
try {
_data.writeInterfaceToken("android.microntek.mtcser.BTServiceInf");
- this.mRemote.transact(32, _data, _reply, 0);
+ this.mRemote.transact(42, _data, _reply, 0);
_reply.readException();
} finally {
_reply.recycle();
@@ -495,7 +495,7 @@ public List getMatchList() throws RemoteException {
Parcel _reply = Parcel.obtain();
try {
_data.writeInterfaceToken("android.microntek.mtcser.BTServiceInf");
- this.mRemote.transact(33, _data, _reply, 0);
+ this.mRemote.transact(43, _data, _reply, 0);
_reply.readException();
List _result = _reply.createStringArrayList();
return _result;
@@ -510,7 +510,7 @@ public List getDeviceList() throws RemoteException {
Parcel _reply = Parcel.obtain();
try {
_data.writeInterfaceToken("android.microntek.mtcser.BTServiceInf");
- this.mRemote.transact(34, _data, _reply, 0);
+ this.mRemote.transact(44, _data, _reply, 0);
_reply.readException();
List _result = _reply.createStringArrayList();
return _result;
@@ -525,7 +525,7 @@ public List getHistoryList() throws RemoteException {
Parcel _reply = Parcel.obtain();
try {
_data.writeInterfaceToken("android.microntek.mtcser.BTServiceInf");
- this.mRemote.transact(35, _data, _reply, 0);
+ this.mRemote.transact(45, _data, _reply, 0);
_reply.readException();
List _result = _reply.createStringArrayList();
return _result;
@@ -540,7 +540,7 @@ public List getPhoneBookList() throws RemoteException {
Parcel _reply = Parcel.obtain();
try {
_data.writeInterfaceToken("android.microntek.mtcser.BTServiceInf");
- this.mRemote.transact(36, _data, _reply, 0);
+ this.mRemote.transact(46, _data, _reply, 0);
_reply.readException();
List _result = _reply.createStringArrayList();
return _result;
@@ -556,7 +556,7 @@ public void setPhoneBookList(List list) throws RemoteException {
try {
_data.writeInterfaceToken("android.microntek.mtcser.BTServiceInf");
_data.writeStringList(list);
- this.mRemote.transact(37, _data, _reply, 0);
+ this.mRemote.transact(47, _data, _reply, 0);
_reply.readException();
} finally {
_reply.recycle();
@@ -570,7 +570,7 @@ public void deleteHistory(int idx) throws RemoteException {
try {
_data.writeInterfaceToken("android.microntek.mtcser.BTServiceInf");
_data.writeInt(idx);
- this.mRemote.transact(38, _data, _reply, 0);
+ this.mRemote.transact(48, _data, _reply, 0);
_reply.readException();
} finally {
_reply.recycle();
@@ -583,7 +583,7 @@ public void deleteHistoryAll() throws RemoteException {
Parcel _reply = Parcel.obtain();
try {
_data.writeInterfaceToken("android.microntek.mtcser.BTServiceInf");
- this.mRemote.transact(39, _data, _reply, 0);
+ this.mRemote.transact(49, _data, _reply, 0);
_reply.readException();
} finally {
_reply.recycle();
@@ -596,7 +596,7 @@ public void musicMute() throws RemoteException {
Parcel _reply = Parcel.obtain();
try {
_data.writeInterfaceToken("android.microntek.mtcser.BTServiceInf");
- this.mRemote.transact(40, _data, _reply, 0);
+ this.mRemote.transact(50, _data, _reply, 0);
_reply.readException();
} finally {
_reply.recycle();
@@ -609,7 +609,7 @@ public void musicUnmute() throws RemoteException {
Parcel _reply = Parcel.obtain();
try {
_data.writeInterfaceToken("android.microntek.mtcser.BTServiceInf");
- this.mRemote.transact(41, _data, _reply, 0);
+ this.mRemote.transact(51, _data, _reply, 0);
_reply.readException();
} finally {
_reply.recycle();
@@ -622,7 +622,7 @@ public void scanStart() throws RemoteException {
Parcel _reply = Parcel.obtain();
try {
_data.writeInterfaceToken("android.microntek.mtcser.BTServiceInf");
- this.mRemote.transact(42, _data, _reply, 0);
+ this.mRemote.transact(52, _data, _reply, 0);
_reply.readException();
} finally {
_reply.recycle();
@@ -635,7 +635,7 @@ public void scanStop() throws RemoteException {
Parcel _reply = Parcel.obtain();
try {
_data.writeInterfaceToken("android.microntek.mtcser.BTServiceInf");
- this.mRemote.transact(43, _data, _reply, 0);
+ this.mRemote.transact(53, _data, _reply, 0);
_reply.readException();
} finally {
_reply.recycle();
@@ -649,7 +649,7 @@ public void dialOut(String s) throws RemoteException {
try {
_data.writeInterfaceToken("android.microntek.mtcser.BTServiceInf");
_data.writeString(s);
- this.mRemote.transact(44, _data, _reply, 0);
+ this.mRemote.transact(54, _data, _reply, 0);
_reply.readException();
} finally {
_reply.recycle();
@@ -663,7 +663,7 @@ public void dialOutSub(char b) throws RemoteException {
try {
_data.writeInterfaceToken("android.microntek.mtcser.BTServiceInf");
_data.writeInt(b);
- this.mRemote.transact(45, _data, _reply, 0);
+ this.mRemote.transact(55, _data, _reply, 0);
_reply.readException();
} finally {
_reply.recycle();
@@ -676,7 +676,7 @@ public void reDial() throws RemoteException {
Parcel _reply = Parcel.obtain();
try {
_data.writeInterfaceToken("android.microntek.mtcser.BTServiceInf");
- this.mRemote.transact(46, _data, _reply, 0);
+ this.mRemote.transact(56, _data, _reply, 0);
_reply.readException();
} finally {
_reply.recycle();
@@ -689,7 +689,7 @@ public String getMusicInfo() throws RemoteException {
Parcel _reply = Parcel.obtain();
try {
_data.writeInterfaceToken("android.microntek.mtcser.BTServiceInf");
- this.mRemote.transact(47, _data, _reply, 0);
+ this.mRemote.transact(57, _data, _reply, 0);
_reply.readException();
String _result = _reply.readString();
return _result;
@@ -704,7 +704,7 @@ public int getOBDstate() throws RemoteException {
Parcel _reply = Parcel.obtain();
try {
_data.writeInterfaceToken("android.microntek.mtcser.BTServiceInf");
- this.mRemote.transact(48, _data, _reply, 0);
+ this.mRemote.transact(58, _data, _reply, 0);
_reply.readException();
int _result = _reply.readInt();
return _result;
@@ -769,86 +769,86 @@ public boolean onTransact(int code, Parcel data, Parcel reply, int flags) throws
reply.writeNoException();
reply.writeString(_result2);
return true;
- case 7:
+ case 11:
data.enforceInterface("android.microntek.mtcser.BTServiceInf");
long _result5 = getNowDevAddr();
reply.writeNoException();
reply.writeLong(_result5);
return true;
- case 8:
+ case 12:
data.enforceInterface("android.microntek.mtcser.BTServiceInf");
_result2 = getNowDevName();
reply.writeNoException();
reply.writeString(_result2);
return true;
- case 9:
+ case 15:
data.enforceInterface("android.microntek.mtcser.BTServiceInf");
avPlayPause();
reply.writeNoException();
return true;
- case 10:
+ case 16:
data.enforceInterface("android.microntek.mtcser.BTServiceInf");
avPlayStop();
reply.writeNoException();
return true;
- case 11:
+ case 17:
data.enforceInterface("android.microntek.mtcser.BTServiceInf");
avPlayPrev();
reply.writeNoException();
return true;
- case 12:
+ case 18:
data.enforceInterface("android.microntek.mtcser.BTServiceInf");
avPlayNext();
reply.writeNoException();
return true;
- case 13:
+ case 19:
data.enforceInterface("android.microntek.mtcser.BTServiceInf");
answerCall();
reply.writeNoException();
return true;
- case 14:
+ case 20:
data.enforceInterface("android.microntek.mtcser.BTServiceInf");
hangupCall();
reply.writeNoException();
return true;
- case 15:
+ case 21:
data.enforceInterface("android.microntek.mtcser.BTServiceInf");
rejectCall();
reply.writeNoException();
return true;
- case 16:
+ case 26:
data.enforceInterface("android.microntek.mtcser.BTServiceInf");
switchVoice();
reply.writeNoException();
return true;
- case 17:
+ case 27:
data.enforceInterface("android.microntek.mtcser.BTServiceInf");
syncPhonebook();
reply.writeNoException();
return true;
- case 18:
+ case 28:
data.enforceInterface("android.microntek.mtcser.BTServiceInf");
_result2 = getModuleName();
reply.writeNoException();
reply.writeString(_result2);
return true;
- case 19:
+ case 29:
data.enforceInterface("android.microntek.mtcser.BTServiceInf");
_result2 = getModulePassword();
reply.writeNoException();
reply.writeString(_result2);
return true;
- case 20:
+ case 30:
data.enforceInterface("android.microntek.mtcser.BTServiceInf");
setModuleName(data.readString());
reply.writeNoException();
return true;
- case 21:
+ case 31:
data.enforceInterface("android.microntek.mtcser.BTServiceInf");
setModulePassword(data.readString());
reply.writeNoException();
return true;
- case 22:
+ case 32:
data.enforceInterface("android.microntek.mtcser.BTServiceInf");
if (data.readInt() != 0) {
_arg02 = true;
@@ -856,7 +856,7 @@ public boolean onTransact(int code, Parcel data, Parcel reply, int flags) throws
setAutoConnect(_arg02);
reply.writeNoException();
return true;
- case 23:
+ case 33:
data.enforceInterface("android.microntek.mtcser.BTServiceInf");
_result3 = getAutoConnect();
reply.writeNoException();
@@ -865,7 +865,7 @@ public boolean onTransact(int code, Parcel data, Parcel reply, int flags) throws
}
reply.writeInt(_arg0);
return true;
- case 24:
+ case 34:
data.enforceInterface("android.microntek.mtcser.BTServiceInf");
if (data.readInt() != 0) {
_arg02 = true;
@@ -873,7 +873,7 @@ public boolean onTransact(int code, Parcel data, Parcel reply, int flags) throws
setAutoAnswer(_arg02);
reply.writeNoException();
return true;
- case 25:
+ case 35:
data.enforceInterface("android.microntek.mtcser.BTServiceInf");
_result3 = getAutoAnswer();
reply.writeNoException();
@@ -882,122 +882,122 @@ public boolean onTransact(int code, Parcel data, Parcel reply, int flags) throws
}
reply.writeInt(_arg0);
return true;
- case 26:
+ case 36:
data.enforceInterface("android.microntek.mtcser.BTServiceInf");
connectBT(data.readString());
reply.writeNoException();
return true;
- case 27:
+ case 37:
data.enforceInterface("android.microntek.mtcser.BTServiceInf");
disconnectBT(data.readString());
reply.writeNoException();
return true;
- case 28:
+ case 38:
data.enforceInterface("android.microntek.mtcser.BTServiceInf");
connectOBD(data.readString());
reply.writeNoException();
return true;
- case 29:
+ case 39:
data.enforceInterface("android.microntek.mtcser.BTServiceInf");
disconnectOBD(data.readString());
reply.writeNoException();
return true;
- case 30:
+ case 40:
data.enforceInterface("android.microntek.mtcser.BTServiceInf");
deleteOBD(data.readString());
reply.writeNoException();
return true;
- case 31:
+ case 41:
data.enforceInterface("android.microntek.mtcser.BTServiceInf");
deleteBT(data.readString());
reply.writeNoException();
return true;
- case 32:
+ case 42:
data.enforceInterface("android.microntek.mtcser.BTServiceInf");
syncMatchList();
reply.writeNoException();
return true;
- case 33:
+ case 43:
data.enforceInterface("android.microntek.mtcser.BTServiceInf");
_result4 = getMatchList();
reply.writeNoException();
reply.writeStringList(_result4);
return true;
- case 34:
+ case 44:
data.enforceInterface("android.microntek.mtcser.BTServiceInf");
_result4 = getDeviceList();
reply.writeNoException();
reply.writeStringList(_result4);
return true;
- case 35:
+ case 45:
data.enforceInterface("android.microntek.mtcser.BTServiceInf");
_result4 = getHistoryList();
reply.writeNoException();
reply.writeStringList(_result4);
return true;
- case 36:
+ case 46:
data.enforceInterface("android.microntek.mtcser.BTServiceInf");
_result4 = getPhoneBookList();
reply.writeNoException();
reply.writeStringList(_result4);
return true;
- case 37:
+ case 47:
data.enforceInterface("android.microntek.mtcser.BTServiceInf");
setPhoneBookList(data.createStringArrayList());
reply.writeNoException();
return true;
- case 38:
+ case 48:
data.enforceInterface("android.microntek.mtcser.BTServiceInf");
deleteHistory(data.readInt());
reply.writeNoException();
return true;
- case 39:
+ case 49:
data.enforceInterface("android.microntek.mtcser.BTServiceInf");
deleteHistoryAll();
reply.writeNoException();
return true;
- case 40:
+ case 50:
data.enforceInterface("android.microntek.mtcser.BTServiceInf");
musicMute();
reply.writeNoException();
return true;
- case 41:
+ case 51:
data.enforceInterface("android.microntek.mtcser.BTServiceInf");
musicUnmute();
reply.writeNoException();
return true;
- case 42:
+ case 52:
data.enforceInterface("android.microntek.mtcser.BTServiceInf");
scanStart();
reply.writeNoException();
return true;
- case 43:
+ case 53:
data.enforceInterface("android.microntek.mtcser.BTServiceInf");
scanStop();
reply.writeNoException();
return true;
- case 44:
+ case 54:
data.enforceInterface("android.microntek.mtcser.BTServiceInf");
dialOut(data.readString());
reply.writeNoException();
return true;
- case 45:
+ case 55:
data.enforceInterface("android.microntek.mtcser.BTServiceInf");
dialOutSub((char) data.readInt());
reply.writeNoException();
return true;
- case 46:
+ case 56:
data.enforceInterface("android.microntek.mtcser.BTServiceInf");
reDial();
reply.writeNoException();
return true;
- case 47:
+ case 57:
data.enforceInterface("android.microntek.mtcser.BTServiceInf");
_result2 = getMusicInfo();
reply.writeNoException();
reply.writeString(_result2);
return true;
- case 48:
+ case 58:
data.enforceInterface("android.microntek.mtcser.BTServiceInf");
int _result6 = getOBDstate();
reply.writeNoException();
diff --git a/app/src/main/java/com/f1x/mtcdialer/BluetoothServiceActivity.java b/app/src/main/java/com/f1x/mtcdialer/BluetoothServiceActivity.java
index c00a235..6906f0d 100644
--- a/app/src/main/java/com/f1x/mtcdialer/BluetoothServiceActivity.java
+++ b/app/src/main/java/com/f1x/mtcdialer/BluetoothServiceActivity.java
@@ -15,37 +15,11 @@
*/
public abstract class BluetoothServiceActivity extends Activity {
- @Override
- protected void onCreate(Bundle savedInstance) {
- super.onCreate(savedInstance);
-
- // PX3
- Intent startBluetoothServiceIntent = new Intent();
- startBluetoothServiceIntent.setComponent(new ComponentName("android.microntek.mtcser", "android.microntek.mtcser.BTSerialService"));
-
- if(!bindService(startBluetoothServiceIntent, mServiceConnection, BIND_AUTO_CREATE)) {
- // PX5
- startBluetoothServiceIntent.setComponent(new ComponentName("android.microntek.mtcser", "android.microntek.mtcser.BlueToothService"));
- if(!bindService(startBluetoothServiceIntent, mServiceConnection, BIND_AUTO_CREATE)) {
- Toast.makeText(this, this.getText(R.string.BluetoothNotAvailable), Toast.LENGTH_LONG).show();
- finish();
- }
- }
- }
-
- @Override
- protected void onDestroy() {
- super.onDestroy();
- unbindService(mServiceConnection);
- }
-
- protected abstract void onServiceConnected();
- protected abstract void onServiceDisconnected();
-
+ protected BTServiceInf mBluetoothServiceInterface;
private final ServiceConnection mServiceConnection = new ServiceConnection() {
@Override
public void onServiceConnected(ComponentName componentName, IBinder iBinder) {
- if(iBinder == null) {
+ if (iBinder == null) {
Toast.makeText(BluetoothServiceActivity.this, BluetoothServiceActivity.this.getText(R.string.BluetoothNotAvailable), Toast.LENGTH_LONG).show();
BluetoothServiceActivity.this.finish();
return;
@@ -53,7 +27,7 @@ public void onServiceConnected(ComponentName componentName, IBinder iBinder) {
mBluetoothServiceInterface = BTServiceInf.Stub.asInterface(iBinder);
- if(mBluetoothServiceInterface == null) {
+ if (mBluetoothServiceInterface == null) {
Toast.makeText(BluetoothServiceActivity.this, BluetoothServiceActivity.this.getText(R.string.BluetoothNotAvailable), Toast.LENGTH_LONG).show();
BluetoothServiceActivity.this.finish();
return;
@@ -76,5 +50,31 @@ public void onServiceDisconnected(ComponentName componentName) {
}
};
- protected BTServiceInf mBluetoothServiceInterface;
+ @Override
+ protected void onCreate(Bundle savedInstance) {
+ super.onCreate(savedInstance);
+
+ // PX3
+ Intent startBluetoothServiceIntent = new Intent();
+ startBluetoothServiceIntent.setComponent(new ComponentName("android.microntek.mtcser", "android.microntek.mtcser.BTSerialService"));
+
+ if (!bindService(startBluetoothServiceIntent, mServiceConnection, BIND_AUTO_CREATE)) {
+ // PX5
+ startBluetoothServiceIntent.setComponent(new ComponentName("android.microntek.mtcser", "android.microntek.mtcser.BlueToothService"));
+ if (!bindService(startBluetoothServiceIntent, mServiceConnection, BIND_AUTO_CREATE)) {
+ Toast.makeText(this, this.getText(R.string.BluetoothNotAvailable), Toast.LENGTH_LONG).show();
+ finish();
+ }
+ }
+ }
+
+ @Override
+ protected void onDestroy() {
+ super.onDestroy();
+ unbindService(mServiceConnection);
+ }
+
+ protected abstract void onServiceConnected();
+
+ protected abstract void onServiceDisconnected();
}
diff --git a/app/src/main/java/com/f1x/mtcdialer/DialActivity.java b/app/src/main/java/com/f1x/mtcdialer/DialActivity.java
index f3ae690..af0e941 100644
--- a/app/src/main/java/com/f1x/mtcdialer/DialActivity.java
+++ b/app/src/main/java/com/f1x/mtcdialer/DialActivity.java
@@ -37,7 +37,7 @@ public void onServiceConnected() {
String extractPhoneNumber(Intent intent) {
Uri uri = intent.getData();
- if(uri != null && uri.getScheme().matches("tel|sms|smsto|mms|mmsto")) {
+ if (uri != null && uri.getScheme() != null && uri.getScheme().matches("tel|sms|smsto|mms|mmsto")) {
return PhoneNumberUtils.normalizeNumber(uri.getSchemeSpecificPart());
} else {
return null;
diff --git a/app/src/main/java/com/f1x/mtcdialer/PhoneBookActivity.java b/app/src/main/java/com/f1x/mtcdialer/PhoneBookActivity.java
index 2ca37ca..9042ce0 100644
--- a/app/src/main/java/com/f1x/mtcdialer/PhoneBookActivity.java
+++ b/app/src/main/java/com/f1x/mtcdialer/PhoneBookActivity.java
@@ -14,6 +14,32 @@
*/
public abstract class PhoneBookActivity extends BluetoothServiceActivity {
+ protected Map mPhoneBookRecords;
+ private final PhoneBookReceiver mPhoneBookReceiver = new PhoneBookReceiver() {
+ List mRawPhoneBookRecords = new ArrayList<>();
+
+ @Override
+ public void onPhoneBookRecordFetched(String record) {
+ mRawPhoneBookRecords.add(record);
+ }
+
+ @Override
+ public void onPhoneBookFetchFinished() {
+ this.unregister(PhoneBookActivity.this);
+ PhoneBookActivity.this.buildPhoneBook(mRawPhoneBookRecords);
+
+ try {
+ PhoneBookActivity.this.mBluetoothServiceInterface.setPhoneBookList(mRawPhoneBookRecords);
+ } catch (RemoteException e) {
+ e.printStackTrace();
+ Toast.makeText(PhoneBookActivity.this, e.getLocalizedMessage(), Toast.LENGTH_LONG).show();
+ }
+
+ PhoneBookActivity.this.onPhoneBookFetchFinished();
+ mRawPhoneBookRecords.clear();
+ }
+ };
+
@Override
protected void onCreate(Bundle savedInstance) {
super.onCreate(savedInstance);
@@ -31,7 +57,7 @@ protected void onServiceConnected() {
try {
List phoneBookRecords = mBluetoothServiceInterface.getPhoneBookList();
- if(!phoneBookRecords.isEmpty()) {
+ if (!phoneBookRecords.isEmpty()) {
buildPhoneBook(phoneBookRecords);
onPhoneBookFetchFinished();
} else {
@@ -46,7 +72,7 @@ protected void onServiceConnected() {
}
private void buildPhoneBook(List phoneBookRecords) {
- for(String phoneBookRecord : phoneBookRecords) {
+ for (String phoneBookRecord : phoneBookRecords) {
String[] parsedRecord = phoneBookRecord.split("\\^");
String contactName = parsedRecord[0].trim().replaceAll(" +", " ");
String phoneNumber = parsedRecord[1].replaceAll("[^\\d\\+]", "");
@@ -56,31 +82,4 @@ private void buildPhoneBook(List phoneBookRecords) {
}
protected abstract void onPhoneBookFetchFinished();
-
- private final PhoneBookReceiver mPhoneBookReceiver = new PhoneBookReceiver() {
- @Override
- public void onPhoneBookRecordFetched(String record) {
- mRawPhoneBookRecords.add(record);
- }
-
- @Override
- public void onPhoneBookFetchFinished() {
- this.unregister(PhoneBookActivity.this);
- PhoneBookActivity.this.buildPhoneBook(mRawPhoneBookRecords);
-
- try {
- PhoneBookActivity.this.mBluetoothServiceInterface.setPhoneBookList(mRawPhoneBookRecords);
- } catch (RemoteException e) {
- e.printStackTrace();
- Toast.makeText(PhoneBookActivity.this, e.getLocalizedMessage(), Toast.LENGTH_LONG).show();
- }
-
- PhoneBookActivity.this.onPhoneBookFetchFinished();
- mRawPhoneBookRecords.clear();
- }
-
- List mRawPhoneBookRecords = new ArrayList<>();
- };
-
- protected Map mPhoneBookRecords;
}
diff --git a/app/src/main/java/com/f1x/mtcdialer/PhoneBookReceiver.java b/app/src/main/java/com/f1x/mtcdialer/PhoneBookReceiver.java
index eceb7d6..f795282 100644
--- a/app/src/main/java/com/f1x/mtcdialer/PhoneBookReceiver.java
+++ b/app/src/main/java/com/f1x/mtcdialer/PhoneBookReceiver.java
@@ -10,6 +10,11 @@
*/
public abstract class PhoneBookReceiver extends BroadcastReceiver {
+ private final String BLUETOOTH_REPORT_ACTION = "com.microntek.bt.report";
+ private final String PHONEBOOK_RECORD_EXTRA = "phonebook_record";
+ private final String PHONEBOOK_SYNC_END_EXTRA = "phonebook_end";
+ private boolean mRegistered;
+
public PhoneBookReceiver() {
mRegistered = false;
}
@@ -25,8 +30,12 @@ public void onReceive(Context context, Intent intent) {
}
}
+ public abstract void onPhoneBookRecordFetched(String record);
+
+ public abstract void onPhoneBookFetchFinished();
+
public void register(Context context) {
- if(!mRegistered) {
+ if (!mRegistered) {
mRegistered = true;
IntentFilter intentFilter = new IntentFilter();
@@ -37,18 +46,9 @@ public void register(Context context) {
}
public void unregister(Context context) {
- if(mRegistered) {
+ if (mRegistered) {
mRegistered = false;
context.unregisterReceiver(this);
}
}
-
- public abstract void onPhoneBookRecordFetched(String record);
- public abstract void onPhoneBookFetchFinished();
-
- private boolean mRegistered;
-
- private final String BLUETOOTH_REPORT_ACTION = "com.microntek.bt.report";
- private final String PHONEBOOK_RECORD_EXTRA = "phonebook_record";
- private final String PHONEBOOK_SYNC_END_EXTRA = "phonebook_end";
}
diff --git a/app/src/main/java/com/f1x/mtcdialer/VoiceSelectionCallerActivity.java b/app/src/main/java/com/f1x/mtcdialer/VoiceSelectionCallerActivity.java
index 95c79a9..11eccc3 100644
--- a/app/src/main/java/com/f1x/mtcdialer/VoiceSelectionCallerActivity.java
+++ b/app/src/main/java/com/f1x/mtcdialer/VoiceSelectionCallerActivity.java
@@ -4,7 +4,6 @@
import android.net.Uri;
import android.os.Bundle;
import android.speech.RecognizerIntent;
-import android.telephony.PhoneNumberUtils;
import android.widget.Toast;
import java.util.List;
@@ -22,10 +21,7 @@ protected void onCreate(Bundle savedInstance) {
}
@Override
- protected void onServiceDisconnected() {}
-
- @Override
- protected void onPhoneBookFetchFinished() {
+ protected void onPhoneBookFetchFinished() {
Intent intent = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH);
intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE, Locale.getDefault().toString());
intent.putExtra(RecognizerIntent.EXTRA_PROMPT, this.getText(R.string.SpeechPrompt));
@@ -33,6 +29,10 @@ protected void onPhoneBookFetchFinished() {
startActivityForResult(intent, 1);
}
+ @Override
+ protected void onServiceDisconnected() {
+ }
+
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if (resultCode != RESULT_OK || data == null) {
@@ -42,7 +42,7 @@ protected void onActivityResult(int requestCode, int resultCode, Intent data) {
}
List texts = data.getStringArrayListExtra(RecognizerIntent.EXTRA_RESULTS);
- if (texts.isEmpty()) {
+ if (texts != null && texts.isEmpty()) {
Toast.makeText(this, this.getText(R.string.SpeechNotRecognized), Toast.LENGTH_LONG).show();
VoiceSelectionCallerActivity.this.finish();
return;
@@ -68,7 +68,7 @@ private void processSpeechInput(String input) {
phoneNumber = input;
}
- if(phoneNumber != null) {
+ if (phoneNumber != null) {
final String message = String.format(this.getString(R.string.CallingTo), input);
Toast.makeText(this, message, Toast.LENGTH_LONG).show();
diff --git a/app/src/main/res/mipmap-hdpi/ic_launcher.png b/app/src/main/res/mipmap-hdpi/ic_launcher.png
index db0c75a..a5e9865 100644
Binary files a/app/src/main/res/mipmap-hdpi/ic_launcher.png and b/app/src/main/res/mipmap-hdpi/ic_launcher.png differ
diff --git a/app/src/main/res/mipmap-mdpi/ic_launcher.png b/app/src/main/res/mipmap-mdpi/ic_launcher.png
index f268190..7a411cd 100644
Binary files a/app/src/main/res/mipmap-mdpi/ic_launcher.png and b/app/src/main/res/mipmap-mdpi/ic_launcher.png differ
diff --git a/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/app/src/main/res/mipmap-xhdpi/ic_launcher.png
index 2445d72..e28685f 100644
Binary files a/app/src/main/res/mipmap-xhdpi/ic_launcher.png and b/app/src/main/res/mipmap-xhdpi/ic_launcher.png differ
diff --git a/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
index 2199cd2..2d555a3 100644
Binary files a/app/src/main/res/mipmap-xxhdpi/ic_launcher.png and b/app/src/main/res/mipmap-xxhdpi/ic_launcher.png differ
diff --git a/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
index 68f0526..132d877 100644
Binary files a/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png and b/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png differ
diff --git a/app/src/main/web_hi_res_512.png b/app/src/main/web_hi_res_512.png
new file mode 100644
index 0000000..aeaa390
Binary files /dev/null and b/app/src/main/web_hi_res_512.png differ
diff --git a/build.gradle b/build.gradle
index c2eea8e..5cc0b45 100644
--- a/build.gradle
+++ b/build.gradle
@@ -1,11 +1,13 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
+apply from: "$rootDir/gradle/common-build.gradle"
buildscript {
repositories {
+ google()
jcenter()
}
dependencies {
- classpath 'com.android.tools.build:gradle:2.3.3'
+ classpath 'com.android.tools.build:gradle:3.5.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
@@ -14,6 +16,7 @@ buildscript {
allprojects {
repositories {
+ google()
jcenter()
}
}
@@ -21,3 +24,22 @@ allprojects {
task clean(type: Delete) {
delete rootProject.buildDir
}
+
+ext {
+
+ versionNameApp = "v1.3.0"
+ versionCode = getCiBuildNumber()
+
+ compileSdkVersion = 29
+ buildToolsVersion = "29.0.2"
+ targetSdkVersion = 29
+
+ minSdkVersion = 21
+ javaVersion = JavaVersion.VERSION_1_8
+
+ dependencies = [
+ support : "28.0.0",
+ espresso : "3.0.2",
+ junit : "4.12",
+ ]
+}
diff --git a/credentials.tar.enc b/credentials.tar.enc
new file mode 100644
index 0000000..003eb0b
Binary files /dev/null and b/credentials.tar.enc differ
diff --git a/gradle/common-build.gradle b/gradle/common-build.gradle
new file mode 100644
index 0000000..7e1c421
--- /dev/null
+++ b/gradle/common-build.gradle
@@ -0,0 +1,69 @@
+ext {
+ getGitRev = this.&getGitRev
+ getGitCommitDate = this.&getGitCommitDate
+ getGitBranch = this.&getGitBranch
+ getSigningProperties = this.&getSigningProperties
+ isCiBuild = this.&isCiBuild
+ getCiBuildNumber = this.&getCiBuildNumber
+ getBuildTime = this.&getBuildTime
+}
+
+String getGitRev() {
+ def git_rev = new ByteArrayOutputStream()
+ exec {
+ commandLine 'git', 'log', '-1', '--format=%H'
+ standardOutput = git_rev
+ }
+ git_rev = git_rev.toString().trim()
+ return git_rev
+}
+
+String getGitCommitDate() {
+ def git_date = new ByteArrayOutputStream()
+ exec {
+ commandLine 'git', 'log', '-1', '--format=%ci'
+ standardOutput = git_date
+ }
+ git_date = git_date.toString().trim()
+ return git_date
+}
+
+String getGitBranch() {
+ def git_branch = new ByteArrayOutputStream()
+ exec {
+ commandLine 'git', 'rev-parse', '--abbrev-ref', 'HEAD'
+ standardOutput = git_branch
+ ignoreExitValue = true
+ }
+ git_branch = git_branch.toString().trim()
+ return git_branch
+}
+
+def getSigningProperties() {
+ Properties props = new Properties()
+ try {
+ props.load(new FileInputStream(file("$rootDir/local.properties")))
+ } catch (Exception e) {
+ }
+ return props
+}
+
+String getBuildTime() {
+ return new Date().toString()
+}
+
+static boolean isCiBuild() {
+ def ciBuild = false
+ if (System.getenv().CI != null) {
+ ciBuild = Boolean.valueOf(System.getenv().CI)
+ }
+ return ciBuild
+}
+
+static Integer getCiBuildNumber() {
+ def buildNumber = 1
+ if (System.getenv().TRAVIS_BUILD_NUMBER != null) {
+ buildNumber = System.getenv().TRAVIS_BUILD_NUMBER
+ }
+ return Integer.valueOf(buildNumber)
+}
diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties
index 0fbd754..82c527d 100644
--- a/gradle/wrapper/gradle-wrapper.properties
+++ b/gradle/wrapper/gradle-wrapper.properties
@@ -1,6 +1,6 @@
-#Thu Jun 22 17:35:36 CEST 2017
+#Fri Apr 19 12:02:25 EEST 2019
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip
+distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.2-all.zip
diff --git a/gradlew b/gradlew
old mode 100644
new mode 100755