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


Java Dialogs类代码示例

本文整理汇总了Java中org.thoughtcrime.securesms.util.Dialogs的典型用法代码示例。如果您正苦于以下问题:Java Dialogs类的具体用法?Java Dialogs怎么用?Java Dialogs使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: handleDial

import org.thoughtcrime.securesms.util.Dialogs; //导入依赖的package包/类
private void handleDial(final Recipient recipient) {
  if (recipient == null) return;

  if (isSecureText) {
    Intent intent = new Intent(this, WebRtcCallService.class);
    intent.setAction(WebRtcCallService.ACTION_OUTGOING_CALL);
    intent.putExtra(WebRtcCallService.EXTRA_REMOTE_NUMBER, recipient.getNumber());
    startService(intent);

    Intent activityIntent = new Intent(this, WebRtcCallActivity.class);
    activityIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    startActivity(activityIntent);
  } else {
    try {
      Intent dialIntent = new Intent(Intent.ACTION_DIAL,
                                     Uri.parse("tel:" + recipient.getNumber()));
      startActivity(dialIntent);
    } catch (ActivityNotFoundException anfe) {
      Log.w(TAG, anfe);
      Dialogs.showAlertDialog(this,
                              getString(R.string.ConversationActivity_calls_not_supported),
                              getString(R.string.ConversationActivity_this_device_does_not_appear_to_support_dial_actions));
    }
  }
}
 
开发者ID:XecureIT,项目名称:PeSanKita-android,代码行数:26,代码来源:ConversationActivity.java

示例2: onClick

import org.thoughtcrime.securesms.util.Dialogs; //导入依赖的package包/类
public void onClick(View v) {
  if (MediaPreviewActivity.isContentTypeSupported(slide.getContentType())) {
    Intent intent = new Intent(context, MediaPreviewActivity.class);
    intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
    intent.setDataAndType(slide.getUri(), slide.getContentType());
    intent.putExtra(MediaPreviewActivity.MASTER_SECRET_EXTRA, masterSecret);
    if (!messageRecord.isOutgoing()) intent.putExtra(MediaPreviewActivity.RECIPIENT_EXTRA, messageRecord.getIndividualRecipient());
    intent.putExtra(MediaPreviewActivity.DATE_EXTRA, messageRecord.getDateReceived());
    context.startActivity(intent);
  } else {
    AlertDialog.Builder builder = new AlertDialog.Builder(context);
    builder.setTitle(R.string.ConversationItem_view_secure_media_question);
    builder.setIcon(Dialogs.resolveIcon(context, 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();
      }
    });
    builder.setNegativeButton(R.string.no, null);
    builder.show();
  }
}
 
开发者ID:redcracker,项目名称:TextSecure,代码行数:25,代码来源:ConversationItem.java

示例3: handleImportSms

import org.thoughtcrime.securesms.util.Dialogs; //导入依赖的package包/类
private void handleImportSms() {
  AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
  builder.setIcon(Dialogs.resolveIcon(getActivity(), R.attr.dialog_info_icon));
  builder.setTitle(getActivity().getString(R.string.ImportFragment_import_system_sms_database));
  builder.setMessage(getActivity().getString(R.string.ImportFragment_this_will_import_messages_from_the_system));
  builder.setPositiveButton(getActivity().getString(R.string.ImportFragment_import), new AlertDialog.OnClickListener() {
    @Override
    public void onClick(DialogInterface dialog, int which) {
      Intent intent = new Intent(getActivity(), ApplicationMigrationService.class);
      intent.setAction(ApplicationMigrationService.MIGRATE_DATABASE);
      intent.putExtra("master_secret", masterSecret);
      getActivity().startService(intent);

      Intent nextIntent = new Intent(getActivity(), ConversationListActivity.class);
      intent.putExtra("master_secret", masterSecret);

      Intent activityIntent = new Intent(getActivity(), DatabaseMigrationActivity.class);
      activityIntent.putExtra("master_secret", masterSecret);
      activityIntent.putExtra("next_intent", nextIntent);
      getActivity().startActivity(activityIntent);
    }
  });
  builder.setNegativeButton(getActivity().getString(R.string.ImportFragment_cancel), null);
  builder.show();
}
 
开发者ID:redcracker,项目名称:TextSecure,代码行数:26,代码来源:ImportFragment.java

示例4: onActivityResult

import org.thoughtcrime.securesms.util.Dialogs; //导入依赖的package包/类
@Override
public void onActivityResult(int requestCode, int resultCode, Intent intent) {
  IntentResult scanResult = IntentIntegrator.parseActivityResult(requestCode, resultCode, intent);

  if ((scanResult != null) && (scanResult.getContents() != null)) {
    String data = scanResult.getContents();

    if (data.equals(Base64.encodeBytes(getIdentityKeyToCompare().serialize()))) {
      Dialogs.showInfoDialog(this, getVerifiedTitle(), getVerifiedMessage());
    } else {
      Dialogs.showAlertDialog(this, getNotVerifiedTitle(), getNotVerifiedMessage());
    }
  } else {
    Toast.makeText(this, R.string.KeyScanningActivity_no_scanned_key_found_exclamation,
                   Toast.LENGTH_LONG).show();
  }
}
 
开发者ID:redcracker,项目名称:TextSecure,代码行数:18,代码来源:KeyScanningActivity.java

示例5: handleStartSecureSession

import org.thoughtcrime.securesms.util.Dialogs; //导入依赖的package包/类
private void handleStartSecureSession() {
  if (getRecipients() == null) {
    Toast.makeText(this, getString(R.string.ConversationActivity_invalid_recipient),
                   Toast.LENGTH_LONG).show();
    return;
  }

  final Recipient recipient   = getRecipients().getPrimaryRecipient();
  String recipientName        = (recipient.getName() == null ? recipient.getNumber() : recipient.getName());
  AlertDialog.Builder builder = new AlertDialog.Builder(this);
  builder.setTitle(R.string.ConversationActivity_initiate_secure_session_question);
  builder.setIcon(Dialogs.resolveIcon(this, R.attr.dialog_info_icon));
  builder.setCancelable(true);
  builder.setMessage(String.format(getString(R.string.ConversationActivity_initiate_secure_session_with_s_question),
                     recipientName));
  builder.setPositiveButton(R.string.yes, new DialogInterface.OnClickListener() {
    @Override
    public void onClick(DialogInterface dialog, int which) {
      KeyExchangeInitiator.initiate(ConversationActivity.this, masterSecret,
                                    recipient, true);
    }
  });

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

示例6: handleDeleteThread

import org.thoughtcrime.securesms.util.Dialogs; //导入依赖的package包/类
private void handleDeleteThread() {
  AlertDialog.Builder builder = new AlertDialog.Builder(this);
  builder.setTitle(R.string.ConversationActivity_delete_thread_confirmation);
  builder.setIcon(Dialogs.resolveIcon(this, 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);
        finish();
      }
    }
  });

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

示例7: handleDeleteMessage

import org.thoughtcrime.securesms.util.Dialogs; //导入依赖的package包/类
private void handleDeleteMessage(final MessageRecord message) {
  final long messageId   = message.getId();

  AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
  builder.setTitle(R.string.ConversationFragment_confirm_message_delete);
  builder.setIcon(Dialogs.resolveIcon(getActivity(), R.attr.dialog_alert_icon));
  builder.setCancelable(true);
  builder.setMessage(R.string.ConversationFragment_are_you_sure_you_want_to_permanently_delete_this_message);

  builder.setPositiveButton(R.string.yes, new DialogInterface.OnClickListener() {
    @Override
    public void onClick(DialogInterface dialog, int which) {
      if (message.isMms()) {
        DatabaseFactory.getMmsDatabase(getActivity()).delete(messageId);
      } else {
        DatabaseFactory.getSmsDatabase(getActivity()).deleteMessage(messageId);
      }
    }
  });

  builder.setNegativeButton(R.string.no, null);
  builder.show();
}
 
开发者ID:redcracker,项目名称:TextSecure,代码行数:24,代码来源:ConversationFragment.java

示例8: onClick

import org.thoughtcrime.securesms.util.Dialogs; //导入依赖的package包/类
@Override
public void onClick(View v) {
  final RegistrationActivity self = RegistrationActivity.this;

  if (TextUtils.isEmpty(countryCode.getText())) {
    Toast.makeText(self,
                   getString(R.string.RegistrationActivity_you_must_specify_your_country_code),
                   Toast.LENGTH_LONG).show();
    return;
  }

  if (TextUtils.isEmpty(number.getText())) {
    Toast.makeText(self,
                   getString(R.string.RegistrationActivity_you_must_specify_your_phone_number),
                   Toast.LENGTH_LONG).show();
    return;
  }

  final String e164number = getConfiguredE164Number();

  if (!PhoneNumberFormatter.isValidNumber(e164number)) {
    Dialogs.showAlertDialog(self,
                         getString(R.string.RegistrationActivity_invalid_number),
                         String.format(getString(R.string.RegistrationActivity_the_number_you_specified_s_is_invalid),
                                       e164number));
    return;
  }

  promptForRegistrationStart(self, e164number, false);
}
 
开发者ID:CableIM,项目名称:Cable-Android,代码行数:31,代码来源:RegistrationActivity.java

示例9: onPreferenceChange

import org.thoughtcrime.securesms.util.Dialogs; //导入依赖的package包/类
@Override
public boolean onPreferenceChange(final Preference preference, Object newValue) {
  if (((CheckBoxPreference)preference).isChecked()) {
    AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
    builder.setIcon(Dialogs.resolveIcon(getActivity(), R.attr.dialog_info_icon));
    builder.setTitle(R.string.ApplicationPreferencesActivity_disable_push_messages);
    builder.setMessage(R.string.ApplicationPreferencesActivity_this_will_disable_push_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);
    nextIntent.putExtra("master_secret", getActivity().getIntent().getParcelableExtra("master_secret"));

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

  return false;
}
 
开发者ID:redcracker,项目名称:TextSecure,代码行数:29,代码来源:ApplicationPreferencesActivity.java

示例10: handleImportEncryptedBackup

import org.thoughtcrime.securesms.util.Dialogs; //导入依赖的package包/类
private void handleImportEncryptedBackup() {
  AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
  builder.setIcon(Dialogs.resolveIcon(getActivity(), 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:redcracker,项目名称:TextSecure,代码行数:15,代码来源:ImportFragment.java

示例11: handleImportPlaintextBackup

import org.thoughtcrime.securesms.util.Dialogs; //导入依赖的package包/类
private void handleImportPlaintextBackup() {
  AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
  builder.setIcon(Dialogs.resolveIcon(getActivity(), 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:redcracker,项目名称:TextSecure,代码行数:15,代码来源:ImportFragment.java

示例12: initializeDialog

import org.thoughtcrime.securesms.util.Dialogs; //导入依赖的package包/类
private void initializeDialog(View view) {
  AlertDialog.Builder builder = new AlertDialog.Builder(context);
  builder.setIcon(Dialogs.resolveIcon(context, 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.setInverseBackgroundForced(true);
  builder.show();
}
 
开发者ID:redcracker,项目名称:TextSecure,代码行数:12,代码来源:LedBlinkPatternListPreference.java

示例13: handleExportPlaintextBackup

import org.thoughtcrime.securesms.util.Dialogs; //导入依赖的package包/类
private void handleExportPlaintextBackup() {
  AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
  builder.setIcon(Dialogs.resolveIcon(getActivity(), R.attr.dialog_alert_icon));
  builder.setTitle(getActivity().getString(R.string.ExportFragment_export_plaintext_to_sd_card));
  builder.setMessage(getActivity().getString(R.string.ExportFragment_warning_this_will_export_the_plaintext_contents));
  builder.setPositiveButton(getActivity().getString(R.string.ExportFragment_export), new Dialog.OnClickListener() {
    @Override
    public void onClick(DialogInterface dialog, int which) {
      new ExportPlaintextTask().execute();
    }
  });
  builder.setNegativeButton(getActivity().getString(R.string.ExportFragment_cancel), null);
  builder.show();
}
 
开发者ID:redcracker,项目名称:TextSecure,代码行数:15,代码来源:ExportFragment.java

示例14: handleAbortSecureSession

import org.thoughtcrime.securesms.util.Dialogs; //导入依赖的package包/类
private void handleAbortSecureSession() {
  AlertDialog.Builder builder = new AlertDialog.Builder(this);
  builder.setTitle(R.string.ConversationActivity_abort_secure_session_confirmation);
  builder.setIcon(Dialogs.resolveIcon(this, R.attr.dialog_alert_icon));
  builder.setCancelable(true);
  builder.setMessage(R.string.ConversationActivity_are_you_sure_that_you_want_to_abort_this_secure_session_question);
  builder.setPositiveButton(R.string.yes, new DialogInterface.OnClickListener() {
    @Override
    public void onClick(DialogInterface dialog, int which) {
      if (isSingleConversation()) {
        final Context context = getApplicationContext();

        OutgoingEndSessionMessage endSessionMessage =
            new OutgoingEndSessionMessage(new OutgoingTextMessage(getRecipients(), "TERMINATE"));

        new AsyncTask<OutgoingEndSessionMessage, Void, Long>() {
          @Override
          protected Long doInBackground(OutgoingEndSessionMessage... messages) {
            return MessageSender.send(context, masterSecret, messages[0], threadId, false);
          }

          @Override
          protected void onPostExecute(Long result) {
            sendComplete(result);
          }
        }.execute(endSessionMessage);
      }
    }
  });
  builder.setNegativeButton(R.string.no, null);
  builder.show();
}
 
开发者ID:redcracker,项目名称:TextSecure,代码行数:33,代码来源:ConversationActivity.java

示例15: handleLeavePushGroup

import org.thoughtcrime.securesms.util.Dialogs; //导入依赖的package包/类
private void handleLeavePushGroup() {
  if (getRecipients() == null) {
    Toast.makeText(this, getString(R.string.ConversationActivity_invalid_recipient),
                   Toast.LENGTH_LONG).show();
    return;
  }

  AlertDialog.Builder builder = new AlertDialog.Builder(this);
  builder.setTitle(getString(R.string.ConversationActivity_leave_group));
  builder.setIcon(Dialogs.resolveIcon(this, R.attr.dialog_info_icon));
  builder.setCancelable(true);
  builder.setMessage(getString(R.string.ConversationActivity_are_you_sure_you_want_to_leave_this_group));
  builder.setPositiveButton(R.string.yes, new DialogInterface.OnClickListener() {
    @Override
    public void onClick(DialogInterface dialog, int which) {
      try {
        Context self    = ConversationActivity.this;
        byte[]  groupId = GroupUtil.getDecodedId(getRecipients().getPrimaryRecipient().getNumber());
        DatabaseFactory.getGroupDatabase(self).setActive(groupId, false);

        GroupContext context = GroupContext.newBuilder()
                                           .setId(ByteString.copyFrom(groupId))
                                           .setType(GroupContext.Type.QUIT)
                                           .build();

        OutgoingGroupMediaMessage outgoingMessage = new OutgoingGroupMediaMessage(self, getRecipients(),
                                                                                  context, null);
        MessageSender.send(self, masterSecret, outgoingMessage, threadId, false);
        DatabaseFactory.getGroupDatabase(self).remove(groupId, TextSecurePreferences.getLocalNumber(self));
        initializeEnabledCheck();
      } catch (IOException e) {
        Log.w(TAG, e);
        Toast.makeText(ConversationActivity.this, "Error leaving group....", Toast.LENGTH_LONG).show();
      }
    }
  });

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


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