Search in sources :

Example 81 with ProgressDialog

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;
}
Also used : ProgressDialog(android.app.ProgressDialog) MotionEvent(android.view.MotionEvent)

Example 82 with ProgressDialog

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();
}
Also used : AlertDialog(android.app.AlertDialog) DialogInterface(android.content.DialogInterface) AsyncTask(android.os.AsyncTask) ProgressDialog(android.app.ProgressDialog)

Example 83 with ProgressDialog

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);
            }
        }
    });
}
Also used : EditText(android.widget.EditText) PasswordTransformationMethod(android.text.method.PasswordTransformationMethod) HandlerThread(android.os.HandlerThread) Button(android.widget.Button) Handler(android.os.Handler) Intent(android.content.Intent) ProgressDialog(android.app.ProgressDialog) View(android.view.View) WebView(android.webkit.WebView)

Example 84 with ProgressDialog

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();
    }
}
Also used : Intent(android.content.Intent) ProgressDialog(android.app.ProgressDialog) View(android.view.View) WebView(android.webkit.WebView)

Example 85 with ProgressDialog

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;
        }
    });
}
Also used : DialogInterface(android.content.DialogInterface) Handler(android.os.Handler) ProgressDialog(android.app.ProgressDialog) KeyEvent(android.view.KeyEvent) LinearLayout(android.widget.LinearLayout) Display(android.view.Display)

Aggregations

ProgressDialog (android.app.ProgressDialog)266 DialogInterface (android.content.DialogInterface)47 Intent (android.content.Intent)23 View (android.view.View)21 File (java.io.File)19 TextView (android.widget.TextView)13 SuppressLint (android.annotation.SuppressLint)12 Handler (android.os.Handler)12 FrameLayout (android.widget.FrameLayout)12 ArrayList (java.util.ArrayList)12 IOException (java.io.IOException)11 JSONObject (org.json.JSONObject)10 Uri (android.net.Uri)9 LinearLayout (android.widget.LinearLayout)9 OnCancelListener (android.content.DialogInterface.OnCancelListener)8 Display (android.view.Display)8 Activity (android.app.Activity)7 Dialog (android.app.Dialog)7 ImageView (android.widget.ImageView)7 List (java.util.List)7