Search in sources :

Example 31 with DialogInterface

use of android.content.DialogInterface in project AnimeTaste by daimajia.

the class LoadActivity method onCreate.

protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    mContext = this;
    google_bug();
    ActiveAndroid.setLoggingEnabled(false);
    ShareSDK.initSDK(mContext);
    updateFromOldVersion();
    setContentView(R.layout.activity_load);
    MobclickAgent.onError(this);
    if (PreferenceManager.getDefaultSharedPreferences(mContext).getBoolean("only_wifi", true) && !NetworkUtils.isWifiConnected(mContext)) {
        AlertDialog.Builder builder = new AlertDialog.Builder(mContext).setTitle(R.string.only_wifi_title).setMessage(R.string.only_wifi_body);
        builder.setCancelable(false);
        builder.setPositiveButton(R.string.only_wifi_ok, new OnClickListener() {

            @Override
            public void onClick(DialogInterface dialog, int which) {
                dialog.dismiss();
                init();
            }
        });
        builder.setNegativeButton(R.string.only_wifi_cancel, new OnClickListener() {

            @Override
            public void onClick(DialogInterface dialog, int which) {
                finish();
            }
        });
        builder.create().show();
    } else {
        init();
    }
}
Also used : AlertDialog(android.app.AlertDialog) DialogInterface(android.content.DialogInterface) OnClickListener(android.content.DialogInterface.OnClickListener)

Example 32 with DialogInterface

use of android.content.DialogInterface in project AnimeTaste by daimajia.

the class FavoriteActivity method onItemLongClick.

@Override
public boolean onItemLongClick(AdapterView<?> parent, View item, int position, long id) {
    final Animation animation = (Animation) mFavListAdapter.getItem(position);
    AlertDialog.Builder builder = new AlertDialog.Builder(mContext).setTitle(R.string.delete_title).setMessage(R.string.delete_body).setNegativeButton(R.string.delete_cancel, null).setPositiveButton(R.string.delete_ok, new OnClickListener() {

        @Override
        public void onClick(DialogInterface dialog, int which) {
            animation.removeFromFavorite(new Animation.UpdateFinishCallback() {

                @Override
                public void onUpdateFinished(Animation.Method method, Message msg) {
                    new LoadAsyncTask().execute();
                }
            });
            Toast.makeText(mContext, R.string.delete_success, Toast.LENGTH_SHORT).show();
        }
    });
    builder.create().show();
    return false;
}
Also used : AlertDialog(android.app.AlertDialog) Message(android.os.Message) DialogInterface(android.content.DialogInterface) Animation(com.zhan_dui.model.Animation) OnClickListener(android.content.DialogInterface.OnClickListener)

Example 33 with DialogInterface

use of android.content.DialogInterface in project UltimateAndroid by cymcsg.

the class DialogShower method showNoticeDialog.

public void showNoticeDialog(String alertInfo, final Thread thread) {
    AlertDialog.Builder builder = new AlertDialog.Builder(mContext);
    builder.setTitle(noticeTitle);
    builder.setMessage(alertInfo);
    builder.setPositiveButton(positiveButtonString, new DialogInterface.OnClickListener() {

        @Override
        public void onClick(DialogInterface dialog, int which) {
            dialog.dismiss();
            showDownloadDialog();
            thread.start();
        }
    });
    builder.setNegativeButton(negativeButtonString, new DialogInterface.OnClickListener() {

        @Override
        public void onClick(DialogInterface dialog, int which) {
            dialog.dismiss();
        }
    });
    AlertDialog noticeDialog = builder.create();
    // noticeDialog.setContentView(v);
    WindowManager.LayoutParams lp = noticeDialog.getWindow().getAttributes();
    lp.height = 200;
    noticeDialog.getWindow().setAttributes(lp);
    noticeDialog.setCancelable(false);
    noticeDialog.show();
}
Also used : AlertDialog(android.app.AlertDialog) DialogInterface(android.content.DialogInterface) WindowManager(android.view.WindowManager)

Example 34 with DialogInterface

use of android.content.DialogInterface in project UltimateAndroid by cymcsg.

the class DownloadDialogShower method showNoticeDialog.

public void showNoticeDialog(String alertInfo, final Thread thread) {
    AlertDialog.Builder builder = new AlertDialog.Builder(mContext);
    builder.setTitle(noticeTitle);
    builder.setMessage(alertInfo);
    builder.setPositiveButton(positiveButtonString, new DialogInterface.OnClickListener() {

        @Override
        public void onClick(DialogInterface dialog, int which) {
            dialog.dismiss();
            showDownloadDialog();
            thread.start();
        }
    });
    builder.setNegativeButton(negativeButtonString, new DialogInterface.OnClickListener() {

        @Override
        public void onClick(DialogInterface dialog, int which) {
            dialog.dismiss();
        }
    });
    AlertDialog noticeDialog = builder.create();
    // noticeDialog.setContentView(v);
    WindowManager.LayoutParams lp = noticeDialog.getWindow().getAttributes();
    lp.height = 200;
    noticeDialog.getWindow().setAttributes(lp);
    noticeDialog.setCancelable(false);
    noticeDialog.show();
}
Also used : AlertDialog(android.app.AlertDialog) DialogInterface(android.content.DialogInterface) WindowManager(android.view.WindowManager)

Example 35 with DialogInterface

use of android.content.DialogInterface in project UltimateAndroid by cymcsg.

the class DownloadDialogShower method showDownloadDialog.

private void showDownloadDialog() {
    builder = new AlertDialog.Builder(mContext);
    final LayoutInflater inflater = LayoutInflater.from(mContext);
    View v = inflater.inflate(R.layout.progress_update, null);
    mProgress = (ProgressBar) v.findViewById(R.id.progress);
    updatePercentTextView = (TextView) v.findViewById(R.id.updatePercentTextView);
    updateCurrentTextView = (TextView) v.findViewById(R.id.updateCurrentTextView);
    updateCurrentTextView.setText(prepareDownloadingTextViewString);
    updateTotalTextView = (TextView) v.findViewById(R.id.updateTotalTextView);
    // builder.setCustomTitle(inflater.inflate(R.layout.progress_update_title, null));
    builder.setTitle(downloadTitle);
    builder.setView(v);
    builder.setNegativeButton(downloadCancel, new DialogInterface.OnClickListener() {

        @Override
        public void onClick(DialogInterface dialog, int which) {
            dialog.dismiss();
            interceptFlag = true;
        }
    });
    progressDialog = builder.create();
    progressDialog.show();
}
Also used : AlertDialog(android.app.AlertDialog) DialogInterface(android.content.DialogInterface) LayoutInflater(android.view.LayoutInflater) TextView(android.widget.TextView) View(android.view.View)

Aggregations

DialogInterface (android.content.DialogInterface)2733 AlertDialog (android.app.AlertDialog)1228 View (android.view.View)877 Intent (android.content.Intent)709 TextView (android.widget.TextView)653 AlertDialog (android.support.v7.app.AlertDialog)649 EditText (android.widget.EditText)426 ImageView (android.widget.ImageView)308 OnClickListener (android.content.DialogInterface.OnClickListener)285 LayoutInflater (android.view.LayoutInflater)242 SuppressLint (android.annotation.SuppressLint)225 AdapterView (android.widget.AdapterView)220 ListView (android.widget.ListView)220 ArrayList (java.util.ArrayList)213 Context (android.content.Context)181 Dialog (android.app.Dialog)180 File (java.io.File)160 OnClickListener (android.view.View.OnClickListener)157 Bundle (android.os.Bundle)146 Activity (android.app.Activity)143