| @@ -1,6 +1,6 @@ | |||
| <?xml version="1.0" encoding="UTF-8"?> | |||
| <project version="4"> | |||
| <component name="CompilerConfiguration"> | |||
| <bytecodeTargetLevel target="9" /> | |||
| <bytecodeTargetLevel target="1.8" /> | |||
| </component> | |||
| </project> | |||
| @@ -1,18 +1,20 @@ | |||
| <?xml version="1.0" encoding="UTF-8"?> | |||
| <project version="4"> | |||
| <component name="GradleMigrationSettings" migrationVersion="1" /> | |||
| <component name="GradleSettings"> | |||
| <option name="linkedExternalProjectsSettings"> | |||
| <GradleProjectSettings> | |||
| <option name="testRunner" value="PLATFORM" /> | |||
| <option name="distributionType" value="DEFAULT_WRAPPED" /> | |||
| <option name="externalProjectPath" value="$PROJECT_DIR$" /> | |||
| <option name="modules"> | |||
| <set> | |||
| <option value="$PROJECT_DIR$" /> | |||
| <option value="$PROJECT_DIR$/app" /> | |||
| <option value="$PROJECT_DIR$/tpmslibrary" /> | |||
| </set> | |||
| </option> | |||
| <option name="resolveModulePerSourceSet" value="false" /> | |||
| <option name="useQualifiedModuleNames" value="true" /> | |||
| </GradleProjectSettings> | |||
| </option> | |||
| </component> | |||
| @@ -0,0 +1,30 @@ | |||
| <?xml version="1.0" encoding="UTF-8"?> | |||
| <project version="4"> | |||
| <component name="RemoteRepositoriesConfiguration"> | |||
| <remote-repository> | |||
| <option name="id" value="central" /> | |||
| <option name="name" value="Maven Central repository" /> | |||
| <option name="url" value="https://repo1.maven.org/maven2" /> | |||
| </remote-repository> | |||
| <remote-repository> | |||
| <option name="id" value="jboss.community" /> | |||
| <option name="name" value="JBoss Community repository" /> | |||
| <option name="url" value="https://repository.jboss.org/nexus/content/repositories/public/" /> | |||
| </remote-repository> | |||
| <remote-repository> | |||
| <option name="id" value="BintrayJCenter" /> | |||
| <option name="name" value="BintrayJCenter" /> | |||
| <option name="url" value="https://jcenter.bintray.com/" /> | |||
| </remote-repository> | |||
| <remote-repository> | |||
| <option name="id" value="Google" /> | |||
| <option name="name" value="Google" /> | |||
| <option name="url" value="https://dl.google.com/dl/android/maven2/" /> | |||
| </remote-repository> | |||
| <remote-repository> | |||
| <option name="id" value="maven" /> | |||
| <option name="name" value="maven" /> | |||
| <option name="url" value="https://jitpack.io" /> | |||
| </remote-repository> | |||
| </component> | |||
| </project> | |||
| @@ -5,7 +5,7 @@ | |||
| <configuration PROFILE_NAME="Debug" CONFIG_NAME="Debug" /> | |||
| </configurations> | |||
| </component> | |||
| <component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" project-jdk-name="1.8" project-jdk-type="JavaSDK"> | |||
| <component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" project-jdk-name="1.8" project-jdk-type="JavaSDK"> | |||
| <output url="file://$PROJECT_DIR$/build/classes" /> | |||
| </component> | |||
| <component name="ProjectType"> | |||
| @@ -4,11 +4,11 @@ android { | |||
| compileSdkVersion 29 | |||
| buildToolsVersion "29.0.2" | |||
| defaultConfig { | |||
| applicationId "aicare.net.cn.sdk.tmpsrepositoryandroid" | |||
| applicationId "aicare.net.cn.sdk.tmpsdemoandroid" | |||
| minSdkVersion 19 | |||
| targetSdkVersion 29 | |||
| versionCode 1 | |||
| versionName "1.0" | |||
| versionCode 2 | |||
| versionName "1.1" | |||
| testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" | |||
| } | |||
| buildTypes { | |||
| @@ -32,5 +32,5 @@ dependencies { | |||
| testImplementation 'junit:junit:4.12' | |||
| androidTestImplementation 'androidx.test:runner:1.2.0' | |||
| androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0' | |||
| implementation project(path: ':tpmslibrary') | |||
| implementation 'com.github.elinkthings:TmpsSDKRepositoryAndroid:1.2.9' | |||
| } | |||
| @@ -4,6 +4,7 @@ import android.bluetooth.BluetoothAdapter; | |||
| import android.content.Intent; | |||
| import android.os.Bundle; | |||
| import android.os.Handler; | |||
| import android.os.Looper; | |||
| import android.os.Message; | |||
| import android.text.TextUtils; | |||
| import android.view.View; | |||
| @@ -13,7 +14,6 @@ import android.widget.LinearLayout; | |||
| import android.widget.ListView; | |||
| import android.widget.TextView; | |||
| import com.pingwang.tpmslibrary.TpmsSDK; | |||
| import com.pingwang.tpmslibrary.TpmsScan; | |||
| import java.util.ArrayList; | |||
| @@ -51,7 +51,6 @@ public class MainActivity extends AppCompatActivity implements View.OnClickListe | |||
| protected void onCreate(Bundle savedInstanceState) { | |||
| super.onCreate(savedInstanceState); | |||
| setContentView(R.layout.activity_main); | |||
| TpmsSDK.init(this); | |||
| L.isDebug = true; | |||
| initData(); | |||
| initViews(); | |||
| @@ -192,8 +191,8 @@ public class MainActivity extends AppCompatActivity implements View.OnClickListe | |||
| @Override | |||
| public void onGetData(String mac, String deviceId, int rssi, float pressure, float battery, | |||
| int temp, int status, float mcuVersion, int year, int month, int day, | |||
| public void onGetData(byte[] bytes,String mac, String deviceId, int rssi, float pressure,int pressureUnit, float battery, | |||
| int temp,int tempUnit, int status, float mcuVersion, int year, int month, int day, | |||
| float bleVersion) { | |||
| if (deviceIdMap != null) { | |||
| @@ -346,7 +345,7 @@ public class MainActivity extends AppCompatActivity implements View.OnClickListe | |||
| lv_show_log.setSelection(infoList.size() - 1); | |||
| } | |||
| private Handler handler = new android.os.Handler() { | |||
| private Handler handler = new android.os.Handler(Looper.getMainLooper()) { | |||
| @Override | |||
| public void handleMessage(Message msg) { | |||
| String result = msg.getData().getString(RESULT); | |||
| @@ -1,5 +1,5 @@ | |||
| <resources> | |||
| <string name="app_name">TmpsRepositoryAndroid</string> | |||
| <string name="app_name">TmpsDemoAndroid</string> | |||
| <string name="left_front_id">左前:%1$s</string> | |||
| <string name="right_front_id">右前:%1$s</string> | |||
| @@ -18,7 +18,7 @@ allprojects { | |||
| repositories { | |||
| google() | |||
| jcenter() | |||
| maven { url 'https://jitpack.io' } | |||
| } | |||
| } | |||
| @@ -1 +1 @@ | |||
| include ':app', ':tpmslibrary' | |||
| include ':app' | |||
| @@ -1 +0,0 @@ | |||
| /build | |||
| @@ -1,41 +0,0 @@ | |||
| apply plugin: 'com.android.library' | |||
| android { | |||
| compileSdkVersion 29 | |||
| buildToolsVersion "29.0.2" | |||
| defaultConfig { | |||
| minSdkVersion 19 | |||
| targetSdkVersion 29 | |||
| versionCode 1 | |||
| versionName "1.0" | |||
| testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" | |||
| } | |||
| buildTypes { | |||
| release { | |||
| minifyEnabled false | |||
| proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' | |||
| } | |||
| } | |||
| sourceSets { | |||
| main { | |||
| jniLibs.srcDirs = ['libs'] | |||
| } | |||
| } | |||
| } | |||
| dependencies { | |||
| implementation fileTree(dir: 'libs', include: ['*.jar']) | |||
| implementation 'androidx.appcompat:appcompat:1.1.0' | |||
| testImplementation 'junit:junit:4.12' | |||
| androidTestImplementation 'androidx.test:runner:1.2.0' | |||
| androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0' | |||
| implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.3.41" | |||
| api files('libs/tpmslib.jar') | |||
| } | |||
| @@ -1,21 +0,0 @@ | |||
| # Add project specific ProGuard rules here. | |||
| # You can control the set of applied configuration files using the | |||
| # proguardFiles setting in build.gradle. | |||
| # | |||
| # For more details, see | |||
| # http://developer.android.com/guide/developing/tools/proguard.html | |||
| # 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 *; | |||
| #} | |||
| # Uncomment this to preserve the line number information for | |||
| # debugging stack traces. | |||
| #-keepattributes SourceFile,LineNumberTable | |||
| # If you keep the line number information, uncomment this to | |||
| # hide the original source file name. | |||
| #-renamesourcefileattribute SourceFile | |||
| @@ -1,27 +0,0 @@ | |||
| package aicare.net.cn.sdk.tpmslibrary; | |||
| import android.content.Context; | |||
| import androidx.test.InstrumentationRegistry; | |||
| import androidx.test.runner.AndroidJUnit4; | |||
| import org.junit.Test; | |||
| import org.junit.runner.RunWith; | |||
| import static org.junit.Assert.*; | |||
| /** | |||
| * Instrumented test, which will execute on an Android device. | |||
| * | |||
| * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> | |||
| */ | |||
| @RunWith(AndroidJUnit4.class) | |||
| public class ExampleInstrumentedTest { | |||
| @Test | |||
| public void useAppContext() { | |||
| // Context of the app under test. | |||
| Context appContext = InstrumentationRegistry.getTargetContext(); | |||
| assertEquals("aicare.net.cn.sdk.tpmslibrary.test", appContext.getPackageName()); | |||
| } | |||
| } | |||
| @@ -1,2 +0,0 @@ | |||
| <manifest package="aicare.net.cn.sdk.tpmslibrary" | |||
| xmlns:android="http://schemas.android.com/apk/res/android"/> | |||
| @@ -1,3 +0,0 @@ | |||
| <resources> | |||
| <string name="app_name">TpmsLibrary</string> | |||
| </resources> | |||
| @@ -1,17 +0,0 @@ | |||
| package aicare.net.cn.sdk.tpmslibrary; | |||
| import org.junit.Test; | |||
| import static org.junit.Assert.*; | |||
| /** | |||
| * Example local unit test, which will execute on the development machine (host). | |||
| * | |||
| * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> | |||
| */ | |||
| public class ExampleUnitTest { | |||
| @Test | |||
| public void addition_isCorrect() { | |||
| assertEquals(4, 2 + 2); | |||
| } | |||
| } | |||