diff --git a/android/src/com/mapswithme/maps/editor/ViralFragment.java b/android/src/com/mapswithme/maps/editor/ViralFragment.java index 62c7631deb..ed146e69e5 100644 --- a/android/src/com/mapswithme/maps/editor/ViralFragment.java +++ b/android/src/com/mapswithme/maps/editor/ViralFragment.java @@ -21,7 +21,10 @@ public class ViralFragment extends BaseMwmDialogFragment { private static final String EXTRA_CONTRATS_SHOWN = "CongratsShown"; - private static String sViralText; + private String mViralText; + + private final String viralChangesMsg = getString(R.string.editor_done_dialog_1); + private final String viralRatingMsg = getString(R.string.editor_done_dialog_2, getUserEditorRank()); public static boolean shouldDisplay() { @@ -41,13 +44,12 @@ public class ViralFragment extends BaseMwmDialogFragment public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { MwmApplication.prefs().edit().putBoolean(EXTRA_CONTRATS_SHOWN, true).apply(); - Statistics.INSTANCE.trackEvent(Statistics.EventName.EDITOR_SHARE_SHOW); @SuppressLint("InflateParams") final View root = inflater.inflate(R.layout.fragment_editor_viral, null); TextView viralText = (TextView) root.findViewById(R.id.viral); initViralText(); - viralText.setText(sViralText); + viralText.setText(mViralText); root.findViewById(R.id.tell_friend).setOnClickListener(new View.OnClickListener() { @Override @@ -66,6 +68,8 @@ public class ViralFragment extends BaseMwmDialogFragment dismiss(); } }); + Statistics.INSTANCE.trackEvent(Statistics.EventName.EDITOR_SHARE_SHOW, + Statistics.params().add("showed", mViralText.equals(viralChangesMsg) ? "change" : "rating")); return root; } @@ -76,24 +80,11 @@ public class ViralFragment extends BaseMwmDialogFragment private void initViralText() { - if (sViralText != null) - return; - - switch (new Random().nextInt(2)) - { - case 0: - sViralText = getString(R.string.editor_done_dialog_1); - break; - case 1: - sViralText = getString(R.string.editor_done_dialog_2, getUserEditorRank()); - break; - default: - sViralText = getString(R.string.editor_done_dialog_3); - } + mViralText = new Random().nextBoolean() ? viralChangesMsg : viralRatingMsg; } // Counts fake rank in the rating of editors. - private int getUserEditorRank() + private static int getUserEditorRank() { return 1000 + new Random().nextInt(1000); } diff --git a/android/src/com/mapswithme/maps/settings/AboutFragment.java b/android/src/com/mapswithme/maps/settings/AboutFragment.java index 06df835bd2..4bf2e94014 100644 --- a/android/src/com/mapswithme/maps/settings/AboutFragment.java +++ b/android/src/com/mapswithme/maps/settings/AboutFragment.java @@ -58,7 +58,7 @@ public class AboutFragment extends BaseSettingsFragment .setText(getString(R.string.version, BuildConfig.VERSION_NAME)); ((TextView) mFrame.findViewById(R.id.data_version)) - .setText(getString(R.string.data_version, Framework.nativeGetDataVersion())); + .setText(getString(R.string.data_version, Framework.nativeGetDataVersion())); setupItem(R.id.web, true); setupItem(R.id.blog, true);