-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit d6077ec
Showing
40 changed files
with
1,662 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,131 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<module external.linked.project.id=":app" external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$/.." external.system.id="GRADLE" external.system.module.group="vwcardash" external.system.module.version="unspecified" type="JAVA_MODULE" version="4"> | ||
<component name="FacetManager"> | ||
<facet type="android-gradle" name="Android-Gradle"> | ||
<configuration> | ||
<option name="GRADLE_PROJECT_PATH" value=":app" /> | ||
</configuration> | ||
</facet> | ||
<facet type="android" name="Android"> | ||
<configuration> | ||
<option name="SELECTED_BUILD_VARIANT" value="debug" /> | ||
<option name="SELECTED_TEST_ARTIFACT" value="_android_test_" /> | ||
<option name="ASSEMBLE_TASK_NAME" value="assembleDebug" /> | ||
<option name="COMPILE_JAVA_TASK_NAME" value="compileDebugSources" /> | ||
<afterSyncTasks> | ||
<task>generateDebugSources</task> | ||
</afterSyncTasks> | ||
<option name="ALLOW_USER_CONFIGURATION" value="false" /> | ||
<option name="MANIFEST_FILE_RELATIVE_PATH" value="/src/main/AndroidManifest.xml" /> | ||
<option name="RES_FOLDER_RELATIVE_PATH" value="/src/main/res" /> | ||
<option name="RES_FOLDERS_RELATIVE_PATH" value="file://$MODULE_DIR$/src/main/res" /> | ||
<option name="ASSETS_FOLDER_RELATIVE_PATH" value="/src/main/assets" /> | ||
</configuration> | ||
</facet> | ||
</component> | ||
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_7" inherit-compiler-output="false"> | ||
<output url="file://$MODULE_DIR$/build/intermediates/classes/debug" /> | ||
<output-test url="file://$MODULE_DIR$/build/intermediates/classes/test/debug" /> | ||
<exclude-output /> | ||
<content url="file://$MODULE_DIR$"> | ||
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/r/debug" isTestSource="false" generated="true" /> | ||
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/aidl/debug" isTestSource="false" generated="true" /> | ||
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/buildConfig/debug" isTestSource="false" generated="true" /> | ||
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/rs/debug" isTestSource="false" generated="true" /> | ||
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/rs/debug" type="java-resource" /> | ||
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/resValues/debug" type="java-resource" /> | ||
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/r/androidTest/debug" isTestSource="true" generated="true" /> | ||
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/aidl/androidTest/debug" isTestSource="true" generated="true" /> | ||
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/buildConfig/androidTest/debug" isTestSource="true" generated="true" /> | ||
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/rs/androidTest/debug" isTestSource="true" generated="true" /> | ||
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/rs/androidTest/debug" type="java-test-resource" /> | ||
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/resValues/androidTest/debug" type="java-test-resource" /> | ||
<sourceFolder url="file://$MODULE_DIR$/src/debug/res" type="java-resource" /> | ||
<sourceFolder url="file://$MODULE_DIR$/src/debug/resources" type="java-resource" /> | ||
<sourceFolder url="file://$MODULE_DIR$/src/debug/assets" type="java-resource" /> | ||
<sourceFolder url="file://$MODULE_DIR$/src/debug/aidl" isTestSource="false" /> | ||
<sourceFolder url="file://$MODULE_DIR$/src/debug/java" isTestSource="false" /> | ||
<sourceFolder url="file://$MODULE_DIR$/src/debug/jni" isTestSource="false" /> | ||
<sourceFolder url="file://$MODULE_DIR$/src/debug/rs" isTestSource="false" /> | ||
<sourceFolder url="file://$MODULE_DIR$/src/debug/shaders" isTestSource="false" /> | ||
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/res" type="java-test-resource" /> | ||
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/resources" type="java-test-resource" /> | ||
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/assets" type="java-test-resource" /> | ||
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/aidl" isTestSource="true" /> | ||
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/java" isTestSource="true" /> | ||
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/jni" isTestSource="true" /> | ||
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/rs" isTestSource="true" /> | ||
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/shaders" isTestSource="true" /> | ||
<sourceFolder url="file://$MODULE_DIR$/src/main/res" type="java-resource" /> | ||
<sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" /> | ||
<sourceFolder url="file://$MODULE_DIR$/src/main/assets" type="java-resource" /> | ||
<sourceFolder url="file://$MODULE_DIR$/src/main/aidl" isTestSource="false" /> | ||
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" /> | ||
<sourceFolder url="file://$MODULE_DIR$/src/main/jni" isTestSource="false" /> | ||
<sourceFolder url="file://$MODULE_DIR$/src/main/rs" isTestSource="false" /> | ||
<sourceFolder url="file://$MODULE_DIR$/src/main/shaders" isTestSource="false" /> | ||
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/res" type="java-test-resource" /> | ||
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/resources" type="java-test-resource" /> | ||
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/assets" type="java-test-resource" /> | ||
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/aidl" isTestSource="true" /> | ||
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/java" isTestSource="true" /> | ||
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/jni" isTestSource="true" /> | ||
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/rs" isTestSource="true" /> | ||
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/shaders" isTestSource="true" /> | ||
<sourceFolder url="file://$MODULE_DIR$/src/test/res" type="java-test-resource" /> | ||
<sourceFolder url="file://$MODULE_DIR$/src/test/resources" type="java-test-resource" /> | ||
<sourceFolder url="file://$MODULE_DIR$/src/test/assets" type="java-test-resource" /> | ||
<sourceFolder url="file://$MODULE_DIR$/src/test/aidl" isTestSource="true" /> | ||
<sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" /> | ||
<sourceFolder url="file://$MODULE_DIR$/src/test/jni" isTestSource="true" /> | ||
<sourceFolder url="file://$MODULE_DIR$/src/test/rs" isTestSource="true" /> | ||
<sourceFolder url="file://$MODULE_DIR$/src/test/shaders" isTestSource="true" /> | ||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/assets" /> | ||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/blame" /> | ||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/builds" /> | ||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/bundles" /> | ||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/classes" /> | ||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/dependency-cache" /> | ||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/cn.pedant.sweetalert/library/1.3/jars" /> | ||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.akexorcist/bluetoothspp/1.0.0/jars" /> | ||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/animated-vector-drawable/23.2.0/jars" /> | ||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/appcompat-v7/23.2.0/jars" /> | ||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/support-v4/23.2.0/jars" /> | ||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/support-vector-drawable/23.2.0/jars" /> | ||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.github.medyo/fancybuttons/1.8.1/jars" /> | ||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.pnikosis/materialish-progress/1.0/jars" /> | ||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/org.adw.library/discrete-seekbar/1.0.1/jars" /> | ||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental" /> | ||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental-classes" /> | ||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental-runtime-classes" /> | ||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental-safeguard" /> | ||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental-verifier" /> | ||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/instant-run-support" /> | ||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/jniLibs" /> | ||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/manifests" /> | ||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/reload-dex" /> | ||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/res" /> | ||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/restart-dex" /> | ||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/rs" /> | ||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/shaders" /> | ||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/symbols" /> | ||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/transforms" /> | ||
<excludeFolder url="file://$MODULE_DIR$/build/outputs" /> | ||
<excludeFolder url="file://$MODULE_DIR$/build/tmp" /> | ||
</content> | ||
<orderEntry type="jdk" jdkName="Android API 23 Platform" jdkType="Android SDK" /> | ||
<orderEntry type="sourceFolder" forTests="false" /> | ||
<orderEntry type="library" exported="" name="animated-vector-drawable-23.2.0" level="project" /> | ||
<orderEntry type="library" exported="" name="support-v4-23.2.0" level="project" /> | ||
<orderEntry type="library" exported="" name="support-annotations-23.2.0" level="project" /> | ||
<orderEntry type="library" exported="" name="bluetoothspp-1.0.0" level="project" /> | ||
<orderEntry type="library" exported="" name="fancybuttons-1.8.1" level="project" /> | ||
<orderEntry type="library" exported="" name="support-vector-drawable-23.2.0" level="project" /> | ||
<orderEntry type="library" exported="" name="discrete-seekbar-1.0.1" level="project" /> | ||
<orderEntry type="library" exported="" name="library-1.3" level="project" /> | ||
<orderEntry type="library" exported="" name="appcompat-v7-23.2.0" level="project" /> | ||
<orderEntry type="library" exported="" scope="TEST" name="hamcrest-core-1.3" level="project" /> | ||
<orderEntry type="library" exported="" name="materialish-progress-1.0" level="project" /> | ||
<orderEntry type="library" exported="" scope="TEST" name="junit-4.12" level="project" /> | ||
</component> | ||
</module> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
apply plugin: 'com.android.application' | ||
|
||
android { | ||
compileSdkVersion 23 | ||
buildToolsVersion "23.0.2" | ||
|
||
defaultConfig { | ||
applicationId "com.developwear.vwcardash" | ||
minSdkVersion 18 | ||
targetSdkVersion 23 | ||
versionCode 1 | ||
versionName "1.0" | ||
} | ||
buildTypes { | ||
release { | ||
minifyEnabled false | ||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' | ||
} | ||
} | ||
} | ||
|
||
dependencies { | ||
compile fileTree(dir: 'libs', include: ['*.jar']) | ||
testCompile 'junit:junit:4.12' | ||
compile 'com.android.support:appcompat-v7:23.2.0' | ||
compile 'org.adw.library:discrete-seekbar:1.0.1' | ||
compile 'com.github.medyo:fancybuttons:1.8.1' | ||
compile 'com.akexorcist:bluetoothspp:1.0.0' | ||
compile 'cn.pedant.sweetalert:library:1.3' | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# Add project specific ProGuard rules here. | ||
# By default, the flags in this file are appended to flags specified | ||
# in /Users/Aykut/Downloads/adt-bundle-mac-x86_64-20140702/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 *; | ||
#} |
13 changes: 13 additions & 0 deletions
13
app/src/androidTest/java/com/developwear/vwcardash/ApplicationTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package com.developwear.vwcardash; | ||
|
||
import android.app.Application; | ||
import android.test.ApplicationTestCase; | ||
|
||
/** | ||
* <a href="http://d.android.com/tools/testing/testing_android.html">Testing Fundamentals</a> | ||
*/ | ||
public class ApplicationTest extends ApplicationTestCase<Application> { | ||
public ApplicationTest() { | ||
super(Application.class); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" | ||
xmlns:tools="http://schemas.android.com/tools" | ||
package="com.developwear.vwcardash"> | ||
<uses-permission android:name="android.permission.DISABLE_KEYGUARD"></uses-permission> | ||
<uses-permission android:name="android.permission.RECORD_AUDIO"/> | ||
<uses-feature android:name="android.hardware.usb.accessory" /> | ||
<uses-permission android:name="android.permission.BLUETOOTH" /> | ||
<uses-permission android:name="android.permission.WAKE_LOCK" /> | ||
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" /> | ||
<application | ||
android:allowBackup="true" | ||
android:label="@string/app_name" | ||
android:supportsRtl="true" | ||
android:icon="@mipmap/vwlogolaunch" | ||
tools:replace="android:icon" | ||
android:theme="@style/AppTheme"> | ||
|
||
<activity android:name=".MainActivity" android:screenOrientation="landscape"> | ||
|
||
|
||
<intent-filter> | ||
<action android:name="android.intent.action.MAIN" /> | ||
<category android:name="android.intent.category.LAUNCHER" /> | ||
</intent-filter> | ||
<intent-filter> | ||
<action android:name="android.hardware.usb.action.USB_ACCESSORY_ATTACHED" /> | ||
</intent-filter> | ||
<meta-data | ||
android:name="android.hardware.usb.action.USB_ACCESSORY_ATTACHED" | ||
android:resource="@xml/accessory_filter" /> | ||
</activity> | ||
<receiver android:name=".DeviceAdminSampleReceiver" | ||
android:label="@string/sample_device_admin" | ||
android:description="@string/sample_device_admin_description" | ||
android:permission="android.permission.BIND_DEVICE_ADMIN"> | ||
<meta-data android:name="android.app.device_admin" | ||
android:resource="@xml/device_admin_sample" /> | ||
<intent-filter> | ||
<action android:name="android.app.action.DEVICE_ADMIN_ENABLED" /> | ||
</intent-filter> | ||
</receiver> | ||
|
||
<uses-library android:name="com.android.future.usb.accessory" /> | ||
</application> | ||
|
||
</manifest> |
90 changes: 90 additions & 0 deletions
90
app/src/main/java/com/developwear/vwcardash/BluetoothBaseActivity.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
package com.developwear.vwcardash; | ||
|
||
import android.app.Activity; | ||
import android.content.Intent; | ||
import android.graphics.Color; | ||
import android.os.Bundle; | ||
import android.os.PersistableBundle; | ||
import android.support.v7.app.AppCompatActivity; | ||
import android.util.Log; | ||
import android.view.View; | ||
import android.widget.Button; | ||
import android.widget.Toast; | ||
|
||
import app.akexorcist.bluetotohspp.library.BluetoothSPP; | ||
import app.akexorcist.bluetotohspp.library.BluetoothState; | ||
import app.akexorcist.bluetotohspp.library.DeviceList; | ||
import cn.pedant.SweetAlert.SweetAlertDialog; | ||
|
||
/** | ||
* Created by Aykut on 20/05/16. | ||
*/ | ||
public class BluetoothBaseActivity extends AppCompatActivity { | ||
|
||
public interface DataArrivaListener | ||
{ | ||
void onDataArrived(String data); | ||
} | ||
DataArrivaListener listener; | ||
public void setDataArrivaListener(DataArrivaListener lis) | ||
{ | ||
listener=lis; | ||
} | ||
BluetoothSPP bt; | ||
@Override | ||
public void onCreate(Bundle savedInstanceState) { | ||
super.onCreate(savedInstanceState); | ||
bt = new BluetoothSPP(this); | ||
|
||
final SweetAlertDialog pDialog = new SweetAlertDialog(this, SweetAlertDialog.PROGRESS_TYPE); | ||
pDialog.getProgressHelper().setBarColor(Color.parseColor("#A5DC86")); | ||
pDialog.setTitleText("Bağlanılıyor"); | ||
pDialog.setCancelable(false); | ||
pDialog.show(); | ||
|
||
bt.setBluetoothStateListener(new BluetoothSPP.BluetoothStateListener() { | ||
@Override | ||
public void onServiceStateChanged(int state) { | ||
if(state==3) { | ||
pDialog.dismissWithAnimation(); | ||
} | ||
} | ||
}); | ||
|
||
bt.setOnDataReceivedListener(new BluetoothSPP.OnDataReceivedListener() { | ||
@Override | ||
public void onDataReceived(byte[] data, String message) { | ||
if(listener!=null) | ||
listener.onDataArrived(message); | ||
} | ||
}); | ||
} | ||
|
||
public void onDestroy() { | ||
super.onDestroy(); | ||
bt.disconnect(); | ||
bt.stopService(); | ||
|
||
} | ||
|
||
public void onStart() { | ||
super.onStart(); | ||
if(!bt.isBluetoothEnabled()) { | ||
bt.enable(); | ||
} else { | ||
if(!bt.isServiceAvailable()) { | ||
bt.setupService(); | ||
bt.startService(BluetoothState.DEVICE_OTHER); | ||
setup(); | ||
} | ||
} | ||
} | ||
|
||
public void setup() { | ||
bt.autoConnect("HC-06"); | ||
} | ||
public void sendData(String data) | ||
{ | ||
bt.send(data,false); | ||
} | ||
} |
38 changes: 38 additions & 0 deletions
38
app/src/main/java/com/developwear/vwcardash/DeviceAdminSampleReceiver.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
package com.developwear.vwcardash; | ||
|
||
import android.app.admin.DeviceAdminReceiver; | ||
import android.content.BroadcastReceiver; | ||
import android.content.Context; | ||
import android.content.Intent; | ||
import android.widget.Toast; | ||
|
||
/** | ||
* Created by Aykut on 03/03/16. | ||
*/ | ||
public class DeviceAdminSampleReceiver extends DeviceAdminReceiver { | ||
|
||
void showToast(Context context, String msg) { | ||
String status = "status:".concat(msg); | ||
Toast.makeText(context, status, Toast.LENGTH_SHORT).show(); | ||
} | ||
|
||
@Override | ||
public void onEnabled(Context context, Intent intent) { | ||
showToast(context, context.getString(R.string.admin_receiver_status_enabled)); | ||
} | ||
|
||
@Override | ||
public CharSequence onDisableRequested(Context context, Intent intent) { | ||
return context.getString(R.string.admin_receiver_status_disable_warning); | ||
} | ||
|
||
@Override | ||
public void onDisabled(Context context, Intent intent) { | ||
showToast(context, context.getString(R.string.admin_receiver_status_disabled)); | ||
} | ||
|
||
@Override | ||
public void onPasswordChanged(Context context, Intent intent) { | ||
showToast(context, context.getString(R.string.admin_receiver_status_pw_changed)); | ||
} | ||
} |
Oops, something went wrong.