Android Open Source - clever-weather Forecasts Activity






From Project

Back to project page clever-weather.

License

The source code is released under:

GNU General Public License

If you think the Android project clever-weather listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.listotechnologies.cleverweather;
// ww  w. j a  va  2s. c  o m
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.view.MenuItem;

public class ForecastsActivity extends Activity {
    private static final String EXTRA_CITY_CODE = "EXTRA_CITY_CODE";
    private static final String EXTRA_CITY_NAME = "EXTRA_CITY_NAME";
    private static final String EXTRA_IS_FAVORITE = "EXTRA_IS_FAVORITE";

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        String cityName = getIntent().getStringExtra(EXTRA_CITY_NAME);
        if (cityName != null)
            setTitle(cityName);

        if (savedInstanceState == null) {
            String cityCode = getIntent().getStringExtra(EXTRA_CITY_CODE);
            boolean isFavorite = getIntent().getBooleanExtra(EXTRA_IS_FAVORITE, false);
            ForecastsFragment fragment = ForecastsFragment.newInstance(cityCode, isFavorite);
            getFragmentManager().beginTransaction().add(android.R.id.content, fragment).commit();
        }
    }

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        switch (item.getItemId()) {
            case android.R.id.home:
                onBackPressed();
                return true;
        }
        return(super.onOptionsItemSelected(item));
    }

    public static void start(Context context, String cityCode, String cityName, boolean isFavorite) {
        Intent intent = new Intent(context, ForecastsActivity.class);
        intent.putExtra(ForecastsActivity.EXTRA_CITY_CODE, cityCode);
        intent.putExtra(ForecastsActivity.EXTRA_CITY_NAME, cityName);
        intent.putExtra(ForecastsActivity.EXTRA_IS_FAVORITE, isFavorite);
        context.startActivity(intent);
    }
}




Java Source Code List

com.example.android.common.view.SlidingTabLayout.java
com.example.android.common.view.SlidingTabStrip.java
com.listotechnologies.cleverweather.ApplicationTest.java
com.listotechnologies.cleverweather.CitiesFragment.java
com.listotechnologies.cleverweather.CleverWeatherDbHelper.java
com.listotechnologies.cleverweather.CleverWeatherProviderClient.java
com.listotechnologies.cleverweather.CleverWeatherProviderExtended.java
com.listotechnologies.cleverweather.CleverWeatherProvider.java
com.listotechnologies.cleverweather.ForecastParser.java
com.listotechnologies.cleverweather.ForecastsActivity.java
com.listotechnologies.cleverweather.ForecastsFragment.java
com.listotechnologies.cleverweather.LocationGetter.java
com.listotechnologies.cleverweather.LocationHelper.java
com.listotechnologies.cleverweather.ProvinceActivity.java
com.listotechnologies.cleverweather.ProvincesFragment.java
com.listotechnologies.cleverweather.SearchCitiesActivity.java
com.listotechnologies.cleverweather.TabbedActivity.java
com.listotechnologies.cleverweather.TwoPaneFragment.java