package com.example.android.sunshine.app.data;

import android.content.ContentProvider;
import android.content.ContentValues;
import android.content.UriMatcher;
import android.database.Cursor;
import android.net.Uri;
import android.support.annotation.Nullable;

public class WeatherProvider extends ContentProvider {

    private WeatherDbHelper mOpenHelper;

    static final int WEATHER = 100;
    static final int WEATHER_WITH_LOCATION = 101;
    static final int WEATHER_WITH_LOCATION_AND_DATE = 102;
    static final int LOCATION = 300;

    static UriMatcher buildUriMatcher() {
        final UriMatcher matcher = new UriMatcher(UriMatcher.NO_MATCH);
        final String authority = WeatherContract.CONTENT_AUTHORITY;
        final String path_weather = WeatherContract.PATH_WEATHER;
        final String path_location = WeatherContract.PATH_LOCATION;

        matcher.addURI(authority, path_weather, WEATHER);
        matcher.addURI(authority, path_location, LOCATION);
        matcher.addURI(authority, path_weather + "/*", WEATHER_WITH_LOCATION);
        matcher.addURI(authority, path_weather + "/*/#", WEATHER_WITH_LOCATION_AND_DATE);

        return matcher;
    }

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

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

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

    @Nullable
    @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;
    }
}

@@ -351,16 +351,85 @@
 nHelper;
+%0A    private static final UriMatcher sUriMatcher = buildUriMatcher();
 %0A%0A    st
@@ -1613,36 +1613,614 @@
 ) %7B%0A        
-return null;
+final int match = sUriMatcher.match(uri);%0A%0A        switch (match) %7B%0A            case WEATHER_WITH_LOCATION_AND_DATE:%0A                return WeatherContract.WeatherEntry.CONTENT_ITEM_TYPE;%0A            case WEATHER_WITH_LOCATION:%0A                return WeatherContract.WeatherEntry.CONTENT_TYPE;%0A            case WEATHER:%0A                return WeatherContract.WeatherEntry.CONTENT_TYPE;%0A            case LOCATION:%0A                return WeatherContract.LocationEntry.CONTENT_TYPE;%0A            default:%0A                throw new UnsupportedOperationException(%22Unknown uri: %22 + uri);%0A        %7D
 %0A    %7D%0A%0A    

Add GetType to ContentProvider