From 4656ce51bad7e2a7ac538c7dea3c6a29e284b84f Mon Sep 17 00:00:00 2001 From: Scott Jackson Date: Sun, 10 Nov 2013 20:53:25 -0800 Subject: Fixed drawer icons to be themed, added settings to drawer --- .../dsub/activity/SubsonicActivity.java | 24 +++++++++++++++------- .../dsub/fragments/SubsonicFragment.java | 3 --- 2 files changed, 17 insertions(+), 10 deletions(-) (limited to 'src/github/daneren2005') diff --git a/src/github/daneren2005/dsub/activity/SubsonicActivity.java b/src/github/daneren2005/dsub/activity/SubsonicActivity.java index 3c884683..0ac2aa19 100644 --- a/src/github/daneren2005/dsub/activity/SubsonicActivity.java +++ b/src/github/daneren2005/dsub/activity/SubsonicActivity.java @@ -158,12 +158,17 @@ public class SubsonicActivity extends ActionBarActivity implements OnItemSelecte drawerList.setOnItemClickListener(new ListView.OnItemClickListener() { @Override public void onItemClick(AdapterView parent, View view, int position, long id) { - startFragmentActivity(drawerItemsDescriptions[position]); + if("Settings".equals(drawerItemsDescriptions[position])) { + startActivity(new Intent(SubsonicActivity.this, SettingsActivity.class)); + drawer.closeDrawers(); + } else { + startFragmentActivity(drawerItemsDescriptions[position]); - if(lastSelectedView != view) { - lastSelectedView.setBackgroundResource(android.R.color.transparent); - view.setBackgroundResource(R.color.dividerColor); - lastSelectedView = view; + if(lastSelectedView != view) { + lastSelectedView.setBackgroundResource(android.R.color.transparent); + view.setBackgroundResource(R.color.dividerColor); + lastSelectedView = view; + } } } }); @@ -383,10 +388,15 @@ public class SubsonicActivity extends ActionBarActivity implements OnItemSelecte List drawerItemsDescriptionsList = new ArrayList(Arrays.asList(drawerItemsDescriptions)); List drawerItemsIconsList = new ArrayList(); - TypedArray typedArray = getResources().obtainTypedArray(R.array.drawerItemIcons); + int[] arrayAttr = {R.attr.drawerItemsIcons}; + TypedArray arrayType = obtainStyledAttributes(arrayAttr); + int arrayId = arrayType.getResourceId(0, 0); + TypedArray iconType = getResources().obtainTypedArray(arrayId); for(int i = 0; i < drawerItemsList.size(); i++) { - drawerItemsIconsList.add(typedArray.getResourceId(i, 0)); + drawerItemsIconsList.add(iconType.getResourceId(i, 0)); } + iconType.recycle(); + arrayType.recycle(); // Selectively remove podcast listing [3] if(!podcastsEnabled) { diff --git a/src/github/daneren2005/dsub/fragments/SubsonicFragment.java b/src/github/daneren2005/dsub/fragments/SubsonicFragment.java index 18c9476a..5965db0b 100644 --- a/src/github/daneren2005/dsub/fragments/SubsonicFragment.java +++ b/src/github/daneren2005/dsub/fragments/SubsonicFragment.java @@ -144,9 +144,6 @@ public class SubsonicFragment extends Fragment { case R.id.menu_exit: exit(); return true; - case R.id.menu_settings: - startActivity(new Intent(context, SettingsActivity.class)); - return true; } return false; -- cgit v1.2.3