aboutsummaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorScott Jackson <daneren2005@gmail.com>2015-09-14 17:06:02 -0700
committerScott Jackson <daneren2005@gmail.com>2015-09-14 17:06:02 -0700
commit59dca36ab7a630332bb7ee6afb025f5c0c414541 (patch)
tree938c02a60d03c36dfe6748c83bbb3d3615889b5b /app
parente7062e98e77991a8f32cffcb4f0942b88e370bf0 (diff)
downloaddsub-59dca36ab7a630332bb7ee6afb025f5c0c414541.tar.gz
dsub-59dca36ab7a630332bb7ee6afb025f5c0c414541.tar.bz2
dsub-59dca36ab7a630332bb7ee6afb025f5c0c414541.zip
Auto redirect to user tab when not logged in as an admin
Diffstat (limited to 'app')
-rw-r--r--app/src/main/java/github/daneren2005/dsub/activity/SubsonicActivity.java9
-rw-r--r--app/src/main/java/github/daneren2005/dsub/fragments/AdminFragment.java7
-rw-r--r--app/src/main/java/github/daneren2005/dsub/fragments/SubsonicFragment.java3
3 files changed, 18 insertions, 1 deletions
diff --git a/app/src/main/java/github/daneren2005/dsub/activity/SubsonicActivity.java b/app/src/main/java/github/daneren2005/dsub/activity/SubsonicActivity.java
index f1dd21e9..cd746516 100644
--- a/app/src/main/java/github/daneren2005/dsub/activity/SubsonicActivity.java
+++ b/app/src/main/java/github/daneren2005/dsub/activity/SubsonicActivity.java
@@ -805,6 +805,15 @@ public class SubsonicActivity extends AppCompatActivity implements OnItemSelecte
}
recreateSpinner();
}
+ public void replaceExistingFragment(SubsonicFragment fragment, int tag) {
+ FragmentTransaction trans = getSupportFragmentManager().beginTransaction();
+ trans.remove(currentFragment);
+ trans.add(R.id.fragment_container, fragment, tag + "");
+ trans.commit();
+
+ currentFragment = fragment;
+ currentFragment.setPrimaryFragment(true);
+ }
public void invalidate() {
if(currentFragment != null) {
diff --git a/app/src/main/java/github/daneren2005/dsub/fragments/AdminFragment.java b/app/src/main/java/github/daneren2005/dsub/fragments/AdminFragment.java
index 69164036..d4afa67e 100644
--- a/app/src/main/java/github/daneren2005/dsub/fragments/AdminFragment.java
+++ b/app/src/main/java/github/daneren2005/dsub/fragments/AdminFragment.java
@@ -117,7 +117,12 @@ public class AdminFragment extends SelectRecyclerFragment<User> {
List<User> users = new ArrayList<User>();
User user = musicService.getUser(refresh, UserUtil.getCurrentUsername(context), context, listener);
if(user != null) {
- users.add(user);
+ SubsonicFragment fragment = new UserFragment();
+ Bundle args = new Bundle();
+ args.putSerializable(Constants.INTENT_EXTRA_NAME_ID, user);
+ fragment.setArguments(args);
+
+ replaceExistingFragment(fragment);
}
UserUtil.refreshCurrentUser(context, false);
diff --git a/app/src/main/java/github/daneren2005/dsub/fragments/SubsonicFragment.java b/app/src/main/java/github/daneren2005/dsub/fragments/SubsonicFragment.java
index 6c895edc..c5a2b022 100644
--- a/app/src/main/java/github/daneren2005/dsub/fragments/SubsonicFragment.java
+++ b/app/src/main/java/github/daneren2005/dsub/fragments/SubsonicFragment.java
@@ -399,6 +399,9 @@ public class SubsonicFragment extends Fragment implements SwipeRefreshLayout.OnR
public void replaceFragment(SubsonicFragment fragment, boolean replaceCurrent) {
context.replaceFragment(fragment, fragment.getSupportTag(), secondaryFragment && replaceCurrent);
}
+ public void replaceExistingFragment(SubsonicFragment fragment) {
+ context.replaceExistingFragment(fragment, fragment.getSupportTag());
+ }
public int getRootId() {
return rootView.getId();