mirror of
https://github.com/subsurface/subsurface.git
synced 2024-12-03 15:43:09 +00:00
Android: add callback from Intent
Right now all this does is add the device string to the log. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
d27777790e
commit
aed7528443
2 changed files with 20 additions and 0 deletions
|
@ -27,6 +27,7 @@ public class SubsurfaceMobileActivity extends QtActivity
|
||||||
public static boolean isIntentPending;
|
public static boolean isIntentPending;
|
||||||
public static boolean isInitialized;
|
public static boolean isInitialized;
|
||||||
private static final String TAG = "subsurfacedivelog.mobile";
|
private static final String TAG = "subsurfacedivelog.mobile";
|
||||||
|
public static native void setDeviceString(String deviceString);
|
||||||
|
|
||||||
// we need to provide two endpoints:
|
// we need to provide two endpoints:
|
||||||
// onNewIntent if we receive an Intent while running
|
// onNewIntent if we receive an Intent while running
|
||||||
|
@ -58,6 +59,7 @@ public class SubsurfaceMobileActivity extends QtActivity
|
||||||
// Log.i(TAG + " onNewIntent product name", device.getProductName());
|
// Log.i(TAG + " onNewIntent product name", device.getProductName());
|
||||||
// }
|
// }
|
||||||
Log.i(TAG + " onNewIntent toString", device.toString());
|
Log.i(TAG + " onNewIntent toString", device.toString());
|
||||||
|
setDeviceString(device.toString());
|
||||||
super.onNewIntent(intent);
|
super.onNewIntent(intent);
|
||||||
setIntent(intent);
|
setIntent(intent);
|
||||||
// Intent will be processed, if all is initialized and Qt / QML can handle the event
|
// Intent will be processed, if all is initialized and Qt / QML can handle the event
|
||||||
|
|
|
@ -15,6 +15,10 @@
|
||||||
#include <QtAndroidExtras/QAndroidJniObject>
|
#include <QtAndroidExtras/QAndroidJniObject>
|
||||||
#include <QtAndroid>
|
#include <QtAndroid>
|
||||||
|
|
||||||
|
#if defined(SUBSURFACE_MOBILE)
|
||||||
|
#include "mobile-widgets/qmlmanager.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#define USB_SERVICE "usb"
|
#define USB_SERVICE "usb"
|
||||||
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
@ -152,6 +156,20 @@ int get_usb_fd(uint16_t idVendor, uint16_t idProduct)
|
||||||
return fd;
|
return fd;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
JNIEXPORT void JNICALL
|
||||||
|
Java_org_subsurfacedivelog_mobile_SubsurfaceMobileActivity_setDeviceString(JNIEnv *env,
|
||||||
|
jobject obj,
|
||||||
|
jstring javaDeviceString)
|
||||||
|
{
|
||||||
|
const char *deviceString = env->GetStringUTFChars(javaDeviceString, NULL);
|
||||||
|
Q_UNUSED (obj)
|
||||||
|
#if defined(SUBSURFACE_MOBILE)
|
||||||
|
QMLManager::instance()->appendTextToLog(deviceString);
|
||||||
|
#endif
|
||||||
|
env->ReleaseStringUTFChars(javaDeviceString, deviceString);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
/* NOP wrappers to comform with windows.c */
|
/* NOP wrappers to comform with windows.c */
|
||||||
int subsurface_rename(const char *path, const char *newpath)
|
int subsurface_rename(const char *path, const char *newpath)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue