|
16 | 16 |
|
17 | 17 | package com.google.example.nativegame; |
18 | 18 |
|
| 19 | +import android.app.Activity; |
19 | 20 | import android.app.NativeActivity; |
| 21 | +import android.content.Intent; |
20 | 22 | import android.os.Bundle; |
21 | 23 | import android.view.Gravity; |
22 | 24 | import android.view.LayoutInflater; |
@@ -130,26 +132,38 @@ public void run() { |
130 | 132 |
|
131 | 133 | }}); |
132 | 134 | } |
133 | | - |
134 | | - protected void onPause() { |
135 | | - super.onPause(); |
| 135 | + |
| 136 | + protected void onPause() { |
| 137 | + super.onPause(); |
136 | 138 | if (_popupWindow != null) { |
137 | 139 | _popupWindow.dismiss(); |
138 | 140 | _popupWindow = null; |
139 | 141 | } |
140 | 142 |
|
141 | 143 | // This call is to suppress 'E/WindowManager(): |
142 | | - // android.view.WindowLeaked...' errors. |
143 | | - // Since orientation change events in NativeActivity comes later than |
144 | | - // expected, we can not dismiss |
145 | | - // popupWindow gracefully from NativeActivity. |
146 | | - // So we are releasing popupWindows explicitly triggered from Java |
147 | | - // callback through JNI call. |
148 | | - OnPauseHandler(); |
149 | | - } |
| 144 | + // android.view.WindowLeaked...' errors. |
| 145 | + // Since orientation change events in NativeActivity comes later than |
| 146 | + // expected, we can not dismiss |
| 147 | + // popupWindow gracefully from NativeActivity. |
| 148 | + // So we are releasing popupWindows explicitly triggered from Java |
| 149 | + // callback through JNI call. |
| 150 | + OnPauseHandler(); |
| 151 | + } |
| 152 | + |
| 153 | + native public void OnPauseHandler(); |
150 | 154 |
|
151 | | - native public void OnPauseHandler(); |
152 | 155 |
|
| 156 | + /* |
| 157 | + * This is needed to foward the onActivityResult call to the games SDK. |
| 158 | + * The SDK uses this to manage the display of the standard UI calls. |
| 159 | + */ |
| 160 | + protected void onActivityResult(int requestCode, int resultCode, Intent data) { |
| 161 | + nativeOnActivityResult(this, requestCode,resultCode, data); |
| 162 | + } |
| 163 | + |
| 164 | + // Implemented in C++. |
| 165 | + public static native void nativeOnActivityResult(Activity activity, |
| 166 | + int requestCode, int resultCode, Intent data); |
153 | 167 | } |
154 | 168 |
|
155 | 169 |
|
0 commit comments