Skip to content

Commit

Permalink
Translation & fix
Browse files Browse the repository at this point in the history
- Add complete french translation
- Fix app crash when adding a transaction with empty field(s)
  • Loading branch information
TanguyHerbron committed Jun 5, 2018
1 parent 0c0cfff commit 75da1ee
Show file tree
Hide file tree
Showing 5 changed files with 153 additions and 92 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,6 @@ private void updateAll(boolean mustUpdate)

lastTimestamp = System.currentTimeMillis() / 1000;
balanceManager.updateExchangeKeys();
refreshLayout.setRefreshing(true);

resetCounters();
DataUpdater updater = new DataUpdater();
Expand Down Expand Up @@ -319,8 +318,6 @@ private void resetCounters()
{
coinCounter = 0;
iconCounter = 0;
detailsChecker = false;
tickersChecker = false;

totalValue = 0;
totalFluctuation = 0;
Expand Down Expand Up @@ -350,17 +347,18 @@ private void countCoins(boolean isCoin, boolean isDetails, boolean isTickers)

if(balanceManager.getTotalBalance() != null)
{
if(coinCounter == balanceManager.getTotalBalance().size() && detailsChecker && tickersChecker)
if(balanceManager.getTotalBalance().size() == 0)
{
IconDownloader iconDownloader = new IconDownloader();
iconDownloader.execute();
countIcons();
}
else
{
if(balanceManager.getTotalBalance().size() == 0)
if(coinCounter >= balanceManager.getTotalBalance().size() && detailsChecker && tickersChecker)
{
countIcons();
IconDownloader iconDownloader = new IconDownloader();
iconDownloader.execute();
}

}
}
}
Expand Down Expand Up @@ -398,25 +396,21 @@ private void countIcons()

private void updateNoBalance()
{
refreshLayout.setRefreshing(false);

currencyLayout.removeAllViews();
getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
refreshLayout.setRefreshing(false);

if(loadingDialog.isShowing())
{
loadingDialog.dismiss();
}
currencyLayout.removeAllViews();

try {
getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
updateTitle();
if(loadingDialog.isShowing())
{
loadingDialog.dismiss();
}
});
} catch (NullPointerException e) {
e.printStackTrace();
}

updateTitle();
}
});
}

protected void updateTitle()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,29 +56,33 @@ public boolean onCreateOptionsMenu(Menu menu) {
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
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)
{
databaseManager.updateTransactionWithId(transactionId, amount, calendar.getTime(), purchasedPrice, fees);
}
else
{
databaseManager.addCurrencyToManualCurrency(symbol, amount, calendar.getTime(), purchasedPrice, fees);
}
if(!sellButton.isEnabled())
{
amount *= -1;
}

preferenceManager.setMustUpdateSummary(true);
Intent intent = new Intent(RecordTransactionActivity.this, HomeActivity.class);
intent.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
startActivity(intent);
finish();
if(transactionId != -1)
{
databaseManager.updateTransactionWithId(transactionId, amount, calendar.getTime(), purchasedPrice, fees);
}
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;
case android.R.id.home:
//NavUtils.navigateUpFromSameTask(this);
Expand All @@ -90,6 +94,30 @@ public boolean onOptionsItemSelected(MenuItem item) {
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
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,27 +85,6 @@ public boolean onPreferenceChange(Preference preference, Object value) {
? listPreference.getEntries()[index]
: 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 {
// For all other preferences, set the summary to the value's
// simple string representation.
Expand Down
62 changes: 62 additions & 0 deletions app/src/main/res/values-fr/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,66 @@
<string name="title_transactions">Transactions</string>
<string name="title_home">Possessions</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>
54 changes: 26 additions & 28 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<string name="debug_volley" translatable="false">Moodl_debugVolley</string>
<string name="title_activity_settings">Settings</string>

<string name="currency">currency</string>
<string name="currency" translatable="false">currency</string>

<!-- Example General settings -->
<string name="pref_header_general">General</string>
Expand Down Expand Up @@ -39,10 +39,6 @@

<string name="transaction_record">Save</string>

<!-- Example settings for Notifications -->

<string name="pref_ringtone_silent">Silent</string>

<!--Fingerprint authentification-->

<!--Cardviews-->
Expand All @@ -51,7 +47,7 @@
<!--Details activity-->
<string name="line_chart">Line 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="current_price">Current price</string>
<string name="delta">Delta</string>
Expand All @@ -69,7 +65,7 @@
<string name="transaction_history">Transaction history</string>
<string name="trade_history">Trade history</string>
<string name="trade_loading">Looking for trades&#8230;</string>
<string name="default_value">--</string>
<string name="default_value" translatable="false">--</string>

<!--Home activity-->
<string name="drawer">Drawer</string>
Expand All @@ -80,7 +76,7 @@
<string name="add_transaction">Add transaction</string>
<string name="add_watchlist">Add to watchlist</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-->
<string name="pref_header_exchange">Exchanges settings</string>
Expand All @@ -102,28 +98,28 @@
<string name="pref_title_enable_synchronization_binance">Enable synchronization</string>
<string name="pref_title_binance_publickey">Public 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-->
<string name="pref_title_enable_synchronization_poloniex">Enable synchronization</string>
<string name="pref_title_poloniex_publickey">Public 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-->
<string name="pref_title_enable_synchronization_kraken">Enable synchronization</string>
<string name="pref_title_kraken_publickey">Public 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-->
<string name="activity_add_amount">Amount</string>
<string name="activity_purchased_price">Purchased price</string>
<string name="activity_purchased_date">Purchased date</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_watchlist" translatable="false">Watchlist</string>
<string name="title_watchlist">Watchlist</string>
<string name="title_infos">Infos</string>
<string name="title_transactions">Transactions</string>
<string name="title_home">Holdings</string>
Expand All @@ -142,25 +138,25 @@
<string name="button1y">1y</string>

<!--Cardview placeholders-->
<string name="currencySymbolPlaceholder">(%1$s)</string>
<string name="currencyBalancePlaceholder">%1$s%2$s</string>
<string name="currencyPercentagePlaceholder">%1$s%%</string>
<string name="currencySymbolPlaceholder" translatable="false">(%1$s)</string>
<string name="currencyBalancePlaceholder" translatable="false">%1$s%2$s</string>
<string name="currencyPercentagePlaceholder" translatable="false">%1$s%%</string>
<!--Dollar-->
<string name="currencyDollarParenthesisPlaceholder">(US$%1$s)</string>
<string name="currencyDollarPlaceholder">US$%1$s</string>
<string name="fluctuationDollarPercentagePlaceholder">US$%1$s (%2$s%%)</string>
<string name="currencyDollarParenthesisPlaceholder" translatable="false">(US$%1$s)</string>
<string name="currencyDollarPlaceholder" translatable="false">US$%1$s</string>
<string name="fluctuationDollarPercentagePlaceholder" translatable="false">US$%1$s (%2$s%%)</string>
<!--Euro-->
<string name="currencyEurosParenthesisPlaceholder">(%1$s€)</string>
<string name="currencyEurosPlaceholder">%1$s€</string>
<string name="fluctuationEurosPercentagePlaceholder">%1$s€ (%2$s%%)</string>
<string name="currencyEurosParenthesisPlaceholder" translatable="false">(%1$s€)</string>
<string name="currencyEurosPlaceholder" translatable="false">%1$s€</string>
<string name="fluctuationEurosPercentagePlaceholder" translatable="false">%1$s€ (%2$s%%)</string>
<!--Pound-->
<string name="currencyPoundParenthesisPlaceholder">(%1$s£)</string>
<string name="currencyPoundPlaceholder">%1$s£</string>
<string name="fluctuationPoundPercentagePlaceholder">%1$s£ (%2$s%%)</string>
<string name="currencyPoundParenthesisPlaceholder" translatable="false">(%1$s£)</string>
<string name="currencyPoundPlaceholder" translatable="false">%1$s£</string>
<string name="fluctuationPoundPercentagePlaceholder" translatable="false">%1$s£ (%2$s%%)</string>
<!--Yen-->
<string name="currencyYenParenthesisPlaceholder">(%1$s¥)</string>
<string name="currencyYenPlaceholder">%1$s¥</string>
<string name="fluctuationYenPercentagePlaceholder">%1$s¥ (%2$s%%)</string>
<string name="currencyYenParenthesisPlaceholder" translatable="false">(%1$s¥)</string>
<string name="currencyYenPlaceholder" translatable="false">%1$s¥</string>
<string name="fluctuationYenPercentagePlaceholder" translatable="false">%1$s¥ (%2$s%%)</string>

<!--DetailsActivity placeholders-->
<string name="timestampPlaceholder">Date\n%1$s</string>
Expand Down Expand Up @@ -190,4 +186,6 @@
<string name="action_settings">Settings</string>
<string name="action_edit_mode">Edition</string>

<string name="field_empty">This field cannot be blank</string>

</resources>

0 comments on commit 75da1ee

Please sign in to comment.