浏览代码

[콘텐츠상세][Common] 앱 별점 리뷰 원버튼 가운데정렬 속성 지정

Hasemi 6 年之前
父节点
当前提交
4c068e67d6

+ 19 - 4
app/src/main/java/kr/co/zumo/app/lifeplus/view/dialog/AlertDialog.java

@@ -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());
   }
 
 }

+ 1 - 0
app/src/main/java/kr/co/zumo/app/lifeplus/view/screen/contents/ContentsPresenter.java

@@ -566,6 +566,7 @@ public class ContentsPresenter extends ContentsBasePresenter<ContentsModel, ICon
         })
         .attribute(dialog -> {
           dialog.setVisibleCloseButton(true);
+          dialog.setOneButtonCenterAlign(false);
           dialog.setPositiveButtonLabelId(R.string.app_review_write);
           dialog.setTitleId(R.string.app_review_title);
           dialog.setText(R.string.app_review_message);