aboutsummaryrefslogtreecommitdiff
path: root/app/src/main
diff options
context:
space:
mode:
authorScott Jackson <daneren2005@gmail.com>2015-06-24 18:47:56 -0700
committerScott Jackson <daneren2005@gmail.com>2015-06-24 18:47:56 -0700
commit09ba1ad3a2f9e9ad7fd634b2c34d95016dc8315b (patch)
treee2e4873a779e7309b7bb00531366bce2802cb831 /app/src/main
parent302dd4b2e8ea0514cd489295f403edd4bfba33f1 (diff)
downloaddsub-09ba1ad3a2f9e9ad7fd634b2c34d95016dc8315b.tar.gz
dsub-09ba1ad3a2f9e9ad7fd634b2c34d95016dc8315b.tar.bz2
dsub-09ba1ad3a2f9e9ad7fd634b2c34d95016dc8315b.zip
Move settings initiation to before super so we don't crash setting up drawer header on first run
Diffstat (limited to 'app/src/main')
-rw-r--r--app/src/main/java/github/daneren2005/dsub/activity/SubsonicFragmentActivity.java28
1 files changed, 18 insertions, 10 deletions
diff --git a/app/src/main/java/github/daneren2005/dsub/activity/SubsonicFragmentActivity.java b/app/src/main/java/github/daneren2005/dsub/activity/SubsonicFragmentActivity.java
index 95ec7c15..bdbdd44c 100644
--- a/app/src/main/java/github/daneren2005/dsub/activity/SubsonicFragmentActivity.java
+++ b/app/src/main/java/github/daneren2005/dsub/activity/SubsonicFragmentActivity.java
@@ -105,6 +105,24 @@ public class SubsonicFragmentActivity extends SubsonicActivity {
@Override
public void onCreate(Bundle savedInstanceState) {
+ if(savedInstanceState == null) {
+ String fragmentType = getIntent().getStringExtra(Constants.INTENT_EXTRA_FRAGMENT_TYPE);
+ boolean firstRun = false;
+ if (fragmentType == null) {
+ fragmentType = Util.openToTab(this);
+ if (fragmentType != null) {
+ firstRun = true;
+ }
+ }
+
+ if ("".equals(fragmentType) || fragmentType == null || firstRun) {
+ // Initial startup stuff
+ if (!sessionInitialized) {
+ loadSession();
+ }
+ }
+ }
+
super.onCreate(savedInstanceState);
if (getIntent().hasExtra(Constants.INTENT_EXTRA_NAME_EXIT)) {
stopService(new Intent(this, DownloadService.class));
@@ -119,12 +137,10 @@ public class SubsonicFragmentActivity extends SubsonicActivity {
UserUtil.seedCurrentUser(this);
if (findViewById(R.id.fragment_container) != null && savedInstanceState == null) {
String fragmentType = getIntent().getStringExtra(Constants.INTENT_EXTRA_FRAGMENT_TYPE);
- boolean firstRun = false;
if(fragmentType == null) {
fragmentType = Util.openToTab(this);
if(fragmentType != null) {
getIntent().putExtra(Constants.INTENT_EXTRA_FRAGMENT_TYPE, fragmentType);
- firstRun = true;
switch(fragmentType) {
case "Home":
@@ -159,14 +175,6 @@ public class SubsonicFragmentActivity extends SubsonicActivity {
}
}
currentFragment = getNewFragment(fragmentType);
-
- if("".equals(fragmentType) || fragmentType == null || firstRun) {
- // Initial startup stuff
- if(!sessionInitialized) {
- loadSession();
- }
- }
-
currentFragment.setPrimaryFragment(true);
getSupportFragmentManager().beginTransaction().add(R.id.fragment_container, currentFragment, currentFragment.getSupportTag() + "").commit();