コード例 #1
0
  /* (non-Javadoc)
   * @see android.app.Activity#onCreateOptionsMenu(android.view.Menu)
   */
  @Override
  public boolean onCreateOptionsMenu(Menu menu) {
    super.onCreateOptionsMenu(menu);

    if (optManager != null) optManager.createMenu(menu, true);
    return true;
  }
コード例 #2
0
 /*
  * Context Menu Item Selected
  */
 @Override
 public boolean onContextItemSelected(MenuItem item) {
   if (optManager.menuItemSelected(item.getItemId(), true)) return true;
   return super.onContextItemSelected(item);
 }
コード例 #3
0
 /*
  * Create Context Menu (Long-press menu)
  */
 @Override
 public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) {
   super.onCreateContextMenu(menu, v, menuInfo);
   optManager.createMenu(menu, true);
 }
コード例 #4
0
 /* (non-Javadoc)
  * @see android.app.Activity#onOptionsItemSelected(android.view.MenuItem)
  */
 @Override
 public boolean onOptionsItemSelected(MenuItem item) {
   if (optManager != null && optManager.menuItemSelected(item.getItemId(), true)) return true;
   return super.onOptionsItemSelected(item);
 }
コード例 #5
0
 /* (non-Javadoc)
  * @see android.app.Activity#onPrepareOptionsMenu(android.view.Menu)
  */
 @Override
 public boolean onPrepareOptionsMenu(Menu menu) {
   if (optManager != null) optManager.prepareMenu(menu);
   return true;
 }
コード例 #6
0
  /*
   * Populate all the main SMS/MMS views with content from the actual
   * SmsMmsMessage
   */
  private void populateViews(SmsMmsMessage newMessage) {

    // Store message
    message = newMessage;

    // Set up regular button list
    optManager = new MsgOptionManager(this, message);
    optManager.setupButtons(
        (ViewGroup) findViewById(R.id.RespButtonLayout),
        (ViewGroup) findViewById(R.id.RegButtonLayout));

    info = message.getInfo();

    // Hook the donate status button with the current donation status
    MainDonateEvent.instance().setButton(this, donateStatusBtn, newMessage);

    // Update Icon to indicate direct paging source
    int resIcon = VendorManager.instance().getVendorIconId(message.getVendorCode());
    if (resIcon <= 0) resIcon = R.drawable.ic_launcher;
    fromImage.setImageResource(resIcon);

    // Update TextView that contains the timestamp for the incoming message
    String headerText;
    String timeStamp = message.getFormattedTimestamp(this).toString();
    if (ManagePreferences.showSource()) {
      String source = "";
      if (info != null) source = info.getSource();
      if (source.length() == 0) source = message.getLocation();
      headerText = getString(R.string.src_text_at, source, timeStamp); //
    } else {
      headerText = getString(R.string.new_text_at, timeStamp);
    }

    String detailText;

    // Special case if we have no parsed information (which is just about impossible)
    if (info == null) {
      detailText = message.getTitle();
    }

    // Otherwise do things normally
    else {

      // Set the from, message and header views
      StringBuilder sb = new StringBuilder(info.getTitle());
      fromTV.setText(sb.toString());
      if (info.noCall()) fromTV.setMaxLines(2);
      sb = new StringBuilder();
      if (info.getPlace().length() > 0) {
        sb.append(info.getPlace());
        sb.append('\n');
      }
      String addr = info.getAddress();
      String apt = info.getApt();
      if (apt.length() > 0) {
        if (addr.length() > 0) addr = addr + ' ';
        addr = addr + getString(R.string.apt_label) + apt;
      }
      if (addr.length() > 0) {
        sb.append(addr);
        sb.append('\n');
      }
      String city = info.getCity();
      String st = info.getState();
      if (st.length() > 0) {
        if (city.length() > 0) city += ", ";
        city += st;
      }
      if (city.length() > 0) {
        sb.append(city);
        sb.append('\n');
      }
      if (info.getCross().length() > 0) {
        sb.append(getString(R.string.cross_label));
        sb.append(info.getCross());
        sb.append('\n');
      }
      if (info.getMap().length() > 0) {
        sb.append(getString(R.string.map_label));
        sb.append(info.getMap());
        sb.append('\n');
      }
      if (info.getBox().length() > 0) {
        sb.append(getString(R.string.box_label));
        sb.append(info.getBox());
        sb.append('\n');
      }
      if (info.getUnit().length() > 0) {
        sb.append(getString(R.string.units_label));
        sb.append(info.getUnit());
        sb.append('\n');
      }
      if (ManagePreferences.showPersonal()) {
        if (info.getName().length() > 0) {
          sb.append(getString(R.string.name_label));
          sb.append(info.getName());
          sb.append('\n');
        }
        if (info.getPhone().length() > 0) {
          sb.append(getString(R.string.phone_label));
          sb.append(info.getPhone());
          sb.append('\n');
        }
      }
      if (info.getChannel().length() > 0) {
        sb.append(getString(R.string.channel_label));
        sb.append(info.getChannel());
        sb.append('\n');
      }
      if (info.getSupp().length() > 0) {
        sb.append(info.getSupp());
        sb.append('\n');
      }
      if (info.getCallId().length() > 0) {
        sb.append(getString(R.string.call_id_label));
        sb.append(info.getCallId());
        sb.append('\n');
      }

      // Remove trailing \n
      int len = sb.length();
      if (len > 0) sb.setLength(len - 1);
      detailText = sb.toString();
    }
    messageReceivedTV.setText(headerText);
    messageTV.setText(detailText);

    // There used to be a call to myFinish() that was invoked if this method was
    // passed a message that was not a CAD page.  I am about as certain as I can
    // possibly be that this is no longer possible, which is why this call no
    // longer exists.  But the comment remains as a possible clue if someone
    // should discover I was wrong.

    // Will add a Database method in the future.
    // storeFileMessage();

  } // end of function