android save picker, create dir api wip

This commit is contained in:
2019-09-14 11:24:50 +02:00
parent 729c73eef2
commit 6f6be42a01
7 changed files with 64 additions and 12 deletions

View File

@@ -296,6 +296,14 @@ void android_pick_file(std::function<void(std::string)> callback)
jni->CallVoidMethod(g_engine.app->activity->clazz, method);
}
void android_pick_file_save(std::function<void(std::string)> callback)
{
pick_file_callback = callback;
jclass clazz = jni->GetObjectClass(g_engine.app->activity->clazz);
jmethodID method = jni->GetMethodID(clazz, "pickFileSave", "()V");
jni->CallVoidMethod(g_engine.app->activity->clazz, method);
}
float get_display_density()
{
jclass clazz = jni->GetObjectClass(g_engine.app->activity->clazz);
@@ -366,6 +374,17 @@ bool android_set_clipboard(const std::string& s)
return success;
}
bool android_create_dir(const std::string& path)
{
jclass clazz = jni->GetObjectClass(g_engine.app->activity->clazz);
jmethodID method = jni->GetMethodID(clazz, "createDir", "(Ljava/lang/String;)Z");
jstring js = JniStringFromUTF8(path);
if (!js) return false;
jboolean success = jni->CallBooleanMethod(g_engine.app->activity->clazz, method, js);
jni->DeleteLocalRef(js);
return success;
}
bool vr_running = false;
static void engine_vr_loop()
{
@@ -1029,12 +1048,12 @@ static void engine_handle_cmd(struct android_app* app, int32_t cmd) {
break;
case APP_CMD_WINDOW_REDRAW_NEEDED:
LOG("APP_CMD_WINDOW_REDRAW_NEEDED");
App::I->redraw = true;
App::I->ui_task([]{ App::I->update(0); });
ALooper_wake(engine->app->looper);
break;
case APP_CMD_WINDOW_RESIZED:
LOG("APP_CMD_WINDOW_RESIZED");
App::I->redraw = true;
App::I->async_redraw();
ALooper_wake(engine->app->looper);
break;
case APP_CMD_CONTENT_RECT_CHANGED:
@@ -1042,7 +1061,7 @@ static void engine_handle_cmd(struct android_app* app, int32_t cmd) {
//App::I->width = engine->app->contentRect.right - engine->app->contentRect.left;
//App::I->height = engine->app->contentRect.bottom - engine->app->contentRect.top;
//LOG("content rect %f %f", App::I->width, App::I->height);
App::I->redraw = true;
App::I->async_redraw();
ALooper_wake(engine->app->looper);
break;
}

View File

@@ -1,7 +0,0 @@
#include <stdlib.h>
int main()
{
return 0;
}