mirror of
https://github.com/MinimalBible/MinimalBible
synced 2024-11-04 23:28:19 -05:00
Settings now looking (mostly) beautiful.
This commit is contained in:
parent
21730b7db6
commit
578e970c0e
@ -17,7 +17,8 @@
|
|||||||
android:label="@string/app_name" />
|
android:label="@string/app_name" />
|
||||||
<activity
|
<activity
|
||||||
android:name=".activity.settings.MinimalBibleSettings"
|
android:name=".activity.settings.MinimalBibleSettings"
|
||||||
android:label="@string/app_name" />
|
android:label="@string/app_name"
|
||||||
|
android:theme="@style/MinimalBible.Settings" />
|
||||||
<activity
|
<activity
|
||||||
android:name=".activity.viewer.BibleViewer"
|
android:name=".activity.viewer.BibleViewer"
|
||||||
android:label="@string/app_name">
|
android:label="@string/app_name">
|
||||||
|
@ -119,8 +119,10 @@ public class SeekBarDialogPreference extends
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onDialogClosed(boolean positiveResult) {
|
public void onDialogClosed(boolean positiveResult) {
|
||||||
if (positiveResult && shouldPersist())
|
if (positiveResult && shouldPersist()) {
|
||||||
|
setSummary((value + minimumValue) + " " + units);
|
||||||
persistInt(value + minimumValue);
|
persistInt(value + minimumValue);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -130,4 +132,11 @@ public class SeekBarDialogPreference extends
|
|||||||
@Override
|
@Override
|
||||||
public void onStopTrackingTouch(SeekBar seekBar) {
|
public void onStopTrackingTouch(SeekBar seekBar) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public CharSequence getSummary() {
|
||||||
|
// We have to use getPersistedInt over `value` since it will not have
|
||||||
|
// been set yet.
|
||||||
|
return getPersistedInt(minimumValue) + " " + units;
|
||||||
|
}
|
||||||
}
|
}
|
@ -39,4 +39,15 @@ public class AvailableBookPreference extends ListPreference {
|
|||||||
|
|
||||||
return super.onCreateView(parent);
|
return super.onCreateView(parent);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public CharSequence getSummary() {
|
||||||
|
return getEntry();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onDialogClosed(boolean positiveResult) {
|
||||||
|
super.onDialogClosed(positiveResult);
|
||||||
|
setSummary(getEntry());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,6 +3,8 @@ package org.bspeice.minimalbible.activity.viewer;
|
|||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.support.v7.widget.Toolbar;
|
import android.support.v7.widget.Toolbar;
|
||||||
|
import android.view.Menu;
|
||||||
|
import android.view.MenuItem;
|
||||||
|
|
||||||
import org.bspeice.minimalbible.Injector;
|
import org.bspeice.minimalbible.Injector;
|
||||||
import org.bspeice.minimalbible.MinimalBible;
|
import org.bspeice.minimalbible.MinimalBible;
|
||||||
@ -10,6 +12,7 @@ import org.bspeice.minimalbible.OGHolder;
|
|||||||
import org.bspeice.minimalbible.R;
|
import org.bspeice.minimalbible.R;
|
||||||
import org.bspeice.minimalbible.activity.BaseActivity;
|
import org.bspeice.minimalbible.activity.BaseActivity;
|
||||||
import org.bspeice.minimalbible.activity.downloader.DownloadActivity;
|
import org.bspeice.minimalbible.activity.downloader.DownloadActivity;
|
||||||
|
import org.bspeice.minimalbible.activity.settings.MinimalBibleSettings;
|
||||||
import org.crosswire.jsword.book.Book;
|
import org.crosswire.jsword.book.Book;
|
||||||
|
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
@ -87,4 +90,24 @@ public class BibleViewer extends BaseActivity implements Injector {
|
|||||||
|
|
||||||
bibleContent.setBook(mainBook, prefs);
|
bibleContent.setBook(mainBook, prefs);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onCreateOptionsMenu(Menu menu) {
|
||||||
|
getMenuInflater().inflate(R.menu.viewer, menu);
|
||||||
|
return super.onCreateOptionsMenu(menu);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onOptionsItemSelected(MenuItem item) {
|
||||||
|
int id = item.getItemId();
|
||||||
|
if (id == R.id.action_settings) {
|
||||||
|
Intent i = new Intent(this, MinimalBibleSettings.class);
|
||||||
|
startActivityForResult(i, 0);
|
||||||
|
} else if (id == R.id.action_downloads) {
|
||||||
|
Intent i = new Intent(this, DownloadActivity.class);
|
||||||
|
startActivityForResult(i, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
return super.onOptionsItemSelected(item);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -7,6 +7,7 @@ import org.bspeice.minimalbible.R
|
|||||||
/**
|
/**
|
||||||
* Created by bspeice on 12/1/14.
|
* Created by bspeice on 12/1/14.
|
||||||
*/
|
*/
|
||||||
|
// TODO: Fix the status bar color/transparency, and lack of toolbar
|
||||||
class MinimalBibleSettings() : PreferenceActivity() {
|
class MinimalBibleSettings() : PreferenceActivity() {
|
||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
super<PreferenceActivity>.onCreate(savedInstanceState)
|
super<PreferenceActivity>.onCreate(savedInstanceState)
|
||||||
|
@ -1,17 +0,0 @@
|
|||||||
<menu xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
|
||||||
tools:context="org.bspeice.minimalbible.MainActivity" >
|
|
||||||
|
|
||||||
<item
|
|
||||||
android:id="@+id/action_settings"
|
|
||||||
android:orderInCategory="100"
|
|
||||||
android:title="@string/action_settings"
|
|
||||||
app:showAsAction="never"/>
|
|
||||||
|
|
||||||
<item
|
|
||||||
android:id="@+id/action_downloads"
|
|
||||||
android:orderInCategory="100"
|
|
||||||
android:title="@string/activity_downloader" />
|
|
||||||
|
|
||||||
</menu>
|
|
@ -9,4 +9,7 @@
|
|||||||
|
|
||||||
<color name="navigationBackground">#cccccc</color>
|
<color name="navigationBackground">#cccccc</color>
|
||||||
<color name="textNavigation">#000</color>
|
<color name="textNavigation">#000</color>
|
||||||
|
|
||||||
|
<color name="settingsTextColor">#000</color>
|
||||||
|
<color name="settingsTextColorSecondary">#9e9e9e</color>
|
||||||
</resources>
|
</resources>
|
||||||
|
@ -2,7 +2,12 @@
|
|||||||
|
|
||||||
<!-- Base application theme. -->
|
<!-- Base application theme. -->
|
||||||
<style name="MinimalBibleBase" parent="Theme.AppCompat.Light.NoActionBar">
|
<style name="MinimalBibleBase" parent="Theme.AppCompat.Light.NoActionBar">
|
||||||
|
<!-- Toolbar text color -->
|
||||||
<item name="android:textColorPrimary">@color/textColorPrimary</item>
|
<item name="android:textColorPrimary">@color/textColorPrimary</item>
|
||||||
|
<!-- Overflow dots color -->
|
||||||
|
<item name="android:textColorSecondary">@color/textColorPrimary</item>
|
||||||
|
<!-- Overflow menu text item color -->
|
||||||
|
<item name="android:textColor">@color/textColor</item>
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<!-- Almost re-use style from Widget.Holo.Button.Borderless -->
|
<!-- Almost re-use style from Widget.Holo.Button.Borderless -->
|
||||||
@ -21,9 +26,16 @@
|
|||||||
<item name="android:paddingLeft">8dp</item>
|
<item name="android:paddingLeft">8dp</item>
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
|
<style name="MinimalBibleBase.Settings" parent="MinimalBibleBase">
|
||||||
|
<item name="android:textColor">@color/settingsTextColor</item>
|
||||||
|
<item name="android:textColorSecondary">@color/settingsTextColorSecondary</item>
|
||||||
|
</style>
|
||||||
|
|
||||||
<!-- Actual application style. Allows selective over-riding while inheriting
|
<!-- Actual application style. Allows selective over-riding while inheriting
|
||||||
from the parent -->
|
from the parent -->
|
||||||
<style name="MinimalBible" parent="MinimalBibleBase" />
|
<style name="MinimalBible" parent="MinimalBibleBase" />
|
||||||
|
|
||||||
<style name="MinimalBible.NavigationDrawer" parent="MinimalBibleBase.NavigationDrawer" />
|
<style name="MinimalBible.NavigationDrawer" parent="MinimalBibleBase.NavigationDrawer" />
|
||||||
|
|
||||||
|
<style name="MinimalBible.Settings" parent="MinimalBibleBase.Settings" />
|
||||||
</resources>
|
</resources>
|
||||||
|
@ -4,10 +4,11 @@ but I will likely want to re-implement this in the future -->
|
|||||||
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
|
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:cmwmobile="http://schemas.android.com/apk/res/org.bspeice.minimalbible">
|
xmlns:cmwmobile="http://schemas.android.com/apk/res/org.bspeice.minimalbible">
|
||||||
|
|
||||||
|
<!-- The summary comes from the preference dynamically setting everything -->
|
||||||
|
<!-- TODO: Get the title from strings.xml and update MinimalBibleSettings.kt -->
|
||||||
<com.cmwmobile.android.samples.SeekBarDialogPreference
|
<com.cmwmobile.android.samples.SeekBarDialogPreference
|
||||||
android:defaultValue="14"
|
android:defaultValue="14"
|
||||||
android:key="baseTextSize"
|
android:key="baseTextSize"
|
||||||
android:summary="Font Size"
|
|
||||||
android:title="Font Size"
|
android:title="Font Size"
|
||||||
cmwmobile:maximumValue="28"
|
cmwmobile:maximumValue="28"
|
||||||
cmwmobile:minimumValue="8"
|
cmwmobile:minimumValue="8"
|
||||||
@ -22,7 +23,6 @@ but I will likely want to re-implement this in the future -->
|
|||||||
|
|
||||||
<org.bspeice.minimalbible.activity.settings.AvailableBookPreference
|
<org.bspeice.minimalbible.activity.settings.AvailableBookPreference
|
||||||
android:key="defaultBookInitials"
|
android:key="defaultBookInitials"
|
||||||
android:summary="Which book to display in the main window"
|
|
||||||
android:title="Active Book" />
|
android:title="Active Book" />
|
||||||
|
|
||||||
</PreferenceScreen>
|
</PreferenceScreen>
|
Loading…
Reference in New Issue
Block a user