diff --git a/.github/workflows/android.yml b/.github/workflows/android.yml
index 0741c09..9ece954 100644
--- a/.github/workflows/android.yml
+++ b/.github/workflows/android.yml
@@ -13,3 +13,13 @@ jobs:
java-version: 11
- name: Build with Gradle
run: ./gradlew :APDE:build
+ - name: upload release
+ uses: actions/upload-artifact@v3
+ with:
+ name: APDE.apk
+ path: APDE/build/outputs/apk/release/APDE-release-unsigned.apk
+ - name: upload debug
+ uses: actions/upload-artifact@v3
+ with:
+ name: APDE-debug.apk
+ path: APDE/build/outputs/apk/debug/APDE-debug.apk
diff --git a/APDE/src/main/java/com/calsignlabs/apde/EditorActivity.java b/APDE/src/main/java/com/calsignlabs/apde/EditorActivity.java
index 3757c17..d49f697 100644
--- a/APDE/src/main/java/com/calsignlabs/apde/EditorActivity.java
+++ b/APDE/src/main/java/com/calsignlabs/apde/EditorActivity.java
@@ -2184,6 +2184,7 @@ public boolean loadSketch(String sketchPath, APDE.SketchLocation sketchLocation)
// Get all the files in the directory
DocumentFile[] files = sketchLoc.resolve().listFiles();
+ MaybeDocumentFile datadir = sketchLoc.childDirectory("data");
// Why do we need this...?
for (SketchFile meta : tabs) {
@@ -2218,6 +2219,34 @@ public boolean loadSketch(String sketchPath, APDE.SketchLocation sketchLocation)
meta.getFragment().setSketchFile(meta);
}
}
+
+ if(datadir.exists()){
+ DocumentFile[] datafiles = datadir.resolve().listFiles();
+ for (DocumentFile file : datafiles) {
+ String name = file.getName();
+ if (name == null) {
+ continue;
+ }
+
+ String[] parts = name.split("\\.");
+ if (parts.length != 2) {
+ continue;
+ }
+ String title = parts[0];
+ String ext = parts[1];
+
+ if (ext.equals("glsl") || ext.equals("frag") || ext.equals("vert") || ext.equals("txt") || ext.equals("json")) {
+ // Build a SketchFile object
+ SketchFile meta = new SketchFile("data/"+title);
+ meta.readData(file, getContentResolver());
+ meta.setExample(getGlobalState().isExample());
+ meta.setSuffix("." + ext);
+
+ addTabWithoutPagerUpdate(meta);
+ meta.getFragment().setSketchFile(meta);
+ }
+ }
+ }
codePagerAdapter.notifyDataSetChanged();
diff --git a/APDE/src/main/java/com/calsignlabs/apde/SketchPropertiesActivity.java b/APDE/src/main/java/com/calsignlabs/apde/SketchPropertiesActivity.java
index 9d3e4c4..aaf4d02 100644
--- a/APDE/src/main/java/com/calsignlabs/apde/SketchPropertiesActivity.java
+++ b/APDE/src/main/java/com/calsignlabs/apde/SketchPropertiesActivity.java
@@ -154,4 +154,21 @@ public void addFile(Uri source) {
e.printStackTrace();
}
}
-}
\ No newline at end of file
+
+ public void addNewFile() {
+ try {
+ // Get the location of this sketch's data folder
+ MaybeDocumentFile dataFolder = getGlobalState().getSketchLocation().childDirectory("data");
+
+ String name = DEFAULT_ADDED_FILENAME;
+
+ String mimeType = "application/octet-stream";
+
+ MaybeDocumentFile dest = dataFolder.child(name, mimeType);
+ dataFolder.resolve();
+ dest.resolve();
+ } catch (MaybeDocumentFile.MaybeDocumentFileException e) {
+ e.printStackTrace();
+ }
+ }
+}
diff --git a/APDE/src/main/java/com/calsignlabs/apde/SketchPropertiesFragment.java b/APDE/src/main/java/com/calsignlabs/apde/SketchPropertiesFragment.java
index bbed77c..a74c702 100644
--- a/APDE/src/main/java/com/calsignlabs/apde/SketchPropertiesFragment.java
+++ b/APDE/src/main/java/com/calsignlabs/apde/SketchPropertiesFragment.java
@@ -135,6 +135,12 @@ public void onCreatePreferences(Bundle savedInstanceState, String rootKey) {
return true;
});
+ Preference launchAddNewFile = findPreference("prop_add_new_file");
+ launchAddNewFile.setOnPreferenceClickListener(preference -> {
+ launchAddNewFile();
+ return true;
+ });
+
Preference launchAddFile = findPreference("prop_add_file");
launchAddFile.setOnPreferenceClickListener(preference -> {
launchAddFile();
@@ -276,6 +282,10 @@ public void launchAddFile() {
getSketchPropertiesActivity().startActivityForResult(intent, SketchPropertiesActivity.REQUEST_CHOOSER);
}
+ public void launchAddNewFile() {
+ getSketchPropertiesActivity().addNewFile();
+ }
+
@SuppressLint({ "InlinedApi", "NewApi" })
public void launchChangeIcon() {
AlertDialog.Builder builder = new AlertDialog.Builder(getSketchPropertiesActivity());
diff --git a/APDE/src/main/res/values/strings_activity_sketch_properties.xml b/APDE/src/main/res/values/strings_activity_sketch_properties.xml
index 99305f9..fe53dd7 100644
--- a/APDE/src/main/res/values/strings_activity_sketch_properties.xml
+++ b/APDE/src/main/res/values/strings_activity_sketch_properties.xml
@@ -39,6 +39,8 @@
Sketch Folder
Add File
Add a file to the sketch\'s data folder
+ Add Empty File
+ Add an empty file to the sketch\'s data folder
Show Sketch Folder
@@ -54,4 +56,4 @@
Center
Resize
No Icon File Selected
-
\ No newline at end of file
+