// Path: app/src/main/java/dynoapps/exchange_rates/App.java
// public class App extends Application {
//     private static App appInstance;
// 
//     public static App getInstance() {
//         return appInstance;
//     }
// 
//     @NonNull
//     public static Context context() {
//         return appInstance.getApplicationContext();
//     }
// 
//     public AlarmsRepository provideAlarmsRepository() {
//         return AlarmsRepository.getInstance(getApplicationContext());
//     }
// 
//     @SuppressLint("CheckResult")
//     @Override
//     public void onCreate() {
//         super.onCreate();
//         appInstance = this;
// 
//         RxJavaPlugins.setErrorHandler(throwable -> L.e("App", throwable.getLocalizedMessage()));
//     }
// 
//     /**
//      * Enum used to identify the tracker that needs to be used for tracking.
//      * <p/>
//      * A single tracker is usually enough for most purposes. In case you do need multiple trackers,
//      * storing them all in Application object helps ensure that they are created only once per
//      * application instance.
//      */
//     public enum TrackerName {
//         APP_TRACKER, // Tracker used only in this app.
//         GLOBAL_TRACKER, // Tracker used by all the apps from a company. eg: roll-up tracking.
//     }
// 
// 
// }
// 
// Path: app/src/main/java/dynoapps/exchange_rates/Prefs.java
// public class Prefs {
//     private static final String SOURCES = "SOURCES";
//     private static final String INTERVAL = "INTERVAL";
//     private static final String ALARMS = "ALARMS";
//     private static final String ALARM_ENABLED = "ALARM_ENABLED";
// 
//     private static SharedPreferences getPrefs(Context context) {
//         return PreferenceManager.getDefaultSharedPreferences(context);
//     }
// 
//     public static boolean isAlarmEnabled() {
//         return getPrefs(App.context()).getBoolean(ALARM_ENABLED, true);
//     }
// 
//     public static void saveAlarmEnabled(boolean enabled) {
//         saveBoolean(ALARM_ENABLED, enabled);
//     }
// 
// 
//     public static void saveSources(String sources) {
//         saveString(SOURCES, sources);
//     }
// 
//     public static String getSources() {
//         return getPrefs(App.context()).getString(SOURCES, null);
//     }
// 
// 
//     public static void saveAlarms(String alarms_json) {
//         saveString(ALARMS, alarms_json);
//     }
// 
//     public static String getAlarms() {
//         return getPrefs(App.context()).getString(ALARMS, null);
//     }
// 
//     public static void saveInterval(Context context, long interval) {
//         SharedPreferences preferences = getPrefs(context);
//         SharedPreferences.Editor editor = preferences.edit();
//         editor.putLong(INTERVAL, interval);
//         editor.apply();
//     }
// 
//     public static long getInterval(Context context) {
//         return getPrefs(context).getLong(INTERVAL, -1);
//     }
// 
//     private static void saveString(String key, String value) {
//         SharedPreferences preferences = getPrefs(App.context());
//         SharedPreferences.Editor editor = preferences.edit();
//         editor.putString(key, value);
//         editor.apply();
//     }
// 
//     private static void saveBoolean(String key, boolean value) {
//         SharedPreferences preferences = getPrefs(App.context());
//         SharedPreferences.Editor editor = preferences.edit();
//         editor.putBoolean(key, value);
//         editor.apply();
//     }
// 
// }
// 
// Path: app/src/main/java/dynoapps/exchange_rates/util/CollectionUtils.java
// public class CollectionUtils {
//     public static <E> E getInstance(List<E> list, Class<?> clazz) {
//         for (E e : list) {
//             if (clazz.isInstance(e)) {
//                 return e;
//             }
//         }
//         return null;
//     }
// 
//     public static <E> int size(List<E> list) {
//         return list == null ? 0 : list.size();
//     }
// 
//     public static <E> int size(E[] array) {
//         return array == null ? 0 : array.length;
//     }
// 
//     public static <E> boolean isNullOrEmpty(List<E> list) {
//         return list == null || list.size() < 1;
//     }
// 
//     public static <E> boolean isNullOrEmpty(E[] array) {
//         return array == null || array.length < 1;
//     }
// 
// }


import android.app.Activity;
import java.util.ArrayList;
import java.util.concurrent.TimeUnit;
import androidx.appcompat.app.AlertDialog;
import dynoapps.exchange_rates.App;
import dynoapps.exchange_rates.Prefs;
import dynoapps.exchange_rates.R;
import dynoapps.exchange_rates.util.CollectionUtils;
import io.reactivex.subjects.PublishSubject;
package dynoapps.exchange_rates.time;




/**
 * Created by erdemmac on 03/12/2016.
 */

public final class TimeIntervalManager {

    private static final int DEFAULT_INTERVAL_INDEX = 2;
    private static final int INTERVAL_SERVICE_INDEX = 4;
// Path: app/src/main/java/dynoapps/exchange_rates/App.java
// public class App extends Application {
//     private static App appInstance;
// 
//     public static App getInstance() {
//         return appInstance;
//     }
// 
//     @NonNull
//     public static Context context() {
//         return appInstance.getApplicationContext();
//     }
// 
//     public AlarmsRepository provideAlarmsRepository() {
//         return AlarmsRepository.getInstance(getApplicationContext());
//     }
// 
//     @SuppressLint("CheckResult")
//     @Override
//     public void onCreate() {
//         super.onCreate();
//         appInstance = this;
// 
//         RxJavaPlugins.setErrorHandler(throwable -> L.e("App", throwable.getLocalizedMessage()));
//     }
// 
//     /**
//      * Enum used to identify the tracker that needs to be used for tracking.
//      * <p/>
//      * A single tracker is usually enough for most purposes. In case you do need multiple trackers,
//      * storing them all in Application object helps ensure that they are created only once per
//      * application instance.
//      */
//     public enum TrackerName {
//         APP_TRACKER, // Tracker used only in this app.
//         GLOBAL_TRACKER, // Tracker used by all the apps from a company. eg: roll-up tracking.
//     }
// 
// 
// }
// 
// Path: app/src/main/java/dynoapps/exchange_rates/Prefs.java
// public class Prefs {
//     private static final String SOURCES = "SOURCES";
//     private static final String INTERVAL = "INTERVAL";
//     private static final String ALARMS = "ALARMS";
//     private static final String ALARM_ENABLED = "ALARM_ENABLED";
// 
//     private static SharedPreferences getPrefs(Context context) {
//         return PreferenceManager.getDefaultSharedPreferences(context);
//     }
// 
//     public static boolean isAlarmEnabled() {
//         return getPrefs(App.context()).getBoolean(ALARM_ENABLED, true);
//     }
// 
//     public static void saveAlarmEnabled(boolean enabled) {
//         saveBoolean(ALARM_ENABLED, enabled);
//     }
// 
// 
//     public static void saveSources(String sources) {
//         saveString(SOURCES, sources);
//     }
// 
//     public static String getSources() {
//         return getPrefs(App.context()).getString(SOURCES, null);
//     }
// 
// 
//     public static void saveAlarms(String alarms_json) {
//         saveString(ALARMS, alarms_json);
//     }
// 
//     public static String getAlarms() {
//         return getPrefs(App.context()).getString(ALARMS, null);
//     }
// 
//     public static void saveInterval(Context context, long interval) {
//         SharedPreferences preferences = getPrefs(context);
//         SharedPreferences.Editor editor = preferences.edit();
//         editor.putLong(INTERVAL, interval);
//         editor.apply();
//     }
// 
//     public static long getInterval(Context context) {
//         return getPrefs(context).getLong(INTERVAL, -1);
//     }
// 
//     private static void saveString(String key, String value) {
//         SharedPreferences preferences = getPrefs(App.context());
//         SharedPreferences.Editor editor = preferences.edit();
//         editor.putString(key, value);
//         editor.apply();
//     }
// 
//     private static void saveBoolean(String key, boolean value) {
//         SharedPreferences preferences = getPrefs(App.context());
//         SharedPreferences.Editor editor = preferences.edit();
//         editor.putBoolean(key, value);
//         editor.apply();
//     }
// 
// }
// 
// Path: app/src/main/java/dynoapps/exchange_rates/util/CollectionUtils.java
// public class CollectionUtils {
//     public static <E> E getInstance(List<E> list, Class<?> clazz) {
//         for (E e : list) {
//             if (clazz.isInstance(e)) {
//                 return e;
//             }
//         }
//         return null;
//     }
// 
//     public static <E> int size(List<E> list) {
//         return list == null ? 0 : list.size();
//     }
// 
//     public static <E> int size(E[] array) {
//         return array == null ? 0 : array.length;
//     }
// 
//     public static <E> boolean isNullOrEmpty(List<E> list) {
//         return list == null || list.size() < 1;
//     }
// 
//     public static <E> boolean isNullOrEmpty(E[] array) {
//         return array == null || array.length < 1;
//     }
// 
// }


// Path: app/src/main/java/dynoapps/exchange_rates/time/TimeIntervalManager.java
import android.app.Activity;
import java.util.ArrayList;
import java.util.concurrent.TimeUnit;
import androidx.appcompat.app.AlertDialog;
import dynoapps.exchange_rates.App;
import dynoapps.exchange_rates.Prefs;
import dynoapps.exchange_rates.R;
import dynoapps.exchange_rates.util.CollectionUtils;
import io.reactivex.subjects.PublishSubject;

package dynoapps.exchange_rates.time;




/**
 * Created by erdemmac on 03/12/2016.
 */

public final class TimeIntervalManager {

    private static final int DEFAULT_INTERVAL_INDEX = 2;
    private static final int INTERVAL_SERVICE_INDEX = 4;
    private static final long PREF_INTERVAL_MILLIS = Prefs.getInterval(App.context());