use of android.app.TimePickerDialog in project android_frameworks_base by ResurrectionRemix.
the class TimeDialogActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
FrameLayout layout = new FrameLayout(this);
Button b = new Button(this);
b.setLayoutParams(new FrameLayout.LayoutParams(FrameLayout.LayoutParams.WRAP_CONTENT, FrameLayout.LayoutParams.WRAP_CONTENT, Gravity.CENTER));
b.setText("Show dialog");
b.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
new TimePickerDialog(TimeDialogActivity.this, null, 12, 12, true).show();
}
});
layout.addView(b);
setContentView(layout);
}
use of android.app.TimePickerDialog in project android_frameworks_base by crdroidandroid.
the class TimeDialogActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
FrameLayout layout = new FrameLayout(this);
Button b = new Button(this);
b.setLayoutParams(new FrameLayout.LayoutParams(FrameLayout.LayoutParams.WRAP_CONTENT, FrameLayout.LayoutParams.WRAP_CONTENT, Gravity.CENTER));
b.setText("Show dialog");
b.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
new TimePickerDialog(TimeDialogActivity.this, null, 12, 12, true).show();
}
});
layout.addView(b);
setContentView(layout);
}
use of android.app.TimePickerDialog in project android_packages_apps_Settings by LineageOS.
the class NightDisplaySettings method onCreateDialog.
@Override
public Dialog onCreateDialog(final int dialogId) {
if (dialogId == DIALOG_START_TIME || dialogId == DIALOG_END_TIME) {
final LocalTime initialTime;
if (dialogId == DIALOG_START_TIME) {
initialTime = mController.getCustomStartTime();
} else {
initialTime = mController.getCustomEndTime();
}
final Context context = getContext();
final boolean use24HourFormat = android.text.format.DateFormat.is24HourFormat(context);
return new TimePickerDialog(context, new TimePickerDialog.OnTimeSetListener() {
@Override
public void onTimeSet(TimePicker view, int hourOfDay, int minute) {
final LocalTime time = LocalTime.of(hourOfDay, minute);
if (dialogId == DIALOG_START_TIME) {
mController.setCustomStartTime(time);
} else {
mController.setCustomEndTime(time);
}
}
}, initialTime.getHour(), initialTime.getMinute(), use24HourFormat);
}
return super.onCreateDialog(dialogId);
}
use of android.app.TimePickerDialog in project instructure-android by instructure.
the class TimePickerFragment method onCreateDialog.
@Override
@NonNull
public Dialog onCreateDialog(Bundle savedInstanceState) {
// Use the current time as the default values for the picker
final Calendar c = Calendar.getInstance();
int hour = c.get(Calendar.HOUR_OF_DAY);
int minute = c.get(Calendar.MINUTE);
// Create a new instance of TimePickerDialog and return it
return new TimePickerDialog(getActivity(), this, hour, minute, DateFormat.is24HourFormat(getActivity()));
}
use of android.app.TimePickerDialog in project IITB-App by wncc.
the class AddEventFragment method onCreateView.
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
container.removeAllViews();
view = inflater.inflate(R.layout.fragment_add_event, container, false);
ButterKnife.bind(this, view);
eventPictureImageView = view.findViewById(R.id.ib_eventImage);
progressDialog = new ProgressDialog(getContext());
cb_permission.setVisibility(View.GONE);
cb_public.setVisibility(View.GONE);
et_mapLocation.setVisibility(View.GONE);
close.setVisibility(View.GONE);
open.setVisibility(View.VISIBLE);
start.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Calendar calendar = Calendar.getInstance();
int mYear = calendar.get(Calendar.YEAR);
int mMonth = calendar.get(Calendar.MONTH);
int mDay = calendar.get(Calendar.DAY_OF_MONTH);
final int mHour = calendar.get(Calendar.HOUR_OF_DAY);
final int mMin = calendar.get(Calendar.MINUTE);
long millis = calendar.getTimeInMillis();
DatePickerDialog datePickerDialog = new DatePickerDialog(getContext(), new DatePickerDialog.OnDateSetListener() {
@Override
public void onDateSet(DatePicker view, final int year, final int month, final int dayOfMonth) {
TimePickerDialog timePickerDialog = new TimePickerDialog(getContext(), new TimePickerDialog.OnTimeSetListener() {
@Override
public void onTimeSet(TimePicker view, int hourOfDay, int minute) {
start.setText(dayOfMonth + "/" + month + "/" + year + " " + hourOfDay + ":" + minute);
}
}, mHour, mMin, true);
timePickerDialog.show();
}
}, mYear, mMonth, mDay);
datePickerDialog.show();
timestamp_start = new Timestamp(millis);
}
});
end.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Calendar calendar = Calendar.getInstance();
int mYear = calendar.get(Calendar.YEAR);
int mMonth = calendar.get(Calendar.MONTH);
int mDay = calendar.get(Calendar.DAY_OF_MONTH);
final int mHour = calendar.get(Calendar.HOUR_OF_DAY);
final int mMin = calendar.get(Calendar.MINUTE);
long millis = calendar.getTimeInMillis();
DatePickerDialog datePickerDialog = new DatePickerDialog(getContext(), new DatePickerDialog.OnDateSetListener() {
@Override
public void onDateSet(DatePicker view, final int year, final int month, final int dayOfMonth) {
TimePickerDialog timePickerDialog = new TimePickerDialog(getContext(), new TimePickerDialog.OnTimeSetListener() {
@Override
public void onTimeSet(TimePicker view, int hourOfDay, int minute) {
end.setText(dayOfMonth + "/" + month + "/" + year + " " + hourOfDay + ":" + minute);
}
}, mHour, mMin, true);
timePickerDialog.show();
}
}, mYear, mMonth, mDay);
datePickerDialog.show();
timestamp_end = new Timestamp(millis);
}
});
if (cb_permission.isChecked()) {
publicStatus = 1;
} else
publicStatus = 0;
advancedMenu.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (cb_public.getVisibility() == View.VISIBLE) {
open.setVisibility(View.VISIBLE);
close.setVisibility(View.GONE);
cb_permission.setVisibility(View.GONE);
cb_public.setVisibility(View.GONE);
et_mapLocation.setVisibility(View.GONE);
} else {
close.setVisibility(View.VISIBLE);
open.setVisibility(View.GONE);
cb_permission.setVisibility(View.VISIBLE);
cb_public.setVisibility(View.VISIBLE);
et_mapLocation.setVisibility(View.VISIBLE);
}
}
});
imageButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (ContextCompat.checkSelfPermission(getContext(), Manifest.permission.READ_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) {
// Permission is not granted
ActivityCompat.requestPermissions(getActivity(), new String[] { Manifest.permission.READ_EXTERNAL_STORAGE }, MY_PERMISSIONS_REQUEST_READ_EXTERNAL_STORAGE);
return;
}
Intent i = new Intent(Intent.ACTION_PICK, android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
startActivityForResult(i, RESULT_LOAD_IMAGE);
}
});
createEvent.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
progressDialog.setIndeterminate(true);
progressDialog.setCancelable(false);
progressDialog.show();
sendImage();
}
});
return view;
}
Aggregations