Search in sources :

Example 1 with RichNotificationActionLink

use of com.frostwire.android.gui.views.RichNotificationActionLink in project frostwire by frostwire.

the class SearchFragment method showRatingsReminder.

private void showRatingsReminder(View v) {
    final RichNotification ratingReminder = findView(v, R.id.fragment_search_rating_reminder_notification);
    ratingReminder.setVisibility(View.GONE);
    final ConfigurationManager CM = ConfigurationManager.instance();
    boolean alreadyRated = CM.getBoolean(Constants.PREF_KEY_GUI_ALREADY_RATED_US_IN_MARKET);
    if (alreadyRated || ratingReminder.wasDismissed()) {
        // LOG.info("SearchFragment.showRatingsReminder() aborted. alreadyRated="+alreadyRated + " wasDismissed=" + ratingReminder.wasDismissed());
        return;
    }
    long installationTimestamp = CM.getLong(Constants.PREF_KEY_GUI_INSTALLATION_TIMESTAMP);
    long daysInstalled = TimeUnit.MILLISECONDS.toDays(System.currentTimeMillis() - installationTimestamp);
    if (installationTimestamp == -1 || daysInstalled < 5) {
        // LOG.info("SearchFragment.showRatingsReminder() aborted. Too soon to show ratings reminder. daysInstalled=" + daysInstalled);
        return;
    }
    ClickAdapter<SearchFragment> onRateAdapter = new OnRateClickAdapter(SearchFragment.this, ratingReminder, CM);
    ratingReminder.setOnClickListener(onRateAdapter);
    RichNotificationActionLink rateFrostWireActionLink = new RichNotificationActionLink(ratingReminder.getContext(), getString(R.string.love_frostwire), onRateAdapter);
    RichNotificationActionLink sendFeedbackActionLink = new RichNotificationActionLink(ratingReminder.getContext(), getString(R.string.send_feedback), new OnFeedbackClickAdapter(this, ratingReminder, CM));
    ratingReminder.updateActionLinks(rateFrostWireActionLink, sendFeedbackActionLink);
    ratingReminder.setVisibility(View.VISIBLE);
}
Also used : RichNotificationActionLink(com.frostwire.android.gui.views.RichNotificationActionLink) RichNotification(com.frostwire.android.gui.views.RichNotification) ConfigurationManager(com.frostwire.android.core.ConfigurationManager) OnFeedbackClickAdapter(com.frostwire.android.gui.adapters.OnFeedbackClickAdapter)

Aggregations

ConfigurationManager (com.frostwire.android.core.ConfigurationManager)1 OnFeedbackClickAdapter (com.frostwire.android.gui.adapters.OnFeedbackClickAdapter)1 RichNotification (com.frostwire.android.gui.views.RichNotification)1 RichNotificationActionLink (com.frostwire.android.gui.views.RichNotificationActionLink)1