From cff73dac49a8e8b3b171d7f9f5e1a99bc2c48ccd Mon Sep 17 00:00:00 2001 From: Tanguy Herbron Date: Fri, 8 Jun 2018 21:50:07 +0200 Subject: [PATCH] Minor fixs - Fix crash when fields in the Record activity are field with unexpected infos - Fix soft buttons being overlapped by some activities - Fix NaN bug displayed in the drawer when hiding balance while having 0$ - Fix activities action bar not being displayed properly --- app/build.gradle | 4 +-- .../moodl/Activities/HomeActivity.java | 2 -- .../HomeActivityFragments/Summary.java | 24 +++++++++++++++--- .../Activities/RecordTransactionActivity.java | 25 +++++++++++++++++-- .../res/layout/activity_currency_summary.xml | 1 - .../fragment_marketcap_homeactivity.xml | 4 +-- .../layout/fragment_overview_homeactivity.xml | 4 +-- .../layout/fragment_summary_homeactivity.xml | 2 -- .../fragment_watchlist_homeactivity.xml | 4 +-- app/src/main/res/values-fr/strings.xml | 2 ++ app/src/main/res/values/strings.xml | 1 + 11 files changed, 51 insertions(+), 22 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 382ed82..d7c78b3 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -6,8 +6,8 @@ android { applicationId "com.herbron.moodl" minSdkVersion 19 targetSdkVersion 27 - versionCode 4 - versionName "0.0.4" + versionCode 5 + versionName "0.0.5" testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" } buildTypes { diff --git a/app/src/main/java/com/herbron/moodl/Activities/HomeActivity.java b/app/src/main/java/com/herbron/moodl/Activities/HomeActivity.java index 9e7b3df..c394da6 100644 --- a/app/src/main/java/com/herbron/moodl/Activities/HomeActivity.java +++ b/app/src/main/java/com/herbron/moodl/Activities/HomeActivity.java @@ -59,8 +59,6 @@ public class HomeActivity extends AppCompatActivity implements BalanceUpdateInte /**Interface setup**/ Window w = getWindow(); - w.addFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS); - w.addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION); setContentView(R.layout.activity_currency_summary); 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 f97e596..2f7f70b 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 @@ -419,13 +419,29 @@ public class Summary extends Fragment implements BalanceSwitchManagerInterface { if(preferencesManager.isBalanceHidden()) { - updateHideBalanceTitle(totalFluctuationPercentage); - balanceUpdateInterface.onBalanceUpdated(totalFluctuationPercentage); + if(Double.isNaN(totalFluctuationPercentage)) + { + updateHideBalanceTitle(0); + balanceUpdateInterface.onBalanceUpdated(0); + } + else + { + updateHideBalanceTitle(totalFluctuationPercentage); + balanceUpdateInterface.onBalanceUpdated(totalFluctuationPercentage); + } } else { - updateBalanceDisplayedTitle(totalFluctuationPercentage); - balanceUpdateInterface.onBalanceUpdated(totalValue); + if(Double.isNaN(totalFluctuation)) + { + updateBalanceDisplayedTitle(0); + balanceUpdateInterface.onBalanceUpdated(0); + } + else + { + updateBalanceDisplayedTitle(totalValue); + balanceUpdateInterface.onBalanceUpdated(totalValue); + } } } 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 88a3727..23ac447 100644 --- a/app/src/main/java/com/herbron/moodl/Activities/RecordTransactionActivity.java +++ b/app/src/main/java/com/herbron/moodl/Activities/RecordTransactionActivity.java @@ -21,6 +21,7 @@ import com.herbron.moodl.DataManagers.DatabaseManager; import com.herbron.moodl.DataManagers.PreferencesManager; import com.herbron.moodl.R; +import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.Locale; @@ -96,7 +97,17 @@ public class RecordTransactionActivity extends AppCompatActivity { private boolean checkPriceText() { - if(purchasedPriceEditText.getText().toString().equals("")) + String purchasedPriceText = purchasedPriceEditText.getText().toString(); + + try { + Double.parseDouble(purchasedPriceText); + } catch (NumberFormatException e) { + purchasedPriceEditText.setError(getResources().getString(R.string.field_nan)); + + return false; + } + + if(purchasedPriceText.equals("")) { purchasedPriceEditText.setError(getResources().getString(R.string.field_empty)); @@ -108,7 +119,17 @@ public class RecordTransactionActivity extends AppCompatActivity { private boolean checkAmountText() { - if(amountTxtView.getText().toString().equals("")) + String amountText = amountTxtView.getText().toString(); + + try { + Double.parseDouble(amountText); + } catch (NumberFormatException e) { + amountTxtView.setError(getResources().getString(R.string.field_nan)); + + return false; + } + + if(amountText.equals("")) { amountTxtView.setError(getResources().getString(R.string.field_empty)); diff --git a/app/src/main/res/layout/activity_currency_summary.xml b/app/src/main/res/layout/activity_currency_summary.xml index e57d0be..089af02 100644 --- a/app/src/main/res/layout/activity_currency_summary.xml +++ b/app/src/main/res/layout/activity_currency_summary.xml @@ -5,7 +5,6 @@ android:id="@+id/drawer_layout" android:layout_width="match_parent" android:layout_height="match_parent" - android:fitsSystemWindows="true" tools:context="com.herbron.moodl.Activities.HomeActivity"> + android:layout_height="match_parent"> + android:layout_height="match_parent"> + android:layout_height="match_parent"> Vérifier votre empreinte digitale pour continuer Paramètres Edition + Ce champ en peut pas être vide + Ce champ doit être un nombre \ 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 4ac31f0..daba12a 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -187,5 +187,6 @@ Edition This field cannot be blank + This field must be a number