File tree Expand file tree Collapse file tree
app/src/org/gnucash/android/ui/account Expand file tree Collapse file tree Original file line number Diff line number Diff line change 6161import java .io .FileNotFoundException ;
6262import java .io .InputStream ;
6363import java .util .Arrays ;
64+ import java .util .Currency ;
65+ import java .util .List ;
66+ import java .util .Locale ;
6467
6568/**
6669 * Manages actions related to accounts, displaying, exporting and creating new accounts
@@ -443,11 +446,16 @@ public void onClick(DialogInterface dialog, int which) {
443446 AccountsActivity .this ,
444447 android .R .layout .select_dialog_singlechoice ,
445448 getResources ().getStringArray (R .array .currency_names ));
446- adb .setAdapter (arrayAdapter , new DialogInterface .OnClickListener () {
447449
450+ final List <String > currencyCodes = Arrays .asList (
451+ getResources ().getStringArray (R .array .key_currency_codes ));
452+ String userCurrencyCode = Currency .getInstance (Locale .getDefault ()).getCurrencyCode ();
453+ int currencyIndex = currencyCodes .indexOf (userCurrencyCode .toUpperCase ());
454+
455+ adb .setSingleChoiceItems (arrayAdapter , currencyIndex , new DialogInterface .OnClickListener () {
448456 @ Override
449457 public void onClick (DialogInterface dialog , int which ) {
450- String currency = Arrays . asList ( getResources (). getStringArray ( R . array . key_currency_codes )) .get (which );
458+ String currency = currencyCodes .get (which );
451459 PreferenceManager .getDefaultSharedPreferences (AccountsActivity .this )
452460 .edit ()
453461 .putString (getString (R .string .key_default_currency ), currency )
You can’t perform that action at this time.
0 commit comments