Translation & fix

- Add complete french translation
- Fix app crash when adding a transaction with empty field(s)
This commit is contained in:
Tanguy Herbron 2018-06-05 20:05:48 +02:00
parent 0c0cfff731
commit 75da1ee9e8
5 changed files with 153 additions and 92 deletions

View File

@ -288,7 +288,6 @@ public class Summary extends Fragment implements BalanceSwitchManagerInterface {
lastTimestamp = System.currentTimeMillis() / 1000; lastTimestamp = System.currentTimeMillis() / 1000;
balanceManager.updateExchangeKeys(); balanceManager.updateExchangeKeys();
refreshLayout.setRefreshing(true);
resetCounters(); resetCounters();
DataUpdater updater = new DataUpdater(); DataUpdater updater = new DataUpdater();
@ -319,8 +318,6 @@ public class Summary extends Fragment implements BalanceSwitchManagerInterface {
{ {
coinCounter = 0; coinCounter = 0;
iconCounter = 0; iconCounter = 0;
detailsChecker = false;
tickersChecker = false;
totalValue = 0; totalValue = 0;
totalFluctuation = 0; totalFluctuation = 0;
@ -350,17 +347,18 @@ public class Summary extends Fragment implements BalanceSwitchManagerInterface {
if(balanceManager.getTotalBalance() != null) if(balanceManager.getTotalBalance() != null)
{ {
if(coinCounter == balanceManager.getTotalBalance().size() && detailsChecker && tickersChecker) if(balanceManager.getTotalBalance().size() == 0)
{ {
IconDownloader iconDownloader = new IconDownloader(); countIcons();
iconDownloader.execute();
} }
else else
{ {
if(balanceManager.getTotalBalance().size() == 0) if(coinCounter >= balanceManager.getTotalBalance().size() && detailsChecker && tickersChecker)
{ {
countIcons(); IconDownloader iconDownloader = new IconDownloader();
iconDownloader.execute();
} }
} }
} }
} }
@ -398,25 +396,21 @@ public class Summary extends Fragment implements BalanceSwitchManagerInterface {
private void updateNoBalance() private void updateNoBalance()
{ {
refreshLayout.setRefreshing(false); getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
refreshLayout.setRefreshing(false);
currencyLayout.removeAllViews(); currencyLayout.removeAllViews();
if(loadingDialog.isShowing()) if(loadingDialog.isShowing())
{ {
loadingDialog.dismiss(); loadingDialog.dismiss();
}
try {
getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
updateTitle();
} }
});
} catch (NullPointerException e) { updateTitle();
e.printStackTrace(); }
} });
} }
protected void updateTitle() protected void updateTitle()

View File

@ -56,29 +56,33 @@ public class RecordTransactionActivity extends AppCompatActivity {
public boolean onOptionsItemSelected(MenuItem item) { public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) { switch (item.getItemId()) {
case R.id.action_record: case R.id.action_record:
double amount = Double.parseDouble(amountTxtView.getText().toString());
double purchasedPrice = Double.parseDouble(purchasedPriceEditText.getText().toString());
double fees = Double.parseDouble(feesTxtView.getText().toString());
if(!sellButton.isEnabled()) if(checkAmountText() && checkPriceText())
{ {
amount *= -1; double amount = Double.parseDouble(amountTxtView.getText().toString());
} double purchasedPrice = Double.parseDouble(purchasedPriceEditText.getText().toString());
double fees = Double.parseDouble(feesTxtView.getText().toString());
if(transactionId != -1) if(!sellButton.isEnabled())
{ {
databaseManager.updateTransactionWithId(transactionId, amount, calendar.getTime(), purchasedPrice, fees); amount *= -1;
} }
else
{
databaseManager.addCurrencyToManualCurrency(symbol, amount, calendar.getTime(), purchasedPrice, fees);
}
preferenceManager.setMustUpdateSummary(true); if(transactionId != -1)
Intent intent = new Intent(RecordTransactionActivity.this, HomeActivity.class); {
intent.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT); databaseManager.updateTransactionWithId(transactionId, amount, calendar.getTime(), purchasedPrice, fees);
startActivity(intent); }
finish(); else
{
databaseManager.addCurrencyToManualCurrency(symbol, amount, calendar.getTime(), purchasedPrice, fees);
}
preferenceManager.setMustUpdateSummary(true);
Intent intent = new Intent(RecordTransactionActivity.this, HomeActivity.class);
intent.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
startActivity(intent);
finish();
}
break; break;
case android.R.id.home: case android.R.id.home:
//NavUtils.navigateUpFromSameTask(this); //NavUtils.navigateUpFromSameTask(this);
@ -90,6 +94,30 @@ public class RecordTransactionActivity extends AppCompatActivity {
return true; return true;
} }
private boolean checkPriceText()
{
if(purchasedPriceEditText.getText().toString().equals(""))
{
purchasedPriceEditText.setError(getResources().getString(R.string.field_empty));
return false;
}
return true;
}
private boolean checkAmountText()
{
if(amountTxtView.getText().toString().equals(""))
{
amountTxtView.setError(getResources().getString(R.string.field_empty));
return false;
}
return true;
}
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);

View File

@ -85,27 +85,6 @@ public class SettingsActivity extends AppCompatPreferenceActivity {
? listPreference.getEntries()[index] ? listPreference.getEntries()[index]
: null); : null);
} else if (preference instanceof RingtonePreference) {
// For ringtone preferences, look up the correct display value
// using RingtoneManager.
if (TextUtils.isEmpty(stringValue)) {
// Empty values correspond to 'silent' (no ringtone).
preference.setSummary(R.string.pref_ringtone_silent);
} else {
Ringtone ringtone = RingtoneManager.getRingtone(
preference.getContext(), Uri.parse(stringValue));
if (ringtone == null) {
// Clear the summary if there was a lookup error.
preference.setSummary(null);
} else {
// Set the summary to reflect the new ringtone display
// name.
String name = ringtone.getTitle(preference.getContext());
preference.setSummary(name);
}
}
} else { } else {
// For all other preferences, set the summary to the value's // For all other preferences, set the summary to the value's
// simple string representation. // simple string representation.

View File

@ -24,4 +24,66 @@
<string name="title_transactions">Transactions</string> <string name="title_transactions">Transactions</string>
<string name="title_home">Possessions</string> <string name="title_home">Possessions</string>
<string name="title_market_cap">Capitalisation du marché</string> <string name="title_market_cap">Capitalisation du marché</string>
<string name="pref_title_minimum_amount_displayed">Montant minimum affiché</string>
<string name="day_history">Historique du jour</string>
<string name="line_chart">Graphique linéaire</string>
<string name="candle_stick_chart">Graphique bougie</string>
<string name="beginning_price">Prix de départ</string>
<string name="current_price">Prix actuel</string>
<string name="delta">Delta</string>
<string name="total_volume">Volume total</string>
<string name="highest_price">Plus haut prix</string>
<string name="lowest_price">Plus bas prix</string>
<string name="rank">Rang</string>
<string name="algorithm">Algorithme</string>
<string name="proof_type">Type de preuve</string>
<string name="start_date">Date de début</string>
<string name="description">Description</string>
<string name="transaction_history">Historique de transaction</string>
<string name="trade_history">Historique d\'échange</string>
<string name="trade_loading">Recherche d\'échange&#8230;</string>
<string name="drawer">Volet</string>
<string name="dominance_percentage">Dominance en pourcentage</string>
<string name="active_cryptocurrencies">Cryptomonnaies actives</string>
<string name="volume_24h">Volume sur 24h</string>
<string name="active_marketes">Marchés actifs</string>
<string name="add_transaction">Ajouter une transaction</string>
<string name="add_watchlist">Ajouter à la liste suivie</string>
<string name="edit_mode">Mode édition</string>
<string name="pref_title_enable_synchronization_binance">Activer la synchronisation</string>
<string name="pref_title_binance_publickey">Clé public</string>
<string name="pref_title_binance_privatekey">Clé privée</string>
<string name="pref_title_enable_synchronization_poloniex">Activer la synchronisation</string>
<string name="pref_title_poloniex_publickey">Clé public</string>
<string name="pref_title_poloniex_privatekey">Clé privée</string>
<string name="pref_title_enable_synchronization_kraken">Activer la synchronisation</string>
<string name="pref_title_kraken_publickey">Clé public</string>
<string name="pref_title_kraken_privatekey">Clé privée</string>
<string name="title_watchlist">Liste suivie</string>
<string name="title_coin_list">Liste des monnaies</string>
<string name="button1h">1h</string>
<string name="button3h">3h</string>
<string name="button1d">1j</string>
<string name="button3d">3j</string>
<string name="button1w">1S</string>
<string name="button1m">1M</string>
<string name="button3m">3M</string>
<string name="button6m">6M</string>
<string name="button1y">1A</string>
<string name="timestampPlaceholder">Date\n%1$s</string>
<string name="volumeDollarPlaceholder">Volume\nUS$%1$s</string>
<string name="priceDollarPlaceholder">Prix\nUS$%1$s</string>
<string name="volumeEurosPlaceholder">Volume\n%1$s€</string>
<string name="priceEurosPlaceholder">Prix\n%1$s€</string>
<string name="volumePoundPlaceholder">Volume\n%1$s£</string>
<string name="pricePoundPlaceholder">Prix\n%1$s£</string>
<string name="volumeYenPlaceholder">Volume\n%1$s¥</string>
<string name="priceYenPlaceholder">Prix\n%1$s¥</string>
<string name="total_supply">Liquidité totale</string>
<string name="circulating_supply">Liquiditée en circulation</string>
<string name="market_capitalization">Capitalisation du marché</string>
<string name="fingerprint_dialog_cancel">Annuler</string>
<string name="fingerprint_dialog_title">Vérifier votre empreinte digitale pour continuer</string>
<string name="action_settings">Paramètres</string>
<string name="action_edit_mode">Edition</string>
</resources> </resources>

View File

@ -4,7 +4,7 @@
<string name="debug_volley" translatable="false">Moodl_debugVolley</string> <string name="debug_volley" translatable="false">Moodl_debugVolley</string>
<string name="title_activity_settings">Settings</string> <string name="title_activity_settings">Settings</string>
<string name="currency">currency</string> <string name="currency" translatable="false">currency</string>
<!-- Example General settings --> <!-- Example General settings -->
<string name="pref_header_general">General</string> <string name="pref_header_general">General</string>
@ -39,10 +39,6 @@
<string name="transaction_record">Save</string> <string name="transaction_record">Save</string>
<!-- Example settings for Notifications -->
<string name="pref_ringtone_silent">Silent</string>
<!--Fingerprint authentification--> <!--Fingerprint authentification-->
<!--Cardviews--> <!--Cardviews-->
@ -51,7 +47,7 @@
<!--Details activity--> <!--Details activity-->
<string name="line_chart">Line chart</string> <string name="line_chart">Line chart</string>
<string name="candle_stick_chart">Candle stick chart</string> <string name="candle_stick_chart">Candle stick chart</string>
<string name="backline">\n</string> <string name="backline" translatable="false">\n</string>
<string name="beginning_price">Beginning price</string> <string name="beginning_price">Beginning price</string>
<string name="current_price">Current price</string> <string name="current_price">Current price</string>
<string name="delta">Delta</string> <string name="delta">Delta</string>
@ -69,7 +65,7 @@
<string name="transaction_history">Transaction history</string> <string name="transaction_history">Transaction history</string>
<string name="trade_history">Trade history</string> <string name="trade_history">Trade history</string>
<string name="trade_loading">Looking for trades&#8230;</string> <string name="trade_loading">Looking for trades&#8230;</string>
<string name="default_value">--</string> <string name="default_value" translatable="false">--</string>
<!--Home activity--> <!--Home activity-->
<string name="drawer">Drawer</string> <string name="drawer">Drawer</string>
@ -80,7 +76,7 @@
<string name="add_transaction">Add transaction</string> <string name="add_transaction">Add transaction</string>
<string name="add_watchlist">Add to watchlist</string> <string name="add_watchlist">Add to watchlist</string>
<string name="edit_mode">Edit mode</string> <string name="edit_mode">Edit mode</string>
<string name="loading_coin_list">Hodl&#8230;</string> <string name="loading_coin_list" translatable="false">Hodl&#8230;</string>
<!--Exchange strings--> <!--Exchange strings-->
<string name="pref_header_exchange">Exchanges settings</string> <string name="pref_header_exchange">Exchanges settings</string>
@ -102,28 +98,28 @@
<string name="pref_title_enable_synchronization_binance">Enable synchronization</string> <string name="pref_title_enable_synchronization_binance">Enable synchronization</string>
<string name="pref_title_binance_publickey">Public key</string> <string name="pref_title_binance_publickey">Public key</string>
<string name="pref_title_binance_privatekey">Private key</string> <string name="pref_title_binance_privatekey">Private key</string>
<string name="pref_title_exchange_binance">Binance</string> <string name="pref_title_exchange_binance" translatable="false">Binance</string>
<!--Poloniex--> <!--Poloniex-->
<string name="pref_title_enable_synchronization_poloniex">Enable synchronization</string> <string name="pref_title_enable_synchronization_poloniex">Enable synchronization</string>
<string name="pref_title_poloniex_publickey">Public key</string> <string name="pref_title_poloniex_publickey">Public key</string>
<string name="pref_title_poloniex_privatekey">Private key</string> <string name="pref_title_poloniex_privatekey">Private key</string>
<string name="pref_title_exchange_poloniex">Poloniex</string> <string name="pref_title_exchange_poloniex" translatable="false">Poloniex</string>
<!--Kraken--> <!--Kraken-->
<string name="pref_title_enable_synchronization_kraken">Enable synchronization</string> <string name="pref_title_enable_synchronization_kraken">Enable synchronization</string>
<string name="pref_title_kraken_publickey">Public key</string> <string name="pref_title_kraken_publickey">Public key</string>
<string name="pref_title_kraken_privatekey">Private key</string> <string name="pref_title_kraken_privatekey">Private key</string>
<string name="pref_title_exchange_kraken">Kraken</string> <string name="pref_title_exchange_kraken" translatable="false">Kraken</string>
<!--Add transaction activity--> <!--Add transaction activity-->
<string name="activity_add_amount">Amount</string> <string name="activity_add_amount">Amount</string>
<string name="activity_purchased_price">Purchased price</string> <string name="activity_purchased_price">Purchased price</string>
<string name="activity_purchased_date">Purchased date</string> <string name="activity_purchased_date">Purchased date</string>
<string name="activity_fees">Fees</string> <string name="activity_fees">Fees</string>
<string name="title_activity_currency_details">CurrencyDetailsActivity</string> <string name="title_activity_currency_details" translatable="false">CurrencyDetailsActivity</string>
<string name="title_history">History charts</string> <string name="title_history">History charts</string>
<string name="title_watchlist" translatable="false">Watchlist</string> <string name="title_watchlist">Watchlist</string>
<string name="title_infos">Infos</string> <string name="title_infos">Infos</string>
<string name="title_transactions">Transactions</string> <string name="title_transactions">Transactions</string>
<string name="title_home">Holdings</string> <string name="title_home">Holdings</string>
@ -142,25 +138,25 @@
<string name="button1y">1y</string> <string name="button1y">1y</string>
<!--Cardview placeholders--> <!--Cardview placeholders-->
<string name="currencySymbolPlaceholder">(%1$s)</string> <string name="currencySymbolPlaceholder" translatable="false">(%1$s)</string>
<string name="currencyBalancePlaceholder">%1$s%2$s</string> <string name="currencyBalancePlaceholder" translatable="false">%1$s%2$s</string>
<string name="currencyPercentagePlaceholder">%1$s%%</string> <string name="currencyPercentagePlaceholder" translatable="false">%1$s%%</string>
<!--Dollar--> <!--Dollar-->
<string name="currencyDollarParenthesisPlaceholder">(US$%1$s)</string> <string name="currencyDollarParenthesisPlaceholder" translatable="false">(US$%1$s)</string>
<string name="currencyDollarPlaceholder">US$%1$s</string> <string name="currencyDollarPlaceholder" translatable="false">US$%1$s</string>
<string name="fluctuationDollarPercentagePlaceholder">US$%1$s (%2$s%%)</string> <string name="fluctuationDollarPercentagePlaceholder" translatable="false">US$%1$s (%2$s%%)</string>
<!--Euro--> <!--Euro-->
<string name="currencyEurosParenthesisPlaceholder">(%1$s€)</string> <string name="currencyEurosParenthesisPlaceholder" translatable="false">(%1$s€)</string>
<string name="currencyEurosPlaceholder">%1$s€</string> <string name="currencyEurosPlaceholder" translatable="false">%1$s€</string>
<string name="fluctuationEurosPercentagePlaceholder">%1$s€ (%2$s%%)</string> <string name="fluctuationEurosPercentagePlaceholder" translatable="false">%1$s€ (%2$s%%)</string>
<!--Pound--> <!--Pound-->
<string name="currencyPoundParenthesisPlaceholder">(%1$s£)</string> <string name="currencyPoundParenthesisPlaceholder" translatable="false">(%1$s£)</string>
<string name="currencyPoundPlaceholder">%1$s£</string> <string name="currencyPoundPlaceholder" translatable="false">%1$s£</string>
<string name="fluctuationPoundPercentagePlaceholder">%1$s£ (%2$s%%)</string> <string name="fluctuationPoundPercentagePlaceholder" translatable="false">%1$s£ (%2$s%%)</string>
<!--Yen--> <!--Yen-->
<string name="currencyYenParenthesisPlaceholder">(%1$s¥)</string> <string name="currencyYenParenthesisPlaceholder" translatable="false">(%1$s¥)</string>
<string name="currencyYenPlaceholder">%1$s¥</string> <string name="currencyYenPlaceholder" translatable="false">%1$s¥</string>
<string name="fluctuationYenPercentagePlaceholder">%1$s¥ (%2$s%%)</string> <string name="fluctuationYenPercentagePlaceholder" translatable="false">%1$s¥ (%2$s%%)</string>
<!--DetailsActivity placeholders--> <!--DetailsActivity placeholders-->
<string name="timestampPlaceholder">Date\n%1$s</string> <string name="timestampPlaceholder">Date\n%1$s</string>
@ -190,4 +186,6 @@
<string name="action_settings">Settings</string> <string name="action_settings">Settings</string>
<string name="action_edit_mode">Edition</string> <string name="action_edit_mode">Edition</string>
<string name="field_empty">This field cannot be blank</string>
</resources> </resources>