Compare commits
5 Commits
2733f4def2
...
61ab159447
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
61ab159447 | ||
|
|
daf4c67032 | ||
|
|
b92ca8fe6e | ||
|
|
991682f0ce | ||
|
|
66e1b0b154 |
@ -33,6 +33,8 @@ dependencies {
|
||||
implementation 'androidx.appcompat:appcompat:1.1.0'
|
||||
implementation 'com.google.android.material:material:1.1.0'
|
||||
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
|
||||
implementation 'androidx.navigation:navigation-fragment:2.2.2'
|
||||
implementation 'androidx.navigation:navigation-ui:2.2.2'
|
||||
testImplementation 'junit:junit:4.+'
|
||||
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
|
||||
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
|
||||
|
||||
@ -9,6 +9,7 @@
|
||||
android:roundIcon="@mipmap/ic_launcher_round"
|
||||
android:supportsRtl="true"
|
||||
android:theme="@style/Theme.MyWeather">
|
||||
<activity android:name=".AddCity"></activity>
|
||||
<activity android:name=".MainActivity">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
|
||||
14
app/src/main/java/fr/romanet/vj/apps/myweather/AddCity.java
Normal file
14
app/src/main/java/fr/romanet/vj/apps/myweather/AddCity.java
Normal file
@ -0,0 +1,14 @@
|
||||
package fr.romanet.vj.apps.myweather;
|
||||
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
import android.os.Bundle;
|
||||
|
||||
public class AddCity extends AppCompatActivity {
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.add_city_page);
|
||||
}
|
||||
}
|
||||
@ -1,14 +1,33 @@
|
||||
package fr.romanet.vj.apps.myweather;
|
||||
|
||||
import android.widget.Button;
|
||||
import android.content.*;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
|
||||
public class MainActivity extends AppCompatActivity {
|
||||
|
||||
private Button buttonAddCity;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
protected void onCreate(Bundle savedInstanceState)
|
||||
{
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_main);
|
||||
|
||||
buttonAddCity = (Button) findViewById(R.id.fab);
|
||||
buttonAddCity.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
openAddCityPage();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void openAddCityPage()
|
||||
{
|
||||
Intent intent = new Intent(this, AddCity.class);
|
||||
startActivity(intent);
|
||||
}
|
||||
}
|
||||
@ -15,7 +15,7 @@
|
||||
<androidx.appcompat.widget.Toolbar
|
||||
android:id="@+id/toolbar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="?attr/actionBarSize"
|
||||
android:layout_height="75dp"
|
||||
android:background="?attr/colorPrimary"
|
||||
app:title="MyWeather"
|
||||
app:popupTheme="@style/Theme.MyWeather.PopupOverlay" />
|
||||
@ -46,6 +46,7 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="bottom|end"
|
||||
android:layout_margin="@dimen/fab_margin"
|
||||
android:layout_marginRight="10dp"
|
||||
app:backgroundTint="#FF0202"
|
||||
app:rippleColor="#FFFFFF"
|
||||
app:srcCompat="@android:drawable/ic_input_add" />
|
||||
|
||||
68
app/src/main/res/layout/add_city_page.xml
Normal file
68
app/src/main/res/layout/add_city_page.xml
Normal file
@ -0,0 +1,68 @@
|
||||
<?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"
|
||||
tools:context=".MainActivity"
|
||||
android:orientation="vertical">
|
||||
|
||||
<com.google.android.material.appbar.AppBarLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:theme="@style/Theme.MyWeather.AppBarOverlay">
|
||||
|
||||
<androidx.appcompat.widget.Toolbar
|
||||
android:id="@+id/toolbar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="75dp"
|
||||
android:background="?attr/colorPrimary"
|
||||
app:title="Add a city"
|
||||
app:popupTheme="@style/Theme.MyWeather.PopupOverlay" />
|
||||
|
||||
</com.google.android.material.appbar.AppBarLayout>
|
||||
|
||||
<Space
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="130dp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="51dp"
|
||||
android:textSize="20sp"
|
||||
android:gravity="center"
|
||||
android:layout_marginRight="10dp"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:text="Enter the name of the city you want to add :"
|
||||
tools:layout_editor_absoluteX="89dp"
|
||||
tools:layout_editor_absoluteY="566dp" />
|
||||
|
||||
<Space
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="120dp" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/editText"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:layout_marginRight="10dp"
|
||||
android:hint="City name"
|
||||
android:inputType="textCapWords" />
|
||||
|
||||
<Space
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="100dp" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/btnSave"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:layout_marginRight="10dp"
|
||||
android:text="Save"
|
||||
android:textSize="12sp"/>
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
@ -9,4 +9,5 @@
|
||||
|
||||
<string name="hello_first_fragment">Hello first fragment</string>
|
||||
<string name="hello_second_fragment">Hello second fragment. Arg: %1$s</string>
|
||||
<string name="title_activity_main2">MainActivity</string>
|
||||
</resources>
|
||||
Loading…
Reference in New Issue
Block a user