package hotchemi.android.rate;

import android.view.View;

import java.lang.ref.WeakReference;

final class DialogOptions {

    private boolean showNeutralButton = true;

    private boolean showTitle = true;

    private int titleResId = R.string.rate_dialog_title;

    private int messageResId = R.string.rate_dialog_message;

    private int textPositiveResId = R.string.rate_dialog_ok;

    private int textNeutralResId = R.string.rate_dialog_cancel;

    private int textNegativeResId = R.string.rate_dialog_no;

    private WeakReference<View> view;

    private WeakReference<OnClickButtonListener> listener;

    public boolean shouldShowNeutralButton() {
        return showNeutralButton;
    }

    public void setShowNeutralButton(boolean showNeutralButton) {
        this.showNeutralButton = showNeutralButton;
    }

    public boolean shouldShowTitle() {
        return showTitle;
    }

    public void setShowTitle(boolean showTitle) {
        this.showTitle = showTitle;
    }

    public int getTitleResId() {
        return titleResId;
    }

    public void setTitleResId(int titleResId) {
        this.titleResId = titleResId;
    }

    public int getMessageResId() {
        return messageResId;
    }

    public void setMessageResId(int messageResId) {
        this.messageResId = messageResId;
    }

    public int getTextPositiveResId() {
        return textPositiveResId;
    }

    public void setTextPositiveResId(int textPositiveResId) {
        this.textPositiveResId = textPositiveResId;
    }

    public int getTextNeutralResId() {
        return textNeutralResId;
    }

    public void setTextNeutralResId(int textNeutralResId) {
        this.textNeutralResId = textNeutralResId;
    }

    public int getTextNegativeResId() {
        return textNegativeResId;
    }

    public void setTextNegativeResId(int textNegativeResId) {
        this.textNegativeResId = textNegativeResId;
    }

    public View getView() {
        if (view == null) {
            return null;
        }
        return view.get();
    }

    public void setView(View view) {
        this.view = new WeakReference<>(view);
    }

    public OnClickButtonListener getListener() {
        if (listener == null) {
            return null;
        }
        return listener.get();
    }

    public void setListener(OnClickButtonListener listener) {
        this.listener = new WeakReference<>(listener);
    }

}

@@ -56,45 +56,8 @@
 w;%0A%0A
-import java.lang.ref.WeakReference;%0A%0A
 fina
@@ -492,27 +492,12 @@
 ate 
-WeakReference%3C
 View
-%3E
  vie
@@ -512,30 +512,16 @@
 private 
-WeakReference%3C
 OnClickB
@@ -533,17 +533,16 @@
 Listener
-%3E
  listene
@@ -1887,71 +1887,8 @@
 ) %7B%0A
-        if (view == null) %7B%0A            return null;%0A        %7D%0A
     
@@ -1902,22 +1902,16 @@
 urn view
-.get()
 ;%0A    %7D%0A
@@ -1972,33 +1972,12 @@
 w = 
-new WeakReference%3C%3E(
 view
-)
 ;%0A  
@@ -2034,75 +2034,8 @@
 ) %7B%0A
-        if (listener == null) %7B%0A            return null;%0A        %7D%0A
     
@@ -2057,14 +2057,8 @@
 ener
-.get()
 ;%0A  
@@ -2152,36 +2152,16 @@
 r = 
-new WeakReference%3C%3E(
 listener
 );%0A 
@@ -2156,17 +2156,16 @@
 listener
-)
 ;%0A    %7D%0A

Delete weakreference.