Android Open Source - simpleplayer Prefs Controller






From Project

Back to project page simpleplayer.

License

The source code is released under:

GNU General Public License

If you think the Android project simpleplayer listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package org.sergez.splayer.util;
//from w  w  w .  j  a  v a 2 s  .  c o m
import android.content.Context;
import android.content.SharedPreferences;
import android.preference.PreferenceManager;

import static org.sergez.splayer.util.PrefsConstants.*;


/**
 * @author Sergii Zhuk
 *         Date: 15.03.14
 *         Time: 21:18
 */
public final class PrefsController {

    private PrefsController() {

    }

    private static SharedPreferences getPrefs(Context context) {
        return PreferenceManager.getDefaultSharedPreferences(context);
    }

    public static boolean isPlayOnlyWhenButtonPressed(Context context) {
        return getPrefs(context).getBoolean(PREF_CHECKBOX_PLAY_ONLY_WHEN_BUTTON_PRESSED, false);
    }

    public static boolean isStopAfterEachFile(Context context) {
        return getPrefs(context).getBoolean(PREF_CHECKBOX_STOP_AFTER_EACH_FILE, false);
    }

    public static boolean isDonationStoppedToShow(Context context) {
        boolean result = getPrefs(context).getBoolean(PREF_STOP_SHOW_DONATION, false);
        return result;
    }

    public static void setDonationStoppedToShow(Context context, boolean stopToShow) {
        getPrefs(context).edit().putBoolean(PREF_STOP_SHOW_DONATION, stopToShow).commit();
    }

    public static boolean isTimeToShowDonationRequest(Context context) {
        long now = System.currentTimeMillis();
        long lastShow = getPrefs(context).getLong(PREF_LAST_DONATION_SHOW, now);
        if (now - lastShow >= Constants.INTERVAL_DAYS_SHOW_DONATE) {
            getPrefs(context).edit().putLong(PREF_LAST_DONATION_SHOW, now).commit();
            return true;
        } else {
            return false;
        }
    }

}




Java Source Code List

org.sergez.splayer.activity.AnimationMakeGoneListener.java
org.sergez.splayer.activity.AudioFxDemo.java
org.sergez.splayer.activity.DonationActivity.java
org.sergez.splayer.activity.ListData.java
org.sergez.splayer.activity.PlayFileAdapter.java
org.sergez.splayer.activity.PreferencesActivity.java
org.sergez.splayer.activity.SimplePlayerActivity.java
org.sergez.splayer.enums.RepeatState.java
org.sergez.splayer.enums.ShuffleState.java
org.sergez.splayer.inappbilling.Base64DecoderException.java
org.sergez.splayer.inappbilling.Base64.java
org.sergez.splayer.inappbilling.IabException.java
org.sergez.splayer.inappbilling.IabHelper.java
org.sergez.splayer.inappbilling.IabResult.java
org.sergez.splayer.inappbilling.Inventory.java
org.sergez.splayer.inappbilling.Purchase.java
org.sergez.splayer.inappbilling.Security.java
org.sergez.splayer.inappbilling.SkuDetails.java
org.sergez.splayer.service.SimplePlayerService.java
org.sergez.splayer.util.Constants.java
org.sergez.splayer.util.DialogUtils.java
org.sergez.splayer.util.DurationAlbumID.java
org.sergez.splayer.util.FileFormat.java
org.sergez.splayer.util.MediaFileData.java
org.sergez.splayer.util.MediaFileUtil.java
org.sergez.splayer.util.PlayerState.java
org.sergez.splayer.util.PrefsConstants.java
org.sergez.splayer.util.PrefsController.java
org.sergez.splayer.util.SortIgnoreCase.java
org.sergez.splayer.util.UIStateController.java
org.sergez.splayer.util.Utils.java
org.sergez.splayer.view.ScrollingTextView.java