Search in sources :

Example 46 with AlertDialog

use of android.app.AlertDialog in project WordPress-Android by wordpress-mobile.

the class ProfileInputDialogFragment method onStart.

@Override
public void onStart() {
    super.onStart();
    AlertDialog dialog = (AlertDialog) getDialog();
    Button positive = dialog.getButton(DialogInterface.BUTTON_POSITIVE);
    Button negative = dialog.getButton(DialogInterface.BUTTON_NEGATIVE);
    if (positive != null)
        WPPrefUtils.layoutAsFlatButton(positive);
    if (negative != null)
        WPPrefUtils.layoutAsFlatButton(negative);
}
Also used : AlertDialog(android.app.AlertDialog) Button(android.widget.Button)

Example 47 with AlertDialog

use of android.app.AlertDialog in project WordPress-Android by wordpress-mobile.

the class RelatedPostsDialog method onStart.

@Override
public void onStart() {
    super.onStart();
    AlertDialog dialog = (AlertDialog) getDialog();
    Button positive = dialog.getButton(DialogInterface.BUTTON_POSITIVE);
    Button negative = dialog.getButton(DialogInterface.BUTTON_NEGATIVE);
    if (positive != null)
        WPPrefUtils.layoutAsFlatButton(positive);
    if (negative != null)
        WPPrefUtils.layoutAsFlatButton(negative);
}
Also used : AlertDialog(android.app.AlertDialog) CompoundButton(android.widget.CompoundButton) Button(android.widget.Button)

Example 48 with AlertDialog

use of android.app.AlertDialog in project sharelock-android by auth0.

the class LinkFragment method onViewCreated.

@Override
public void onViewCreated(final View view, @Nullable Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);
    final EventBus bus = this.bus;
    TextView secretText = (TextView) view.findViewById(R.id.link_secret_text);
    secretText.setText(secret.getSecret());
    ShareEditText shareEditText = (ShareEditText) view.findViewById(R.id.link_share_list);
    shareEditText.setFocusable(false);
    shareEditText.allowDuplicates(false);
    for (String viewer : secret.getAllowedViewers()) {
        shareEditText.addObject(viewer);
    }
    linkText = (TextView) view.findViewById(R.id.link_text);
    progressBar = (ProgressBar) view.findViewById(R.id.link_progress);
    retryButton = (Button) view.findViewById(R.id.link_retry_button);
    shareButton = (ImageButton) view.findViewById(R.id.link_share_button);
    newButton = (ImageButton) view.findViewById(R.id.link_new_button);
    buttons = (ViewGroup) view.findViewById(R.id.link_buttons);
    retryButton.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            bus.post(new RequestLinkEvent(secret));
        }
    });
    shareButton.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            Intent sendIntent = new Intent();
            sendIntent.setAction(Intent.ACTION_SEND);
            sendIntent.putExtra(Intent.EXTRA_TEXT, link.toString());
            sendIntent.setType("text/plain");
            startActivity(Intent.createChooser(sendIntent, getString(R.string.share_link_chooser_title)));
        }
    });
    newButton.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            AlertDialog dialog = new AlertDialog.Builder(getActivity()).setTitle(R.string.new_link_prompt_title).setMessage(R.string.new_link_prompt_message).setCancelable(true).setPositiveButton(R.string.ok_button, new DialogInterface.OnClickListener() {

                @Override
                public void onClick(DialogInterface dialog, int which) {
                    bus.post(new RequestNewSecretEvent());
                }
            }).setNegativeButton(R.string.cancel_button, null).create();
            dialog.show();
        }
    });
    ImageView craftedBy = (ImageView) view.findViewById(R.id.crafted_by);
    craftedBy.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            final Intent intent = new Intent(Intent.ACTION_VIEW);
            intent.setData(Uri.parse(getString(R.string.crafted_by_url)));
            startActivity(intent);
        }
    });
}
Also used : AlertDialog(android.app.AlertDialog) DialogInterface(android.content.DialogInterface) RequestNewSecretEvent(com.auth0.sharelock.event.RequestNewSecretEvent) Intent(android.content.Intent) EventBus(de.greenrobot.event.EventBus) ImageView(android.widget.ImageView) View(android.view.View) TextView(android.widget.TextView) RequestLinkEvent(com.auth0.sharelock.event.RequestLinkEvent) ShareEditText(com.auth0.sharelock.widget.ShareEditText) TextView(android.widget.TextView) ImageView(android.widget.ImageView)

Example 49 with AlertDialog

use of android.app.AlertDialog in project sharelock-android by auth0.

the class ComposeActivity method onEvent.

public void onEvent(RequestLinkEvent event) {
    final Secret secret = event.getSecret();
    final EventBus bus = this.bus;
    SharedPreferences preferences = getSharedPreferences(getPackageName(), MODE_PRIVATE);
    client = new LinkAPIClient(preferences.getString(LinkAPIClient.SHARELOCK_ENDPOINT_KEY, LinkAPIClient.DEFAULT_URL));
    client.generateLinkForSecret(secret, this, new LinkAPIClient.LinkCallback() {

        @Override
        public void onSuccess(final Uri link) {
            Log.d(TAG, "Obtained link path " + link);
            handler.postDelayed(new Runnable() {

                @Override
                public void run() {
                    bus.postSticky(new NewLinkEvent(link));
                    final ClipboardManager clipboardManager = (ClipboardManager) getSystemService(CLIPBOARD_SERVICE);
                    final ClipData clipData = ClipData.newRawUri("sharelocked-link", link);
                    clipboardManager.setPrimaryClip(clipData);
                    Snackbar snackbar = Snackbar.with(ComposeActivity.this).text(R.string.link_in_clipboard_message).duration(Snackbar.SnackbarDuration.LENGTH_SHORT);
                    SnackbarManager.show(snackbar);
                }
            }, DELAY_MILLIS);
        }

        @Override
        public void onError(Throwable reason) {
            Log.e(TAG, "Failed to generate link", reason);
            bus.post(new SharelockAPIErrorEvent());
            AlertDialog dialog = new AlertDialog.Builder(ComposeActivity.this).setTitle(R.string.link_generation_failed_title).setMessage(R.string.link_generation_failed).setCancelable(true).setPositiveButton(R.string.retry_button, new DialogInterface.OnClickListener() {

                @Override
                public void onClick(DialogInterface dialog, int which) {
                    bus.post(new RequestLinkEvent(secret));
                }
            }).setNegativeButton(R.string.cancel_button, null).create();
            dialog.show();
        }
    });
}
Also used : ClipboardManager(android.content.ClipboardManager) AlertDialog(android.app.AlertDialog) SharedPreferences(android.content.SharedPreferences) DialogInterface(android.content.DialogInterface) EventBus(de.greenrobot.event.EventBus) Uri(android.net.Uri) RequestLinkEvent(com.auth0.sharelock.event.RequestLinkEvent) NewLinkEvent(com.auth0.sharelock.event.NewLinkEvent) ClipData(android.content.ClipData) SharelockAPIErrorEvent(com.auth0.sharelock.event.SharelockAPIErrorEvent) Snackbar(com.nispok.snackbar.Snackbar)

Example 50 with AlertDialog

use of android.app.AlertDialog in project platform_frameworks_base by android.

the class TileAdapter method showAccessibilityDialog.

private void showAccessibilityDialog(final int position, final View v) {
    final TileInfo info = mTiles.get(position);
    CharSequence[] options = new CharSequence[] { mContext.getString(R.string.accessibility_qs_edit_move_tile, info.state.label), mContext.getString(R.string.accessibility_qs_edit_remove_tile, info.state.label) };
    AlertDialog dialog = new Builder(mContext).setItems(options, new DialogInterface.OnClickListener() {

        @Override
        public void onClick(DialogInterface dialog, int which) {
            if (which == 0) {
                startAccessibleDrag(position);
            } else {
                move(position, info.isSystem ? mEditIndex : mTileDividerIndex, v);
                notifyItemChanged(mTileDividerIndex);
                notifyDataSetChanged();
            }
        }
    }).setNegativeButton(android.R.string.cancel, null).create();
    SystemUIDialog.setShowForAllUsers(dialog, true);
    SystemUIDialog.applyFlags(dialog);
    dialog.show();
}
Also used : AlertDialog(android.app.AlertDialog) TileInfo(com.android.systemui.qs.customize.TileQueryHelper.TileInfo) DialogInterface(android.content.DialogInterface) Builder(android.app.AlertDialog.Builder)

Aggregations

AlertDialog (android.app.AlertDialog)1029 DialogInterface (android.content.DialogInterface)573 View (android.view.View)278 TextView (android.widget.TextView)213 Intent (android.content.Intent)172 EditText (android.widget.EditText)160 Test (org.junit.Test)148 ShadowAlertDialog (org.robolectric.shadows.ShadowAlertDialog)111 Context (android.content.Context)96 ListView (android.widget.ListView)87 ImageView (android.widget.ImageView)86 LayoutInflater (android.view.LayoutInflater)80 Button (android.widget.Button)78 AdapterView (android.widget.AdapterView)72 Activity (android.app.Activity)66 SuppressLint (android.annotation.SuppressLint)61 Bundle (android.os.Bundle)56 OnClickListener (android.content.DialogInterface.OnClickListener)54 ArrayList (java.util.ArrayList)50 Dialog (android.app.Dialog)46