aboutsummaryrefslogtreecommitdiff
path: root/src/github
diff options
context:
space:
mode:
authorScott Jackson <daneren2005@gmail.com>2014-04-09 22:39:41 -0700
committerScott Jackson <daneren2005@gmail.com>2014-04-09 22:39:41 -0700
commit7c4ea93d29cf6f41e2aeec375314339e383bb605 (patch)
tree3d25967f2c451d6f1055f48cac1e0cd66b125088 /src/github
parentfb1eac0064ab7057254ed9db40d21754864fbba2 (diff)
downloaddsub-7c4ea93d29cf6f41e2aeec375314339e383bb605.tar.gz
dsub-7c4ea93d29cf6f41e2aeec375314339e383bb605.tar.bz2
dsub-7c4ea93d29cf6f41e2aeec375314339e383bb605.zip
Fix some issues with wrong drawer item as picked
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) {