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
This commit is contained in:
Tanguy Herbron 2018-06-08 21:50:07 +02:00
parent 75da1ee9e8
commit cff73dac49
11 changed files with 51 additions and 22 deletions

View File

@ -6,8 +6,8 @@ android {
applicationId "com.herbron.moodl" applicationId "com.herbron.moodl"
minSdkVersion 19 minSdkVersion 19
targetSdkVersion 27 targetSdkVersion 27
versionCode 4 versionCode 5
versionName "0.0.4" versionName "0.0.5"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
} }
buildTypes { buildTypes {

View File

@ -59,8 +59,6 @@ public class HomeActivity extends AppCompatActivity implements BalanceUpdateInte
/**Interface setup**/ /**Interface setup**/
Window w = getWindow(); Window w = getWindow();
w.addFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS);
w.addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION);
setContentView(R.layout.activity_currency_summary); setContentView(R.layout.activity_currency_summary);

View File

@ -419,13 +419,29 @@ public class Summary extends Fragment implements BalanceSwitchManagerInterface {
if(preferencesManager.isBalanceHidden()) if(preferencesManager.isBalanceHidden())
{ {
updateHideBalanceTitle(totalFluctuationPercentage); if(Double.isNaN(totalFluctuationPercentage))
balanceUpdateInterface.onBalanceUpdated(totalFluctuationPercentage); {
updateHideBalanceTitle(0);
balanceUpdateInterface.onBalanceUpdated(0);
}
else
{
updateHideBalanceTitle(totalFluctuationPercentage);
balanceUpdateInterface.onBalanceUpdated(totalFluctuationPercentage);
}
} }
else else
{ {
updateBalanceDisplayedTitle(totalFluctuationPercentage); if(Double.isNaN(totalFluctuation))
balanceUpdateInterface.onBalanceUpdated(totalValue); {
updateBalanceDisplayedTitle(0);
balanceUpdateInterface.onBalanceUpdated(0);
}
else
{
updateBalanceDisplayedTitle(totalValue);
balanceUpdateInterface.onBalanceUpdated(totalValue);
}
} }
} }

View File

@ -21,6 +21,7 @@ import com.herbron.moodl.DataManagers.DatabaseManager;
import com.herbron.moodl.DataManagers.PreferencesManager; import com.herbron.moodl.DataManagers.PreferencesManager;
import com.herbron.moodl.R; import com.herbron.moodl.R;
import java.text.ParseException;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.Calendar; import java.util.Calendar;
import java.util.Locale; import java.util.Locale;
@ -96,7 +97,17 @@ public class RecordTransactionActivity extends AppCompatActivity {
private boolean checkPriceText() 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)); purchasedPriceEditText.setError(getResources().getString(R.string.field_empty));
@ -108,7 +119,17 @@ public class RecordTransactionActivity extends AppCompatActivity {
private boolean checkAmountText() 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)); amountTxtView.setError(getResources().getString(R.string.field_empty));

View File

@ -5,7 +5,6 @@
android:id="@+id/drawer_layout" android:id="@+id/drawer_layout"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:fitsSystemWindows="true"
tools:context="com.herbron.moodl.Activities.HomeActivity"> tools:context="com.herbron.moodl.Activities.HomeActivity">
<FrameLayout <FrameLayout

View File

@ -2,13 +2,11 @@
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" <android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent">
android:fitsSystemWindows="true">
<android.support.design.widget.AppBarLayout <android.support.design.widget.AppBarLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:paddingTop="@dimen/fragment_padding"
android:background="@drawable/gradient_background"> android:background="@drawable/gradient_background">
<android.support.v7.widget.Toolbar <android.support.v7.widget.Toolbar

View File

@ -2,13 +2,11 @@
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" <android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent">
android:fitsSystemWindows="true">
<android.support.design.widget.AppBarLayout <android.support.design.widget.AppBarLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:paddingTop="@dimen/fragment_padding"
android:background="@drawable/gradient_background"> android:background="@drawable/gradient_background">
<android.support.v7.widget.Toolbar <android.support.v7.widget.Toolbar

View File

@ -5,7 +5,6 @@
android:id="@+id/coordinatorLayout" android:id="@+id/coordinatorLayout"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:fitsSystemWindows="true"
tools:context="com.herbron.moodl.Activities.HomeActivity"> tools:context="com.herbron.moodl.Activities.HomeActivity">
<android.support.design.widget.AppBarLayout <android.support.design.widget.AppBarLayout
@ -13,7 +12,6 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="@dimen/app_bar_height" android:layout_height="@dimen/app_bar_height"
android:theme="@style/AppTheme.AppBarOverlay" android:theme="@style/AppTheme.AppBarOverlay"
android:paddingTop="@dimen/fragment_padding"
android:background="@drawable/gradient_background"> android:background="@drawable/gradient_background">
<android.support.design.widget.CollapsingToolbarLayout <android.support.design.widget.CollapsingToolbarLayout

View File

@ -2,13 +2,11 @@
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" <android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent">
android:fitsSystemWindows="true">
<android.support.design.widget.AppBarLayout <android.support.design.widget.AppBarLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:paddingTop="@dimen/fragment_padding"
android:background="@drawable/gradient_background"> android:background="@drawable/gradient_background">
<android.support.v7.widget.Toolbar <android.support.v7.widget.Toolbar

View File

@ -86,4 +86,6 @@
<string name="fingerprint_dialog_title">Vérifier votre empreinte digitale pour continuer</string> <string name="fingerprint_dialog_title">Vérifier votre empreinte digitale pour continuer</string>
<string name="action_settings">Paramètres</string> <string name="action_settings">Paramètres</string>
<string name="action_edit_mode">Edition</string> <string name="action_edit_mode">Edition</string>
<string name="field_empty">Ce champ en peut pas être vide</string>
<string name="field_nan">Ce champ doit être un nombre</string>
</resources> </resources>

View File

@ -187,5 +187,6 @@
<string name="action_edit_mode">Edition</string> <string name="action_edit_mode">Edition</string>
<string name="field_empty">This field cannot be blank</string> <string name="field_empty">This field cannot be blank</string>
<string name="field_nan">This field must be a number</string>
</resources> </resources>