Android Open Source - Sunshine Weather Provider






From Project

Back to project page Sunshine.

License

The source code is released under:

MIT License

If you think the Android project Sunshine 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 me.kalehv.t.sunshine.data;
/*  ww  w.j a va  2s. co m*/
import android.content.ContentProvider;
import android.content.ContentValues;
import android.content.UriMatcher;
import android.database.Cursor;
import android.net.Uri;

/**
 * Created by harshadkale on 7/21/14.
 */
public class WeatherProvider extends ContentProvider
{
    public static final int WEATHER = 100;
    public static final int WEATHER_WITH_LOCATION = 101;
    public static final int WEAHTER_WITH_LOCATION_AND_DATE = 103;
    public static final int LOCATION = 300;
    public static final int LOCATION_ID = 301;

    public static final UriMatcher sUriMatcher = buildUriMatcher();

    private WeatherDbHelper mOpenHelper;

    //region Overriden Methods
    @Override
    public boolean onCreate()
    {
//        mOpenHelper = new WeatherDbHelper(getContext());
        return true;
    }

    @Override
    public Cursor query(Uri uri, String[] projection, String selection, String[] selectionArgs, String sortOrder)
    {
        return null;
    }

    @Override
    public String getType(Uri uri)
    {
        return null;
    }

    @Override
    public Uri insert(Uri uri, ContentValues values)
    {
        return null;
    }

    @Override
    public int delete(Uri uri, String selection, String[] selectionArgs)
    {
        return 0;
    }

    @Override
    public int update(Uri uri, ContentValues values, String selection, String[] selectionArgs)
    {
        return 0;
    }
    //endregion

    private static UriMatcher buildUriMatcher()
    {
        final String authority = WeatherContract.CONTENT_AUTHORITY;
        final UriMatcher matcher = new UriMatcher(UriMatcher.NO_MATCH);

        matcher.addURI(authority, WeatherContract.PATH_WEATHER, WEATHER);
        matcher.addURI(authority, WeatherContract.PATH_WEATHER + "/*", WEATHER_WITH_LOCATION);
        matcher.addURI(authority, WeatherContract.PATH_WEATHER + "/*/*", WEAHTER_WITH_LOCATION_AND_DATE);

        matcher.addURI(authority, WeatherContract.PATH_LOCATION, LOCATION);
        matcher.addURI(authority, WeatherContract.PATH_LOCATION + "/#", LOCATION_ID);

        return matcher;
    }
}




Java Source Code List

me.kalehv.t.sunshine.ApplicationTest.java
me.kalehv.t.sunshine.DetailActivity.java
me.kalehv.t.sunshine.ForecastFragment.java
me.kalehv.t.sunshine.FullTestSuite.java
me.kalehv.t.sunshine.MainActivity.java
me.kalehv.t.sunshine.SettingsActivity.java
me.kalehv.t.sunshine.TestDB.java
me.kalehv.t.sunshine.data.WeatherContract.java
me.kalehv.t.sunshine.data.WeatherDbHelper.java
me.kalehv.t.sunshine.data.WeatherProvider.java