aboutsummaryrefslogtreecommitdiff
path: root/src/github
diff options
context:
space:
mode:
Diffstat (limited to 'src/github')
-rw-r--r--src/github/daneren2005/dsub/activity/SubsonicActivity.java13
-rw-r--r--src/github/daneren2005/dsub/activity/SubsonicFragmentActivity.java4
-rw-r--r--src/github/daneren2005/dsub/view/DrawerAdapter.java9
3 files changed, 20 insertions, 6 deletions
diff --git a/src/github/daneren2005/dsub/activity/SubsonicActivity.java b/src/github/daneren2005/dsub/activity/SubsonicActivity.java
index d56cb854..58069df7 100644
--- a/src/github/daneren2005/dsub/activity/SubsonicActivity.java
+++ b/src/github/daneren2005/dsub/activity/SubsonicActivity.java
@@ -208,9 +208,6 @@ public class SubsonicActivity extends ActionBarActivity implements OnItemSelecte
}
if(lastSelectedView == null) {
- if(lastSelectedPosition == -1) {
- lastSelectedPosition = drawerList.getChildCount() - 2;
- }
lastSelectedView = drawerList.getChildAt(lastSelectedPosition);
lastSelectedView.setBackgroundResource(R.color.dividerColor);
}
@@ -427,6 +424,16 @@ public class SubsonicActivity extends ActionBarActivity implements OnItemSelecte
enabledItems[1] = bookmarksEnabled;
enabledItems[2] = sharedEnabled;
enabledItems[3] = chatEnabled;
+
+ String fragmentType = getIntent().getStringExtra(Constants.INTENT_EXTRA_FRAGMENT_TYPE);
+ if(fragmentType != null) {
+ for(int i = 0; i < drawerItemsDescriptions.length; i++) {
+ if(fragmentType.equals(drawerItemsDescriptions[i])) {
+ lastSelectedPosition = drawerAdapter.getAdapterPosition(i);
+ break;
+ }
+ }
+ }
}
}
diff --git a/src/github/daneren2005/dsub/activity/SubsonicFragmentActivity.java b/src/github/daneren2005/dsub/activity/SubsonicFragmentActivity.java
index aedd8892..2eed719f 100644
--- a/src/github/daneren2005/dsub/activity/SubsonicFragmentActivity.java
+++ b/src/github/daneren2005/dsub/activity/SubsonicFragmentActivity.java
@@ -103,9 +103,7 @@ public class SubsonicFragmentActivity extends SubsonicActivity {
String fragmentType = getIntent().getStringExtra(Constants.INTENT_EXTRA_FRAGMENT_TYPE);
if(fragmentType == null && Util.isOpenToLibrary(this)) {
fragmentType = "Artist";
- lastSelectedPosition = 1;
- } else if(fragmentType == "Download") {
- lastSelectedPosition = -1;
+ getIntent().putExtra(Constants.INTENT_EXTRA_FRAGMENT_TYPE, fragmentType);
}
currentFragment = getNewFragment(fragmentType);
diff --git a/src/github/daneren2005/dsub/view/DrawerAdapter.java b/src/github/daneren2005/dsub/view/DrawerAdapter.java
index 9832ad05..345ca34c 100644
--- a/src/github/daneren2005/dsub/view/DrawerAdapter.java
+++ b/src/github/daneren2005/dsub/view/DrawerAdapter.java
@@ -90,6 +90,15 @@ public class DrawerAdapter extends ArrayAdapter<String> {
return position;
}
+ public int getAdapterPosition(int position) {
+ for(int i = position; i >= 0; i--) {
+ if(!visible.get(i)) {
+ position--;
+ }
+ }
+
+ return position;
+ }
public void setItemVisible(int position, boolean visible) {
if(this.visible.get(position) != visible) {