53
53
54
54
import java .io .InputStream ;
55
55
import java .util .ArrayList ;
56
+ import java .util .HashMap ;
56
57
import java .util .List ;
58
+ import java .util .Map ;
57
59
58
60
import static com .skuares .studio .quest .UserProfile .getPath ;
59
61
@@ -79,6 +81,8 @@ public class CreateQuest extends AppCompatActivity{
79
81
80
82
LoadImageFromPath loadImageFromPath ;
81
83
84
+ private Map <String ,Object > participants ;
85
+
82
86
/*
83
87
Todos Dialg layout
84
88
*/
@@ -137,6 +141,7 @@ protected void onCreate(Bundle savedInstanceState) {
137
141
loadImageFromPath = new LoadImageFromPath (this );
138
142
// initialize the list
139
143
todosList = new ArrayList <ToDo >();
144
+
140
145
// reference
141
146
questImageAdd = (ImageView )findViewById (R .id .questImageAdd );
142
147
questUserImageAdd = (ImageView )findViewById (R .id .questUserImageAdd );
@@ -149,6 +154,10 @@ protected void onCreate(Bundle savedInstanceState) {
149
154
150
155
// get user
151
156
if (MainActivity .myUser != null ){
157
+ // initialize the todo map and get it ready
158
+ participants = new HashMap <String , Object >();
159
+ participants .put (MainActivity .uid ,false );
160
+
152
161
userQuest = MainActivity .myUser ;
153
162
154
163
// get user image and get usernamse
@@ -175,6 +184,9 @@ public void onClick(View v) {
175
184
questDesc = questDescriptionAdd .getText ().toString ();
176
185
questTitle = questTitleAdd .getText ().toString ();
177
186
187
+ /*
188
+
189
+ */
178
190
// check list
179
191
if (todosList == null || todosList .size () == 0 ){
180
192
Toast .makeText (CreateQuest .this ,"You must add a todos" ,Toast .LENGTH_LONG ).show ();
@@ -203,6 +215,11 @@ public void onClick(View v) {
203
215
return ;
204
216
}
205
217
218
+ // done validating take the user to the next page
219
+
220
+
221
+ //
222
+
206
223
// we need to meausre the cost
207
224
double sumMoney = 0 ;
208
225
int hours = 0 ;
@@ -250,63 +267,6 @@ public void onClick(View v) {
250
267
251
268
}
252
269
253
- /*
254
-
255
- protected synchronized void buildGoogleApiClient() {
256
- mGoogleApiClient = new GoogleApiClient.Builder(this)
257
- .addConnectionCallbacks(this)
258
- .addOnConnectionFailedListener(this)
259
- .addApi(LocationServices.API)
260
- .addApi(Places.GEO_DATA_API)
261
- .build();
262
- }
263
-
264
- @Override
265
- public void onConnected(Bundle bundle) {
266
- Toast.makeText(this, "Connection true",Toast.LENGTH_SHORT).show();
267
- }
268
-
269
- @Override
270
- public void onConnectionSuspended(int i) {
271
- Toast.makeText(this, "Connection Suspended",Toast.LENGTH_SHORT).show();
272
- }
273
-
274
- @Override
275
- public void onConnectionFailed(ConnectionResult connectionResult) {
276
- Toast.makeText(this, "Connection Failed",Toast.LENGTH_SHORT).show();
277
-
278
- }
279
- */
280
-
281
-
282
- /*
283
- @Override
284
- protected void onStart() {
285
- super.onStart();
286
-
287
- if (!mGoogleApiClient.isConnected() && !mGoogleApiClient.isConnecting()){
288
- Log.v("Google API","Connecting");
289
- mGoogleApiClient.connect();
290
- }
291
- }
292
-
293
- @Override
294
- protected void onPause() {
295
- if(mGoogleApiClient.isConnected()){
296
- Log.v("Google API","Dis-Connecting");
297
- mGoogleApiClient.disconnect();
298
- }
299
- super.onPause();
300
- }
301
-
302
- @Override
303
- protected void onResume() {
304
- super.onResume();
305
-
306
- }
307
- */
308
-
309
-
310
270
311
271
312
272
class GetCompressedImageThenSave extends AsyncTask <Object ,Void ,Bitmap >{
@@ -549,16 +509,21 @@ public void onClick(View v) {
549
509
String time = addTimeDialog .getText ().toString ();
550
510
String money = addMoneyDialog .getText ().toString ();
551
511
512
+
513
+
552
514
if (desc .equals ("" ) || time .equals ("" ) || money .equals ("" )){
553
515
Toast .makeText (CreateQuest .this ,"Please Fill In The Fields" ,Toast .LENGTH_SHORT ).show ();
554
516
return ;
555
517
}
556
518
519
+
520
+
557
521
double moneys = Double .parseDouble (money );
558
522
// create a to--do object
559
523
APlace aPlace1 = aPlace [0 ];
560
- if (aPlace1 != null ){
561
- toDo = new ToDo (desc ,time ,moneys ,aPlace1 );
524
+ if (aPlace1 != null && participants != null ){
525
+
526
+ toDo = new ToDo (desc ,time ,moneys ,aPlace1 ,participants ,0 ); // usersFinishedThisTodo 0 by default
562
527
// add it to the list
563
528
todosList .add (toDo );
564
529
// call adapter
0 commit comments