diff --git a/.gitignore b/.gitignore
index f6b286c..1ee9933 100644
--- a/.gitignore
+++ b/.gitignore
@@ -34,7 +34,10 @@ captures/
# Intellij
*.iml
-.idea/workspace.xml
+.idea
+
# Keystore files
*.jks
+
+.DS_Store
diff --git a/app/.gitignore b/app/.gitignore
new file mode 100644
index 0000000..796b96d
--- /dev/null
+++ b/app/.gitignore
@@ -0,0 +1 @@
+/build
diff --git a/app/build.gradle b/app/build.gradle
new file mode 100644
index 0000000..874f9f6
--- /dev/null
+++ b/app/build.gradle
@@ -0,0 +1,29 @@
+apply plugin: 'com.android.application'
+
+android {
+ compileSdkVersion 25
+ buildToolsVersion "24.0.1"
+ defaultConfig {
+ applicationId "com.f1x.mtcdialer"
+ minSdkVersion 19
+ targetSdkVersion 25
+ versionCode 1
+ versionName "1.0"
+ testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
+ }
+ buildTypes {
+ release {
+ minifyEnabled false
+ proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
+ }
+ }
+}
+
+dependencies {
+ compile fileTree(dir: 'libs', include: ['*.jar'])
+ androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
+ 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/proguard-rules.pro b/app/proguard-rules.pro
new file mode 100644
index 0000000..960178b
--- /dev/null
+++ b/app/proguard-rules.pro
@@ -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\COMPUTER\AppData\Local\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 *;
+#}
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
new file mode 100644
index 0000000..25cd2d1
--- /dev/null
+++ b/app/src/main/AndroidManifest.xml
@@ -0,0 +1,30 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/ic_launcher-web.png b/app/src/main/ic_launcher-web.png
new file mode 100644
index 0000000..d28d49b
Binary files /dev/null and b/app/src/main/ic_launcher-web.png differ
diff --git a/app/src/main/java/android/microntek/mtcser/BTServiceInf.java b/app/src/main/java/android/microntek/mtcser/BTServiceInf.java
new file mode 100644
index 0000000..2b3d896
--- /dev/null
+++ b/app/src/main/java/android/microntek/mtcser/BTServiceInf.java
@@ -0,0 +1,1110 @@
+package android.microntek.mtcser;
+
+import android.os.Binder;
+import android.os.IBinder;
+import android.os.IInterface;
+import android.os.Parcel;
+import android.os.RemoteException;
+import java.util.List;
+
+public interface BTServiceInf extends IInterface {
+
+ public static abstract class Stub extends Binder implements BTServiceInf {
+
+ private static class Proxy implements BTServiceInf {
+ private IBinder mRemote;
+
+ Proxy(IBinder remote) {
+ this.mRemote = remote;
+ }
+
+ public IBinder asBinder() {
+ return this.mRemote;
+ }
+
+ public void init() throws RemoteException {
+ Parcel _data = Parcel.obtain();
+ Parcel _reply = Parcel.obtain();
+ try {
+ _data.writeInterfaceToken("android.microntek.mtcser.BTServiceInf");
+ this.mRemote.transact(1, _data, _reply, 0);
+ _reply.readException();
+ } finally {
+ _reply.recycle();
+ _data.recycle();
+ }
+ }
+
+ public byte getBTState() throws RemoteException {
+ Parcel _data = Parcel.obtain();
+ Parcel _reply = Parcel.obtain();
+ try {
+ _data.writeInterfaceToken("android.microntek.mtcser.BTServiceInf");
+ this.mRemote.transact(2, _data, _reply, 0);
+ _reply.readException();
+ byte _result = _reply.readByte();
+ return _result;
+ } finally {
+ _reply.recycle();
+ _data.recycle();
+ }
+ }
+
+ public byte getAVState() throws RemoteException {
+ Parcel _data = Parcel.obtain();
+ Parcel _reply = Parcel.obtain();
+ try {
+ _data.writeInterfaceToken("android.microntek.mtcser.BTServiceInf");
+ this.mRemote.transact(3, _data, _reply, 0);
+ _reply.readException();
+ byte _result = _reply.readByte();
+ return _result;
+ } finally {
+ _reply.recycle();
+ _data.recycle();
+ }
+ }
+
+ public String getDialOutNum() throws RemoteException {
+ Parcel _data = Parcel.obtain();
+ Parcel _reply = Parcel.obtain();
+ try {
+ _data.writeInterfaceToken("android.microntek.mtcser.BTServiceInf");
+ this.mRemote.transact(4, _data, _reply, 0);
+ _reply.readException();
+ String _result = _reply.readString();
+ return _result;
+ } finally {
+ _reply.recycle();
+ _data.recycle();
+ }
+ }
+
+ public String getCallInNum() throws RemoteException {
+ Parcel _data = Parcel.obtain();
+ Parcel _reply = Parcel.obtain();
+ try {
+ _data.writeInterfaceToken("android.microntek.mtcser.BTServiceInf");
+ this.mRemote.transact(5, _data, _reply, 0);
+ _reply.readException();
+ String _result = _reply.readString();
+ return _result;
+ } finally {
+ _reply.recycle();
+ _data.recycle();
+ }
+ }
+
+ public String getPhoneNum() throws RemoteException {
+ Parcel _data = Parcel.obtain();
+ Parcel _reply = Parcel.obtain();
+ try {
+ _data.writeInterfaceToken("android.microntek.mtcser.BTServiceInf");
+ this.mRemote.transact(6, _data, _reply, 0);
+ _reply.readException();
+ String _result = _reply.readString();
+ return _result;
+ } finally {
+ _reply.recycle();
+ _data.recycle();
+ }
+ }
+
+ public long getNowDevAddr() throws RemoteException {
+ Parcel _data = Parcel.obtain();
+ Parcel _reply = Parcel.obtain();
+ try {
+ _data.writeInterfaceToken("android.microntek.mtcser.BTServiceInf");
+ this.mRemote.transact(7, _data, _reply, 0);
+ _reply.readException();
+ long _result = _reply.readLong();
+ return _result;
+ } finally {
+ _reply.recycle();
+ _data.recycle();
+ }
+ }
+
+ public String getNowDevName() throws RemoteException {
+ Parcel _data = Parcel.obtain();
+ Parcel _reply = Parcel.obtain();
+ try {
+ _data.writeInterfaceToken("android.microntek.mtcser.BTServiceInf");
+ this.mRemote.transact(8, _data, _reply, 0);
+ _reply.readException();
+ String _result = _reply.readString();
+ return _result;
+ } finally {
+ _reply.recycle();
+ _data.recycle();
+ }
+ }
+
+ public void avPlayPause() throws RemoteException {
+ Parcel _data = Parcel.obtain();
+ Parcel _reply = Parcel.obtain();
+ try {
+ _data.writeInterfaceToken("android.microntek.mtcser.BTServiceInf");
+ this.mRemote.transact(9, _data, _reply, 0);
+ _reply.readException();
+ } finally {
+ _reply.recycle();
+ _data.recycle();
+ }
+ }
+
+ public void avPlayStop() throws RemoteException {
+ Parcel _data = Parcel.obtain();
+ Parcel _reply = Parcel.obtain();
+ try {
+ _data.writeInterfaceToken("android.microntek.mtcser.BTServiceInf");
+ this.mRemote.transact(10, _data, _reply, 0);
+ _reply.readException();
+ } finally {
+ _reply.recycle();
+ _data.recycle();
+ }
+ }
+
+ public void avPlayPrev() throws RemoteException {
+ Parcel _data = Parcel.obtain();
+ Parcel _reply = Parcel.obtain();
+ try {
+ _data.writeInterfaceToken("android.microntek.mtcser.BTServiceInf");
+ this.mRemote.transact(11, _data, _reply, 0);
+ _reply.readException();
+ } finally {
+ _reply.recycle();
+ _data.recycle();
+ }
+ }
+
+ public void avPlayNext() throws RemoteException {
+ Parcel _data = Parcel.obtain();
+ Parcel _reply = Parcel.obtain();
+ try {
+ _data.writeInterfaceToken("android.microntek.mtcser.BTServiceInf");
+ this.mRemote.transact(12, _data, _reply, 0);
+ _reply.readException();
+ } finally {
+ _reply.recycle();
+ _data.recycle();
+ }
+ }
+
+ public void answerCall() throws RemoteException {
+ Parcel _data = Parcel.obtain();
+ Parcel _reply = Parcel.obtain();
+ try {
+ _data.writeInterfaceToken("android.microntek.mtcser.BTServiceInf");
+ this.mRemote.transact(13, _data, _reply, 0);
+ _reply.readException();
+ } finally {
+ _reply.recycle();
+ _data.recycle();
+ }
+ }
+
+ public void hangupCall() throws RemoteException {
+ Parcel _data = Parcel.obtain();
+ Parcel _reply = Parcel.obtain();
+ try {
+ _data.writeInterfaceToken("android.microntek.mtcser.BTServiceInf");
+ this.mRemote.transact(14, _data, _reply, 0);
+ _reply.readException();
+ } finally {
+ _reply.recycle();
+ _data.recycle();
+ }
+ }
+
+ public void rejectCall() throws RemoteException {
+ Parcel _data = Parcel.obtain();
+ Parcel _reply = Parcel.obtain();
+ try {
+ _data.writeInterfaceToken("android.microntek.mtcser.BTServiceInf");
+ this.mRemote.transact(15, _data, _reply, 0);
+ _reply.readException();
+ } finally {
+ _reply.recycle();
+ _data.recycle();
+ }
+ }
+
+ public void switchVoice() throws RemoteException {
+ Parcel _data = Parcel.obtain();
+ Parcel _reply = Parcel.obtain();
+ try {
+ _data.writeInterfaceToken("android.microntek.mtcser.BTServiceInf");
+ this.mRemote.transact(16, _data, _reply, 0);
+ _reply.readException();
+ } finally {
+ _reply.recycle();
+ _data.recycle();
+ }
+ }
+
+ public void syncPhonebook() throws RemoteException {
+ Parcel _data = Parcel.obtain();
+ Parcel _reply = Parcel.obtain();
+ try {
+ _data.writeInterfaceToken("android.microntek.mtcser.BTServiceInf");
+ this.mRemote.transact(17, _data, _reply, 0);
+ _reply.readException();
+ } finally {
+ _reply.recycle();
+ _data.recycle();
+ }
+ }
+
+ public String getModuleName() throws RemoteException {
+ Parcel _data = Parcel.obtain();
+ Parcel _reply = Parcel.obtain();
+ try {
+ _data.writeInterfaceToken("android.microntek.mtcser.BTServiceInf");
+ this.mRemote.transact(18, _data, _reply, 0);
+ _reply.readException();
+ String _result = _reply.readString();
+ return _result;
+ } finally {
+ _reply.recycle();
+ _data.recycle();
+ }
+ }
+
+ public String getModulePassword() throws RemoteException {
+ Parcel _data = Parcel.obtain();
+ Parcel _reply = Parcel.obtain();
+ try {
+ _data.writeInterfaceToken("android.microntek.mtcser.BTServiceInf");
+ this.mRemote.transact(19, _data, _reply, 0);
+ _reply.readException();
+ String _result = _reply.readString();
+ return _result;
+ } finally {
+ _reply.recycle();
+ _data.recycle();
+ }
+ }
+
+ public void setModuleName(String name) throws RemoteException {
+ Parcel _data = Parcel.obtain();
+ Parcel _reply = Parcel.obtain();
+ try {
+ _data.writeInterfaceToken("android.microntek.mtcser.BTServiceInf");
+ _data.writeString(name);
+ this.mRemote.transact(20, _data, _reply, 0);
+ _reply.readException();
+ } finally {
+ _reply.recycle();
+ _data.recycle();
+ }
+ }
+
+ public void setModulePassword(String password) throws RemoteException {
+ Parcel _data = Parcel.obtain();
+ Parcel _reply = Parcel.obtain();
+ try {
+ _data.writeInterfaceToken("android.microntek.mtcser.BTServiceInf");
+ _data.writeString(password);
+ this.mRemote.transact(21, _data, _reply, 0);
+ _reply.readException();
+ } finally {
+ _reply.recycle();
+ _data.recycle();
+ }
+ }
+
+ public void setAutoConnect(boolean auto) throws RemoteException {
+ int i = 0;
+ Parcel _data = Parcel.obtain();
+ Parcel _reply = Parcel.obtain();
+ try {
+ _data.writeInterfaceToken("android.microntek.mtcser.BTServiceInf");
+ if (auto) {
+ i = 1;
+ }
+ _data.writeInt(i);
+ this.mRemote.transact(22, _data, _reply, 0);
+ _reply.readException();
+ } finally {
+ _reply.recycle();
+ _data.recycle();
+ }
+ }
+
+ public boolean getAutoConnect() throws RemoteException {
+ boolean _result = false;
+ Parcel _data = Parcel.obtain();
+ Parcel _reply = Parcel.obtain();
+ try {
+ _data.writeInterfaceToken("android.microntek.mtcser.BTServiceInf");
+ this.mRemote.transact(23, _data, _reply, 0);
+ _reply.readException();
+ if (_reply.readInt() != 0) {
+ _result = true;
+ }
+ _reply.recycle();
+ _data.recycle();
+ } catch (Throwable th) {
+ _reply.recycle();
+ _data.recycle();
+ }
+
+ return _result;
+ }
+
+ public void setAutoAnswer(boolean auto) throws RemoteException {
+ int i = 0;
+ Parcel _data = Parcel.obtain();
+ Parcel _reply = Parcel.obtain();
+ try {
+ _data.writeInterfaceToken("android.microntek.mtcser.BTServiceInf");
+ if (auto) {
+ i = 1;
+ }
+ _data.writeInt(i);
+ this.mRemote.transact(24, _data, _reply, 0);
+ _reply.readException();
+ } finally {
+ _reply.recycle();
+ _data.recycle();
+ }
+ }
+
+ public boolean getAutoAnswer() throws RemoteException {
+ boolean _result = false;
+ Parcel _data = Parcel.obtain();
+ Parcel _reply = Parcel.obtain();
+ try {
+ _data.writeInterfaceToken("android.microntek.mtcser.BTServiceInf");
+ this.mRemote.transact(25, _data, _reply, 0);
+ _reply.readException();
+ if (_reply.readInt() != 0) {
+ _result = true;
+ }
+ _reply.recycle();
+ _data.recycle();
+ } catch (Throwable th) {
+ _reply.recycle();
+ _data.recycle();
+ }
+
+ return _result;
+ }
+
+ public void connectBT(String mac) throws RemoteException {
+ Parcel _data = Parcel.obtain();
+ Parcel _reply = Parcel.obtain();
+ try {
+ _data.writeInterfaceToken("android.microntek.mtcser.BTServiceInf");
+ _data.writeString(mac);
+ this.mRemote.transact(26, _data, _reply, 0);
+ _reply.readException();
+ } finally {
+ _reply.recycle();
+ _data.recycle();
+ }
+ }
+
+ public void disconnectBT(String mac) throws RemoteException {
+ Parcel _data = Parcel.obtain();
+ Parcel _reply = Parcel.obtain();
+ try {
+ _data.writeInterfaceToken("android.microntek.mtcser.BTServiceInf");
+ _data.writeString(mac);
+ this.mRemote.transact(27, _data, _reply, 0);
+ _reply.readException();
+ } finally {
+ _reply.recycle();
+ _data.recycle();
+ }
+ }
+
+ public void connectOBD(String mac) throws RemoteException {
+ Parcel _data = Parcel.obtain();
+ Parcel _reply = Parcel.obtain();
+ try {
+ _data.writeInterfaceToken("android.microntek.mtcser.BTServiceInf");
+ _data.writeString(mac);
+ this.mRemote.transact(28, _data, _reply, 0);
+ _reply.readException();
+ } finally {
+ _reply.recycle();
+ _data.recycle();
+ }
+ }
+
+ public void disconnectOBD(String mac) throws RemoteException {
+ Parcel _data = Parcel.obtain();
+ Parcel _reply = Parcel.obtain();
+ try {
+ _data.writeInterfaceToken("android.microntek.mtcser.BTServiceInf");
+ _data.writeString(mac);
+ this.mRemote.transact(29, _data, _reply, 0);
+ _reply.readException();
+ } finally {
+ _reply.recycle();
+ _data.recycle();
+ }
+ }
+
+ public void deleteOBD(String mac) throws RemoteException {
+ Parcel _data = Parcel.obtain();
+ Parcel _reply = Parcel.obtain();
+ try {
+ _data.writeInterfaceToken("android.microntek.mtcser.BTServiceInf");
+ _data.writeString(mac);
+ this.mRemote.transact(30, _data, _reply, 0);
+ _reply.readException();
+ } finally {
+ _reply.recycle();
+ _data.recycle();
+ }
+ }
+
+ public void deleteBT(String mac) throws RemoteException {
+ Parcel _data = Parcel.obtain();
+ Parcel _reply = Parcel.obtain();
+ try {
+ _data.writeInterfaceToken("android.microntek.mtcser.BTServiceInf");
+ _data.writeString(mac);
+ this.mRemote.transact(31, _data, _reply, 0);
+ _reply.readException();
+ } finally {
+ _reply.recycle();
+ _data.recycle();
+ }
+ }
+
+ public void syncMatchList() throws RemoteException {
+ Parcel _data = Parcel.obtain();
+ Parcel _reply = Parcel.obtain();
+ try {
+ _data.writeInterfaceToken("android.microntek.mtcser.BTServiceInf");
+ this.mRemote.transact(32, _data, _reply, 0);
+ _reply.readException();
+ } finally {
+ _reply.recycle();
+ _data.recycle();
+ }
+ }
+
+ public List getMatchList() throws RemoteException {
+ Parcel _data = Parcel.obtain();
+ Parcel _reply = Parcel.obtain();
+ try {
+ _data.writeInterfaceToken("android.microntek.mtcser.BTServiceInf");
+ this.mRemote.transact(33, _data, _reply, 0);
+ _reply.readException();
+ List _result = _reply.createStringArrayList();
+ return _result;
+ } finally {
+ _reply.recycle();
+ _data.recycle();
+ }
+ }
+
+ public List getDeviceList() throws RemoteException {
+ Parcel _data = Parcel.obtain();
+ Parcel _reply = Parcel.obtain();
+ try {
+ _data.writeInterfaceToken("android.microntek.mtcser.BTServiceInf");
+ this.mRemote.transact(34, _data, _reply, 0);
+ _reply.readException();
+ List _result = _reply.createStringArrayList();
+ return _result;
+ } finally {
+ _reply.recycle();
+ _data.recycle();
+ }
+ }
+
+ public List getHistoryList() throws RemoteException {
+ Parcel _data = Parcel.obtain();
+ Parcel _reply = Parcel.obtain();
+ try {
+ _data.writeInterfaceToken("android.microntek.mtcser.BTServiceInf");
+ this.mRemote.transact(35, _data, _reply, 0);
+ _reply.readException();
+ List _result = _reply.createStringArrayList();
+ return _result;
+ } finally {
+ _reply.recycle();
+ _data.recycle();
+ }
+ }
+
+ public List getPhoneBookList() throws RemoteException {
+ Parcel _data = Parcel.obtain();
+ Parcel _reply = Parcel.obtain();
+ try {
+ _data.writeInterfaceToken("android.microntek.mtcser.BTServiceInf");
+ this.mRemote.transact(36, _data, _reply, 0);
+ _reply.readException();
+ List _result = _reply.createStringArrayList();
+ return _result;
+ } finally {
+ _reply.recycle();
+ _data.recycle();
+ }
+ }
+
+ public void setPhoneBookList(List list) throws RemoteException {
+ Parcel _data = Parcel.obtain();
+ Parcel _reply = Parcel.obtain();
+ try {
+ _data.writeInterfaceToken("android.microntek.mtcser.BTServiceInf");
+ _data.writeStringList(list);
+ this.mRemote.transact(37, _data, _reply, 0);
+ _reply.readException();
+ } finally {
+ _reply.recycle();
+ _data.recycle();
+ }
+ }
+
+ public void deleteHistory(int idx) throws RemoteException {
+ Parcel _data = Parcel.obtain();
+ Parcel _reply = Parcel.obtain();
+ try {
+ _data.writeInterfaceToken("android.microntek.mtcser.BTServiceInf");
+ _data.writeInt(idx);
+ this.mRemote.transact(38, _data, _reply, 0);
+ _reply.readException();
+ } finally {
+ _reply.recycle();
+ _data.recycle();
+ }
+ }
+
+ public void deleteHistoryAll() throws RemoteException {
+ Parcel _data = Parcel.obtain();
+ Parcel _reply = Parcel.obtain();
+ try {
+ _data.writeInterfaceToken("android.microntek.mtcser.BTServiceInf");
+ this.mRemote.transact(39, _data, _reply, 0);
+ _reply.readException();
+ } finally {
+ _reply.recycle();
+ _data.recycle();
+ }
+ }
+
+ public void musicMute() throws RemoteException {
+ Parcel _data = Parcel.obtain();
+ Parcel _reply = Parcel.obtain();
+ try {
+ _data.writeInterfaceToken("android.microntek.mtcser.BTServiceInf");
+ this.mRemote.transact(40, _data, _reply, 0);
+ _reply.readException();
+ } finally {
+ _reply.recycle();
+ _data.recycle();
+ }
+ }
+
+ public void musicUnmute() throws RemoteException {
+ Parcel _data = Parcel.obtain();
+ Parcel _reply = Parcel.obtain();
+ try {
+ _data.writeInterfaceToken("android.microntek.mtcser.BTServiceInf");
+ this.mRemote.transact(41, _data, _reply, 0);
+ _reply.readException();
+ } finally {
+ _reply.recycle();
+ _data.recycle();
+ }
+ }
+
+ public void scanStart() throws RemoteException {
+ Parcel _data = Parcel.obtain();
+ Parcel _reply = Parcel.obtain();
+ try {
+ _data.writeInterfaceToken("android.microntek.mtcser.BTServiceInf");
+ this.mRemote.transact(42, _data, _reply, 0);
+ _reply.readException();
+ } finally {
+ _reply.recycle();
+ _data.recycle();
+ }
+ }
+
+ public void scanStop() throws RemoteException {
+ Parcel _data = Parcel.obtain();
+ Parcel _reply = Parcel.obtain();
+ try {
+ _data.writeInterfaceToken("android.microntek.mtcser.BTServiceInf");
+ this.mRemote.transact(43, _data, _reply, 0);
+ _reply.readException();
+ } finally {
+ _reply.recycle();
+ _data.recycle();
+ }
+ }
+
+ public void dialOut(String s) throws RemoteException {
+ Parcel _data = Parcel.obtain();
+ Parcel _reply = Parcel.obtain();
+ try {
+ _data.writeInterfaceToken("android.microntek.mtcser.BTServiceInf");
+ _data.writeString(s);
+ this.mRemote.transact(44, _data, _reply, 0);
+ _reply.readException();
+ } finally {
+ _reply.recycle();
+ _data.recycle();
+ }
+ }
+
+ public void dialOutSub(char b) throws RemoteException {
+ Parcel _data = Parcel.obtain();
+ Parcel _reply = Parcel.obtain();
+ try {
+ _data.writeInterfaceToken("android.microntek.mtcser.BTServiceInf");
+ _data.writeInt(b);
+ this.mRemote.transact(45, _data, _reply, 0);
+ _reply.readException();
+ } finally {
+ _reply.recycle();
+ _data.recycle();
+ }
+ }
+
+ public void reDial() throws RemoteException {
+ Parcel _data = Parcel.obtain();
+ Parcel _reply = Parcel.obtain();
+ try {
+ _data.writeInterfaceToken("android.microntek.mtcser.BTServiceInf");
+ this.mRemote.transact(46, _data, _reply, 0);
+ _reply.readException();
+ } finally {
+ _reply.recycle();
+ _data.recycle();
+ }
+ }
+
+ public String getMusicInfo() throws RemoteException {
+ Parcel _data = Parcel.obtain();
+ Parcel _reply = Parcel.obtain();
+ try {
+ _data.writeInterfaceToken("android.microntek.mtcser.BTServiceInf");
+ this.mRemote.transact(47, _data, _reply, 0);
+ _reply.readException();
+ String _result = _reply.readString();
+ return _result;
+ } finally {
+ _reply.recycle();
+ _data.recycle();
+ }
+ }
+
+ public int getOBDstate() throws RemoteException {
+ Parcel _data = Parcel.obtain();
+ Parcel _reply = Parcel.obtain();
+ try {
+ _data.writeInterfaceToken("android.microntek.mtcser.BTServiceInf");
+ this.mRemote.transact(48, _data, _reply, 0);
+ _reply.readException();
+ int _result = _reply.readInt();
+ return _result;
+ } finally {
+ _reply.recycle();
+ _data.recycle();
+ }
+ }
+ }
+
+ public static BTServiceInf asInterface(IBinder obj) {
+ if (obj == null) {
+ return null;
+ }
+ IInterface iin = obj.queryLocalInterface("android.microntek.mtcser.BTServiceInf");
+ if (iin == null || !(iin instanceof BTServiceInf)) {
+ return new Proxy(obj);
+ }
+ return (BTServiceInf) iin;
+ }
+
+ public boolean onTransact(int code, Parcel data, Parcel reply, int flags) throws RemoteException {
+ int _arg0 = 0;
+ byte _result;
+ String _result2;
+ boolean _arg02 = false;
+ boolean _result3;
+ List _result4;
+ switch (code) {
+ case 1:
+ data.enforceInterface("android.microntek.mtcser.BTServiceInf");
+ init();
+ reply.writeNoException();
+ return true;
+ case 2:
+ data.enforceInterface("android.microntek.mtcser.BTServiceInf");
+ _result = getBTState();
+ reply.writeNoException();
+ reply.writeByte(_result);
+ return true;
+ case 3:
+ data.enforceInterface("android.microntek.mtcser.BTServiceInf");
+ _result = getAVState();
+ reply.writeNoException();
+ reply.writeByte(_result);
+ return true;
+ case 4:
+ data.enforceInterface("android.microntek.mtcser.BTServiceInf");
+ _result2 = getDialOutNum();
+ reply.writeNoException();
+ reply.writeString(_result2);
+ return true;
+ case 5:
+ data.enforceInterface("android.microntek.mtcser.BTServiceInf");
+ _result2 = getCallInNum();
+ reply.writeNoException();
+ reply.writeString(_result2);
+ return true;
+ case 6:
+ data.enforceInterface("android.microntek.mtcser.BTServiceInf");
+ _result2 = getPhoneNum();
+ reply.writeNoException();
+ reply.writeString(_result2);
+ return true;
+ case 7:
+ data.enforceInterface("android.microntek.mtcser.BTServiceInf");
+ long _result5 = getNowDevAddr();
+ reply.writeNoException();
+ reply.writeLong(_result5);
+ return true;
+ case 8:
+ data.enforceInterface("android.microntek.mtcser.BTServiceInf");
+ _result2 = getNowDevName();
+ reply.writeNoException();
+ reply.writeString(_result2);
+ return true;
+ case 9:
+ data.enforceInterface("android.microntek.mtcser.BTServiceInf");
+ avPlayPause();
+ reply.writeNoException();
+ return true;
+ case 10:
+ data.enforceInterface("android.microntek.mtcser.BTServiceInf");
+ avPlayStop();
+ reply.writeNoException();
+ return true;
+ case 11:
+ data.enforceInterface("android.microntek.mtcser.BTServiceInf");
+ avPlayPrev();
+ reply.writeNoException();
+ return true;
+ case 12:
+ data.enforceInterface("android.microntek.mtcser.BTServiceInf");
+ avPlayNext();
+ reply.writeNoException();
+ return true;
+ case 13:
+ data.enforceInterface("android.microntek.mtcser.BTServiceInf");
+ answerCall();
+ reply.writeNoException();
+ return true;
+ case 14:
+ data.enforceInterface("android.microntek.mtcser.BTServiceInf");
+ hangupCall();
+ reply.writeNoException();
+ return true;
+ case 15:
+ data.enforceInterface("android.microntek.mtcser.BTServiceInf");
+ rejectCall();
+ reply.writeNoException();
+ return true;
+ case 16:
+ data.enforceInterface("android.microntek.mtcser.BTServiceInf");
+ switchVoice();
+ reply.writeNoException();
+ return true;
+ case 17:
+ data.enforceInterface("android.microntek.mtcser.BTServiceInf");
+ syncPhonebook();
+ reply.writeNoException();
+ return true;
+ case 18:
+ data.enforceInterface("android.microntek.mtcser.BTServiceInf");
+ _result2 = getModuleName();
+ reply.writeNoException();
+ reply.writeString(_result2);
+ return true;
+ case 19:
+ data.enforceInterface("android.microntek.mtcser.BTServiceInf");
+ _result2 = getModulePassword();
+ reply.writeNoException();
+ reply.writeString(_result2);
+ return true;
+ case 20:
+ data.enforceInterface("android.microntek.mtcser.BTServiceInf");
+ setModuleName(data.readString());
+ reply.writeNoException();
+ return true;
+ case 21:
+ data.enforceInterface("android.microntek.mtcser.BTServiceInf");
+ setModulePassword(data.readString());
+ reply.writeNoException();
+ return true;
+ case 22:
+ data.enforceInterface("android.microntek.mtcser.BTServiceInf");
+ if (data.readInt() != 0) {
+ _arg02 = true;
+ }
+ setAutoConnect(_arg02);
+ reply.writeNoException();
+ return true;
+ case 23:
+ data.enforceInterface("android.microntek.mtcser.BTServiceInf");
+ _result3 = getAutoConnect();
+ reply.writeNoException();
+ if (_result3) {
+ _arg0 = 1;
+ }
+ reply.writeInt(_arg0);
+ return true;
+ case 24:
+ data.enforceInterface("android.microntek.mtcser.BTServiceInf");
+ if (data.readInt() != 0) {
+ _arg02 = true;
+ }
+ setAutoAnswer(_arg02);
+ reply.writeNoException();
+ return true;
+ case 25:
+ data.enforceInterface("android.microntek.mtcser.BTServiceInf");
+ _result3 = getAutoAnswer();
+ reply.writeNoException();
+ if (_result3) {
+ _arg0 = 1;
+ }
+ reply.writeInt(_arg0);
+ return true;
+ case 26:
+ data.enforceInterface("android.microntek.mtcser.BTServiceInf");
+ connectBT(data.readString());
+ reply.writeNoException();
+ return true;
+ case 27:
+ data.enforceInterface("android.microntek.mtcser.BTServiceInf");
+ disconnectBT(data.readString());
+ reply.writeNoException();
+ return true;
+ case 28:
+ data.enforceInterface("android.microntek.mtcser.BTServiceInf");
+ connectOBD(data.readString());
+ reply.writeNoException();
+ return true;
+ case 29:
+ data.enforceInterface("android.microntek.mtcser.BTServiceInf");
+ disconnectOBD(data.readString());
+ reply.writeNoException();
+ return true;
+ case 30:
+ data.enforceInterface("android.microntek.mtcser.BTServiceInf");
+ deleteOBD(data.readString());
+ reply.writeNoException();
+ return true;
+ case 31:
+ data.enforceInterface("android.microntek.mtcser.BTServiceInf");
+ deleteBT(data.readString());
+ reply.writeNoException();
+ return true;
+ case 32:
+ data.enforceInterface("android.microntek.mtcser.BTServiceInf");
+ syncMatchList();
+ reply.writeNoException();
+ return true;
+ case 33:
+ data.enforceInterface("android.microntek.mtcser.BTServiceInf");
+ _result4 = getMatchList();
+ reply.writeNoException();
+ reply.writeStringList(_result4);
+ return true;
+ case 34:
+ data.enforceInterface("android.microntek.mtcser.BTServiceInf");
+ _result4 = getDeviceList();
+ reply.writeNoException();
+ reply.writeStringList(_result4);
+ return true;
+ case 35:
+ data.enforceInterface("android.microntek.mtcser.BTServiceInf");
+ _result4 = getHistoryList();
+ reply.writeNoException();
+ reply.writeStringList(_result4);
+ return true;
+ case 36:
+ data.enforceInterface("android.microntek.mtcser.BTServiceInf");
+ _result4 = getPhoneBookList();
+ reply.writeNoException();
+ reply.writeStringList(_result4);
+ return true;
+ case 37:
+ data.enforceInterface("android.microntek.mtcser.BTServiceInf");
+ setPhoneBookList(data.createStringArrayList());
+ reply.writeNoException();
+ return true;
+ case 38:
+ data.enforceInterface("android.microntek.mtcser.BTServiceInf");
+ deleteHistory(data.readInt());
+ reply.writeNoException();
+ return true;
+ case 39:
+ data.enforceInterface("android.microntek.mtcser.BTServiceInf");
+ deleteHistoryAll();
+ reply.writeNoException();
+ return true;
+ case 40:
+ data.enforceInterface("android.microntek.mtcser.BTServiceInf");
+ musicMute();
+ reply.writeNoException();
+ return true;
+ case 41:
+ data.enforceInterface("android.microntek.mtcser.BTServiceInf");
+ musicUnmute();
+ reply.writeNoException();
+ return true;
+ case 42:
+ data.enforceInterface("android.microntek.mtcser.BTServiceInf");
+ scanStart();
+ reply.writeNoException();
+ return true;
+ case 43:
+ data.enforceInterface("android.microntek.mtcser.BTServiceInf");
+ scanStop();
+ reply.writeNoException();
+ return true;
+ case 44:
+ data.enforceInterface("android.microntek.mtcser.BTServiceInf");
+ dialOut(data.readString());
+ reply.writeNoException();
+ return true;
+ case 45:
+ data.enforceInterface("android.microntek.mtcser.BTServiceInf");
+ dialOutSub((char) data.readInt());
+ reply.writeNoException();
+ return true;
+ case 46:
+ data.enforceInterface("android.microntek.mtcser.BTServiceInf");
+ reDial();
+ reply.writeNoException();
+ return true;
+ case 47:
+ data.enforceInterface("android.microntek.mtcser.BTServiceInf");
+ _result2 = getMusicInfo();
+ reply.writeNoException();
+ reply.writeString(_result2);
+ return true;
+ case 48:
+ data.enforceInterface("android.microntek.mtcser.BTServiceInf");
+ int _result6 = getOBDstate();
+ reply.writeNoException();
+ reply.writeInt(_result6);
+ return true;
+ case 1598968902:
+ reply.writeString("android.microntek.mtcser.BTServiceInf");
+ return true;
+ default:
+ return super.onTransact(code, data, reply, flags);
+ }
+ }
+ }
+
+ void answerCall() throws RemoteException;
+
+ void avPlayNext() throws RemoteException;
+
+ void avPlayPause() throws RemoteException;
+
+ void avPlayPrev() throws RemoteException;
+
+ void avPlayStop() throws RemoteException;
+
+ void connectBT(String str) throws RemoteException;
+
+ void connectOBD(String str) throws RemoteException;
+
+ void deleteBT(String str) throws RemoteException;
+
+ void deleteHistory(int i) throws RemoteException;
+
+ void deleteHistoryAll() throws RemoteException;
+
+ void deleteOBD(String str) throws RemoteException;
+
+ void dialOut(String str) throws RemoteException;
+
+ void dialOutSub(char c) throws RemoteException;
+
+ void disconnectBT(String str) throws RemoteException;
+
+ void disconnectOBD(String str) throws RemoteException;
+
+ byte getAVState() throws RemoteException;
+
+ boolean getAutoAnswer() throws RemoteException;
+
+ boolean getAutoConnect() throws RemoteException;
+
+ byte getBTState() throws RemoteException;
+
+ String getCallInNum() throws RemoteException;
+
+ List getDeviceList() throws RemoteException;
+
+ String getDialOutNum() throws RemoteException;
+
+ List getHistoryList() throws RemoteException;
+
+ List getMatchList() throws RemoteException;
+
+ String getModuleName() throws RemoteException;
+
+ String getModulePassword() throws RemoteException;
+
+ String getMusicInfo() throws RemoteException;
+
+ long getNowDevAddr() throws RemoteException;
+
+ String getNowDevName() throws RemoteException;
+
+ int getOBDstate() throws RemoteException;
+
+ List getPhoneBookList() throws RemoteException;
+
+ String getPhoneNum() throws RemoteException;
+
+ void hangupCall() throws RemoteException;
+
+ void init() throws RemoteException;
+
+ void musicMute() throws RemoteException;
+
+ void musicUnmute() throws RemoteException;
+
+ void reDial() throws RemoteException;
+
+ void rejectCall() throws RemoteException;
+
+ void scanStart() throws RemoteException;
+
+ void scanStop() throws RemoteException;
+
+ void setAutoAnswer(boolean z) throws RemoteException;
+
+ void setAutoConnect(boolean z) throws RemoteException;
+
+ void setModuleName(String str) throws RemoteException;
+
+ void setModulePassword(String str) throws RemoteException;
+
+ void setPhoneBookList(List list) throws RemoteException;
+
+ void switchVoice() throws RemoteException;
+
+ void syncMatchList() throws RemoteException;
+
+ void syncPhonebook() throws RemoteException;
+}
diff --git a/app/src/main/java/com/f1x/mtcdialer/BluetoothServiceActivity.java b/app/src/main/java/com/f1x/mtcdialer/BluetoothServiceActivity.java
new file mode 100644
index 0000000..5254fad
--- /dev/null
+++ b/app/src/main/java/com/f1x/mtcdialer/BluetoothServiceActivity.java
@@ -0,0 +1,75 @@
+package com.f1x.mtcdialer;
+
+import android.app.Activity;
+import android.content.ComponentName;
+import android.content.Intent;
+import android.content.ServiceConnection;
+import android.microntek.mtcser.BTServiceInf;
+import android.os.Bundle;
+import android.os.IBinder;
+import android.os.RemoteException;
+import android.widget.Toast;
+
+/**
+ * Created by COMPUTER on 2017-02-17.
+ */
+
+public abstract class BluetoothServiceActivity extends Activity {
+ @Override
+ protected void onCreate(Bundle savedInstance) {
+ super.onCreate(savedInstance);
+
+ Intent startBluetoothServiceIntent = new Intent();
+ startBluetoothServiceIntent.setComponent(new ComponentName("android.microntek.mtcser", "android.microntek.mtcser.BTSerialService"));
+
+ 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();
+
+ private final ServiceConnection mServiceConnection = new ServiceConnection() {
+ @Override
+ public void onServiceConnected(ComponentName componentName, IBinder iBinder) {
+ if(iBinder == null) {
+ Toast.makeText(BluetoothServiceActivity.this, BluetoothServiceActivity.this.getText(R.string.BluetoothNotAvailable), Toast.LENGTH_LONG).show();
+ BluetoothServiceActivity.this.finish();
+ return;
+ }
+
+ mBluetoothServiceInterface = BTServiceInf.Stub.asInterface(iBinder);
+
+ if(mBluetoothServiceInterface == null) {
+ Toast.makeText(BluetoothServiceActivity.this, BluetoothServiceActivity.this.getText(R.string.BluetoothNotAvailable), Toast.LENGTH_LONG).show();
+ BluetoothServiceActivity.this.finish();
+ return;
+ }
+
+ try {
+ mBluetoothServiceInterface.init();
+ BluetoothServiceActivity.this.onServiceConnected();
+ } catch (RemoteException e) {
+ e.printStackTrace();
+ Toast.makeText(BluetoothServiceActivity.this, e.getLocalizedMessage(), Toast.LENGTH_LONG).show();
+ BluetoothServiceActivity.this.finish();
+ }
+ }
+
+ @Override
+ public void onServiceDisconnected(ComponentName componentName) {
+ mBluetoothServiceInterface = null;
+ BluetoothServiceActivity.this.onServiceDisconnected();
+ }
+ };
+
+ protected BTServiceInf mBluetoothServiceInterface;
+}
diff --git a/app/src/main/java/com/f1x/mtcdialer/DialActivity.java b/app/src/main/java/com/f1x/mtcdialer/DialActivity.java
new file mode 100644
index 0000000..4208dc3
--- /dev/null
+++ b/app/src/main/java/com/f1x/mtcdialer/DialActivity.java
@@ -0,0 +1,50 @@
+package com.f1x.mtcdialer;
+
+import android.content.Intent;
+import android.net.Uri;
+import android.os.Bundle;
+import android.os.RemoteException;
+import android.widget.Toast;
+
+/**
+ * Created by COMPUTER on 2017-02-17.
+ */
+
+public class DialActivity extends BluetoothServiceActivity {
+ @Override
+ protected void onCreate(Bundle savedInstance) {
+ super.onCreate(savedInstance);
+ setContentView(R.layout.layout_activity);
+ }
+
+ @Override
+ public void onServiceConnected() {
+ final String number = extractPhoneNumber(getIntent());
+
+ if (number != null && !number.isEmpty()) {
+ try {
+ mBluetoothServiceInterface.dialOut(number);
+ } catch (RemoteException e) {
+ e.printStackTrace();
+ Toast.makeText(this, e.getLocalizedMessage(), Toast.LENGTH_LONG).show();
+ }
+ }
+
+ DialActivity.this.finish();
+ }
+
+ String extractPhoneNumber(Intent intent) {
+ Uri uri = intent.getData();
+
+ if(uri != null && uri.getScheme().equals("tel")) {
+ return uri.toString().replace("tel:", "").replaceAll("\\s+", "");
+ } else {
+ return null;
+ }
+ }
+
+ @Override
+ public void onServiceDisconnected() {
+
+ }
+}
diff --git a/app/src/main/java/com/f1x/mtcdialer/PhoneBookActivity.java b/app/src/main/java/com/f1x/mtcdialer/PhoneBookActivity.java
new file mode 100644
index 0000000..ebdb41e
--- /dev/null
+++ b/app/src/main/java/com/f1x/mtcdialer/PhoneBookActivity.java
@@ -0,0 +1,85 @@
+package com.f1x.mtcdialer;
+
+import android.os.Bundle;
+import android.os.RemoteException;
+import android.widget.Toast;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.TreeMap;
+
+/**
+ * Created by COMPUTER on 2017-02-17.
+ */
+
+public abstract class PhoneBookActivity extends BluetoothServiceActivity {
+ @Override
+ protected void onCreate(Bundle savedInstance) {
+ super.onCreate(savedInstance);
+ mPhoneBookRecords = new TreeMap<>(String.CASE_INSENSITIVE_ORDER);
+ }
+
+ @Override
+ protected void onDestroy() {
+ super.onDestroy();
+ mPhoneBookReceiver.unregister(this);
+ }
+
+ @Override
+ protected void onServiceConnected() {
+ try {
+ List phoneBookRecords = mBluetoothServiceInterface.getPhoneBookList();
+
+ if(!phoneBookRecords.isEmpty()) {
+ buildPhoneBook(phoneBookRecords);
+ onPhoneBookFetchFinished();
+ } else {
+ mPhoneBookReceiver.register(this);
+ mBluetoothServiceInterface.syncPhonebook();
+ }
+ } catch (RemoteException e) {
+ e.printStackTrace();
+ Toast.makeText(PhoneBookActivity.this, e.getLocalizedMessage(), Toast.LENGTH_LONG).show();
+ finish();
+ }
+ }
+
+ private void buildPhoneBook(List phoneBookRecords) {
+ for(String phoneBookRecord : phoneBookRecords) {
+ String[] parsedRecord = phoneBookRecord.split("\\^");
+ String phoneNumber = parsedRecord[1].replaceAll("[^\\d\\+]", "");
+
+ mPhoneBookRecords.put(parsedRecord[0], phoneNumber);
+ }
+ }
+
+ 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);
+ PhoneBookActivity.this.onPhoneBookFetchFinished();
+
+ try {
+ PhoneBookActivity.this.mBluetoothServiceInterface.setPhoneBookList(mRawPhoneBookRecords);
+ } catch (RemoteException e) {
+ e.printStackTrace();
+ Toast.makeText(PhoneBookActivity.this, e.getLocalizedMessage(), Toast.LENGTH_LONG).show();
+ }
+
+ 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
new file mode 100644
index 0000000..7135f91
--- /dev/null
+++ b/app/src/main/java/com/f1x/mtcdialer/PhoneBookReceiver.java
@@ -0,0 +1,57 @@
+package com.f1x.mtcdialer;
+
+import android.content.BroadcastReceiver;
+import android.content.Context;
+import android.content.Intent;
+import android.content.IntentFilter;
+
+import java.util.Map;
+import java.util.TreeMap;
+
+/**
+ * Created by COMPUTER on 2017-02-18.
+ */
+
+public abstract class PhoneBookReceiver extends BroadcastReceiver {
+ public PhoneBookReceiver() {
+ mRegistered = false;
+ }
+
+ @Override
+ public void onReceive(Context context, Intent intent) {
+ if (intent.getAction().equals(BLUETOOTH_REPORT_ACTION)) {
+ if (intent.hasExtra(PHONEBOOK_RECORD_EXTRA)) {
+ onPhoneBookRecordFetched(intent.getStringExtra(PHONEBOOK_RECORD_EXTRA));
+ } else if (intent.hasExtra(PHONEBOOK_SYNC_END_EXTRA)) {
+ onPhoneBookFetchFinished();
+ }
+ }
+ }
+
+ public void register(Context context) {
+ if(!mRegistered) {
+ mRegistered = true;
+
+ IntentFilter intentFilter = new IntentFilter();
+ intentFilter.addAction(BLUETOOTH_REPORT_ACTION);
+
+ context.registerReceiver(this, intentFilter);
+ }
+ }
+
+ public void unregister(Context context) {
+ 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
new file mode 100644
index 0000000..acd21fc
--- /dev/null
+++ b/app/src/main/java/com/f1x/mtcdialer/VoiceSelectionCallerActivity.java
@@ -0,0 +1,83 @@
+package com.f1x.mtcdialer;
+
+import android.content.Intent;
+import android.net.Uri;
+import android.os.Bundle;
+import android.speech.RecognizerIntent;
+import android.telephony.PhoneNumberUtils;
+import android.widget.Toast;
+
+import java.util.List;
+import java.util.Locale;
+
+/**
+ * Created by COMPUTER on 2017-02-17.
+ */
+
+public class VoiceSelectionCallerActivity extends PhoneBookActivity {
+ @Override
+ protected void onCreate(Bundle savedInstance) {
+ super.onCreate(savedInstance);
+ setContentView(R.layout.activity_voice_selection_caller);
+ }
+
+ @Override
+ protected void onServiceDisconnected() {}
+
+ @Override
+ 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));
+
+ startActivityForResult(intent, 1);
+ }
+
+ @Override
+ protected void onActivityResult(int requestCode, int resultCode, Intent data) {
+ if (resultCode != RESULT_OK || data == null) {
+ Toast.makeText(this, this.getText(R.string.SpeechNotRecognized), Toast.LENGTH_LONG).show();
+ VoiceSelectionCallerActivity.this.finish();
+ return;
+ }
+
+ List texts = data.getStringArrayListExtra(RecognizerIntent.EXTRA_RESULTS);
+ if (texts.isEmpty()) {
+ Toast.makeText(this, this.getText(R.string.SpeechNotRecognized), Toast.LENGTH_LONG).show();
+ VoiceSelectionCallerActivity.this.finish();
+ return;
+ }
+
+ String input = texts.get(0);
+ if (input.isEmpty()) {
+ Toast.makeText(this, this.getText(R.string.SpeechNotRecognized), Toast.LENGTH_LONG).show();
+ VoiceSelectionCallerActivity.this.finish();
+ return;
+ }
+
+ processSpeechInput(input);
+ VoiceSelectionCallerActivity.this.finish();
+ }
+
+ private void processSpeechInput(String input) {
+ String phoneNumber = null;
+
+ if (mPhoneBookRecords.containsKey(input)) {
+ phoneNumber = mPhoneBookRecords.get(input);
+ } else if (input.replaceAll("\\s+", "").matches("\\+?\\d+?")) {
+ phoneNumber = input;
+ }
+
+ if(phoneNumber != null) {
+ String text = String.format(this.getString(R.string.CallingTo), input);
+ Toast.makeText(this, text, Toast.LENGTH_LONG).show();
+
+ Intent dialIntent = new Intent(this, DialActivity.class);
+ dialIntent.setData(Uri.parse("tel:" + phoneNumber));
+ startActivity(dialIntent);
+ } else {
+ String text = String.format(this.getString(R.string.PhoneBookEntryNotFound), input);
+ Toast.makeText(this, text, Toast.LENGTH_LONG).show();
+ }
+ }
+}
diff --git a/app/src/main/res/layout/activity_voice_selection_caller.xml b/app/src/main/res/layout/activity_voice_selection_caller.xml
new file mode 100644
index 0000000..d9f4659
--- /dev/null
+++ b/app/src/main/res/layout/activity_voice_selection_caller.xml
@@ -0,0 +1,21 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/layout_activity.xml b/app/src/main/res/layout/layout_activity.xml
new file mode 100644
index 0000000..25823d4
--- /dev/null
+++ b/app/src/main/res/layout/layout_activity.xml
@@ -0,0 +1,8 @@
+
+
+
diff --git a/app/src/main/res/mipmap-hdpi/ic_launcher.png b/app/src/main/res/mipmap-hdpi/ic_launcher.png
new file mode 100644
index 0000000..db0c75a
Binary files /dev/null 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
new file mode 100644
index 0000000..f268190
Binary files /dev/null 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
new file mode 100644
index 0000000..2445d72
Binary files /dev/null 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
new file mode 100644
index 0000000..2199cd2
Binary files /dev/null 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
new file mode 100644
index 0000000..68f0526
Binary files /dev/null and b/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png differ
diff --git a/app/src/main/res/values-pl/strings.xml b/app/src/main/res/values-pl/strings.xml
new file mode 100644
index 0000000..5d3efb4
--- /dev/null
+++ b/app/src/main/res/values-pl/strings.xml
@@ -0,0 +1,9 @@
+
+
+ Powiedz, gdzie chcesz zadzwonić
+ Bluetooth jest niedostępny
+ Nie można rozpoznać mowy
+ Wpis o nazwie\'%1$s\' nie został znaleziony w książce telefonicznej
+ Dzwonię do \'%1$s\'
+ Łączę z serwisem bluetooth...
+
\ No newline at end of file
diff --git a/app/src/main/res/values-w820dp/dimens.xml b/app/src/main/res/values-w820dp/dimens.xml
new file mode 100644
index 0000000..63fc816
--- /dev/null
+++ b/app/src/main/res/values-w820dp/dimens.xml
@@ -0,0 +1,6 @@
+
+
+ 64dp
+
diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml
new file mode 100644
index 0000000..3ab3e9c
--- /dev/null
+++ b/app/src/main/res/values/colors.xml
@@ -0,0 +1,6 @@
+
+
+ #3F51B5
+ #303F9F
+ #FF4081
+
diff --git a/app/src/main/res/values/dimens.xml b/app/src/main/res/values/dimens.xml
new file mode 100644
index 0000000..47c8224
--- /dev/null
+++ b/app/src/main/res/values/dimens.xml
@@ -0,0 +1,5 @@
+
+
+ 16dp
+ 16dp
+
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
new file mode 100644
index 0000000..491f962
--- /dev/null
+++ b/app/src/main/res/values/strings.xml
@@ -0,0 +1,9 @@
+
+ MtcDialer
+ Say where do you want to call
+ Bluetooth is not available
+ Speech could not be recognized
+ Could not find phone number for \'%1$s\'
+ Calling to \'%1$s\'
+ Connecting to bluetooth service...
+
diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml
new file mode 100644
index 0000000..5885930
--- /dev/null
+++ b/app/src/main/res/values/styles.xml
@@ -0,0 +1,11 @@
+
+
+
+
+
+
diff --git a/build.gradle b/build.gradle
new file mode 100644
index 0000000..74b2ab0
--- /dev/null
+++ b/build.gradle
@@ -0,0 +1,23 @@
+// Top-level build file where you can add configuration options common to all sub-projects/modules.
+
+buildscript {
+ repositories {
+ jcenter()
+ }
+ dependencies {
+ classpath 'com.android.tools.build:gradle:2.2.3'
+
+ // 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
+}
diff --git a/gradle.properties b/gradle.properties
new file mode 100644
index 0000000..aac7c9b
--- /dev/null
+++ b/gradle.properties
@@ -0,0 +1,17 @@
+# 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.
+org.gradle.jvmargs=-Xmx1536m
+
+# 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
diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar
new file mode 100644
index 0000000..13372ae
Binary files /dev/null and b/gradle/wrapper/gradle-wrapper.jar differ
diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties
new file mode 100644
index 0000000..04e285f
--- /dev/null
+++ b/gradle/wrapper/gradle-wrapper.properties
@@ -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.14.1-all.zip
diff --git a/gradlew b/gradlew
new file mode 100644
index 0000000..9d82f78
--- /dev/null
+++ b/gradlew
@@ -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 "$@"
diff --git a/gradlew.bat b/gradlew.bat
new file mode 100644
index 0000000..8a0b282
--- /dev/null
+++ b/gradlew.bat
@@ -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
diff --git a/settings.gradle b/settings.gradle
new file mode 100644
index 0000000..e7b4def
--- /dev/null
+++ b/settings.gradle
@@ -0,0 +1 @@
+include ':app'