Skip to content

Commit b49988e

Browse files
author
Google Automerger
committed
Merge commit '2b8606e7d2f995cccf5c457cf93a2cdb717a469a' into HEAD
2 parents a17bec0 + 2b8606e commit b49988e

File tree

8 files changed

+32
-30
lines changed

8 files changed

+32
-30
lines changed

samples-android/ButtonClicker/AndroidManifest.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
<uses-sdk
77
android:minSdkVersion="11"
8-
android:targetSdkVersion="19" />
8+
android:targetSdkVersion="22" />
99

1010
<uses-feature android:glEsVersion="0x00020000" >
1111
</uses-feature>
@@ -47,4 +47,4 @@
4747
</intent-filter>
4848
</activity>
4949
</application>
50-
</manifest>
50+
</manifest>

samples-android/ButtonClicker/jni/Application.mk

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
1-
APP_PLATFORM := android-9
2-
#APP_ABI := all
1+
APP_PLATFORM := android-22
32
APP_ABI := armeabi-v7a
4-
#,arm64-v8a
5-
63
APP_STL := c++_static
74

85
APP_CPPFLAGS := -std=c++11

samples-android/ButtonClicker/jni/ButtonClickerNativeActivity.cpp

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -105,15 +105,15 @@ void Engine::InitGooglePlayGameServices() {
105105
*
106106
*/
107107
void Engine::OnAuthActionStarted(gpg::AuthOperation op) {
108-
if (!initialized_resources_) return;
108+
if(!initialized_resources_) {
109+
return;
110+
}
111+
109112
ndk_helper::JNIHelper::GetInstance()->RunOnUiThread([this, op]() {
110113
EnableUI(false);
111-
authorizing_ = true;
112114
if (op == gpg::AuthOperation::SIGN_IN) {
113-
LOGI("Signing in to GPG");
114115
status_text_->SetAttribute("Text", "Signing In...");
115116
} else {
116-
LOGI("Signing out from GPG");
117117
status_text_->SetAttribute("Text", "Signing Out...");
118118
}
119119
});
@@ -136,11 +136,12 @@ void Engine::OnAuthActionFinished(gpg::AuthOperation op,
136136
});
137137
}
138138

139-
if (!initialized_resources_) return;
139+
if(!initialized_resources_) {
140+
return;
141+
}
140142

141143
ndk_helper::JNIHelper::GetInstance()->RunOnUiThread([this, status]() {
142144
EnableUI(true);
143-
authorizing_ = false;
144145
button_sign_in_->SetAttribute(
145146
"Text", gpg::IsSuccess(status) ? "Sign Out" : "Sign In");
146147

@@ -560,8 +561,14 @@ void Engine::LeaveGame() {
560561
* invoking jui_helper functions to create java UIs
561562
*/
562563
void Engine::InitUI() {
564+
// The window initialization
565+
jui_helper::JUIWindow::Init(app_->activity, JUIHELPER_CLASS_NAME);
566+
563567
// Show toast with app label
564568
ndk_helper::JNIHelper::GetInstance()->RunOnUiThread([]() {
569+
if(NULL == jui_helper::JUIWindow::GetInstance()->GetContext()) {
570+
return;
571+
}
565572
jui_helper::JUIToast toast(
566573
ndk_helper::JNIHelper::GetInstance()->GetAppLabel());
567574
toast.Show();
@@ -572,9 +579,6 @@ void Engine::InitUI() {
572579
// UIs.
573580
//
574581

575-
// The window initialization
576-
jui_helper::JUIWindow::Init(app_->activity, JUIHELPER_CLASS_NAME);
577-
578582
//
579583
// Buttons
580584
//
@@ -586,7 +590,6 @@ void Engine::InitUI() {
586590
jui_helper::LAYOUT_PARAMETER_TRUE);
587591
button_sign_in_->SetCallback([this](jui_helper::JUIView *view,
588592
const int32_t message) {
589-
LOGI("button_sign_in_ click: %d", message);
590593
if (message == jui_helper::JUICALLBACK_BUTTON_UP) {
591594
if (service_->IsAuthorized()) {
592595
service_->SignOut();
@@ -647,7 +650,6 @@ void Engine::InitUI() {
647650
// Init play game services
648651
InitGooglePlayGameServices();
649652

650-
if (authorizing_) EnableUI(false);
651653
return;
652654
}
653655

@@ -669,7 +671,6 @@ void Engine::SetParameters(jui_helper::JUIButton *button,
669671
* Enable/Disable management UI
670672
*/
671673
void Engine::EnableUI(bool enable) {
672-
LOGI("Updating UI:%d", enable);
673674
ndk_helper::JNIHelper::GetInstance()->RunOnUiThread([this, enable]() {
674675
button_sign_in_->SetAttribute("Enabled", enable);
675676

samples-android/ButtonClicker/jni/ButtonClickerNativeActivity.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,6 @@ class Engine : public gpg::IRealTimeEventListener {
147147
// in OnRoomStatusChanged()
148148
int32_t score_counter_; // Score counter of local player
149149
bool playing_; // Am I playing a game?
150-
bool authorizing_; // Am I signing in to gpg service?
151150
std::string self_id_; // Local player's ID
152151
double start_time_; // Game start time
153152

samples-android/ButtonClicker/jni/ButtonClickerNativeActivity_Engine.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
Engine::Engine()
2424
: initialized_resources_(false),
2525
has_focus_(false),
26-
authorizing_(false),
2726
app_(nullptr),
2827
dialog_(nullptr),
2928
textViewFPS_(nullptr),
@@ -192,7 +191,6 @@ int32_t Engine::HandleInput(android_app *app, AInputEvent *event) {
192191
*/
193192
void Engine::HandleCmd(struct android_app *app, int32_t cmd) {
194193
Engine *eng = (Engine *)app->userData;
195-
LOGI("message %d", cmd);
196194
switch (cmd) {
197195
case APP_CMD_SAVE_STATE:
198196
break;

samples-android/Teapot/jni/NativeGameActivity.cpp

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -112,16 +112,16 @@ Engine::~Engine() {
112112
}
113113

114114
void Engine::InitUI() {
115+
// The window is being shown, get it ready.
116+
jui_helper::JUIWindow::Init(app_->activity, JUIHELPER_CLASS_NAME);
117+
115118
// Show toast with app label
116119
ndk_helper::JNIHelper::GetInstance()->RunOnUiThread([]() {
117120
jui_helper::JUIToast toast(
118121
ndk_helper::JNIHelper::GetInstance()->GetAppLabel());
119122
toast.Show();
120123
});
121124

122-
// The window is being shown, get it ready.
123-
jui_helper::JUIWindow::Init(app_->activity, JUIHELPER_CLASS_NAME);
124-
125125
//
126126
// Buttons
127127
//
@@ -472,6 +472,9 @@ void Engine::UpdateFPS(float fps) {
472472
}
473473

474474
void Engine::OnAuthActionStarted(gpg::AuthOperation op) {
475+
if (!initialized_resources_) {
476+
return;
477+
}
475478
ndk_helper::JNIHelper::GetInstance()->RunOnUiThread([this, op]() {
476479
if (status_text_) {
477480
if (op == gpg::AuthOperation::SIGN_IN) {
@@ -485,6 +488,10 @@ void Engine::OnAuthActionStarted(gpg::AuthOperation op) {
485488

486489
void Engine::OnAuthActionFinished(gpg::AuthOperation op,
487490
gpg::AuthStatus status) {
491+
if (!initialized_resources_) {
492+
return;
493+
}
494+
488495
ndk_helper::JNIHelper::GetInstance()->RunOnUiThread([this, status]() {
489496
if (status == gpg::AuthStatus::VALID) {
490497
jui_helper::JUIToast toast("Signed In.");

samples-android/build.sh

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@ fi
99
# List of targets to build. Interpreted as directories relative to
1010
# this script's path.
1111
declare targets=( \
12-
CollectAllTheStarsNative \
13-
Minimalist \
14-
TbmpSkeletonNative \
15-
Teapot \
16-
TrivialQuestNative \
12+
# CollectAllTheStarsNative \
13+
# Minimalist \
14+
# TbmpSkeletonNative \
15+
# Teapot \
16+
# TrivialQuestNative \
1717
ButtonClicker \
1818
)
1919

samples-android/build_sample.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ trap cleanup EXIT
104104
# Copy the lib project and run "android update lib-project" on it.
105105
# This requires a target, which apparently needs to be android-10.
106106
cp -r ${lib_project} ${private_lib}
107-
${android_tool} update lib-project --path ${private_lib} --target android-10
107+
${android_tool} update lib-project --path ${private_lib} --target android-22
108108

109109
#
110110
# At last, build!

0 commit comments

Comments
 (0)