|
|
@@ -23,12 +23,24 @@ import kr.co.zumo.app.lifeplus.view.Event;
|
|
|
*/
|
|
|
public class AlertDialog extends ConfirmBaseDialog<ICustomAlertListener<AlertDialog>> {
|
|
|
|
|
|
+ private boolean isCenterAlignOneButton = true; //기본 얼럿은 버튼 하나일때 가운데 정렬
|
|
|
+
|
|
|
//onStart() is where dialog.show() is actually called on
|
|
|
//the underlying dialog, so we have to do it there or
|
|
|
//later in the lifecycle.
|
|
|
//Doing it in onResume() makes sure that even if there is a config change
|
|
|
//environment that skips onStart then the dialog will still be functioning
|
|
|
//properly after a rotation.
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 버튼 하나일때 가운데 정렬 옵션 설정
|
|
|
+ *
|
|
|
+ * @param isCenterAlignOneButton
|
|
|
+ */
|
|
|
+ public void setOneButtonCenterAlign(boolean isCenterAlignOneButton) {
|
|
|
+ this.isCenterAlignOneButton = isCenterAlignOneButton;
|
|
|
+ }
|
|
|
+
|
|
|
@Override
|
|
|
protected void attachEvent() {
|
|
|
final android.support.v7.app.AlertDialog d = (android.support.v7.app.AlertDialog) getDialog();
|
|
|
@@ -61,12 +73,15 @@ public class AlertDialog extends ConfirmBaseDialog<ICustomAlertListener<AlertDia
|
|
|
//
|
|
|
textViewNegativeButton.setVisibility(View.GONE);
|
|
|
|
|
|
- ConstraintSet constraintSet = new ConstraintSet();
|
|
|
- constraintSet.clone((ConstraintLayout) textViewPositiveButton.getParent());
|
|
|
+ if (isCenterAlignOneButton) {
|
|
|
+ ConstraintSet constraintSet = new ConstraintSet();
|
|
|
+ constraintSet.clone((ConstraintLayout) textViewPositiveButton.getParent());
|
|
|
+
|
|
|
+ constraintSet.connect(textViewPositiveButton.getId(), ConstraintSet.START, ConstraintSet.PARENT_ID, ConstraintSet.START, ResourceUtil.dpToPx(10));
|
|
|
|
|
|
- constraintSet.connect(textViewPositiveButton.getId(), ConstraintSet.START, ConstraintSet.PARENT_ID, ConstraintSet.START, ResourceUtil.dpToPx(10));
|
|
|
+ constraintSet.applyTo((ConstraintLayout) textViewPositiveButton.getParent());
|
|
|
+ }
|
|
|
|
|
|
- constraintSet.applyTo((ConstraintLayout) textViewPositiveButton.getParent());
|
|
|
}
|
|
|
|
|
|
}
|