forked from clearw5/Auto.js
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add: tasker plugin support, injectable webview
- Loading branch information
hyb1996
committed
Apr 2, 2017
1 parent
121949f
commit e7500e6
Showing
127 changed files
with
5,280 additions
and
1,654 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
|
||
bg | ||
w | ||
h | ||
margin | ||
marginLeft | ||
margin* | ||
padding | ||
padding* | ||
layout_gravity="center" | ||
gravity | ||
|
||
|
||
weight | ||
|
||
|
||
ui.layout( | ||
<linear orientation="vertical" w="fill" h="300" bg="#ff0000" gravity="center"> | ||
<text text="测试" size="18" color="#000000"/> | ||
<button id="btn" text="按钮"/> | ||
</linear> | ||
); | ||
|
||
<relative> | ||
|
||
</relative> | ||
|
||
<horizon> | ||
|
||
</horiz> | ||
|
||
<vertical> | ||
|
||
</vertical> | ||
|
||
|
||
function ui(){ | ||
|
||
} | ||
|
||
|
||
module.exports = ui; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
|
||
module.exports = { | ||
test: function(){ | ||
return "test"; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package com.stardust.pio; | ||
|
||
/** | ||
* Created by Stardust on 2017/4/1. | ||
*/ | ||
|
||
public class PFile { | ||
|
||
public static PFile open(String path, String mode) { | ||
switch (mode){ | ||
case "r": | ||
return new PReadableFile(path); | ||
case "w": | ||
return new PWritableFile(); | ||
} | ||
return null; | ||
} | ||
|
||
public static void create(String path){ | ||
|
||
} | ||
|
||
public static void createIfNotExists(String path){ | ||
|
||
} | ||
|
||
public static void delete(String path){ | ||
|
||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
package com.stardust.pio; | ||
|
||
import java.io.*; | ||
import java.nio.charset.Charset; | ||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
/** | ||
* Created by Stardust on 2017/4/1. | ||
*/ | ||
|
||
public class PReadableFile extends PFile { | ||
|
||
private BufferedReader mBufferedReader; | ||
private FileInputStream mFileInputStream; | ||
private int mBufferingSize; | ||
private String mEncoding; | ||
|
||
public PReadableFile(String path) { | ||
this(path, Charset.defaultCharset().name()); | ||
} | ||
|
||
public PReadableFile(String path, String encoding) { | ||
this(path, encoding, -1); | ||
} | ||
|
||
public PReadableFile(String path, String encoding, int bufferingSize) { | ||
mEncoding = encoding; | ||
mBufferingSize = bufferingSize; | ||
try { | ||
mFileInputStream = new FileInputStream(path); | ||
} catch (FileNotFoundException e) { | ||
throw new UncheckedIOException(e); | ||
} | ||
} | ||
|
||
|
||
private void ensureBufferReader() { | ||
if (mBufferedReader == null) { | ||
try { | ||
if (mBufferingSize == -1) | ||
mBufferedReader = new BufferedReader(new InputStreamReader(mFileInputStream, mEncoding)); | ||
else | ||
mBufferedReader = new BufferedReader(new InputStreamReader(mFileInputStream, mEncoding), mBufferingSize); | ||
} catch (UnsupportedEncodingException e) { | ||
e.printStackTrace(); | ||
} | ||
|
||
} | ||
} | ||
|
||
public String read() { | ||
try { | ||
byte[] data = new byte[mFileInputStream.available()]; | ||
mFileInputStream.read(data); | ||
return new String(data, mEncoding); | ||
} catch (IOException e) { | ||
throw new UncheckedIOException(e); | ||
} | ||
} | ||
|
||
public String read(int size) { | ||
ensureBufferReader(); | ||
try { | ||
char[] chars = new char[size]; | ||
int len = mBufferedReader.read(chars); | ||
return new String(chars, 0, len); | ||
} catch (IOException e) { | ||
throw new UncheckedIOException(e); | ||
} | ||
} | ||
|
||
public String readline() { | ||
ensureBufferReader(); | ||
try { | ||
return mBufferedReader.readLine(); | ||
} catch (IOException e) { | ||
throw new UncheckedIOException(e); | ||
} | ||
} | ||
|
||
public String[] readlines() { | ||
ensureBufferReader(); | ||
List<String> lines = new ArrayList<>(); | ||
try { | ||
while (mBufferedReader.ready()) { | ||
lines.add(mBufferedReader.readLine()); | ||
} | ||
return lines.toArray(new String[lines.size()]); | ||
} catch (IOException e) { | ||
throw new UncheckedIOException(e); | ||
} | ||
} | ||
|
||
public void close() { | ||
try { | ||
if (mBufferedReader != null) { | ||
mBufferedReader.close(); | ||
} else { | ||
mFileInputStream.close(); | ||
} | ||
} catch (IOException e) { | ||
throw new UncheckedIOException(e); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package com.stardust.pio; | ||
|
||
/** | ||
* Created by Stardust on 2017/4/1. | ||
*/ | ||
|
||
public class PWritableFile extends PFile { | ||
|
||
public PWritableFile(){ | ||
|
||
} | ||
|
||
|
||
|
||
} |
14 changes: 14 additions & 0 deletions
14
app/src/main/java/com/stardust/pio/UncheckedIOException.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package com.stardust.pio; | ||
|
||
import java.io.IOException; | ||
|
||
/** | ||
* Created by Stardust on 2017/4/1. | ||
*/ | ||
|
||
public class UncheckedIOException extends RuntimeException { | ||
|
||
public UncheckedIOException(IOException cause) { | ||
super(cause); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.