diff options
author | Scott Jackson <daneren2005@gmail.com> | 2013-04-26 20:32:25 -0700 |
---|---|---|
committer | Scott Jackson <daneren2005@gmail.com> | 2013-04-26 20:32:25 -0700 |
commit | f4e44095c6638253997316300c92f70ef23b66e7 (patch) | |
tree | e76c024eee2140193652a364d00732fd8ce71eec /subsonic-android | |
parent | e6fcbc2dcc38e845017e7bf4280e982883fcc5fc (diff) | |
download | dsub-f4e44095c6638253997316300c92f70ef23b66e7.tar.gz dsub-f4e44095c6638253997316300c92f70ef23b66e7.tar.bz2 dsub-f4e44095c6638253997316300c92f70ef23b66e7.zip |
Added method to specify tabs need to be refreshed - used for server change
Diffstat (limited to 'subsonic-android')
3 files changed, 25 insertions, 2 deletions
diff --git a/subsonic-android/src/github/daneren2005/dsub/activity/SubsonicActivity.java b/subsonic-android/src/github/daneren2005/dsub/activity/SubsonicActivity.java index eae6c56a..5e89fbe6 100644 --- a/subsonic-android/src/github/daneren2005/dsub/activity/SubsonicActivity.java +++ b/subsonic-android/src/github/daneren2005/dsub/activity/SubsonicActivity.java @@ -362,6 +362,14 @@ public class SubsonicActivity extends SherlockFragmentActivity { }
}
}
+
+ public void invalidate() {
+ for (int i = 0; i < frags.size(); i++) {
+ List fragStack = (List)frags.get(i);
+ SubsonicTabFragment frag = (SubsonicTabFragment)fragStack.get(fragStack.size() - 1);
+ frag.invalidate();
+ }
+ }
private class TabInfo {
public final Class fragmentClass;
diff --git a/subsonic-android/src/github/daneren2005/dsub/fragments/MainFragment.java b/subsonic-android/src/github/daneren2005/dsub/fragments/MainFragment.java index 0e2b92e6..eb3ee575 100644 --- a/subsonic-android/src/github/daneren2005/dsub/fragments/MainFragment.java +++ b/subsonic-android/src/github/daneren2005/dsub/fragments/MainFragment.java @@ -129,7 +129,7 @@ public class MainFragment extends SubsonicTabFragment { return super.onContextItemSelected(menuItem);
}
- refresh();
+ context.getPagerAdapter().invalidate();
return true;
}
@@ -227,7 +227,7 @@ public class MainFragment extends SubsonicTabFragment { private void toggleOffline() {
Util.setOffline(context, !Util.isOffline(context));
- refresh();
+ context.getPagerAdapter().invalidate();
}
private void showAlbumList(String type) {
diff --git a/subsonic-android/src/github/daneren2005/dsub/fragments/SubsonicTabFragment.java b/subsonic-android/src/github/daneren2005/dsub/fragments/SubsonicTabFragment.java index 19c3fd2c..a1cd9557 100644 --- a/subsonic-android/src/github/daneren2005/dsub/fragments/SubsonicTabFragment.java +++ b/subsonic-android/src/github/daneren2005/dsub/fragments/SubsonicTabFragment.java @@ -18,9 +18,12 @@ */
package github.daneren2005.dsub.fragments;
+import android.util.Log;
+
public class SubsonicTabFragment extends SubsonicFragment {
private static final String TAG = SubsonicTabFragment.class.getSimpleName();
protected boolean primaryFragment = false;
+ protected boolean invalidated = false;
public void replaceFragment(SubsonicTabFragment fragment, int id) {
this.setPrimaryFragment(false);
@@ -34,6 +37,18 @@ public class SubsonicTabFragment extends SubsonicFragment { if(context != null) {
context.setTitle(title);
}
+ if(invalidated) {
+ invalidated = false;
+ refresh();
+ }
+ }
+ }
+
+ public void invalidate() {
+ if(primaryFragment) {
+ refresh();
+ } else {
+ invalidated = true;
}
}
}
|