Search in sources :

Example 71 with ProgressDialog

use of android.app.ProgressDialog in project Bitocle by mthli.

the class SplashActivity method showSignInDialog.

private void showSignInDialog() {
    AlertDialog.Builder builder = new AlertDialog.Builder(SplashActivity.this);
    LinearLayout layout = (LinearLayout) getLayoutInflater().inflate(R.layout.splash_dialog, null);
    final EditText userText = (EditText) layout.findViewById(R.id.splash_sign_in_dialog_username);
    final EditText passText = (EditText) layout.findViewById(R.id.splash_sign_in_dialog_password);
    passText.setTypeface(Typeface.DEFAULT);
    passText.setTransformationMethod(new PasswordTransformationMethod());
    builder.setView(layout);
    builder.setPositiveButton(getString(R.string.splash_sign_in_dialog_ok), new DialogInterface.OnClickListener() {

        @Override
        public void onClick(DialogInterface dialog, int which) {
            username = userText.getText().toString();
            password = passText.getText().toString();
            if (username.length() == 0 || password.length() == 0) {
                Toast.makeText(SplashActivity.this, R.string.splash_input_error, Toast.LENGTH_SHORT).show();
            } else {
                progress = new ProgressDialog(SplashActivity.this);
                progress.setMessage(getString(R.string.splash_sign_in_authenticating));
                progress.setCancelable(false);
                progress.show();
                HandlerThread thread = new HandlerThread(getString(R.string.splash_sign_in_thread));
                thread.start();
                Handler handler = new Handler(thread.getLooper());
                handler.post(signInThread);
            }
        }
    });
    builder.setNegativeButton(getString(R.string.splash_sign_in_dialog_cancel), new DialogInterface.OnClickListener() {

        @Override
        public void onClick(DialogInterface dialog, int which) {
        /* Do nothing */
        }
    });
    builder.show();
}
Also used : AlertDialog(android.app.AlertDialog) EditText(android.widget.EditText) DialogInterface(android.content.DialogInterface) Handler(android.os.Handler) ProgressDialog(android.app.ProgressDialog) PasswordTransformationMethod(android.text.method.PasswordTransformationMethod) HandlerThread(android.os.HandlerThread) LinearLayout(android.widget.LinearLayout)

Example 72 with ProgressDialog

use of android.app.ProgressDialog in project Rashr by DsLNeXuS.

the class FlashFragment method showUnifiedBuildsDialog.

/**
     * Check if Device uses a Unified base like some Galaxy S4: htle, htltespr htltexx uses the same
     * sources so they can use the unified kernels and recoveries. Let the User choice which one is
     * the correct for him. PLEASE BE CAREFUL!
     */
public void showUnifiedBuildsDialog() {
    final AppCompatDialog UnifiedBuildsDialog = new AppCompatDialog(mContext);
    UnifiedBuildsDialog.setTitle(R.string.make_choice);
    final ArrayList<String> DevName = new ArrayList<>();
    ArrayList<String> DevNamesCarriers = new ArrayList<>();
    UnifiedBuildsDialog.setContentView(R.layout.dialog_unified_build);
    ListView UnifiedList = (ListView) UnifiedBuildsDialog.findViewById(R.id.lvUnifiedList);
    ArrayAdapter<String> UnifiedAdapter = new ArrayAdapter<>(mContext, android.R.layout.simple_list_item_1, DevNamesCarriers);
    if (UnifiedList != null) {
        UnifiedList.setAdapter(UnifiedAdapter);
        UnifiedList.setOnItemClickListener(new AdapterView.OnItemClickListener() {

            @Override
            public void onItemClick(AdapterView<?> parent, View view, final int position, long id) {
                UnifiedBuildsDialog.dismiss();
                final ProgressDialog reloading = new ProgressDialog(mContext);
                reloading.setMessage(mContext.getString(R.string.reloading));
                reloading.setCancelable(false);
                reloading.show();
                new Thread(new Runnable() {

                    @Override
                    public void run() {
                        Common.setBooleanPref(mContext, Const.PREF_NAME, Const.PREF_KEY_SHOW_UNIFIED, false);
                        RashrApp.DEVICE.setName(DevName.get(position));
                        RashrApp.DEVICE.loadRecoveryList();
                        mActivity.runOnUiThread(new Runnable() {

                            @Override
                            public void run() {
                                reloading.dismiss();
                                mActivity.switchTo(FlashFragment.newInstance(mActivity));
                            }
                        });
                    }
                }).start();
            }
        });
    }
    if (RashrApp.DEVICE.getManufacture().equals("samsung")) {
        String[] unifiedGalaxyS3 = { "d2lte", "d2att", "d2cri", "d2mtr", "d2spr", "d2tmo", "d2usc", "d2vzw" };
        String[] unifiedGalaxyNote3 = { "hlte", "hltespr", "hltetmo", "hltevzw", "htlexx" };
        String[] unifiedGalaxyS4 = { "jflte", "jflteatt", "jfltecan", "jfltecri", "jfltecsp", "jfltespr", "jfltetmo", "jflteusc", "jfltevzw", "jfltexx", "jgedlte" };
        String[] unifiedGalaxyNote4 = { "trlte", "trltecan", "trltedt", "trltexx", "trltespr", "trltetmo", "trltevzw", "trlteusc" };
        if (Common.stringEndsWithArray(RashrApp.DEVICE.getName(), unifiedGalaxyS3)) {
            DevName.addAll(Arrays.asList(unifiedGalaxyS3));
        } else if (Common.stringEndsWithArray(RashrApp.DEVICE.getName(), unifiedGalaxyS3)) {
            DevName.addAll(Arrays.asList(unifiedGalaxyNote3));
        } else if (Common.stringEndsWithArray(RashrApp.DEVICE.getName(), unifiedGalaxyS4)) {
            DevName.addAll(Arrays.asList(unifiedGalaxyS4));
        } else if (Common.stringEndsWithArray(RashrApp.DEVICE.getName(), unifiedGalaxyNote4)) {
            DevName.addAll(Arrays.asList(unifiedGalaxyNote4));
        }
    }
    if (RashrApp.DEVICE.getManufacture().equals("motorola")) {
        String[] unifiedMsm8960 = { "moto_msm8960" };
        if (RashrApp.DEVICE.getBOARD().equals("msm8960")) {
            DevName.addAll(Arrays.asList(unifiedMsm8960));
        }
    }
    for (String i : DevName) {
        if (i.contains("att")) {
            DevNamesCarriers.add(i + " (AT&T Mobility)");
        } else if (i.contains("can")) {
            DevNamesCarriers.add(i + " (Canada)");
        } else if (i.contains("cri")) {
            DevNamesCarriers.add(i + " (Cricket Wireless)");
        } else if (i.contains("csp")) {
            DevNamesCarriers.add(i + " (C Spire Wireless)");
        } else if (i.contains("mtr")) {
            DevNamesCarriers.add(i + " (MetroPCS)");
        } else if (i.contains("spr")) {
            DevNamesCarriers.add(i + " (Sprint Corporation)");
        } else if (i.contains("tmo")) {
            DevNamesCarriers.add(i + " (T-Mobile US)");
        } else if (i.contains("usc")) {
            DevNamesCarriers.add(i + " (U.S. Cellular)");
        } else if (i.contains("vzw")) {
            DevNamesCarriers.add(i + " (Verizon Wireless)");
        } else if (i.contains("xx")) {
            DevNamesCarriers.add(i + " (International)");
        } else if (i.contains("ged")) {
            DevNamesCarriers.add(i + " (Google Play Edition)");
        } else if (i.contains("dt")) {
            DevNamesCarriers.add(i + " (India)");
        } else {
            DevNamesCarriers.add(i + " (Unified)");
        }
    }
    AppCompatButton KeepCurrent = (AppCompatButton) UnifiedBuildsDialog.findViewById(R.id.bKeepCurrent);
    if (KeepCurrent != null) {
        KeepCurrent.setText(String.format(getString(R.string.keep_current_name), RashrApp.DEVICE.getName()));
        KeepCurrent.setOnClickListener(new View.OnClickListener() {

            @Override
            public void onClick(View v) {
                Common.setBooleanPref(mContext, Const.PREF_NAME, Const.PREF_KEY_SHOW_UNIFIED, false);
                UnifiedBuildsDialog.dismiss();
            }
        });
    }
    if (DevName.size() > 0) {
        UnifiedBuildsDialog.show();
        UnifiedBuildsDialog.setOnCancelListener(new DialogInterface.OnCancelListener() {

            @Override
            public void onCancel(DialogInterface dialog) {
                Common.setBooleanPref(mContext, Const.PREF_NAME, Const.PREF_KEY_SHOW_UNIFIED, false);
            }
        });
    }
}
Also used : DialogInterface(android.content.DialogInterface) ArrayList(java.util.ArrayList) ProgressDialog(android.app.ProgressDialog) View(android.view.View) AdapterView(android.widget.AdapterView) AbsListView(android.widget.AbsListView) ListView(android.widget.ListView) SuppressLint(android.annotation.SuppressLint) AppCompatButton(android.support.v7.widget.AppCompatButton) AbsListView(android.widget.AbsListView) ListView(android.widget.ListView) AppCompatDialog(android.support.v7.app.AppCompatDialog) AdapterView(android.widget.AdapterView) ArrayAdapter(android.widget.ArrayAdapter)

Example 73 with ProgressDialog

use of android.app.ProgressDialog in project XobotOS by xamarin.

the class ExternalStorageFormatter method updateProgressDialog.

public void updateProgressDialog(int msg) {
    if (mProgressDialog == null) {
        mProgressDialog = new ProgressDialog(this);
        mProgressDialog.setIndeterminate(true);
        mProgressDialog.setCancelable(false);
        mProgressDialog.getWindow().setType(WindowManager.LayoutParams.TYPE_SYSTEM_ALERT);
        mProgressDialog.show();
    }
    mProgressDialog.setMessage(getText(msg));
}
Also used : ProgressDialog(android.app.ProgressDialog)

Example 74 with ProgressDialog

use of android.app.ProgressDialog in project Android by WilliamYi96.

the class MainActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    Button button = (Button) findViewById(R.id.button);
    editText = (EditText) findViewById(R.id.edit_text);
    imageView = (ImageView) findViewById(R.id.image_view);
    progressBar = (ProgressBar) findViewById(R.id.progress_bar);
    //get the string of EditText and then toast it
    button.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            switch((v.getId())) {
                case R.id.button:
                    String inputText = editText.getText().toString();
                    Toast.makeText(MainActivity.this, inputText, Toast.LENGTH_SHORT).show();
                    break;
                default:
                    break;
            }
        }
    });
    //change the picture when button is clicked
    button.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            switch(v.getId()) {
                case R.id.button:
                    imageView.setImageResource(R.drawable.img_2);
                    break;
                default:
                    break;
            }
        }
    });
    //dynamic progress bar(visible or not)
    button.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            switch(v.getId()) {
                case R.id.button:
                    if (progressBar.getVisibility() == View.GONE) {
                        progressBar.setVisibility(View.VISIBLE);
                    } else {
                        progressBar.setVisibility(View.GONE);
                    }
                    break;
                default:
                    break;
            }
        }
    });
    //dynamic progress bar(increasing numbers)
    button.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            switch(v.getId()) {
                case R.id.button:
                    int progress = progressBar.getProgress();
                    progress = progress + 10;
                    progressBar.setProgress(progress);
                    break;
                default:
                    break;
            }
        }
    });
    //alert dialog
    button.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            switch(v.getId()) {
                case R.id.button:
                    AlertDialog.Builder dialog = new AlertDialog.Builder(MainActivity.this);
                    dialog.setTitle("This is dialog");
                    dialog.setMessage("Something important.");
                    //dialog.setCancelable(false);
                    dialog.setCancelable(true);
                    dialog.setPositiveButton("OK", new DialogInterface.OnClickListener() {

                        @Override
                        public void onClick(DialogInterface dialog, int which) {
                        }
                    });
                    dialog.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {

                        @Override
                        public void onClick(DialogInterface dialog, int which) {
                        }
                    });
                    dialog.show();
                    break;
                default:
                    break;
            }
        }
    });
    button.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            switch(v.getId()) {
                case R.id.button:
                    ProgressDialog progressDialog = new ProgressDialog(MainActivity.this);
                    progressDialog.setTitle("This is ProgressDialog");
                    progressDialog.setMessage("Loading....");
                    progressDialog.setCancelable(true);
                    progressDialog.show();
                    break;
                default:
                    break;
            }
        }
    });
}
Also used : AlertDialog(android.support.v7.app.AlertDialog) Button(android.widget.Button) DialogInterface(android.content.DialogInterface) ProgressDialog(android.app.ProgressDialog) ImageView(android.widget.ImageView) View(android.view.View)

Example 75 with ProgressDialog

use of android.app.ProgressDialog in project priend by TakoJ.

the class BaseActivity method showProgressDialog.

public void showProgressDialog() {
    if (mProgressDialog == null) {
        mProgressDialog = new ProgressDialog(this);
        mProgressDialog.setCancelable(false);
        mProgressDialog.setMessage("Loading...");
    }
    mProgressDialog.show();
}
Also used : ProgressDialog(android.app.ProgressDialog)

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