Example usage for android.app ProgressDialog dismiss

List of usage examples for android.app ProgressDialog dismiss

Introduction

In this page you can find the example usage for android.app ProgressDialog dismiss.

Prototype

@Override
public void dismiss() 

Source Link

Document

Dismiss this dialog, removing it from the screen.

Usage

From source file:com.softminds.matrixcalculator.OperationFragments.ExponentFragment.java

public void RunAndGetResult(final int pos, final int exponent, final ProgressDialog progressDialog) {
    Runnable runnable = new Runnable() {
        @Override//from  w w w .jav a  2s .c o m
        public void run() {
            MatrixV2 res = new MatrixV2(
                    ((GlobalValues) getActivity().getApplication()).GetCompleteList().get(pos)
                            .getNumberOfRows(),
                    ((GlobalValues) getActivity().getApplication()).GetCompleteList().get(pos)
                            .getNumberOfCols(),
                    ((GlobalValues) getActivity().getApplication()).GetCompleteList().get(pos).getType());
            res.cloneFrom(((GlobalValues) getActivity().getApplication()).GetCompleteList().get(pos));
            res.raisedToPower(exponent);
            progressDialog.dismiss();
            Message message = new Message();
            message.setData(res.getDataBundled());
            handler.sendMessage(message);
        }
    };
    Thread thread = new Thread(runnable);
    thread.start();
}

From source file:com.gikoo5.hyphenate.ui.SettingsFragment.java

void logout() {
    final ProgressDialog pd = new ProgressDialog(getActivity());
    String st = getResources().getString(R.string.Are_logged_out);
    pd.setMessage(st);/*  w  ww  .  j a  v a2  s .  com*/
    pd.setCanceledOnTouchOutside(false);
    pd.show();
    EMHelper.getInstance().logout(false, new EMCallBack() {

        @Override
        public void onSuccess() {
            getActivity().runOnUiThread(new Runnable() {
                public void run() {
                    pd.dismiss();
                    // ??
                    ((MainActivity) getActivity()).finish();
                    startActivity(new Intent(getActivity(), LoginActivity.class));

                }
            });
        }

        @Override
        public void onProgress(int progress, String status) {

        }

        @Override
        public void onError(int code, String message) {
            getActivity().runOnUiThread(new Runnable() {

                @Override
                public void run() {
                    // TODO Auto-generated method stub
                    pd.dismiss();
                    Toast.makeText(getActivity(), "unbind devicetokens failed", Toast.LENGTH_SHORT).show();

                }
            });
        }
    });
}

From source file:nl.eduvpn.app.fragment.ProviderSelectionFragment.java

/**
 * Starts connecting to an API provider.
 *
 * @param instance The instance to connect to.
 *//*w w  w  . j av  a2s .  c om*/
private void _connectToApi(final Instance instance) {
    DiscoveredAPI discoveredAPI = _historyService.getCachedDiscoveredAPI(instance.getSanitizedBaseURI());
    // If there's only a discovered API, initiate the connection
    if (discoveredAPI != null) {
        Log.d(TAG, "Cached discovered API found.");
        _connectionService.initiateConnection(getActivity(), instance, discoveredAPI);
        return;
    }
    // If no discovered API, fetch it first, then initiate the connection for the login
    Log.d(TAG, "No cached discovered API found, continuing with discovery.");
    final ProgressDialog dialog = ProgressDialog.show(getContext(), getString(R.string.progress_dialog_title),
            getString(R.string.api_discovery_message), true);
    // Discover the API
    _apiService.getJSON(instance.getSanitizedBaseURI() + Constants.API_DISCOVERY_POSTFIX, null,
            new APIService.Callback<JSONObject>() {
                @Override
                public void onSuccess(JSONObject result) {
                    try {
                        DiscoveredAPI discoveredAPI = _serializerService.deserializeDiscoveredAPI(result);
                        dialog.dismiss();
                        // Cache the result
                        _historyService.cacheDiscoveredAPI(instance.getSanitizedBaseURI(), discoveredAPI);
                        _connectionService.initiateConnection(getActivity(), instance, discoveredAPI);
                    } catch (SerializerService.UnknownFormatException ex) {
                        Log.e(TAG, "Error parsing discovered API!", ex);
                        ErrorDialog.show(getContext(), R.string.error_dialog_title, ex.toString());
                        dialog.dismiss();
                    }
                }

                @Override
                public void onError(String errorMessage) {
                    dialog.dismiss();
                    Log.e(TAG, "Error while fetching discovered API: " + errorMessage);
                    ErrorDialog.show(getContext(), R.string.error_dialog_title, errorMessage);
                }
            });
}

From source file:cn.xcom.helper.chat.ui.SettingsFragment.java

void logout() {
    final ProgressDialog pd = new ProgressDialog(getActivity());
    String st = getResources().getString(R.string.Are_logged_out);
    pd.setMessage(st);/*from  w ww.  j  a  va 2s. co m*/
    pd.setCanceledOnTouchOutside(false);
    pd.show();
    DemoHelper.getInstance().logout(false, new EMCallBack() {

        @Override
        public void onSuccess() {
            getActivity().runOnUiThread(new Runnable() {
                public void run() {
                    pd.dismiss();
                    // show login screen
                    ((MainActivity) getActivity()).finish();
                    startActivity(new Intent(getActivity(), LoginActivity.class));

                }
            });
        }

        @Override
        public void onProgress(int progress, String status) {

        }

        @Override
        public void onError(int code, String message) {
            getActivity().runOnUiThread(new Runnable() {

                @Override
                public void run() {
                    // TODO Auto-generated method stub
                    pd.dismiss();
                    Toast.makeText(getActivity(), "unbind devicetokens failed", Toast.LENGTH_SHORT).show();
                }
            });
        }
    });
}

From source file:com.jackpan.TaiwanpetadoptionApp.HeadpageActivity.java

protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
            WindowManager.LayoutParams.FLAG_FULLSCREEN);//    
    requestWindowFeature(Window.FEATURE_NO_TITLE);// ?APP
    setContentView(R.layout.activity_headpage);
    ConnectivityManager conManager = (ConnectivityManager) getSystemService(CONNECTIVITY_SERVICE);
    NetworkInfo networInfo = conManager.getActiveNetworkInfo();

    if (networInfo == null || !networInfo.isAvailable()) {
        new AlertDialog.Builder(HeadpageActivity.this).setTitle(getString(R.string.Network_status))
                .setMessage(getString(R.string.no_network)).setCancelable(false)
                .setPositiveButton(getString(R.string.setting), new DialogInterface.OnClickListener() {

                    @Override/*from w  w w .j  a  v  a 2 s.c o  m*/
                    public void onClick(DialogInterface dialog, int which) {
                        // TODO Auto-generated method stub
                        Intent settintIntent = new Intent(android.provider.Settings.ACTION_SETTINGS);
                        startActivity(settintIntent);

                    }
                }).setNegativeButton(getString(R.string.cancel), new DialogInterface.OnClickListener() {

                    @Override
                    public void onClick(DialogInterface dialog, int which) {
                        // TODO Auto-generated method stub
                        HeadpageActivity.this.finish();
                    }
                }).show();

    } else {
        final ProgressDialog progressDialog = ProgressDialog.show(HeadpageActivity.this,
                getString(R.string.Network_in), getString(R.string.waitting));
        final Handler handler = new Handler();
        final Runnable runnable = new Runnable() {

            @Override
            public void run() {
                // TODO Auto-generated method stub
                new AlertDialog.Builder(HeadpageActivity.this);

                progressDialog.dismiss();

            }
        };

        Thread thread = new Thread() {

            @Override
            public void run() {
                try {
                    Thread.sleep(1500);
                } catch (InterruptedException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }
                handler.post(runnable);
            }
        };
        thread.start();

    }

    final TextView test = (TextView) findViewById(R.id.textView1);
    Timer timer = new Timer();

    TimerTask task = new TimerTask() {
        public void run() {
            runOnUiThread(new Runnable() {
                public void run() {
                    if (change) {
                        change = false;
                        test.setTextColor(Color.TRANSPARENT); // ?
                    } else {
                        change = true;
                        test.setTextColor(Color.DKGRAY);
                    }
                }
            });
        }
    };
    timer.schedule(task, 1, 800); // ?(timer???)

    mHelper = new IabHelper(this, getString(R.string.my_license_key));
    mHelper.startSetup(new IabHelper.OnIabSetupFinishedListener() {
        public void onIabSetupFinished(IabResult result) {
            if (!result.isSuccess()) {

                MySharedPrefernces.saveIsBuyed(HeadpageActivity.this, false);
            } else {

                MySharedPrefernces.saveIsBuyed(HeadpageActivity.this, false);
                mHelper.queryInventoryAsync(mGotInventoryListener);
            }

        }
    });

    GetButtonView();
    setButtonEvent();
    buildGoogleApiClient();

}

From source file:cn.ucai.superwechat.ui.SettingsActivity.java

void logout() {
    final ProgressDialog pd = new ProgressDialog(this);
    String st = getResources().getString(R.string.Are_logged_out);
    pd.setMessage(st);//w  w  w .j  a va  2  s  .  c  om
    pd.setCanceledOnTouchOutside(false);
    pd.show();
    SuperWeChatHelper.getInstance().logout(false, new EMCallBack() {

        @Override
        public void onSuccess() {
            runOnUiThread(new Runnable() {
                public void run() {
                    pd.dismiss();
                    //                show login screen
                    //               ExitAppUtils.getInstance().exit();
                    finish();
                    startActivity(new Intent(SettingsActivity.this, LoginActivity.class)
                            .setFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_NEW_TASK));

                }
            });
        }

        @Override
        public void onProgress(int progress, String status) {

        }

        @Override
        public void onError(int code, String message) {
            runOnUiThread(new Runnable() {

                @Override
                public void run() {
                    // TODO Auto-generated method stub
                    pd.dismiss();
                    Toast.makeText(SettingsActivity.this, "unbind devicetokens failed", Toast.LENGTH_SHORT)
                            .show();
                }
            });
        }
    });
}

From source file:com.easemob.qixin.activity.SettingsFragment.java

void logout() {
    final ProgressDialog pd = new ProgressDialog(getActivity());
    String st = getResources().getString(R.string.Are_logged_out);
    pd.setMessage(st);/*  w  w  w . j  a  v a 2s. c om*/
    pd.setCanceledOnTouchOutside(false);
    pd.show();
    DemoApplication.getInstance().logout(new EMCallBack() {

        @Override
        public void onSuccess() {
            getActivity().runOnUiThread(new Runnable() {
                public void run() {
                    pd.dismiss();
                    // ??
                    ((MainActivity) getActivity()).finish();
                    startActivity(new Intent(getActivity(), LoginActivity.class));

                }
            });
        }

        @Override
        public void onProgress(int progress, String status) {

        }

        @Override
        public void onError(int code, String message) {

        }
    });
}

From source file:cn.ucai.chatuidemo.activity.SettingsFragment.java

void logout() {
    final ProgressDialog pd = new ProgressDialog(getActivity());
    String st = getResources().getString(R.string.Are_logged_out);
    pd.setMessage(st);/*  w w  w  . j  av  a  2  s .c o  m*/
    pd.setCanceledOnTouchOutside(false);
    pd.show();
    DemoHXSDKHelper.getInstance().logout(true, new EMCallBack() {

        @Override
        public void onSuccess() {
            getActivity().runOnUiThread(new Runnable() {
                public void run() {
                    pd.dismiss();
                    // ??
                    ((MainActivity) getActivity()).finish();
                    startActivity(new Intent(getActivity(), LoginActivity.class));

                }
            });
        }

        @Override
        public void onProgress(int progress, String status) {

        }

        @Override
        public void onError(int code, String message) {
            getActivity().runOnUiThread(new Runnable() {

                @Override
                public void run() {
                    // TODO Auto-generated method stub
                    pd.dismiss();
                    Toast.makeText(getActivity(), "unbind devicetokens failed", Toast.LENGTH_SHORT).show();

                }
            });
        }
    });
}

From source file:com.easemob.chatuidemo.activity.SettingsFragment.java

void logout() {
    final ProgressDialog pd = new ProgressDialog(getActivity());
    String st = getResources().getString(R.string.Are_logged_out);
    pd.setMessage(st);/*from  w  w  w  .j a  v a2  s  .c o m*/
    pd.setCanceledOnTouchOutside(false);
    pd.show();
    DemoApplication.getInstance().logout(new EMCallBack() {

        @Override
        public void onSuccess() {
            getActivity().runOnUiThread(new Runnable() {
                @Override
                public void run() {
                    pd.dismiss();
                    // ??
                    ((MainActivity) getActivity()).finish();
                    startActivity(new Intent(getActivity(), LoginActivity.class));

                }
            });
        }

        @Override
        public void onProgress(int progress, String status) {

        }

        @Override
        public void onError(int code, String message) {

        }
    });
}

From source file:com.eason.marker.emchat.chatuidemo.activity.SettingsFragment.java

void logout() {
    final ProgressDialog pd = new ProgressDialog(getActivity());
    String st = getResources().getString(R.string.Are_logged_out);
    pd.setMessage(st);//from   w  w w. ja v a 2 s  . com
    pd.setCanceledOnTouchOutside(false);
    pd.show();
    DemoHXSDKHelper.getInstance().logout(true, new EMCallBack() {

        @Override
        public void onSuccess() {
            getActivity().runOnUiThread(new Runnable() {
                public void run() {
                    pd.dismiss();
                    // ??
                    ((EMChatMainActivity) getActivity()).finish();
                    startActivity(new Intent(getActivity(), EMChatLoginActivity.class));

                }
            });
        }

        @Override
        public void onProgress(int progress, String status) {

        }

        @Override
        public void onError(int code, String message) {
            getActivity().runOnUiThread(new Runnable() {

                @Override
                public void run() {
                    // TODO Auto-generated method stub
                    pd.dismiss();
                    Toast.makeText(getActivity(), "unbind devicetokens failed", Toast.LENGTH_SHORT).show();

                }
            });
        }
    });
}