use of carbon.dialog.ProgressDialog in project Carbon by ZieIony.
the class ProgressDialogActivity method onCreate.
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
initToolbar();
EditText titleText = findViewById(R.id.titleText);
EditText messageText = findViewById(R.id.messageText);
EditText buttonText = findViewById(R.id.buttonText);
findViewById(R.id.showProgressDialog).setOnClickListener(view -> {
ProgressDialog dialog = new ProgressDialog(this);
if (titleText.length() > 0)
dialog.setTitle(titleText.getText());
if (buttonText.length() > 0)
dialog.addButton(buttonText.getText().toString(), null);
Handler handler = new Handler(Looper.getMainLooper());
Runnable dismissRunnable = dialog::dismiss;
dialog.setOnDismissListener(dialogInterface -> handler.removeCallbacks(dismissRunnable));
dialog.setText(messageText.getText());
dialog.show();
handler.postDelayed(dialog::dismiss, 2000);
});
}
Aggregations