From 3ed5e71da71e50849eb9e2c3244e843bc5e38a05 Mon Sep 17 00:00:00 2001 From: Matthias Melcher Date: Mon, 5 Mar 2018 23:17:51 +0000 Subject: Android: moved to IDE directory. git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@12711 ea41ed52-d2ee-0310-a9c1-e6b18d33e121 --- Android/HelloAndroid/app/app.iml | 141 ---------------- Android/HelloAndroid/app/build.gradle | 23 --- .../HelloAndroid/app/src/main/AndroidManifest.xml | 22 --- .../HelloAndroid/app/src/main/cpp/CMakeLists.txt | 45 ----- .../HelloAndroid/app/src/main/cpp/HelloAndroid.cxx | 182 --------------------- .../app/src/main/res/mipmap-hdpi/ic_launcher.png | Bin 3418 -> 0 bytes .../app/src/main/res/mipmap-mdpi/ic_launcher.png | Bin 2206 -> 0 bytes .../app/src/main/res/mipmap-xhdpi/ic_launcher.png | Bin 4842 -> 0 bytes .../app/src/main/res/mipmap-xxhdpi/ic_launcher.png | Bin 7718 -> 0 bytes .../app/src/main/res/values/strings.xml | 4 - 10 files changed, 417 deletions(-) delete mode 100644 Android/HelloAndroid/app/app.iml delete mode 100644 Android/HelloAndroid/app/build.gradle delete mode 100644 Android/HelloAndroid/app/src/main/AndroidManifest.xml delete mode 100644 Android/HelloAndroid/app/src/main/cpp/CMakeLists.txt delete mode 100644 Android/HelloAndroid/app/src/main/cpp/HelloAndroid.cxx delete mode 100644 Android/HelloAndroid/app/src/main/res/mipmap-hdpi/ic_launcher.png delete mode 100644 Android/HelloAndroid/app/src/main/res/mipmap-mdpi/ic_launcher.png delete mode 100644 Android/HelloAndroid/app/src/main/res/mipmap-xhdpi/ic_launcher.png delete mode 100644 Android/HelloAndroid/app/src/main/res/mipmap-xxhdpi/ic_launcher.png delete mode 100644 Android/HelloAndroid/app/src/main/res/values/strings.xml (limited to 'Android/HelloAndroid/app') diff --git a/Android/HelloAndroid/app/app.iml b/Android/HelloAndroid/app/app.iml deleted file mode 100644 index a83784e31..000000000 --- a/Android/HelloAndroid/app/app.iml +++ /dev/null @@ -1,141 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/Android/HelloAndroid/app/build.gradle b/Android/HelloAndroid/app/build.gradle deleted file mode 100644 index dbe9d3dc9..000000000 --- a/Android/HelloAndroid/app/build.gradle +++ /dev/null @@ -1,23 +0,0 @@ -apply plugin: 'com.android.application' - - android { - compileSdkVersion 25 - - defaultConfig { - applicationId 'org.fltk.android_hello' - minSdkVersion 14 - targetSdkVersion 25 - } - buildTypes { - release { - minifyEnabled false - proguardFiles getDefaultProguardFile('proguard-android.txt'), - 'proguard-rules.pro' - } - } - externalNativeBuild { - cmake { - path 'src/main/cpp/CMakeLists.txt' - } - } - } diff --git a/Android/HelloAndroid/app/src/main/AndroidManifest.xml b/Android/HelloAndroid/app/src/main/AndroidManifest.xml deleted file mode 100644 index e0131f422..000000000 --- a/Android/HelloAndroid/app/src/main/AndroidManifest.xml +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - - - - - - - diff --git a/Android/HelloAndroid/app/src/main/cpp/CMakeLists.txt b/Android/HelloAndroid/app/src/main/cpp/CMakeLists.txt deleted file mode 100644 index 408052168..000000000 --- a/Android/HelloAndroid/app/src/main/cpp/CMakeLists.txt +++ /dev/null @@ -1,45 +0,0 @@ -# -# Copyright (C) The Android Open Source Project -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -cmake_minimum_required(VERSION 3.4.1) - -set(FLTK_DIR ../../../../../..) - -# FIXME: add as a second argument the binary build dir -# so that the first argument can link directly to FLTK -# instead of the fltk symlink, which is bad for SVN -add_subdirectory(${FLTK_DIR}/ "${CMAKE_CURRENT_BINARY_DIR}/fltk" EXCLUDE_FROM_ALL) - -# now build app's shared lib -add_library(android-hello SHARED - HelloAndroid.cxx) - -target_include_directories(android-hello PRIVATE - ${FLTK_DIR}/ - ${FLTK_DIR}/Android/) - -# Export ANativeActivity_onCreate(),
 -# Refer to: https://github.com/android-ndk/ndk/issues/381. -set(CMAKE_SHARED_LINKER_FLAGS - "${CMAKE_SHARED_LINKER_FLAGS} -u ANativeActivity_onCreate") - -# add lib dependencies -target_link_libraries(android-hello - fltk - android - log - m) - diff --git a/Android/HelloAndroid/app/src/main/cpp/HelloAndroid.cxx b/Android/HelloAndroid/app/src/main/cpp/HelloAndroid.cxx deleted file mode 100644 index bba38a5b7..000000000 --- a/Android/HelloAndroid/app/src/main/cpp/HelloAndroid.cxx +++ /dev/null @@ -1,182 +0,0 @@ -/* - * Copyright (C) 2010 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -//#include -#include -#include - -#include -#include -#include -Fl_Window *win; -Fl_Button *btn; - -#include -#include -#include -#include -#include - -#include -#include -#include -#include - -#define LOG_TAG "HelloFLTK" -#define LOGI(...) __android_log_print(ANDROID_LOG_INFO,LOG_TAG,__VA_ARGS__) -#define LOGW(...) __android_log_print(ANDROID_LOG_WARN,LOG_TAG,__VA_ARGS__) -#define LOGE(...) __android_log_print(ANDROID_LOG_ERROR,LOG_TAG,__VA_ARGS__) - -/* Set to 1 to enable debug log traces. */ -#define DEBUG 0 - -// ---------------------------------------------------------------------- - -struct engine { - int animating; -}; - -struct engine engine = { 0 }; - -static void engine_draw_frame() -{ - //if (Fl_Android_Application::lock_screen()) { - Fl::damage(FL_DAMAGE_ALL); - win->redraw(); - Fl::flush(); - // Fl_Android_Application::unlock_and_post_screen(); - //} -} - -static void engine_term_display() { - engine.animating = 0; -} - -static int32_t engine_handle_input(AInputEvent* event) { - if (AInputEvent_getType(event) == AINPUT_EVENT_TYPE_MOTION) { - engine.animating = 1; - Fl::e_x = Fl::e_x_root = AMotionEvent_getX(event, 0) * 600 / ANativeWindow_getWidth(Fl_Android_Application::native_window()); - Fl::e_y = Fl::e_y_root = AMotionEvent_getY(event, 0) * 800 / ANativeWindow_getHeight(Fl_Android_Application::native_window()); - Fl::e_state = FL_BUTTON1; - Fl::e_keysym = FL_Button+1; - if (AMotionEvent_getAction(event)==AMOTION_EVENT_ACTION_DOWN) { - Fl::e_is_click = 1; - Fl::handle(FL_PUSH, Fl::first_window()); - LOGE("Mouse push %d at %d, %d", Fl::event_button(), Fl::event_x(), Fl::event_y()); - } else if (AMotionEvent_getAction(event)==AMOTION_EVENT_ACTION_MOVE) { - Fl::handle(FL_DRAG, Fl::first_window()); - } else if (AMotionEvent_getAction(event)==AMOTION_EVENT_ACTION_UP) { - Fl::e_state = 0; - Fl::handle(FL_RELEASE, Fl::first_window()); - } - return 1; - } else if (AInputEvent_getType(event) == AINPUT_EVENT_TYPE_KEY) { - LOGI("Key event: action=%d keyCode=%d metaState=0x%x", - AKeyEvent_getAction(event), - AKeyEvent_getKeyCode(event), - AKeyEvent_getMetaState(event)); - } - - return 0; -} - -static void engine_handle_cmd(int32_t cmd) { - static int32_t format = WINDOW_FORMAT_RGB_565; - switch (cmd) { - case APP_CMD_INIT_WINDOW: - if (Fl_Android_Application::native_window() != NULL) { - // fill_plasma() assumes 565 format, get it here - format = ANativeWindow_getFormat(Fl_Android_Application::native_window()); - ANativeWindow_setBuffersGeometry(Fl_Android_Application::native_window(), -#if 1 - 600, //ANativeWindow_getWidth(app->window), - 800, //ANativeWindow_getHeight(app->window), -#else - ANativeWindow_getWidth(app->window), - ANativeWindow_getHeight(app->window), -#endif - WINDOW_FORMAT_RGB_565); - engine_draw_frame(); - } - break; - case APP_CMD_TERM_WINDOW: - engine_term_display(); - ANativeWindow_setBuffersGeometry(Fl_Android_Application::native_window(), -#if 1 - 600, //ANativeWindow_getWidth(app->window), - 800, //ANativeWindow_getHeight(app->window), -#else - ANativeWindow_getWidth(app->window), - ANativeWindow_getHeight(app->window), -#endif - format); - break; - case APP_CMD_LOST_FOCUS: - engine.animating = 0; - engine_draw_frame(); - break; - default: break; - } -} - - -int main(int argc, char **argv) -{ - Fl_Android_Application::log_e("App path is %s", argv[0]); - - memset(&engine, 0, sizeof(engine)); - Fl_Android_Application::set_on_app_cmd(engine_handle_cmd); - Fl_Android_Application::set_on_input_event(engine_handle_input); - - win = new Fl_Window(10, 10, 600, 400, "Hallo"); - btn = new Fl_Button(190, 200, 280, 35, "Hello, Android!"); - btn->color(FL_LIGHT2); - win->show(); - Fl::damage(FL_DAMAGE_ALL); - win->redraw(); - - - // loop waiting for stuff to do. - - while (1) { - // Read all pending events. - int ident; - int events; - struct android_poll_source* source; - - // If not animating, we will block forever waiting for events. - // If animating, we loop until all events are read, then continue - // to draw the next frame of animation. - while ((ident=ALooper_pollAll(engine.animating ? 0 : -1, NULL, &events, - (void**)&source)) >= 0) { - - // Process this event. - if (source != NULL) { - source->process(source); - } - - // Check if we are exiting. - if (Fl_Android_Application::destroy_requested() != 0) { - LOGI("Engine thread destroy requested!"); - engine_term_display(); - return 0; - } - } - Fl::flush(); - } - return 0; -} diff --git a/Android/HelloAndroid/app/src/main/res/mipmap-hdpi/ic_launcher.png b/Android/HelloAndroid/app/src/main/res/mipmap-hdpi/ic_launcher.png deleted file mode 100644 index cde69bccc..000000000 Binary files a/Android/HelloAndroid/app/src/main/res/mipmap-hdpi/ic_launcher.png and /dev/null differ diff --git a/Android/HelloAndroid/app/src/main/res/mipmap-mdpi/ic_launcher.png b/Android/HelloAndroid/app/src/main/res/mipmap-mdpi/ic_launcher.png deleted file mode 100644 index c133a0cbd..000000000 Binary files a/Android/HelloAndroid/app/src/main/res/mipmap-mdpi/ic_launcher.png and /dev/null differ diff --git a/Android/HelloAndroid/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/Android/HelloAndroid/app/src/main/res/mipmap-xhdpi/ic_launcher.png deleted file mode 100644 index bfa42f0e7..000000000 Binary files a/Android/HelloAndroid/app/src/main/res/mipmap-xhdpi/ic_launcher.png and /dev/null differ diff --git a/Android/HelloAndroid/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/Android/HelloAndroid/app/src/main/res/mipmap-xxhdpi/ic_launcher.png deleted file mode 100644 index 324e72cdd..000000000 Binary files a/Android/HelloAndroid/app/src/main/res/mipmap-xxhdpi/ic_launcher.png and /dev/null differ diff --git a/Android/HelloAndroid/app/src/main/res/values/strings.xml b/Android/HelloAndroid/app/src/main/res/values/strings.xml deleted file mode 100644 index e2f60e96f..000000000 --- a/Android/HelloAndroid/app/src/main/res/values/strings.xml +++ /dev/null @@ -1,4 +0,0 @@ - - - Hello Android - -- cgit v1.2.3