use of android.text.format.DateFormat in project Awful.apk by Awful.
the class ImgurInserter method onCreateDialog.
@NonNull
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
FragmentActivity activity = getActivity();
dateFormat = DateFormat.getDateFormat(activity);
timeFormat = DateFormat.getTimeFormat(activity);
View layout = activity.getLayoutInflater().inflate(R.layout.insert_imgur_dialog, null);
bind(this, layout);
AlertDialog dialog = new AlertDialog.Builder(activity).setTitle(R.string.imgur_uploader_dialog_title).setView(layout).setPositiveButton(R.string.imgur_uploader_ok_button, null).setNegativeButton(R.string.cancel, (dialogInterface, i) -> dismiss()).show();
// get the dialog's 'upload' positive button so we can enable and disable it
// setting the click listener directly prevents the dialog from dismissing, so the upload can run
uploadButton = dialog.getButton(AlertDialog.BUTTON_POSITIVE);
uploadButton.setOnClickListener(view -> startUpload());
// TODO: 05/06/2017 is that method guaranteed to be fired when the system creates the spinner and sets the first item?
updateUploadType();
updateRemainingUploads();
return dialog;
}
use of android.text.format.DateFormat in project UltimateAndroid by cymcsg.
the class PublishedActivity method takePhoto.
// public void photo() {
// Intent openCameraIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
// File file = new File(Environment.getExternalStorageDirectory()
// + "/myimage/", String.valueOf(System.currentTimeMillis())
// + ".jpg");
// path = file.getPath();
// Uri imageUri = Uri.fromFile(file);
// openCameraIntent.putExtra(MediaStore.EXTRA_OUTPUT, imageUri);
// startActivityForResult(openCameraIntent, TAKE_PICTURE);
// }
/**
* 调用系统相机
*/
public void takePhoto() {
// 调用系统相机
Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
new DateFormat();
String name = DateFormat.format("yyyyMMdd_hhmmss", Calendar.getInstance(Locale.CHINA)) + ".jpg";
Uri imageUri = Uri.fromFile(new File(PATH, name));
path = PATH + "/" + name;
intent.putExtra(MediaStore.EXTRA_OUTPUT, imageUri);
startActivityForResult(intent, TAKE_PICTURE);
}
Aggregations