Commit 42080b32 authored by Geoffrey Métais's avatar Geoffrey Métais
Browse files

Remove settings launcher from ListView #Material

parent df74c1d0
<?xml version="1.0" encoding="utf-8"?>
<merge xmlns:android="http://schemas.android.com/apk/res/android">
<ListView
android:id="@+id/sidelist"
android:layout_height="match_parent"
android:divider="?attr/background_menu_divider"
android:dividerHeight="0.2dp"
android:layout_width="208dp"
android:paddingTop="?attr/actionBarSize"
android:layout_gravity="start"
android:cacheColorHint="#0000"
android:fastScrollEnabled="true"
android:background="?attr/background_menu"
android:nextFocusForward="@id/sidelist"
android:nextFocusUp="@id/sidelist"
android:nextFocusDown="@id/sidelist"
android:nextFocusLeft="@id/sidelist"
android:nextFocusRight="@id/sidelist" >
</ListView>
<RelativeLayout
android:id="@+id/side_menu"
android:layout_width="208dp"
android:layout_height="match_parent"
android:layout_gravity="start"
android:background="?attr/background_menu">
<ListView
android:id="@+id/sidelist"
android:layout_width="208dp"
android:layout_height="match_parent"
android:divider="?attr/background_menu_divider"
android:dividerHeight="0.2dp"
android:paddingTop="?attr/actionBarSize"
android:cacheColorHint="#0000"
android:layout_above="@+id/sidebar_separator"
android:nextFocusForward="@id/sidelist"
android:nextFocusUp="@id/sidelist"
android:nextFocusDown="@id/sidelist"
android:nextFocusLeft="@id/sidelist"
android:nextFocusRight="@id/sidelist" >
</ListView>
<View
android:id="@+id/sidebar_separator"
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_above="@+id/settings"
android:background="?attr/playlist_item_footer" />
<ImageView
android:id="@+id/settings_icon"
android:layout_width="32dp"
android:layout_height="32dp"
android:layout_alignParentLeft="true"
android:layout_alignParentBottom="true"
android:layout_margin="10dp"
android:clickable="true"
android:onClick="onClick"
android:src="@drawable/ic_menu_preferences"/>
<TextView
android:id="@+id/settings"
android:layout_width="match_parent"
android:layout_height="32dp"
android:layout_alignParentBottom="true"
android:layout_toRightOf="@+id/settings_icon"
android:gravity="left|center_vertical"
android:layout_marginTop="10dp"
android:layout_marginBottom="10dp"
android:clickable="true"
android:onClick="onClick"
android:text="@string/preferences"
android:textColor="?attr/list_menu"
android:textSize="16sp"
android:fontFamily="sans-serif"/>
</RelativeLayout>
</merge>
......@@ -110,6 +110,7 @@ public class MainActivity extends ActionBarActivity {
private DrawerLayout mRootContainer;
private ListView mListView;
private ActionBarDrawerToggle mDrawerToggle;
private View mSideMenu;
private View mInfoLayout;
private ProgressBar mInfoProgress;
......@@ -207,6 +208,7 @@ public class MainActivity extends ActionBarActivity {
mSlidingPane = (SlidingPaneLayout) v_main.findViewById(R.id.pane);
mSlidingPane.setPanelSlideListener(mPanelSlideListener);
mSideMenu = v_main.findViewById(R.id.side_menu);
mListView = (ListView)v_main.findViewById(R.id.sidelist);
mListView.setFooterDividersEnabled(true);
mSidebarAdapter = new SidebarAdapter(this);
......@@ -250,7 +252,7 @@ public class MainActivity extends ActionBarActivity {
if(current == null || (entry != null && current.getTag().equals(entry.id))) { /* Already selected */
if (mFocusedPrior != 0)
findViewById(R.id.ml_menu_search).requestFocus();
mRootContainer.closeDrawer(mListView);
mRootContainer.closeDrawer(mSideMenu);
return;
}
......@@ -287,7 +289,7 @@ public class MainActivity extends ActionBarActivity {
if (mFocusedPrior != 0)
findViewById(R.id.ml_menu_search).requestFocus();
mRootContainer.closeDrawer(mListView);
mRootContainer.closeDrawer(mSideMenu);
}else if (entry.attributeID == R.attr.ic_menu_preferences){
startActivityForResult(new Intent(mContext, PreferencesActivity.class), ACTIVITY_RESULT_PREFERENCES);
}
......@@ -311,7 +313,7 @@ public class MainActivity extends ActionBarActivity {
mHandler.postDelayed(new Runnable() {
@Override
public void run() {
mRootContainer.openDrawer(mListView);
mRootContainer.openDrawer(mSideMenu);
}
}, 500);
}
......@@ -448,11 +450,11 @@ public class MainActivity extends ActionBarActivity {
@Override
public void onBackPressed() {
if(mRootContainer.isDrawerOpen(mListView)) {
if(mRootContainer.isDrawerOpen(mSideMenu)) {
/* Close the menu first */
if (mFocusedPrior != 0)
findViewById(R.id.ml_menu_search).requestFocus();
mRootContainer.closeDrawer(mListView);
mRootContainer.closeDrawer(mSideMenu);
return;
}
......@@ -689,7 +691,7 @@ public class MainActivity extends ActionBarActivity {
MediaDatabase.getInstance().clearSearchHistory();
break;
}
mRootContainer.closeDrawer(mListView);
mRootContainer.closeDrawer(mSideMenu);
return super.onOptionsItemSelected(item);
}
......@@ -1023,4 +1025,13 @@ public class MainActivity extends ActionBarActivity {
}
}
}
public void onClick(View v){
switch (v.getId()){
case R.id.settings:
case R.id.settings_icon:
startActivityForResult(new Intent(mContext, PreferencesActivity.class), ACTIVITY_RESULT_PREFERENCES);
break;
}
}
}
......@@ -86,7 +86,7 @@ public class SidebarAdapter extends BaseAdapter {
for(SidebarEntry e : entries) {
sidebarFragments.add(e.id);
}
entries.add(new SidebarEntry(SidebarEntry.ID_PREFERENCES, R.string.preferences, R.attr.ic_menu_preferences, SidebarEntry.TYPE_ACTION));
// entries.add(new SidebarEntry(SidebarEntry.ID_PREFERENCES, R.string.preferences, R.attr.ic_menu_preferences, SidebarEntry.TYPE_ACTION));
}
public SidebarAdapter(Context context) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment