diff options
author | Scott Jackson <daneren2005@gmail.com> | 2015-11-14 12:05:59 -0800 |
---|---|---|
committer | Scott Jackson <daneren2005@gmail.com> | 2015-11-14 12:05:59 -0800 |
commit | 585e21608e29f98e66a054cc8ddc3be761b1ddaf (patch) | |
tree | 088f3e5f25b8ea43654e5c8c5f5cf06982684571 /app | |
parent | 760e09f2921297bb0579de16d612afd257bf6545 (diff) | |
download | dsub-585e21608e29f98e66a054cc8ddc3be761b1ddaf.tar.gz dsub-585e21608e29f98e66a054cc8ddc3be761b1ddaf.tar.bz2 dsub-585e21608e29f98e66a054cc8ddc3be761b1ddaf.zip |
On tablets show the search fragment as the origin
Diffstat (limited to 'app')
3 files changed, 15 insertions, 6 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 92d9deed..ba7a32b8 100644 --- a/app/src/main/java/github/daneren2005/dsub/activity/SubsonicActivity.java +++ b/app/src/main/java/github/daneren2005/dsub/activity/SubsonicActivity.java @@ -699,7 +699,7 @@ public class SubsonicActivity extends AppCompatActivity implements OnItemSelecte currentFragment.setPrimaryFragment(true); supportInvalidateOptionsMenu(); - if(secondaryContainer == null || oldFragment.isAlwaysFullscreen()) { + if(secondaryContainer == null || oldFragment.isAlwaysFullscreen() || currentFragment.isAlwaysStartFullscreen()) { FragmentTransaction trans = getSupportFragmentManager().beginTransaction(); trans.setCustomAnimations(R.anim.enter_from_right, R.anim.exit_to_left, R.anim.enter_from_left, R.anim.exit_to_right); trans.hide(oldFragment); @@ -755,16 +755,16 @@ public class SubsonicActivity extends AppCompatActivity implements OnItemSelecte if(currentFragment != null) { currentFragment.setPrimaryFragment(false); } - Fragment oldFrag = currentFragment; + SubsonicFragment oldFragment = currentFragment; currentFragment = backStack.remove(backStack.size() - 1); currentFragment.setPrimaryFragment(true, false); supportInvalidateOptionsMenu(); - if(secondaryContainer == null || currentFragment.isAlwaysFullscreen()) { + if(secondaryContainer == null || currentFragment.isAlwaysFullscreen() || oldFragment.isAlwaysStartFullscreen()) { FragmentTransaction trans = getSupportFragmentManager().beginTransaction(); trans.setCustomAnimations(R.anim.enter_from_left, R.anim.exit_to_right, R.anim.enter_from_right, R.anim.exit_to_left); - trans.remove(oldFrag); + trans.remove(oldFragment); trans.show(currentFragment); trans.commit(); } else { @@ -772,10 +772,10 @@ public class SubsonicActivity extends AppCompatActivity implements OnItemSelecte // Remove old right fragment trans.setCustomAnimations(R.anim.enter_from_left, R.anim.exit_to_right, R.anim.enter_from_right, R.anim.exit_to_left); - trans.remove(oldFrag); + trans.remove(oldFragment); // Only switch places if there is a backstack, otherwise primary container is correct - if(backStack.size() > 0 && !backStack.get(backStack.size() - 1).isAlwaysFullscreen()) { + if(backStack.size() > 0 && !backStack.get(backStack.size() - 1).isAlwaysFullscreen() && !currentFragment.isAlwaysStartFullscreen()) { trans.setCustomAnimations(0, 0, 0, 0); // Add current left fragment to right side trans.remove(currentFragment); diff --git a/app/src/main/java/github/daneren2005/dsub/fragments/SearchFragment.java b/app/src/main/java/github/daneren2005/dsub/fragments/SearchFragment.java index 4b34abf2..7072408a 100644 --- a/app/src/main/java/github/daneren2005/dsub/fragments/SearchFragment.java +++ b/app/src/main/java/github/daneren2005/dsub/fragments/SearchFragment.java @@ -51,6 +51,11 @@ public class SearchFragment extends SubsonicFragment implements SectionAdapter.O private boolean skipSearch = false; private String currentQuery; + public SearchFragment() { + super(); + alwaysStartFullscreen = true; + } + @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); 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 aa6245e4..2b95af22 100644 --- a/app/src/main/java/github/daneren2005/dsub/fragments/SubsonicFragment.java +++ b/app/src/main/java/github/daneren2005/dsub/fragments/SubsonicFragment.java @@ -115,6 +115,7 @@ public class SubsonicFragment extends Fragment implements SwipeRefreshLayout.OnR protected boolean secondaryFragment = false; protected boolean isOnlyVisible = true; protected boolean alwaysFullscreen = false; + protected boolean alwaysStartFullscreen = false; protected boolean invalidated = false; protected static Random random = new Random(); protected GestureDetector gestureScanner; @@ -484,6 +485,9 @@ public class SubsonicFragment extends Fragment implements SwipeRefreshLayout.OnR public boolean isAlwaysFullscreen() { return alwaysFullscreen; } + public boolean isAlwaysStartFullscreen() { + return alwaysStartFullscreen; + } public void invalidate() { if(primaryFragment) { |