mirror of
https://github.com/MinimalBible/MinimalBible
synced 2024-11-22 07:58:20 -05:00
Lots of styling cleanup
Download activity last thing before another release
This commit is contained in:
parent
f466f9b017
commit
f889b61b9c
@ -4,6 +4,7 @@ import android.app.Activity;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.support.v7.app.ActionBarActivity;
|
||||
import android.support.v7.widget.Toolbar;
|
||||
import android.view.View;
|
||||
|
||||
import com.readystatesoftware.systembartint.SystemBarTintManager;
|
||||
@ -29,9 +30,26 @@ public class BaseActivity extends ActionBarActivity {
|
||||
}
|
||||
|
||||
public static void setupInsets(Activity context, View view) {
|
||||
if (Build.VERSION.SDK_INT > Build.VERSION_CODES.KITKAT) {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
|
||||
SystemBarTintManager.SystemBarConfig config = getConfig(context);
|
||||
view.setPadding(0, config.getPixelInsetTop(false), config.getPixelInsetRight(), config.getPixelInsetBottom());
|
||||
view.setPadding(0, config.getPixelInsetTop(false),
|
||||
config.getPixelInsetRight(), config.getPixelInsetBottom());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Calculate the offset needed for a Toolbar
|
||||
* The reason we need a separate method is because we don't want
|
||||
* the SystemBarTintManager calculating an offset for the navigation bar
|
||||
*
|
||||
* @param context
|
||||
* @param view
|
||||
*/
|
||||
public static void setupToolbar(Activity context, Toolbar view) {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
|
||||
SystemBarTintManager.SystemBarConfig config = getConfig(context);
|
||||
view.setPadding(0, config.getPixelInsetTop(false),
|
||||
config.getPixelInsetRight(), 0);
|
||||
}
|
||||
}
|
||||
|
||||
@ -39,17 +57,6 @@ public class BaseActivity extends ActionBarActivity {
|
||||
return new SystemBarTintManager(context).getConfig();
|
||||
}
|
||||
|
||||
/**
|
||||
* Calculate the offset we need to display properly if the System bar is translucent
|
||||
*
|
||||
* @param context The {@link android.app.Activity} we are displaying in
|
||||
* @param view The {@link android.view.View} we need to calculate the offset for.
|
||||
*/
|
||||
@SuppressWarnings("unused")
|
||||
protected static void setInsets(Activity context, View view) {
|
||||
setupInsets(context, view);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
protected static void setInsetsSpinner(Activity context, View view) {
|
||||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT) return;
|
||||
@ -60,6 +67,20 @@ public class BaseActivity extends ActionBarActivity {
|
||||
marginTopBottom);
|
||||
}
|
||||
|
||||
/**
|
||||
* Calculate the offset we need to display properly if the System bar is translucent
|
||||
*
|
||||
* @param view The {@link android.view.View} we need to calculate the offset for.
|
||||
*/
|
||||
@SuppressWarnings("unused")
|
||||
protected void setInsets(View view) {
|
||||
setupInsets(this, view);
|
||||
}
|
||||
|
||||
protected void setInsetToolbar(Toolbar toolbar) {
|
||||
setupToolbar(this, toolbar);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
@ -2,6 +2,7 @@ package org.bspeice.minimalbible.activity.viewer;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.support.v4.widget.DrawerLayout;
|
||||
import android.support.v7.widget.Toolbar;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
@ -40,6 +41,9 @@ public class BibleViewer extends BaseActivity implements Injector {
|
||||
@InjectView(R.id.toolbar)
|
||||
Toolbar toolbar;
|
||||
|
||||
@InjectView(R.id.drawer_layout)
|
||||
DrawerLayout drawerLayout;
|
||||
|
||||
private ObjectGraph bvObjectGraph;
|
||||
|
||||
/**
|
||||
@ -85,9 +89,8 @@ public class BibleViewer extends BaseActivity implements Injector {
|
||||
ButterKnife.inject(this);
|
||||
|
||||
setSupportActionBar(toolbar);
|
||||
setInsetToolbar(toolbar);
|
||||
bibleMenu.setBible(mainBook);
|
||||
setInsets(this, bibleMenu);
|
||||
|
||||
bibleContent.setBook(mainBook, prefs);
|
||||
}
|
||||
|
||||
|
@ -5,6 +5,7 @@ import android.os.Bundle
|
||||
import org.bspeice.minimalbible.R
|
||||
import android.support.v7.widget.Toolbar
|
||||
import org.bspeice.minimalbible.activity.BaseActivity
|
||||
import android.widget.LinearLayout
|
||||
|
||||
/**
|
||||
* Created by bspeice on 12/1/14.
|
||||
@ -20,5 +21,8 @@ class MinimalBibleSettings() : PreferenceActivity() {
|
||||
|
||||
val toolbar = findViewById(R.id.toolbar) as Toolbar
|
||||
toolbar.setTitle(R.string.action_settings)
|
||||
|
||||
val root = findViewById(R.id.container) as LinearLayout
|
||||
BaseActivity.setupInsets(this, root)
|
||||
}
|
||||
}
|
@ -6,12 +6,13 @@
|
||||
android:layout_height="match_parent"
|
||||
tools:context="org.bspeice.minimalbible.activities.viewer.BibleViewer">
|
||||
|
||||
<!-- Main content -->
|
||||
<!-- Main content
|
||||
fitsSystemWindows not set so that the Bible view can flow
|
||||
over the navigation drawer -->
|
||||
<LinearLayout
|
||||
android:id="@+id/container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:fitsSystemWindows="true"
|
||||
android:orientation="vertical">
|
||||
|
||||
<android.support.v7.widget.Toolbar
|
||||
|
@ -1,9 +1,9 @@
|
||||
<?xml version="1.0" encoding="utf-8"?><!-- layout_marginTop is for the transparent status bar offset.
|
||||
Normally you'd use the SystemBarTintManager but I was having issues with it. -->
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginTop="24dp"
|
||||
android:orientation="vertical">
|
||||
|
||||
<!-- Use style="MinimalBible" because we over-ride the settings in AndroidManifest.xml -->
|
||||
|
@ -17,7 +17,8 @@
|
||||
android:paddingLeft="16dp"
|
||||
android:paddingRight="16dp"
|
||||
android:text="@string/app_name"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Title" />
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Title"
|
||||
android:textColor="?android:textColorPrimary" />
|
||||
|
||||
<ExpandableListView
|
||||
android:id="@+id/menu"
|
||||
|
@ -21,13 +21,14 @@
|
||||
-->
|
||||
</style>
|
||||
|
||||
<style name="MinimalBibleBase.NavigationDrawer">
|
||||
<item name="android:background">@color/navigationBackground</item>
|
||||
<item name="android:paddingLeft">8dp</item>
|
||||
<style name="MinimalBibleBase.NavigationDrawer" parent="MinimalBibleBase">
|
||||
<item name="android:background">@color/navigationBackground</item>
|
||||
</style>
|
||||
|
||||
<!-- Inherits from MinimalBible as a parent so that
|
||||
translucent statusbar is automatically applied -->
|
||||
<style name="MinimalBibleBase.Settings" parent="MinimalBible">
|
||||
<item name="android:textColor">@color/settingsTextColor</item>
|
||||
<item name="android:textColor">@color/settingsTextColor</item>
|
||||
<item name="android:textColorSecondary">@color/settingsTextColorSecondary</item>
|
||||
</style>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user