Skip to content

Commit

Permalink
Enhance
Browse files Browse the repository at this point in the history
  - Apply port change immediately when it is modified.
  - Fix some problem of traditional Chinese.
  - Add Pinkd (@78848d676612) to the authors list.
  • Loading branch information
haruue committed Feb 24, 2017
1 parent 3544d87 commit d242b9b
Show file tree
Hide file tree
Showing 13 changed files with 63 additions and 26 deletions.
4 changes: 2 additions & 2 deletions .idea/copyright/profiles_settings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions .idea/dictionaries/haruue.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions .idea/gradle.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion README-zh_rCN.md
Expand Up @@ -33,7 +33,7 @@ start adbd
Apache License 2.0

```License
Copyright 2016 Haruue Icymoon
Copyright 2016 Haruue Icymoon, PinkD
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -35,7 +35,7 @@ Support us in Play Store:
Apache License 2.0

```License
Copyright 2016 Haruue Icymoon
Copyright 2016 Haruue Icymoon, PinkD
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
Binary file modified app/app-release.apk
Binary file not shown.
15 changes: 7 additions & 8 deletions app/build.gradle
@@ -1,14 +1,14 @@
apply plugin: 'com.android.application'

android {
compileSdkVersion 24
compileSdkVersion 25
buildToolsVersion "24.0.3"
defaultConfig {
applicationId "moe.haruue.wadb"
minSdkVersion 14
targetSdkVersion 24
versionCode 11
versionName "2.2.0"
versionCode 12
versionName "2.3.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
jackOptions {
enabled true
Expand Down Expand Up @@ -37,14 +37,13 @@ repositories {

dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:appcompat-v7:24.2.1'
compile 'com.android.support.constraint:constraint-layout:1.0.0-alpha4'
compile 'com.android.support:appcompat-v7:25.2.0'
testCompile 'junit:junit:4.12'
androidTestCompile 'com.android.support.test.espresso:espresso-core:2.2.2'
androidTestCompile 'com.android.support.test:runner:0.5'
androidTestCompile 'com.android.support:support-annotations:24.2.1'
compile 'com.android.support:design:24.2.1'
compile 'eu.chainfire:libsuperuser:1.0.0.+'
androidTestCompile 'com.android.support:support-annotations:25.2.0'
compile 'com.android.support:design:25.2.0'
compile 'eu.chainfire:libsuperuser:1.0.0.201608240809'
compile 'moe.haruue:haruueutils:1.1.1-preview'
compile 'com.jude:easyrecyclerview:4.0.5'
}
18 changes: 18 additions & 0 deletions app/src/main/java/moe/haruue/wadb/data/Commands.java
Expand Up @@ -24,6 +24,24 @@ public interface CommandsListener {
void onWadbStopListener(boolean isSuccess);
}

public static abstract class AbstractCommandsListener implements CommandsListener {

@Override
public void onGetSUAvailable(boolean isAvailable) {}

@Override
public void onGetAdbState(boolean isWadb, int port) {}

@Override
public void onGetAdbStateFailure() {}

@Override
public void onWadbStartListener(boolean isSuccess) {}

@Override
public void onWadbStopListener(boolean isSuccess) {}
}

private static boolean isSUAvailable() {
return Shell.SU.available();
}
Expand Down
24 changes: 19 additions & 5 deletions app/src/main/java/moe/haruue/wadb/ui/fragment/MainFragment.java
Expand Up @@ -10,6 +10,7 @@

import moe.haruue.util.StandardUtils;
import moe.haruue.wadb.R;
import moe.haruue.wadb.data.Commands;
import moe.haruue.wadb.presenter.Commander;
import moe.haruue.wadb.ui.activity.LaunchActivity;
import moe.haruue.wadb.ui.service.NotificationService;
Expand All @@ -34,15 +35,10 @@ public void onCreate(Bundle savedInstanceState) {
PreferenceManager.setDefaultValues(getActivity(), R.xml.preferences, false);
wadbSwitchPreference = (SwitchPreference) findPreference("pref_key_wadb_switch");
portPreference = (EditTextPreference) findPreference("pref_key_wadb_port");
init();
Commander.checkWadbState();
}

private void init() {
SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(StandardUtils.getApplication());
String port = sharedPreferences.getString("pref_key_wadb_port", "5555");
portPreference.setSummary(port);
portPreference.setText(port);
}

@Override
Expand Down Expand Up @@ -83,15 +79,25 @@ public void onOperateFailure() {

@Override
public void onWadbStart(String ip, int port) {
// refresh switch
wadbSwitchPreference.setChecked(true);
wadbSwitchPreference.setSummaryOn(ip + ":" + port);
// refresh port
portPreference.setText(port + "");
portPreference.setSummary(port + "");
wadbSwitchPreference.setEnabled(true);
}

@Override
public void onWadbStop() {
// refresh switch
wadbSwitchPreference.setChecked(false);
wadbSwitchPreference.getEditor().putBoolean("pref_key_wadb_switch", false).commit();
// refresh port
SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(StandardUtils.getApplication());
String port = sharedPreferences.getString("pref_key_wadb_port", "5555");
portPreference.setSummary(port);
portPreference.setText(port);
wadbSwitchPreference.setEnabled(true);
}

Expand Down Expand Up @@ -149,6 +155,14 @@ public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, Strin
}
portPreference.setText(port);
portPreference.setSummary(port);
Commands.getWadbState(new Commands.AbstractCommandsListener() {
@Override
public void onGetAdbState(boolean isWadb, int port) {
if (isWadb) {
Commander.startWadb();
}
}
});
break;
}
}
Expand Down
4 changes: 2 additions & 2 deletions app/src/main/res/raw/license.html
@@ -1,7 +1,7 @@
<h2>WADB</h2>
<p>Author: Haruue Icymoon<br>
<p>Author: Haruue Icymoon, PinkD<br>
Link: https://github.com/haruue/WADB</p>
<pre>Copyright 2016 Haruue Icymoon<br>
<pre>Copyright 2016 Haruue Icymoon, PinkD<br>
<br>
Licensed under the Apache License, Version 2.0 (the &quot;License&quot;);<br>
you may not use this file except in compliance with the License.<br>
Expand Down
4 changes: 2 additions & 2 deletions app/src/main/res/values-zh-rHK/strings.xml
Expand Up @@ -34,6 +34,6 @@
<string name="wake_lock">屏幕常亮</string>
<string name="wake_lock_on">啟用調試時屏幕常亮</string>
<string name="wake_lock_off">不啟用調試時屏幕常亮</string>
<string name="port">端口</string>
<string name="bad_port_number">端口只能在1025–65535之間 \n已重置為5555</string>
<string name="port"></string>
<string name="bad_port_number">埠只能在1025–65535之間 \n已重置為5555</string>
</resources>
4 changes: 2 additions & 2 deletions app/src/main/res/values-zh-rTW/strings.xml
Expand Up @@ -34,6 +34,6 @@
<string name="wake_lock">屏幕常亮</string>
<string name="wake_lock_on">啟用調試時屏幕常亮</string>
<string name="wake_lock_off">不啟用調試時屏幕常亮</string>
<string name="port">端口</string>
<string name="bad_port_number">端口只能在1025–65535之間 \n已重置為5555</string>
<string name="port"></string>
<string name="bad_port_number">埠只能在1025–65535之間 \n已重置為5555</string>
</resources>
2 changes: 1 addition & 1 deletion gradle.properties
Expand Up @@ -16,4 +16,4 @@
systemProp.http.proxyHost=127.0.0.1
systemProp.http.nonProxyHosts=dl.google.com
org.gradle.jvmargs=-Xmx1536m
systemProp.http.proxyPort=1080
systemProp.http.proxyPort=41080

0 comments on commit d242b9b

Please sign in to comment.