Search in sources :

Example 36 with AlertDialog

use of android.app.AlertDialog in project JamsMusicPlayer by psaravan.

the class LicensesDialog method create.

public Dialog create() {
    //Get resources
    final WebView webView = new WebView(mContext);
    webView.loadDataWithBaseURL(null, mLicensesText, "text/html", "utf-8", null);
    final AlertDialog.Builder builder = new AlertDialog.Builder(mContext).setTitle(mTitleText).setView(webView).setPositiveButton(mCloseText, new Dialog.OnClickListener() {

        public void onClick(final DialogInterface dialogInterface, final int i) {
            dialogInterface.dismiss();
        }
    });
    final AlertDialog dialog = builder.create();
    dialog.setOnDismissListener(new DialogInterface.OnDismissListener() {

        @Override
        public void onDismiss(final DialogInterface dialog) {
            if (mOnDismissListener != null) {
                mOnDismissListener.onDismiss(dialog);
            }
        }
    });
    return dialog;
}
Also used : AlertDialog(android.app.AlertDialog) DialogInterface(android.content.DialogInterface) AlertDialog(android.app.AlertDialog) Dialog(android.app.Dialog) WebView(android.webkit.WebView)

Example 37 with AlertDialog

use of android.app.AlertDialog in project weiciyuan by qii.

the class AddGroupDialog method onCreateDialog.

@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
    name = new EditText(getActivity());
    name.addTextChangedListener(new WordLengthLimitWatcher(name));
    if (savedInstanceState != null) {
        name.append(savedInstanceState.getString("name"));
    }
    builder.setView(name).setTitle(getString(R.string.input_group_name)).setPositiveButton(getString(R.string.add), new DialogInterface.OnClickListener() {

        @Override
        public void onClick(DialogInterface dialog, int which) {
            String word = name.getText().toString().trim();
            if (!TextUtils.isEmpty(word)) {
                ManageGroupActivity.ManageGroupFragment fragment = (ManageGroupActivity.ManageGroupFragment) getTargetFragment();
                fragment.addGroup(word);
            }
        }
    }).setNegativeButton(getString(R.string.cancel), new DialogInterface.OnClickListener() {

        @Override
        public void onClick(DialogInterface dialog, int which) {
        }
    });
    AlertDialog dialog = builder.create();
    dialog.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE);
    return dialog;
}
Also used : AlertDialog(android.app.AlertDialog) EditText(android.widget.EditText) DialogInterface(android.content.DialogInterface)

Example 38 with AlertDialog

use of android.app.AlertDialog in project weiciyuan by qii.

the class ModifyGroupDialog method onCreateDialog.

@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    if (savedInstanceState != null) {
        idstr = savedInstanceState.getString("idstr");
        oriName = savedInstanceState.getString("oriName");
    }
    AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
    name = new EditText(getActivity());
    name.setHint(oriName);
    name.addTextChangedListener(new WordLengthLimitWatcher(name));
    if (savedInstanceState != null) {
        name.append(savedInstanceState.getString("name"));
    }
    builder.setView(name).setTitle(getString(R.string.modify_group_name)).setPositiveButton(getString(R.string.modify), new DialogInterface.OnClickListener() {

        @Override
        public void onClick(DialogInterface dialog, int which) {
            String name = ModifyGroupDialog.this.name.getText().toString().trim();
            if (!TextUtils.isEmpty(name)) {
                ManageGroupActivity.ManageGroupFragment fragment = (ManageGroupActivity.ManageGroupFragment) getTargetFragment();
                fragment.modifyGroupName(idstr, name);
            }
        }
    }).setNegativeButton(getString(R.string.cancel), new DialogInterface.OnClickListener() {

        @Override
        public void onClick(DialogInterface dialog, int which) {
        }
    });
    AlertDialog dialog = builder.create();
    dialog.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE);
    return dialog;
}
Also used : AlertDialog(android.app.AlertDialog) EditText(android.widget.EditText) DialogInterface(android.content.DialogInterface)

Example 39 with AlertDialog

use of android.app.AlertDialog in project weiciyuan by qii.

the class AddFilterDialog method onCreateDialog.

@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
    final EditText et = new EditText(getActivity());
    builder.setView(et).setTitle(getString(R.string.input_filter_word)).setPositiveButton(getString(R.string.add), new DialogInterface.OnClickListener() {

        @Override
        public void onClick(DialogInterface dialog, int which) {
            String word = et.getText().toString().trim();
            if (!TextUtils.isEmpty(word)) {
                AbstractFilterFragment filterFragment = (AbstractFilterFragment) getTargetFragment();
                filterFragment.addFilter(word);
            }
        }
    }).setNegativeButton(getString(R.string.cancel), new DialogInterface.OnClickListener() {

        @Override
        public void onClick(DialogInterface dialog, int which) {
        }
    });
    AlertDialog dialog = builder.create();
    dialog.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE);
    return dialog;
}
Also used : AlertDialog(android.app.AlertDialog) EditText(android.widget.EditText) AbstractFilterFragment(org.qii.weiciyuan.ui.preference.filter.AbstractFilterFragment) DialogInterface(android.content.DialogInterface)

Example 40 with AlertDialog

use of android.app.AlertDialog in project weiciyuan by qii.

the class FollowTopicDialog method onCreateDialog.

@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
    final EditText et = new EditText(getActivity());
    et.setHint(getString(R.string.add_topic_hint));
    builder.setView(et).setTitle(getString(R.string.add_topic)).setPositiveButton(getString(R.string.add), new DialogInterface.OnClickListener() {

        @Override
        public void onClick(DialogInterface dialog, int which) {
            String word = et.getText().toString().trim();
            if (!TextUtils.isEmpty(word)) {
                UserTopicListFragment userTopicListFragment = (UserTopicListFragment) getTargetFragment();
                userTopicListFragment.addTopic(word);
            }
        }
    }).setNegativeButton(getString(R.string.cancel), new DialogInterface.OnClickListener() {

        @Override
        public void onClick(DialogInterface dialog, int which) {
        }
    });
    AlertDialog dialog = builder.create();
    dialog.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE);
    return dialog;
}
Also used : AlertDialog(android.app.AlertDialog) EditText(android.widget.EditText) DialogInterface(android.content.DialogInterface)

Aggregations

AlertDialog (android.app.AlertDialog)368 DialogInterface (android.content.DialogInterface)251 View (android.view.View)93 TextView (android.widget.TextView)70 Intent (android.content.Intent)63 EditText (android.widget.EditText)53 OnClickListener (android.content.DialogInterface.OnClickListener)37 Test (org.junit.Test)33 ListView (android.widget.ListView)30 Context (android.content.Context)29 AdapterView (android.widget.AdapterView)27 LayoutInflater (android.view.LayoutInflater)26 ImageView (android.widget.ImageView)26 SuppressLint (android.annotation.SuppressLint)24 Button (android.widget.Button)24 Activity (android.app.Activity)23 Paint (android.graphics.Paint)20 OnClickListener (android.view.View.OnClickListener)18 KeyEvent (android.view.KeyEvent)16 ArrayList (java.util.ArrayList)16