- Add Watchlist charts - Add Detail Activity for Watchlist coins - Add padding for Watchlist - Remove superfluous 0s when displaying balance/price - Fix Summary Detail Button not changing form - Fix app crash when Marketcap fragment is not fully loaded - Fix separate Fragment update obligations - Fix 0 coin in Detail activity when coming from Watchlist
124 lines
3.3 KiB
Java
124 lines
3.3 KiB
Java
package com.nauk.coinfolio.DataManagers;
|
|
|
|
import android.content.SharedPreferences;
|
|
import android.preference.PreferenceManager;
|
|
|
|
/**
|
|
* Created by Guitoune on 09/01/2018.
|
|
*/
|
|
|
|
public class PreferencesManager {
|
|
|
|
private static final String currencyListFile = "CustomCurrencies";
|
|
private static final String preferencesFile = "Preferences";
|
|
private SharedPreferences settingPreferences;
|
|
private SharedPreferences currencyList;
|
|
private SharedPreferences preferencesList;
|
|
|
|
public PreferencesManager(android.content.Context context)
|
|
{
|
|
settingPreferences = PreferenceManager.getDefaultSharedPreferences(context);
|
|
currencyList = context.getSharedPreferences(currencyListFile, 0);
|
|
preferencesList = context.getSharedPreferences(preferencesFile, 0);
|
|
}
|
|
|
|
public void setDetailOption(boolean isExtended)
|
|
{
|
|
SharedPreferences.Editor editor = preferencesList.edit();
|
|
editor.putBoolean("DetailOption", isExtended);
|
|
editor.apply();
|
|
}
|
|
|
|
public boolean getDetailOption()
|
|
{
|
|
return preferencesList.getBoolean("DetailOption", true);
|
|
}
|
|
|
|
public String getHitBTCPublicKey()
|
|
{
|
|
return settingPreferences.getString("hitbtc_publickey", null);
|
|
}
|
|
|
|
public String getHitBTCPrivateKey()
|
|
{
|
|
return settingPreferences.getString("hitbtc_privatekey", null);
|
|
}
|
|
|
|
public boolean isHitBTCActivated()
|
|
{
|
|
return settingPreferences.getBoolean("enable_hitbtc", false);
|
|
}
|
|
|
|
public boolean isBalanceHidden()
|
|
{
|
|
return settingPreferences.getBoolean("hide_balance", false);
|
|
}
|
|
|
|
public void disableHitBTC()
|
|
{
|
|
SharedPreferences.Editor editor = settingPreferences.edit();
|
|
editor.putBoolean("enable_hitbtc", false);
|
|
editor.apply();
|
|
}
|
|
|
|
public String getBinancePublicKey()
|
|
{
|
|
return settingPreferences.getString("binance_publickey", null);
|
|
}
|
|
|
|
public String getBinancePrivateKey()
|
|
{
|
|
return settingPreferences.getString("binance_privatekey", null);
|
|
}
|
|
|
|
public boolean isBinanceActivated()
|
|
{
|
|
return settingPreferences.getBoolean("enable_binance", false);
|
|
}
|
|
|
|
public void disableBinance()
|
|
{
|
|
SharedPreferences.Editor editor = settingPreferences.edit();
|
|
editor.putBoolean("enable_binance", false);
|
|
editor.apply();
|
|
}
|
|
|
|
public void setMustUpdateWatchlist(boolean mustUpdate)
|
|
{
|
|
SharedPreferences.Editor editor = settingPreferences.edit();
|
|
editor.putBoolean("mustUpdateWatchlist", mustUpdate);
|
|
editor.apply();
|
|
}
|
|
|
|
public boolean mustUpdateWatchlist()
|
|
{
|
|
boolean mustUpdate = settingPreferences.getBoolean("mustUpdateWatchlist", false);
|
|
|
|
if(mustUpdate)
|
|
{
|
|
setMustUpdateWatchlist(false);
|
|
}
|
|
|
|
return mustUpdate;
|
|
}
|
|
|
|
public void setMustUpdateSummary(boolean mustUpdate)
|
|
{
|
|
SharedPreferences.Editor editor = settingPreferences.edit();
|
|
editor.putBoolean("mustUpdateSummary", mustUpdate);
|
|
editor.apply();
|
|
}
|
|
|
|
public boolean mustUpdateSummary()
|
|
{
|
|
boolean mustUpdate = settingPreferences.getBoolean("mustUpdateSummary", false);
|
|
|
|
if(mustUpdate)
|
|
{
|
|
setMustUpdateSummary(false);
|
|
}
|
|
|
|
return mustUpdate;
|
|
}
|
|
}
|