wtf
This commit is contained in:
@@ -38,6 +38,7 @@ import com.stardust.util.Supplier;
|
||||
import com.stardust.util.UiHandler;
|
||||
import com.stardust.view.accessibility.AccessibilityInfoProvider;
|
||||
import com.stardust.autojs.core.record.accessibility.AccessibilityActionRecorder;
|
||||
import com.stardust.view.accessibility.AccessibilityNotificationObserver;
|
||||
import com.stardust.view.accessibility.AccessibilityService;
|
||||
import com.stardust.scriptdroid.tool.AccessibilityServiceTool;
|
||||
import com.stardust.view.accessibility.LayoutInspector;
|
||||
@@ -61,7 +62,7 @@ public class AutoJs {
|
||||
}
|
||||
|
||||
private final AccessibilityActionRecorder mAccessibilityActionRecorder = new AccessibilityActionRecorder();
|
||||
private final NotificationListener.Observer mNotificationObserver;
|
||||
private final AccessibilityNotificationObserver mNotificationObserver;
|
||||
private ScriptEngineManager mScriptEngineManager;
|
||||
private final LayoutInspector mLayoutInspector = new LayoutInspector();
|
||||
private final Context mContext;
|
||||
@@ -85,7 +86,7 @@ public class AutoJs {
|
||||
return log;
|
||||
}
|
||||
};
|
||||
mNotificationObserver = new NotificationListener.Observer(context);
|
||||
mNotificationObserver = new AccessibilityNotificationObserver(context);
|
||||
mAccessibilityInfoProvider = new AccessibilityInfoProvider(context.getPackageManager());
|
||||
mScriptEngineService = buildScriptEngineService();
|
||||
addAccessibilityServiceDelegates();
|
||||
@@ -230,7 +231,7 @@ public class AutoJs {
|
||||
}
|
||||
|
||||
@Override
|
||||
public NotificationListener.Observer getNotificationObserver() {
|
||||
public AccessibilityNotificationObserver getNotificationObserver() {
|
||||
return mNotificationObserver;
|
||||
}
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ public class DevPluginService {
|
||||
|
||||
private static DevPluginService sInstance = new DevPluginService();
|
||||
private DevPluginClient mClient;
|
||||
private final PublishSubject<DevPluginClient.State> mConnection = PublishSubject.create();
|
||||
private final PublishSubject<DevPluginClient.State> mConnection = PublishSubject.create();
|
||||
|
||||
public static DevPluginService getInstance() {
|
||||
return sInstance;
|
||||
@@ -23,7 +23,7 @@ public class DevPluginService {
|
||||
return mClient != null && mClient.getState() == DevPluginClient.State.CONNECTED;
|
||||
}
|
||||
|
||||
public boolean isDisconnected(){
|
||||
public boolean isDisconnected() {
|
||||
return mClient == null || mClient.getState() == DevPluginClient.State.DISCONNECTED;
|
||||
}
|
||||
|
||||
@@ -44,7 +44,14 @@ public class DevPluginService {
|
||||
}
|
||||
|
||||
public void connectToServer(String host) {
|
||||
mClient = new DevPluginClient(host, 1209, mConnection);
|
||||
int port = 1209;
|
||||
String ip = host;
|
||||
int i = host.lastIndexOf(':');
|
||||
if (i > 0 && i < host.length() - 1) {
|
||||
port = Integer.parseInt(host.substring(i + 1));
|
||||
ip = host.substring(0, i);
|
||||
}
|
||||
mClient = new DevPluginClient(ip, port, mConnection);
|
||||
mClient.setResponseHandler(new DevPluginResponseHandler());
|
||||
mClient.connectToServer();
|
||||
}
|
||||
|
||||
@@ -163,45 +163,29 @@ public class EditorMenu {
|
||||
private void jumpToLine() {
|
||||
mEditor.getLineCount()
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new Consumer<Integer>() {
|
||||
@Override
|
||||
public void accept(@NonNull Integer lineCount) throws Exception {
|
||||
showJumpDialog(lineCount);
|
||||
}
|
||||
});
|
||||
.subscribe(this::showJumpDialog);
|
||||
}
|
||||
|
||||
private void showJumpDialog(final int lineCount) {
|
||||
String hint = "1 ~ " + lineCount;
|
||||
new ThemeColorMaterialDialogBuilder(mContext)
|
||||
.title(R.string.text_jump_to_line)
|
||||
.input(hint, "", new MaterialDialog.InputCallback() {
|
||||
@Override
|
||||
public void onInput(@android.support.annotation.NonNull MaterialDialog dialog, CharSequence input) {
|
||||
int line = Integer.parseInt(input.toString());
|
||||
mEditor.jumpTo(line - 1, 0);
|
||||
}
|
||||
.input(hint, "", (dialog, input) -> {
|
||||
int line = Integer.parseInt(input.toString());
|
||||
mEditor.jumpTo(line - 1, 0);
|
||||
})
|
||||
.inputType(InputType.TYPE_CLASS_NUMBER)
|
||||
.show();
|
||||
}
|
||||
|
||||
private void showInfo() {
|
||||
Observable.zip(mEditor.getText(), mEditor.getLineCount(), new BiFunction<String, Integer, String>() {
|
||||
@Override
|
||||
public String apply(@NonNull String text, @NonNull Integer lineCount) throws Exception {
|
||||
String size = PFiles.getHumanReadableSize(text.length());
|
||||
return String.format(Locale.getDefault(), mContext.getString(R.string.format_editor_info),
|
||||
text.length(), lineCount, size);
|
||||
}
|
||||
Observable.zip(mEditor.getText(), mEditor.getLineCount(), (text, lineCount) -> {
|
||||
String size = PFiles.getHumanReadableSize(text.length());
|
||||
return String.format(Locale.getDefault(), mContext.getString(R.string.format_editor_info),
|
||||
text.length(), lineCount, size);
|
||||
})
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new Consumer<String>() {
|
||||
@Override
|
||||
public void accept(@NonNull String info) throws Exception {
|
||||
showInfo(info);
|
||||
}
|
||||
});
|
||||
.subscribe(this::showInfo);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
package com.stardust.scriptdroid.ui.user;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.Intent;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
@@ -12,6 +12,7 @@ import com.stardust.scriptdroid.R;
|
||||
import com.stardust.scriptdroid.network.NodeBB;
|
||||
import com.stardust.scriptdroid.network.UserService;
|
||||
import com.stardust.scriptdroid.ui.BaseActivity;
|
||||
import com.stardust.theme.ThemeColorManager;
|
||||
|
||||
import org.androidannotations.annotations.AfterViews;
|
||||
import org.androidannotations.annotations.Click;
|
||||
@@ -33,9 +34,13 @@ public class LoginActivity extends BaseActivity {
|
||||
@ViewById(R.id.password)
|
||||
TextView mPassword;
|
||||
|
||||
@ViewById(R.id.login)
|
||||
View mLogin;
|
||||
|
||||
@AfterViews
|
||||
void setUpViews() {
|
||||
setToolbarAsBack(getString(R.string.text_login));
|
||||
ThemeColorManager.addViewBackground(mLogin);
|
||||
}
|
||||
|
||||
@Click(R.id.login)
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.stardust.scriptdroid.ui.user;
|
||||
|
||||
import android.util.Log;
|
||||
import android.util.Patterns;
|
||||
import android.view.View;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
@@ -9,6 +10,7 @@ import com.afollestad.materialdialogs.MaterialDialog;
|
||||
import com.stardust.scriptdroid.R;
|
||||
import com.stardust.scriptdroid.network.UserService;
|
||||
import com.stardust.scriptdroid.ui.BaseActivity;
|
||||
import com.stardust.theme.ThemeColorManager;
|
||||
|
||||
import org.androidannotations.annotations.AfterViews;
|
||||
import org.androidannotations.annotations.Click;
|
||||
@@ -33,9 +35,14 @@ public class RegisterActivity extends BaseActivity {
|
||||
@ViewById(R.id.password)
|
||||
TextView mPassword;
|
||||
|
||||
@ViewById(R.id.register)
|
||||
View mRegister;
|
||||
|
||||
|
||||
@AfterViews
|
||||
void setUpViews() {
|
||||
setToolbarAsBack(getString(R.string.text_register));
|
||||
ThemeColorManager.addViewBackground(mRegister);
|
||||
}
|
||||
|
||||
@Click(R.id.register)
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
|
||||
</android.support.design.widget.AppBarLayout>
|
||||
|
||||
|
||||
<FrameLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:theme="@style/AppTheme.AppBarOverlay">
|
||||
|
||||
<android.support.v7.widget.Toolbar
|
||||
<com.stardust.theme.widget.ThemeColorToolbar
|
||||
android:id="@+id/toolbar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="?attr/actionBarSize"
|
||||
|
||||
Reference in New Issue
Block a user