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:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true" android:supportsRtl="true"
android:theme="@style/Theme.MyWeather"> 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 <activity
the mainActivity as a parent of AddCity activity in order to go back to the mainActivity screen--> android:name=".ShowTemparature"
<activity android:name=".AddCity"
android:parentActivityName=".MainActivity" android:parentActivityName=".MainActivity"
android:theme="@style/Theme.MyWeather.NoActionBar"> android:theme="@style/Theme.MyWeather.NoActionBar"></activity>
</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"> <activity android:name=".MainActivity">
<intent-filter> <intent-filter>
<action android:name="android.intent.action.MAIN" /> <action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" /> <category android:name="android.intent.category.LAUNCHER" />
</intent-filter> </intent-filter>
</activity> </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);
}
}