66import android .net .Uri ;
77import android .os .Bundle ;
88
9+ import androidx .annotation .Nullable ;
10+
911import com .blogspot .e_kanivets .moneytracker .MtApp ;
10- import com .blogspot .e_kanivets .moneytracker .R ;
1112import com .blogspot .e_kanivets .moneytracker .controller .PreferenceController ;
13+ import com .blogspot .e_kanivets .moneytracker .databinding .DialogRateBinding ;
1214
1315import javax .inject .Inject ;
1416
15- import butterknife .ButterKnife ;
16- import butterknife .OnClick ;
17-
1817public class AppRateDialog extends AlertDialog {
1918 private static final String GP_MARKET = "market://details?id=" ;
2019
2120 private Context context ;
21+ private DialogRateBinding binding ;
2222
2323 @ Inject
2424 PreferenceController preferenceController ;
@@ -30,25 +30,23 @@ public AppRateDialog(Context context) {
3030 }
3131
3232 @ Override
33- protected void onCreate (Bundle savedInstanceState ) {
33+ protected void onCreate (@ Nullable Bundle savedInstanceState ) {
3434 super .onCreate (savedInstanceState );
35- setContentView (R .layout .dialog_rate );
36- ButterKnife .bind (AppRateDialog .this );
35+
36+ binding = DialogRateBinding .inflate (getLayoutInflater ());
37+ setContentView (binding .getRoot ());
38+
39+ binding .yesButton .setOnClickListener (view -> yes ());
40+ binding .maybeButton .setOnClickListener (view -> dismiss ());
41+ binding .thanksButton .setOnClickListener (view -> thanks ());
3742 }
3843
39- @ OnClick (R .id .yes_button )
4044 public void yes () {
4145 context .startActivity (new Intent (Intent .ACTION_VIEW , Uri .parse (GP_MARKET + context .getPackageName ())));
4246 preferenceController .appRated ();
4347 dismiss ();
4448 }
4549
46- @ OnClick (R .id .maybeButton )
47- public void maybe () {
48- dismiss ();
49- }
50-
51- @ OnClick (R .id .thanksButton )
5250 public void thanks () {
5351 preferenceController .appRated ();
5452 dismiss ();
@@ -62,4 +60,4 @@ public void dismiss() {
6260 e .printStackTrace ();
6361 }
6462 }
65- }
63+ }
0 commit comments