feat(*): update to androidx and add mynteye jni

This commit is contained in:
John Zhao
2019-01-15 15:10:59 +08:00
parent d41f4cbcbc
commit a8796478e6
34 changed files with 1018 additions and 75 deletions

View File

@@ -8,7 +8,7 @@ android {
targetSdkVersion xversions.targetSdk
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
ndk {
abiFilters xabis
}
@@ -19,17 +19,26 @@ android {
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation xdeps.support.appcompat
implementation xdeps.support.constraint
implementation 'androidx.appcompat:appcompat:1.1.0-alpha01'
implementation 'androidx.constraintlayout:constraintlayout:2.0.0-alpha3'
implementation 'com.jakewharton.timber:timber:4.7.1'
implementation 'com.jakewharton:butterknife:10.0.0'
annotationProcessor 'com.jakewharton:butterknife-compiler:10.0.0'
implementation project(':libmynteye')
testImplementation xdeps.junit
androidTestImplementation xdeps.support.test.runner
androidTestImplementation xdeps.support.test.espresso
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'
}

View File

@@ -1,8 +1,8 @@
package com.slightech.mynteye.demo;
import android.content.Context;
import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;
import androidx.test.InstrumentationRegistry;
import androidx.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;

View File

@@ -6,6 +6,7 @@
<application
android:allowBackup="false"
android:label="@string/app_name"
android:name=".MyApplication"
android:supportsRtl="true"
android:theme="@style/AppTheme"
tools:ignore="GoogleAppIndexingWarning">

View File

@@ -1,7 +1,10 @@
package com.slightech.mynteye.demo;
import android.support.v7.app.AppCompatActivity;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
import com.slightech.mynteye.Device;
import com.slightech.mynteye.DeviceUsbInfo;
import timber.log.Timber;
public class MainActivity extends AppCompatActivity {
@@ -9,5 +12,9 @@ public class MainActivity extends AppCompatActivity {
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
for (DeviceUsbInfo info : Device.query()) {
Timber.i(info.toString());
}
}
}

View File

@@ -0,0 +1,32 @@
package com.slightech.mynteye.demo;
import android.app.Application;
import timber.log.Timber;
public class MyApplication extends Application {
static {
try {
System.loadLibrary("mynteye_jni");
} catch (UnsatisfiedLinkError e) {
System.err.println("mynteye_jni library failed to load.\n" + e);
}
}
@Override public void onCreate() {
super.onCreate();
Timber.plant(new Timber.DebugTree());
}
@Override public void onLowMemory() {
super.onLowMemory();
}
@Override public void onTrimMemory(int level) {
super.onTrimMemory(level);
}
@Override public void onTerminate() {
super.onTerminate();
}
}

View File

@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
@@ -18,4 +18,4 @@
app:layout_constraintTop_toTopOf="parent"
/>
</android.support.constraint.ConstraintLayout>
</androidx.constraintlayout.widget.ConstraintLayout>