aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorScott Jackson <daneren2005@gmail.com>2014-10-01 07:48:46 -0700
committerScott Jackson <daneren2005@gmail.com>2014-10-01 07:48:46 -0700
commit9675c980d2478000abe24ce5f4b062448dd88fc7 (patch)
tree00cd4d6eb4aca5ee62dc62f55683661eb7d88628
parent474af4f10f6e9a2e3de48b06430404c8ab4d3a6a (diff)
downloaddsub-9675c980d2478000abe24ce5f4b062448dd88fc7.tar.gz
dsub-9675c980d2478000abe24ce5f4b062448dd88fc7.tar.bz2
dsub-9675c980d2478000abe24ce5f4b062448dd88fc7.zip
Fix title being switch to Dsub briefly on new fragment creation
-rw-r--r--src/github/daneren2005/dsub/activity/SubsonicActivity.java10
-rw-r--r--src/github/daneren2005/dsub/fragments/SubsonicFragment.java4
2 files changed, 10 insertions, 4 deletions
diff --git a/src/github/daneren2005/dsub/activity/SubsonicActivity.java b/src/github/daneren2005/dsub/activity/SubsonicActivity.java
index 2865ef8f..4d60dd77 100644
--- a/src/github/daneren2005/dsub/activity/SubsonicActivity.java
+++ b/src/github/daneren2005/dsub/activity/SubsonicActivity.java
@@ -372,8 +372,10 @@ public class SubsonicActivity extends ActionBarActivity implements OnItemSelecte
@Override
public void setTitle(CharSequence title) {
- getSupportActionBar().setTitle(title);
- recreateSpinner();
+ if(!title.equals(getSupportActionBar().getTitle())) {
+ getSupportActionBar().setTitle(title);
+ recreateSpinner();
+ }
}
public void setSubtitle(CharSequence title) {
getSupportActionBar().setSubtitle(title);
@@ -653,6 +655,10 @@ public class SubsonicActivity extends ActionBarActivity implements OnItemSelecte
}
protected void recreateSpinner() {
+ if(currentFragment.getTitle() == null) {
+ return;
+ }
+
if(backStack.size() > 0) {
spinnerAdapter.clear();
for(int i = 0; i < backStack.size(); i++) {
diff --git a/src/github/daneren2005/dsub/fragments/SubsonicFragment.java b/src/github/daneren2005/dsub/fragments/SubsonicFragment.java
index cf6f78b0..fe1153c0 100644
--- a/src/github/daneren2005/dsub/fragments/SubsonicFragment.java
+++ b/src/github/daneren2005/dsub/fragments/SubsonicFragment.java
@@ -96,7 +96,7 @@ public class SubsonicFragment extends Fragment implements SwipeRefreshLayout.OnR
private int tag;
protected SubsonicActivity context;
- protected CharSequence title = "DSub";
+ protected CharSequence title = null;
protected CharSequence subtitle = null;
protected View rootView;
protected boolean primaryFragment = false;
@@ -420,7 +420,7 @@ public class SubsonicFragment extends Fragment implements SwipeRefreshLayout.OnR
public void setPrimaryFragment(boolean primary) {
primaryFragment = primary;
if(primary) {
- if(context != null) {
+ if(context != null && title != null) {
context.setTitle(title);
context.setSubtitle(subtitle);
}