@@ -151,8 +151,10 @@ private void changeSignInSignOutOption() {
151
151
MenuItem sign_in_out_item = menu .findItem (R .id .nav_sign_in_out );
152
152
if (checkIfLoggedIn ()) {
153
153
sign_in_out_item .setTitle (R .string .sign_out );
154
+ sign_in_out_item .setIcon (this .getResources ().getDrawable (R .drawable .sign_out ));
154
155
} else {
155
156
sign_in_out_item .setTitle (R .string .sign_in );
157
+ sign_in_out_item .setIcon (this .getResources ().getDrawable (R .drawable .sign_in ));
156
158
}
157
159
}
158
160
@@ -247,27 +249,27 @@ public void onBackPressed() {
247
249
}
248
250
}
249
251
250
- @ Override
251
- public boolean onCreateOptionsMenu (Menu menu ) {
252
- // Inflate the menu; this adds items to the action bar if it is present.
253
- getMenuInflater ().inflate (R .menu .main , menu );
254
- return true ;
255
- }
256
-
257
- @ Override
258
- public boolean onOptionsItemSelected (MenuItem item ) {
259
- // Handle action bar item clicks here. The action bar will
260
- // automatically handle clicks on the Home/Up button, so long
261
- // as you specify a parent activity in AndroidManifest.xml.
262
- int id = item .getItemId ();
263
-
264
- //noinspection SimplifiableIfStatement
265
- if (id == R .id .action_settings ) {
266
- return true ;
267
- }
268
-
269
- return super .onOptionsItemSelected (item );
270
- }
252
+ // @Override
253
+ // public boolean onCreateOptionsMenu(Menu menu) {
254
+ // // Inflate the menu; this adds items to the action bar if it is present.
255
+ // getMenuInflater().inflate(R.menu.main, menu);
256
+ // return true;
257
+ // }
258
+ //
259
+ // @Override
260
+ // public boolean onOptionsItemSelected(MenuItem item) {
261
+ // // Handle action bar item clicks here. The action bar will
262
+ // // automatically handle clicks on the Home/Up button, so long
263
+ // // as you specify a parent activity in AndroidManifest.xml.
264
+ // int id = item.getItemId();
265
+ //
266
+ // //noinspection SimplifiableIfStatement
267
+ // if (id == R.id.action_settings) {
268
+ // return true;
269
+ // }
270
+ //
271
+ // return super.onOptionsItemSelected(item);
272
+ // }
271
273
272
274
@ SuppressWarnings ("StatementWithEmptyBody" )
273
275
@ Override
@@ -282,15 +284,38 @@ public boolean onNavigationItemSelected(MenuItem item) {
282
284
loadAddNewPrivyActivity ();
283
285
closeDrawer ();
284
286
} else if (id == R .id .nav_sign_in_out ) {
285
- if (checkIfLoggedIn ())
287
+ if (checkIfLoggedIn ()) {
286
288
signOut ();
287
- else
289
+ } else {
288
290
startGoogleSignInActivity (RC_SIGN_IN );
291
+ }
292
+ } else if (id == R .id .nav_share ) {
293
+ shareApp ();
294
+ closeDrawer ();
295
+ } else if (id == R .id .nav_feedback ) {
296
+ sendFeedBack ();
297
+ closeDrawer ();
289
298
}
290
- //TODO : Add other conditions
291
299
return true ;
292
300
}
293
301
302
+ private void sendFeedBack () {
303
+ Intent Email = new Intent (Intent .ACTION_SEND );
304
+ Email .setType ("text/email" );
305
+ Email .putExtra (Intent .EXTRA_EMAIL , new String []{getString (R .string .app_feedback_mail )});
306
+ Email .putExtra (Intent .EXTRA_SUBJECT , getString (R .string .feedback_subject ));
307
+ startActivity (Intent .createChooser (Email , getString (R .string .send_feedback_msg )));
308
+ }
309
+
310
+ private void shareApp () {
311
+ Intent sendIntent = new Intent ();
312
+ sendIntent .setAction (Intent .ACTION_SEND );
313
+ sendIntent .putExtra (Intent .EXTRA_TEXT ,
314
+ getString (R .string .social_share_msg ));
315
+ sendIntent .setType ("text/plain" );
316
+ startActivity (sendIntent );
317
+ }
318
+
294
319
private void closeDrawer () {
295
320
DrawerLayout drawer = (DrawerLayout ) findViewById (R .id .drawer_layout );
296
321
drawer .closeDrawer (GravityCompat .START );
@@ -367,7 +392,6 @@ private void handleSignInResult(GoogleSignInResult result) {
367
392
}
368
393
369
394
private void addLoginInfo (GoogleSignInAccount acct ) {
370
- // TODO : add Profile Picture
371
395
SharedPreferences .Editor editor = mSharedPreferences .edit ();
372
396
editor .putBoolean (LOGGED_IN , true );
373
397
if (acct .getDisplayName () != null )
0 commit comments