Beispiel #1
0
  /**
   * Create the default full dialog.
   *
   * @param context The Context in which the Dialog should run. In particular, ituses the window
   *     manager and theme from this context to present its UI.
   * @param theme A style resource describing the theme to use for the window.If 0, the default
   *     dialog theme will be used.
   * @param buttonStyle One button or Two button
   * @return The Object of the TCLAlertDialogGray.
   */
  public static TCLAlertDialogEspecial makeDefaultFullDialog(
      Context context, int theme, int buttonStyle) {
    dialog = TCLAlertDialogEspecial.makeFullDialog(context, theme);

    if (buttonStyle == TCLAlertDialogEspecial.TWO_BUTTON) {
      dialog.setButton(context, TCLAlertDialogEspecial.TWO_BUTTON);
      Button bt1 = dialog.getLeftButton();
      bt1.setText(com.android.internal.R.string.tcl_dialog_ok);
      Button bt2 = dialog.getRightButton();
      bt2.setText(com.android.internal.R.string.tcl_dialog_cancle);
    } else if (buttonStyle == TCLAlertDialogEspecial.ONE_BUTTON) {
      dialog.setButton(context, TCLAlertDialogEspecial.ONE_BUTTON);
      Button bt3 = dialog.getLeftButton();
      bt3.setText(com.android.internal.R.string.tcl_dialog_ok);
    } else if (buttonStyle == TCLAlertDialogEspecial.THREE_BUTTON) {
      dialog.setButton(context, TCLAlertDialogEspecial.THREE_BUTTON);
      Button bt1 = dialog.getLeftButton();
      bt1.setText(com.android.internal.R.string.tcl_dialog_ok);
      Button bt2 = dialog.getRightButton();
      bt2.setText(com.android.internal.R.string.tcl_dialog_cancle);
      Button bt3 = dialog.getCenterButton();
      bt3.setText(com.android.internal.R.string.tcl_dialog_alonelistener);
    }
    return dialog;
  }
Beispiel #2
0
  /**
   * Creates a Dialog which has title, content and button area.
   *
   * @param context The Context in which the Dialog should run. In particular, ituses the window
   *     manager and theme from this context to present its UI.
   * @param theme A style resource describing the theme to use for the window.If 0, the default
   *     dialog theme will be used.
   *     <p>return The Object of the TCLAlertDialog.
   */
  public static TCLAlertDialogEspecial makeFullDialog(Context context, int theme) {
    dialog = new TCLAlertDialogEspecial(context, theme);
    if (dialog != null) {
      // setBackgroundWindow();
      setView(context, com.android.internal.R.layout.tcl_alert_full_especial);

      mButtonLayout = getLayout(com.android.internal.R.id.tcl_especial_idalert_gray_full_button);
      mContentLayout = getLayout(com.android.internal.R.id.tcl_especial_idalert_gray_full_content);
      dialog.setContentView(mView);
      return dialog;
    } else {
      return null;
    }
  }
Beispiel #3
0
  /**
   * Set the content text of default dialog.
   *
   * @param context The Context in which the Dialog should run. In particular, ituses the window
   *     manager and theme from this context to present its UI.
   * @param text The text in default dialog content.
   */
  public void setContentText(Context context, CharSequence text) {
    // contentText=text;
    LinearLayout.LayoutParams lp =
        new LinearLayout.LayoutParams(
            LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT);
    LayoutInflater inflate =
        (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    View view =
        inflate.inflate(com.android.internal.R.layout.tcl_alert_content_text_especial, null);
    TextView tv = ((TextView) view.findViewById(com.android.internal.R.id.tcl_especial_idlabel));
    dialog.setCustomContentView(view /*,lp*/);
    tv.setText((text == null) ? "test" : text);

    // add by gaodw.
    // tv.setTextAlignment(TextView.TEXT_ALIGNMENT_CENTER);
    // tv.setTextSize(TypedValue.COMPLEX_UNIT_SP, 30);
    // end

  }