Android Open Source - HackWinds Tide Fragment






From Project

Back to project page HackWinds.

License

The source code is released under:

MIT License

If you think the Android project HackWinds 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.nucc.hackwinds;
//from www  .  java  2s. c  o m
import android.os.AsyncTask;
import android.os.Bundle;
import android.support.v4.app.ListFragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;


public class TideFragment extends ListFragment {
    TideModel mTideModel;
    TideArrayAdapter mTideArrayAdapter;

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

        mTideModel = TideModel.getInstance();

        // deploy the wunderground async task
        new BackgroundWunderAsyncTask().execute();
    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        View V = inflater.inflate(R.layout.tide_fragment, container, false);
        return V;
    }

    public class BackgroundWunderAsyncTask extends AsyncTask<Void, Void, Void> {

        @Override
        protected Void doInBackground(Void... arg0) {
            // Get the values using the model and parse the data
            mTideModel.getTideData();

            // Return
            return null;
        }

        @Override
        protected void onPostExecute(Void result) {
            super.onPostExecute(result);

            // If there arent enough values, remove it from the list
            if (mTideModel.tides.get(mTideModel.tides.size() - 1).dType[0] == null) {
                mTideModel.tides.remove(mTideModel.tides.size() - 1);
            }

            // Set the tide adapter to the list
            mTideArrayAdapter = new TideArrayAdapter(getActivity(), mTideModel.tides);
            setListAdapter(mTideArrayAdapter);
        }

    }
}




Java Source Code List

com.nucc.hackwinds.BuoyArrayAdapter.java
com.nucc.hackwinds.BuoyFragment.java
com.nucc.hackwinds.BuoyModel.java
com.nucc.hackwinds.Buoy.java
com.nucc.hackwinds.CamFragment.java
com.nucc.hackwinds.ConditionArrayAdapter.java
com.nucc.hackwinds.ConditionModel.java
com.nucc.hackwinds.Condition.java
com.nucc.hackwinds.CurrentFragment.java
com.nucc.hackwinds.ForecastArrayAdapter.java
com.nucc.hackwinds.ForecastFragment.java
com.nucc.hackwinds.ForecastModel.java
com.nucc.hackwinds.Forecast.java
com.nucc.hackwinds.MainActivity.java
com.nucc.hackwinds.ServiceHandler.java
com.nucc.hackwinds.TideArrayAdapter.java
com.nucc.hackwinds.TideFragment.java
com.nucc.hackwinds.TideModel.java
com.nucc.hackwinds.Tide.java