Ejemplo n.º 1
0
  public DialogueFrame(String name, int t, Font f, Color c, int x, int y, int w, int h, int r) {

    this.name = name;
    this.type = t;
    this.x0 = x;
    this.y0 = y;
    this.width = w;
    this.height = h;
    this.rowHeight = r;

    this.color = c;
    this.font = f;
    this.show = false;

    //
    this.charWidth = 8; // Dialogue.controller.getGraphics().getFontMetrics(f).charWidth('a');
    this.charHeight = 8 + 2; // Dialogue.controller.getGraphics().getFontMetrics(f).getHeight();
    this.rowWidth = (width - Dialogue.PADDING[3] - Dialogue.PADDING[1]) * (int) Controller.SCALE;
    this.charsInRow = rowWidth / charWidth; // System.out.println(this.name+": "+this.charsInRow);
    this.rowsInHeight = this.height / this.rowHeight;

    // this.setText(s);
    this.text = new ArrayList<>();
    this.rowIndex = 0;
    this.more = false;

    Dialogue.addFrame(this.name, this);
  }
 @Override
 public boolean onOptionsItemSelected(MenuItem item) {
   if (item.getItemId() == R.id.action_clear_history) {
     Dialogue.askForConfirmation(
         this,
         R.string.clear_history,
         new View.OnClickListener() {
           @Override
           public void onClick(View v) {
             dbConn.clearHistory();
             calendar.updateContents();
           }
         });
     return true;
   }
   return super.onOptionsItemSelected(item);
 }