Skip to content

Commit

Permalink
Merge pull request #1 from emschu/feature/api29-compat
Browse files Browse the repository at this point in the history
A bunch of improvements, fixes and support for android api29+
  • Loading branch information
emschu authored Oct 12, 2020
2 parents be265ab + b734ac7 commit f350ba4
Show file tree
Hide file tree
Showing 106 changed files with 1,636 additions and 974 deletions.
2 changes: 1 addition & 1 deletion PRIVACY_POLICY.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ This app follows several principles:
- Completely advertising free
- No tracking
- No non-free dependencies/assets/resources
- no transmission of your data, any data keeps on your device
- no transmission of your data, any data stays on your device
- no external (network) services
- Android's camera permission is used **exclusively** to scan your QR codes exclusively via the Open Source **zxing library**. The app does *never* store WIFI credentials or SNMP device connection credentials.

Expand Down
5 changes: 1 addition & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,4 @@ Icon made by [Smashicons](https://www.flaticon.com/authors/smashicons) from [www
Icon made by [becris](https://www.flaticon.com/authors/becris) from [www.flaticon.com](www.flaticon.com), CC 3.0 BY

* Disconnect (*ic_disconnect.xml*):
Icon made by [Freepik](https://www.freepik.com/) from [www.flaticon.com](www.flaticon.com), CC 3.0 BY

* Add-device (*ic_add_device.xml*):
Icon made by [xnimrodx](https://www.flaticon.com/authors/xnimrodx) from [www.flaticon.com](www.flaticon.com), CC 3.0 BY
Icon made by [Freepik](https://www.freepik.com/) from [www.flaticon.com](www.flaticon.com), CC 3.0 BY
44 changes: 21 additions & 23 deletions app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
apply plugin: 'com.android.application'
apply from: './jacoco.gradle'

ext.androidSupportVersion = '1.1.0'
ext.androidSupportVersion = '1.2.0'
/*
* SNMP Cockpit Android App
*
Expand All @@ -23,17 +23,17 @@ ext.androidSupportVersion = '1.1.0'

// we need to use old mockito!
ext.mockitoVersion = "2.22.0"
ext.androidTestVersion = '1.2.0'
ext.espressoVersion = '3.2.0'
ext.androidTestVersion = '1.3.0'
ext.espressoVersion = '3.3.0'

android {
compileSdkVersion 28
compileSdkVersion 29
defaultConfig {
applicationId "org.emschu.snmp.cockpit"
minSdkVersion 23
targetSdkVersion 28
versionCode 33
versionName "0.9.9"
targetSdkVersion 29
versionCode 36
versionName "0.9.11"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
vectorDrawables.useSupportLibrary = true
buildConfigField "long", "BUILD_TIMESTAMP", System.currentTimeMillis() + "L"
Expand Down Expand Up @@ -73,7 +73,7 @@ android {
packagingOptions {
exclude 'META-INF/library-core_release.kotlin_module'
}
buildToolsVersion '29.0.2'
buildToolsVersion '29.0.3'
}
configurations {
compile.exclude group: 'log4j'
Expand All @@ -90,34 +90,32 @@ sonarqube {
}

dependencies {
// constraints {
// implementation('org.snmp4j:org.snmp4j:2.6.3') {
// because 'later would break android api compatibility with sdk 23'
// }
// }
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.journeyapps:zxing-android-embedded:3.6.0'
implementation "androidx.appcompat:appcompat:$androidSupportVersion"
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'androidx.drawerlayout:drawerlayout:1.0.0'
implementation 'com.google.android.material:material:1.0.0'
implementation "androidx.legacy:legacy-support-v4:1.0.0"
implementation "androidx.legacy:legacy-preference-v14:1.0.0"
implementation 'androidx.recyclerview:recyclerview:1.0.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.2'
implementation 'androidx.drawerlayout:drawerlayout:1.1.1'
implementation 'com.google.android.material:material:1.2.1'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'androidx.legacy:legacy-preference-v14:1.0.0'
implementation 'androidx.recyclerview:recyclerview:1.1.0'
implementation "androidx.cardview:cardview:1.0.0"
implementation 'androidx.activity:activity:1.2.0-beta01'
implementation 'androidx.fragment:fragment:1.3.0-beta01'
implementation "androidx.viewpager:viewpager:1.0.0"
implementation "com.mikepenz:aboutlibraries:7.0.1"
implementation "com.mikepenz:aboutlibraries:7.1.0"
implementation 'com.fasterxml.jackson.core:jackson-databind:2.9.10.1'
implementation 'androidx.preference:preference:1.1.1'
// tests
androidTestImplementation "androidx.test.ext:junit:1.1.1"
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestImplementation "androidx.test.espresso:espresso-core:$espressoVersion"
androidTestImplementation "androidx.test.espresso:espresso-contrib:$espressoVersion"
androidTestImplementation "androidx.test.espresso:espresso-intents:$espressoVersion"
androidTestImplementation "androidx.test:rules:$androidTestVersion"
testImplementation "org.mockito:mockito-core:$mockitoVersion"
androidTestImplementation "org.mockito:mockito-android:$mockitoVersion"
androidTestImplementation "androidx.annotation:annotation:$androidSupportVersion"
testImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation "androidx.annotation:annotation:1.1.0"
testImplementation 'androidx.test.ext:junit:1.1.2'
testImplementation 'junit:junit:4.12'
// debug
// debugImplementation 'com.squareup.leakcanary:leakcanary-android:2.0-alpha-3'
Expand Down
8 changes: 4 additions & 4 deletions app/jacoco.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ task jacocoTestReport(type: JacocoReport, dependsOn: "testDebugUnitTest") {
def debugTree = fileTree(dir: "${buildDir}/intermediates/classes/debug", excludes: fileFilter)
def mainSrc = "${project.projectDir}/app/src/main/java"

sourceDirectories = files([mainSrc])
classDirectories = files([debugTree])
executionData = fileTree(dir: project.projectDir, includes:
['**/*.exec', '**/*.ec'])
getSourceDirectories().setFrom(files([mainSrc]))
getClassDirectories().setFrom(files([debugTree]))
getExecutionData().setFrom(fileTree(dir: project.projectDir, includes:
['**/*.exec', '**/*.ec']))
}
1 change: 1 addition & 0 deletions app/proguard-rules.pro
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
public static final int define_*;
}
# keep snmp4j classes or crash
#noinspection ShrinkerUnresolvedReference
-keep class org.snmp4j.** {*;}

# handle jackson databind
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
import androidx.test.ext.junit.runners.AndroidJUnit4;
import androidx.test.rule.ActivityTestRule;

import org.emschu.snmp.cockpit.CockpitMainActivity;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Rule;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,11 @@
package org.emschu.snmp.cockpit;

import android.content.SharedPreferences;
import android.preference.PreferenceManager;
import androidx.preference.PreferenceManager;

import androidx.test.ext.junit.runners.AndroidJUnit4;
import androidx.test.rule.ActivityTestRule;

import org.emschu.snmp.cockpit.CockpitMainActivity;
import org.emschu.snmp.cockpit.CockpitPreferenceManager;
import org.junit.Assert;
import org.junit.Rule;
import org.junit.Test;
Expand All @@ -50,7 +48,7 @@ public void testWifiModesAndPreferenceInteraction() {
edit.putBoolean(CockpitPreferenceManager.KEY_DEBUG_ALLOW_ALL_NETWORKS, false);
edit.apply();

WifiNetworkManager wifiNetworkManager = WifiNetworkManager.getInstance(rule.getActivity());
WifiNetworkManager wifiNetworkManager = WifiNetworkManager.getInstance();
wifiNetworkManager.updateMode();
Assert.assertEquals("AndroidWifi", wifiNetworkManager.getCurrentSsid());
Assert.assertEquals(4, wifiNetworkManager.getCurrentMode());
Expand Down
3 changes: 3 additions & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,13 @@

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.CHANGE_NETWORK_STATE" />
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:maxSdkVersion="25" android:name="android.permission.WAKE_LOCK" />

<uses-feature
android:name="android.hardware.camera"
Expand Down Expand Up @@ -120,6 +122,7 @@

<service
android:name="org.emschu.snmp.cockpit.service.CockpitStateService"
android:permission="android.permission.BIND_JOB_SERVICE"
android:exported="false" />
</application>

Expand Down
2 changes: 1 addition & 1 deletion app/src/main/assets/privacy_policy.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ <h1 style="text-align: center;"><strong>Privacy policy</strong></h1>
<li>Completely advertising free</li>
<li>No tracking</li>
<li>No non-free dependencies/assets/resources</li>
<li>no transmission of your data, any data keeps on your device</li>
<li>no transmission of your data, any data stays on your device</li>
<li>no external (network) services</li>
<li>Android's camera permission is used <strong>exclusively</strong> to scan your QR codes exclusively via the Open Source <strong>zxing library</strong>. The app does <em>never</em> store WIFI credentials or SNMP device connection credentials.</li>
</ul>
Expand Down
Loading

0 comments on commit f350ba4

Please sign in to comment.