Ejemplo n.º 1
0
  @Override
  public void onLoadFinished(Loader<Cursor> loader, Cursor cursor) {
    // getting a null pointer exception here

    Log.d(TAG, "Content loaded: " + cursor.getCount());
    listAdapter.swapCursor(cursor);
  }
Ejemplo n.º 2
0
 @Override
 public void bindView(View view, Context context, Cursor cursor) {
   super.bindView(view, context, cursor);
   TextView setup = (TextView) view.findViewById(R.id.text3);
   TextView reply = (TextView) view.findViewById(R.id.text4);
   locationCursor.moveToPosition(cursor.getPosition());
   long rt = locationCursor.getLong(1);
   if (rt > 0) {
     Calendar cal = Calendar.getInstance();
     cal.setTimeInMillis(rt);
     DateFormat sdf = SimpleDateFormat.getDateTimeInstance();
     setup.setText("requested on: " + sdf.format(cal.getTime()));
   } else {
     setup.setText("requested on: <not available>");
   }
   rt = locationCursor.getLong(2);
   if (rt > 0) {
     Calendar cal = Calendar.getInstance();
     cal.setTimeInMillis(rt);
     DateFormat sdf = SimpleDateFormat.getDateTimeInstance();
     reply.setText("updated on:" + sdf.format(cal.getTime()));
     ((ImageView) view.findViewById(R.id.status))
         .setImageResource(android.R.drawable.presence_online);
   } else {
     reply.setText("updated on: <not available>");
   }
 }
Ejemplo n.º 3
0
 void showDetails(int pos) {
   Cursor c = (Cursor) listAdapter.getItem(pos);
   showDetails(
       ContactContract.OBJECT_CONTACT_URI
           .buildUpon()
           .appendPath(c.getString(c.getColumnIndex(ContactContract.Columns._ID)))
           .build());
 }
Ejemplo n.º 4
0
  void resolveConflict(int pos) {
    if (BuildConfig.DEBUG) {
      Log.d(TAG, "resolve conflicts");
    }

    Cursor c = (Cursor) listAdapter.getItem(pos);

    int di = c.getColumnIndex(WebData.Object.WD_DATA_ID);
    String dataID = c.getString(di);
    resolveConflict(dataID);
  }
Ejemplo n.º 5
0
    @Override
    public void bindView(View view, Context context, final Cursor cursor) {
      boolean inConflict = WebData.Object.inConflict(cursor);

      if (inConflict) {
        view.setBackgroundResource(R.color.conflicted);
      } else {
        view.setBackgroundResource(android.R.color.black);
      }

      super.bindView(view, context, cursor);
    }
Ejemplo n.º 6
0
 @Override
 public void onLoadComplete(Loader<Cursor> loader, Cursor data) {
   if (data != null) {
     cSearchResult = data;
     adapterSearchResult =
         new SimpleCursorAdapter(
             getActivity(),
             R.layout.item_card,
             cSearchResult,
             new String[] {"name", "sCardType"},
             new int[] {R.id.tvCardName, R.id.tvCardType},
             CursorAdapter.FLAG_REGISTER_CONTENT_OBSERVER);
   }
   if (getActivity() != null) {
     lvCards.setAdapter(adapterSearchResult);
     tvListNoCard.setVisibility(adapterSearchResult.getCount() == 0 ? View.VISIBLE : View.GONE);
     tvListNoCard.setText(R.string.deck_nocard);
   }
 }
Ejemplo n.º 7
0
 @Override
 public void onLoaderReset(Loader<Cursor> loader) {
   listAdapter.swapCursor(null);
 }