diff --git a/app/src/main/java/com/herbron/moodl/Activities/CurrencySelectionActivity.java b/app/src/main/java/com/herbron/moodl/Activities/CurrencySelectionActivity.java index c15e4ea..caa2cd1 100644 --- a/app/src/main/java/com/herbron/moodl/Activities/CurrencySelectionActivity.java +++ b/app/src/main/java/com/herbron/moodl/Activities/CurrencySelectionActivity.java @@ -46,7 +46,7 @@ public class CurrencySelectionActivity extends AppCompatActivity implements Sear currencyDetailsList = CurrencyDetailsList.getInstance(this); - setTitle("Select a coin"); + setTitle(getString(R.string.select_coin)); Intent intent = getIntent(); isWatchList = intent.getBooleanExtra("isWatchList", false); @@ -103,7 +103,7 @@ public class CurrencySelectionActivity extends AppCompatActivity implements Sear } else { - Toast.makeText(getApplicationContext(), "Currency already in watchlist.", Toast.LENGTH_SHORT).show(); + Toast.makeText(getApplicationContext(), getString(R.string.already_watchlisr), Toast.LENGTH_SHORT).show(); } } else diff --git a/app/src/main/java/com/herbron/moodl/Activities/DetailsActivityFragments/Informations.java b/app/src/main/java/com/herbron/moodl/Activities/DetailsActivityFragments/Informations.java index 1fb345b..482cc55 100644 --- a/app/src/main/java/com/herbron/moodl/Activities/DetailsActivityFragments/Informations.java +++ b/app/src/main/java/com/herbron/moodl/Activities/DetailsActivityFragments/Informations.java @@ -120,7 +120,7 @@ public class Informations extends Fragment { ((TextView) view.findViewById(R.id.txtViewDescription)) .setMovementMethod(LinkMovementMethod.getInstance()); ((TextView) view.findViewById(R.id.txtViewPercentageCoinEmited)) - .setText("Percentage of coin emited : " + numberConformer(currency.getMinedCoinSupply() / currency.getMaxCoinSupply() * 100) + "%"); + .setText(PlaceholderManager.getEmitedPercentageString(numberConformer(currency.getMinedCoinSupply() / currency.getMaxCoinSupply() * 100), getContext())); if(currency.getMarketCapitalization() != 0) { diff --git a/app/src/main/java/com/herbron/moodl/Activities/HomeActivityFragments/Summary.java b/app/src/main/java/com/herbron/moodl/Activities/HomeActivityFragments/Summary.java index 056c71b..cf8f721 100644 --- a/app/src/main/java/com/herbron/moodl/Activities/HomeActivityFragments/Summary.java +++ b/app/src/main/java/com/herbron/moodl/Activities/HomeActivityFragments/Summary.java @@ -341,8 +341,8 @@ public class Summary extends Fragment implements BalanceSwitchManagerInterface, private void showErrorSnackbar() { - Snackbar.make(getActivity().findViewById(R.id.content_frame), "Error while updating data", Snackbar.LENGTH_LONG) - .setAction("Update", new View.OnClickListener() { + Snackbar.make(getActivity().findViewById(R.id.content_frame), getString(R.string.error_update_data), Snackbar.LENGTH_LONG) + .setAction(getString(R.string.update), new View.OnClickListener() { @Override public void onClick(View view) { @@ -584,7 +584,7 @@ public class Summary extends Fragment implements BalanceSwitchManagerInterface, { case "com.android.volley.AuthFailureError": preferencesManager.disableHitBTC(); - Snackbar.make(view, "HitBTC synchronization error : Invalid keys", Snackbar.LENGTH_LONG) + Snackbar.make(view, getString(R.string.invalid_keys_hitbtc), Snackbar.LENGTH_LONG) .show(); refreshLayout.setRefreshing(false); @@ -593,19 +593,19 @@ public class Summary extends Fragment implements BalanceSwitchManagerInterface, break; case "API-key format invalid.": preferencesManager.disableBinance(); - Snackbar.make(view, "Binance synchronization error : Invalid keys", Snackbar.LENGTH_LONG) + Snackbar.make(view, getString(R.string.invalid_keys_binance), Snackbar.LENGTH_LONG) .show(); updateAll(true); break; case "com.android.volley.NoConnectionError: java.net.UnknownHostException: Unable to resolve host \"api.hitbtc.com\": No address associated with hostname": - Snackbar.make(view, "Can't resolve host", Snackbar.LENGTH_LONG) + Snackbar.make(view, getString(R.string.cannot_resole_host), Snackbar.LENGTH_LONG) .show(); break; case "com.android.volley.TimeoutError": break; default: - Snackbar.make(view, "Unexpected error", Snackbar.LENGTH_LONG) + Snackbar.make(view, R.string.unexpected, Snackbar.LENGTH_LONG) .show(); Log.d("moodl", error); diff --git a/app/src/main/java/com/herbron/moodl/Activities/RecordTransactionActivity.java b/app/src/main/java/com/herbron/moodl/Activities/RecordTransactionActivity.java index 3646eaa..3d2644c 100644 --- a/app/src/main/java/com/herbron/moodl/Activities/RecordTransactionActivity.java +++ b/app/src/main/java/com/herbron/moodl/Activities/RecordTransactionActivity.java @@ -19,6 +19,7 @@ import com.herbron.moodl.DataManagers.CurrencyData.Currency; import com.herbron.moodl.DataManagers.CurrencyData.Transaction; import com.herbron.moodl.DataManagers.DatabaseManager; import com.herbron.moodl.DataManagers.PreferencesManager; +import com.herbron.moodl.PlaceholderManager; import com.herbron.moodl.R; import java.text.ParseException; @@ -168,7 +169,7 @@ public class RecordTransactionActivity extends AppCompatActivity { if(transactionId != -1) { - setTitle("Edit " + coin + " transaction"); + setTitle(PlaceholderManager.getEditTransactionString(coin, getBaseContext())); DatabaseManager databaseManager = new DatabaseManager(this); Transaction transaction = databaseManager.getCurrencyTransactionById(transactionId); @@ -180,7 +181,7 @@ public class RecordTransactionActivity extends AppCompatActivity { } else { - setTitle("Add " + coin + " transaction"); + setTitle(PlaceholderManager.getAddCoinTransactionString(coin, getBaseContext())); purchaseDate.setText(sdf.format(calendar.getTime())); symbolTxtView.setText(symbol); @@ -300,7 +301,6 @@ public class RecordTransactionActivity extends AppCompatActivity { purchasedPriceEditText.setText(price); } }, calendar.getTimeInMillis() / 1000); - Log.d("moodl", "Time : " + calendar.getTimeInMillis()); } }, calendar.get(Calendar.HOUR_OF_DAY), diff --git a/app/src/main/java/com/herbron/moodl/Activities/SettingsActivity.java b/app/src/main/java/com/herbron/moodl/Activities/SettingsActivity.java index 2ae23cc..5bfdf0f 100644 --- a/app/src/main/java/com/herbron/moodl/Activities/SettingsActivity.java +++ b/app/src/main/java/com/herbron/moodl/Activities/SettingsActivity.java @@ -465,8 +465,8 @@ public class SettingsActivity extends AppCompatPreferenceActivity { } }); - dialogBuilder.setTitle("Create backup"); - dialogBuilder.setPositiveButton("Confirm", new DialogInterface.OnClickListener() { + dialogBuilder.setTitle(getString(R.string.create_backup)); + dialogBuilder.setPositiveButton(getString(R.string.confirm), new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { checkPermissions(); @@ -510,7 +510,7 @@ public class SettingsActivity extends AppCompatPreferenceActivity { dialog.dismiss(); } }); - dialogBuilder.setNegativeButton("Cancel", new DialogInterface.OnClickListener() { + dialogBuilder.setNegativeButton(getString(R.string.cancel), new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { dialog.dismiss(); } @@ -621,7 +621,7 @@ public class SettingsActivity extends AppCompatPreferenceActivity { } else { - textInputLayoutPassword.setError("Wrong password"); + textInputLayoutPassword.setError(getString(R.string.wrong_password)); } } catch (JSONException e) { diff --git a/app/src/main/java/com/herbron/moodl/FingerprintToolkit/FingerprintHandler.java b/app/src/main/java/com/herbron/moodl/FingerprintToolkit/FingerprintHandler.java index 1316587..5964de8 100644 --- a/app/src/main/java/com/herbron/moodl/FingerprintToolkit/FingerprintHandler.java +++ b/app/src/main/java/com/herbron/moodl/FingerprintToolkit/FingerprintHandler.java @@ -8,6 +8,8 @@ import android.os.CancellationSignal; import android.os.Handler; import android.support.v4.app.ActivityCompat; +import com.herbron.moodl.R; + /** * Created by Guitoune on 28/02/2018. */ @@ -39,7 +41,7 @@ public class FingerprintHandler extends FingerprintManager.AuthenticationCallbac { if(dialogFragment.isVisible()) { - dialogFragment.wrongFingerprint("Error"); + dialogFragment.wrongFingerprint(context.getString(R.string.error)); new Handler().postDelayed(new Runnable() { @Override public void run() { @@ -57,7 +59,7 @@ public class FingerprintHandler extends FingerprintManager.AuthenticationCallbac { if(dialogFragment.isVisible()) { - dialogFragment.wrongFingerprint("Wrong fingerprint"); + dialogFragment.wrongFingerprint(context.getString(R.string.wrong_fingerprint)); new Handler().postDelayed(new Runnable() { @Override public void run() { diff --git a/app/src/main/java/com/herbron/moodl/PlaceholderManager.java b/app/src/main/java/com/herbron/moodl/PlaceholderManager.java index fdf4fb1..9b6edb7 100644 --- a/app/src/main/java/com/herbron/moodl/PlaceholderManager.java +++ b/app/src/main/java/com/herbron/moodl/PlaceholderManager.java @@ -1,5 +1,7 @@ package com.herbron.moodl; +import android.content.Context; + import com.herbron.moodl.DataManagers.PreferencesManager; /** @@ -32,7 +34,21 @@ public class PlaceholderManager { return formattedString; } - public static String getValuePercentageString(String value, String percentage, android.content.Context context) + public static String getAddCoinTransactionString(String coinName, Context context) { + return context.getResources().getString(R.string.add_coin_transaction, coinName); + } + + public static String getEditTransactionString(String coinName, Context context) + { + return context.getResources().getString(R.string.edit_transaction, coinName); + } + + public static String getEmitedPercentageString(String percentage, Context context) + { + return context.getResources().getString(R.string.emitedPlaceholder, percentage); + } + + public static String getValuePercentageString(String value, String percentage, Context context) { PreferencesManager preferencesManager = new PreferencesManager(context); String formattedString = null; diff --git a/app/src/main/res/values-fr/strings.xml b/app/src/main/res/values-fr/strings.xml index 4427267..ac0ce6f 100644 --- a/app/src/main/res/values-fr/strings.xml +++ b/app/src/main/res/values-fr/strings.xml @@ -116,4 +116,19 @@ 6 mois 1 année + Pourcentage de coin émis : %1$s%% + Edition d\'une transaction de %1$s + Ajouter d\'une transaction de %1$s + Erreur lors de l\'actualisation des données + Rafraichir + Erreur de synchronisation avec HitBTC : Clefs invalides + Erreur de synchronisation avec Binance : Clefs invalides + Impossible de résoudre l\'hôte + Erreur inconnue + Selectionner une monnaie + Monnaie déjà présente dans la liste suivie + Créer une sauvegarde + Mauvais mot de passe + Erreur + Mauvaise empreinte digitale \ No newline at end of file diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index ef89a40..d14a022 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -174,6 +174,7 @@ Date\n%1$s + Percentage of coin emitted : %1$s%% Volume\nUS$%1$s Price\nUS$%1$s @@ -190,6 +191,9 @@ Cancel Verify your fingerprint to continue + Edit %1$s transaction + Add %1$s transaction + @@ -219,5 +223,17 @@ Market Cap Dominance Global Other coins + Error while updating data + Update + HitBTC synchronization error : Invalid keys + Binance synchronization error : Invalid keys + Can\'t resolve host + Unexpected error + Select a coin + Currency already in watchlist + Create backup + Wrong password + Error + Wrong fingerprint