Skip to content

Commit

Permalink
Merge branch 'development'
Browse files Browse the repository at this point in the history
  • Loading branch information
aaronjwood committed Feb 24, 2020
2 parents 8ff1cef + 3c4f327 commit 1f5e71a
Show file tree
Hide file tree
Showing 19 changed files with 394 additions and 275 deletions.
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ jdk:
android:
components:
- tools
- build-tools-27.0.2
- android-27
- build-tools-28.0.3
- android-29
- extra-android-m2repository

env:
Expand Down
29 changes: 13 additions & 16 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@ sonarqube {
}

android {
compileSdkVersion 27
buildToolsVersion '27.0.2'
compileSdkVersion 29
buildToolsVersion '28.0.3'

defaultConfig {
minSdkVersion 14
targetSdkVersion 27
versionCode 55
versionName "2.2.8"
targetSdkVersion 29
versionCode 57
versionName "2.2.12"
applicationId "com.aaronjwood.portauthority"
setProperty("archivesBaseName", "PortAuthority-$versionName")
}
Expand Down Expand Up @@ -65,15 +65,12 @@ android {
}

dependencies {
compile 'com.android.support:support-v4:27.0.2'
compile 'com.android.support:appcompat-v7:27.0.2'
compile 'com.squareup.okhttp3:okhttp:3.9.1'
compile 'jcifs:jcifs:1.3.17'
compile 'dnsjava:dnsjava:2.1.7'
//This does absolutely nothing
releaseCompile 'com.squareup.leakcanary:leakcanary-android-no-op:1.5.4'
debugCompile 'com.squareup.leakcanary:leakcanary-android:1.5.4'
testCompile 'junit:junit:4.12'
testCompile 'org.mockito:mockito-core:1.10.19'
testCompile 'com.squareup.leakcanary:leakcanary-android-no-op:1.5.4'
implementation 'com.android.support:support-v4:28.0.0'
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.squareup.okhttp3:okhttp:4.4.0'
implementation 'jcifs:jcifs:1.3.17'
implementation 'dnsjava:dnsjava:3.0.1'
debugImplementation 'com.squareup.leakcanary:leakcanary-android:2.2'
testImplementation 'junit:junit:4.12'
testImplementation 'org.mockito:mockito-core:1.10.19'
}
6 changes: 0 additions & 6 deletions app/proguard.pro
Original file line number Diff line number Diff line change
@@ -1,9 +1,3 @@
-dontnote org.xbill.DNS.spi.DNSJavaNameServiceDescriptor
-dontwarn org.xbill.DNS.spi.DNSJavaNameServiceDescriptor
-keep class org.xbill.** { *; }
-keepattributes EnclosingMethod
-keepattributes InnerClasses

-dontwarn okhttp3.**
-dontwarn okio.**
-dontwarn javax.annotation.**
Expand Down
3 changes: 2 additions & 1 deletion app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,11 @@

<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" /> <!-- Needed to read the SSID on Android 8-9. -->
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> <!-- Needed to read the SSID on Android 10+. -->
<uses-permission android:name="android.permission.INTERNET" />

<application
android:name=".PortAuthority"
android:allowBackup="true"
android:icon="@drawable/icon"
android:label="@string/app_name"
Expand Down
33 changes: 0 additions & 33 deletions app/src/main/java/com/aaronjwood/portauthority/PortAuthority.java

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public abstract class HostActivity extends AppCompatActivity implements HostAsyn
protected int layout;
protected ArrayAdapter<String> adapter;
protected ListView portList;
protected final List<String> ports = Collections.synchronizedList(new ArrayList<String>());
protected final List<String> ports = Collections.synchronizedList(new ArrayList<>());
protected ProgressDialog scanProgressDialog;
protected Dialog portRangeDialog;
protected Handler handler;
Expand Down Expand Up @@ -114,7 +114,7 @@ protected void onDestroy() {
public void onSaveInstanceState(Bundle savedState) {
super.onSaveInstanceState(savedState);

String[] savedList = ports.toArray(new String[ports.size()]);
String[] savedList = ports.toArray(new String[0]);
savedState.putStringArray("ports", savedList);
}

Expand All @@ -141,12 +141,9 @@ public void onRestoreInstanceState(Bundle savedInstanceState) {
* @param stop Stopping port picker
*/
protected void resetPortRangeScanClick(final NumberPicker start, final NumberPicker stop) {
portRangeDialog.findViewById(R.id.resetPortRangeScan).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
start.setValue(Constants.MIN_PORT_VALUE);
stop.setValue(Constants.MAX_PORT_VALUE);
}
portRangeDialog.findViewById(R.id.resetPortRangeScan).setOnClickListener(v -> {
start.setValue(Constants.MIN_PORT_VALUE);
stop.setValue(Constants.MAX_PORT_VALUE);
});
}

Expand Down Expand Up @@ -250,13 +247,9 @@ public void onItemClick(AdapterView<?> parent, View view, int position, long id)
*/
@Override
public void processFinish(final int output) {
handler.post(new Runnable() {

@Override
public void run() {
if (scanProgressDialog != null) {
scanProgressDialog.incrementProgressBy(output);
}
handler.post(() -> {
if (scanProgressDialog != null) {
scanProgressDialog.incrementProgressBy(output);
}
});
}
Expand Down Expand Up @@ -307,24 +300,16 @@ private String formatOpenPort(SparseArray<String> entry, int scannedPort, String
*/
private void addOpenPort(final String port) {
setAnimations();
handler.post(new Runnable() {

@Override
public void run() {
ports.add(port);
Collections.sort(ports, new Comparator<String>() {

@Override
public int compare(String lhs, String rhs) {
int left = Integer.parseInt(lhs.substring(0, lhs.indexOf('-') - 1));
int right = Integer.parseInt(rhs.substring(0, rhs.indexOf('-') - 1));
handler.post(() -> {
ports.add(port);
Collections.sort(ports, (lhs, rhs) -> {
int left = Integer.parseInt(lhs.substring(0, lhs.indexOf('-') - 1));
int right = Integer.parseInt(rhs.substring(0, rhs.indexOf('-') - 1));

return left - right;
}
});
return left - right;
});

adapter.notifyDataSetChanged();
}
adapter.notifyDataSetChanged();
});
}

Expand All @@ -335,11 +320,6 @@ public int compare(String lhs, String rhs) {
* @param <T> Exception
*/
public <T extends Throwable> void processFinish(final T output) {
handler.post(new Runnable() {
@Override
public void run() {
Errors.showError(getApplicationContext(), output.getLocalizedMessage());
}
});
handler.post(() -> Errors.showError(getApplicationContext(), output.getLocalizedMessage()));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -169,23 +169,19 @@ public void onClick(View v) {
*/
private void setupWol() {
Button wakeUpButton = findViewById(R.id.wakeOnLan);
wakeUpButton.setOnClickListener(new View.OnClickListener() {

@Override
public void onClick(View v) {
try {
if (!wifi.isConnectedWifi()) {
Errors.showError(getApplicationContext(), getResources().getString(R.string.notConnectedLan));
return;
}
} catch (Wireless.NoConnectivityManagerException e) {
wakeUpButton.setOnClickListener(v -> {
try {
if (!wifi.isConnectedWifi()) {
Errors.showError(getApplicationContext(), getResources().getString(R.string.notConnectedLan));
return;
}

host.wakeOnLan();
Toast.makeText(getApplicationContext(), String.format(getResources().getString(R.string.waking), host.getHostname()), Toast.LENGTH_LONG).show();
} catch (Wireless.NoConnectivityManagerException e) {
Errors.showError(getApplicationContext(), getResources().getString(R.string.notConnectedLan));
return;
}

host.wakeOnLan();
Toast.makeText(getApplicationContext(), String.format(getResources().getString(R.string.waking), host.getHostname()), Toast.LENGTH_LONG).show();
});
}

Expand Down
Loading

0 comments on commit 1f5e71a

Please sign in to comment.