Class where we are going to call the API to show the temperature of a city

This commit is contained in:
BGbaderguet 2020-11-14 02:57:06 +01:00
parent 5c58efae68
commit 64a6883c81
2 changed files with 38 additions and 5 deletions

View File

@ -9,15 +9,22 @@
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/Theme.MyWeather">
<!-- Adding an attribute to remove the app bar (.NoActionBar) only in the activity that allows the user to add a city, also declaring
the mainActivity as a parent of AddCity activity in order to go back to the mainActivity screen-->
<activity android:name=".AddCity"
<activity
android:name=".ShowTemparature"
android:parentActivityName=".MainActivity"
android:theme="@style/Theme.MyWeather.NoActionBar">
</activity>
android:theme="@style/Theme.MyWeather.NoActionBar"></activity>
<!--
Adding an attribute to remove the app bar (.NoActionBar) only in the activity that allows the user to add a city, also declaring
the mainActivity as a parent of AddCity activity in order to go back to the mainActivity screen
-->
<activity
android:name=".AddCity"
android:parentActivityName=".MainActivity"
android:theme="@style/Theme.MyWeather.NoActionBar"></activity>
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>

View File

@ -0,0 +1,26 @@
package fr.romanet.vj.apps.myweather;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.Toolbar;
import android.os.Bundle;
public class ShowTemparature extends AppCompatActivity {
private String currentCityName;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_temparature);
currentCityName = (String) getIntent().getExtras().get("cityName");
Toolbar toolbarAddCity = (Toolbar) findViewById(R.id.toolbarCityTemp);
toolbarAddCity.setTitle(currentCityName);
setSupportActionBar(toolbarAddCity);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
getSupportActionBar().setDisplayShowHomeEnabled(true);
}
}