From 2482b09c88fe3d8197189a828a156e8e3daad802 Mon Sep 17 00:00:00 2001 From: pocho23 Date: Thu, 12 Mar 2015 18:55:57 +0100 Subject: [PATCH] fix on action listener --- .../src/com/androidsx/rateme/DialogRateMe.java | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/LibraryRateMe/src/com/androidsx/rateme/DialogRateMe.java b/LibraryRateMe/src/com/androidsx/rateme/DialogRateMe.java index 23c7578..8f872af 100644 --- a/LibraryRateMe/src/com/androidsx/rateme/DialogRateMe.java +++ b/LibraryRateMe/src/com/androidsx/rateme/DialogRateMe.java @@ -128,7 +128,9 @@ public void onClick(View v) { RateMeDialogTimer.clearSharedPreferences(getActivity()); Log.d(TAG, "clear preferences"); RateMeDialogTimer.setOptOut(getActivity(), true); - onActionListener.onHandleRateMeAction(RateMeAction.DISMISSED_WITH_CROSS, ratingBar.getRating()); + if (onActionListener != null) { + onActionListener.onHandleRateMeAction(RateMeAction.DISMISSED_WITH_CROSS, ratingBar.getRating()); + } } }); @@ -144,7 +146,10 @@ public void onClick(View v) { public void onClick(View v) { startActivity(shareApp(appPackageName)); Log.d(TAG, "share App"); - onActionListener.onHandleRateMeAction(RateMeAction.SHARED_APP, ratingBar.getRating()); + if (onActionListener != null) { + onActionListener.onHandleRateMeAction(RateMeAction.SHARED_APP, ratingBar.getRating()); + } + } }); }catch (Exception e){ @@ -261,7 +266,9 @@ public void onClick(View v) { rateApp(); Log.d(TAG, "go to Google Play Store for Rate-Me"); RateMeDialogTimer.setOptOut(getActivity(), true); - onActionListener.onHandleRateMeAction(RateMeAction.HIGH_RATING_WENT_TO_GOOGLE_PLAY, ratingBar.getRating()); + if (onActionListener != null) { + onActionListener.onHandleRateMeAction(RateMeAction.HIGH_RATING_WENT_TO_GOOGLE_PLAY, ratingBar.getRating()); + } dismiss(); } }); @@ -276,7 +283,9 @@ public void onClick(View v) { Log.d(TAG, "got to Mail for explain what is the problem"); } else { dismiss(); - onActionListener.onHandleRateMeAction(RateMeAction.LOW_RATING, ratingBar.getRating()); + if (onActionListener != null) { + onActionListener.onHandleRateMeAction(RateMeAction.LOW_RATING, ratingBar.getRating()); + } } RateMeDialogTimer.setOptOut(getActivity(), true); }