The open source OpenXR runtime
at main 117 lines 2.7 kB view raw
1// Copyright 2020-2021, Collabora, Ltd. 2// SPDX-License-Identifier: BSL-1.0 3// Author: Rylie Pavlik <rylie.pavlik@collabora.com> 4 5#pragma once 6 7#include "ObjectWrapperBase.h" 8 9namespace wrap { 10namespace android::content { 11class Context; 12} // namespace android::content 13 14namespace android::widget { 15class Toast; 16} // namespace android::widget 17 18} // namespace wrap 19 20namespace wrap { 21namespace android::widget { 22/*! 23 * Wrapper for android.widget.Toast objects. 24 */ 25class Toast : public ObjectWrapperBase { 26 public: 27 using ObjectWrapperBase::ObjectWrapperBase; 28 static constexpr const char *getTypeName() noexcept { 29 return "android/widget/Toast"; 30 } 31 32 /*! 33 * Getter for the LENGTH_LONG static field value 34 * 35 * Java prototype: 36 * `public static final int LENGTH_LONG;` 37 * 38 * JNI signature: I 39 * 40 */ 41 static int32_t LENGTH_LONG(); 42 43 /*! 44 * Getter for the LENGTH_SHORT static field value 45 * 46 * Java prototype: 47 * `public static final int LENGTH_SHORT;` 48 * 49 * JNI signature: I 50 * 51 */ 52 static int32_t LENGTH_SHORT(); 53 54 /*! 55 * Wrapper for the show method 56 * 57 * Java prototype: 58 * `public void show();` 59 * 60 * JNI signature: ()V 61 * 62 */ 63 void show() const; 64 65 /*! 66 * Wrapper for the makeText static method 67 * 68 * Java prototype: 69 * `public static android.widget.Toast makeText(android.content.Context, 70 * java.lang.CharSequence, int);` 71 * 72 * JNI signature: 73 * (Landroid/content/Context;Ljava/lang/CharSequence;I)Landroid/widget/Toast; 74 * 75 */ 76 static Toast makeText(content::Context const &context, 77 std::string const &stringParam, int32_t duration); 78 79 /*! 80 * Wrapper for the makeText static method 81 * 82 * Java prototype: 83 * `public static android.widget.Toast makeText(android.content.Context, 84 * int, int) throws android.content.res.Resources$NotFoundException;` 85 * 86 * JNI signature: (Landroid/content/Context;II)Landroid/widget/Toast; 87 * 88 */ 89 static Toast makeText(content::Context const &context, int32_t resId, 90 int32_t duration); 91 92 /*! 93 * Class metadata 94 */ 95 struct Meta : public MetaBase { 96 impl::StaticFieldId<int32_t> LENGTH_LONG; 97 impl::StaticFieldId<int32_t> LENGTH_SHORT; 98 jni::method_t show; 99 jni::method_t makeText; 100 jni::method_t makeText1; 101 102 /*! 103 * Singleton accessor 104 */ 105 static Meta &data() { 106 static Meta instance{}; 107 return instance; 108 } 109 110 private: 111 Meta(); 112 }; 113}; 114 115} // namespace android::widget 116} // namespace wrap 117#include "android.widget.impl.h"