当前位置: 首页>>代码示例>>Java>>正文


Java AlertDialogWrapper.Builder方法代码示例

本文整理汇总了Java中com.afollestad.materialdialogs.AlertDialogWrapper.Builder方法的典型用法代码示例。如果您正苦于以下问题:Java AlertDialogWrapper.Builder方法的具体用法?Java AlertDialogWrapper.Builder怎么用?Java AlertDialogWrapper.Builder使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.afollestad.materialdialogs.AlertDialogWrapper的用法示例。


在下文中一共展示了AlertDialogWrapper.Builder方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: measurementTypeDialog

import com.afollestad.materialdialogs.AlertDialogWrapper; //导入方法依赖的package包/类
@OnClick(R.id.text_measurement_type)
public void measurementTypeDialog(View view) {

    AlertDialogWrapper.Builder builder = new AlertDialogWrapper.Builder(getActivity());
    builder.setTitle(R.string.pick_measurement_type)
            .setItems(R.array.measurement_type_array, new DialogInterface.OnClickListener() {

                public void onClick(DialogInterface dialog, int which) {
                    // The 'which' argument contains the index position
                    // of the selected item
                    application.prefStore
                            .setInt(SharedPrefStore.Pref.SETTINGS_MEASUREMENT_TYPE, which);
                    textMeasurementTypeValue.setText(application.getResources()
                            .getStringArray(R.array.measurement_type_array)[which]);
                }
            });
    builder.create().show();
}
 
开发者ID:Drakuwa,项目名称:Fridge,代码行数:19,代码来源:SettingsFragment.java

示例2: viewCommentParent

import com.afollestad.materialdialogs.AlertDialogWrapper; //导入方法依赖的package包/类
private static void viewCommentParent(CommentAdapter adapter, CommentViewHolder holder,
        Context mContext, CommentNode baseNode) {
    int old = holder.getAdapterPosition();
    int pos = (old < 2) ? 0 : old - 1;
    for (int i = pos - 1; i >= 0; i--) {
        CommentObject o = adapter.currentComments.get(adapter.getRealPosition(i));
        if (o instanceof CommentItem
                && pos - 1 != i
                && o.comment.getDepth() < baseNode.getDepth()) {
            LayoutInflater inflater = ((Activity) mContext).getLayoutInflater();
            final View dialoglayout = inflater.inflate(R.layout.parent_comment_dialog, null);
            final AlertDialogWrapper.Builder builder = new AlertDialogWrapper.Builder(mContext);
            Comment parent = o.comment.getComment();
            adapter.setViews(parent.getDataNode().get("body_html").asText(),
                    adapter.submission.getSubredditName(),
                    (SpoilerRobotoTextView) dialoglayout.findViewById(R.id.firstTextView),
                    (CommentOverflow) dialoglayout.findViewById(R.id.commentOverflow));
            builder.setView(dialoglayout);
            builder.show();
            break;
        }
    }
}
 
开发者ID:ccrama,项目名称:Slide,代码行数:24,代码来源:CommentAdapterHelper.java

示例3: show

import com.afollestad.materialdialogs.AlertDialogWrapper; //导入方法依赖的package包/类
public static void show(final Context context, final @NonNull MuteSelectionListener listener) {
  AlertDialogWrapper.Builder builder = new AlertDialogWrapper.Builder(context);
  builder.setTitle(R.string.MuteDialog_mute_notifications);
  builder.setItems(R.array.mute_durations, new DialogInterface.OnClickListener() {
    @Override
    public void onClick(DialogInterface dialog, final int which) {
      final long muteUntil;

      switch (which) {
        case 0:  muteUntil = System.currentTimeMillis() + TimeUnit.HOURS.toMillis(1); break;
        case 1:  muteUntil = System.currentTimeMillis() + TimeUnit.HOURS.toMillis(2); break;
        case 2:  muteUntil = System.currentTimeMillis() + TimeUnit.DAYS.toMillis(1);  break;
        case 3:  muteUntil = System.currentTimeMillis() + TimeUnit.DAYS.toMillis(7);  break;
        default: muteUntil = System.currentTimeMillis() + TimeUnit.HOURS.toMillis(1); break;
      }

      listener.onMuted(muteUntil);
    }
  });

  builder.show();

}
 
开发者ID:Agilitum,项目名称:TextSecureSMP,代码行数:24,代码来源:MuteDialog.java

示例4: onPreferenceClick

import com.afollestad.materialdialogs.AlertDialogWrapper; //导入方法依赖的package包/类
@Override
public boolean onPreferenceClick(Preference preference) {
  final int threadLengthLimit = TextSecurePreferences.getThreadTrimLength(getActivity());
  AlertDialogWrapper.Builder builder = new AlertDialogWrapper.Builder(getActivity());
  builder.setTitle(R.string.ApplicationPreferencesActivity_delete_all_old_messages_now);
  builder.setMessage(getString(R.string.ApplicationPreferencesActivity_are_you_sure_you_would_like_to_immediately_trim_all_conversation_threads_to_the_s_most_recent_messages,
                               threadLengthLimit));
  builder.setPositiveButton(R.string.ApplicationPreferencesActivity_delete,
    new DialogInterface.OnClickListener() {
      @Override
      public void onClick(DialogInterface dialog, int which) {
        Trimmer.trimAllThreads(getActivity(), threadLengthLimit);
      }
    });

  builder.setNegativeButton(android.R.string.cancel, null);
  builder.show();

  return true;
}
 
开发者ID:Agilitum,项目名称:TextSecureSMP,代码行数:21,代码来源:StoragePreferenceFragment.java

示例5: handleDeleteThread

import com.afollestad.materialdialogs.AlertDialogWrapper; //导入方法依赖的package包/类
private void handleDeleteThread() {
  AlertDialogWrapper.Builder builder = new AlertDialogWrapper.Builder(this);
  builder.setTitle(R.string.ConversationActivity_delete_thread_confirmation);
  builder.setIconAttribute(R.attr.dialog_alert_icon);
  builder.setCancelable(true);
  builder.setMessage(R.string.ConversationActivity_are_you_sure_that_you_want_to_permanently_delete_this_conversation_question);
  builder.setPositiveButton(R.string.yes, new DialogInterface.OnClickListener() {
    @Override
    public void onClick(DialogInterface dialog, int which) {
      if (threadId > 0) {
        DatabaseFactory.getThreadDatabase(ConversationActivity.this).deleteConversation(threadId);
      }
      composeText.getText().clear();
      threadId = -1;
      finish();
    }
  });

  builder.setNegativeButton(R.string.no, null);
  builder.show();
}
 
开发者ID:Agilitum,项目名称:TextSecureSMP,代码行数:22,代码来源:ConversationActivity.java

示例6: selectContactInfo

import com.afollestad.materialdialogs.AlertDialogWrapper; //导入方法依赖的package包/类
private void selectContactInfo(ContactData contactData) {
  final CharSequence[] numbers     = new CharSequence[contactData.numbers.size()];
  final CharSequence[] numberItems = new CharSequence[contactData.numbers.size()];

  for (int i = 0; i < contactData.numbers.size(); i++) {
    numbers[i]     = contactData.numbers.get(i).number;
    numberItems[i] = contactData.numbers.get(i).type + ": " + contactData.numbers.get(i).number;
  }

  AlertDialogWrapper.Builder builder = new AlertDialogWrapper.Builder(this);
  builder.setIconAttribute(R.attr.conversation_attach_contact_info);
  builder.setTitle(R.string.ConversationActivity_select_contact_info);

  builder.setItems(numberItems, new DialogInterface.OnClickListener() {
    @Override
    public void onClick(DialogInterface dialog, int which) {
      composeText.append(numbers[which]);
    }
  });
  builder.show();
}
 
开发者ID:Agilitum,项目名称:TextSecureSMP,代码行数:22,代码来源:ConversationActivity.java

示例7: onCreateDialog

import com.afollestad.materialdialogs.AlertDialogWrapper; //导入方法依赖的package包/类
@SuppressWarnings("deprecation")
@Override
protected Dialog onCreateDialog(int id) {
    //AlertDialog.Builder builder = new AlertDialog.Builder(
    //        EmvReadActivity.this, R.style.dialog);
    AlertDialogWrapper.Builder builder = new AlertDialogWrapper.Builder(this);
    final LayoutInflater li = getLayoutInflater();
    Dialog dialog = null;
    switch (id) {
        case DIALOG_ENABLE_NFC: {
            dialog = mNfcManager.onCreateDialog(id, builder, li);
            break;
        }
    }
    return dialog;
}
 
开发者ID:doc-rj,项目名称:smartcard-reader,代码行数:17,代码来源:EmvReadActivity.java

示例8: getPicture

import com.afollestad.materialdialogs.AlertDialogWrapper; //导入方法依赖的package包/类
public void getPicture() {

        if (isPhotoSelected) {
            isPhotoSelected = false;
            circularView.setEnabled(true);
            FileUtils.deleteFile(new File(filePath));
            filePath = null;
            menu.findItem(R.id.action_add).setIcon(R.drawable.ic_photo_camera);
            // ((FloatingActionButton) view).setImageResource(R.drawable.ic_photo_camera);

            circularView.setHighlightedDegree(CircularView.RIGHT);
            Marker marker = circularView.getHighlightedMarker();
            circularView.getCenterCircle().setSrc(marker.getDrawable());
            textType.setText(adapter.getMarkerName(marker.getId()));
        } else {
            // Show image chooser dialog
            String[] options = {application.getString(R.string.take_photo),
                    application.getString(R.string.choose_image)};
            AlertDialogWrapper.Builder builder = new AlertDialogWrapper.Builder(getActivity());
            builder.setTitle(R.string.get_picture)
                    .setItems(options, new DialogInterface.OnClickListener() {
                        public void onClick(DialogInterface dialog, int which) {
                            // The 'which' argument contains the index position
                            // of the selected item
                            switch (which) {
                                case 0:
                                    takePhoto();
                                    break;
                                case 1:
                                    chooseImage();
                                    break;
                            }
                        }
                    });
            builder.create().show();
        }
    }
 
开发者ID:Drakuwa,项目名称:Fridge,代码行数:38,代码来源:AddItemFragment.java

示例9: onClick

import com.afollestad.materialdialogs.AlertDialogWrapper; //导入方法依赖的package包/类
public void onClick(final View v, final Slide slide) {
  if (!batchSelected.isEmpty()) {
    selectionClickListener.onItemClick(null, ConversationItem.this, -1, -1);
  } else if (MediaPreviewActivity.isContentTypeSupported(slide.getContentType()) &&
             slide.getThumbnailUri() != null)
  {
    Intent intent = new Intent(context, MediaPreviewActivity.class);
    intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
    intent.setDataAndType(slide.getUri(), slide.getContentType());
    if (!messageRecord.isOutgoing()) intent.putExtra(MediaPreviewActivity.RECIPIENT_EXTRA, messageRecord.getIndividualRecipient().getRecipientId());
    intent.putExtra(MediaPreviewActivity.DATE_EXTRA, messageRecord.getDateReceived());

    context.startActivity(intent);
  } else if (slide.getThumbnailUri() != null) {
    AlertDialogWrapper.Builder builder = new AlertDialogWrapper.Builder(context);
    builder.setTitle(R.string.ConversationItem_view_secure_media_question);
    builder.setIconAttribute(R.attr.dialog_alert_icon);
    builder.setCancelable(true);
    builder.setMessage(R.string.ConversationItem_this_media_has_been_stored_in_an_encrypted_database_external_viewer_warning);
    builder.setPositiveButton(R.string.yes, new DialogInterface.OnClickListener() {
      public void onClick(DialogInterface dialog, int which) {
        fireIntent(slide);
      }
    });
    builder.setNegativeButton(R.string.no, null);
    builder.show();
  }
}
 
开发者ID:Agilitum,项目名称:TextSecureSMP,代码行数:29,代码来源:ConversationItem.java

示例10: onPostExecute

import com.afollestad.materialdialogs.AlertDialogWrapper; //导入方法依赖的package包/类
@Override
public void onPostExecute(Recipients members) {
  GroupMembers groupMembers = new GroupMembers(members);
  AlertDialogWrapper.Builder builder = new AlertDialogWrapper.Builder(context);
  builder.setTitle(R.string.ConversationActivity_group_members);
  builder.setIconAttribute(R.attr.group_members_dialog_icon);
  builder.setCancelable(true);
  builder.setItems(groupMembers.getRecipientStrings(), new GroupMembersOnClickListener(context, groupMembers));
  builder.setPositiveButton(android.R.string.ok, null);
  builder.show();
}
 
开发者ID:Agilitum,项目名称:TextSecureSMP,代码行数:12,代码来源:GroupMembersDialog.java

示例11: handleImportEncryptedBackup

import com.afollestad.materialdialogs.AlertDialogWrapper; //导入方法依赖的package包/类
private void handleImportEncryptedBackup() {
  AlertDialogWrapper.Builder builder = new AlertDialogWrapper.Builder(getActivity());
  builder.setIconAttribute(R.attr.dialog_alert_icon);
  builder.setTitle(getActivity().getString(R.string.ImportFragment_restore_encrypted_backup));
  builder.setMessage(getActivity().getString(R.string.ImportFragment_restoring_an_encrypted_backup_will_completely_replace_your_existing_keys));
  builder.setPositiveButton(getActivity().getString(R.string.ImportFragment_restore), new AlertDialog.OnClickListener() {
    @Override
    public void onClick(DialogInterface dialog, int which) {
      new ImportEncryptedBackupTask().execute();
    }
  });
  builder.setNegativeButton(getActivity().getString(R.string.ImportFragment_cancel), null);
  builder.show();
}
 
开发者ID:Agilitum,项目名称:TextSecureSMP,代码行数:15,代码来源:ImportFragment.java

示例12: handleImportPlaintextBackup

import com.afollestad.materialdialogs.AlertDialogWrapper; //导入方法依赖的package包/类
private void handleImportPlaintextBackup() {
  AlertDialogWrapper.Builder builder = new AlertDialogWrapper.Builder(getActivity());
  builder.setIconAttribute(R.attr.dialog_alert_icon);
  builder.setTitle(getActivity().getString(R.string.ImportFragment_import_plaintext_backup));
  builder.setMessage(getActivity().getString(R.string.ImportFragment_this_will_import_messages_from_a_plaintext_backup));
  builder.setPositiveButton(getActivity().getString(R.string.ImportFragment_import), new AlertDialog.OnClickListener() {
    @Override
    public void onClick(DialogInterface dialog, int which) {
      new ImportPlaintextBackupTask().execute();
    }
  });
  builder.setNegativeButton(getActivity().getString(R.string.ImportFragment_cancel), null);
  builder.show();
}
 
开发者ID:Agilitum,项目名称:TextSecureSMP,代码行数:15,代码来源:ImportFragment.java

示例13: onPreferenceChange

import com.afollestad.materialdialogs.AlertDialogWrapper; //导入方法依赖的package包/类
@Override
public boolean onPreferenceChange(final Preference preference, Object newValue) {
  if (((CheckBoxPreference)preference).isChecked()) {
    AlertDialogWrapper.Builder builder = new AlertDialogWrapper.Builder(getActivity());
    builder.setIconAttribute(R.attr.dialog_info_icon);
    builder.setTitle(R.string.ApplicationPreferencesActivity_disable_textsecure_messages);
    builder.setMessage(R.string.ApplicationPreferencesActivity_this_will_disable_textsecure_messages);
    builder.setNegativeButton(android.R.string.cancel, null);
    builder.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
      @Override
      public void onClick(DialogInterface dialog, int which) {
        new DisablePushMessagesTask((CheckBoxPreference)preference).execute();
      }
    });
    builder.show();
  } else {
    Intent nextIntent = new Intent(getActivity(), ApplicationPreferencesActivity.class);

    Intent intent = new Intent(getActivity(), RegistrationActivity.class);
    intent.putExtra("cancel_button", true);
    intent.putExtra("next_intent", nextIntent);
    intent.putExtra("master_secret", masterSecret);
    startActivity(intent);
  }

  return false;
}
 
开发者ID:Agilitum,项目名称:TextSecureSMP,代码行数:28,代码来源:AdvancedPreferenceFragment.java

示例14: initializeDialog

import com.afollestad.materialdialogs.AlertDialogWrapper; //导入方法依赖的package包/类
private void initializeDialog(View view) {
  AlertDialogWrapper.Builder builder = new AlertDialogWrapper.Builder(context);
  builder.setIconAttribute(R.attr.dialog_info_icon);
  builder.setTitle(R.string.preferences__pref_led_blink_custom_pattern_title);
  builder.setView(view);
  builder.setOnCancelListener(new CustomDialogCancelListener());
  builder.setNegativeButton(android.R.string.cancel, new CustomDialogCancelListener());
  builder.setPositiveButton(android.R.string.ok, new CustomDialogClickListener());
  builder.show();
}
 
开发者ID:Agilitum,项目名称:TextSecureSMP,代码行数:11,代码来源:LedBlinkPatternListPreference.java

示例15: onOptionsItemSelected

import com.afollestad.materialdialogs.AlertDialogWrapper; //导入方法依赖的package包/类
@Override
public boolean onOptionsItemSelected(MenuItem item) {
    int id = item.getItemId();

    if (id == R.id.action_delete) {
        AlertDialogWrapper.Builder builder = new AlertDialogWrapper.Builder(getActivity());
        builder.setTitle(R.string.delete);
        builder.setMessage(R.string.delete_message);
        builder.setNegativeButton(android.R.string.cancel, null);
        builder.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
            @Override
            public void onClick(DialogInterface dialog, int which) {
                if (mPhotos.size() > 0) {
                    ImageUtils.clearStorageDir(MainActivity.ALBUM_NAME);
                    mPhotos.clear();
                    mThumbnails.clear();
                    updateView();
                    Log.d("C2P", "Deleted temp image files");
                }
            }
        });
        builder.show();
        return true;
    } else if (id == R.id.action_pick) {
        Log.d("C2P", "Should start intent for picker");
        startPickIntent();
    }
    return super.onOptionsItemSelected(item);
}
 
开发者ID:rockwotj,项目名称:Cam2PDF,代码行数:30,代码来源:ImagesFragment.java


注:本文中的com.afollestad.materialdialogs.AlertDialogWrapper.Builder方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。