Skip to content

Commit

Permalink
Fix crash on bad number input and upgrade version to 2.2
Browse files Browse the repository at this point in the history
  • Loading branch information
rparkins999 committed May 27, 2018
1 parent 4c895ad commit 40f3501
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ android {
applicationId 'uk.co.yahoo.p1rpp.calendartrigger'
minSdkVersion 21
targetSdkVersion 22
versionCode 6
versionName "2.1"
versionCode 7
versionName "2.2"
}
buildTypes {
release {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

import android.app.Fragment;
import android.os.Bundle;
import android.text.InputFilter;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
Expand Down Expand Up @@ -74,6 +75,9 @@ public void onResume() {
ViewGroup.LayoutParams.WRAP_CONTENT,
ViewGroup.LayoutParams.WRAP_CONTENT
);
InputFilter lf[] = {
new InputFilter.LengthFilter(6)
};
LinearLayout ll =
(LinearLayout)ac.findViewById(R.id.definestartlayout);
ll.removeAllViews();
Expand All @@ -98,6 +102,7 @@ public boolean onLongClick(View v) {
lll.setPadding((int)(scale * 25.0), 0, 0, 0);
minutesEditor = new EditText(ac);
minutesEditor.setInputType(android.text.InputType.TYPE_CLASS_NUMBER);
minutesEditor.setFilters(lf);
Integer i =
new Integer(PrefsManager.getBeforeMinutes(ac, classNum));
minutesEditor.setText(i.toString(), TextView.BufferType.EDITABLE);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import android.content.pm.PackageManager;
import android.os.Bundle;
import android.support.v4.content.PermissionChecker;
import android.text.InputFilter;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
Expand Down Expand Up @@ -85,6 +86,9 @@ public void onResume() {
ViewGroup.LayoutParams.WRAP_CONTENT,
ViewGroup.LayoutParams.WRAP_CONTENT
);
InputFilter lf[] = {
new InputFilter.LengthFilter(6)
};
LinearLayout ll =
(LinearLayout)ac.findViewById(R.id.definestoplayout);
ll.removeAllViews();
Expand All @@ -109,6 +113,7 @@ public boolean onLongClick(View v) {
lll.setPadding((int)(scale * 25.0), 0, 0, 0);
minutesEditor = new EditText(ac);
minutesEditor.setInputType(android.text.InputType.TYPE_CLASS_NUMBER);
minutesEditor.setFilters(lf);
Integer i =
new Integer(PrefsManager.getAfterMinutes(ac, classNum));
minutesEditor.setText(i.toString(), TextView.BufferType.EDITABLE);
Expand Down Expand Up @@ -164,6 +169,7 @@ public boolean onLongClick(View v) {
stepCountEditor = new EditText(ac);
stepCountEditor.setInputType(
android.text.InputType.TYPE_CLASS_NUMBER);
stepCountEditor.setFilters(lf);
i = haveStepCounter ? PrefsManager.getAfterSteps(ac, classNum) : 0;
stepCountEditor.setText(String.valueOf(i), TextView.BufferType.EDITABLE);
stepCountEditor.setEnabled(true);
Expand Down Expand Up @@ -199,6 +205,7 @@ public boolean onLongClick(View v) {
metresEditor = new EditText(ac);
metresEditor.setInputType(
android.text.InputType.TYPE_CLASS_NUMBER);
metresEditor.setFilters(lf);
i = havelocation ? PrefsManager.getAfterMetres(ac, classNum) : 0;
metresEditor.setText(String.valueOf(i), TextView.BufferType.EDITABLE);
metresEditor.setEnabled(havelocation);
Expand Down

0 comments on commit 40f3501

Please sign in to comment.