Android Open Source - The-Weather-App All Cities






From Project

Back to project page The-Weather-App.

License

The source code is released under:

Apache License

If you think the Android project The-Weather-App 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.sachinshinde.theweatherapp.ui.main.activities;
//  ww  w.  j  a  v a 2  s. com
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;

import com.sachinshinde.theweatherapp.R;
import com.sachinshinde.theweatherapp.ui.main.fragments.LocationDetailFragment;
import com.sachinshinde.theweatherapp.ui.main.fragments.LocationListFragment;
import com.sachinshinde.theweatherapp.ui.main.views.DrawShadowFrameLayout;


public class AllCities extends BaseActivity implements
        LocationListFragment.Callbacks  {

    /**
     * Callback method from {@link com.sachinshinde.theweatherapp.ui.main.fragments.LocationListFragment.Callbacks} indicating that
     * the item with the given ID was selected.
     */
    @Override
    public void onItemSelected(long id) {
//    if (mTwoPane) {
//      // In two-pane mode, show the detail view in this activity by
//      // adding or replacing the detail fragment using a
//      // fragment transaction.
//      Bundle arguments = new Bundle();
//      arguments.putLong(LocationDetailFragment.ARG_ITEM_ID, id);
//      LocationDetailFragment fragment = new LocationDetailFragment();
//      fragment.setArguments(arguments);
//      getSupportFragmentManager().beginTransaction()
//          .replace(R.id.person_detail_container, fragment).commit();
//
//    } else {
        // In single-pane mode, simply start the detail activity
        // for the selected item ID.
        Intent detailIntent = new Intent(this, LocationDetailActivity.class);
        detailIntent.putExtra(LocationDetailFragment.ARG_ITEM_ID, id);
        startActivity(detailIntent);
//    }
    }

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

//        Toolbar toolbar = getActionBarToolbar();

//        overridePendingTransition(0, 0);

    }

    @Override
    protected void onPostCreate(Bundle savedInstanceState) {
        super.onPostCreate(savedInstanceState);
//        CollectionView collectionView = (CollectionView) findViewById(R.id.sessions_collection_view);
//
//        if (collectionView != null) {
//            Log.d(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>", "not null");
//            enableActionBarAutoHide(collectionView);
//        } else {
//            Log.d(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>", "null");
//        }


        mLocationsFrag = (LocationListFragment) getSupportFragmentManager().findFragmentById(
                R.id.sessions_fragment);
        if (mLocationsFrag != null && savedInstanceState == null) {
            Bundle args = intentToFragmentArguments(getIntent());
//            mLocationsFrag.reloadFromArguments(args);
        }

        registerHideableHeaderView(findViewById(R.id.headerbar));
    }

    /**
     * Converts an intent into a {@link android.os.Bundle} suitable for use as fragment arguments.
     */
    public static Bundle intentToFragmentArguments(Intent intent) {
        Bundle arguments = new Bundle();
        if (intent == null) {
            return arguments;
        }

        final Uri data = intent.getData();
        if (data != null) {
            arguments.putParcelable("_uri", data);
        }

        final Bundle extras = intent.getExtras();
        if (extras != null) {
            arguments.putAll(intent.getExtras());
        }

        return arguments;
    }


    @Override
    protected void onActionBarAutoShowOrHide(boolean shown) {
        super.onActionBarAutoShowOrHide(shown);
        mDrawShadowFrameLayout.setShadowVisible(shown, shown);
    }

    @Override
    public boolean canSwipeRefreshChildScrollUp() {
        if (mLocationsFrag != null) {
            return mLocationsFrag.canCollectionViewScrollUp();
        }
        return super.canSwipeRefreshChildScrollUp();
    }

    private LocationListFragment mLocationsFrag = null;
    private DrawShadowFrameLayout mDrawShadowFrameLayout;

    @Override protected int getLayoutResource() {
        return R.layout.activity_main;
    }

    @Override
    protected int getSelfNavDrawerItem() {
        return BaseActivity.NAVDRAWER_ITEM_OVERVIEW;
    }
}




Java Source Code List

com.sachinshinde.theweatherapp.ApplicationTest.java
com.sachinshinde.theweatherapp.db.LocationDBHandler.java
com.sachinshinde.theweatherapp.db.LocationsProvider.java
com.sachinshinde.theweatherapp.db.Locations.java
com.sachinshinde.theweatherapp.libs.SwipeDismissRecyclerViewTouchListener.java
com.sachinshinde.theweatherapp.libs.SwipeDismissTouchListener.java
com.sachinshinde.theweatherapp.ui.main.activities.AboutClass.java
com.sachinshinde.theweatherapp.ui.main.activities.AllCities.java
com.sachinshinde.theweatherapp.ui.main.activities.BaseActivity.java
com.sachinshinde.theweatherapp.ui.main.activities.LocationDetailActivity.java
com.sachinshinde.theweatherapp.ui.main.activities.LocationListActivity.java
com.sachinshinde.theweatherapp.ui.main.fragments.LocationDetailFragment.java
com.sachinshinde.theweatherapp.ui.main.fragments.LocationListFragment.java
com.sachinshinde.theweatherapp.ui.main.fragments.NavigationDrawerFragment.java
com.sachinshinde.theweatherapp.ui.main.views.DrawShadowFrameLayout.java
com.sachinshinde.theweatherapp.ui.main.views.MultiSwipeRefreshLayout.java
com.sachinshinde.theweatherapp.ui.main.views.ScrimInsetsFrameLayout.java
com.sachinshinde.theweatherapp.ui.main.views.ScrimInsetsScrollView.java
com.sachinshinde.theweatherapp.utils.ChangeLog.java
com.sachinshinde.theweatherapp.utils.Constant.java
com.sachinshinde.theweatherapp.utils.LUtils.java
com.sachinshinde.theweatherapp.utils.LogUtils.java
com.sachinshinde.theweatherapp.utils.PrefUtils.java
com.sachinshinde.theweatherapp.utils.UIUtils.java
com.sachinshinde.theweatherapp.utils.Utilities.java