diff --git a/android/jni/com/mapswithme/maps/Lifecycle.cpp b/android/jni/com/mapswithme/maps/Lifecycle.cpp index add919608e..976f0091c5 100644 --- a/android/jni/com/mapswithme/maps/Lifecycle.cpp +++ b/android/jni/com/mapswithme/maps/Lifecycle.cpp @@ -52,7 +52,10 @@ bool SetupGLESResources() return true; if (!g_framework->InitRenderPolicy()) + { + NVEventReportUnsupported(); return false; + } s_glesLoaded = true; diff --git a/android/jni/nv_event/nv_event.cpp b/android/jni/nv_event/nv_event.cpp index 93883cd4e8..747abfba60 100644 --- a/android/jni/nv_event/nv_event.cpp +++ b/android/jni/nv_event/nv_event.cpp @@ -173,6 +173,25 @@ public: return (int)jniEnv->CallIntMethod(s_globalThiz, m_index); } + void CallVoid() + { + JNIEnv * jniEnv = NVThreadGetCurrentJNIEnv(); + + if (!jniEnv || !s_globalThiz) + { + __android_log_print(ANDROID_LOG_DEBUG, MODULE, "Error: No valid JNI env in %s", m_name); + return; + } + + if (!m_index) + { + __android_log_print(ANDROID_LOG_DEBUG, MODULE, "Error: No valid function pointer in %s", m_name); + return; + } + + return jniEnv->CallVoidMethod(s_globalThiz, m_index); + } + const char* m_name; const char* m_signature; jmethodID m_index; @@ -188,6 +207,7 @@ static MethodRef s_BindSurfaceAndContextEGL("BindSurfaceAndContextEGL", "()Z"); static MethodRef s_UnbindSurfaceAndContextEGL("UnbindSurfaceAndContextEGL", "()Z"); static MethodRef s_GetErrorEGL("GetErrorEGL", "()I"); static MethodRef s_finish("finish", "()V"); +static MethodRef s_ReportUnsupported("ReportUnsupported", "()V"); // True between onCreate and onDestroy bool NVEventStatusIsRunning() @@ -466,6 +486,12 @@ bool NVEventRepaint() return true; } +void NVEventReportUnsupported() +{ + /// to prevent from rendering + ClearAppFlag(NVEVENT_STATUS_FOCUSED); + s_ReportUnsupported.CallVoid(); +} /////////////////////////////////////////////////////////////////////////////// // Input event-related Java to Native callback functions @@ -884,5 +910,6 @@ void InitNVEvent(JavaVM* vm) s_UnbindSurfaceAndContextEGL.QueryID(env, k); s_GetErrorEGL.QueryID(env, k); s_finish.QueryID(env, k); + s_ReportUnsupported.QueryID(env, k); } diff --git a/android/jni/nv_event/nv_event.hpp b/android/jni/nv_event/nv_event.hpp index 15b93023ed..73568cb9ae 100644 --- a/android/jni/nv_event/nv_event.hpp +++ b/android/jni/nv_event/nv_event.hpp @@ -521,6 +521,8 @@ bool NVEventStatusEGLIsBound(); bool NVEventRepaint(); +void NVEventReportUnsupported(); + /** Returns the platform-specific handle to the application instance, if supported. This function is, by definition platform-specific. diff --git a/android/res/values-de/strings.xml b/android/res/values-de/strings.xml index f8b0e92ed4..453b7f2308 100644 --- a/android/res/values-de/strings.xml +++ b/android/res/values-de/strings.xml @@ -21,4 +21,5 @@ Kilometer Schließen Um die Karte dieses Ortes\nherunterzuladen, berühren Sie\n bitte die Taste in der unteren\n Hälfte des Bildschirms + Das Programm braucht OpenGL um funktionnieren zu können. Leider wird ihr Gerät nicht unterschtüzt. diff --git a/android/res/values-es/strings.xml b/android/res/values-es/strings.xml index ef6625da5a..149c7af2bc 100644 --- a/android/res/values-es/strings.xml +++ b/android/res/values-es/strings.xml @@ -21,4 +21,5 @@ Kilómetros Cerrar Para poder ver detalles\n de esta zona debes descargar\nel mapa de este país. Pulse el botón\nbajo la pantalla para descargar. + Un hardware aceleró OpenGL se requiere. Desgraciadamente, el dispositivo móvil no es compatible. diff --git a/android/res/values-fr/strings.xml b/android/res/values-fr/strings.xml index efd3d34796..a45643e15d 100644 --- a/android/res/values-fr/strings.xml +++ b/android/res/values-fr/strings.xml @@ -21,4 +21,5 @@ Kilomètres Fermer Pour scharger cette carte,\ntoucher le bouton au bas de l`écran + Le programme a besoin d`OpenGL pour travailler. Votre appareil n`est pas appuyé maleuresement. diff --git a/android/res/values-ru/strings.xml b/android/res/values-ru/strings.xml index 8920eae6fe..f618009de9 100644 --- a/android/res/values-ru/strings.xml +++ b/android/res/values-ru/strings.xml @@ -25,4 +25,5 @@ Загруженные карты недоступны Отключите USB кабель или вставьте SD-карту Чтобы загрузить карту\nэтого места, нажмите на\nкнопку загрузки внизу экрана + Для работы приложения необходим аппаратно ускоренный OpenGL. К сожалению, ваше устройство не поддерживается. diff --git a/android/res/values/strings.xml b/android/res/values/strings.xml index ae3616b209..e0348eb64a 100644 --- a/android/res/values/strings.xml +++ b/android/res/values/strings.xml @@ -25,4 +25,5 @@ External storage memory is not available Please disconnect USB cable or insert memory card to use MapsWithMe Nothing found. Have you tried\ndownloading maps of the countries?\nJust click the download button\nat the bottom of the screen. + A hardware accelerated OpenGL is required. Unfortunately, your device is not supported. diff --git a/android/src/com/mapswithme/maps/MWMActivity.java b/android/src/com/mapswithme/maps/MWMActivity.java index 158f32fb8e..25fabb757a 100644 --- a/android/src/com/mapswithme/maps/MWMActivity.java +++ b/android/src/com/mapswithme/maps/MWMActivity.java @@ -6,6 +6,7 @@ import com.mapswithme.maps.R; import com.mapswithme.maps.location.LocationService; import com.nvidia.devtech.NvEventQueueActivity; +import android.app.Activity; import android.app.AlertDialog; import android.content.BroadcastReceiver; import android.content.Context; @@ -15,12 +16,14 @@ import android.content.IntentFilter; import android.content.pm.PackageManager.NameNotFoundException; import android.os.Bundle; import android.os.Environment; +import android.view.Gravity; import android.view.LayoutInflater; import android.view.Menu; import android.view.MenuInflater; import android.view.MenuItem; import android.view.View; import android.webkit.WebView; +import android.widget.TextView; import android.util.DisplayMetrics; import android.util.Log; @@ -68,6 +71,35 @@ public class MWMActivity extends NvEventQueueActivity implements return getFilesDir().getAbsolutePath() + "/"; } + public void ReportUnsupported() + { + runOnUiThread(new Runnable() + { + public void run() + { + AlertDialog alert = new AlertDialog.Builder(getCurrentContext()).create(); + + alert.setMessage(getString(R.string.unsupported_phone)); + + alert.setCancelable(false); + + alert.setButton(AlertDialog.BUTTON_POSITIVE, getString(R.string.close), + new DialogInterface.OnClickListener() + { + public void onClick(DialogInterface dlg, int which) + { + Activity a = (Activity)getCurrentContext(); + a.moveTaskToBack(true); + dlg.dismiss(); + } + }); + + alert.show(); + } + }); + + } + private void checkMeasurementSystem() { int u; diff --git a/android/src/com/nvidia/devtech/NvEventQueueActivity.java b/android/src/com/nvidia/devtech/NvEventQueueActivity.java index c263e4170e..e907a93c68 100644 --- a/android/src/com/nvidia/devtech/NvEventQueueActivity.java +++ b/android/src/com/nvidia/devtech/NvEventQueueActivity.java @@ -655,4 +655,9 @@ public abstract class NvEventQueueActivity extends Activity { return m_egl.eglGetError(); } + + public void ReportUnsupported() + { + Log.i(TAG, "this phone GPU is unsupported"); + } }