use of android.app.ProgressDialog in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class ApnSettings method onCreateDialog.
@Override
public Dialog onCreateDialog(int id) {
if (id == DIALOG_RESTORE_DEFAULTAPN) {
ProgressDialog dialog = new ProgressDialog(getActivity()) {
public boolean onTouchEvent(MotionEvent event) {
return true;
}
};
dialog.setMessage(getResources().getString(R.string.restore_default_apn));
dialog.setCancelable(false);
return dialog;
}
return null;
}
use of android.app.ProgressDialog in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class Helpers method showSystemUIrestartDialog.
public static void showSystemUIrestartDialog(Activity a) {
final AlertDialog.Builder builder = new AlertDialog.Builder(a);
builder.setTitle(R.string.systemui_restart_title);
builder.setMessage(R.string.systemui_restart_message);
builder.setPositiveButton(R.string.print_restart, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
AsyncTask<Void, Void, Void> task = new AsyncTask<Void, Void, Void>() {
@Override
protected void onPreExecute() {
ProgressDialog dialog = new ProgressDialog(a);
dialog.setMessage(a.getResources().getString(R.string.restarting_ui));
dialog.setCancelable(false);
dialog.setIndeterminate(true);
dialog.show();
}
@Override
protected Void doInBackground(Void... params) {
// Give the user a second to see the dialog
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
// Ignore
}
// Restart the UI
CMDProcessor.startSuCommand("pkill -f com.android.systemui");
a.finish();
return null;
}
};
task.execute();
}
});
builder.setNegativeButton(android.R.string.cancel, null);
builder.show();
}
use of android.app.ProgressDialog in project Bitocle by mthli.
the class LoginActivity method onCreate.
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.login);
/*
* 检测用户登陆状态
*
* 如果SharedPreferences中存在用户信息,
* 则说明用户已经登陆,此时直接跳转到MainActivity即可;
* 否则进入登陆界面
*/
sharedPreferences = getSharedPreferences(getString(R.string.login_sp), MODE_PRIVATE);
String oAuth = sharedPreferences.getString(getString(R.string.login_sp_oauth), null);
if (oAuth != null) {
Intent intent = new Intent(LoginActivity.this, MainActivity.class);
intent.putExtra(getString(R.string.login_intent), false);
startActivity(intent);
finish();
}
getActionBar().setDisplayShowHomeEnabled(false);
final EditText userText = (EditText) findViewById(R.id.login_username);
final EditText passText = (EditText) findViewById(R.id.login_password);
/* 保持EditText字体的一致性 */
passText.setTypeface(Typeface.DEFAULT);
passText.setTransformationMethod(new PasswordTransformationMethod());
Button button = (Button) findViewById(R.id.login_button);
button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
username = userText.getText().toString();
password = passText.getText().toString();
/* 给出相应的错误提示 */
if (username.length() == 0 && password.length() == 0) {
SuperToast.create(LoginActivity.this, getString(R.string.login_message_miss_both), SuperToast.Duration.SHORT, Style.getStyle(Style.RED)).show();
} else if (username.length() != 0 && password.length() == 0) {
SuperToast.create(LoginActivity.this, getString(R.string.login_message_miss_password), SuperToast.Duration.SHORT, Style.getStyle(Style.RED)).show();
} else if (username.length() == 0 && password.length() != 0) {
SuperToast.create(LoginActivity.this, getString(R.string.login_message_miss_username), SuperToast.Duration.SHORT, Style.getStyle(Style.RED)).show();
} else {
/* ProgressDialog显示当前正在运行的状态 */
progressDialog = new ProgressDialog(LoginActivity.this);
progressDialog.setMessage(getString(R.string.login_message_authoring));
progressDialog.setCancelable(false);
progressDialog.show();
/* 开启新的线程用于认证 */
HandlerThread handlerThread = new HandlerThread(getString(R.string.login_thread));
handlerThread.start();
Handler handler = new Handler(handlerThread.getLooper());
handler.post(authorizationThread);
}
}
});
}
use of android.app.ProgressDialog in project android-app-common-tasks by multidots.
the class LinkedInActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.asn_activity_oauth);
View view = findViewById(R.id.progress_container);
view.setVisibility(View.GONE);
Intent intent = getIntent();
APIKEY = intent.getStringExtra("APIKEY");
APISECRET = intent.getStringExtra("APISECRET");
if (TextUtils.isEmpty(APIKEY) || TextUtils.isEmpty(APISECRET)) {
Common.showAlertDialog(this, "Linkedin", "Please pass APIKEY and APISECRET in intent extras", true);
setResult(RESULT_CANCELED);
finish();
} else {
progress = new ProgressDialog(this);
progress.setTitle("Loading...");
progress.setMessage("Please Wait...");
progress.show();
new OauthStart().execute();
}
}
use of android.app.ProgressDialog in project android-app-common-tasks by multidots.
the class SocialAuthDialog method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
handler = new Handler();
Util.getDisplayDpi(getContext());
mSpinner = new ProgressDialog(getContext());
mSpinner.requestWindowFeature(Window.FEATURE_NO_TITLE);
mSpinner.setMessage("Loading...");
mSpinner.setCancelable(true);
mContent = new LinearLayout(getContext());
mContent.setOrientation(LinearLayout.VERTICAL);
setUpTitle();
setUpWebView();
Display display = getWindow().getWindowManager().getDefaultDisplay();
final float scale = getContext().getResources().getDisplayMetrics().density;
int orientation = getContext().getResources().getConfiguration().orientation;
float[] dimensions = (orientation == Configuration.ORIENTATION_LANDSCAPE) ? DIMENSIONS_DIFF_LANDSCAPE : DIMENSIONS_DIFF_PORTRAIT;
addContentView(mContent, new LinearLayout.LayoutParams(display.getWidth() - ((int) (dimensions[0] * scale + 0.5f)), display.getHeight() - ((int) (dimensions[1] * scale + 0.5f))));
mSpinner.setOnCancelListener(new OnCancelListener() {
@Override
public void onCancel(DialogInterface dialogInterface) {
mWebView.stopLoading();
mListener.onBack();
SocialAuthDialog.this.dismiss();
}
});
this.setOnKeyListener(new OnKeyListener() {
@Override
public boolean onKey(DialogInterface dialog, int keyCode, KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_BACK && event.getAction() == KeyEvent.ACTION_DOWN) {
mWebView.stopLoading();
dismiss();
mListener.onBack();
return true;
}
return false;
}
});
}
Aggregations