private ContentValues tranValues(Transaction trans) {
   ContentValues newValue = new ContentValues();
   newValue.put("acct_id", trans.acct.ID);
   newValue.put("trans_id", trans.transID);
   newValue.put("serv_trans_id", trans.servTransID);
   newValue.put("type", trans.type);
   newValue.put("amt", trans.amt);
   newValue.put(
       "post_date", trans.postDate == null ? null : Long.toString(trans.postDate.getTime()));
   newValue.put(
       "init_date", trans.initDate == null ? null : Long.toString(trans.initDate.getTime()));
   newValue.put(
       "avail_date", trans.availDate == null ? null : Long.toString(trans.availDate.getTime()));
   return newValue;
 }
Beispiel #2
0
  @Override
  public void onDownloadProgress(DownloadProgressInfo progress) {
    mAverageSpeed.setText(
        getString(
            com.godot.game.R.string.kilobytes_per_second,
            Helpers.getSpeedString(progress.mCurrentSpeed)));
    mTimeRemaining.setText(
        getString(
            com.godot.game.R.string.time_remaining,
            Helpers.getTimeRemaining(progress.mTimeRemaining)));

    progress.mOverallTotal = progress.mOverallTotal;
    mPB.setMax((int) (progress.mOverallTotal >> 8));
    mPB.setProgress((int) (progress.mOverallProgress >> 8));
    mProgressPercent.setText(
        Long.toString(progress.mOverallProgress * 100 / progress.mOverallTotal) + "%");
    mProgressFraction.setText(
        Helpers.getDownloadProgressString(progress.mOverallProgress, progress.mOverallTotal));
  }
  private ContentValues acctValues(Account acct) {
    ContentValues newValue = new ContentValues();

    if (acct.service != null) {
      if (acct.service.ID != 0) newValue.put("service_id", acct.service.ID);
    } else {
      if (acct.serviceId != 0) newValue.put("service_id", acct.serviceId);
    }
    newValue.put("name", acct.name);
    newValue.put(
        "last_update", acct.lastUpdate == null ? null : Long.toString(acct.lastUpdate.getTime()));
    newValue.put("curbal_amt", acct.curBalAmt);
    newValue.put(
        "curbal_date", acct.curBalDate == null ? null : Long.toString(acct.curBalDate.getTime()));
    newValue.put("availbal_amt", acct.availBalAmt);
    newValue.put(
        "availbal_date",
        acct.availBalDate == null ? null : Long.toString(acct.availBalDate.getTime()));
    newValue.put(
        "last_trans", acct.lastTrans == null ? null : Long.toString(acct.lastTrans.getTime()));
    return newValue;
  }
  private void updatePhoto(Long rawContactId, byte[] photo) {

    ContentValues values = new ContentValues();
    values.put(ContactsContract.Contacts.Photo.PHOTO, photo);

    String selection =
        ContactsContract.RawContacts.Data.RAW_CONTACT_ID
            + "=? and "
            + ContactsContract.RawContacts.Data.MIMETYPE
            + "=?";
    String[] selectionArgs =
        new String[] {
          Long.toString(rawContactId), ContactsContract.CommonDataKinds.Photo.CONTENT_ITEM_TYPE
        };

    getContentResolver()
        .update(ContactsContract.Data.CONTENT_URI, values, selection, selectionArgs);
  }