|
|
@@ -3,7 +3,6 @@ package kr.co.zumo.app.lifeplus.view.dialog;
|
|
|
import android.os.Bundle;
|
|
|
import android.support.annotation.NonNull;
|
|
|
import android.support.annotation.Nullable;
|
|
|
-import android.support.annotation.StringRes;
|
|
|
import android.util.Log;
|
|
|
import android.view.LayoutInflater;
|
|
|
import android.view.View;
|
|
|
@@ -15,7 +14,7 @@ import kr.co.zumo.app.R;
|
|
|
import kr.co.zumo.app.lifeplus.view.Event;
|
|
|
|
|
|
/**
|
|
|
- * CurrentPageShareDialog
|
|
|
+ * ShareDialog
|
|
|
* <pre>
|
|
|
* </pre>
|
|
|
*
|
|
|
@@ -24,10 +23,15 @@ import kr.co.zumo.app.lifeplus.view.Event;
|
|
|
* @history 하세미 [2018-10-26] [최초 작성]
|
|
|
* @since 2018-10-26
|
|
|
*/
|
|
|
-public class CurrentPageShareDialog extends DialogBase {
|
|
|
+public class ShareDialog extends DialogBase {
|
|
|
+
|
|
|
+ public static final int TYPE_CODE = 0;
|
|
|
+ public static final int TYPE_PAGE_CURRENT = 1;
|
|
|
+ public static final int TYPE_PAGE_TOTAL = 2;
|
|
|
|
|
|
private int titleResource;
|
|
|
private int lastButtonNameResource;
|
|
|
+ private int type;
|
|
|
|
|
|
@Nullable
|
|
|
@Override
|
|
|
@@ -39,50 +43,69 @@ public class CurrentPageShareDialog extends DialogBase {
|
|
|
public void onActivityCreated(Bundle savedInstanceState) {
|
|
|
super.onActivityCreated(savedInstanceState);
|
|
|
|
|
|
- Log.e("APP# CurrentPageShareDialog | onActivityCreated", "|" + "onActivityCreated");
|
|
|
+ switch (type) {
|
|
|
+ case TYPE_CODE:
|
|
|
+ this.titleResource = R.string.code_share;
|
|
|
+ this.lastButtonNameResource = R.string.code_copy;
|
|
|
+ getView().findViewById(R.id.image_view_facebook).setVisibility(View.GONE);
|
|
|
+ getView().findViewById(R.id.image_view_email).setVisibility(View.GONE);
|
|
|
+ getView().findViewById(R.id.textView2).setVisibility(View.GONE);
|
|
|
+ getView().findViewById(R.id.textView3).setVisibility(View.GONE);
|
|
|
+ getView().findViewById(R.id.imageView2).setVisibility(View.GONE);
|
|
|
+ getView().findViewById(R.id.imageView3).setVisibility(View.GONE);
|
|
|
+ break;
|
|
|
+ case TYPE_PAGE_CURRENT:
|
|
|
+ this.titleResource = R.string.share_current_page_subject;
|
|
|
+ this.lastButtonNameResource = R.string.url;
|
|
|
+ break;
|
|
|
+ case TYPE_PAGE_TOTAL:
|
|
|
+ this.titleResource = R.string.share_total_page_subject;
|
|
|
+ this.lastButtonNameResource = R.string.url;
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ break;
|
|
|
+ }
|
|
|
+
|
|
|
+ Log.e("APP# ShareDialog | onActivityCreated", "|" + "onActivityCreated");
|
|
|
((TextView) getView().findViewById(R.id.text_view_dialog_title)).setText(titleResource);
|
|
|
((TextView) getView().findViewById(R.id.text_view_last_button_name)).setText(lastButtonNameResource);
|
|
|
|
|
|
-
|
|
|
Window window = getDialog().getWindow();
|
|
|
window.setBackgroundDrawableResource(R.color.C99000000);
|
|
|
|
|
|
getView().findViewById(R.id.image_view_cancel).setOnClickListener(view -> {
|
|
|
if (null != getCustomListener()) {
|
|
|
- getCustomListener().onDialogCanceled(CurrentPageShareDialog.this);
|
|
|
+ getCustomListener().onDialogCanceled(ShareDialog.this);
|
|
|
}
|
|
|
});
|
|
|
|
|
|
getView().findViewById(R.id.image_view_kakao).setOnClickListener(view -> {
|
|
|
if (null != getCustomListener()) {
|
|
|
- getCustomListener().onDialogResult(CurrentPageShareDialog.this, new Event.Builder(Event.KAKAO_TALK).build());
|
|
|
+ getCustomListener().onDialogResult(ShareDialog.this, new Event.Builder(Event.KAKAO_TALK).build());
|
|
|
}
|
|
|
});
|
|
|
|
|
|
getView().findViewById(R.id.image_view_facebook).setOnClickListener(view -> {
|
|
|
if (null != getCustomListener()) {
|
|
|
- getCustomListener().onDialogResult(CurrentPageShareDialog.this, new Event.Builder(Event.FACE_BOOK).build());
|
|
|
+ getCustomListener().onDialogResult(ShareDialog.this, new Event.Builder(Event.FACE_BOOK).build());
|
|
|
}
|
|
|
});
|
|
|
|
|
|
- getView().findViewById(R.id.image_view_url).setOnClickListener(view -> {
|
|
|
+ getView().findViewById(R.id.image_view_email).setOnClickListener(view -> {
|
|
|
if (null != getCustomListener()) {
|
|
|
- getCustomListener().onDialogResult(CurrentPageShareDialog.this, new Event.Builder(Event.CODE_COPY).build());
|
|
|
+ getCustomListener().onDialogResult(ShareDialog.this, new Event.Builder(Event.EMAIL_CLICK).build());
|
|
|
}
|
|
|
});
|
|
|
|
|
|
- getView().findViewById(R.id.image_view_email).setOnClickListener(view -> {
|
|
|
+ getView().findViewById(R.id.image_view_url).setOnClickListener(view -> {
|
|
|
if (null != getCustomListener()) {
|
|
|
- getCustomListener().onDialogResult(CurrentPageShareDialog.this, new Event.Builder(Event.EMAIL_CLICK).build());
|
|
|
+ getCustomListener().onDialogResult(ShareDialog.this, new Event.Builder(Event.CODE_COPY).build());
|
|
|
}
|
|
|
});
|
|
|
-
|
|
|
-
|
|
|
}
|
|
|
|
|
|
- public void setDialogType(@StringRes int titleResource, @StringRes int lastButtonNameResource) {
|
|
|
- this.titleResource = titleResource;
|
|
|
- this.lastButtonNameResource = lastButtonNameResource;
|
|
|
+ public void setDialogType(int type) {
|
|
|
+ this.type = type;
|
|
|
}
|
|
|
|
|
|
}
|