save works
This commit is contained in:
BIN
.idea/caches/build_file_checksums.ser
generated
BIN
.idea/caches/build_file_checksums.ser
generated
Binary file not shown.
@@ -35,7 +35,7 @@
|
||||
tools:replace="android:label, android:icon, android:allowBackup">
|
||||
|
||||
<activity
|
||||
android:name=".ui.splash.SplashActivity_"
|
||||
android:name=".ui.splash.SplashActivity"
|
||||
android:hardwareAccelerated="true"
|
||||
android:label="@string/_app_name"
|
||||
android:theme="@style/AppTheme.Splash">
|
||||
@@ -96,7 +96,8 @@
|
||||
android:name=".ui.user.RegisterActivity_"
|
||||
android:windowSoftInputMode="adjustResize"/>
|
||||
<activity android:name=".ui.user.WebActivity_"/>
|
||||
<activity android:name=".ui.build.BuildActivity_"/>
|
||||
<activity android:name=".ui.project.BuildActivity_"/>
|
||||
<activity android:name=".ui.project.ProjectConfigActivity_"/>
|
||||
<activity android:name=".ui.log.LogActivity_"/>
|
||||
<activity android:name=".ui.doc.DocumentationActivity_"/>
|
||||
<activity android:name=".ui.shortcut.ShortcutIconSelectActivity_"/>
|
||||
|
||||
@@ -3,11 +3,10 @@ package org.autojs.autojs.build;
|
||||
import android.content.Context;
|
||||
import android.content.pm.PackageInfo;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.os.Build;
|
||||
|
||||
import com.stardust.pio.UncheckedIOException;
|
||||
import org.autojs.autojs.BuildConfig;
|
||||
import org.autojs.autojs.ui.build.BuildActivity;
|
||||
|
||||
import com.stardust.util.DeveloperUtils;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
@@ -84,7 +84,7 @@ public class Explorer {
|
||||
|
||||
|
||||
public Single<ExplorerPage> fetchChildren(ExplorerPage page) {
|
||||
ExplorerPage cachedGroup = mExplorerPageLruCache.get(page.getPath());
|
||||
ExplorerPage cachedGroup = mExplorerPageLruCache == null ? null : mExplorerPageLruCache.get(page.getPath());
|
||||
if (cachedGroup != null) {
|
||||
page.copyChildren(cachedGroup);
|
||||
return Single.just(page);
|
||||
@@ -92,7 +92,8 @@ public class Explorer {
|
||||
return mExplorerProvider.getExplorerPage(page)
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.map(g -> {
|
||||
mExplorerPageLruCache.put(g.getPath(), g);
|
||||
if (mExplorerPageLruCache != null)
|
||||
mExplorerPageLruCache.put(g.getPath(), g);
|
||||
page.copyChildren(g);
|
||||
return page;
|
||||
});
|
||||
|
||||
@@ -10,15 +10,15 @@ public class ExplorerChangeEvent {
|
||||
private final int mAction;
|
||||
private final ExplorerItem mItem;
|
||||
private final ExplorerItem mNewItem;
|
||||
private final ExplorerPage mItemGroup;
|
||||
private final ExplorerPage mPage;
|
||||
|
||||
public ExplorerChangeEvent(ExplorerPage itemGroup) {
|
||||
this(itemGroup, CHANGE, null, null);
|
||||
public ExplorerChangeEvent(ExplorerPage page) {
|
||||
this(page, CHANGE, null, null);
|
||||
}
|
||||
|
||||
public ExplorerChangeEvent(ExplorerPage parent, int action, ExplorerItem oldItem, ExplorerItem newItem) {
|
||||
mAction = action;
|
||||
mItemGroup = parent;
|
||||
mPage = parent;
|
||||
mNewItem = newItem;
|
||||
mItem = oldItem;
|
||||
}
|
||||
@@ -43,7 +43,7 @@ public class ExplorerChangeEvent {
|
||||
return mNewItem;
|
||||
}
|
||||
|
||||
public ExplorerPage getItemGroup() {
|
||||
return mItemGroup;
|
||||
public ExplorerPage getPage() {
|
||||
return mPage;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -42,8 +42,19 @@ public class ExplorerDirPage extends ExplorerFileItem implements ExplorerPage {
|
||||
}
|
||||
}
|
||||
|
||||
protected int indexOf(ExplorerItem child){
|
||||
int i = 0;
|
||||
for(ExplorerItem item : mChildren){
|
||||
if(item.getPath().equals(child.getPath())){
|
||||
return i;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
public boolean updateChild(ExplorerItem oldItem, ExplorerItem newItem) {
|
||||
int i = mChildren.indexOf(oldItem);
|
||||
int i = indexOf(oldItem);
|
||||
if (i < 0) {
|
||||
return false;
|
||||
}
|
||||
@@ -52,7 +63,12 @@ public class ExplorerDirPage extends ExplorerFileItem implements ExplorerPage {
|
||||
}
|
||||
|
||||
public boolean removeChild(ExplorerItem item) {
|
||||
return mChildren.remove(item);
|
||||
int i = indexOf(item);
|
||||
if(i < 0){
|
||||
return false;
|
||||
}
|
||||
mChildren.remove(i);
|
||||
return true;
|
||||
}
|
||||
|
||||
public void addChild(ExplorerItem item) {
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
package org.autojs.autojs.model.explorer;
|
||||
|
||||
import android.graphics.Color;
|
||||
|
||||
import com.stardust.pio.PFile;
|
||||
|
||||
import org.autojs.autojs.model.script.ScriptFile;
|
||||
@@ -52,6 +50,16 @@ public class ExplorerFileItem implements ExplorerItem {
|
||||
return mFile.lastModified();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canDelete() {
|
||||
return mFile.canWrite();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canRename() {
|
||||
return mFile.canWrite();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getType() {
|
||||
if(mFile.isDirectory()){
|
||||
@@ -73,7 +81,7 @@ public class ExplorerFileItem implements ExplorerItem {
|
||||
@Override
|
||||
public boolean isEditable() {
|
||||
String type = getType();
|
||||
return type.equals("js") || type.equals("json") || type.equals("xml");
|
||||
return !type.equals(TYPE_AUTO_FILE) && !type.equals(TYPE_APK);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -10,6 +10,7 @@ public interface ExplorerItem {
|
||||
String TYPE_JSON = "json";
|
||||
String TYPE_XML = "xml";
|
||||
String TYPE_UNKNOWN = "?";
|
||||
String TYPE_APK = "apk";
|
||||
|
||||
String getName();
|
||||
|
||||
@@ -19,6 +20,10 @@ public interface ExplorerItem {
|
||||
|
||||
long lastModified();
|
||||
|
||||
boolean canDelete();
|
||||
|
||||
boolean canRename();
|
||||
|
||||
String getType();
|
||||
|
||||
long getSize();
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
package org.autojs.autojs.model.explorer;
|
||||
|
||||
import com.stardust.autojs.project.ProjectConfig;
|
||||
import com.stardust.pio.PFile;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
public class ExplorerProjectPage extends ExplorerDirPage {
|
||||
|
||||
private ProjectConfig mProjectConfig;
|
||||
|
||||
public ExplorerProjectPage(PFile file, ExplorerPage parent, ProjectConfig projectConfig) {
|
||||
super(file, parent);
|
||||
mProjectConfig = projectConfig;
|
||||
}
|
||||
|
||||
public ExplorerProjectPage(String path, ExplorerPage parent, ProjectConfig projectConfig) {
|
||||
super(path, parent);
|
||||
mProjectConfig = projectConfig;
|
||||
}
|
||||
|
||||
public ExplorerProjectPage(File file, ExplorerPage parent, ProjectConfig projectConfig) {
|
||||
super(file, parent);
|
||||
mProjectConfig = projectConfig;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
package org.autojs.autojs.model.explorer;
|
||||
|
||||
import com.stardust.pio.PFile;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
public class ExplorerSamleItem extends ExplorerFileItem {
|
||||
public ExplorerSamleItem(PFile file, ExplorerPage parent) {
|
||||
super(file, parent);
|
||||
}
|
||||
|
||||
public ExplorerSamleItem(String path, ExplorerPage parent) {
|
||||
super(path, parent);
|
||||
}
|
||||
|
||||
public ExplorerSamleItem(File file, ExplorerPage parent) {
|
||||
super(file, parent);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canDelete() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canRename() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -1,4 +0,0 @@
|
||||
package org.autojs.autojs.model.explorer;
|
||||
|
||||
public interface IExplorerPage {
|
||||
}
|
||||
@@ -3,6 +3,7 @@ package org.autojs.autojs.model.explorer;
|
||||
import android.content.Context;
|
||||
import android.content.res.AssetManager;
|
||||
|
||||
import com.stardust.autojs.project.ProjectConfig;
|
||||
import com.stardust.pio.PFile;
|
||||
import com.stardust.pio.PFiles;
|
||||
|
||||
@@ -38,22 +39,35 @@ public class WorkspaceFileProvider extends ExplorerFileProvider {
|
||||
String path = page.getPath();
|
||||
return listFiles(new PFile(path))
|
||||
.collectInto(createExplorerPage(path, parent), (p, file) -> {
|
||||
if(file.isDirectory()){
|
||||
if(file.getPath().startsWith(mSampleDir.getPath())){
|
||||
if (file.isDirectory()) {
|
||||
ProjectConfig projectConfig = ProjectConfig.fromProjectDir(file.getPath());
|
||||
if (projectConfig != null) {
|
||||
p.addChild(new ExplorerProjectPage(file, parent, projectConfig));
|
||||
return;
|
||||
}
|
||||
if (inSampleDir(file)) {
|
||||
p.addChild(new ExplorerSamplePage(file, p));
|
||||
}else {
|
||||
} else {
|
||||
p.addChild(new ExplorerDirPage(file, p));
|
||||
}
|
||||
}else {
|
||||
p.addChild(new ExplorerFileItem(file, p));
|
||||
} else {
|
||||
if (file.getPath().startsWith(mSampleDir.getPath())) {
|
||||
p.addChild(new ExplorerSamleItem(file, p));
|
||||
} else {
|
||||
p.addChild(new ExplorerFileItem(file, p));
|
||||
}
|
||||
}
|
||||
})
|
||||
.subscribeOn(Schedulers.io());
|
||||
}
|
||||
|
||||
private boolean inSampleDir(PFile file) {
|
||||
return file.getPath().startsWith(mSampleDir.getPath());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Observable<PFile> listFiles(PFile directory) {
|
||||
if (directory.getPath().startsWith(mSampleDir.getPath())) {
|
||||
if (inSampleDir(directory)) {
|
||||
return listSamples(directory);
|
||||
}
|
||||
return super.listFiles(directory);
|
||||
@@ -61,9 +75,9 @@ public class WorkspaceFileProvider extends ExplorerFileProvider {
|
||||
|
||||
private Observable<PFile> listSamples(PFile directory) {
|
||||
String pathOfSample;
|
||||
if(directory.getPath().length() <= mSampleDir.getPath().length() + 1){
|
||||
if (directory.getPath().length() <= mSampleDir.getPath().length() + 1) {
|
||||
pathOfSample = "";
|
||||
}else {
|
||||
} else {
|
||||
pathOfSample = directory.getPath().substring(mSampleDir.getPath().length());
|
||||
}
|
||||
String pathOfAsset = SAMPLE_PATH + pathOfSample;
|
||||
@@ -71,13 +85,13 @@ public class WorkspaceFileProvider extends ExplorerFileProvider {
|
||||
.flatMap(path -> Observable.fromArray(mAssetManager.list(path)))
|
||||
.map(child -> {
|
||||
PFile file = new PFile(new File(directory, child).getPath());
|
||||
if(file.exists()){
|
||||
return file;
|
||||
if (file.exists()) {
|
||||
return file;
|
||||
}
|
||||
try {
|
||||
InputStream stream = mAssetManager.open(pathOfAsset + "/" + child);
|
||||
PFiles.copyStream(stream, file.getPath());
|
||||
}catch (FileNotFoundException e){
|
||||
} catch (FileNotFoundException e) {
|
||||
file.mkdirs();
|
||||
}
|
||||
return file;
|
||||
@@ -88,7 +102,7 @@ public class WorkspaceFileProvider extends ExplorerFileProvider {
|
||||
protected ExplorerDirPage createExplorerPage(String path, ExplorerPage parent) {
|
||||
ExplorerDirPage page = super.createExplorerPage(path, parent);
|
||||
if (new File(path).equals(new File(Pref.getScriptDirPath()))) {
|
||||
page.addChild( ExplorerSamplePage.createRoot(mSampleDir));
|
||||
page.addChild(ExplorerSamplePage.createRoot(mSampleDir));
|
||||
}
|
||||
return page;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
package org.autojs.autojs.model.project;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
|
||||
import com.stardust.autojs.project.ProjectConfig;
|
||||
import com.stardust.pio.PFiles;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import io.reactivex.Observable;
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.schedulers.Schedulers;
|
||||
|
||||
public class ProjectTemplate {
|
||||
|
||||
|
||||
private final ProjectConfig mProjectConfig;
|
||||
private final File mProjectDir;
|
||||
|
||||
public ProjectTemplate(ProjectConfig projectConfig, File projectDir) {
|
||||
mProjectConfig = projectConfig;
|
||||
mProjectDir = projectDir;
|
||||
}
|
||||
|
||||
@SuppressLint("CheckResult")
|
||||
public Observable<File> newProject() {
|
||||
return Observable.fromCallable(() -> {
|
||||
mProjectDir.mkdirs();
|
||||
PFiles.write(ProjectConfig.configFileOfDir(mProjectDir.getPath()), mProjectConfig.toJson());
|
||||
new File(mProjectDir, mProjectConfig.getMainScriptFile()).createNewFile();
|
||||
return mProjectDir;
|
||||
})
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -13,6 +13,7 @@ import android.widget.SeekBar;
|
||||
|
||||
import org.autojs.autojs.R;
|
||||
import org.autojs.autojs.network.VersionService;
|
||||
|
||||
import com.stardust.theme.ThemeColorManager;
|
||||
import com.stardust.util.BackPressedHandler;
|
||||
|
||||
@@ -51,16 +52,19 @@ public abstract class BaseActivity extends AppCompatActivity {
|
||||
return (T) findViewById(resId);
|
||||
}
|
||||
|
||||
protected void checkPermission(String... permissions) {
|
||||
protected boolean checkPermission(String... permissions) {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
||||
String[] requestPermissions = getRequestPermissions(permissions);
|
||||
if (requestPermissions.length > 0) {
|
||||
requestPermissions(requestPermissions, PERMISSION_REQUEST_CODE);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
} else {
|
||||
int[] grantResults = new int[permissions.length];
|
||||
Arrays.fill(grantResults, PERMISSION_GRANTED);
|
||||
onRequestPermissionsResult(PERMISSION_REQUEST_CODE, permissions, grantResults);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -25,8 +25,10 @@ import org.autojs.autojs.Pref;
|
||||
import org.autojs.autojs.R;
|
||||
import org.autojs.autojs.external.ScriptIntents;
|
||||
import org.autojs.autojs.model.explorer.Explorer;
|
||||
import org.autojs.autojs.model.explorer.ExplorerDirPage;
|
||||
import org.autojs.autojs.model.explorer.ExplorerFileItem;
|
||||
import org.autojs.autojs.model.explorer.ExplorerItem;
|
||||
import org.autojs.autojs.model.explorer.ExplorerPage;
|
||||
import org.autojs.autojs.model.explorer.Explorers;
|
||||
import org.autojs.autojs.storage.file.TmpScriptFiles;
|
||||
import org.autojs.autojs.model.sample.SampleFile;
|
||||
@@ -58,7 +60,7 @@ import io.reactivex.subjects.PublishSubject;
|
||||
public class ScriptOperations {
|
||||
|
||||
private static final String LOG_TAG = "ScriptOperations";
|
||||
private final ExplorerItem mExplorerItem;
|
||||
private final ExplorerPage mExplorerPage;
|
||||
private Context mContext;
|
||||
private View mView;
|
||||
private ScriptFile mCurrentDirectory;
|
||||
@@ -69,15 +71,15 @@ public class ScriptOperations {
|
||||
mView = view;
|
||||
mCurrentDirectory = currentDirectory;
|
||||
mExplorer = Explorers.workspace();
|
||||
mExplorerItem = new ExplorerFileItem(currentDirectory, null);
|
||||
mExplorerPage = new ExplorerDirPage(currentDirectory, null);
|
||||
}
|
||||
|
||||
public ScriptOperations(Context context, View view, ExplorerItem item) {
|
||||
public ScriptOperations(Context context, View view, ExplorerPage page) {
|
||||
mContext = context;
|
||||
mView = view;
|
||||
mCurrentDirectory = item.toScriptFile();
|
||||
mCurrentDirectory = page.toScriptFile();
|
||||
mExplorer = Explorers.workspace();
|
||||
mExplorerItem = item;
|
||||
mExplorerPage = page;
|
||||
}
|
||||
|
||||
public ScriptOperations(Context context, View view) {
|
||||
@@ -118,7 +120,7 @@ public class ScriptOperations {
|
||||
}
|
||||
|
||||
private void notifyFileCreated(ScriptFile directory, ScriptFile scriptFile) {
|
||||
mExplorer.notifyItemCreated(new ExplorerFileItem(scriptFile, mExplorerItem.getParent()));
|
||||
mExplorer.notifyItemCreated(new ExplorerFileItem(scriptFile, mExplorerPage));
|
||||
}
|
||||
|
||||
public void newScriptFile() {
|
||||
@@ -236,8 +238,8 @@ public class ScriptOperations {
|
||||
}
|
||||
|
||||
private void notifyFileChanged(ScriptFile directory, ScriptFile oldFile, PFile newFile) {
|
||||
mExplorer.notifyItemChanged(new ExplorerFileItem(oldFile, mExplorerItem.getParent()),
|
||||
new ExplorerFileItem(newFile, mExplorerItem.getParent()));
|
||||
mExplorer.notifyItemChanged(new ExplorerFileItem(oldFile, mExplorerPage),
|
||||
new ExplorerFileItem(newFile, mExplorerPage));
|
||||
}
|
||||
|
||||
public void createShortcut(ScriptFile file) {
|
||||
@@ -270,7 +272,7 @@ public class ScriptOperations {
|
||||
}
|
||||
|
||||
private void notifyFileRemoved(ScriptFile directory, ScriptFile scriptFile) {
|
||||
mExplorer.notifyItemRemoved(new ExplorerFileItem(scriptFile, mExplorerItem.getParent()));
|
||||
mExplorer.notifyItemRemoved(new ExplorerFileItem(scriptFile, mExplorerPage));
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -10,14 +10,13 @@ import android.widget.Toast;
|
||||
|
||||
import com.afollestad.materialdialogs.MaterialDialog;
|
||||
import com.stardust.autojs.script.JavaScriptSource;
|
||||
import com.stardust.autojs.script.ScriptSource;
|
||||
import com.stardust.pio.PFiles;
|
||||
|
||||
import org.autojs.autojs.R;
|
||||
import org.autojs.autojs.model.indices.AndroidClass;
|
||||
import org.autojs.autojs.model.indices.ClassSearchingItem;
|
||||
import org.autojs.autojs.ui.build.BuildActivity;
|
||||
import org.autojs.autojs.ui.build.BuildActivity_;
|
||||
import org.autojs.autojs.ui.project.BuildActivity;
|
||||
import org.autojs.autojs.ui.project.BuildActivity_;
|
||||
import org.autojs.autojs.ui.common.NotAskAgainDialog;
|
||||
import org.autojs.autojs.ui.edit.editor.CodeEditor;
|
||||
import org.autojs.autojs.ui.log.LogActivity_;
|
||||
|
||||
@@ -9,6 +9,7 @@ import org.autojs.autojs.R;
|
||||
import org.autojs.autojs.model.explorer.ExplorerFileItem;
|
||||
import org.autojs.autojs.model.explorer.ExplorerItem;
|
||||
import org.autojs.autojs.model.explorer.ExplorerPage;
|
||||
import org.autojs.autojs.model.explorer.ExplorerProjectPage;
|
||||
import org.autojs.autojs.model.explorer.ExplorerSamplePage;
|
||||
|
||||
import static android.support.v4.content.ContextCompat.getColor;
|
||||
@@ -62,6 +63,9 @@ public class ExplorerViewHelper {
|
||||
if (page instanceof ExplorerSamplePage) {
|
||||
return R.drawable.ic_sample_dir;
|
||||
}
|
||||
if(page instanceof ExplorerProjectPage){
|
||||
return R.drawable.ic_project;
|
||||
}
|
||||
return R.drawable.ic_folder_yellow_100px;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -152,7 +152,7 @@ public class FileChooseListView extends ExplorerView {
|
||||
CheckBoxCompat mCheckBox;
|
||||
|
||||
@BindView(R.id.icon)
|
||||
ImageView mIcon;
|
||||
ImageView mIcon;
|
||||
|
||||
private ExplorerPage mExplorerPage;
|
||||
|
||||
|
||||
@@ -34,8 +34,9 @@ public class FloatingActionMenu extends FrameLayout implements View.OnClickListe
|
||||
private static final int[] ICONS = {
|
||||
R.drawable.ic_floating_action_menu_dir,
|
||||
R.drawable.ic_floating_action_menu_file,
|
||||
R.drawable.ic_floating_action_menu_open};
|
||||
private static final int[] LABELS = {R.string.text_directory, R.string.text_file, R.string.text_import};
|
||||
R.drawable.ic_floating_action_menu_open,
|
||||
R.drawable.ic_project};
|
||||
private static final int[] LABELS = {R.string.text_directory, R.string.text_file, R.string.text_import, R.string.text_project};
|
||||
private TextView[] mLabels;
|
||||
private FloatingActionButton[] mFabs;
|
||||
private View[] mFabContainers;
|
||||
|
||||
@@ -166,7 +166,7 @@ public class MainActivity extends BaseActivity implements OnActivityResultDelega
|
||||
.add(new MyScriptListFragment_(), R.string.text_file)
|
||||
.add(new DocsFragment_(), R.string.text_tutorial)
|
||||
.add(new CommunityFragment_(), R.string.text_community)
|
||||
.add(new MarketFragment_(), R.string.text_sample)
|
||||
.add(new MarketFragment_(), R.string.text_market)
|
||||
.add(new TaskManagerFragment_(), R.string.text_manage)
|
||||
.build();
|
||||
mViewPager.setAdapter(mPagerAdapter);
|
||||
|
||||
@@ -9,6 +9,7 @@ import android.support.v7.widget.GridLayoutManager;
|
||||
import android.support.v7.widget.RecyclerView;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
@@ -23,10 +24,11 @@ import org.autojs.autojs.model.explorer.Explorer;
|
||||
import org.autojs.autojs.model.explorer.ExplorerChangeEvent;
|
||||
import org.autojs.autojs.model.explorer.ExplorerItem;
|
||||
import org.autojs.autojs.model.explorer.ExplorerPage;
|
||||
import org.autojs.autojs.model.explorer.ExplorerSamplePage;
|
||||
import org.autojs.autojs.model.script.ScriptFile;
|
||||
import org.autojs.autojs.model.script.Scripts;
|
||||
import org.autojs.autojs.ui.build.BuildActivity;
|
||||
import org.autojs.autojs.ui.build.BuildActivity_;
|
||||
import org.autojs.autojs.ui.project.BuildActivity;
|
||||
import org.autojs.autojs.ui.project.BuildActivity_;
|
||||
import org.autojs.autojs.ui.common.ScriptLoopDialog;
|
||||
import org.autojs.autojs.ui.common.ScriptOperations;
|
||||
import org.autojs.autojs.ui.explorer.ExplorerViewHelper;
|
||||
@@ -219,7 +221,9 @@ public class ExplorerView extends ThemeColorSwipeRefreshLayout implements SwipeR
|
||||
@Subscribe
|
||||
public void onExplorerChange(ExplorerChangeEvent event) {
|
||||
if (event.getAction() == ExplorerChangeEvent.ALL
|
||||
|| mCurrentPageState.page.equals(event.getItemGroup())) {
|
||||
|| (event.getAction() == ExplorerChangeEvent.CHANGE &&
|
||||
mCurrentPageState.page.getPath().equals(event.getPage().getPath()))
|
||||
|| (event.getAction() == Explorer)) {
|
||||
loadItemList();
|
||||
}
|
||||
}
|
||||
@@ -457,6 +461,17 @@ public class ExplorerView extends ThemeColorSwipeRefreshLayout implements SwipeR
|
||||
mSelectedItem = mExplorerItem;
|
||||
PopupMenu popupMenu = new PopupMenu(getContext(), mOptions);
|
||||
popupMenu.inflate(R.menu.menu_script_options);
|
||||
Menu menu = popupMenu.getMenu();
|
||||
if(!mExplorerItem.isExecutable()){
|
||||
menu.removeItem(R.id.run_repeatedly);
|
||||
menu.removeItem(R.id.more);
|
||||
}
|
||||
if(!mExplorerItem.canDelete()){
|
||||
menu.removeItem(R.id.delete);
|
||||
}
|
||||
if(!mExplorerItem.canRename()){
|
||||
menu.removeItem(R.id.rename);
|
||||
}
|
||||
popupMenu.setOnMenuItemClickListener(ExplorerView.this);
|
||||
popupMenu.show();
|
||||
}
|
||||
@@ -484,7 +499,9 @@ public class ExplorerView extends ThemeColorSwipeRefreshLayout implements SwipeR
|
||||
public void bind(ExplorerPage data, int position) {
|
||||
mName.setText(ExplorerViewHelper.getDisplayName(data));
|
||||
mIcon.setImageResource(ExplorerViewHelper.getIcon(data));
|
||||
mOptions.setVisibility(data instanceof ExplorerSamplePage ? GONE : VISIBLE);
|
||||
mExplorerPage = data;
|
||||
|
||||
}
|
||||
|
||||
@OnClick(R.id.item)
|
||||
|
||||
@@ -21,6 +21,8 @@ import org.autojs.autojs.ui.common.ScriptOperations;
|
||||
import org.autojs.autojs.ui.main.FloatingActionMenu;
|
||||
import org.autojs.autojs.ui.main.QueryEvent;
|
||||
import org.autojs.autojs.ui.main.ViewPagerFragment;
|
||||
import org.autojs.autojs.ui.project.ProjectConfigActivity;
|
||||
import org.autojs.autojs.ui.project.ProjectConfigActivity_;
|
||||
import org.autojs.autojs.ui.viewmodel.ExplorerItemList;
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
import org.greenrobot.eventbus.Subscribe;
|
||||
@@ -177,6 +179,11 @@ public class MyScriptListFragment extends ViewPagerFragment implements BackPress
|
||||
case 2:
|
||||
new ScriptOperations(getContext(), mExplorerView, mExplorerView.getCurrentPage())
|
||||
.importFile();
|
||||
case 3:
|
||||
ProjectConfigActivity_.intent(getContext())
|
||||
.extra(ProjectConfigActivity.EXTRA_PARENT_DIRECTORY, mExplorerView.getCurrentPage().getPath())
|
||||
.extra(ProjectConfigActivity.EXTRA_NEW_PROJECT, true)
|
||||
.start();
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package org.autojs.autojs.ui.build;
|
||||
package org.autojs.autojs.ui.project;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.Intent;
|
||||
@@ -0,0 +1,125 @@
|
||||
package org.autojs.autojs.ui.project;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.os.Bundle;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.design.widget.TextInputEditText;
|
||||
import android.text.Editable;
|
||||
import android.widget.EditText;
|
||||
import android.widget.ImageView;
|
||||
|
||||
import com.stardust.autojs.project.LaunchConfig;
|
||||
import com.stardust.autojs.project.ProjectConfig;
|
||||
|
||||
import org.androidannotations.annotations.AfterViews;
|
||||
import org.androidannotations.annotations.Click;
|
||||
import org.androidannotations.annotations.EActivity;
|
||||
import org.androidannotations.annotations.ViewById;
|
||||
import org.autojs.autojs.R;
|
||||
import org.autojs.autojs.model.explorer.ExplorerDirPage;
|
||||
import org.autojs.autojs.model.explorer.Explorers;
|
||||
import org.autojs.autojs.model.project.ProjectTemplate;
|
||||
import org.autojs.autojs.ui.BaseActivity;
|
||||
import org.autojs.autojs.ui.widget.SimpleTextWatcher;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.concurrent.Executors;
|
||||
|
||||
@EActivity(R.layout.activity_project_config)
|
||||
public class ProjectConfigActivity extends BaseActivity {
|
||||
|
||||
public static final String EXTRA_PARENT_DIRECTORY = "parent_directory";
|
||||
|
||||
public static final String EXTRA_NEW_PROJECT = "new_project";
|
||||
|
||||
public static final String EXTRA_DIRECTORY = "directory";
|
||||
|
||||
|
||||
@ViewById(R.id.project_location)
|
||||
EditText mProjectLocation;
|
||||
|
||||
@ViewById(R.id.app_name)
|
||||
TextInputEditText mAppName;
|
||||
|
||||
@ViewById(R.id.package_name)
|
||||
TextInputEditText mPackageName;
|
||||
|
||||
@ViewById(R.id.version_name)
|
||||
TextInputEditText mVersionName;
|
||||
|
||||
@ViewById(R.id.version_code)
|
||||
TextInputEditText mVersionCode;
|
||||
|
||||
@ViewById(R.id.main_file_name)
|
||||
EditText mMainFileName;
|
||||
|
||||
@ViewById(R.id.icon)
|
||||
ImageView mIcon;
|
||||
|
||||
private File mDirectory;
|
||||
private File mParentDirectory;
|
||||
private ProjectConfig mProjectConfig;
|
||||
private boolean mNewProject;
|
||||
|
||||
@Override
|
||||
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
mNewProject = getIntent().getBooleanExtra(EXTRA_NEW_PROJECT, false);
|
||||
String parentDirectory = getIntent().getStringExtra(EXTRA_PARENT_DIRECTORY);
|
||||
if (mNewProject) {
|
||||
if (parentDirectory == null) {
|
||||
finish();
|
||||
return;
|
||||
}
|
||||
mParentDirectory = new File(parentDirectory);
|
||||
mProjectConfig = new ProjectConfig();
|
||||
} else {
|
||||
String dir = getIntent().getStringExtra(EXTRA_DIRECTORY);
|
||||
if(dir == null){
|
||||
finish();
|
||||
return;
|
||||
}
|
||||
mDirectory = new File(dir);
|
||||
mProjectConfig = ProjectConfig.fromProjectDir(dir);
|
||||
}
|
||||
}
|
||||
|
||||
@AfterViews
|
||||
void setupViews() {
|
||||
setToolbarAsBack(mNewProject ? getString(R.string.text_new_project) : mProjectConfig.getName());
|
||||
mAppName.addTextChangedListener(new SimpleTextWatcher(s ->
|
||||
mProjectLocation.setText(new File(mParentDirectory, s.toString()).getPath()))
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
@SuppressLint("CheckResult")
|
||||
@Click(R.id.fab)
|
||||
void commit() {
|
||||
syncProjectConfig();
|
||||
if (!checkInputs()) {
|
||||
return;
|
||||
}
|
||||
if(mNewProject){
|
||||
String location = mProjectLocation.getText().toString();
|
||||
new ProjectTemplate(mProjectConfig, new File(location))
|
||||
.newProject()
|
||||
.subscribe(ignored -> {
|
||||
Explorers.workspace().notifyItemCreated(new ExplorerDirPage(location, null));
|
||||
finish();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private void syncProjectConfig(){
|
||||
mProjectConfig.setName(mAppName.getText().toString());
|
||||
mProjectConfig.setVersionCode(Integer.parseInt(mVersionCode.getText().toString()));
|
||||
mProjectConfig.setVersionName(mVersionName.getText().toString());
|
||||
mProjectConfig.setMainScriptFile(mMainFileName.getText().toString());
|
||||
//mProjectConfig.getLaunchConfig().setHideLogs(true);
|
||||
}
|
||||
|
||||
private boolean checkInputs() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -8,23 +8,18 @@ import android.preference.PreferenceScreen;
|
||||
import android.support.v4.util.Pair;
|
||||
import android.support.v7.widget.Toolbar;
|
||||
import android.view.View;
|
||||
import android.widget.Toast;
|
||||
|
||||
import org.autojs.autojs.network.VersionService;
|
||||
import org.autojs.autojs.ui.BaseActivity;
|
||||
import org.autojs.autojs.ui.error.IssueReporterActivity;
|
||||
import org.autojs.autojs.ui.splash.SplashActivity;
|
||||
import org.autojs.autojs.ui.splash.SplashActivity_;
|
||||
import org.autojs.autojs.ui.update.UpdateCheckDialog;
|
||||
import com.stardust.theme.preference.ThemeColorPreferenceFragment;
|
||||
import com.stardust.util.IntentUtil;
|
||||
import com.stardust.util.MapEntries;
|
||||
import org.autojs.autojs.R;
|
||||
import com.stardust.theme.app.ColorSelectActivity;
|
||||
import com.stardust.theme.preference.ThemeColorPreferenceFragment;
|
||||
import com.stardust.theme.util.ListBuilder;
|
||||
import com.stardust.util.MapEntries;
|
||||
|
||||
import org.androidannotations.annotations.AfterViews;
|
||||
import org.androidannotations.annotations.EActivity;
|
||||
import org.autojs.autojs.R;
|
||||
import org.autojs.autojs.ui.BaseActivity;
|
||||
import org.autojs.autojs.ui.error.IssueReporterActivity;
|
||||
import org.autojs.autojs.ui.update.UpdateCheckDialog;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@@ -107,12 +102,6 @@ public class SettingsActivity extends BaseActivity {
|
||||
super.onStart();
|
||||
ACTION_MAP = new MapEntries<String, Runnable>()
|
||||
.entry(getString(R.string.text_theme_color), () -> selectThemeColor(getActivity()))
|
||||
.entry(getString(R.string.show_ad), () -> {
|
||||
SplashActivity_.intent(getActivity())
|
||||
.extra(SplashActivity.NOT_START_MAIN_ACTIVITY, true)
|
||||
.extra(SplashActivity.FORCE_SHOW_AD, true)
|
||||
.start();
|
||||
})
|
||||
.entry(getString(R.string.text_check_for_updates), () -> new UpdateCheckDialog(getActivity())
|
||||
.show())
|
||||
.entry(getString(R.string.text_issue_report), () -> startActivity(new Intent(getActivity(), IssueReporterActivity.class).addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)))
|
||||
|
||||
@@ -1,9 +1,12 @@
|
||||
package org.autojs.autojs.ui.splash;
|
||||
|
||||
import android.Manifest;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.widget.ImageView;
|
||||
|
||||
import com.xcy8.ads.listener.LoadAdListener;
|
||||
@@ -24,7 +27,6 @@ import java.util.Random;
|
||||
/**
|
||||
* Created by Stardust on 2017/7/7.
|
||||
*/
|
||||
@EActivity(R.layout.activity_splash)
|
||||
public class SplashActivity extends BaseActivity {
|
||||
|
||||
public static final String NOT_START_MAIN_ACTIVITY = "notStartMainActivity";
|
||||
@@ -32,8 +34,6 @@ public class SplashActivity extends BaseActivity {
|
||||
|
||||
private static final String LOG_TAG = SplashActivity.class.getSimpleName();
|
||||
|
||||
@ViewById(R.id.logo)
|
||||
ImageView mLogo;
|
||||
|
||||
private boolean mCanEnterNextActivity = false;
|
||||
private boolean mNotStartMainActivity;
|
||||
@@ -42,7 +42,6 @@ public class SplashActivity extends BaseActivity {
|
||||
|
||||
private Handler mHandler;
|
||||
|
||||
@ViewById(R.id.full_screen_view)
|
||||
FullScreenAdView mFullScreenAdView;
|
||||
|
||||
@Override
|
||||
@@ -51,17 +50,18 @@ public class SplashActivity extends BaseActivity {
|
||||
mHandler = new Handler();
|
||||
mNotStartMainActivity = getIntent().getBooleanExtra(NOT_START_MAIN_ACTIVITY, false);
|
||||
boolean forceShowAd = getIntent().getBooleanExtra(FORCE_SHOW_AD, false);
|
||||
setContentView(R.layout.activity_splash);
|
||||
mFullScreenAdView = (FullScreenAdView) findViewById(R.id.full_screen_view);
|
||||
if (!forceShowAd && !Pref.shouldShowAd()) {
|
||||
enterNextActivity();
|
||||
return;
|
||||
mFullScreenAdView.setVisibility(View.INVISIBLE);
|
||||
mHandler.postDelayed(this::enterNextActivity, 1500);
|
||||
} else {
|
||||
if(checkPermission(Manifest.permission.READ_PHONE_STATE)){
|
||||
fetchSplashAD();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@AfterViews
|
||||
void afterViews(){
|
||||
fetchSplashAD();
|
||||
}
|
||||
|
||||
void enterNextActivity() {
|
||||
if (mAlreadyEnterNextActivity)
|
||||
return;
|
||||
@@ -91,6 +91,12 @@ public class SplashActivity extends BaseActivity {
|
||||
mCanEnterNextActivity = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
|
||||
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
|
||||
fetchSplashAD();
|
||||
}
|
||||
|
||||
private void fetchSplashAD() {
|
||||
mAdLoading = true;
|
||||
mFullScreenAdView.setFullScreenListener(this::enterNextActivity);
|
||||
|
||||
BIN
app/src/main/res/drawable/ic_project.png
Normal file
BIN
app/src/main/res/drawable/ic_project.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 6.8 KiB |
224
app/src/main/res/layout/activity_project_config.xml
Normal file
224
app/src/main/res/layout/activity_project_config.xml
Normal file
@@ -0,0 +1,224 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
|
||||
<android.support.design.widget.AppBarLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:theme="@style/AppTheme.AppBarOverlay">
|
||||
|
||||
<com.stardust.theme.widget.ThemeColorToolbar
|
||||
android:id="@+id/toolbar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"/>
|
||||
|
||||
</android.support.design.widget.AppBarLayout>
|
||||
|
||||
|
||||
<FrameLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:paddingTop="6dp">
|
||||
|
||||
<ScrollView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<android.support.v7.widget.CardView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="6dp"
|
||||
android:layout_marginRight="6dp"
|
||||
app:cardCornerRadius="2dp"
|
||||
app:cardElevation="1dp"
|
||||
app:cardUseCompatPadding="true">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:padding="24dp">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="24dp"
|
||||
android:text="@string/text_project"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Body2"
|
||||
android:textColor="?android:textColorSecondary"/>
|
||||
|
||||
<android.support.design.widget.TextInputLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<android.support.design.widget.TextInputEditText
|
||||
android:id="@+id/app_name"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:hint="@string/text_app_name"/>
|
||||
</android.support.design.widget.TextInputLayout>
|
||||
|
||||
<android.support.design.widget.TextInputLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="12dp">
|
||||
|
||||
<android.support.design.widget.TextInputEditText
|
||||
android:id="@+id/package_name"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:digits="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890_."
|
||||
android:hint="@string/text_package_name"/>
|
||||
</android.support.design.widget.TextInputLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:orientation="vertical">
|
||||
|
||||
<android.support.design.widget.TextInputLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="12dp">
|
||||
|
||||
<android.support.design.widget.TextInputEditText
|
||||
android:id="@+id/version_name"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:hint="@string/text_version_name"
|
||||
android:text="1.0.0"/>
|
||||
</android.support.design.widget.TextInputLayout>
|
||||
|
||||
<android.support.design.widget.TextInputLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="12dp">
|
||||
|
||||
<android.support.design.widget.TextInputEditText
|
||||
android:id="@+id/version_code"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:hint="@string/text_version_code"
|
||||
android:inputType="number"
|
||||
android:text="1"/>
|
||||
</android.support.design.widget.TextInputLayout>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="12dp"
|
||||
android:layout_marginTop="12dp"
|
||||
android:text="@string/text_icon"
|
||||
android:textColor="#9e9e9e"
|
||||
android:textSize="12sp"/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/icon"
|
||||
android:layout_width="64dp"
|
||||
android:layout_height="64dp"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginLeft="16dp"
|
||||
android:layout_marginRight="16dp"
|
||||
android:background="@drawable/shortcut_create_dialog_icon_bg"
|
||||
android:padding="12dp"
|
||||
android:src="@drawable/ic_add_white_48dp"/>
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<android.support.design.widget.TextInputLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<android.support.design.widget.TextInputEditText
|
||||
android:id="@+id/project_location"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:hint="@string/text_project_location"
|
||||
android:inputType="number"/>
|
||||
</android.support.design.widget.TextInputLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</android.support.v7.widget.CardView>
|
||||
|
||||
<android.support.v7.widget.CardView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="6dp"
|
||||
android:layout_marginRight="6dp"
|
||||
app:cardBackgroundColor="@android:color/white"
|
||||
app:cardCornerRadius="2dp"
|
||||
app:cardElevation="1dp"
|
||||
app:cardUseCompatPadding="true">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:padding="24dp">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="24dp"
|
||||
android:text="@string/text_launch_config"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Body2"
|
||||
android:textColor="?android:textColorSecondary"/>
|
||||
|
||||
<android.support.design.widget.TextInputLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<android.support.design.widget.TextInputEditText
|
||||
android:id="@+id/main_file_name"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/default_main_file_name"
|
||||
android:hint="@string/text_main_file_name"/>
|
||||
|
||||
</android.support.design.widget.TextInputLayout>
|
||||
|
||||
<org.autojs.autojs.ui.widget.CheckBoxCompat
|
||||
android:layout_width="wrap_content"
|
||||
android:id="@+id/default_stable_mode"
|
||||
android:text="@string/text_stable_mode"
|
||||
android:layout_height="wrap_content"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</android.support.v7.widget.CardView>
|
||||
</LinearLayout>
|
||||
</ScrollView>
|
||||
|
||||
<com.stardust.theme.widget.ThemeColorFloatingActionButton
|
||||
android:id="@+id/fab"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="end|right|bottom"
|
||||
android:layout_margin="16dp"
|
||||
android:src="@drawable/ic_done_white_48dp"/>
|
||||
</FrameLayout>
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
@@ -29,6 +29,7 @@
|
||||
android:gravity="center"/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/icon"
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="24dp"
|
||||
android:layout_gravity="center_vertical"
|
||||
|
||||
@@ -18,7 +18,9 @@
|
||||
android:title="@string/text_send"/>
|
||||
|
||||
|
||||
<item android:title="@string/text_more">
|
||||
<item
|
||||
android:id="@+id/more"
|
||||
android:title="@string/text_more">
|
||||
|
||||
<menu>
|
||||
|
||||
|
||||
@@ -389,4 +389,11 @@
|
||||
<string name="text_en_import">import</string>
|
||||
<string name="key_ad_type">key_ad_type</string>
|
||||
<string name="text_ad_type_settings">广告类型设置</string>
|
||||
<string name="text_market">市场</string>
|
||||
<string name="text_launch_config">运行配置</string>
|
||||
<string name="text_main_file_name">主脚本名称</string>
|
||||
<string name="default_main_file_name">main.js</string>
|
||||
<string name="text_project">项目</string>
|
||||
<string name="text_project_location">项目位置</string>
|
||||
<string name="text_new_project">新建项目</string>
|
||||
</resources>
|
||||
|
||||
@@ -4,6 +4,7 @@ import android.content.Context;
|
||||
import android.support.annotation.NonNull;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.GsonBuilder;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import com.stardust.pio.PFiles;
|
||||
import com.stardust.pio.UncheckedIOException;
|
||||
@@ -22,7 +23,7 @@ public class ProjectConfig {
|
||||
|
||||
public static final String CONFIG_FILE_NAME = "project.json";
|
||||
|
||||
private static final Gson GSON = new Gson();
|
||||
private static final Gson GSON = new GsonBuilder().setPrettyPrinting().create();
|
||||
|
||||
@SerializedName("name")
|
||||
private String mName;
|
||||
|
||||
Reference in New Issue
Block a user