[DEV] add jump url for Android (only)
Conflicts: external/ewolsa
This commit is contained in:
parent
78d729e033
commit
b3602ceb14
2
build
2
build
@ -1 +1 @@
|
||||
Subproject commit 27d665573a0d5acfd68c523b6c3fbc01cf1f874b
|
||||
Subproject commit 2e79c973af0e73c1732711cedc39dc414a82052d
|
2
external/ewolsa
vendored
2
external/ewolsa
vendored
@ -1 +1 @@
|
||||
Subproject commit 2297f5a5e60ee2deab32938e8ffc0748d3636f1d
|
||||
Subproject commit 34ac6fe9d201e995401b0fc8bdbb70fe3bd40970
|
@ -42,6 +42,10 @@ import android.util.Log;
|
||||
import android.content.ClipboardManager;
|
||||
import android.content.ClipData;
|
||||
|
||||
import android.net.Uri;
|
||||
import android.content.Intent;
|
||||
import android.content.ActivityNotFoundException;
|
||||
|
||||
import java.io.IOException;
|
||||
//import activityRootView
|
||||
|
||||
@ -277,6 +281,15 @@ public abstract class EwolActivity extends Activity implements EwolCallback, Ewo
|
||||
setTitle(value);
|
||||
}
|
||||
|
||||
public void openURI(String uri) {
|
||||
try {
|
||||
Intent myIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(uri));
|
||||
startActivity(myIntent);
|
||||
} catch (ActivityNotFoundException e) {
|
||||
Log.e("EwolActivity", "Can not request an URL");
|
||||
}
|
||||
}
|
||||
|
||||
public void stop() {
|
||||
// end application is requested ...
|
||||
finish();
|
||||
|
@ -10,6 +10,7 @@ package org.ewol;
|
||||
import android.util.Log;
|
||||
|
||||
public interface EwolCallback {
|
||||
public void openURI(String uri);
|
||||
public void keyboardUpdate(boolean show);
|
||||
public void eventNotifier(String[] args);
|
||||
public void orientationUpdate(int screenMode);
|
||||
|
@ -23,6 +23,10 @@ import android.view.SurfaceHolder;
|
||||
import org.ewol.EwolSurfaceViewGL;
|
||||
import android.view.MotionEvent;
|
||||
|
||||
import android.net.Uri;
|
||||
import android.content.Intent;
|
||||
import android.content.ActivityNotFoundException;
|
||||
|
||||
import org.ewol.Ewol;
|
||||
|
||||
public abstract class EwolWallpaper extends WallpaperService implements EwolCallback, EwolConstants
|
||||
@ -186,6 +190,15 @@ public abstract class EwolWallpaper extends WallpaperService implements EwolCall
|
||||
Log.d("EwolCallback", "SET TITLE is not implemented ...");
|
||||
}
|
||||
|
||||
public void openURI(String uri) {
|
||||
try {
|
||||
Intent myIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(uri));
|
||||
startActivity(myIntent);
|
||||
} catch (ActivityNotFoundException e) {
|
||||
Log.e("EwolActivity", "Can not request an URL");
|
||||
}
|
||||
}
|
||||
|
||||
public void stop() {
|
||||
Log.d("EwolCallback", "STOP is not implemented ...");
|
||||
}
|
||||
|
@ -28,7 +28,7 @@ namespace ewol {
|
||||
#define SHAPER_NB_MAX_QUAD (5*5)
|
||||
#define SHAPER_NB_MAX_TRIANGLE (SHAPER_NB_MAX_QUAD*2)
|
||||
#define SHAPER_NB_MAX_VERTEX (SHAPER_NB_MAX_TRIANGLE*3)
|
||||
enum {
|
||||
enum shaperPos {
|
||||
shaperPosLeft,
|
||||
shaperPosRight,
|
||||
shaperPosTop,
|
||||
|
@ -63,6 +63,7 @@ class AndroidContext : public ewol::Context {
|
||||
jmethodID m_javaMethodEwolCallbackKeyboardUpdate; //!< basic methode to call ...
|
||||
jmethodID m_javaMethodEwolCallbackOrientationUpdate;
|
||||
jmethodID m_javaMethodEwolActivitySetTitle;
|
||||
jmethodID m_javaMethodEwolActivityOpenURI;
|
||||
jmethodID m_javaMethodEwolActivitySetClipBoardString;
|
||||
jmethodID m_javaMethodEwolActivityGetClipBoardString;
|
||||
// List of all Audio interface :
|
||||
@ -97,6 +98,7 @@ class AndroidContext : public ewol::Context {
|
||||
m_javaMethodEwolCallbackKeyboardUpdate(0),
|
||||
m_javaMethodEwolCallbackOrientationUpdate(0),
|
||||
m_javaMethodEwolActivitySetTitle(0),
|
||||
m_javaMethodEwolActivityOpenURI(0),
|
||||
m_javaMethodEwolActivitySetClipBoardString(0),
|
||||
m_javaMethodEwolActivityGetClipBoardString(0),
|
||||
m_javaMethodEwolActivityAudioGetDeviceCount(0),
|
||||
@ -145,6 +147,15 @@ class AndroidContext : public ewol::Context {
|
||||
EWOL_ERROR("system can not start without function : titleSet");
|
||||
functionCallbackIsMissing = true;
|
||||
}
|
||||
ret = safeInitMethodID(m_javaMethodEwolActivityOpenURI,
|
||||
m_javaClassEwolCallback,
|
||||
"openURI",
|
||||
"(Ljava/lang/String;)V");
|
||||
if (ret == false) {
|
||||
java_check_exception(_env);
|
||||
EWOL_ERROR("system can not start without function : openURI");
|
||||
functionCallbackIsMissing = true;
|
||||
}
|
||||
|
||||
ret = safeInitMethodID(m_javaMethodEwolCallbackStop,
|
||||
m_javaClassEwolCallback,
|
||||
@ -535,6 +546,21 @@ class AndroidContext : public ewol::Context {
|
||||
}
|
||||
}
|
||||
|
||||
void openURL(const std::string& _url) {
|
||||
EWOL_DEBUG("C->java : send message to the java : open URL'" << _url << "'");
|
||||
int status;
|
||||
if(!java_attach_current_thread(&status)) {
|
||||
return;
|
||||
}
|
||||
//Call java ...
|
||||
jstring url = m_JavaVirtualMachinePointer->NewStringUTF(_url.c_str());
|
||||
m_JavaVirtualMachinePointer->CallVoidMethod(m_javaObjectEwolCallback, m_javaMethodEwolActivityOpenURI, url);
|
||||
m_JavaVirtualMachinePointer->DeleteLocalRef(url);
|
||||
// manage execption :
|
||||
java_check_exception(m_JavaVirtualMachinePointer);
|
||||
java_detach_current_thread(status);
|
||||
}
|
||||
|
||||
void sendSystemMessage(const char* _dataString) {
|
||||
EWOL_DEBUG("C->java : send message to the java : \"" << _dataString << "\"");
|
||||
int status;
|
||||
|
@ -260,6 +260,11 @@ namespace ewol {
|
||||
* @param[in] title New desired title
|
||||
*/
|
||||
virtual void setTitle(const std::string& _title);
|
||||
/**
|
||||
* @brief Open an URL on an eternal brother.
|
||||
* @param[in] _url URL to open.
|
||||
*/
|
||||
virtual void openURL(const std::string& _url) {};
|
||||
/**
|
||||
* @brief force the screen orientation (availlable on portable elements ...
|
||||
* @param[in] _orientation Selected orientation.
|
||||
|
Loading…
x
Reference in New Issue
Block a user