Example usage for android.text.format Time format3339

List of usage examples for android.text.format Time format3339

Introduction

In this page you can find the example usage for android.text.format Time format3339.

Prototype

public String format3339(boolean allDay) 

Source Link

Document

Return a string in the RFC 3339 format.

Usage

From source file:Main.java

public static String getFormat3339ByDate(Date date, boolean isallDay) {
    Time time = new Time();
    time.set(date.getTime());//from  w  ww .ja v a  2 s .com
    return time.format3339(isallDay);
}

From source file:uk.co.alt236.floatinginfo.provider.generalinfo.GeneralInfoProvider.java

@Override
public void onLogShare() {
    final StringBuilder sb = new StringBuilder();
    sb.append(mUiManager.getSharePayload());

    final Time now = new Time();
    now.setToNow();//from w  w w  . ja v a2 s .  c  om

    final String ts = now.format3339(false);

    final Intent shareIntent = new Intent(Intent.ACTION_SEND);
    shareIntent.setType("text/plain");
    shareIntent.putExtra(Intent.EXTRA_TEXT, sb.toString());
    shareIntent.putExtra(Intent.EXTRA_SUBJECT, getString(R.string.share_subject) + " " + ts);
    shareIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    startActivity(shareIntent);
}

From source file:org.tomdroid.Note.java

public void setLastChangeDate(Time lastChangeDateTime) {
    this.lastChangeDate = lastChangeDateTime.format3339(false);
}

From source file:org.tomdroid.Note.java

public void setLastChangeDate() {
    Time now = new Time();
    now.setToNow();// ww w  . j ava 2s  .  co m
    String time = now.format3339(false);
    setLastChangeDate(time);
}

From source file:com.readystatesoftware.ghostlog.ServerlessLogScreen.java

@Override
public void onLogShare() {
    StringBuffer sb = new StringBuffer();
    for (LogLine line : mLogBufferFiltered) {
        sb.append(line.getRaw());//from   ww w .j  a  v a2  s .  c o  m
        sb.append("\n");
    }
    Time now = new Time();
    now.setToNow();
    String ts = now.format3339(false);

    Intent shareIntent = new Intent(Intent.ACTION_SEND);
    shareIntent.setType("text/plain");
    shareIntent.putExtra(Intent.EXTRA_TEXT, sb.toString());
    shareIntent.putExtra(Intent.EXTRA_SUBJECT, getString(R.string.share_subject) + " " + ts);
    shareIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    mContext.startActivity(shareIntent);
}

From source file:com.readystatesoftware.ghostlog.LogService.java

@Override
public void onLogShare() {
    StringBuffer sb = new StringBuffer();
    for (LogLine line : mLogBufferFiltered) {
        sb.append(line.getRaw());//from  w w  w .  ja v a 2 s .  c o m
        sb.append("\n");
    }
    Time now = new Time();
    now.setToNow();
    String ts = now.format3339(false);

    Intent shareIntent = new Intent(Intent.ACTION_SEND);
    shareIntent.setType("text/plain");
    shareIntent.putExtra(Intent.EXTRA_TEXT, sb.toString());
    shareIntent.putExtra(Intent.EXTRA_SUBJECT, getString(R.string.share_subject) + " " + ts);
    shareIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    startActivity(shareIntent);
}

From source file:org.tomdroid.sync.web.SnowySyncService.java

public void finishSync(boolean refresh) {

    // delete leftover local notes
    NoteManager.purgeDeletedNotes(activity);

    Time now = new Time();
    now.setToNow();//from  w  ww . java2s.co  m
    String nowString = now.format3339(false);
    Preferences.putString(Preferences.Key.LATEST_SYNC_DATE, nowString);
    Preferences.putLong(Preferences.Key.LATEST_SYNC_REVISION, latestRemoteRevision);

    setSyncProgress(100);
    if (refresh)
        sendMessage(PARSING_COMPLETE);
}

From source file:eu.liveGov.gordexola.urbanplanning.activities.MainActivity.java

@Override
public void anonymousUpdated() {

    logger.info("anonymousUpdated");
    PermissionHelper.addListener(this);

    if (_savedInstanceState == null) {
        new LogFileHelper().postLogFile(getApplicationContext());
        Time now = new Time();
        now.setToNow();/* w  w  w  .  j a v  a 2  s. co m*/
        logger.info("Starting the application... ({})", now.format3339(false));
        PermissionHelper ph = PermissionHelper.getInstance();
        ph.downloadPermissions(getBaseContext());

    } else {
        if (!PermissionHelper.isDownloading()) {
            loadFragmentsWithPermissions("startupApp");
        }
    }
    _savedInstanceState = null; // we don't need it anymore.

    if (pbarGeneral != null)
        pbarGeneral.setProgress(2);

}

From source file:com.nadmm.airports.DownloadActivity.java

protected void cleanupExpiredData() {
    SQLiteDatabase catalogDb = mDbManager.getCatalogDb();

    Time now = new Time();
    now.setToNow();/*from   w  w  w .j av  a2 s . co  m*/
    String today = now.format3339(true);

    Cursor c = mDbManager.getAllFromCatalog();
    if (c.moveToFirst()) {
        do {
            // Check and delete all the expired databases
            String end = c.getString(c.getColumnIndex(Catalog.END_DATE));
            if (end.compareTo(today) < 0) {
                // This database has expired, remove it
                Integer _id = c.getInt(c.getColumnIndex(Catalog._ID));
                String dbName = c.getString(c.getColumnIndex(Catalog.DB_NAME));
                File file = new File(DatabaseManager.DATABASE_DIR, dbName);
                if (catalogDb.isOpen() && file.delete()) {
                    // Now delete the catalog entry for the file
                    catalogDb.delete(Catalog.TABLE_NAME, Catalog._ID + "=?",
                            new String[] { Integer.toString(_id) });
                }
            }
        } while (c.moveToNext());
    }
    c.close();
}

From source file:com.tdispatch.passenger.fragment.ControlCenterFragment.java

/**[ BookingConfirmationDialogClickListener ]**********************************************************************/

@Override//from   w ww .  j  av a 2 s  . c o m
public void bookingConfirmed(LocationData pickup, LocationData dropoff, Long pickupMillis) {

    int maxDaysAhead = getResources().getInteger(R.integer.caboffice_settings_new_bookings_max_days_ahead);

    Boolean result = false;
    Boolean pickupMillisInvalid = false;
    String pickupMillisBodyId = "";

    if (pickupMillis != null) {
        Long diff = (pickupMillis - System.currentTimeMillis());

        if (diff > 0) {

            if (diff > (WebnetTools.MILLIS_PER_MINUTE * 5)) {
                if (diff < (WebnetTools.MILLIS_PER_DAY * maxDaysAhead)) {
                    //    keep it
                } else {
                    pickupMillisBodyId = getString(R.string.new_booking_pickup_date_too_ahead_body_fmt,
                            maxDaysAhead);
                    pickupMillisInvalid = true;
                }
            } else {
                pickupMillis = null;
            }

        } else {
            pickupMillisBodyId = getString(R.string.new_booking_pickup_date_already_passed);
            pickupMillisInvalid = true;
        }

    }

    if (pickupMillisInvalid == false) {
        if (mPickupAddress != null) {
            mCommonHostActivity.lockUI();

            // prepare booking
            try {
                AccountData user = TDApplication.getSessionManager().getAccountData();

                JSONObject json = new JSONObject();

                JSONObject passenger = new JSONObject();
                passenger.put("name", user.getFullName());
                passenger.put("phone", (user.getPhone() != null) ? user.getPhone() : "");
                passenger.put("email", (user.getEmail() != null) ? user.getEmail() : "");
                json.put("passenger", passenger);

                // pickup location
                json.put("pickup_location", pickup.toJSON());

                if (pickupMillis != null) {
                    Time t = new Time();
                    t.set(pickupMillis);

                    String timeStr = t.format3339(false).replace(".000+", "+"); // FIXME API BUG
                    json.put("pickup_time", timeStr);
                }

                // dropoff
                if (mDropoffAddress != null) {
                    json.put("dropoff_location", dropoff.toJSON());
                }

                json.put("passengers", 1);
                json.put("status", "incoming");

                WebnetTools.executeAsyncTask(new NewBookingAsyncTask(), json);

                result = true;

            } catch (Exception e) {
                e.printStackTrace();
            }

        } else {
            showDialog(GenericDialogFragment.DIALOG_TYPE_ERROR, R.string.dialog_error_title,
                    R.string.new_booking_no_pickup_location_body);
        }

    } else {
        showDialog(GenericDialogFragment.DIALOG_TYPE_ERROR, getString(R.string.dialog_error_title),
                pickupMillisBodyId);
    }

    if (result == false) {
        mCommonHostActivity.unlockUI();
    }

}