Skip to content

Instantly share code, notes, and snippets.

@abhishekhugetech
Created January 8, 2019 19:07
Show Gist options
  • Save abhishekhugetech/798f8348005fbab2d6ffd87c5372ca70 to your computer and use it in GitHub Desktop.
Save abhishekhugetech/798f8348005fbab2d6ffd87c5372ca70 to your computer and use it in GitHub Desktop.
Defines the Contract Class for the Content Provider
package com.jwhh.jim.notekeeper;
import android.net.Uri;
import android.provider.BaseColumns;
/**
* Created by Jim.
*/
public final class NoteKeeperProviderContract {
private NoteKeeperProviderContract(){}
public static final String AUTHORITY = "com.jwhh.jim.notekeeper.provider";
public static final Uri AUTHORITY_URI = Uri.parse("content://" + AUTHORITY);
protected interface CoursesIdColumns {
public static final String COLUMN_COURSE_ID = "course_id";
}
protected interface CoursesColumns {
public static final String COLUMN_COURSE_TITLE = "course_title";
}
protected interface NotesColumns {
public static final String COLUMN_NOTE_TITLE = "note_title";
public static final String COLUMN_NOTE_TEXT = "note_text";
}
public static final class Courses implements BaseColumns, CoursesColumns, CoursesIdColumns {
public static final String PATH = "courses";
// content://com.jwhh.jim.notekeeper.provider/courses
public static final Uri CONTENT_URI = Uri.withAppendedPath(AUTHORITY_URI, PATH);
}
public static final class Notes implements BaseColumns, NotesColumns, CoursesIdColumns, CoursesColumns {
public static final String PATH = "notes";
public static final Uri CONTENT_URO = Uri.withAppendedPath(AUTHORITY_URI, PATH);
public static final String PATH_EXPANDED = "notes_expanded";
public static final Uri CONTENT_EXPANDED_URI = Uri.withAppendedPath(AUTHORITY_URI, PATH_EXPANDED);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment