diff --git a/app/build.gradle b/app/build.gradle index d76f866..edb3a2b 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -9,8 +9,8 @@ android { applicationId "org.literacyapp" minSdkVersion 21 targetSdkVersion 23 - versionCode 1005002 - versionName "1.5.2" + versionCode 1005003 + versionName "1.5.3" // jackOptions { // enabled true diff --git a/app/src/main/java/org/literacyapp/MainActivity.java b/app/src/main/java/org/literacyapp/MainActivity.java index 7c02d3a..a90654c 100644 --- a/app/src/main/java/org/literacyapp/MainActivity.java +++ b/app/src/main/java/org/literacyapp/MainActivity.java @@ -11,12 +11,15 @@ import android.util.Log; import android.widget.Toast; +import org.literacyapp.contentprovider.ContentProvider; import org.literacyapp.contentprovider.dao.LetterDao; +import org.literacyapp.contentprovider.model.content.Letter; import org.literacyapp.service.synchronization.ReadDeviceAsyncTask; import org.literacyapp.util.ConnectivityHelper; import org.literacyapp.util.RootHelper; import java.io.IOException; +import java.util.List; public class MainActivity extends AppCompatActivity { @@ -60,9 +63,9 @@ protected void onStart() { LiteracyApplication literacyApplication = (LiteracyApplication) getApplication(); letterDao = literacyApplication.getDaoSession().getLetterDao(); -// ContentProvider.initializeDb(this); -// List letters = ContentProvider.getAvailableLetters(); -// Log.i(getClass().getName(), "letters: " + letters); + ContentProvider.initializeDb(this); + List letters = ContentProvider.getUnlockedLetters(); + Log.i(getClass().getName(), "letters: " + letters); if (letterDao.loadAll().isEmpty()) { // Download content diff --git a/app/src/main/java/org/literacyapp/logic/CurriculumHelper.java b/app/src/main/java/org/literacyapp/logic/CurriculumHelper.java index e4e6d2c..6bcd0bf 100644 --- a/app/src/main/java/org/literacyapp/logic/CurriculumHelper.java +++ b/app/src/main/java/org/literacyapp/logic/CurriculumHelper.java @@ -38,7 +38,7 @@ public CurriculumHelper(Context context) { * default list. */ public List getAvailableLetters(Student student) { - Log.i(getClass().getName(), "getAvailableLetters"); + Log.i(getClass().getName(), "getUnlockedLetters"); List letters = new ArrayList<>(); @@ -72,7 +72,7 @@ public List getAvailableLetters(Student student) { * default list. */ public List getAvailableNumbers(Student student) { - Log.i(getClass().getName(), "getAvailableNumbers"); + Log.i(getClass().getName(), "getUnlockedNumbers"); List numbers = new ArrayList<>(); diff --git a/contentprovider/build.gradle b/contentprovider/build.gradle index a67b2eb..0f4a121 100644 --- a/contentprovider/build.gradle +++ b/contentprovider/build.gradle @@ -8,8 +8,8 @@ android { defaultConfig { minSdkVersion 21 targetSdkVersion 23 - versionCode 1005002 - versionName "1.5.2" + versionCode 1005003 + versionName "1.5.3" testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" diff --git a/contentprovider/src/main/java/org/literacyapp/contentprovider/ContentProvider.java b/contentprovider/src/main/java/org/literacyapp/contentprovider/ContentProvider.java index df54a7f..87b28c7 100644 --- a/contentprovider/src/main/java/org/literacyapp/contentprovider/ContentProvider.java +++ b/contentprovider/src/main/java/org/literacyapp/contentprovider/ContentProvider.java @@ -6,7 +6,7 @@ import android.util.Log; import org.literacyapp.contentprovider.dao.AudioDao; -import org.literacyapp.contentprovider.dao.CustomDaoMaster; +import org.literacyapp.contentprovider.dao.DaoMaster; import org.literacyapp.contentprovider.dao.DaoSession; import org.literacyapp.contentprovider.dao.ImageDao; import org.literacyapp.contentprovider.dao.LetterDao; @@ -29,9 +29,9 @@ */ public class ContentProvider { - public static final int INITIAL_LETTER_COUNT = 3; + private static final int INITIAL_LETTER_COUNT = 3; - public static final int INITIAL_NUMBER_COUNT = 3; + private static final int INITIAL_NUMBER_COUNT = 3; private static DaoSession daoSession; @@ -40,16 +40,16 @@ public static DaoSession initializeDb(Context context) { // Initialize greenDAO database String dbName = Environment.getExternalStorageDirectory() + "/.literacyapp/database/literacyapp-db"; - CustomDaoMaster.DevOpenHelper openHelper = new CustomDaoMaster.DevOpenHelper(context, dbName, null); + DaoMaster.DevOpenHelper openHelper = new DaoMaster.DevOpenHelper(context, dbName); SQLiteDatabase db = openHelper.getReadableDatabase(); // read-only - CustomDaoMaster daoMaster = new CustomDaoMaster(db); + DaoMaster daoMaster = new DaoMaster(db); daoSession = daoMaster.newSession(); return daoSession; } - public static List getAvailableLetters() { - Log.i(ContentProvider.class.getName(), "getAvailableLetters"); + public static List getUnlockedLetters() { + Log.i(ContentProvider.class.getName(), "getUnlockedLetters"); // TODO: get current Student Student student = null; @@ -85,8 +85,18 @@ public static List getAvailableLetters() { return letters; } - public static List getAvailableNumbers() { - Log.i(ContentProvider.class.getName(), "getAvailableNumbers"); + public static List getAllLetters() { + Log.i(ContentProvider.class.getName(), "getAllLetters"); + + LetterDao letterDao = daoSession.getLetterDao(); + + List letters = letterDao.loadAll(); + + return letters; + } + + public static List getUnlockedNumbers() { + Log.i(ContentProvider.class.getName(), "getUnlockedNumbers"); // TODO: get current Student Student student = null; @@ -123,7 +133,7 @@ public static List getAvailableNumbers() { } public static List getAllNumbers() { - Log.i(ContentProvider.class.getName(), "getAvailableNumbers"); + Log.i(ContentProvider.class.getName(), "getAllNumbers"); NumberDao numberDao = daoSession.getNumberDao(); @@ -132,18 +142,18 @@ public static List getAllNumbers() { return numbers; } - public static List getAllLetters() { - Log.i(ContentProvider.class.getName(), "getAvailableLetters"); - - LetterDao letterDao = daoSession.getLetterDao(); - - List letters = letterDao.loadAll(); - - return letters; - } +// public static List getUnlockedWords() { +// Log.i(ContentProvider.class.getName(), "getUnlockedWords"); +// +// WordDao wordDao = daoSession.getWordDao(); +// +// // TODO +// +// return words; +// } public static List getAllWords() { - Log.i(ContentProvider.class.getName(), "getAvailableWords"); + Log.i(ContentProvider.class.getName(), "getAllWords"); WordDao wordDao = daoSession.getWordDao(); @@ -152,20 +162,12 @@ public static List getAllWords() { return words; } - public static List getAllWordsOrderedByFrequency() { - Log.i(ContentProvider.class.getName(), "getAvailableWords"); - - WordDao wordDao = daoSession.getWordDao(); - - List words = wordDao.loadAll(); - - return words; - } + // TODO: getUnlockedStoryBooks() // TODO: getAllStoryBooks() public static List