public void changeCursorAndColumns(
     Cursor paramCursor, String[] paramArrayOfString, int[] paramArrayOfInt) {
   mOriginalFrom = paramArrayOfString;
   mTo = paramArrayOfInt;
   super.changeCursor(paramCursor);
   findColumns(mOriginalFrom);
 }
  /** Cache columns. */
  @Override
  public void changeCursor(Cursor c) {
    if (DBG) Log.d(LOG_TAG, "changeCursor(" + c + ")");

    if (mClosed) {
      Log.w(LOG_TAG, "Tried to change cursor after adapter was closed.");
      if (c != null) c.close();
      return;
    }

    try {
      super.changeCursor(c);

      if (c != null) {
        mText1Col = c.getColumnIndex(SearchManager.SUGGEST_COLUMN_TEXT_1);
        mText2Col = c.getColumnIndex(SearchManager.SUGGEST_COLUMN_TEXT_2);
        mText2UrlCol = c.getColumnIndex(SearchManager.SUGGEST_COLUMN_TEXT_2_URL);
        mIconName1Col = c.getColumnIndex(SearchManager.SUGGEST_COLUMN_ICON_1);
        mIconName2Col = c.getColumnIndex(SearchManager.SUGGEST_COLUMN_ICON_2);
        mFlagsCol = c.getColumnIndex(SearchManager.SUGGEST_COLUMN_FLAGS);
      }
    } catch (Exception e) {
      Log.e(LOG_TAG, "error changing cursor and caching columns", e);
    }
  }
  @Override
  public void notifyDataSetInvalidated() {
    if (DBG) Log.d(LOG_TAG, "notifyDataSetInvalidated");
    super.notifyDataSetInvalidated();

    updateSpinnerState(getCursor());
  }
  @Override
  public void notifyDataSetChanged() {
    if (DBG) Log.d(LOG_TAG, "notifyDataSetChanged");
    super.notifyDataSetChanged();

    // mSearchView.onDataSetChanged(); // TODO:

    updateSpinnerState(getCursor());
  }
  /** Set up action bar navigation list and listener callbacks */
  private void setupActionBarNavigation() {
    // set up spinner adapter for navigation list
    Cursor accountsCursor = mAccountsDbAdapter.fetchAllRecordsOrderedByFullName();

    SpinnerAdapter mSpinnerAdapter =
        new QualifiedAccountNameCursorAdapter(
            getSupportActionBar().getThemedContext(),
            R.layout.sherlock_spinner_item,
            accountsCursor);
    ((ResourceCursorAdapter) mSpinnerAdapter)
        .setDropDownViewResource(R.layout.sherlock_spinner_dropdown_item);
    ActionBar actionBar = getSupportActionBar();
    actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_LIST);
    actionBar.setListNavigationCallbacks(mSpinnerAdapter, mTransactionListNavigationListener);
    actionBar.setDisplayHomeAsUpEnabled(true);

    updateNavigationSelection();
  }
Пример #6
0
 public void changeCursorAndColumns(Cursor cursor, String as[], int ai[]) {
   mOriginalFrom = as;
   mTo = ai;
   super.changeCursor(cursor);
   findColumns(mOriginalFrom);
 }