OLD | NEW |
1 /* | 1 /* |
2 * This file is part of Adblock Plus <https://adblockplus.org/>, | 2 * This file is part of Adblock Plus <https://adblockplus.org/>, |
3 * Copyright (C) 2006-2015 Eyeo GmbH | 3 * Copyright (C) 2006-2015 Eyeo GmbH |
4 * | 4 * |
5 * Adblock Plus is free software: you can redistribute it and/or modify | 5 * Adblock Plus is free software: you can redistribute it and/or modify |
6 * it under the terms of the GNU General Public License version 3 as | 6 * it under the terms of the GNU General Public License version 3 as |
7 * published by the Free Software Foundation. | 7 * published by the Free Software Foundation. |
8 * | 8 * |
9 * Adblock Plus is distributed in the hope that it will be useful, | 9 * Adblock Plus is distributed in the hope that it will be useful, |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 enumName, | 60 enumName, |
61 TYP("Notification$Type")); | 61 TYP("Notification$Type")); |
62 | 62 |
63 return env->GetStaticObjectField(*enumClass, enumField); | 63 return env->GetStaticObjectField(*enumClass, enumField); |
64 } | 64 } |
65 | 65 |
66 static jstring JniGetTitle(JNIEnv* env, jclass clazz, jlong ptr) | 66 static jstring JniGetTitle(JNIEnv* env, jclass clazz, jlong ptr) |
67 { | 67 { |
68 try | 68 try |
69 { | 69 { |
70 return env->NewStringUTF(GetNotificationPtr(ptr)->GetTitle().c_str()); | 70 return env->NewStringUTF(GetNotificationPtr(ptr)->GetTexts().title.c_str()); |
71 } | 71 } |
72 CATCH_THROW_AND_RETURN(env, 0) | 72 CATCH_THROW_AND_RETURN(env, 0) |
73 } | 73 } |
74 | 74 |
75 static jstring JniGetMessageString(JNIEnv* env, jclass clazz, jlong ptr) | 75 static jstring JniGetMessageString(JNIEnv* env, jclass clazz, jlong ptr) |
76 { | 76 { |
77 try | 77 try |
78 { | 78 { |
79 return env->NewStringUTF(GetNotificationPtr(ptr)->GetMessageString().c_str()
); | 79 return env->NewStringUTF(GetNotificationPtr(ptr)->GetTexts().message.c_str()
); |
80 } | 80 } |
81 CATCH_THROW_AND_RETURN(env, 0) | 81 CATCH_THROW_AND_RETURN(env, 0) |
82 } | 82 } |
83 | 83 |
84 static void JniMarkAsShown(JNIEnv* env, jclass clazz, jlong ptr) | 84 static void JniMarkAsShown(JNIEnv* env, jclass clazz, jlong ptr) |
85 { | 85 { |
86 try | 86 try |
87 { | 87 { |
88 GetNotificationPtr(ptr)->MarkAsShown(); | 88 GetNotificationPtr(ptr)->MarkAsShown(); |
89 } | 89 } |
90 CATCH_AND_THROW(env) | 90 CATCH_AND_THROW(env) |
91 } | 91 } |
92 | 92 |
93 static JNINativeMethod methods[] = | 93 static JNINativeMethod methods[] = |
94 { | 94 { |
95 { (char*) "markAsShown", (char*) "(J)V", (void*) JniMarkAsShown }, | 95 { (char*) "markAsShown", (char*) "(J)V", (void*) JniMarkAsShown }, |
96 { (char*) "getMessageString", (char*) "(J)Ljava/lang/String;", (void*) JniGetM
essageString }, | 96 { (char*) "getMessageString", (char*) "(J)Ljava/lang/String;", (void*) JniGetM
essageString }, |
97 { (char*) "getTitle", (char*) "(J)Ljava/lang/String;", (void*) JniGetTitle }, | 97 { (char*) "getTitle", (char*) "(J)Ljava/lang/String;", (void*) JniGetTitle }, |
98 { (char*) "getType", (char*) "(J)" TYP("Notification$Type"), (void*) JniGetTyp
e } | 98 { (char*) "getType", (char*) "(J)" TYP("Notification$Type"), (void*) JniGetTyp
e } |
99 }; | 99 }; |
100 | 100 |
101 extern "C" JNIEXPORT void JNICALL Java_org_adblockplus_libadblockplus_Notificati
on_registerNatives( | 101 extern "C" JNIEXPORT void JNICALL Java_org_adblockplus_libadblockplus_Notificati
on_registerNatives( |
102 JNIEnv *env, jclass clazz) | 102 JNIEnv *env, jclass clazz) |
103 { | 103 { |
104 env->RegisterNatives(clazz, methods, sizeof(methods) / sizeof(methods[0])); | 104 env->RegisterNatives(clazz, methods, sizeof(methods) / sizeof(methods[0])); |
105 } | 105 } |
106 | 106 |
OLD | NEW |