Skip to content

Commit

Permalink
Merge branch 'hotfix/4.3.4'
Browse files Browse the repository at this point in the history
# Conflicts:
#	Alkitab/build.gradle
  • Loading branch information
yukuku committed Nov 30, 2015
2 parents ff163d6 + 00f046d commit ba4bd59
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 22 deletions.
14 changes: 11 additions & 3 deletions Alkitab/src/main/java/yuku/alkitab/base/S.java
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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);
Expand All @@ -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);
Expand Down Expand Up @@ -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, " +
Expand Down
10 changes: 8 additions & 2 deletions Alkitab/src/main/java/yuku/alkitab/base/widget/VerseAdapter.java
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ public synchronized void reloadAttributeMap() {
}

@Override public synchronized long getItemId(int position) {
return itemPointer_[position];
return position;
}

public void setParallelListener(CallbackSpan.OnClickListener<Object> parallelListener) {
Expand Down Expand Up @@ -341,7 +341,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) {
Expand Down

0 comments on commit ba4bd59

Please sign in to comment.