Skip to content
This repository was archived by the owner on Mar 25, 2019. It is now read-only.

Commit 19372b0

Browse files
committed
Updated to version 0.3.0
No major changes, just using LiquidCore 0.3.0 Cleaned up some lint warnings
1 parent 2fd709b commit 19372b0

File tree

12 files changed

+57
-76
lines changed

12 files changed

+57
-76
lines changed

.idea/misc.xml

Lines changed: 1 addition & 14 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ A Node.js console UI for LiquidCore
33

44
Version
55
-------
6-
[0.2.2](https://github.com/LiquidPlayer/ConsoleSurface/releases/tag/0.2.2) - Get it through [JitPack](https://jitpack.io/#LiquidPlayer/ConsoleSurface/0.2.2)
6+
[0.3.0](https://github.com/LiquidPlayer/ConsoleSurface/releases/tag/0.3.0) - Get it through [JitPack](https://jitpack.io/#LiquidPlayer/ConsoleSurface/0.3.0)
77

88
[![Release](https://jitpack.io/v/LiquidPlayer/ConsoleSurface.svg)](https://jitpack.io/#LiquidPlayer/ConsoleSurface)
99

@@ -118,7 +118,7 @@ Then, add the ConsoleSurface library to your **app's `build.gradle`**:
118118
```
119119
dependencies {
120120
...
121-
compile 'com.github.LiquidPlayer:ConsoleSurface:0.2.2'
121+
compile 'com.github.LiquidPlayer:ConsoleSurface:0.3.0'
122122
}
123123
124124
```
@@ -182,7 +182,7 @@ LiquidCore_ {
182182
_events: {},
183183
_eventsCount: 0,
184184
_maxListeners: undefined,
185-
availableSurfaces: { 'org.liquidplayer.surface.console.ConsoleSurface': '0.2.2' },
185+
availableSurfaces: { 'org.liquidplayer.surface.console.ConsoleSurface': '0.3.0' },
186186
attach: [Function: attach_],
187187
detach: [Function: detach_] }
188188
```
@@ -194,7 +194,7 @@ Type `LiquidCore.detach()` in your console and Poof! Your surface is gone. If y
194194
device, a new instance will be launched and reattached. Type `process.exit()`
195195
and the same thing happens.
196196

197-
Of course it is possible to use a [`LiquidView`](https://liquidplayer.github.io/LiquidCoreAndroid/0.2.2/org/liquidplayer/service/LiquidView.html) programmatically and dynamically set its available surfaces
197+
Of course it is possible to use a [`LiquidView`](https://liquidplayer.github.io/LiquidCoreAndroid/0.3.0/org/liquidplayer/service/LiquidView.html) programmatically and dynamically set its available surfaces
198198
and URI. The [ExampleBitTorrentμService](https://github.com/LiquidPlayer/Examples/tree/master/ExampleBitTorrent%CE%BCService) project uses LiquidView programmatically.
199199

200200
License

build.gradle

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,13 @@
33
buildscript {
44
repositories {
55
jcenter()
6+
maven {
7+
url 'https://maven.google.com/'
8+
name 'Google'
9+
}
610
}
711
dependencies {
8-
classpath 'com.android.tools.build:gradle:2.2.3'
12+
classpath 'com.android.tools.build:gradle:3.0.0'
913
classpath 'com.github.dcendents:android-maven-gradle-plugin:1.4.1'
1014

1115
// NOTE: Do not place your application dependencies here; they belong
@@ -17,6 +21,10 @@ allprojects {
1721
repositories {
1822
jcenter()
1923
maven { url "https://jitpack.io" }
24+
maven {
25+
url 'https://maven.google.com/'
26+
name 'Google'
27+
}
2028
}
2129
}
2230

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
#Mon Dec 28 10:00:20 PST 2015
1+
#Sat Nov 18 17:32:51 CET 2017
22
distributionBase=GRADLE_USER_HOME
33
distributionPath=wrapper/dists
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists
6-
distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip
6+
distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip

lib/build.gradle

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@ apply plugin: 'jacoco'
33
apply plugin: 'com.github.dcendents.android-maven'
44

55
android {
6-
compileSdkVersion 25
7-
buildToolsVersion "25.0.2"
6+
compileSdkVersion 26
7+
buildToolsVersion "26.0.2"
88

99
defaultConfig {
1010
minSdkVersion 16
11-
targetSdkVersion 24
11+
targetSdkVersion 26
1212
versionCode 2
13-
versionName "0.2.2"
13+
versionName "0.3.0"
1414
setProperty("archivesBaseName", "LiquidConsoleSurface")
1515
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
1616
}
@@ -28,13 +28,13 @@ android {
2828
}
2929

3030
dependencies {
31-
compile fileTree(include: ['*.jar'], dir: 'libs')
32-
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
31+
implementation fileTree(include: ['*.jar'], dir: 'libs')
32+
androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', {
3333
exclude group: 'com.android.support', module: 'support-annotations'
3434
})
35-
compile 'com.android.support:appcompat-v7:25.3.1'
36-
testCompile 'junit:junit:4.12'
37-
compile 'com.github.LiquidPlayer:LiquidCore:0.2.2'
35+
implementation 'com.android.support:appcompat-v7:26.1.0'
36+
testImplementation 'junit:junit:4.12'
37+
implementation 'com.github.LiquidPlayer:LiquidCore:0.3.0'
3838
}
3939

4040
// build a jar with source files
@@ -61,7 +61,6 @@ artifacts {
6161
archives javadocJar
6262
}
6363

64-
6564
apply plugin: 'com.github.dcendents.android-maven'
6665

6766
group='com.github.liquidplayer'

lib/src/main/java/org/liquidplayer/surface/console/AnsiConsoleTextView.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,14 +38,14 @@ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
3838
import android.text.Html;
3939
import android.text.TextUtils;
4040
import android.util.AttributeSet;
41-
import android.widget.TextView;
41+
import android.support.v7.widget.AppCompatTextView;
4242

4343
import java.io.ByteArrayOutputStream;
4444
import java.io.IOException;
4545
import java.util.ArrayList;
4646
import java.util.concurrent.Semaphore;
4747

48-
class AnsiConsoleTextView extends TextView {
48+
class AnsiConsoleTextView extends AppCompatTextView {
4949
public AnsiConsoleTextView(Context context, AttributeSet attrs) {
5050
super(context, attrs);
5151
stream = new ConsoleOutputStream(new ByteArrayOutputStream());

lib/src/main/java/org/liquidplayer/surface/console/AnsiOutputStream.java

Lines changed: 14 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/**
1+
/*
22
* Copyright (C) 2009, Progress Software Corporation and/or its
33
* subsidiaries or affiliates. All rights reserved.
44
*
@@ -14,7 +14,7 @@
1414
* See the License for the specific language governing permissions and
1515
* limitations under the License.
1616
*/
17-
/**
17+
/*
1818
* Edited by Eric Lange for LiquidPlayer
1919
* Copyright (C) 2016, Eric Lange. All Rights Reserved.
2020
*/
@@ -53,7 +53,7 @@ class AnsiOutputStream extends FilterOutputStream {
5353
private byte[] buffer = new byte[MAX_ESCAPE_SEQUENCE_LENGTH];
5454
private int pos = 0;
5555
private int startOfValue;
56-
private final ArrayList<Object> options = new ArrayList<Object>();
56+
private final ArrayList<Object> options = new ArrayList<>();
5757

5858
private static final int LOOKING_FOR_FIRST_ESC_CHAR = 0;
5959
private static final int LOOKING_FOR_SECOND_ESC_CHAR = 1;
@@ -108,9 +108,9 @@ public void write(int data) throws IOException {
108108
} else if (';' == data) {
109109
options.add(null);
110110
} else if ('?' == data) {
111-
options.add(new Character('?'));
111+
options.add('?');
112112
} else if ('=' == data) {
113-
options.add(new Character('='));
113+
options.add('=');
114114
} else {
115115
reset(processEscapeCommand(options, data));
116116
}
@@ -122,7 +122,7 @@ public void write(int data) throws IOException {
122122
buffer[pos++] = (byte) data;
123123
if (!('0' <= data && data <= '9')) {
124124
String strValue = new String(buffer, startOfValue, (pos - 1) - startOfValue, "UTF-8");
125-
Integer value = new Integer(strValue);
125+
Integer value = Integer.valueOf(strValue);
126126
options.add(value);
127127
if (data == ';') {
128128
state = LOOKING_FOR_NEXT_ARG;
@@ -159,13 +159,11 @@ public void write(int data) throws IOException {
159159
buffer[pos++] = (byte) data;
160160
if (';' == data) {
161161
String strValue = new String(buffer, startOfValue, (pos - 1) - startOfValue, "UTF-8");
162-
Integer value = new Integer(strValue);
162+
Integer value = Integer.valueOf(strValue);
163163
options.add(value);
164164
startOfValue = pos;
165165
state = LOOKING_FOR_OSC_PARAM;
166-
} else if ('0' <= data && data <= '9') {
167-
// already pushed digit to buffer, just keep looking
168-
} else {
166+
} else if (!('0' <= data && data <= '9')) {
169167
// oops, did not expect this
170168
reset(false);
171169
}
@@ -179,9 +177,9 @@ public void write(int data) throws IOException {
179177
reset(processOperatingSystemCommand(options));
180178
} else if (FIRST_ESC_CHAR == data) {
181179
state = LOOKING_FOR_ST;
182-
} else {
180+
} /*else {
183181
// just keep looking while adding text
184-
}
182+
}*/
185183
break;
186184

187185
case LOOKING_FOR_ST:
@@ -205,9 +203,8 @@ public void write(int data) throws IOException {
205203
/**
206204
* Resets all state to continue with regular parsing
207205
* @param skipBuffer if current buffer should be skipped or written to out
208-
* @throws IOException
209206
*/
210-
private void reset(boolean skipBuffer) throws IOException {
207+
private void reset(boolean skipBuffer) /*throws IOException*/ {
211208
/*
212209
FIXME!
213210
if (!skipBuffer) {
@@ -273,7 +270,7 @@ private boolean processEscapeCommand(ArrayList<Object> options, int command) thr
273270
for (Object next : options) {
274271
if (next != null) {
275272
count++;
276-
int value = ((Integer) next).intValue();
273+
int value = ((Integer) next);
277274
if (30 <= value && value <= 37) {
278275
processSetForegroundColor(value - 30);
279276
} else if (40 <= value && value <= 47) {
@@ -486,7 +483,7 @@ private int optionInt(ArrayList<Object> options, int index) {
486483
throw new IllegalArgumentException();
487484
if (!value.getClass().equals(Integer.class))
488485
throw new IllegalArgumentException();
489-
return ((Integer) value).intValue();
486+
return ((Integer) value);
490487
}
491488

492489
private int optionInt(ArrayList<Object> options, int index, int defaultValue) {
@@ -495,7 +492,7 @@ private int optionInt(ArrayList<Object> options, int index, int defaultValue) {
495492
if (value == null) {
496493
return defaultValue;
497494
}
498-
return ((Integer) value).intValue();
495+
return ((Integer) value);
499496
}
500497
return defaultValue;
501498
}

lib/src/main/java/org/liquidplayer/surface/console/ConsoleSurface.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
3838
import android.os.Parcel;
3939
import android.os.Parcelable;
4040
import android.util.AttributeSet;
41+
import android.view.View;
4142

4243
import org.liquidplayer.javascript.JSContext;
4344
import org.liquidplayer.javascript.JSException;
@@ -47,6 +48,7 @@ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
4748
import org.liquidplayer.node.Process;
4849
import org.liquidplayer.service.MicroService;
4950
import org.liquidplayer.service.Surface;
51+
import org.liquidplayer.service.Synchronizer;
5052

5153
import java.util.HashMap;
5254

@@ -92,6 +94,11 @@ protected void resize(int columns, int rows) {
9294
}
9395
}
9496

97+
@Override
98+
public void bind(MicroService service, JSContext context, Synchronizer synchronizer) {
99+
// Nothing to do -- everything happens during attach
100+
}
101+
95102
/**
96103
* ConsoleSurface is somewhat unusal for Surfaces. It can be attached and detached at any
97104
* time during the MicroService lifecycle, as it dynamically overrides stderr, stdout and
@@ -101,10 +108,11 @@ protected void resize(int columns, int rows) {
101108
* @param service The MicroService to attach
102109
*/
103110
@Override
104-
public void attach(MicroService service, Runnable onAttached) {
111+
public View attach(MicroService service, Runnable onAttached) {
105112
session = ConsoleSession.newSession(service, onAttached);
106113
session.setCurrentView(this);
107114
uuid = service.getId();
115+
return this;
108116
}
109117

110118
@Override

lib/src/main/java/org/liquidplayer/surface/console/ConsoleView.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -185,17 +185,17 @@ public void run() {
185185
private Handler uiThread = new Handler(Looper.getMainLooper());
186186

187187
private void loadViews() {
188-
inputBox = (EditText) findViewById(R.id.inputBox);
189-
scrollView = (NestedScrollView) findViewById(R.id.scroll);
188+
inputBox = findViewById(R.id.inputBox);
189+
scrollView = findViewById(R.id.scroll);
190190

191191
inputBox.setFocusableInTouchMode(true);
192192
inputBox.requestFocus();
193193
inputBox.setOnEditorActionListener(onEditorAction);
194194
inputBox.setOnKeyListener(onKeyListener);
195195
inputBox.setEnabled(false);
196196

197-
upHistory = (ImageButton) findViewById(R.id.up_history);
198-
downHistory = (ImageButton) findViewById(R.id.down_history);
197+
upHistory = findViewById(R.id.up_history);
198+
downHistory = findViewById(R.id.down_history);
199199

200200
upHistory.setOnClickListener(onUpClick);
201201
downHistory.setOnClickListener(onDownClick);
@@ -205,7 +205,7 @@ private void loadViews() {
205205
ViewTreeObserver vto = scrollView.getViewTreeObserver();
206206
vto.addOnGlobalLayoutListener(onLayout);
207207

208-
consoleTextView = (AnsiConsoleTextView) findViewById(R.id.console_text);
208+
consoleTextView = findViewById(R.id.console_text);
209209
consoleTextView.addListener(this);
210210
// FIXME: Don't forget to removeListener on shutdown
211211

lib/src/main/java/org/liquidplayer/surface/console/HtmlAnsiOutputStream.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/**
1+
/*
22
* Copyright (C) 2009, Progress Software Corporation and/or its
33
* subsidiaries or affiliates. All rights reserved.
44
*
@@ -14,7 +14,7 @@
1414
* See the License for the specific language governing permissions and
1515
* limitations under the License.
1616
*/
17-
/**
17+
/*
1818
* Edited by Eric Lange for LiquidPlayer
1919
* Copyright (C) 2016, Eric Lange. All Rights Reserved.
2020
*/

lib/src/main/res/values/colors.xml

Lines changed: 0 additions & 6 deletions
This file was deleted.

lib/src/main/res/values/styles.xml

Lines changed: 0 additions & 12 deletions
This file was deleted.

0 commit comments

Comments
 (0)