Search in sources :

Example 1 with RichNotification

use of com.frostwire.android.gui.views.RichNotification 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)

Example 2 with RichNotification

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

the class TransfersFragment method initStorageRelatedRichNotifications.

public void initStorageRelatedRichNotifications(View v) {
    if (v == null) {
        v = getView();
    }
    RichNotification sdCardNotification = findView(v, R.id.fragment_transfers_sd_card_notification);
    sdCardNotification.setVisibility(View.GONE);
    RichNotification internalMemoryNotification = findView(v, R.id.fragment_transfers_internal_memory_notification);
    internalMemoryNotification.setVisibility(View.GONE);
    if (!isVisible()) {
        // this will be invoked later again onResume, don't bother now if it's not visible
        return;
    }
    if (TransferManager.isUsingSDCardPrivateStorage() && !sdCardNotification.wasDismissed()) {
        String currentPath = ConfigurationManager.instance().getStoragePath();
        boolean inPrivateFolder = currentPath.contains("Android/data");
        if (inPrivateFolder) {
            sdCardNotification.setVisibility(View.VISIBLE);
            sdCardNotification.setOnClickListener(v12 -> showStoragePreference());
        }
    }
    // if you do have an SD Card mounted and you're using internal memory, we'll let you know
    // that you now can use the SD Card. We'll keep this for a few releases.
    File sdCardDir = getBiggestSDCardDir(getActivity());
    if (sdCardDir != null && com.frostwire.android.util.SystemUtils.isSecondaryExternalStorageMounted(sdCardDir) && !TransferManager.isUsingSDCardPrivateStorage() && !internalMemoryNotification.wasDismissed()) {
        String bytesAvailableInHuman = UIUtils.getBytesInHuman(com.frostwire.android.util.SystemUtils.getAvailableStorageSize(sdCardDir));
        String internalMemoryNotificationDescription = getString(R.string.saving_to_internal_memory_description, bytesAvailableInHuman);
        internalMemoryNotification.setDescription(internalMemoryNotificationDescription);
        internalMemoryNotification.setVisibility(View.VISIBLE);
        internalMemoryNotification.setOnClickListener(v1 -> showStoragePreference());
    }
}
Also used : RichNotification(com.frostwire.android.gui.views.RichNotification) File(java.io.File)

Aggregations

RichNotification (com.frostwire.android.gui.views.RichNotification)2 ConfigurationManager (com.frostwire.android.core.ConfigurationManager)1 OnFeedbackClickAdapter (com.frostwire.android.gui.adapters.OnFeedbackClickAdapter)1 RichNotificationActionLink (com.frostwire.android.gui.views.RichNotificationActionLink)1 File (java.io.File)1