コード例 #1
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    if (isFinishing()) return;

    Intent intent = getIntent();
    account = QuestionViewer.getAccount(intent);
    user = QuestionViewer.getUser(intent);
    if (AccountManager.getInstance().getAccount(account) == null || user == null) {
      Application.getInstance().onError(R.string.ENTRY_IS_NOT_FOUND);
      finish();
      return;
    }
    if (intent.getBooleanExtra(EXTRA_FIELD_CANCEL, false)) {
      try {
        OTRManager.getInstance().abortSmp(account, user);
      } catch (NetworkException e) {
        Application.getInstance().onError(e);
      }
      finish();
      return;
    }
    showQuestion = intent.getBooleanExtra(EXTRA_FIELD_SHOW_QUESTION, true);
    answerRequest = intent.getBooleanExtra(EXTRA_FIELD_ANSWER_REQUEST, false);
    if (showQuestion) {
      setContentView(R.layout.question_viewer);
      questionView = (EditText) findViewById(R.id.question);
      questionView.setEnabled(!answerRequest);
      if (answerRequest) questionView.setText(intent.getStringExtra(Intent.EXTRA_TEXT));
      else findViewById(R.id.cancel).setVisibility(View.GONE);
    } else setContentView(R.layout.secret_viewer);
    findViewById(R.id.cancel).setOnClickListener(this);
    findViewById(R.id.send).setOnClickListener(this);
  }
コード例 #2
0
 public String getGroupName(String account, String group) {
   if (group == GroupManager.NO_GROUP)
     return Application.getInstance().getString(R.string.group_none);
   else if (group == GroupManager.IS_ROOM)
     return Application.getInstance().getString(R.string.group_room);
   else if (group == GroupManager.IS_ROOM_ROOM)
     return Application.getInstance().getString(R.string.group_room_room);
   else if (group == GroupManager.ACTIVE_CHATS)
     return Application.getInstance().getString(R.string.group_active_chat);
   else if (group == GroupManager.IS_ACCOUNT)
     return AccountManager.getInstance().getVerboseName(account);
   return group;
 }
コード例 #3
0
 public ExportChatDialogBuilder(
     Activity activity,
     int dialogId,
     ConfirmDialogListener listener,
     String account,
     String user) {
   super(activity, dialogId, listener);
   setTitle(R.string.export_chat_title);
   View layout = activity.getLayoutInflater().inflate(R.layout.export_chat, null);
   nameView = (EditText) layout.findViewById(R.id.name);
   sendView = (CheckBox) layout.findViewById(R.id.send);
   nameView.setText(
       activity.getString(
           R.string.export_chat_mask,
           AccountManager.getInstance().getVerboseName(account),
           RosterManager.getInstance().getName(account, user)));
   setView(layout);
 }