Skip to content

Commit

Permalink
LIBbb20905 Add SoftReference to OnClickButtonListener hotchemi/Androi…
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexanderLS committed Sep 5, 2018
1 parent 7ab1440 commit 25f8a80
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import android.content.Context;
import android.view.View;

import java.lang.ref.WeakReference;
import java.lang.ref.SoftReference;

import androidx.annotation.Nullable;

Expand Down Expand Up @@ -56,7 +56,7 @@ public final class DialogOptions {

private View view = null;

private OnClickButtonListener listener = null;
private SoftReference<OnClickButtonListener> listener = null;

DialogOptions() {
}
Expand Down Expand Up @@ -148,11 +148,11 @@ void setView(View view) {

@Nullable
OnClickButtonListener getListener() {
return listener;
return listener != null ? listener.get() : null;
}

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

public String getTitleText(Context context) {
Expand Down

0 comments on commit 25f8a80

Please sign in to comment.