Search in sources :

Example 11 with DialogInterface

use of android.content.DialogInterface in project lottie-android by airbnb.

the class AnimationFragment method onLoadUrlClicked.

@OnClick(R.id.load_url)
void onLoadUrlClicked() {
    animationView.cancelAnimation();
    final EditText urlView = new EditText(getContext());
    new AlertDialog.Builder(getContext()).setTitle("Enter a URL").setView(urlView).setPositiveButton("Load", new DialogInterface.OnClickListener() {

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

        @Override
        public void onClick(DialogInterface dialog, int which) {
            dialog.dismiss();
        }
    }).show();
}
Also used : EditText(android.widget.EditText) AlertDialog(android.app.AlertDialog) DialogInterface(android.content.DialogInterface) OnClick(butterknife.OnClick)

Example 12 with DialogInterface

use of android.content.DialogInterface in project remusic by aa112901.

the class MainFragmentAdapter method setOnPlaylistListener.

private void setOnPlaylistListener(ItemHolder itemHolder, final int position, final long playlistid, final String albumArt, final String playlistname) {
    itemHolder.itemView.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            final Handler handler = new Handler();
            handler.postDelayed(new Runnable() {

                @Override
                public void run() {
                    Intent intent = new Intent(mContext, PlaylistActivity.class);
                    intent.setFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);
                    intent.putExtra("islocal", true);
                    intent.putExtra("playlistid", playlistid + "");
                    intent.putExtra("albumart", albumArt);
                    intent.putExtra("playlistname", playlistname);
                    mContext.startActivity(intent);
                }
            }, 60);
        }
    });
    itemHolder.menu.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            PopupMenu popupMenu = new PopupMenu(mContext, v);
            popupMenu.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() {

                @Override
                public boolean onMenuItemClick(MenuItem item) {
                    if (position == 5) {
                        Toast.makeText(mContext, "此歌单不应删除", Toast.LENGTH_SHORT).show();
                    } else {
                        new AlertDialog.Builder(mContext).setTitle(mContext.getString(R.string.sure_to_delete_music)).setPositiveButton(mContext.getString(R.string.sure), new DialogInterface.OnClickListener() {

                            @Override
                            public void onClick(DialogInterface dialog, int which) {
                                PlaylistInfo.getInstance(mContext).deletePlaylist(playlistid);
                                PlaylistsManager.getInstance(mContext).delete(playlistid);
                                Intent intent = new Intent();
                                intent.setAction(IConstants.PLAYLIST_COUNT_CHANGED);
                                mContext.sendBroadcast(intent);
                                dialog.dismiss();
                            }
                        }).setNegativeButton(mContext.getString(R.string.cancel), new DialogInterface.OnClickListener() {

                            @Override
                            public void onClick(DialogInterface dialog, int which) {
                                dialog.dismiss();
                            }
                        }).show();
                    }
                    return true;
                }
            });
            popupMenu.inflate(R.menu.popmenu);
            popupMenu.show();
        }
    });
}
Also used : DialogInterface(android.content.DialogInterface) Handler(android.os.Handler) Intent(android.content.Intent) MenuItem(android.view.MenuItem) ImageView(android.widget.ImageView) TintImageView(com.bilibili.magicasakura.widgets.TintImageView) SimpleDraweeView(com.facebook.drawee.view.SimpleDraweeView) View(android.view.View) RecyclerView(android.support.v7.widget.RecyclerView) TextView(android.widget.TextView) PopupMenu(android.support.v7.widget.PopupMenu)

Example 13 with DialogInterface

use of android.content.DialogInterface in project remusic by aa112901.

the class RadioDetailActivity method setHeaderView.

private void setHeaderView() {
    albumArt = (ImageView) findViewById(R.id.album_art);
    albumTitle = (TextView) findViewById(R.id.album_title);
    albumArtSmall = (SimpleDraweeView) findViewById(R.id.playlist_art);
    LinearLayout downAll = (LinearLayout) headerViewContent.findViewById(R.id.playlist_down);
    downAll.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            new AlertDialog.Builder(RadioDetailActivity.this).setTitle("要下载音乐吗").setPositiveButton(RadioDetailActivity.this.getString(R.string.sure), new DialogInterface.OnClickListener() {

                @Override
                public void onClick(DialogInterface dialog, int which) {
                    int len = mList.size();
                    for (int i = 0; i < len; i++) {
                        Down.downMusic(MainApplication.context, mList.get(i).getSong_id(), mList.get(i).getSong_name(), artistName);
                    }
                    dialog.dismiss();
                }
            }).setNegativeButton(RadioDetailActivity.this.getString(R.string.cancel), new DialogInterface.OnClickListener() {

                @Override
                public void onClick(DialogInterface dialog, int which) {
                    dialog.dismiss();
                }
            }).show();
        }
    });
}
Also used : AlertDialog(android.support.v7.app.AlertDialog) DialogInterface(android.content.DialogInterface) ImageView(android.widget.ImageView) ObservableRecyclerView(com.github.ksoichiro.android.observablescrollview.ObservableRecyclerView) SimpleDraweeView(com.facebook.drawee.view.SimpleDraweeView) View(android.view.View) TextView(android.widget.TextView) TintImageView(com.bilibili.magicasakura.widgets.TintImageView) RecyclerView(android.support.v7.widget.RecyclerView) LinearLayout(android.widget.LinearLayout)

Example 14 with DialogInterface

use of android.content.DialogInterface in project actor-platform by actorapp.

the class ViewAvatarActivity method onOptionsItemSelected.

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    if (item.getItemId() == R.id.editAvatar) {
        CharSequence[] args;
        if (getAvatar().get() != null) {
            args = new CharSequence[] { getString(R.string.pick_photo_camera), getString(R.string.pick_photo_gallery), getString(R.string.pick_photo_remove) };
        } else {
            args = new CharSequence[] { getString(R.string.pick_photo_camera), getString(R.string.pick_photo_gallery) };
        }
        new AlertDialog.Builder(this).setItems(args, new DialogInterface.OnClickListener() {

            @Override
            public void onClick(DialogInterface d, int which) {
                if (which == 0) {
                    externalFile = Files.getExternalTempFile("capture", "jpg");
                    if (externalFile == null) {
                        Toast.makeText(ViewAvatarActivity.this, R.string.toast_no_sdcard, Toast.LENGTH_LONG).show();
                        return;
                    }
                    if (ContextCompat.checkSelfPermission(ViewAvatarActivity.this, Manifest.permission.CAMERA) != PackageManager.PERMISSION_GRANTED) {
                        Log.d("Permissions", "camera - no permission :c");
                        ActivityCompat.requestPermissions(ViewAvatarActivity.this, new String[] { Manifest.permission.CAMERA }, PERMISSIONS_REQUEST_CAMERA);
                    } else {
                        startCamera();
                    }
                } else if (which == 1) {
                    Intent i = new Intent(Intent.ACTION_PICK, MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
                    i.setType("image/*");
                    startActivityForResult(i, REQUEST_GALLERY);
                } else if (which == 2) {
                    if (peer.getPeerType() == PeerType.PRIVATE) {
                        if (peer.getPeerId() == myUid()) {
                            messenger().removeMyAvatar();
                        }
                    } else if (peer.getPeerType() == PeerType.GROUP) {
                        messenger().removeGroupAvatar(peer.getPeerId());
                    }
                }
            }
        }).show();
        return true;
    } else if (item.getItemId() == android.R.id.home) {
        finish();
        return true;
    }
    return super.onOptionsItemSelected(item);
}
Also used : DialogInterface(android.content.DialogInterface) Intent(android.content.Intent)

Example 15 with DialogInterface

use of android.content.DialogInterface in project actor-platform by actorapp.

the class AddMemberFragment method onItemClicked.

@Override
public void onItemClicked(Contact contact) {
    final UserVM userModel = users().get(contact.getUid());
    for (GroupMember uid : groupVM.getMembers().get()) {
        if (uid.getUid() == userModel.getId()) {
            Toast.makeText(getActivity(), R.string.toast_already_member, Toast.LENGTH_SHORT).show();
            return;
        }
    }
    new AlertDialog.Builder(getActivity()).setMessage(getString(R.string.alert_group_add_text).replace("{0}", userModel.getName().get())).setPositiveButton(R.string.alert_group_add_yes, new DialogInterface.OnClickListener() {

        @Override
        public void onClick(DialogInterface dialog2, int which) {
            execute(messenger().inviteMember(groupVM.getId(), userModel.getId()), R.string.progress_common, new CommandCallback<Void>() {

                @Override
                public void onResult(Void res) {
                    getActivity().finish();
                }

                @Override
                public void onError(Exception e) {
                    Toast.makeText(getActivity(), R.string.toast_unable_add, Toast.LENGTH_SHORT).show();
                }
            });
        }
    }).setNegativeButton(R.string.dialog_cancel, null).show().setCanceledOnTouchOutside(true);
}
Also used : AlertDialog(android.app.AlertDialog) GroupMember(im.actor.core.entity.GroupMember) UserVM(im.actor.core.viewmodel.UserVM) DialogInterface(android.content.DialogInterface) Void(im.actor.runtime.actors.messages.Void)

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