Skip to content

Commit 0082648

Browse files
Merge branch 'feature'
2 parents 3a1d7af + 74aa2b5 commit 0082648

File tree

101 files changed

+962
-1243
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

101 files changed

+962
-1243
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ jdk: oraclejdk8
55
android:
66
components:
77
- tools
8-
- build-tools-28.0.2
8+
- build-tools-28.0.3
99
- android-27
1010
- extra-google-m2repository
1111
- extra-android-m2repository

app/build.gradle

Lines changed: 66 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -16,27 +16,41 @@
1616
* along with this program. If not, see <http://www.gnu.org/licenses/>
1717
*/
1818

19-
apply plugin: 'com.android.application'
20-
apply plugin: 'jacoco-android'
19+
apply plugin: "com.android.application"
20+
apply plugin: "jacoco-android"
21+
22+
ext {
23+
supportVersion = "28.0.0"
24+
lang3Version = "3.8.1"
25+
collections4Version = "4.2"
26+
graphviewVersion = "4.2.2"
27+
powermockVersion = "1.7.4"
28+
robolectricVersion = "4.0"
29+
junitVersion = "4.12"
30+
junitToolboxVersion = "2.4"
31+
shadowsVersion ="3.4-rc2"
32+
espressoVersion = "3.0.2"
33+
testVersion = "1.0.2"
34+
}
2135

2236
android {
23-
compileSdkVersion 27
24-
buildToolsVersion '28.0.2'
37+
compileSdkVersion 28
38+
buildToolsVersion "28.0.3"
2539

2640
defaultConfig {
2741
applicationId "com.vrem.wifianalyzer"
2842
minSdkVersion 16
29-
targetSdkVersion 22
43+
targetSdkVersion 28
3044
versionCode
3145
versionName
32-
testInstrumentationRunner 'android.support.test.runner.AndroidJUnitRunner'
46+
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
3347
}
3448

3549
buildTypes {
3650
release {
3751
minifyEnabled true
3852
shrinkResources true
39-
proguardFiles getDefaultProguardFile('proguard-android.txt')
53+
proguardFiles getDefaultProguardFile("proguard-android.txt")
4054
signingConfig
4155
}
4256
debug {
@@ -63,82 +77,90 @@ android {
6377
}
6478

6579
lintOptions {
66-
disable 'GoogleAppIndexingWarning'
80+
disable "GoogleAppIndexingWarning"
81+
}
82+
83+
compileOptions {
84+
sourceCompatibility JavaVersion.VERSION_1_8
85+
targetCompatibility JavaVersion.VERSION_1_8
6786
}
6887
}
6988

7089
jacoco {
71-
toolVersion = '0.8.1'
90+
toolVersion = "0.8.2"
7291
}
7392

7493
tasks.withType(Test) {
7594
jacoco.includeNoLocationClasses = true
7695
}
7796

7897
jacocoAndroidUnitTestReport {
79-
excludes += ['**/com/jjoe64/*']
98+
excludes += ["**/com/jjoe64/*"]
8099
html.enabled true
81100
xml.enabled true
82101
csv.enabled false
83102
}
84103

85-
if (project.hasProperty('keyAlias')) {
86-
def propertiesFile = file('../../keystores/androidkeystore.properties')
104+
if (project.hasProperty("keyAlias")) {
105+
def propertiesFile = file("../../keystores/androidkeystore.properties")
87106
Properties properties = readProperties(propertiesFile)
88107

89108
System.out.println(">>> Signing Config " + properties)
90-
android.buildTypes.release.signingConfig.keyAlias = properties['key_alias'].toString()
91-
android.buildTypes.release.signingConfig.keyPassword = properties['key_password'].toString()
92-
android.buildTypes.release.signingConfig.storeFile = file(properties['store_filename'].toString())
93-
android.buildTypes.release.signingConfig.storePassword = properties['store_password'].toString()
109+
android.buildTypes.release.signingConfig.keyAlias = properties["key_alias"].toString()
110+
android.buildTypes.release.signingConfig.keyPassword = properties["key_password"].toString()
111+
android.buildTypes.release.signingConfig.storeFile = file(properties["store_filename"].toString())
112+
android.buildTypes.release.signingConfig.storePassword = properties["store_password"].toString()
94113
}
95114

96115
dependencies {
97116
// Compile Build Dependencies
98-
implementation fileTree(include: ['*.jar'], dir: 'libs')
99-
implementation 'com.android.support:design:27.1.1'
100-
implementation 'org.apache.commons:commons-lang3:3.8'
101-
implementation 'org.apache.commons:commons-collections4:4.2'
102-
implementation 'com.jjoe64:graphview:4.2.2'
117+
implementation fileTree(include: ["*.jar"], dir: "libs")
118+
implementation "com.android.support:design:$supportVersion"
119+
implementation "com.android.support:preference-v7:$supportVersion"
120+
implementation "com.android.support:support-v4:$supportVersion"
121+
implementation "com.android.support:support-media-compat:$supportVersion"
122+
implementation "org.apache.commons:commons-lang3:$lang3Version"
123+
implementation "org.apache.commons:commons-collections4:$collections4Version"
124+
implementation "com.jjoe64:graphview:$graphviewVersion"
103125
// Unit Test Dependencies
104-
testImplementation 'junit:junit:4.12'
105-
testImplementation 'org.powermock:powermock-module-junit4:1.7.4'
106-
testImplementation 'org.powermock:powermock-api-mockito2:1.7.4'
107-
testImplementation 'com.googlecode.junit-toolbox:junit-toolbox:2.4'
108-
testImplementation 'org.robolectric:robolectric:3.8'
109-
testImplementation 'org.robolectric:shadows-support-v4:3.4-rc2'
126+
testImplementation "junit:junit:$junitVersion"
127+
testImplementation "org.powermock:powermock-module-junit4:$powermockVersion"
128+
testImplementation "org.powermock:powermock-api-mockito2:$powermockVersion"
129+
testImplementation "com.googlecode.junit-toolbox:junit-toolbox:$junitToolboxVersion"
130+
testImplementation "org.robolectric:robolectric:$robolectricVersion"
131+
testImplementation "org.robolectric:shadows-support-v4:$shadowsVersion"
110132
// Android Test Dependencies
111-
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
112-
androidTestImplementation 'com.android.support.test:runner:1.0.2'
113-
androidTestImplementation 'com.android.support.test:rules:1.0.2'
133+
androidTestImplementation "com.android.support.test.espresso:espresso-core:$espressoVersion"
134+
androidTestImplementation "com.android.support.test:runner:$testVersion"
135+
androidTestImplementation "com.android.support.test:rules:$testVersion"
114136
}
115137

116138
updateVersion()
117139

118140
def updateVersion() {
119-
def propertiesFile = file('build.properties')
141+
def propertiesFile = file("build.properties")
120142
Properties properties = readProperties(propertiesFile)
121143

122-
def versionMajor = properties['version_major'].toString().toInteger()
123-
def versionMinor = properties['version_minor'].toString().toInteger()
124-
def versionPatch = properties['version_patch'].toString().toInteger()
125-
def versionBuild = properties['version_build'].toString().toInteger()
126-
def versionStore = properties['version_store'].toString().toInteger()
144+
def versionMajor = properties["version_major"].toString().toInteger()
145+
def versionMinor = properties["version_minor"].toString().toInteger()
146+
def versionPatch = properties["version_patch"].toString().toInteger()
147+
def versionBuild = properties["version_build"].toString().toInteger()
148+
def versionStore = properties["version_store"].toString().toInteger()
127149

128150
if (isReleaseTask()) {
129151
System.out.println(">>> Building Release...")
130152
versionPatch++
131153
versionStore++
132154
versionBuild = 0
133-
properties['version_patch'] = versionPatch.toString()
134-
properties['version_store'] = versionStore.toString()
135-
properties['version_build'] = versionBuild.toString()
155+
properties["version_patch"] = versionPatch.toString()
156+
properties["version_store"] = versionStore.toString()
157+
properties["version_build"] = versionBuild.toString()
136158
writeProperties(propertiesFile, properties)
137159
}
138160
if (isCompileTask()) {
139161
System.out.println(">>> Compiling Source...")
140162
versionBuild++
141-
properties['version_build'] = versionBuild.toString()
163+
properties["version_build"] = versionBuild.toString()
142164
writeProperties(propertiesFile, properties)
143165
}
144166

@@ -148,20 +170,20 @@ def updateVersion() {
148170
versionName = versionName + ".${versionBuild}"
149171
applicationId = applicationId + android.buildTypes.debug.applicationIdSuffix
150172
}
151-
System.out.println(">>> " + project.parent.name + " " + versionName + " (" + versionStore + ") '" + applicationId + "'")
173+
System.out.println(">>> " + project.parent.name + " " + versionName + " (" + versionStore + ") " + applicationId)
152174
android.defaultConfig.versionCode = versionStore
153175
android.defaultConfig.versionName = versionName
154176
}
155177

156178
def isCompileTask() {
157179
def tasks = gradle.getStartParameter().getTaskNames()
158-
return ':app:generateDebugSources' in tasks || ':app:generateReleaseSources' in tasks ||
159-
'generateDebugSources' in tasks || 'generateReleaseSources' in tasks
180+
return ":app:generateDebugSources" in tasks || ":app:generateReleaseSources" in tasks ||
181+
"generateDebugSources" in tasks || "generateReleaseSources" in tasks
160182
}
161183

162184
def isReleaseTask() {
163185
def tasks = gradle.getStartParameter().getTaskNames()
164-
return ':app:assembleRelease' in tasks || 'assembleRelease' in tasks
186+
return ":app:assembleRelease" in tasks || "assembleRelease" in tasks
165187
}
166188

167189
static Properties readProperties(propertiesFile) {

app/build.properties

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#Build Properties
2-
#Sun Sep 09 08:19:20 EDT 2018
3-
version_minor=9
4-
version_build=9
5-
version_patch=3
6-
version_major=1
7-
version_store=41
2+
#Sun Nov 04 11:32:14 EST 2018
3+
version_minor=0
4+
version_build=11
5+
version_patch=1
6+
version_store=42
7+
version_major=2

app/src/androidTest/java/com/vrem/wifianalyzer/MainInstrumentedTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@
1919
package com.vrem.wifianalyzer;
2020

2121

22+
import android.support.test.filters.LargeTest;
2223
import android.support.test.rule.ActivityTestRule;
2324
import android.support.test.runner.AndroidJUnit4;
24-
import android.test.suitebuilder.annotation.LargeTest;
2525

2626
import org.junit.Rule;
2727
import org.junit.Test;

app/src/main/AndroidManifest.xml

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,11 @@
2323

2424
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
2525
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE"/>
26+
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
2627

2728
<application
2829
android:allowBackup="true"
30+
android:fullBackupContent="true"
2931
android:hardwareAccelerated="true"
3032
android:icon="@mipmap/ic_launcher"
3133
android:roundIcon="@mipmap/ic_launcher_round"
@@ -57,24 +59,6 @@
5759
<category android:name="android.intent.category.DEFAULT"/>
5860
</intent-filter>
5961
</activity>
60-
<activity
61-
android:name=".settings.SettingActivity"
62-
android:label="@string/action_settings"
63-
android:launchMode="singleTask"
64-
android:parentActivityName=".MainActivity">
65-
<meta-data
66-
android:name="android.support.PARENT_ACTIVITY"
67-
android:value="com.vrem.wifianalyzer.MainActivity"/>
68-
</activity>
69-
<activity
70-
android:name=".about.AboutActivity"
71-
android:label="@string/action_about"
72-
android:launchMode="singleTask"
73-
android:parentActivityName=".MainActivity">
74-
<meta-data
75-
android:name="android.support.PARENT_ACTIVITY"
76-
android:value="com.vrem.wifianalyzer.MainActivity"/>
77-
</activity>
7862
</application>
7963

8064
</manifest>

app/src/main/java/com/vrem/util/EnumUtils.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,12 +61,12 @@ public static <T extends Enum> Set<T> find(@NonNull Class<T> enumType, @NonNull
6161

6262
@NonNull
6363
public static <T extends Enum> Set<String> find(@NonNull Set<T> values) {
64-
return new HashSet<>(CollectionUtils.collect(values, new ToOrdinal<T>()));
64+
return new HashSet<>(CollectionUtils.collect(values, new ToOrdinal<>()));
6565
}
6666

6767
@NonNull
6868
public static <T extends Enum> Set<String> ordinals(@NonNull Class<T> enumType) {
69-
return new HashSet<>(CollectionUtils.collect(values(enumType), new ToOrdinal<T>()));
69+
return new HashSet<>(CollectionUtils.collect(values(enumType), new ToOrdinal<>()));
7070
}
7171

7272
@NonNull

app/src/main/java/com/vrem/util/FileUtils.java

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,7 @@ private FileUtils() {
3333

3434
@NonNull
3535
public static String readFile(@NonNull Resources resources, @RawRes int id) {
36-
InputStream inputStream = null;
37-
try {
38-
inputStream = resources.openRawResource(id);
36+
try (InputStream inputStream = resources.openRawResource(id)) {
3937
int size = inputStream.available();
4038
byte[] bytes = new byte[size];
4139
int count = inputStream.read(bytes);
@@ -46,14 +44,7 @@ public static String readFile(@NonNull Resources resources, @RawRes int id) {
4644
} catch (Exception e) {
4745
// file is corrupted
4846
return StringUtils.EMPTY;
49-
} finally {
50-
if (inputStream != null) {
51-
try {
52-
inputStream.close();
53-
} catch (Exception e) {
54-
// do nothing
55-
}
56-
}
5747
}
48+
// do nothing
5849
}
5950
}

app/src/main/java/com/vrem/util/TextUtils.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ private TextUtils() {
3939
@NonNull
4040
public static Set<String> split(String source) {
4141
return StringUtils.isBlank(source)
42-
? new HashSet<String>()
42+
? new HashSet<>()
4343
: new HashSet<>(Arrays.asList(trim(source).split(SEPARATOR)));
4444
}
4545

app/src/main/java/com/vrem/wifianalyzer/ActivityUtils.java

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -18,36 +18,21 @@
1818

1919
package com.vrem.wifianalyzer;
2020

21-
import android.content.Context;
2221
import android.support.annotation.NonNull;
2322
import android.support.v7.app.ActionBar;
2423
import android.support.v7.widget.Toolbar;
2524
import android.view.View;
2625
import android.view.Window;
2726
import android.view.WindowManager;
2827

29-
import com.vrem.util.ConfigurationUtils;
3028
import com.vrem.wifianalyzer.settings.Settings;
3129

32-
import java.util.Locale;
33-
34-
public class ActivityUtils {
30+
class ActivityUtils {
3531
private ActivityUtils() {
3632
throw new IllegalStateException("Utility class");
3733
}
3834

39-
@NonNull
40-
public static Context createContext(@NonNull Context context) {
41-
Context result = context;
42-
Settings settings = MainContext.INSTANCE.getSettings();
43-
if (settings != null) {
44-
Locale newLocale = settings.getLanguageLocale();
45-
result = ConfigurationUtils.createContext(context, newLocale);
46-
}
47-
return result;
48-
}
49-
50-
public static void setActionBarOptions(ActionBar actionBar) {
35+
static void setActionBarOptions(ActionBar actionBar) {
5136
if (actionBar == null) {
5237
return;
5338
}

0 commit comments

Comments
 (0)