This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Created by shubham on 22/7/17. | |
*/ | |
@Entity(tableName = CATEGORY_TABLE_NAME) | |
public class CategoryData { | |
@SuppressWarnings("unused") | |
private static final String TAG = "CategoryData"; | |
@PrimaryKey |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Created by shubham on 22/7/17. | |
*/ | |
@Entity(tableName = CATEGORY_TABLE_NAME) | |
public class CategoryData { | |
@SuppressWarnings("unused") | |
private static final String TAG = "CategoryData"; | |
@PrimaryKey |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Dao | |
public interface CategoryDao { | |
@Query("SELECT * FROM " + AppDatabase.CATEGORY_TABLE_NAME) | |
List<CategoryData> getAll(); | |
@Insert(onConflict = OnConflictStrategy.REPLACE) | |
void insertAll(List<CategoryData> categories); | |
@Insert(onConflict = OnConflictStrategy.REPLACE) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Database(entities = {CategoryData.class}, version = DATABASE_VERSION) | |
public abstract class AppDatabase extends RoomDatabase { | |
private static AppDatabase INSTANCE; | |
/*Database Constant*/ | |
@SuppressWarnings("WeakerAccess") | |
public final static int DATABASE_VERSION = 1; | |
public final static String DATABASE_NAME = "App.db"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class CategoryDbHelper extends SQLiteOpenHelper { | |
@SuppressWarnings("unused") | |
private static final String TAG = "CategoryDbHelper"; | |
private static final String SQL_CREATE_CATEGORY_ENTRIES = "CREATE TABLE " + CategoryContract.CategoryEntry.TABLE_NAME + " (" | |
+ CategoryContract.CategoryEntry._ID + " INTEGER PRIMARY KEY," | |
+ CategoryContract.CategoryEntry.COLUMN_NAME_ID + " TEXT," | |
+ CategoryContract.CategoryEntry.COLUMN_NAME_DESCRIPTION + " TEXT," | |
+ CategoryContract.CategoryEntry.COLUMN_NAME_NAME + " TEXT," |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public final class CategoryContract { | |
@SuppressWarnings("unused") | |
private static final String TAG = "CategoryContract"; | |
private CategoryContract() { | |
} | |
public static class CategoryEntry implements BaseColumns { | |
@SuppressWarnings("unused") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ᕙ(⇀‸↼‶)ᕗ | |
(๑ᴥ๑ ) | |
━╤デ╦︻(▀̿̿Ĺ̯̿̿▀̿ ̿) | |
(ノಠ益ಠ)ノ彡┻━┻| | |
¯\_(ツ)_/¯ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Created by shubham on 21/7/17. | |
*/ | |
public class RetrofitClient { | |
private static Retrofit sRetrofit = null; | |
@SuppressLint("StaticFieldLeak") | |
private static Context sContext; | |
public static Retrofit getClient(Context context) { | |
if (sRetrofit == null) { |
NewerOlder