Certain kinds of notifications now take you to list activity

pull/14/head
Sam Bosley 13 years ago
parent 0de393e4c3
commit 9f1d7175d9

@ -326,6 +326,7 @@ public class C2DMReceiver extends BroadcastReceiver {
Intent launchIntent = new Intent();
launchIntent.putExtra(TaskListActivity.TOKEN_FILTER, filter);
launchIntent.setComponent(filter.customTaskList);
filter.customExtras.putBoolean(TagViewActivity.TOKEN_START_ACTIVITY, shouldLaunchActivity(intent));
launchIntent.putExtras(filter.customExtras);
return launchIntent;
@ -334,6 +335,21 @@ public class C2DMReceiver extends BroadcastReceiver {
}
}
private boolean shouldLaunchActivity(Intent intent) {
if(intent.hasExtra("type")) {
String type = intent.getStringExtra("type");
if("f".equals(type)) return true;
if("s".equals(type)) return false;
if("l".equals(type)) return false;
} else {
String message = intent.getStringExtra("alert");
if(message.contains(" finished ")) return true;
if(message.contains(" invited you to ")) return false;
if(message.contains(" sent you ")) return false;
}
return true;
}
private void handleRegistration(Intent intent) {
String registration = intent.getStringExtra("registration_id");
if (intent.getStringExtra("error") != null) {

@ -141,6 +141,7 @@ public class TagUpdatesActivity extends ListActivity {
});
refreshUpdatesList();
refreshActivity(null); // start a pull in the background
}
private void refreshUpdatesList() {
@ -193,18 +194,7 @@ public class TagUpdatesActivity extends ListActivity {
case MENU_REFRESH_ID: {
final ProgressDialog progressDialog = DialogUtilities.progressDialog(this, getString(R.string.DLG_please_wait));
actFmSyncService.fetchUpdatesForTag(tagData, true, new Runnable() {
@Override
public void run() {
runOnUiThread(new Runnable() {
@Override
public void run() {
refreshUpdatesList();
DialogUtilities.dismissDialog(TagUpdatesActivity.this, progressDialog);
}
});
}
});
refreshActivity(progressDialog);
return true;
}
@ -212,6 +202,22 @@ public class TagUpdatesActivity extends ListActivity {
}
}
private void refreshActivity(final ProgressDialog progressDialog) {
actFmSyncService.fetchUpdatesForTag(tagData, true, new Runnable() {
@Override
public void run() {
runOnUiThread(new Runnable() {
@Override
public void run() {
refreshUpdatesList();
if (progressDialog != null)
DialogUtilities.dismissDialog(TagUpdatesActivity.this, progressDialog);
}
});
}
});
}
@SuppressWarnings("nls")
private void addComment() {
if(tagData.getValue(TagData.REMOTE_ID) == 0L)

@ -71,6 +71,8 @@ public class TagViewActivity extends TaskListActivity {
private static final int REQUEST_CODE_SETTINGS = 0;
public static final String TOKEN_START_ACTIVITY = "startActivity";
private TagData tagData;
@Autowired TagDataService tagDataService;
@ -232,6 +234,20 @@ public class TagViewActivity extends TaskListActivity {
setUpMembersGallery();
super.onNewIntent(intent);
if (intent.getBooleanExtra(TOKEN_START_ACTIVITY, false)) {
findViewById(R.id.activity).postDelayed(new Runnable() {
@Override
public void run() {
Intent i = new Intent(TagViewActivity.this, TagUpdatesActivity.class);
i.putExtra(EXTRA_TAG_DATA, tagData);
startActivity(i);
AndroidUtilities.callApiMethod(5, TagViewActivity.this, "overridePendingTransition", //$NON-NLS-1$
new Class<?>[] { Integer.TYPE, Integer.TYPE },
R.anim.slide_left_in, R.anim.slide_left_out);
}
}, 500);
}
}
@Override

Loading…
Cancel
Save