Release 2.0.1Beta
This commit is contained in:
@@ -23,15 +23,6 @@ import java.util.Map;
|
||||
*/
|
||||
public class SampleFileManager {
|
||||
|
||||
private static final Map<String, Integer> SAMPLES = new MapEntries<>(new LinkedHashMap<String, Integer>())
|
||||
.entry("sample/自动操作/sample_open_running_services.js", R.string.text_sample_open_running_services)
|
||||
.entry("sample/自动操作/sample_qq_hongbao.js", R.string.text_sample_qq_hongbao)
|
||||
.entry("sample/自动操作/sample_simple_calculator.js", R.string.text_sample_simple_calculator)
|
||||
.entry("sample/自动操作/sample_force_qq_chat.js", R.string.text_sample_for_qq_chat)
|
||||
.entry("sample/自动操作/sample_wechat_scan.js", R.string.text_sample_wechat_scan)
|
||||
.entry("sample/自动操作/sample_alipay_scan.js", R.string.text_sample_alipay_scan)
|
||||
.map();
|
||||
|
||||
private static SampleFileManager instance = new SampleFileManager();
|
||||
|
||||
public static SampleFileManager getInstance() {
|
||||
@@ -42,33 +33,6 @@ public class SampleFileManager {
|
||||
return App.getApp();
|
||||
}
|
||||
|
||||
public void copySampleScriptFileIfNeeded() {
|
||||
if (!Pref.def().getBoolean(Pref.SAMPLE_SCRIPTS_COPIED, false)) {
|
||||
copySampleScriptFile();
|
||||
}
|
||||
}
|
||||
|
||||
public int copySampleScriptFile() {
|
||||
ScriptFileList list = SharedPrefScriptFileList.getInstance();
|
||||
int failCount = 0;
|
||||
for (Map.Entry<String, Integer> entry : SAMPLES.entrySet()) {
|
||||
String assetFile = entry.getKey();
|
||||
String name = getContext().getString(entry.getValue());
|
||||
String path = ScriptFile.DEFAULT_FOLDER + name + ".js";
|
||||
if (!list.containsPath(path)) {
|
||||
if (FileUtils.copyAsset(assetFile, path)) {
|
||||
list.add(new ScriptFile(name, path));
|
||||
} else {
|
||||
failCount++;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (failCount < SAMPLES.size()) {
|
||||
Pref.def().edit().putBoolean(Pref.SAMPLE_SCRIPTS_COPIED, true).apply();
|
||||
}
|
||||
return failCount;
|
||||
}
|
||||
|
||||
public List<SampleGroup> getSamplesFromAssets(AssetManager assets, String path) {
|
||||
List<SampleGroup> sampleGroups = new ArrayList<>();
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user