private void sendResult(String callback, Date result, byte[] opaque) { this.setFieldsEnabled(false); long res = result == null ? 0 : result.getTime() / 1000; Logger.D(TAG, "Return result: " + res); DateTimePicker.callback(callback, res, opaque, result == null); finish(); }
@Override public void onReceivedSslError(WebView view, SslErrorHandler handler, SslError error) { if (RhoConf.getBool("no_ssl_verify_peer")) { Logger.D(TAG, "Skip SSL error."); handler.proceed(); } else { StringBuilder msg = new StringBuilder(); msg.append("SSL error - "); switch (error.getPrimaryError()) { case SslError.SSL_NOTYETVALID: msg.append("The certificate is not yet valid: "); break; case SslError.SSL_EXPIRED: msg.append("The certificate has expired: "); break; case SslError.SSL_IDMISMATCH: msg.append("Hostname mismatch: "); break; case SslError.SSL_UNTRUSTED: msg.append("The certificate authority is not trusted: "); break; } msg.append(error.getCertificate().toString()); Logger.W(TAG, msg.toString()); handler.cancel(); } }
public static ParcelFileDescriptor openParcelFd(String path) { forceFile(path); try { Logger.D(TAG, "Opening file from file system: " + absolutePath(path)); File file = new File(path); return ParcelFileDescriptor.open(file, ParcelFileDescriptor.MODE_READ_ONLY); } catch (FileNotFoundException e) { Logger.E(TAG, "Can not open ParcelFileDescriptor" + e.getMessage()); return null; } }
public static FileDescriptor openFd(String path) { forceFile(path); try { Logger.D(TAG, "Opening file from file system: " + absolutePath(path)); FileInputStream fs = new FileInputStream(absolutePath(path)); return fs.getFD(); } catch (Exception e) { Logger.E(TAG, "Can not open file descriptor: " + e.getMessage()); return null; } }
@Override public void onCreate(Bundle icicle) { super.onCreate(icicle); Logger.D(TAG, "onCreate"); getWindow().setFlags(RhodesService.WINDOW_FLAGS, RhodesService.WINDOW_MASK); setContentView(AndroidR.layout.datetime); Bundle extras = this.getIntent().getExtras(); _callback = extras.getString(INTENT_EXTRA_PREFIX + "callback"); _init = new Date(extras.getLong(INTENT_EXTRA_PREFIX + "init") * 1000); _fmt = extras.getInt(INTENT_EXTRA_PREFIX + "fmt"); _opaque = extras.getByteArray(INTENT_EXTRA_PREFIX + "opaque"); this.setTitle(extras.getString(INTENT_EXTRA_PREFIX + "title")); _datePicker = (DatePicker) findViewById(AndroidR.id.datePicker); _timePicker = (TimePicker) findViewById(AndroidR.id.timePicker); _okButton = (Button) findViewById(AndroidR.id.okButton); _cancelButton = (Button) findViewById(AndroidR.id.cancelButton); _okButton.setOnClickListener(mOkListener); _cancelButton.setOnClickListener(mCancelListener); _datePicker.init(_init.getYear() + 1900, _init.getMonth(), _init.getDay(), null); _timePicker.setCurrentHour(_init.getHours()); _timePicker.setCurrentMinute(_init.getMinutes()); switch (_fmt) { case FORMAT_DATE: _timePicker.setVisibility(View.INVISIBLE); break; case FORMAT_TIME: _datePicker.setVisibility(View.INVISIBLE); break; case FORMAT_DATE_TIME: break; } }
private static void forceFile(String path) { String relPath = makeRelativePath(path); if (copy(relPath)) Logger.D(TAG, "File extracted from package to file system: " + path); }