struct callback_list *android_activity_cbl;
int android_version;
-
int
android_find_class_global(char *name, jclass *ret)
{
callback_call_4((struct callback *)id, sensor, &x, &y, &z);
}
-
+JNIEXPORT void JNICALL
+Java_org_navitproject_navit_NavitGraphics_CallbackMessageChannel( JNIEnv* env, jobject thiz, int i, jobject str)
+{
+ char *s;
+ dbg(0,"enter %p %p\n",(struct callback *)i,str);
+ s=(*env)->GetStringUTFChars(env, str, NULL);
+ dbg(0,"string=%s\n",s);
+ if (i)
+ {
+ if (i == 1)
+ {
+ // zoom in
+ navit_cmd_zoom_in_void();
+ }
+ if (i == 2)
+ {
+ // zoom out
+ navit_cmd_zoom_out_void();
+ }
+ }
+ (*env)->ReleaseStringUTFChars(env, str, s);
+}
if (scale > 1.3)
{
// zoom in
- String s = java.lang.String.valueOf((char) 17);
- KeypressCallback(KeypressCallbackID, s);
+ //String s = java.lang.String.valueOf((char) 17);
+ //KeypressCallback(KeypressCallbackID, s);
+
// next lines are a hack, without it screen will not get updated anymore!
- ButtonCallback(ButtonCallbackID, 1, 1, x, y); // down
- MotionCallback(MotionCallbackID, x+15, y);
- MotionCallback(MotionCallbackID, x-15, y);
- ButtonCallback(ButtonCallbackID, 0, 1, x, y); // up
+ //ButtonCallback(ButtonCallbackID, 1, 1, x, y); // down
+ //MotionCallback(MotionCallbackID, x+15, y);
+ //MotionCallback(MotionCallbackID, x-15, y);
+ //ButtonCallback(ButtonCallbackID, 0, 1, x, y); // up
//this.postInvalidate();
+ CallbackMessageChannel(1,"");
+
//Log.e("NavitGraphics", "onTouch zoom in");
}
else if (scale < 0.8)
{
// zoom out
- String s = java.lang.String.valueOf((char) 15);
- KeypressCallback(KeypressCallbackID, s);
+ //String s = java.lang.String.valueOf((char) 15);
+ //KeypressCallback(KeypressCallbackID, s);
// next lines are a hack, without it screen will not get updated anymore!
- ButtonCallback(ButtonCallbackID, 1, 1, x, y); // down
- MotionCallback(MotionCallbackID, x+15, y);
- MotionCallback(MotionCallbackID, x-15, y);
- ButtonCallback(ButtonCallbackID, 0, 1, x, y); // up
+ //ButtonCallback(ButtonCallbackID, 1, 1, x, y); // down
+ //MotionCallback(MotionCallbackID, x+15, y);
+ //MotionCallback(MotionCallbackID, x-15, y);
+ //ButtonCallback(ButtonCallbackID, 0, 1, x, y); // up
//this.postInvalidate();
-
+
+ CallbackMessageChannel(2,"");
+
//Log.e("NavitGraphics", "onTouch zoom out");
}
{
this.touch_now.set(event.getX(), event.getY());
this.touch_prev.set(event.getX(), event.getY());
-
+
//Log.e("NavitGraphics", "zoom 2");
}
}
if (msg.getData().getInt("Callback") == 1)
{
//Log.e("NavitGraphics","callback_handler -> handleMessage 1");
- KeypressCallback(KeypressCallbackID, msg.getData()
- .getString("s"));
+ //KeypressCallback(KeypressCallbackID, msg.getData()
+ // .getString("s"));
+ CallbackMessageChannel(1,"");
}
- else if (msg.getData().getInt("Callback") == 2)
+ else if (msg.getData().getInt("Callback") == 2)
+
+ {
+ CallbackMessageChannel(2,"");
+ }
+
+ else if (msg.getData().getInt("Callback") == 21)
{
//Log.e("NavitGraphics","callback_handler -> handleMessage 2");
ButtonCallback(ButtonCallbackID, 1, 1, 0, 0); // down
}
- else if (msg.getData().getInt("Callback") == 3)
+ else if (msg.getData().getInt("Callback") == 22)
{
//Log.e("NavitGraphics","callback_handler -> handleMessage 3");
ButtonCallback(ButtonCallbackID, 0, 1, 0, 0); // up
pos_x = x;
pos_y = y;
}
+
+
+
+ /**
+ * generic message channel to C-code
+ */
+ public native int CallbackMessageChannel(int i,String s);
+
+
}