MISC: change all indent to 2 spaces (so compat!)

This commit is contained in:
imkiva
2021-05-08 00:11:00 +08:00
committed by Kiva Oyama
parent 880082458a
commit e8e9162fcf
326 changed files with 37875 additions and 38821 deletions
+18 -18
View File
@@ -4,28 +4,28 @@ def libraryVersionCode = 1
def libraryVersionName = "1.0"
android {
compileSdkVersion rootProject.ext.android.COMPILE_SDK_VERSION
compileSdkVersion rootProject.ext.android.COMPILE_SDK_VERSION
defaultConfig {
minSdkVersion rootProject.ext.android.MIN_SDK_VERSION
targetSdkVersion rootProject.ext.android.TARGET_SDK_VERSION
versionCode libraryVersionCode
versionName libraryVersionName
testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner'
}
defaultConfig {
minSdkVersion rootProject.ext.android.MIN_SDK_VERSION
targetSdkVersion rootProject.ext.android.TARGET_SDK_VERSION
versionCode libraryVersionCode
versionName libraryVersionName
testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner'
}
buildTypes {
release {
minifyEnabled false
}
buildTypes {
release {
minifyEnabled false
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.2.0'
androidTestImplementation('androidx.test.espresso:espresso-core:3.1.0', {
exclude group: 'com.android.support', module: 'support-annotations'
})
testImplementation rootProject.ext.deps["junit"]
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.2.0'
androidTestImplementation('androidx.test.espresso:espresso-core:3.1.0', {
exclude group: 'com.android.support', module: 'support-annotations'
})
testImplementation rootProject.ext.deps["junit"]
}
+2 -2
View File
@@ -1,2 +1,2 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="io.neoterm.bridge" />
<manifest
package="io.neoterm.bridge"/>
@@ -9,52 +9,52 @@ import java.util.Objects;
* @author kiva
*/
public class Bridge {
public static final String ACTION_EXECUTE = "neoterm.action.remote.execute";
public static final String ACTION_SILENT_RUN = "neoterm.action.remote.silent-run";
public static final String EXTRA_COMMAND = "neoterm.extra.remote.execute.command";
public static final String EXTRA_SESSION_ID = "neoterm.extra.remote.execute.session";
public static final String EXTRA_FOREGROUND = "neoterm.extra.remote.execute.foreground";
private static final String NEOTERM_PACKAGE = "io.neoterm";
private static final String NEOTERM_REMOTE_INTERFACE = "io.neoterm.ui.term.NeoTermRemoteInterface";
private static final ComponentName NEOTERM_COMPONENT = new ComponentName(NEOTERM_PACKAGE, NEOTERM_REMOTE_INTERFACE);
public static final String ACTION_EXECUTE = "neoterm.action.remote.execute";
public static final String ACTION_SILENT_RUN = "neoterm.action.remote.silent-run";
public static final String EXTRA_COMMAND = "neoterm.extra.remote.execute.command";
public static final String EXTRA_SESSION_ID = "neoterm.extra.remote.execute.session";
public static final String EXTRA_FOREGROUND = "neoterm.extra.remote.execute.foreground";
private static final String NEOTERM_PACKAGE = "io.neoterm";
private static final String NEOTERM_REMOTE_INTERFACE = "io.neoterm.ui.term.NeoTermRemoteInterface";
private static final ComponentName NEOTERM_COMPONENT = new ComponentName(NEOTERM_PACKAGE, NEOTERM_REMOTE_INTERFACE);
private Bridge() throws IllegalAccessException {
throw new IllegalAccessException();
}
public static Intent createExecuteIntent(SessionId sessionId,
String command,
boolean foreground) {
Objects.requireNonNull(command, "command");
Objects.requireNonNull(sessionId, "session id");
Intent intent = new Intent(ACTION_EXECUTE);
intent.setComponent(NEOTERM_COMPONENT);
intent.putExtra(EXTRA_COMMAND, command);
intent.putExtra(EXTRA_SESSION_ID, sessionId.getSessionId());
intent.putExtra(EXTRA_FOREGROUND, foreground);
return intent;
}
public static Intent createExecuteIntent(SessionId sessionId, String command) {
return createExecuteIntent(sessionId, command, true);
}
public static Intent createExecuteIntent(String command) {
return createExecuteIntent(SessionId.NEW_SESSION, command);
}
public static Intent createExecuteIntent(String command, boolean foreground) {
return createExecuteIntent(SessionId.NEW_SESSION, command, foreground);
}
public static SessionId parseResult(Intent data) {
Objects.requireNonNull(data, "data");
if (data.hasExtra(EXTRA_SESSION_ID)) {
String handle = data.getStringExtra(EXTRA_SESSION_ID);
return SessionId.of(handle);
}
return null;
private Bridge() throws IllegalAccessException {
throw new IllegalAccessException();
}
public static Intent createExecuteIntent(SessionId sessionId,
String command,
boolean foreground) {
Objects.requireNonNull(command, "command");
Objects.requireNonNull(sessionId, "session id");
Intent intent = new Intent(ACTION_EXECUTE);
intent.setComponent(NEOTERM_COMPONENT);
intent.putExtra(EXTRA_COMMAND, command);
intent.putExtra(EXTRA_SESSION_ID, sessionId.getSessionId());
intent.putExtra(EXTRA_FOREGROUND, foreground);
return intent;
}
public static Intent createExecuteIntent(SessionId sessionId, String command) {
return createExecuteIntent(sessionId, command, true);
}
public static Intent createExecuteIntent(String command) {
return createExecuteIntent(SessionId.NEW_SESSION, command);
}
public static Intent createExecuteIntent(String command, boolean foreground) {
return createExecuteIntent(SessionId.NEW_SESSION, command, foreground);
}
public static SessionId parseResult(Intent data) {
Objects.requireNonNull(data, "data");
if (data.hasExtra(EXTRA_SESSION_ID)) {
String handle = data.getStringExtra(EXTRA_SESSION_ID);
return SessionId.of(handle);
}
return null;
}
}
@@ -6,45 +6,45 @@ import java.util.Objects;
* @author kiva
*/
public class SessionId {
/**
* Created a new session.
*/
public static final SessionId NEW_SESSION = SessionId.of("new");
/**
* Created a new session.
*/
public static final SessionId NEW_SESSION = SessionId.of("new");
/**
* Presents current session in NeoTerm.
*/
public static final SessionId CURRENT_SESSION = SessionId.of("current");
/**
* Presents current session in NeoTerm.
*/
public static final SessionId CURRENT_SESSION = SessionId.of("current");
private final String sessionId;
private final String sessionId;
SessionId(String sessionId) {
this.sessionId = sessionId;
}
SessionId(String sessionId) {
this.sessionId = sessionId;
}
public String getSessionId() {
return sessionId;
}
public String getSessionId() {
return sessionId;
}
@Override
public String toString() {
return "TerminalSession { id = " + sessionId + " }";
}
@Override
public String toString() {
return "TerminalSession { id = " + sessionId + " }";
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
SessionId sessionId1 = (SessionId) o;
return Objects.equals(sessionId, sessionId1.sessionId);
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
SessionId sessionId1 = (SessionId) o;
return Objects.equals(sessionId, sessionId1.sessionId);
}
@Override
public int hashCode() {
return Objects.hash(sessionId);
}
@Override
public int hashCode() {
return Objects.hash(sessionId);
}
public static SessionId of(String sessionId) {
return new SessionId(sessionId);
}
public static SessionId of(String sessionId) {
return new SessionId(sessionId);
}
}
@@ -1,3 +1,3 @@
<resources>
<string name="app_name">NeoTermBridge</string>
<string name="app_name">NeoTermBridge</string>
</resources>
@@ -2,7 +2,7 @@ package io.neoterm.bridge;
import org.junit.Test;
import static org.junit.Assert.*;
import static org.junit.Assert.assertEquals;
/**
* Example local unit test, which will execute on the development machine (host).
@@ -10,8 +10,8 @@ import static org.junit.Assert.*;
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() {
assertEquals(4, 2 + 2);
}
@Test
public void addition_isCorrect() {
assertEquals(4, 2 + 2);
}
}