diff --git a/android/app/src/main/java/ca/liquidlabs/android/weather/HomeActivity.java b/android/app/src/main/java/ca/liquidlabs/android/weather/HomeActivity.java index c06ddeb..3382eed 100644 --- a/android/app/src/main/java/ca/liquidlabs/android/weather/HomeActivity.java +++ b/android/app/src/main/java/ca/liquidlabs/android/weather/HomeActivity.java @@ -5,6 +5,7 @@ import android.os.Bundle; import android.support.v4.app.ActionBarDrawerToggle; import android.support.v4.app.FragmentActivity; +import android.support.v4.view.GestureDetectorCompat; import android.support.v4.view.PagerAdapter; import android.support.v4.view.ViewPager; import android.support.v4.widget.DrawerLayout; @@ -54,6 +55,8 @@ public class HomeActivity extends FragmentActivity { */ private PagerAdapter mPagerAdapter; + + @Override protected void onCreate(Bundle savedInstanceState) { @@ -69,6 +72,15 @@ protected void onCreate(Bundle savedInstanceState) setupActionBar(); setupDrawer(); setupViewPager(); + setupGestureListeners(); + } + + + /** + * Sets/Initializes the Gestures + */ + private void setupGestureListeners() { + } diff --git a/android/app/src/main/java/ca/liquidlabs/android/weather/ScreenSlidePageFragment.java b/android/app/src/main/java/ca/liquidlabs/android/weather/ScreenSlidePageFragment.java index b8faf81..36022fd 100644 --- a/android/app/src/main/java/ca/liquidlabs/android/weather/ScreenSlidePageFragment.java +++ b/android/app/src/main/java/ca/liquidlabs/android/weather/ScreenSlidePageFragment.java @@ -44,6 +44,7 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle b = getArguments(); + // put the string! TextView tView = (TextView) rootView.findViewById(R.id.pager_counter); tView.setText(b.getString(ARGS_COUNTER)); diff --git a/android/app/src/main/java/ca/liquidlabs/android/weather/model/Weather.java b/android/app/src/main/java/ca/liquidlabs/android/weather/model/Weather.java new file mode 100644 index 0000000..761e204 --- /dev/null +++ b/android/app/src/main/java/ca/liquidlabs/android/weather/model/Weather.java @@ -0,0 +1,15 @@ +package ca.liquidlabs.android.weather.model; + +/** + * POJO Class corresponding to Weather + * Created by Alif on 3/12/14. + */ +public class Weather { + + private double temp; + private double humidity; + private double high; + private double low; + private double feelsTemp; + +} diff --git a/android/app/src/main/java/ca/liquidlabs/android/weather/model/WeatherDAO.java b/android/app/src/main/java/ca/liquidlabs/android/weather/model/WeatherDAO.java new file mode 100644 index 0000000..e35b188 --- /dev/null +++ b/android/app/src/main/java/ca/liquidlabs/android/weather/model/WeatherDAO.java @@ -0,0 +1,84 @@ +package ca.liquidlabs.android.weather.model; + +import android.app.Activity; +import android.content.Context; +import android.util.Log; + +/** + * Model for retrieving Weather Data + * Abstracts the accessing of Weather Data. + * + * Created by Alif on 3/12/14. + */ +public class WeatherDAO { + + // TAG + private static final String TAG = "WeatherData"; + + // activity using this model must override this data + public interface OnChangeListener { + + // callbacks invoked + public void onSuccess(T data); + + public void onError(Object e); + } + + // context of the Application + private Context mContext; + + // reference to dataListener + private OnChangeListener listener; + private static WeatherDAO instance; + + + // + private WeatherDAO(Context c) { + mContext = c; + } + + /** + * @param ctx Pass the Application Context + * @param ls + * @return + */ + private WeatherDAO getInstance(Context ctx, Activity ls) { + if (instance == null) { + instance = new WeatherDAO(ctx); + } + + try { + listener = (OnChangeListener) ls; + } catch (ClassCastException e) { + Log.d(TAG, e.toString()); + } + + return instance; + } + + + /** + * Gets the Weather Data of the specific city + * @param city + */ + public void getData(String city) + { + // sees if the data exists in the local database + // if it exists, checks if cached/recent enough + // otherwise, makes a request via Android Volley + // and returns the data via callback to Activity + + + } + + /** + * Returns all datas based in collection + */ + public void getData() { + + } + + + + +} diff --git a/android/app/src/main/res/layout/fragment_screen_slide_page.xml b/android/app/src/main/res/layout/fragment_screen_slide_page.xml index aed73a5..8affa59 100644 --- a/android/app/src/main/res/layout/fragment_screen_slide_page.xml +++ b/android/app/src/main/res/layout/fragment_screen_slide_page.xml @@ -1,12 +1,13 @@ - + - - \ No newline at end of file + + \ No newline at end of file