6
6
import android .content .SharedPreferences ;
7
7
import android .os .Bundle ;
8
8
import android .os .Handler ;
9
+ import android .support .annotation .Nullable ;
9
10
import android .support .v7 .app .AppCompatActivity ;
10
11
import android .util .Log ;
11
12
import android .view .Gravity ;
21
22
import com .google .android .gms .common .api .GoogleApiClient ;
22
23
import com .google .android .gms .drive .Drive ;
23
24
import com .google .android .gms .games .Games ;
24
- import com .google .android .gms .games .quest .Quest ;
25
- import com .google .android .gms .games .quest .QuestUpdateListener ;
26
25
import com .orm .query .Condition ;
27
26
import com .orm .query .Select ;
28
27
import com .tapjoy .TJPlacement ;
66
65
67
66
public class MainActivity extends AppCompatActivity implements
68
67
GoogleApiClient .ConnectionCallbacks ,
69
- GoogleApiClient .OnConnectionFailedListener ,
70
- QuestUpdateListener {
68
+ GoogleApiClient .OnConnectionFailedListener {
71
69
private static final Handler handler = new Handler ();
72
- public static RelativeLayout questContainer ;
73
70
public static VariableHelper vh ;
74
71
public static boolean needToRedrawVisitors = false ;
75
72
public static boolean needToRedrawSlots = false ;
@@ -79,7 +76,6 @@ public class MainActivity extends AppCompatActivity implements
79
76
private int newVisitors ;
80
77
private Intent musicService ;
81
78
private boolean musicServiceIsStarted = false ;
82
- private GooglePlayHelper gph ;
83
79
public static TJPlacement adPlacement ;
84
80
85
81
@ Override
@@ -91,7 +87,6 @@ protected void onCreate(Bundle savedInstanceState) {
91
87
92
88
dh = DisplayHelper .getInstance (getApplicationContext ());
93
89
vh = new VariableHelper ();
94
- gph = new GooglePlayHelper ();
95
90
musicService = new Intent (this , MusicService .class );
96
91
prefs = getSharedPreferences ("uk.co.jakelee.blacksmith" , MODE_PRIVATE );
97
92
LanguageHelper .updateLanguage (getApplicationContext ());
@@ -101,8 +96,6 @@ protected void onCreate(Bundle savedInstanceState) {
101
96
TutorialHelper .currentStage = prefs .getInt ("tutorialStage" , 0 );
102
97
}
103
98
104
- assignUIElements ();
105
-
106
99
try {
107
100
GooglePlayHelper .mGoogleApiClient = new GoogleApiClient .Builder (this )
108
101
.addConnectionCallbacks (this )
@@ -138,8 +131,11 @@ protected void onCreate(Bundle savedInstanceState) {
138
131
AlertDialogHelper .displayUpdateMessage (this , this );
139
132
}
140
133
}
134
+ }
135
+
136
+ @ Override
137
+ public void onConnected (@ Nullable Bundle bundle ) {
141
138
142
- gph .UpdateQuest ();
143
139
}
144
140
145
141
private void ratingPrompt () {
@@ -153,18 +149,13 @@ private void ratingPrompt() {
153
149
AppRate .showRateDialogIfMeetsConditions (this );
154
150
}
155
151
156
- private void assignUIElements () {
157
- questContainer = (RelativeLayout ) findViewById (R .id .questContainer );
158
- }
159
-
160
152
public void startFirstTutorial () {
161
153
// Stage 1
162
154
findViewById (mainScroller ).scrollTo (0 , 0 );
163
155
164
156
TutorialHelper th = new TutorialHelper (this , Constants .STAGE_1_MAIN );
165
157
th .addTutorialNoOverlay (findViewById (R .id .visitors_container ), R .string .tutorialIntro , R .string .tutorialIntroText , false );
166
158
th .addTutorial (findViewById (R .id .coinCount ), R .string .tutorialCoins , R .string .tutorialCoinsText , false );
167
- th .addTutorial (findViewById (R .id .questContainer ), R .string .tutorialQuest , R .string .tutorialQuestText , false );
168
159
th .addTutorial (findViewById (R .id .currentLevel ), R .string .tutorialLevel , R .string .tutorialLevelText , false );
169
160
th .addTutorialRectangle (findViewById (R .id .visitors_container ), R .string .tutorialVisitor , R .string .tutorialVisitorText , true );
170
161
th .start ();
@@ -437,7 +428,6 @@ public void run() {
437
428
ToastHelper .showToast (null , ToastHelper .LONG , String .format (getString (R .string .visitorsArriving ), newVisitors ), true );
438
429
}
439
430
DisplayHelper .updateBonusChest ((ImageView ) activity .findViewById (R .id .bonus_chest ));
440
- gph .UpdateQuest ();
441
431
handler .postDelayed (this , DateHelper .MILLISECONDS_IN_SECOND * 10 );
442
432
}
443
433
};
@@ -579,14 +569,6 @@ public void openBuyCoins(View view) {
579
569
startActivity (new Intent (this , BuyCoinsActivity .class ).addFlags (Intent .FLAG_ACTIVITY_BROUGHT_TO_FRONT ));
580
570
}
581
571
582
- public void openQuests (View view ) {
583
- if (GooglePlayHelper .mGoogleApiClient .isConnected ()) {
584
- startActivity (new Intent (this , QuestActivity .class ).addFlags (Intent .FLAG_ACTIVITY_BROUGHT_TO_FRONT ));
585
- } else {
586
- ToastHelper .showErrorToast (null , ToastHelper .LONG , getString (R .string .questsNoConnection ), false );
587
- }
588
- }
589
-
590
572
public void openMessages (View view ) {
591
573
Intent intent = new Intent (this , MessagesActivity .class );
592
574
intent .addFlags (Intent .FLAG_ACTIVITY_NEW_TASK );
@@ -622,13 +604,6 @@ public void clickBookcase(View view) {
622
604
prefs .edit ().putInt ("nextTip" , ++thisTip ).apply ();
623
605
}
624
606
625
- @ Override
626
- public void onConnected (Bundle connectionHint ) {
627
- if (GooglePlayHelper .IsConnected ()) {
628
- Games .Quests .registerQuestUpdateListener (GooglePlayHelper .mGoogleApiClient , this );
629
- }
630
- }
631
-
632
607
@ Override
633
608
public void onConnectionFailed (ConnectionResult connectionResult ) {
634
609
GooglePlayHelper .ConnectionFailed (this , connectionResult );
@@ -639,10 +614,6 @@ public void onConnectionSuspended(int i) {
639
614
GooglePlayHelper .mGoogleApiClient .connect ();
640
615
}
641
616
642
- public void onQuestCompleted (Quest quest ) {
643
- ToastHelper .showPositiveToast (null , ToastHelper .LONG , GooglePlayHelper .CompleteQuest (quest ), true );
644
- }
645
-
646
617
protected void onActivityResult (int requestCode , int resultCode , Intent intent ) {
647
618
GooglePlayHelper .ActivityResult (this , requestCode , resultCode );
648
619
}
0 commit comments