Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -37,17 +37,24 @@ protected void onCreate(Bundle savedInstanceState) {
/*setContentView(R.layout.sample);*/
// setContentView(R.layout.scrollview_sample);
// setContentView(R.layout.webview_sample);
setContentView(R.layout.spinner_sample);

setAndroidVersions();
initialiseSpinnerAdapter();
setSpinnerAdapter();
handlingSpinnerListener();

//loadUrl();

// initViews();
displayLogs();
// setContentView(R.layout.spinner_sample);
// setContentView(R.layout.week3_code_challenge_2);
setContentView(R.layout.week3_code_challenge_1);

EditText editTextEmail = findViewById(R.id.editTextEmail);
editTextEmail.setError("Fill the input with a valid email address");

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

setError is added when the validation is not respected

EditText editTextPhone = findViewById(R.id.editTextPhone);
editTextPhone.setError("Fill the input with a valid phone number");

// setAndroidVersions();
// initialiseSpinnerAdapter();
// setSpinnerAdapter();
// handlingSpinnerListener();
//
// //loadUrl();
//
// // initViews();
// displayLogs();
}

// step 1: data source for our spinner
Expand Down
13 changes: 13 additions & 0 deletions app/src/main/res/layout/spinner_layout.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">

<Spinner
android:id="@+id/spinnerAndroidVersions"

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please consider formatting the code before it is sent for review. Use CTRL + ALT + L

android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>

</LinearLayout>
42 changes: 42 additions & 0 deletions app/src/main/res/layout/week3_code_challenge_1.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:padding="@dimen/medium_space">

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/login"
android:textColor="@color/pale"
android:textSize="@dimen/big_text"
android:textStyle="bold" />

<EditText
android:id="@+id/editTextEmail"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/email"
android:inputType="textEmailAddress"
android:autofillHints="Email address" />

<EditText
android:id="@+id/editTextPhone"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/phone"
android:inputType="phone"
android:autofillHints="Phone number" />

<CheckBox
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/i_accept_t_c"/>

<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/submit"
android:backgroundTint="@color/blue_violet" />
</LinearLayout>
68 changes: 68 additions & 0 deletions app/src/main/res/layout/week3_code_challenge_2.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true"
android:orientation="vertical">

<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">

<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content">

<View
android:layout_width="@dimen/space_64"
android:layout_height="@dimen/space_64"
android:layout_alignParentStart="true"
android:background="@color/purple_200" />

<View
android:id="@+id/viewCenter"
android:layout_width="@dimen/space_64"
android:layout_height="@dimen/space_64"
android:layout_centerHorizontal="true"
android:background="@color/teal_200" />

<View
android:layout_width="@dimen/space_64"
android:layout_height="@dimen/space_64"
android:layout_toEndOf="@id/viewCenter"
android:background="@color/purple_500" />

<View
android:layout_width="@dimen/space_64"
android:layout_height="@dimen/space_64"
android:layout_alignParentEnd="true"
android:background="@color/teal_700" />
</RelativeLayout>

<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/medium_space"
android:text="@string/long_text" />

<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/medium_space"
android:text="@string/long_text" />

<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/medium_space"
android:text="@string/long_text" />

<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/medium_space"
android:text="@string/long_text" />
</LinearLayout>

</ScrollView>
2 changes: 2 additions & 0 deletions app/src/main/res/values/colors.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,6 @@
<color name="black">#FF000000</color>
<color name="white">#FFFFFFFF</color>
<color name="red">#ff3412</color>
<color name="pale">#fbaf9c</color>
<color name="blue_violet">#4054b2</color>
</resources>
1 change: 1 addition & 0 deletions app/src/main/res/values/dimens.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<dimen name="medium_text">23sp</dimen>
<dimen name="big_text">30sp</dimen>
<dimen name="medium_space">16dp</dimen>
<dimen name="space_128">128dp</dimen>
<dimen name="space_64">64dp</dimen>
Expand Down
5 changes: 5 additions & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,9 @@
<string name="long_text">Of course, you’d want to replace the URL after git remote add upstream with the appropriate clone URL for the original project repository. For the rest of this article, I’m going to assume you used upstream as the name for this additional Git remote. Now, you could try pushing changes to the original repository using git push at this point, but it would probably fail because you probably don’t have permission to push changes directly to the repository. Besides, it really wouldn’t be a good idea. That’s because other people might be working on the project as well, and how in the world would we keep track of everyone’s changes? That’s where branches come in.</string>
<string name="text_on_the_right">text on the right</string>
<string name="text_centered_in_parent">text centered in parent</string>
<string name="i_accept_t_c"><![CDATA[I accept T&C]]></string>
<string name="login">LOGIN</string>
<string name="email">Email</string>
<string name="phone">Phone</string>
<string name="submit">SUBMIT</string>
</resources>