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
1 change: 1 addition & 0 deletions .idea/.name

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -12,49 +12,9 @@

public class MainActivity extends AppCompatActivity {

private EditText editTextName;
private Button buttonDisplayGreetings;
private TextView textViewGreetings;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
/*setContentView(R.layout.activity_main);*/
setContentView(R.layout.sample);

initViews();
displayLogs();
}

private void initViews() {
editTextName = findViewById(R.id.editTextName);
buttonDisplayGreetings = findViewById(R.id.buttonDisplayGreetings);
textViewGreetings = findViewById(R.id.textViewGreetings);
}

private void displayLogs() {
Log.e("tag-error", "my first error log");
Log.v("tag-verbose", "my first verbose log");
Log.w("tag-warning", "my first warning log");
}

private void clickOnDisplayGreetingsButton() {
buttonDisplayGreetings.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {

}
});
}

public void displayGreetingsOnClick(View view) {
textViewGreetings.setText("");
String inputName = editTextName.getText().toString();
if (inputName.length() > 0) {
textViewGreetings.setText(inputName);
} else {
editTextName.setError(getString(R.string.error_insert_name));
Toast.makeText(MainActivity.this, getString(R.string.error_insert_name), Toast.LENGTH_LONG).show();
}
setContentView(R.layout.activity_main);
}
}
Binary file added app/src/main/res/drawable-v24/circle.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
265 changes: 168 additions & 97 deletions app/src/main/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
@@ -1,98 +1,169 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context=".MainActivity">

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:layout_margin="@dimen/medium_space"
android:background="@android:color/holo_green_light"
android:gravity="center_horizontal"
android:padding="@dimen/medium_space"
android:text="@string/this_is_my_first_textview"
android:textColor="@color/purple_700"
android:textSize="@dimen/medium_text"
android:textStyle="italic|bold" />

<ImageView
android:layout_width="120dp"
android:layout_height="120dp"
android:scaleType="fitCenter"
android:src="@drawable/android_logo" />

<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/i_am_a_button" />

<View
android:layout_width="match_parent"
android:layout_height="3dp"
android:background="@color/purple_200" />

<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:hint="@string/write_your_name_here"
android:inputType="textCapWords"
android:textColor="@color/purple_700" />

<CheckBox
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:checked="true"
android:text="@string/i_accept_terms_and_conditions" />

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

<RadioButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/yes" />

<RadioButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:checked="true"
android:text="@string/no" />
</RadioGroup>

<RatingBar
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:isIndicator="false"
android:numStars="5"
android:rating="3.5"
android:stepSize="0.5" />

<ProgressBar
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:visibility="gone" />

<Switch
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/change_color" />

<SeekBar
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/medium_space"
android:max="100"
android:progress="70" />

<SearchView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:queryHint="@string/search_for_android" />

<?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">

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

<TextView
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="@color/peach"
android:gravity="center"
android:paddingTop="@dimen/medium_space"
android:paddingBottom="@dimen/medium_space"
android:text="@string/this_is_an_orange_textview"
android:textColor="@color/white"
android:textSize="@dimen/medium_text" />

<TextView
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="@color/light_green"
android:gravity="center"
android:paddingTop="@dimen/medium_space"
android:paddingBottom="@dimen/medium_space"
android:text="@string/this_is_a_green_textview"
android:textColor="@color/black"
android:textSize="@dimen/medium_text" />

<TextView
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="@color/light_green_blue"
android:gravity="center"
android:paddingTop="@dimen/medium_space"
android:paddingBottom="@dimen/medium_space"
android:text="@string/this_is_a_blue_textview"
android:textColor="@color/white"
android:textSize="@dimen/medium_text" />
</LinearLayout>

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

<Button
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_margin="@dimen/small_space"
android:layout_weight="1"
android:backgroundTint="@color/light_green_blue"
android:gravity="center"
android:paddingTop="@dimen/medium_space"
android:paddingBottom="@dimen/medium_space"
android:text="@string/this_is_a_button"
android:textColor="@color/black"
android:textSize="@dimen/small_medium_text" />

<ImageView
android:layout_width="0dp"
android:layout_height="120dp"
android:layout_margin="@dimen/small_space"
android:layout_weight="1"
android:scaleType="fitCenter"
android:src="@drawable/circle" />

<Button
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_margin="@dimen/small_space"
android:layout_weight="1"
android:backgroundTint="@color/light_moss_green"
android:gravity="center"
android:paddingTop="@dimen/medium_space"
android:paddingBottom="@dimen/medium_space"
android:text="@string/this_is_a_green_button"
android:textColor="@color/black"
android:textSize="@dimen/small_medium_text" />
</LinearLayout>

<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/yellow"
android:orientation="vertical"
android:paddingTop="@dimen/medium_space"
android:paddingBottom="@dimen/medium_space">

<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/this_is_an_edittext" />

<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/this_is_a_new_edittext" />
</LinearLayout>

<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/light_green_blue"
android:orientation="vertical">

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

<CheckBox
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:text="@string/notify_me"
android:textSize="@dimen/medium_text" />

<Switch
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_gravity="right"
android:layout_weight="1"
android:text="@string/auto_backup"
android:textSize="@dimen/small_medium_text" />
</LinearLayout>

<LinearLayout
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="@color/purple_700"/>
<RatingBar
style="@style/Widget.AppCompat.RatingBar.Small"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/small_space"
android:layout_marginBottom="@dimen/small_space"
android:numStars="5"
android:progressTint="@color/pink"
android:rating="4" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="@color/purple_700"/>
<RadioGroup
android:layout_width="wrap_content"
android:layout_height="wrap_content">

<RadioButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/yes"
android:textSize="@dimen/medium_text" />

<RadioButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/no"
android:textSize="@dimen/medium_text" />
</RadioGroup>
</LinearLayout>
</LinearLayout>
Loading