From dad7294103d0f03f9aff5ebdd66ad1ba91d15ca4 Mon Sep 17 00:00:00 2001 From: student Date: Wed, 2 Mar 2016 14:34:59 -0600 Subject: [PATCH] Change it to first name to full name (first name, middle name, last name) --- .idea/.name | 2 +- .idea/misc.xml | 16 ++++++ .idea/modules.xml | 2 +- .../personalizedgreeter/BeGreeted.java | 11 +++- .../main/res/layout/activity_be_greeted.xml | 54 +++++++++++++------ app/src/main/res/values/strings.xml | 9 ++-- 6 files changed, 71 insertions(+), 23 deletions(-) diff --git a/.idea/.name b/.idea/.name index 8cce00d..08a5efa 100644 --- a/.idea/.name +++ b/.idea/.name @@ -1 +1 @@ -PersonalizedGreeter \ No newline at end of file +PersonalizedGreeter1 \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml index 5d19981..7158618 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -43,4 +43,20 @@ + + + + + 1.8 + + + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml index ce43c14..fef6439 100644 --- a/.idea/modules.xml +++ b/.idea/modules.xml @@ -2,7 +2,7 @@ - + diff --git a/app/src/main/java/com/example/pbuskell/personalizedgreeter/BeGreeted.java b/app/src/main/java/com/example/pbuskell/personalizedgreeter/BeGreeted.java index 8b1a05e..a6915ed 100644 --- a/app/src/main/java/com/example/pbuskell/personalizedgreeter/BeGreeted.java +++ b/app/src/main/java/com/example/pbuskell/personalizedgreeter/BeGreeted.java @@ -11,9 +11,13 @@ public class BeGreeted extends AppCompatActivity { String strUsersName = ""; + String strMidName = ""; + String strLstName = ""; Button btnGreetMe; EditText edtxtNameField; + EditText edtxtMidName; + EditText edtxtLstName; TextView txtvwGreetingSpace; @@ -24,7 +28,10 @@ protected void onCreate(Bundle savedInstanceState) { btnGreetMe = (Button) findViewById(R.id.btnGreetMe); edtxtNameField = (EditText) findViewById(R.id.edtxtNameField); + edtxtMidName = (EditText) findViewById(R.id. edtxtMidName); + edtxtLstName = (EditText) findViewById(R.id. edtxtLstName); txtvwGreetingSpace = (TextView) findViewById(R.id.txtvwGreetingSpace); + } public void greetTheUser(View vw) @@ -32,7 +39,9 @@ public void greetTheUser(View vw) Resources res = getResources(); strUsersName = edtxtNameField.getText().toString(); + strMidName = edtxtMidName.getText().toString(); + strLstName = edtxtLstName.getText().toString(); - txtvwGreetingSpace.setText(String.format(res.getString(R.string.strGreeting), strUsersName)); + txtvwGreetingSpace.setText(String.format(res.getString(R.string.strGreeting), strUsersName, strMidName, strLstName)); } } diff --git a/app/src/main/res/layout/activity_be_greeted.xml b/app/src/main/res/layout/activity_be_greeted.xml index 654004a..e97331a 100644 --- a/app/src/main/res/layout/activity_be_greeted.xml +++ b/app/src/main/res/layout/activity_be_greeted.xml @@ -16,28 +16,39 @@ android:text="@string/strNamePlaceholder" android:ems="10" android:id="@+id/edtxtNameField" - android:layout_alignParentTop="true" - android:layout_centerHorizontal="true" - android:layout_marginTop="96dp" /> + android:layout_below="@+id/txtvwPrompt" + android:layout_centerHorizontal="true" /> -