From c2ac0b3d5eaf72785f54184c4e2561d6706a8fa5 Mon Sep 17 00:00:00 2001 From: Yuku on yuku8 Date: Tue, 3 Nov 2015 10:17:44 +0800 Subject: [PATCH 1/4] Bump version --- Alkitab/build.gradle | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Alkitab/build.gradle b/Alkitab/build.gradle index ea84e0012..f899342fe 100644 --- a/Alkitab/build.gradle +++ b/Alkitab/build.gradle @@ -17,8 +17,8 @@ android { applicationId 'yuku.alkitab.debug' minSdkVersion rootProject.ext.minSdkVersion targetSdkVersion rootProject.ext.targetSdkVersion - versionCode 14000253 - versionName '4.3.3' + versionCode 14000254 + versionName '4.3.4' multiDexEnabled true } buildTypes { From bc8f0b095ef36d8808ca6c4f40defe8b4d1bb17b Mon Sep 17 00:00:00 2001 From: Yuku on yuku8 Date: Tue, 3 Nov 2015 10:18:09 +0800 Subject: [PATCH 2/4] Bug in version selector: when the selected version is -1 and the user clicks on "other versions" --- Alkitab/src/main/java/yuku/alkitab/base/S.java | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/Alkitab/src/main/java/yuku/alkitab/base/S.java b/Alkitab/src/main/java/yuku/alkitab/base/S.java index 1cfd143f9..ccfd60b94 100644 --- a/Alkitab/src/main/java/yuku/alkitab/base/S.java +++ b/Alkitab/src/main/java/yuku/alkitab/base/S.java @@ -203,9 +203,17 @@ public static void openVersionsDialog(final Activity activity, final boolean wit new MaterialDialog.Builder(activity) .items(options) .itemsCallbackSingleChoice(selected, (dialog, view, which, text) -> { - final MVersion mv = versions.get(which); - listener.onVersionSelected(mv); - dialog.dismiss(); + if (which == -1) { + // it is possible that 'which' is -1 in the case that + // a version is already deleted, but the current displayed version is that version + // (hence the initial selected item position is -1) and then the user + // presses the "other version" button. This callback will still be triggered + // before the positive button callback. + } else { + final MVersion mv = versions.get(which); + listener.onVersionSelected(mv); + dialog.dismiss(); + } return true; }) .alwaysCallSingleChoiceCallback() From 3dafbafc158bcf4b475a9203b1641c4f22426334 Mon Sep 17 00:00:00 2001 From: Yuku on yuku8 Date: Tue, 3 Nov 2015 10:38:06 +0800 Subject: [PATCH 3/4] Fix upgrading db from pre-1.9.0 --- .../base/storage/InternalDbHelper.java | 32 +++++++++---------- 1 file changed, 15 insertions(+), 17 deletions(-) diff --git a/Alkitab/src/main/java/yuku/alkitab/base/storage/InternalDbHelper.java b/Alkitab/src/main/java/yuku/alkitab/base/storage/InternalDbHelper.java index 8ca13f3eb..99a6c94b3 100644 --- a/Alkitab/src/main/java/yuku/alkitab/base/storage/InternalDbHelper.java +++ b/Alkitab/src/main/java/yuku/alkitab/base/storage/InternalDbHelper.java @@ -75,8 +75,19 @@ public void onOpen(SQLiteDatabase db) { // } if (oldVersion <= 50) { - // new table Version - createTableEdisi(db); + // recreate a temporary old-style table "Edisi" + // This will later be converted in version 14000166 + db.execSQL("create table if not exists Edisi (" + + "_id integer primary key autoincrement, " + + "shortName text, " + + "judul text, " + + "jenis text, " + + "keterangan text, " + + "namafile text, " + + "namafile_pdbasal text, " + + "aktif integer, " + + "urutan integer)" + ); } if (oldVersion <= 69) { // 70: 2.0.0 @@ -125,7 +136,7 @@ public void onOpen(SQLiteDatabase db) { createIndexReadingPlanProgress(db); } - if (oldVersion < 14000163) { // last version that doesn't use Marker table + if (oldVersion < 14000163) { // 4.0.0-beta1: last version that doesn't use Marker table addGidColumnToLabelIfNeeded(db); createTableMarker(db); @@ -136,7 +147,7 @@ public void onOpen(SQLiteDatabase db) { convertFromBookmark2ToMarker(db); } - if (oldVersion < 14000166) { // last version that doesn't use the new Version table + if (oldVersion < 14000166) { // 4.0.0-beta5: last version that doesn't use the new Version table createTableVersion(db); createIndexVersion(db); convertFromEdisiToVersion(db); @@ -217,19 +228,6 @@ private void createIndexDevotion(SQLiteDatabase db) { db.execSQL("create index if not exists index_Devotion_02 on " + Table.Devotion.tableName() + " (" + Table.Devotion.touchTime + ")"); } - private void createTableEdisi(SQLiteDatabase db) { - db.execSQL("create table if not exists Edisi (" + - "_id integer primary key autoincrement, " + - "shortName text, " + - "judul text, " + - "jenis text, " + - "keterangan text, " + - Db.Version.filename + "namafile text, " + - "namafile_pdbasal text, " + - "aktif integer, " + - "urutan integer)"); - } - void createTableVersion(SQLiteDatabase db) { db.execSQL("create table if not exists " + Db.TABLE_Version + " (" + "_id integer primary key autoincrement, " + From 00f046d3ea634526e68584f62b4e8edee9f82048 Mon Sep 17 00:00:00 2001 From: Yuku on yuku8 Date: Tue, 3 Nov 2015 11:02:25 +0800 Subject: [PATCH 4/4] Guard against wild ListView.onInitializeAccessibilityNodeInfoForItem that asks for non-existent position when calling isEnabled. --- .../java/yuku/alkitab/base/widget/VerseAdapter.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/Alkitab/src/main/java/yuku/alkitab/base/widget/VerseAdapter.java b/Alkitab/src/main/java/yuku/alkitab/base/widget/VerseAdapter.java index d4e91b0f5..8bf45458d 100644 --- a/Alkitab/src/main/java/yuku/alkitab/base/widget/VerseAdapter.java +++ b/Alkitab/src/main/java/yuku/alkitab/base/widget/VerseAdapter.java @@ -177,7 +177,7 @@ public synchronized void reloadAttributeMap() { } @Override public synchronized long getItemId(int position) { - return itemPointer_[position]; + return position; } public void setParallelListener(CallbackSpan.OnClickListener parallelListener) { @@ -311,7 +311,13 @@ public int getVerseCount() { } @Override public boolean isEnabled(int position) { - return getItemId(position) >= 0; + final int[] _itemPointer = this.itemPointer_; + + // guard against wild ListView.onInitializeAccessibilityNodeInfoForItem + if (_itemPointer == null) return false; + if (position >= _itemPointer.length) return false; + + return _itemPointer[position] >= 0; } private static int[] makeItemPointer(int nverse, int[] pericopeAris, PericopeBlock[] pericopeBlocks, int nblock) {