|
|
@ -1,7 +1,10 @@
|
|
|
|
package com.todoroo.astrid.activity;
|
|
|
|
package com.todoroo.astrid.activity;
|
|
|
|
|
|
|
|
|
|
|
|
import android.app.Activity;
|
|
|
|
import android.app.Activity;
|
|
|
|
|
|
|
|
import android.content.BroadcastReceiver;
|
|
|
|
|
|
|
|
import android.content.Context;
|
|
|
|
import android.content.Intent;
|
|
|
|
import android.content.Intent;
|
|
|
|
|
|
|
|
import android.content.IntentFilter;
|
|
|
|
import android.os.Bundle;
|
|
|
|
import android.os.Bundle;
|
|
|
|
import android.support.v4.app.ActionBar;
|
|
|
|
import android.support.v4.app.ActionBar;
|
|
|
|
import android.support.v4.app.Fragment;
|
|
|
|
import android.support.v4.app.Fragment;
|
|
|
@ -22,6 +25,8 @@ import com.todoroo.andlib.utility.AndroidUtilities;
|
|
|
|
import com.todoroo.astrid.actfm.ActFmLoginActivity;
|
|
|
|
import com.todoroo.astrid.actfm.ActFmLoginActivity;
|
|
|
|
import com.todoroo.astrid.actfm.TagSettingsActivity;
|
|
|
|
import com.todoroo.astrid.actfm.TagSettingsActivity;
|
|
|
|
import com.todoroo.astrid.actfm.TagUpdatesFragment;
|
|
|
|
import com.todoroo.astrid.actfm.TagUpdatesFragment;
|
|
|
|
|
|
|
|
import com.todoroo.astrid.actfm.TagViewFragment;
|
|
|
|
|
|
|
|
import com.todoroo.astrid.api.AstridApiConstants;
|
|
|
|
import com.todoroo.astrid.api.Filter;
|
|
|
|
import com.todoroo.astrid.api.Filter;
|
|
|
|
import com.todoroo.astrid.api.FilterListItem;
|
|
|
|
import com.todoroo.astrid.api.FilterListItem;
|
|
|
|
import com.todoroo.astrid.reminders.NotificationFragment;
|
|
|
|
import com.todoroo.astrid.reminders.NotificationFragment;
|
|
|
@ -47,6 +52,8 @@ public class TaskListActivity extends AstridActivity implements MainMenuListener
|
|
|
|
private FragmentPopover commentsPopover;
|
|
|
|
private FragmentPopover commentsPopover;
|
|
|
|
private MainMenuPopover mainMenuPopover;
|
|
|
|
private MainMenuPopover mainMenuPopover;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private final TagDeletedReceiver tagDeletedReceiver = new TagDeletedReceiver();
|
|
|
|
|
|
|
|
|
|
|
|
private final OnClickListener mainMenuClickListener = new OnClickListener() {
|
|
|
|
private final OnClickListener mainMenuClickListener = new OnClickListener() {
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public void onClick(View v) {
|
|
|
|
public void onClick(View v) {
|
|
|
@ -276,6 +283,12 @@ public class TaskListActivity extends AstridActivity implements MainMenuListener
|
|
|
|
lists.setText(title);
|
|
|
|
lists.setText(title);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
protected void onResume() {
|
|
|
|
|
|
|
|
super.onResume();
|
|
|
|
|
|
|
|
registerReceiver(tagDeletedReceiver, new IntentFilter(AstridApiConstants.BROADCAST_EVENT_TAG_DELETED));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
protected void onPause() {
|
|
|
|
protected void onPause() {
|
|
|
|
super.onPause();
|
|
|
|
super.onPause();
|
|
|
@ -289,6 +302,13 @@ public class TaskListActivity extends AstridActivity implements MainMenuListener
|
|
|
|
commentsPopover.dismiss();
|
|
|
|
commentsPopover.dismiss();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
protected void onStop() {
|
|
|
|
|
|
|
|
super.onStop();
|
|
|
|
|
|
|
|
System.err.println("Unregistering");
|
|
|
|
|
|
|
|
unregisterReceiver(tagDeletedReceiver);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void setSelectedItem(Filter item) {
|
|
|
|
public void setSelectedItem(Filter item) {
|
|
|
|
lists.setText(item.title);
|
|
|
|
lists.setText(item.title);
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -365,4 +385,19 @@ public class TaskListActivity extends AstridActivity implements MainMenuListener
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private class TagDeletedReceiver extends BroadcastReceiver {
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
public void onReceive(Context context, Intent intent) {
|
|
|
|
|
|
|
|
String deletedTag = intent.getStringExtra(TagViewFragment.EXTRA_TAG_NAME);
|
|
|
|
|
|
|
|
String currentlyShowing = getIntent().getStringExtra(TagViewFragment.EXTRA_TAG_NAME);
|
|
|
|
|
|
|
|
if (currentlyShowing != null && currentlyShowing.equals(deletedTag)) {
|
|
|
|
|
|
|
|
FilterListFragment fl = getFilterListFragment();
|
|
|
|
|
|
|
|
if (fl != null) {
|
|
|
|
|
|
|
|
fl.switchToActiveTasks();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|