diff --git a/protocoder_apprunner/src/main/java/org/protocoderrunner/AppSettings.java b/protocoder_apprunner/src/main/java/org/protocoderrunner/AppSettings.java index af39be6d..ffd9905e 100644 --- a/protocoder_apprunner/src/main/java/org/protocoderrunner/AppSettings.java +++ b/protocoder_apprunner/src/main/java/org/protocoderrunner/AppSettings.java @@ -24,17 +24,17 @@ public class AppSettings { - // == APP SETTINGS ========== - public final static boolean DEBUG = true; - public final static boolean FULLSCREEN = false; - public final static boolean PORTRAIT = false; - public final static boolean STAY_AWAKE = false; - public final static boolean OVERRIDE_HOME_BUTTONS = false; - public final static boolean OVERRIDE_VOLUME_BUTTONS = false; - public final static boolean HIDE_HOME_BAR = false; - public final static boolean SCREEN_ALWAYS_ON = false; - public final static boolean CLOSE_WITH_BACK = true; - public static boolean STANDALONE = false; + // == APP SETTINGS ========== + public final static boolean DEBUG = true; + public final static boolean FULLSCREEN = false; + public final static boolean PORTRAIT = false; + public final static boolean STAY_AWAKE = false; + public final static boolean OVERRIDE_HOME_BUTTONS = false; + public final static boolean OVERRIDE_VOLUME_BUTTONS = false; + public final static boolean HIDE_HOME_BAR = false; + public final static boolean SCREEN_ALWAYS_ON = false; + public final static boolean CLOSE_WITH_BACK = true; + public final static boolean STANDALONE = false; public static int MIN_SUPPORTED_VERSION = Build.VERSION_CODES.ICE_CREAM_SANDWICH; public final static String APP_FOLDER = "protocoder"; diff --git a/protocoder_apprunner/src/main/java/org/protocoderrunner/apprunner/AppRunnerActivity.java b/protocoder_apprunner/src/main/java/org/protocoderrunner/apprunner/AppRunnerActivity.java index a0a0b268..dec1fe06 100644 --- a/protocoder_apprunner/src/main/java/org/protocoderrunner/apprunner/AppRunnerActivity.java +++ b/protocoder_apprunner/src/main/java/org/protocoderrunner/apprunner/AppRunnerActivity.java @@ -93,8 +93,6 @@ public class AppRunnerActivity extends BaseActivity { private Toolbar mToolbar; private ActionBar mActionbar; - private Project mProject = null; - @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); @@ -124,37 +122,26 @@ protected void onCreate(Bundle savedInstanceState) { finish(); } - // NOTE: - // if mProject == null , Protocoder is running in "standard" mode - // if mProject != null , Protocoder is running in "standalone" mode - - boolean settingScreenAlwaysOn = false; - boolean settingWakeUpScreen = false; - - if (mProject == null) { + // get projects intent + //settings + boolean settingScreenAlwaysOn = intent.getBooleanExtra(Project.SETTINGS_SCREEN_ALWAYS_ON, false); + boolean settingWakeUpScreen = intent.getBooleanExtra(Project.SETTINGS_SCREEN_WAKEUP, false); - mProject = new Project(); - - // get projects intent - //settings - settingScreenAlwaysOn = intent.getBooleanExtra(Project.SETTINGS_SCREEN_ALWAYS_ON, false); - settingWakeUpScreen = intent.getBooleanExtra(Project.SETTINGS_SCREEN_WAKEUP, false); - - //project info - mProject.name = intent.getStringExtra(Project.NAME); - mProject.folder = intent.getStringExtra(Project.FOLDER); - mProject.prefix = intent.getStringExtra(Project.PREFIX); - mProject.code = intent.getStringExtra(Project.CODE); - mProject.postfix = intent.getStringExtra(Project.POSTFIX); - } + //project info + String projectName = intent.getStringExtra(Project.NAME); + String projectFolder = intent.getStringExtra(Project.FOLDER); + String prefixScript = intent.getStringExtra(Project.PREFIX); + String code = intent.getStringExtra(Project.CODE); + String postfixScript = intent.getStringExtra(Project.POSTFIX); Bundle bundle = new Bundle(); - bundle.putString(Project.NAME, mProject.name); - bundle.putString(Project.FOLDER, mProject.folder); + bundle.putString(Project.NAME, projectName); + bundle.putString(Project.FOLDER, projectFolder); //bundle.putInt(Project.COLOR, intent.getIntExtra("color", 0)); - bundle.putString(Project.PREFIX, mProject.prefix); - bundle.putString(Project.CODE, mProject.code); - bundle.putString(Project.POSTFIX, mProject.postfix); + bundle.putString(Project.PREFIX, prefixScript); + bundle.putString(Project.CODE, code); + bundle.putString(Project.POSTFIX, postfixScript); + //MLog.d(TAG, "load " + projectName + " in " + projectFolder); @@ -633,8 +620,4 @@ public boolean checkVolumeKeys(int keyCode) { } - public void setProject(Project project) { - this.mProject = project; - } - } diff --git a/protocoder_apprunner/src/main/java/org/protocoderrunner/apprunner/AppRunnerFragment.java b/protocoder_apprunner/src/main/java/org/protocoderrunner/apprunner/AppRunnerFragment.java index 3749822b..7b2b5c40 100644 --- a/protocoder_apprunner/src/main/java/org/protocoderrunner/apprunner/AppRunnerFragment.java +++ b/protocoder_apprunner/src/main/java/org/protocoderrunner/apprunner/AppRunnerFragment.java @@ -42,7 +42,6 @@ import org.json.JSONException; import org.json.JSONObject; -import org.protocoderrunner.AppSettings; import org.protocoderrunner.R; import org.protocoderrunner.apprunner.api.PApp; import org.protocoderrunner.apprunner.api.PBoards; @@ -140,14 +139,7 @@ public void onAttach(Activity activity) { ProjectManager.getInstance().setCurrentProject(mCurrentProject); AppRunnerSettings.get().project = mCurrentProject; AppRunnerSettings.get().hasUi = true; - - if (AppSettings.STANDALONE == true) { - // Get code from assets - mScript = ProjectManager.getInstance().getCodeFromAssets(mActivity, mCurrentProject); - } else { - // Get code from sdcard - mScript = ProjectManager.getInstance().getCode(mCurrentProject); - } + mScript = ProjectManager.getInstance().getCode(mCurrentProject); //setup actionbar // int actionBarColor; diff --git a/protocoder_apprunner/src/main/java/org/protocoderrunner/apprunner/api/PUI.java b/protocoder_apprunner/src/main/java/org/protocoderrunner/apprunner/api/PUI.java index 064e3466..f9361f67 100644 --- a/protocoder_apprunner/src/main/java/org/protocoderrunner/apprunner/api/PUI.java +++ b/protocoder_apprunner/src/main/java/org/protocoderrunner/apprunner/api/PUI.java @@ -699,50 +699,24 @@ public void backgroundColor(String c) { @ProtoMethod(description = "Sets an image as background", example = "") - @ProtoMethodParam(params = { "imageName" }) - public void backgroundImage(String imagePath) { - initializeLayout(); - - if (AppSettings.STANDALONE == true) { - // Add the bg image asynchronously from the assets - new SetBgImageTask(bgImageView, false, true).execute( - AppRunnerSettings.get().project.getFolder() - + File.separator - + AppRunnerSettings.get().project.getName() - + File.separator - + imagePath); + @ProtoMethodParam(params = {"imageName"}) + public void backgroundImage(String imagePath) { + initializeLayout(); + // Add the bg image asynchronously + new SetBgImageTask(bgImageView, false).execute(AppRunnerSettings.get().project.getStoragePath() + File.separator + + imagePath); - } else { - // Add the bg image asynchronously from the sdcard - new SetBgImageTask(bgImageView, false, false).execute( - AppRunnerSettings.get().project.getStoragePath() - + File.separator - + imagePath); - } - } + } - @ProtoMethod(description = "Sets an image as tiled background", example = "") - @ProtoMethodParam(params = { "imageName" }) - public void backgroundImageTile(String imagePath) { - initializeLayout(); - - if (AppSettings.STANDALONE == true) { - // Add the bg image asynchronously from the assets - new SetBgImageTask(bgImageView, true, true).execute( - AppRunnerSettings.get().project.getFolder() - + File.separator - + AppRunnerSettings.get().project.getName() - + File.separator - + imagePath); - } else { - // Add the bg image asynchronously from the sdcard - new SetBgImageTask(bgImageView, true, false).execute( - AppRunnerSettings.get().project.getStoragePath() - + File.separator - + imagePath); - } - } + @ProtoMethod(description = "Sets an image as tiled background", example = "") + @ProtoMethodParam(params = {"imageName"}) + public void backgroundImageTile(String imagePath) { + initializeLayout(); + // Add the bg image asynchronously + new SetBgImageTask(bgImageView, true).execute(AppRunnerSettings.get().project.getStoragePath() + File.separator + + imagePath); + } @ProtoMethod(description = "Creates an absolute layout ", example = "") diff --git a/protocoder_apprunner/src/main/java/org/protocoderrunner/apprunner/api/widgets/PImageView.java b/protocoder_apprunner/src/main/java/org/protocoderrunner/apprunner/api/widgets/PImageView.java index c19d4f9f..686f07b3 100644 --- a/protocoder_apprunner/src/main/java/org/protocoderrunner/apprunner/api/widgets/PImageView.java +++ b/protocoder_apprunner/src/main/java/org/protocoderrunner/apprunner/api/widgets/PImageView.java @@ -26,7 +26,6 @@ import android.graphics.drawable.BitmapDrawable; import android.widget.ImageView; -import org.protocoderrunner.AppSettings; import org.protocoderrunner.apidoc.annotation.ProtoMethod; import org.protocoderrunner.apidoc.annotation.ProtoMethodParam; import org.protocoderrunner.apprunner.AppRunnerSettings; @@ -35,11 +34,8 @@ public class PImageView extends ImageView implements PViewInterface { - private Context mContext; - public PImageView(Context context) { super(context); - this.mContext = context; } @@ -51,23 +47,10 @@ public PImageView setImage(String imagePath) { // Add image asynchronously new PUIGeneric.DownloadImageTask(this, false).execute(imagePath); } else { + // Add the image from file + new PUIGeneric.SetImageTask(this, false).execute(AppRunnerSettings.get().project.getStoragePath() + File.separator + + imagePath); - if (AppSettings.STANDALONE == true) { - // Add the image asynchronously from the assets - new PUIGeneric.SetImageTask(mContext, this, false, true).execute( - AppRunnerSettings.get().project.getFolder() - + File.separator - + AppRunnerSettings.get().project.getName() - + File.separator - + imagePath); - - } else { - // Add the image from the sdcard - new PUIGeneric.SetImageTask(mContext, this, false, false).execute( - AppRunnerSettings.get().project.getStoragePath() - + File.separator - + imagePath); - } } return this; @@ -86,23 +69,10 @@ public PImageView setTiledImage(String imagePath) { // Add image asynchronously new PUIGeneric.DownloadImageTask(this, true).execute(imagePath); } else { + // Add the image from file + new PUIGeneric.SetImageTask(this, true).execute(AppRunnerSettings.get().project.getStoragePath() + File.separator + + imagePath); - if (AppSettings.STANDALONE == true) { - // Add the image asynchronously from the assets - new PUIGeneric.SetImageTask(mContext, this, true, true).execute( - AppRunnerSettings.get().project.getFolder() - + File.separator - + AppRunnerSettings.get().project.getName() - + File.separator - + imagePath); - - } else { - // Add the image from the sdcard - new PUIGeneric.SetImageTask(mContext, this, true, false).execute( - AppRunnerSettings.get().project.getStoragePath() - + File.separator - + imagePath); - } } return this; diff --git a/protocoder_apprunner/src/main/java/org/protocoderrunner/apprunner/api/widgets/PUIGeneric.java b/protocoder_apprunner/src/main/java/org/protocoderrunner/apprunner/api/widgets/PUIGeneric.java index f53a3291..9ba0bfb4 100644 --- a/protocoder_apprunner/src/main/java/org/protocoderrunner/apprunner/api/widgets/PUIGeneric.java +++ b/protocoder_apprunner/src/main/java/org/protocoderrunner/apprunner/api/widgets/PUIGeneric.java @@ -23,7 +23,6 @@ import android.animation.LayoutTransition; import android.annotation.TargetApi; import android.content.Context; -import android.content.res.AssetManager; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.graphics.drawable.Drawable; @@ -36,7 +35,6 @@ import android.widget.ArrayAdapter; import android.widget.CompoundButton; import android.widget.CompoundButton.OnCheckedChangeListener; -import android.widget.ImageView; import android.widget.ImageView.ScaleType; import android.widget.LinearLayout; import android.widget.NumberPicker; @@ -53,7 +51,6 @@ import org.osmdroid.events.MapListener; import org.osmdroid.events.ScrollEvent; import org.osmdroid.events.ZoomEvent; -import org.protocoderrunner.AppSettings; import org.protocoderrunner.R; import org.protocoderrunner.apidoc.annotation.ProtoField; import org.protocoderrunner.apidoc.annotation.ProtoMethod; @@ -65,6 +62,7 @@ import org.protocoderrunner.apprunner.api.other.ProtocoderNativeObject; import org.protocoderrunner.apprunner.api.widgets.PPadView.TouchEvent; import org.protocoderrunner.fragments.CameraNew; +import org.protocoderrunner.fragments.CustomVideoTextureView; import org.protocoderrunner.utils.AndroidUtils; import org.protocoderrunner.utils.FileIO; import org.protocoderrunner.utils.Image; @@ -112,14 +110,12 @@ public class PUIGeneric extends PInterface { protected boolean absoluteLayout = true; protected boolean isScrollLayout = true; - private Context mContext; @ProtoField(description = "Toolbar", example = "") public PToolbar toolbar; public PUIGeneric(Context a) { super(a); - this.mContext = a; } @Override @@ -663,22 +659,8 @@ public PImageButton newImageButton(int x, int y, int w, int h, String imgNotPres ib.setBackgroundResource(0); } - if (AppSettings.STANDALONE == true) { - // Add the image asynchronously from the assets - new SetImageTask(mContext, ib, true, true).execute( - AppRunnerSettings.get().project.getFolder() - + File.separator - + AppRunnerSettings.get().project.getName() - + File.separator - + imgNotPressed); - - } else { - // Add image asynchronously from the sdcard - new SetImageTask(mContext, ib, false, false).execute( - AppRunnerSettings.get().project.getStoragePath() - + File.separator - + imgNotPressed); - } + // Add image asynchronously + new SetImageTask(ib, false).execute(AppRunnerSettings.get().project.getStoragePath() + File.separator + imgNotPressed); // Add the view addViewAbsolute(ib, x, y, w, h); @@ -916,58 +898,27 @@ protected void onPostExecute(Bitmap result) { /** * This class lets us set images from file asynchronously * - * @author ncbq76 / Modifications by @josejuansanchez + * @author ncbq76 */ public static class SetImageTask extends AsyncTask { PImageView bgImage; String imagePath; private String fileExtension; boolean isTiled = false; - private Context mContext; - boolean loadFromAssets; - public SetImageTask(Context context, PImageView bmImage, boolean isTiled, boolean loadFromAssets) { - this.mContext = context; + public SetImageTask(PImageView bmImage, boolean isTiled) { this.bgImage = bmImage; this.isTiled = isTiled; - this.loadFromAssets = loadFromAssets; } @Override protected Object doInBackground(String... paths) { imagePath = paths[0]; - - if (loadFromAssets == true) { - return loadImageFromAssets(imagePath); - } else { - return loadImage(imagePath); - } - } - - private Object loadImageFromAssets(String imagePath) { - try { - final InputStream in = mContext.getAssets().open(imagePath); - fileExtension = FileIO.getFileExtension(imagePath); - - if (fileExtension.equals("svg")) { - AssetManager assetManager = mContext.getAssets(); - SVG svg = new SVGBuilder().readFromAsset(assetManager, imagePath).build(); - return svg.getDrawable(); - } else { - return BitmapFactory.decodeStream(in); - } - - } catch (final Throwable tx) { - tx.printStackTrace(); - return null; - } - } - - private Object loadImage(String imagePath) { File imgFile = new File(imagePath); - + //MLog.d("svg", "imagePath " + imagePath); if (imgFile.exists()) { fileExtension = FileIO.getFileExtension(imagePath); + //MLog.d("svg", "fileExtension " + fileExtension); if (fileExtension.equals("svg")) { File file = new File(imagePath); @@ -975,14 +926,36 @@ private Object loadImage(String imagePath) { try { fileInputStream = new FileInputStream(file); SVG svg = new SVGBuilder().readFromInputStream(fileInputStream).build(); + SVGParser svgParser = new SVGParser(); + //new SVGBuilder(). + // SVGParser. + + + //svg. return svg.getDrawable(); } catch (FileNotFoundException e) { e.printStackTrace(); } + +// try { +// //MLog.d("svg", "is SVG 1"); +// File file = new File(imagePath); +// FileInputStream fileInputStream = new FileInputStream(file); +// +// SVG svg = SVG.getFromInputStream(fileInputStream); +// Drawable drawable = new PictureDrawable(svg.renderToPicture()); +// +// return drawable; +// } catch (SVGParseException e) { +// e.printStackTrace(); +// } catch (FileNotFoundException e) { +// e.printStackTrace(); +// } } else { - return Image.loadBitmap(imagePath); + Bitmap bmp = Image.loadBitmap(imagePath); + return bmp; } } return null; @@ -990,7 +963,7 @@ private Object loadImage(String imagePath) { @Override protected void onPostExecute(Object result) { - bgImage.setScaleType(ImageView.ScaleType.FIT_XY); + bgImage.setScaleType(ScaleType.FIT_XY); if (fileExtension.equals("svg")) { MLog.d("svg", "is SVG 2 " + result); @@ -1006,52 +979,34 @@ protected void onPostExecute(Object result) { } } - /** - * This class lets us set the background asynchronously - * - * @author ncbq76 / Modifications by @josejuansanchez + + /** + * This class lets us set the background asynchronously * - */ - // We need to set the bitmap image asynchronously + * @author ncbq76 + */ + // We need to set the bitmap image asynchronously protected class SetBgImageTask extends AsyncTask { PImageView fl; boolean isTiled; - boolean loadFromAssets; - public SetBgImageTask(PImageView bgImageView, boolean isTiled, boolean loadFromAssets) { + public SetBgImageTask(PImageView bgImageView, boolean isTiled) { this.fl = bgImageView; this.isTiled = isTiled; - this.loadFromAssets = loadFromAssets; } @Override protected Bitmap doInBackground(String... paths) { String imagePath = paths[0]; - - if (loadFromAssets == true) { - return loadImageFromAssets(imagePath); - } else { - return loadImage(imagePath); - } - } - - private Bitmap loadImageFromAssets(String imagePath) { - try { - final InputStream in = getContext().getAssets().open(imagePath); - Bitmap bmp = BitmapFactory.decodeStream(in); - return bmp; - } catch(final Throwable tx) { - return null; - } - } - - private Bitmap loadImage(String imagePath) { - try { - Bitmap bmp = BitmapFactory.decodeFile(imagePath); + File imgFile = new File(imagePath); + if (imgFile.exists()) { + // Get the bitmap with appropriate options + final BitmapFactory.Options options = new BitmapFactory.Options(); + options.inPurgeable = true; + Bitmap bmp = BitmapFactory.decodeFile(imagePath, options); return bmp; - } catch(final Throwable tx) { - return null; } + return null; } @Override diff --git a/protocoder_apprunner/src/main/java/org/protocoderrunner/project/Project.java b/protocoder_apprunner/src/main/java/org/protocoderrunner/project/Project.java index 86f1ce9c..13418e89 100644 --- a/protocoder_apprunner/src/main/java/org/protocoderrunner/project/Project.java +++ b/protocoder_apprunner/src/main/java/org/protocoderrunner/project/Project.java @@ -20,10 +20,6 @@ package org.protocoderrunner.project; -import android.content.Context; -import android.content.res.AssetManager; -import android.net.Uri; - public class Project { //public final static String TYPE = "projectType"; @@ -41,11 +37,8 @@ public class Project { public String name; public String folder; - public String code; - public String prefix; - public String postfix; - public boolean containsReadme = false; - public boolean containsTutorial = false; + public boolean containsReadme = false; + public boolean containsTutorial = false; public boolean selected = false; public Project(String folder, String projectName, boolean containsReadme, boolean containsTutorial) { @@ -60,10 +53,6 @@ public Project(String folder, String projectName) { this.name = projectName; } - public Project() { - - } - public String getName() { return this.name; } @@ -82,6 +71,7 @@ public String getFolder() { return this.folder; } + //public String getTypeName() { // return folder; //} diff --git a/protocoder_apprunner/src/main/java/org/protocoderrunner/project/ProjectManager.java b/protocoder_apprunner/src/main/java/org/protocoderrunner/project/ProjectManager.java index 5e458724..1087f31c 100644 --- a/protocoder_apprunner/src/main/java/org/protocoderrunner/project/ProjectManager.java +++ b/protocoder_apprunner/src/main/java/org/protocoderrunner/project/ProjectManager.java @@ -46,7 +46,6 @@ public class ProjectManager { public static String MAIN_FILE_NAME = "main.js"; public static final String FOLDER_EXAMPLES = "examples"; public static final String FOLDER_USER_PROJECTS = "projects"; - public static final String FOLDER_MYSCRIPT = "myscript"; private static String PROTOCODER_EXTENSION = ".proto"; private Project currentProject; @@ -146,13 +145,6 @@ public void run() { }).start(); } - // Get code from assets - public String getCodeFromAssets(Context c, Project p) { - return FileIO.readAssetFile(c, p.folder + File.separator + - p.name + File.separator + MAIN_FILE_NAME); - } - - // Get code from sdcard public String getCode(Project p) { String out = null; File f = new File(p.getStoragePath() + File.separator + MAIN_FILE_NAME); diff --git a/protocoder_myscript/build.gradle b/protocoder_myscript/build.gradle index cab95da0..a3b34885 100644 --- a/protocoder_myscript/build.gradle +++ b/protocoder_myscript/build.gradle @@ -10,26 +10,11 @@ android { targetSdkVersion 21 versionCode 1 versionName "0.1" - - compileOptions { - sourceCompatibility JavaVersion.VERSION_1_7 - targetCompatibility JavaVersion.VERSION_1_7 - } - } - - signingConfigs { - releaseConfig { - - } - } - buildTypes { release { - minifyEnabled false - debuggable false - proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt' - signingConfig signingConfigs.releaseConfig; + runProguard false + proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } debug { @@ -38,18 +23,6 @@ android { } } - productFlavors { - normal { - applicationId "com.myscript" - resValue "string", "releaseMode", "normal" - } - - extended { - applicationId "com.myscript" - resValue "string", "releaseMode", "normal" - } - } - packagingOptions { exclude 'META-INF/DEPENDENCIES.txt' exclude 'META-INF/LICENSE.txt' @@ -62,10 +35,6 @@ android { exclude 'META-INF/dependencies.txt' exclude 'META-INF/LGPL2.1' } - - dexOptions { - jumboMode true - } } @@ -78,11 +47,9 @@ repositories { maven { url 'https://github.com/kshoji/USB-MIDI-Driver/raw/master/MIDIDriver/snapshots' } } -dependencies { - normalCompile project(path: ':protocoder_apprunner', configuration:'normalrunnerRelease') - //extendedCompile project(path: ':protocoder_apprunner', configuration:'extendedrunnerRelease') +dependencies { + compile project(':protocoder_apprunner') compile(name: 'processing_fragmented', ext: 'aar') compile 'jp.kshoji:midi-driver:0.0.2-SNAPSHOT:@aar' - compile 'com.android.support:appcompat-v7:21.0.+' } diff --git a/protocoder_myscript/src/main/AndroidManifest.xml b/protocoder_myscript/src/main/AndroidManifest.xml index 230882f2..2ccbb828 100644 --- a/protocoder_myscript/src/main/AndroidManifest.xml +++ b/protocoder_myscript/src/main/AndroidManifest.xml @@ -3,15 +3,14 @@ package="com.myscript"> + android:logo="@drawable/protocoder_icon" > diff --git a/protocoder_myscript/src/main/assets/Inconsolata.otf b/protocoder_myscript/src/main/assets/Inconsolata.otf deleted file mode 100644 index 34888982..00000000 Binary files a/protocoder_myscript/src/main/assets/Inconsolata.otf and /dev/null differ diff --git a/protocoder_myscript/src/main/assets/myscript/myproject/awesome_tiger.svg b/protocoder_myscript/src/main/assets/myscript/myproject/awesome_tiger.svg deleted file mode 100644 index a59da8d3..00000000 --- a/protocoder_myscript/src/main/assets/myscript/myproject/awesome_tiger.svg +++ /dev/null @@ -1,829 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/protocoder_myscript/src/main/assets/myscript/myproject/cherries.svg b/protocoder_myscript/src/main/assets/myscript/myproject/cherries.svg deleted file mode 100644 index 5edf057c..00000000 --- a/protocoder_myscript/src/main/assets/myscript/myproject/cherries.svg +++ /dev/null @@ -1,42 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - Clipart by Nicu Buculei - pear - - - Nicu Buculei - - - - - - - - - - - - - - \ No newline at end of file diff --git a/protocoder_myscript/src/main/assets/myscript/myproject/main.js b/protocoder_myscript/src/main/assets/myscript/myproject/main.js deleted file mode 100644 index 7c02f4da..00000000 --- a/protocoder_myscript/src/main/assets/myscript/myproject/main.js +++ /dev/null @@ -1,55 +0,0 @@ -media.textToSpeech("hola"); - -ui.backgroundImageTile("patata2.png"); -//ui.backgroundImage("patata2.png"); - -ui.addImage("tomato.jpg", 0, 1050, 300, 300); - -// Failed to parse SVG -// java.lang.NumberFormatException: Invalid float: "400.00000pt" -//ui.addImage("cherries.svg", 0, 400, 300, 300); - -//apparently some devices cannot load svg files -var img = ui.addImage("awesome_tiger.svg", 0, 50, 500, 500); - -// Accelerometer -// ************* - -//add android plots -var plot = ui.addPlot(0, 250, ui.screenWidth, 200, -12, 12); -var plot2 = ui.addPlot(0, 480, ui.screenWidth, 200, -12, 12); - -//add webplot -var webPlot = dashboard.addPlot("accelerometer x", 400, 100, 250, 100, -12, 12); -//plot.setThickness(15); -plot.setDefinition(2); - -//start button, when press add plots and start accelerometer -ui.addButton("Start Accelerometer", 0, 0, ui.screenWidth, 150).onClick(function() { - dashboard.show(true); - - sensors.accelerometer.onChange(function(x,y,z) { - //update plots - webPlot.update(x); - plot.update("x", x); - plot2.update("y", y); - } - ); -}); - -//stop accelerometer -ui.addButton("Stop Accelerometer", 0, 150, ui.screenWidth, 150).onClick(function() { - dashboard.show(false); - sensors.accelerometer.stop(); -}); - -// Camera -// ****** - -//add camera -var camera = ui.addCameraView("back", 0, 0, 500, 500); - -//toggle flash on and off -ui.addToggle("Flash", 0, 700, 500, 100, false).onChange(function(state) { - camera.turnOnFlash(state); -}); \ No newline at end of file diff --git a/protocoder_myscript/src/main/assets/myscript/myproject/patata2.png b/protocoder_myscript/src/main/assets/myscript/myproject/patata2.png deleted file mode 100644 index 652c5e66..00000000 Binary files a/protocoder_myscript/src/main/assets/myscript/myproject/patata2.png and /dev/null differ diff --git a/protocoder_myscript/src/main/assets/myscript/myproject/tomato.jpg b/protocoder_myscript/src/main/assets/myscript/myproject/tomato.jpg deleted file mode 100644 index 2043182e..00000000 Binary files a/protocoder_myscript/src/main/assets/myscript/myproject/tomato.jpg and /dev/null differ diff --git a/protocoder_myscript/src/main/assets/projects/myproject/main.js b/protocoder_myscript/src/main/assets/projects/myproject/main.js new file mode 100644 index 00000000..e98289b7 --- /dev/null +++ b/protocoder_myscript/src/main/assets/projects/myproject/main.js @@ -0,0 +1 @@ +media.textToSpeech("hola"); \ No newline at end of file diff --git a/protocoder_myscript/src/main/assets/myscript/otherproject/main.js b/protocoder_myscript/src/main/assets/projects/otherproject/main.js similarity index 100% rename from protocoder_myscript/src/main/assets/myscript/otherproject/main.js rename to protocoder_myscript/src/main/assets/projects/otherproject/main.js diff --git a/protocoder_myscript/src/main/java/com/myscript/MainActivity.java b/protocoder_myscript/src/main/java/com/myscript/MainActivity.java index 13932d8c..39ef82b3 100644 --- a/protocoder_myscript/src/main/java/com/myscript/MainActivity.java +++ b/protocoder_myscript/src/main/java/com/myscript/MainActivity.java @@ -1,31 +1,27 @@ package com.myscript; -import android.os.Bundle; +import android.app.Activity; +import android.content.Intent; -import org.protocoderrunner.AppSettings; import org.protocoderrunner.apprunner.AppRunnerActivity; import org.protocoderrunner.project.Project; - /** * Created by victormanueldiazbarrales on 15/09/14. - * Recreated by @josejuansanchez on 26/03/15 :) */ -public class MainActivity extends AppRunnerActivity { +public class MainActivity extends Activity { - private static final String PROJECT_FOLDER = "myscript"; - private static final String PROJECT_NAME = "myproject"; + public MainActivity() { + Intent currentProjectApplicationIntent = new Intent(this, AppRunnerActivity.class); + currentProjectApplicationIntent.putExtra(Project.NAME, "myproject"); + currentProjectApplicationIntent.putExtra(Project.FOLDER, "project"); + currentProjectApplicationIntent.putExtra(Project.LOAD_FROM, "assets"); + currentProjectApplicationIntent.putExtra(Project.FORMAT, "dir"); + //currentProjectApplicationIntent.putExtra(Project.FORMAT, "protoFile"); - @Override - protected void onCreate(Bundle savedInstanceState) { - // Enable the standalone mode - AppSettings.STANDALONE = true; + startActivity(currentProjectApplicationIntent); + } - // Create a new project and inject it to the base class - Project project = new Project(PROJECT_FOLDER, PROJECT_NAME); - setProject(project); - super.onCreate(savedInstanceState); - } } diff --git a/protocoder_myscript/src/main/res/drawable-hdpi/protocoder_icon.png b/protocoder_myscript/src/main/res/drawable-hdpi/protocoder_icon.png deleted file mode 100644 index 7700de8e..00000000 Binary files a/protocoder_myscript/src/main/res/drawable-hdpi/protocoder_icon.png and /dev/null differ diff --git a/protocoder_myscript/src/main/res/drawable/protocoder_icon.png b/protocoder_myscript/src/main/res/drawable/protocoder_icon.png index e73df280..722a3b5a 100644 Binary files a/protocoder_myscript/src/main/res/drawable/protocoder_icon.png and b/protocoder_myscript/src/main/res/drawable/protocoder_icon.png differ diff --git a/protocoder_myscript/src/main/res/values/colors.xml b/protocoder_myscript/src/main/res/values/colors.xml deleted file mode 100644 index b2c45364..00000000 --- a/protocoder_myscript/src/main/res/values/colors.xml +++ /dev/null @@ -1,59 +0,0 @@ - - - - #ff0000 - #00ff00 - #0000ff - #ffffff - #000000 - #88000000 - #00000000 - #2200FF00 - #220000FF - #55FFFF00 - #5500FFFF - #22FFFFFF - #ffeeeeee - - - #00777777 - #777777 - - - #FF33b5e5 - #FFffbb33 - - - #82C81F - #606168 - #287ED1 - #CD005B - #FA871E - #E6AF21 - - #BB33B5E5 - #BBCD005B - #FFFFFFFF - - - - #00000000 - #6633B5E5 - #33B5E5 - #0099cc - #555555 - #BB555555 - #cccccc - #aa000000 - #66FF4444 - #dddddd - #ffFFbb33 - #FF8800 - #ffff4444 - #ffcc0000 - #ff99cc00 - #ff669900 - #ffAA66cc - #9933CC - - \ No newline at end of file diff --git a/protocoder_myscript/src/main/res/values/strings.xml b/protocoder_myscript/src/main/res/values/strings.xml index e62af5e7..a843af34 100644 --- a/protocoder_myscript/src/main/res/values/strings.xml +++ b/protocoder_myscript/src/main/res/values/strings.xml @@ -1,4 +1,4 @@ - protocoder_myscript + protocoder_custom MyProtocoderScript diff --git a/protocoder_myscript/src/main/res/values/styles.xml b/protocoder_myscript/src/main/res/values/styles.xml index 5d026bca..ff6c9d2c 100644 --- a/protocoder_myscript/src/main/res/values/styles.xml +++ b/protocoder_myscript/src/main/res/values/styles.xml @@ -1,81 +1,8 @@ - + - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file + diff --git a/protocoder_myscript/src/main/res/values/themes.xml b/protocoder_myscript/src/main/res/values/themes.xml deleted file mode 100644 index 2161005d..00000000 --- a/protocoder_myscript/src/main/res/values/themes.xml +++ /dev/null @@ -1,61 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/settings.gradle b/settings.gradle index 5c941f9b..a996253f 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1 +1,2 @@ -include ':protocoder_app', ':protocoder_apprunner', ':protocoder_myscript' \ No newline at end of file +include ':protocoder_app', ':protocoder_apprunner' +//, ':protocoder_myscript' \ No newline at end of file