Add a BaseActivity for common functionality

Right now it's just setting the translucent statusbar color
This commit is contained in:
DjBushido 2014-04-16 13:29:26 -04:00
parent 9bf99db956
commit bda928098c
6 changed files with 32 additions and 10 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -1,5 +1,6 @@
package org.bspeice.minimalbible; package org.bspeice.minimalbible;
import org.bspeice.minimalbible.activities.BaseActivity;
import org.bspeice.minimalbible.activities.NavigationDrawerFragment; import org.bspeice.minimalbible.activities.NavigationDrawerFragment;
import org.bspeice.minimalbible.activities.downloader.DownloadActivity; import org.bspeice.minimalbible.activities.downloader.DownloadActivity;
@ -21,7 +22,7 @@ import android.widget.TextView;
import com.readystatesoftware.systembartint.SystemBarTintManager; import com.readystatesoftware.systembartint.SystemBarTintManager;
public class BibleViewer extends ActionBarActivity implements public class BibleViewer extends BaseActivity implements
NavigationDrawerFragment.NavigationDrawerCallbacks { NavigationDrawerFragment.NavigationDrawerCallbacks {
/** /**
@ -48,13 +49,6 @@ public class BibleViewer extends ActionBarActivity implements
// Set up the drawer. // Set up the drawer.
mNavigationDrawerFragment.setUp(R.id.navigation_drawer, mNavigationDrawerFragment.setUp(R.id.navigation_drawer,
(DrawerLayout) findViewById(R.id.drawer_layout)); (DrawerLayout) findViewById(R.id.drawer_layout));
// Only set the tint if the device is running KitKat or above
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
SystemBarTintManager tintManager = new SystemBarTintManager(this);
tintManager.setStatusBarTintEnabled(true);
tintManager.setStatusBarTintColor(getResources().getColor(R.color.statusbar));
}
} }
@Override @Override

View File

@ -0,0 +1,28 @@
package org.bspeice.minimalbible.activities;
import org.bspeice.minimalbible.R;
import com.readystatesoftware.systembartint.SystemBarTintManager;
import android.os.Build;
import android.os.Bundle;
import android.support.v7.app.ActionBarActivity;
public class BaseActivity extends ActionBarActivity {
// BaseActivity to take care of some stuff like setting the action bar color
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// Only set the tint if the device is running KitKat or above
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
SystemBarTintManager tintManager = new SystemBarTintManager(this);
tintManager.setStatusBarTintEnabled(true);
tintManager.setStatusBarTintColor(getResources().getColor(
R.color.statusbar));
}
}
}

View File

@ -2,6 +2,7 @@ package org.bspeice.minimalbible.activities.downloader;
import org.bspeice.minimalbible.MinimalBibleConstants; import org.bspeice.minimalbible.MinimalBibleConstants;
import org.bspeice.minimalbible.R; import org.bspeice.minimalbible.R;
import org.bspeice.minimalbible.activities.BaseActivity;
import org.bspeice.minimalbible.activities.NavigationDrawerFragment; import org.bspeice.minimalbible.activities.NavigationDrawerFragment;
import android.app.Activity; import android.app.Activity;
@ -13,7 +14,6 @@ import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager; import android.support.v4.app.FragmentManager;
import android.support.v4.widget.DrawerLayout; import android.support.v4.widget.DrawerLayout;
import android.support.v7.app.ActionBar; import android.support.v7.app.ActionBar;
import android.support.v7.app.ActionBarActivity;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.Menu; import android.view.Menu;
import android.view.MenuItem; import android.view.MenuItem;
@ -22,7 +22,7 @@ import android.view.ViewGroup;
import android.widget.TextView; import android.widget.TextView;
import android.widget.Toast; import android.widget.Toast;
public class DownloadActivity extends ActionBarActivity implements public class DownloadActivity extends BaseActivity implements
NavigationDrawerFragment.NavigationDrawerCallbacks { NavigationDrawerFragment.NavigationDrawerCallbacks {
/** /**