From e58c75d9072781cbadaacaa982bc270ab6359b3b Mon Sep 17 00:00:00 2001 From: Aastha Malviya Date: Wed, 17 Aug 2016 16:51:44 +0530 Subject: [PATCH] Added NHS/Health Number field on personal detail --- app/build.gradle | 4 +-- .../uk/co/jaspalsvoice/jv/JvPreferences.java | 11 +++++++- .../activities/PersonalDetailsActivity.java | 8 ++++-- .../res/layout/personal_details_activity.xml | 27 ++++++++++++++----- app/src/main/res/values/strings.xml | 1 + 5 files changed, 39 insertions(+), 12 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 32c391c..02e3d0b 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -8,8 +8,8 @@ android { applicationId "uk.co.medivoice.jv" minSdkVersion 19 targetSdkVersion 23 - versionCode 1 - versionName "1.0.0" + versionCode 2 + versionName "1.0.1" } signingConfigs { diff --git a/app/src/main/java/uk/co/jaspalsvoice/jv/JvPreferences.java b/app/src/main/java/uk/co/jaspalsvoice/jv/JvPreferences.java index 24ce252..4a896db 100644 --- a/app/src/main/java/uk/co/jaspalsvoice/jv/JvPreferences.java +++ b/app/src/main/java/uk/co/jaspalsvoice/jv/JvPreferences.java @@ -15,6 +15,7 @@ public class JvPreferences { private static final String PERSONAL_DETAILS_LIVE_WITH = "pd_live_with"; private static final String PERSONAL_DETAILS_EMAIL = "pd_email"; private static final String PERSONAL_DETAILS_DATE_OF_BIRTH = "pd_dob"; + private static final String PERSONAL_DETAILS_NHS = "pd_nhs"; private static final String PERSONAL_DETAILS_MAIN_CARER = "pd_main_carer"; private static final String PERSONAL_DETAILS_CARER_TEL = "pd_carer_tel"; private static final String PERSONAL_DETAILS_NEED_TRANSLATOR = "pd_need_translator"; @@ -104,6 +105,14 @@ public void setPersonalDetailsDateOfBirth(String dob) { editor.putString(PERSONAL_DETAILS_DATE_OF_BIRTH, dob).apply(); } + public String getPersonalDetailsNHS() { + return preferences.getString(PERSONAL_DETAILS_NHS, ""); + } + + public void setPersonalDetailsNHS(String nhs) { + editor.putString(PERSONAL_DETAILS_NHS, nhs).apply(); + } + public String getPersonalDetailsMainCarer() { return preferences.getString(PERSONAL_DETAILS_MAIN_CARER, ""); } @@ -355,6 +364,6 @@ public void setFeedingMethod(String feedingMethod) { } public String getFeedingMethod() { - return preferences.getString(FEEDING_METHOD, ""); + return preferences.getString(FEEDING_METHOD, ""); } } diff --git a/app/src/main/java/uk/co/jaspalsvoice/jv/activities/PersonalDetailsActivity.java b/app/src/main/java/uk/co/jaspalsvoice/jv/activities/PersonalDetailsActivity.java index b73bd9f..66ad7ac 100644 --- a/app/src/main/java/uk/co/jaspalsvoice/jv/activities/PersonalDetailsActivity.java +++ b/app/src/main/java/uk/co/jaspalsvoice/jv/activities/PersonalDetailsActivity.java @@ -32,6 +32,7 @@ public class PersonalDetailsActivity extends BaseActivity { EditText lastName; EditText preferredName; EditText dob; + EditText nhs; EditText streetAddress; EditText townAddress; EditText state; @@ -146,6 +147,7 @@ private void loadData() { liveWith.setText(preferences.getPersonalDetailsLiveWith()); email.setText(preferences.getPersonalDetailsEmail()); dob.setText(preferences.getPersonalDetailsDateOfBirth()); + nhs.setText(preferences.getPersonalDetailsNHS()); mainCarer.setText(preferences.getPersonalDetailsMainCarer()); carerTel.setText(preferences.getPersonalDetailsCarerTel()); homeTelephone.setText(preferences.getPersonalDetailHomeTel()); @@ -170,6 +172,7 @@ private void saveData() { preferences.setPersonalDetailsLiveWith(liveWith.getText().toString()); preferences.setPersonalDetailsEmail(email.getText().toString()); preferences.setPersonalDetailsDateOfBirth(dob.getText().toString()); + preferences.setPersonalDetailsNHS(nhs.getText().toString()); preferences.setPersonalDetailsMainCarer(mainCarer.getText().toString()); preferences.setPersonalDetailsCarerTel(carerTel.getText().toString()); preferences.setHomeTelephone(homeTelephone.getText().toString()); @@ -191,13 +194,13 @@ private void saveData() { private void initSpinners() { ArrayAdapter genderAdapter = new ArrayAdapter( - this,R.layout.spinner_item, + this, R.layout.spinner_item, getResources().getStringArray(R.array.gender_spinner)); genderAdapter.setDropDownViewResource(R.layout.spinner_item); genderSpinner.setAdapter(genderAdapter); ArrayAdapter adapter = new ArrayAdapter( - this,R.layout.spinner_item, + this, R.layout.spinner_item, getResources().getStringArray(R.array.yes_no_spinner_item)); adapter.setDropDownViewResource(R.layout.spinner_item); translatorNeededSpinner.setAdapter(adapter); @@ -209,6 +212,7 @@ private void initViews() { lastName = (EditText) findViewById(R.id.lastNameEdittext); preferredName = (EditText) findViewById(R.id.preferredNameEdittext); dob = (EditText) findViewById(R.id.dobEdittext); + nhs = (EditText) findViewById(R.id.nhsEdittext); streetAddress = (EditText) findViewById(R.id.streetEdittext); townAddress = (EditText) findViewById(R.id.townEdittext); state = (EditText) findViewById(R.id.countyEdittext); diff --git a/app/src/main/res/layout/personal_details_activity.xml b/app/src/main/res/layout/personal_details_activity.xml index f659829..9d734e9 100644 --- a/app/src/main/res/layout/personal_details_activity.xml +++ b/app/src/main/res/layout/personal_details_activity.xml @@ -7,10 +7,10 @@ android:id="@+id/buttons" android:layout_width="match_parent" android:layout_height="wrap_content" + android:layout_alignParentBottom="true" android:layout_marginTop="10dp" android:orientation="horizontal" android:padding="@dimen/margin_small" - android:layout_alignParentBottom="true" android:visibility="visible">