Ejemplo n.º 1
0
  @Override
  protected void onResume() {
    super.onResume();

    IntentFilter intentFilter = new IntentFilter(BROADCAST_TAG_ACTIVITY);
    registerReceiver(notifyReceiver, intentFilter);
  }
Ejemplo n.º 2
0
  @Override
  public void loadTaskListContent(boolean requery) {
    super.loadTaskListContent(requery);
    int count = taskAdapter.getCursor().getCount();

    if (tagData != null
        && sortFlags <= SortHelper.FLAG_REVERSE_SORT
        && count != tagData.getValue(TagData.TASK_COUNT)) {
      tagData.setValue(TagData.TASK_COUNT, count);
      tagDataService.save(tagData);
    }
  }
Ejemplo n.º 3
0
  @Override
  protected void onNewIntent(Intent intent) {
    super.onNewIntent(intent);

    synchronized (this) {
      if (dataLoaded) return;
      dataLoaded = true;
    }

    String tag = getIntent().getStringExtra(EXTRA_TAG_NAME);
    long remoteId = getIntent().getLongExtra(EXTRA_TAG_REMOTE_ID, 0);

    if (tag == null && remoteId == 0) return;

    TodorooCursor<TagData> cursor =
        tagDataService.query(
            Query.select(TagData.PROPERTIES)
                .where(
                    Criterion.or(
                        TagData.NAME.eq(tag),
                        Criterion.and(TagData.REMOTE_ID.gt(0), TagData.REMOTE_ID.eq(remoteId)))));
    try {
      tagData = new TagData();
      if (cursor.getCount() == 0) {
        tagData.setValue(TagData.NAME, tag);
        tagData.setValue(TagData.REMOTE_ID, remoteId);
        tagDataService.save(tagData);
      } else {
        cursor.moveToFirst();
        tagData.readFromCursor(cursor);
      }
    } finally {
      cursor.close();
    }

    String fetchKey = LAST_FETCH_KEY + tagData.getId();
    long lastFetchDate = Preferences.getLong(fetchKey, 0);
    if (DateUtilities.now() > lastFetchDate + 300000L) {
      refreshData(false, false);
      Preferences.setLong(fetchKey, DateUtilities.now());
    }

    setUpUpdateList();
    setUpMemberPage();
  }
Ejemplo n.º 4
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    getListView().setOnKeyListener(null);

    // allow for text field entry, needed for android bug #2516
    OnTouchListener onTouch =
        new OnTouchListener() {
          @Override
          public boolean onTouch(View v, MotionEvent event) {
            v.requestFocusFromTouch();
            return false;
          }
        };
    ((EditText) findViewById(R.id.quickAddText)).setOnTouchListener(onTouch);
    ((EditText) findViewById(R.id.commentField)).setOnTouchListener(onTouch);

    if (getIntent().hasExtra(EXTRA_START_TAB))
      tabHost.setCurrentTab(getIntent().getIntExtra(EXTRA_START_TAB, 0));
  }
Ejemplo n.º 5
0
  @Override
  protected void onPause() {
    super.onPause();

    unregisterReceiver(notifyReceiver);
  }