mirror of
https://github.com/MinimalBible/MinimalBible
synced 2024-11-22 07:58:20 -05:00
Multiple Bible support and internet usage settings
Fixes #2 completely.
This commit is contained in:
parent
701726aeb1
commit
c6216afa60
@ -19,5 +19,4 @@ public interface DownloadPrefs {
|
|||||||
long downloadRefreshedOn();
|
long downloadRefreshedOn();
|
||||||
|
|
||||||
void downloadRefreshedOn(long downloadRefreshedOn);
|
void downloadRefreshedOn(long downloadRefreshedOn);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,42 @@
|
|||||||
|
package org.bspeice.minimalbible.activity.settings;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.preference.ListPreference;
|
||||||
|
import android.util.AttributeSet;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
|
||||||
|
import org.crosswire.jsword.book.Book;
|
||||||
|
import org.crosswire.jsword.book.Books;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the active "main book"
|
||||||
|
* Can not be implemented in Kotlin due to array needs
|
||||||
|
*/
|
||||||
|
public class AvailableBookPreference extends ListPreference {
|
||||||
|
|
||||||
|
public AvailableBookPreference(Context ctx, AttributeSet attrs) {
|
||||||
|
super(ctx, attrs);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected View onCreateView(ViewGroup parent) {
|
||||||
|
// TODO: Refactor out the static reference
|
||||||
|
List<Book> books = Books.installed().getBooks();
|
||||||
|
CharSequence[] entries = new CharSequence[books.size()];
|
||||||
|
CharSequence[] entryValues = new CharSequence[books.size()];
|
||||||
|
|
||||||
|
for (int i = 0; i < books.size(); i++) {
|
||||||
|
Book b = books.get(i);
|
||||||
|
entries[i] = b.getName();
|
||||||
|
entryValues[i] = b.getInitials();
|
||||||
|
}
|
||||||
|
|
||||||
|
setEntries(entries);
|
||||||
|
setEntryValues(entryValues);
|
||||||
|
|
||||||
|
return super.onCreateView(parent);
|
||||||
|
}
|
||||||
|
}
|
@ -50,7 +50,7 @@ public class BibleViewerModules {
|
|||||||
.first(new Func1<Book, Boolean>() {
|
.first(new Func1<Book, Boolean>() {
|
||||||
@Override
|
@Override
|
||||||
public Boolean call(Book book) {
|
public Boolean call(Book book) {
|
||||||
return book.getName().equals(prefs.defaultBookName());
|
return book.getInitials().equals(prefs.defaultBookInitials());
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.subscribe(new Action1<Book>() {
|
.subscribe(new Action1<Book>() {
|
||||||
|
@ -9,11 +9,10 @@ import de.devland.esperandro.annotations.SharedPreferences;
|
|||||||
@SharedPreferences
|
@SharedPreferences
|
||||||
public interface BibleViewerPreferences {
|
public interface BibleViewerPreferences {
|
||||||
|
|
||||||
String defaultBookName();
|
String defaultBookInitials();
|
||||||
void defaultBookName(String defaultBookName);
|
void defaultBookName(String defaultBookName);
|
||||||
|
|
||||||
@Default(ofInt = 14)
|
@Default(ofInt = 14)
|
||||||
int baseTextSize();
|
int baseTextSize();
|
||||||
|
|
||||||
void baseTextSize(int baseTextSize);
|
void baseTextSize(int baseTextSize);
|
||||||
}
|
}
|
||||||
|
@ -14,4 +14,15 @@ but I will likely want to re-implement this in the future -->
|
|||||||
cmwmobile:stepSize="1"
|
cmwmobile:stepSize="1"
|
||||||
cmwmobile:units="pt." />
|
cmwmobile:units="pt." />
|
||||||
|
|
||||||
|
<CheckBoxPreference
|
||||||
|
android:defaultValue="true"
|
||||||
|
android:key="hasEnabledDownload"
|
||||||
|
android:summary="Whether MinimalBible can use the Internet"
|
||||||
|
android:title="Internet usage enabled" />
|
||||||
|
|
||||||
|
<org.bspeice.minimalbible.activity.settings.AvailableBookPreference
|
||||||
|
android:key="defaultBookInitials"
|
||||||
|
android:summary="Which book to display in the main window"
|
||||||
|
android:title="Active Book" />
|
||||||
|
|
||||||
</PreferenceScreen>
|
</PreferenceScreen>
|
Loading…
Reference in New Issue
Block a user