|
|
@@ -0,0 +1,107 @@
|
|
|
+/*
|
|
|
+ * COPYRIGHT (c) 2018 All rights reserved by HANWHA LIFE.
|
|
|
+ */
|
|
|
+package kr.co.zumo.app.lifeplus.view.dialog;
|
|
|
+
|
|
|
+import android.content.DialogInterface;
|
|
|
+import android.os.Bundle;
|
|
|
+import android.support.annotation.NonNull;
|
|
|
+import android.support.annotation.Nullable;
|
|
|
+import android.support.v4.app.DialogFragment;
|
|
|
+import android.view.LayoutInflater;
|
|
|
+import android.view.View;
|
|
|
+import android.view.ViewGroup;
|
|
|
+import android.widget.TextView;
|
|
|
+
|
|
|
+import kr.co.zumo.app.R;
|
|
|
+import kr.co.zumo.app.lifeplus.util.StringUtil;
|
|
|
+
|
|
|
+/**
|
|
|
+ * AlertDialog
|
|
|
+ * <pre>
|
|
|
+ * </pre>
|
|
|
+ *
|
|
|
+ * @author 민효동
|
|
|
+ * @version 1.0
|
|
|
+ * @history 민효동 [2018. 9. 23.] [최초 작성]
|
|
|
+ * @since 2018. 9. 23.
|
|
|
+ */
|
|
|
+public class AlertDialog extends DialogBase {
|
|
|
+
|
|
|
+ private String text;
|
|
|
+ private TextView textView;
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void onCreate(Bundle savedInstanceState) {
|
|
|
+ setStyle(DialogFragment.STYLE_NO_TITLE, android.R.style.Theme_Translucent_NoTitleBar_Fullscreen);
|
|
|
+ setStyle(DialogFragment.STYLE_NO_FRAME, android.R.style.Theme_Translucent_NoTitleBar_Fullscreen);
|
|
|
+ super.onCreate(savedInstanceState);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void onDestroyView() {
|
|
|
+ super.onDestroyView();
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 표시할 text 지정
|
|
|
+ *
|
|
|
+ * @param url
|
|
|
+ */
|
|
|
+ public void setText(String url) {
|
|
|
+ this.text = url;
|
|
|
+
|
|
|
+ render();
|
|
|
+ }
|
|
|
+
|
|
|
+ private void render() {
|
|
|
+ if (null != textView && StringUtil.isFull(text)) {
|
|
|
+ textView.setText(text);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ @Nullable
|
|
|
+ @Override
|
|
|
+ public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, Bundle savedInstanceState) {
|
|
|
+ return inflater.inflate(R.layout.alert_dialog, container, false);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void onActivityCreated(Bundle savedInstanceState) {
|
|
|
+ super.onActivityCreated(savedInstanceState);
|
|
|
+
|
|
|
+ textView = getView().findViewById(R.id.text_alert_message);
|
|
|
+
|
|
|
+ render();
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void setEnabled() {
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void setDisabled() {
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void restart() {
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void onDismiss(DialogInterface dialog) {
|
|
|
+ super.onDismiss(dialog);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void onCancel(DialogInterface dialog) {
|
|
|
+ super.onCancel(dialog);
|
|
|
+
|
|
|
+ if (null != resultListener) {
|
|
|
+ resultListener.onDialogResult(this, DialogResult.CODE_CANCEL, null);
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|