- Preferred Language Setting is now working
This commit is contained in:
parent
0dd2afd47d
commit
e511fab358
10 changed files with 149 additions and 14 deletions
|
@ -12,6 +12,7 @@
|
||||||
android:label="Crystal"
|
android:label="Crystal"
|
||||||
android:roundIcon="@mipmap/ic_launcher_round"
|
android:roundIcon="@mipmap/ic_launcher_round"
|
||||||
android:supportsRtl="true"
|
android:supportsRtl="true"
|
||||||
|
android:configChanges="locale"
|
||||||
android:theme="@style/AppTheme">
|
android:theme="@style/AppTheme">
|
||||||
<activity android:name=".activities.IntroActivity"
|
<activity android:name=".activities.IntroActivity"
|
||||||
android:theme="@style/AppTheme.NoActionBar">
|
android:theme="@style/AppTheme.NoActionBar">
|
||||||
|
|
|
@ -4,6 +4,7 @@ import android.app.ActivityOptions;
|
||||||
import android.arch.lifecycle.LiveData;
|
import android.arch.lifecycle.LiveData;
|
||||||
import android.arch.lifecycle.ViewModelProviders;
|
import android.arch.lifecycle.ViewModelProviders;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
|
import android.content.res.Configuration;
|
||||||
import android.content.res.Resources;
|
import android.content.res.Resources;
|
||||||
import android.media.MediaPlayer;
|
import android.media.MediaPlayer;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
@ -24,6 +25,7 @@ import android.view.animation.LinearInterpolator;
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Locale;
|
||||||
|
|
||||||
import butterknife.BindColor;
|
import butterknife.BindColor;
|
||||||
import butterknife.BindView;
|
import butterknife.BindView;
|
||||||
|
|
|
@ -96,16 +96,16 @@ public class GeneralSettingsActivity extends AppCompatActivity {
|
||||||
@OnItemSelected(R.id.spPreferedCountry)
|
@OnItemSelected(R.id.spPreferedCountry)
|
||||||
void onItemSelected(int position) {
|
void onItemSelected(int position) {
|
||||||
if (position != 0) {
|
if (position != 0) {
|
||||||
GeneralSetting generalSettingCountryCode = this.getSetting(GeneralSetting.SETTING_NAME_PREFERED_COUNTRY);
|
GeneralSetting generalSettingCountryCode = this.getSetting(GeneralSetting.SETTING_NAME_PREFERRED_COUNTRY);
|
||||||
GeneralSetting generalSettingCurrency = this.getSetting(GeneralSetting.SETTING_NAME_PREFERED_CURRENCY);
|
GeneralSetting generalSettingCurrency = this.getSetting(GeneralSetting.SETTING_NAME_PREFERRED_CURRENCY);
|
||||||
|
|
||||||
if (generalSettingCountryCode == null){
|
if (generalSettingCountryCode == null){
|
||||||
generalSettingCountryCode = new GeneralSetting();
|
generalSettingCountryCode = new GeneralSetting();
|
||||||
generalSettingCountryCode.setName(GeneralSetting.SETTING_NAME_PREFERED_COUNTRY);
|
generalSettingCountryCode.setName(GeneralSetting.SETTING_NAME_PREFERRED_COUNTRY);
|
||||||
}
|
}
|
||||||
if (generalSettingCurrency == null){
|
if (generalSettingCurrency == null){
|
||||||
generalSettingCurrency = new GeneralSetting();
|
generalSettingCurrency = new GeneralSetting();
|
||||||
generalSettingCurrency.setName(GeneralSetting.SETTING_NAME_PREFERED_CURRENCY);
|
generalSettingCurrency.setName(GeneralSetting.SETTING_NAME_PREFERRED_CURRENCY);
|
||||||
}
|
}
|
||||||
|
|
||||||
String countryCode = countriesMap.get((String) spPreferedCountry.getSelectedItem());
|
String countryCode = countriesMap.get((String) spPreferedCountry.getSelectedItem());
|
||||||
|
@ -120,7 +120,7 @@ public class GeneralSettingsActivity extends AppCompatActivity {
|
||||||
|
|
||||||
public void loadSettings(List<GeneralSetting> generalSettings){
|
public void loadSettings(List<GeneralSetting> generalSettings){
|
||||||
for (GeneralSetting generalSetting:generalSettings) {
|
for (GeneralSetting generalSetting:generalSettings) {
|
||||||
if (generalSetting.getName().equals(GeneralSetting.SETTING_NAME_PREFERED_COUNTRY)){
|
if (generalSetting.getName().equals(GeneralSetting.SETTING_NAME_PREFERRED_COUNTRY)){
|
||||||
String preferedCountryCode = generalSetting.getValue();
|
String preferedCountryCode = generalSetting.getValue();
|
||||||
spPreferedCountry.setSelection(((ArrayAdapter<String>)spPreferedCountry.getAdapter()).getPosition(countriesMap.get(preferedCountryCode)));
|
spPreferedCountry.setSelection(((ArrayAdapter<String>)spPreferedCountry.getAdapter()).getPosition(countriesMap.get(preferedCountryCode)));
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,14 +2,20 @@ package cy.agorise.crystalwallet.application;
|
||||||
|
|
||||||
import android.app.Application;
|
import android.app.Application;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
|
import android.content.res.Configuration;
|
||||||
|
import android.content.res.Resources;
|
||||||
|
import android.util.DisplayMetrics;
|
||||||
|
|
||||||
import com.idescout.sql.SqlScoutServer;
|
import com.idescout.sql.SqlScoutServer;
|
||||||
|
|
||||||
|
import java.util.Locale;
|
||||||
|
|
||||||
import cy.agorise.crystalwallet.dao.CrystalDatabase;
|
import cy.agorise.crystalwallet.dao.CrystalDatabase;
|
||||||
import cy.agorise.crystalwallet.enums.CryptoNet;
|
import cy.agorise.crystalwallet.enums.CryptoNet;
|
||||||
import cy.agorise.crystalwallet.models.BitsharesAsset;
|
import cy.agorise.crystalwallet.models.BitsharesAsset;
|
||||||
import cy.agorise.crystalwallet.models.BitsharesAssetInfo;
|
import cy.agorise.crystalwallet.models.BitsharesAssetInfo;
|
||||||
import cy.agorise.crystalwallet.models.CryptoCurrencyEquivalence;
|
import cy.agorise.crystalwallet.models.CryptoCurrencyEquivalence;
|
||||||
|
import cy.agorise.crystalwallet.models.GeneralSetting;
|
||||||
import cy.agorise.crystalwallet.network.CryptoNetManager;
|
import cy.agorise.crystalwallet.network.CryptoNetManager;
|
||||||
import cy.agorise.crystalwallet.service.CrystalWalletService;
|
import cy.agorise.crystalwallet.service.CrystalWalletService;
|
||||||
|
|
||||||
|
@ -20,6 +26,8 @@ import cy.agorise.crystalwallet.service.CrystalWalletService;
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public class CrystalApplication extends Application {
|
public class CrystalApplication extends Application {
|
||||||
|
private Locale locale = null;
|
||||||
|
|
||||||
public static String BITSHARES_URL[] =
|
public static String BITSHARES_URL[] =
|
||||||
{
|
{
|
||||||
"wss://de.palmpay.io/ws", // Custom node
|
"wss://de.palmpay.io/ws", // Custom node
|
||||||
|
@ -78,6 +86,18 @@ public class CrystalApplication extends Application {
|
||||||
//Next line is for use the bitshares main net
|
//Next line is for use the bitshares main net
|
||||||
//CryptoNetManager.addCryptoNetURL(CryptoNet.BITSHARES,BITSHARES_URL);
|
//CryptoNetManager.addCryptoNetURL(CryptoNet.BITSHARES,BITSHARES_URL);
|
||||||
|
|
||||||
|
GeneralSetting generalSettingPreferredLanguage = db.generalSettingDao().getSettingByName(GeneralSetting.SETTING_NAME_PREFERRED_LANGUAGE);
|
||||||
|
|
||||||
|
if (generalSettingPreferredLanguage != null) {
|
||||||
|
Resources resources = getBaseContext().getResources();
|
||||||
|
Locale locale = new Locale(generalSettingPreferredLanguage.getValue());
|
||||||
|
Locale.setDefault(locale);
|
||||||
|
DisplayMetrics dm = resources.getDisplayMetrics();
|
||||||
|
Configuration configuration = resources.getConfiguration();
|
||||||
|
configuration.locale = locale;
|
||||||
|
resources.updateConfiguration(configuration, dm);
|
||||||
|
}
|
||||||
|
|
||||||
Intent intent = new Intent(getApplicationContext(), CrystalWalletService.class);
|
Intent intent = new Intent(getApplicationContext(), CrystalWalletService.class);
|
||||||
startService(intent);
|
startService(intent);
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,6 +24,9 @@ public interface GeneralSettingDao {
|
||||||
@Query("SELECT * FROM general_setting WHERE name = :name")
|
@Query("SELECT * FROM general_setting WHERE name = :name")
|
||||||
LiveData<GeneralSetting> getByName(String name);
|
LiveData<GeneralSetting> getByName(String name);
|
||||||
|
|
||||||
|
@Query("SELECT * FROM general_setting WHERE name = :name")
|
||||||
|
GeneralSetting getSettingByName(String name);
|
||||||
|
|
||||||
@Insert(onConflict = OnConflictStrategy.REPLACE)
|
@Insert(onConflict = OnConflictStrategy.REPLACE)
|
||||||
public long[] insertGeneralSettings(GeneralSetting... generalSettings);
|
public long[] insertGeneralSettings(GeneralSetting... generalSettings);
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,49 @@
|
||||||
|
package cy.agorise.crystalwallet.enums;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Locale;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by Henry Varona on 16/3/2018.
|
||||||
|
*/
|
||||||
|
|
||||||
|
public enum Language {
|
||||||
|
NOTSET("",""),ENGLISH("en","English"),SPANISH("es","Spanish");
|
||||||
|
|
||||||
|
protected String code;
|
||||||
|
|
||||||
|
protected String label;
|
||||||
|
|
||||||
|
private static Map<String, Language> codeMap = new HashMap<String, Language>();
|
||||||
|
static {
|
||||||
|
for (Language languageEnum : Language.values()) {
|
||||||
|
codeMap.put(languageEnum.code, languageEnum);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Language(String code, String label){
|
||||||
|
this.code = code;
|
||||||
|
this.label = label;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCode(){
|
||||||
|
return this.code;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getLabel(){
|
||||||
|
return this.label;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String toString(){
|
||||||
|
return this.getLabel();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Language getByCode(String code){
|
||||||
|
if (codeMap.containsKey(code)) {
|
||||||
|
return codeMap.get(code);
|
||||||
|
} else {
|
||||||
|
return Language.NOTSET;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -3,9 +3,14 @@ package cy.agorise.crystalwallet.fragments;
|
||||||
import android.arch.lifecycle.LiveData;
|
import android.arch.lifecycle.LiveData;
|
||||||
import android.arch.lifecycle.Observer;
|
import android.arch.lifecycle.Observer;
|
||||||
import android.arch.lifecycle.ViewModelProviders;
|
import android.arch.lifecycle.ViewModelProviders;
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.content.res.Configuration;
|
||||||
|
import android.content.res.Resources;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.support.annotation.Nullable;
|
import android.support.annotation.Nullable;
|
||||||
import android.support.v4.app.Fragment;
|
import android.support.v4.app.Fragment;
|
||||||
|
import android.support.v7.widget.ThemedSpinnerAdapter;
|
||||||
|
import android.util.DisplayMetrics;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
|
@ -23,9 +28,13 @@ import butterknife.BindView;
|
||||||
import butterknife.ButterKnife;
|
import butterknife.ButterKnife;
|
||||||
import butterknife.OnItemSelected;
|
import butterknife.OnItemSelected;
|
||||||
import cy.agorise.crystalwallet.R;
|
import cy.agorise.crystalwallet.R;
|
||||||
|
import cy.agorise.crystalwallet.dao.CrystalDatabase;
|
||||||
|
import cy.agorise.crystalwallet.enums.Language;
|
||||||
import cy.agorise.crystalwallet.models.GeneralSetting;
|
import cy.agorise.crystalwallet.models.GeneralSetting;
|
||||||
import cy.agorise.crystalwallet.viewmodels.GeneralSettingListViewModel;
|
import cy.agorise.crystalwallet.viewmodels.GeneralSettingListViewModel;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by xd on 12/28/17.
|
* Created by xd on 12/28/17.
|
||||||
*/
|
*/
|
||||||
|
@ -36,10 +45,15 @@ public class GeneralSettingsFragment extends Fragment {
|
||||||
private GeneralSettingListViewModel generalSettingListViewModel;
|
private GeneralSettingListViewModel generalSettingListViewModel;
|
||||||
private LiveData<List<GeneralSetting>> generalSettingListLiveData;
|
private LiveData<List<GeneralSetting>> generalSettingListLiveData;
|
||||||
|
|
||||||
|
private Boolean spPreferredLanguageInitialized;
|
||||||
|
|
||||||
@BindView (R.id.spTaxableCountry)
|
@BindView (R.id.spTaxableCountry)
|
||||||
Spinner spTaxableCountry;
|
Spinner spTaxableCountry;
|
||||||
|
@BindView (R.id.spPreferredLanguage)
|
||||||
|
Spinner spPreferredLanguage;
|
||||||
|
|
||||||
public GeneralSettingsFragment() {
|
public GeneralSettingsFragment() {
|
||||||
|
this.spPreferredLanguageInitialized = false;
|
||||||
// Required empty public constructor
|
// Required empty public constructor
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -47,6 +61,8 @@ public class GeneralSettingsFragment extends Fragment {
|
||||||
GeneralSettingsFragment fragment = new GeneralSettingsFragment();
|
GeneralSettingsFragment fragment = new GeneralSettingsFragment();
|
||||||
Bundle args = new Bundle();
|
Bundle args = new Bundle();
|
||||||
fragment.setArguments(args);
|
fragment.setArguments(args);
|
||||||
|
fragment.spPreferredLanguageInitialized = false;
|
||||||
|
|
||||||
return fragment;
|
return fragment;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -95,9 +111,17 @@ public class GeneralSettingsFragment extends Fragment {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return v;
|
return v;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void initPreferredLanguage(GeneralSetting preferredLanguageSetting){
|
||||||
|
ArrayAdapter<Language> preferredLanguageAdapter = new ArrayAdapter<Language>(getContext(), android.R.layout.simple_spinner_item, Language.values());
|
||||||
|
spPreferredLanguage.setAdapter(preferredLanguageAdapter);
|
||||||
|
spPreferredLanguage.setSelection(preferredLanguageAdapter.getPosition(Language.getByCode(preferredLanguageSetting.getValue())));
|
||||||
|
}
|
||||||
|
|
||||||
public GeneralSetting getSetting(String name){
|
public GeneralSetting getSetting(String name){
|
||||||
for (GeneralSetting generalSetting:this.generalSettingListLiveData.getValue()) {
|
for (GeneralSetting generalSetting:this.generalSettingListLiveData.getValue()) {
|
||||||
if (generalSetting.getName().equals(name)) {
|
if (generalSetting.getName().equals(name)) {
|
||||||
|
@ -111,16 +135,16 @@ public class GeneralSettingsFragment extends Fragment {
|
||||||
@OnItemSelected(R.id.spTaxableCountry)
|
@OnItemSelected(R.id.spTaxableCountry)
|
||||||
void onItemSelected(int position) {
|
void onItemSelected(int position) {
|
||||||
if (position != 0) {
|
if (position != 0) {
|
||||||
GeneralSetting generalSettingCountryCode = this.getSetting(GeneralSetting.SETTING_NAME_PREFERED_COUNTRY);
|
GeneralSetting generalSettingCountryCode = this.getSetting(GeneralSetting.SETTING_NAME_PREFERRED_COUNTRY);
|
||||||
GeneralSetting generalSettingCurrency = this.getSetting(GeneralSetting.SETTING_NAME_PREFERED_CURRENCY);
|
GeneralSetting generalSettingCurrency = this.getSetting(GeneralSetting.SETTING_NAME_PREFERRED_CURRENCY);
|
||||||
|
|
||||||
if (generalSettingCountryCode == null){
|
if (generalSettingCountryCode == null){
|
||||||
generalSettingCountryCode = new GeneralSetting();
|
generalSettingCountryCode = new GeneralSetting();
|
||||||
generalSettingCountryCode.setName(GeneralSetting.SETTING_NAME_PREFERED_COUNTRY);
|
generalSettingCountryCode.setName(GeneralSetting.SETTING_NAME_PREFERRED_COUNTRY);
|
||||||
}
|
}
|
||||||
if (generalSettingCurrency == null){
|
if (generalSettingCurrency == null){
|
||||||
generalSettingCurrency = new GeneralSetting();
|
generalSettingCurrency = new GeneralSetting();
|
||||||
generalSettingCurrency.setName(GeneralSetting.SETTING_NAME_PREFERED_CURRENCY);
|
generalSettingCurrency.setName(GeneralSetting.SETTING_NAME_PREFERRED_CURRENCY);
|
||||||
}
|
}
|
||||||
|
|
||||||
String countryCode = countriesMap.get((String) spTaxableCountry.getSelectedItem());
|
String countryCode = countriesMap.get((String) spTaxableCountry.getSelectedItem());
|
||||||
|
@ -133,11 +157,46 @@ public class GeneralSettingsFragment extends Fragment {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@OnItemSelected(R.id.spPreferredLanguage)
|
||||||
|
void onPreferredLanguageSelected(int position){
|
||||||
|
//The first call will be when the spinner gets an adapter attached
|
||||||
|
if (this.spPreferredLanguageInitialized) {
|
||||||
|
Language languageSelected = (Language) this.spPreferredLanguage.getSelectedItem();
|
||||||
|
GeneralSetting generalSettingPreferredLanguage = this.getSetting(GeneralSetting.SETTING_NAME_PREFERRED_LANGUAGE);
|
||||||
|
|
||||||
|
if (generalSettingPreferredLanguage == null) {
|
||||||
|
generalSettingPreferredLanguage = new GeneralSetting();
|
||||||
|
generalSettingPreferredLanguage.setName(GeneralSetting.SETTING_NAME_PREFERRED_LANGUAGE);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!generalSettingPreferredLanguage.getValue().equals(languageSelected.getCode())) {
|
||||||
|
generalSettingPreferredLanguage.setValue(languageSelected.getCode());
|
||||||
|
this.generalSettingListViewModel.saveGeneralSettings(generalSettingPreferredLanguage);
|
||||||
|
|
||||||
|
Resources resources = getContext().getResources();
|
||||||
|
Locale locale = new Locale(languageSelected.getCode());
|
||||||
|
Locale.setDefault(locale);
|
||||||
|
DisplayMetrics dm = resources.getDisplayMetrics();
|
||||||
|
Configuration configuration = resources.getConfiguration();
|
||||||
|
configuration.locale = locale;
|
||||||
|
resources.updateConfiguration(configuration, dm);
|
||||||
|
Intent i = getContext().getPackageManager()
|
||||||
|
.getLaunchIntentForPackage(getContext().getPackageName());
|
||||||
|
i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
|
||||||
|
startActivity(i);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
this.spPreferredLanguageInitialized = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void loadSettings(List<GeneralSetting> generalSettings){
|
public void loadSettings(List<GeneralSetting> generalSettings){
|
||||||
for (GeneralSetting generalSetting:generalSettings) {
|
for (GeneralSetting generalSetting:generalSettings) {
|
||||||
if (generalSetting.getName().equals(GeneralSetting.SETTING_NAME_PREFERED_COUNTRY)){
|
if (generalSetting.getName().equals(GeneralSetting.SETTING_NAME_PREFERRED_COUNTRY)){
|
||||||
String preferedCountryCode = generalSetting.getValue();
|
String preferedCountryCode = generalSetting.getValue();
|
||||||
spTaxableCountry.setSelection(((ArrayAdapter<String>)spTaxableCountry.getAdapter()).getPosition(countriesMap.get(preferedCountryCode)));
|
spTaxableCountry.setSelection(((ArrayAdapter<String>)spTaxableCountry.getAdapter()).getPosition(countriesMap.get(preferedCountryCode)));
|
||||||
|
} else if (generalSetting.getName().equals(GeneralSetting.SETTING_NAME_PREFERRED_LANGUAGE)){
|
||||||
|
initPreferredLanguage(generalSetting);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,8 +15,9 @@ import cy.agorise.crystalwallet.enums.SeedType;
|
||||||
@Entity(tableName = "general_setting")
|
@Entity(tableName = "general_setting")
|
||||||
public class GeneralSetting {
|
public class GeneralSetting {
|
||||||
|
|
||||||
public final static String SETTING_NAME_PREFERED_COUNTRY = "PREFERED_COUNTRY";
|
public final static String SETTING_NAME_PREFERRED_COUNTRY = "PREFERRED_COUNTRY";
|
||||||
public final static String SETTING_NAME_PREFERED_CURRENCY = "PREFERED_CURRENCY";
|
public final static String SETTING_NAME_PREFERRED_CURRENCY = "PREFERRED_CURRENCY";
|
||||||
|
public final static String SETTING_NAME_PREFERRED_LANGUAGE = "PREFERRED_LANGUAGE";
|
||||||
public final static String SETTING_PASSWORD = "PASSWORD";
|
public final static String SETTING_PASSWORD = "PASSWORD";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -68,7 +68,7 @@ public class CrystalWalletService extends LifecycleService {
|
||||||
|
|
||||||
//getting the preferred currency of the user
|
//getting the preferred currency of the user
|
||||||
final LiveData<GeneralSetting> preferredCurrencySetting =
|
final LiveData<GeneralSetting> preferredCurrencySetting =
|
||||||
CrystalDatabase.getAppDatabase(service).generalSettingDao().getByName(GeneralSetting.SETTING_NAME_PREFERED_CURRENCY);
|
CrystalDatabase.getAppDatabase(service).generalSettingDao().getByName(GeneralSetting.SETTING_NAME_PREFERRED_CURRENCY);
|
||||||
|
|
||||||
preferredCurrencySetting.observe(service, new Observer<GeneralSetting>() {
|
preferredCurrencySetting.observe(service, new Observer<GeneralSetting>() {
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -69,7 +69,7 @@ public class CryptoCoinBalanceViewHolder extends RecyclerView.ViewHolder {
|
||||||
this.clear();
|
this.clear();
|
||||||
} else {
|
} else {
|
||||||
//Retrieves the preferred currency selected by the user
|
//Retrieves the preferred currency selected by the user
|
||||||
LiveData<GeneralSetting> preferedCurrencySetting = CrystalDatabase.getAppDatabase(this.context).generalSettingDao().getByName(GeneralSetting.SETTING_NAME_PREFERED_CURRENCY);
|
LiveData<GeneralSetting> preferedCurrencySetting = CrystalDatabase.getAppDatabase(this.context).generalSettingDao().getByName(GeneralSetting.SETTING_NAME_PREFERRED_CURRENCY);
|
||||||
//Retrieves the currency of this balance
|
//Retrieves the currency of this balance
|
||||||
final CryptoCurrency currencyFrom = CrystalDatabase.getAppDatabase(context).cryptoCurrencyDao().getById(balance.getCryptoCurrencyId());
|
final CryptoCurrency currencyFrom = CrystalDatabase.getAppDatabase(context).cryptoCurrencyDao().getById(balance.getCryptoCurrencyId());
|
||||||
//Sets the name and amount of the balance in the view
|
//Sets the name and amount of the balance in the view
|
||||||
|
|
Loading…
Reference in a new issue