Skip to content

Commit

Permalink
Moved settings as footer of navigation drawer listview
Browse files Browse the repository at this point in the history
  • Loading branch information
federicoiosue committed May 29, 2014
1 parent d63a5aa commit 8cc8ac5
Show file tree
Hide file tree
Showing 5 changed files with 89 additions and 48 deletions.
47 changes: 47 additions & 0 deletions res/layout/drawer_category_list_footer.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
<!--
Copyright 2014 Federico Iosue ([email protected])
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:pixlui="http://schemas.android.com/apk/com.neopixl.pixlui"
android:layout_width="match_parent"
android:layout_height="45dp"
android:layout_marginTop="7dp"
android:background="@drawable/icon_selector"
android:gravity="center_vertical"
android:orientation="horizontal"
android:paddingBottom="12dp"
android:paddingLeft="20dp"
android:paddingStart="20dp"
android:paddingTop="12dp" >

<ImageView
android:layout_width="24dp"
android:layout_height="24dp"
android:padding="4dp"
android:src="@drawable/ic_settings" />

<com.neopixl.pixlui.components.textview.TextView
android:id="@+id/settings"
android:layout_width="@dimen/navigation_drawer_width"
android:layout_height="match_parent"
android:paddingLeft="@dimen/icon_text_margin"
android:paddingStart="@dimen/icon_text_margin"
android:text="@string/settings"
android:textAllCaps="true"
android:textAppearance="@style/Text.Normal"
android:textColor="@color/actionbar_title_text"
pixlui:typeface="Roboto-Regular.ttf" />

</LinearLayout>
31 changes: 0 additions & 31 deletions res/layout/fragment_navigation_drawer.xml
Original file line number Diff line number Diff line change
Expand Up @@ -32,36 +32,5 @@
android:scrollbarThumbVertical="@drawable/scroll_bar"
android:listSelector="@drawable/icon_selector" />


<LinearLayout
android:layout_width="match_parent"
android:layout_height="45dp"
android:gravity="center_vertical"
android:orientation="horizontal"
android:paddingBottom="12dp"
android:paddingLeft="20dp"
android:paddingStart="20dp"
android:paddingTop="12dp"
android:layout_marginTop="7dp"
android:background="@drawable/icon_selector" >

<ImageView
android:layout_width="24dp"
android:layout_height="24dp"
android:padding="4dp"
android:src="@drawable/ic_settings" />

<com.neopixl.pixlui.components.textview.TextView
android:id="@+id/settings"
android:layout_width="@dimen/navigation_drawer_width"
android:layout_height="match_parent"
android:paddingLeft="@dimen/icon_text_margin"
android:paddingStart="@dimen/icon_text_margin"
android:text="@string/settings"
android:textAllCaps="true"
android:textAppearance="@style/Text.Normal"
android:textColor="@color/actionbar_title_text"
pixlui:typeface="Roboto-Regular.ttf" />
</LinearLayout>

</LinearLayout>
20 changes: 20 additions & 0 deletions res/values-land-v19/dimens.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<!--
Copyright 2014 Federico Iosue ([email protected])
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<resources>

<dimen name="padding_bottom_kitkat">0dp</dimen>

</resources>
2 changes: 1 addition & 1 deletion src/it/feio/android/omninotes/ListFragment.java
Original file line number Diff line number Diff line change
Expand Up @@ -611,7 +611,7 @@ public boolean onQueryTextSubmit(String arg0) {
@Override
public boolean onQueryTextChange(String pattern) {
if (prefs.getBoolean("settings_instant_search", false)) {
getActivity().findViewById(R.id.search_layout).setVisibility(View.GONE);;
getActivity().findViewById(R.id.search_layout).setVisibility(View.GONE);
searchQuery = pattern;
// ((MainActivity)getActivity()).setIntent(((MainActivity)getActivity()).getIntent().setAction(Intent.ACTION_SEARCH));
NoteLoaderTask mNoteLoaderTask = new NoteLoaderTask(mFragment, mFragment);
Expand Down
37 changes: 21 additions & 16 deletions src/it/feio/android/omninotes/NavigationDrawerFragment.java
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public class NavigationDrawerFragment extends Fragment {
TypedArray mNavigationIconsArray;
private ListView mDrawerList;
private ListView mDrawerTagList;
private View tagListHeader;
private View tagListHeader, tagListFooter;
private Category candidateSelectedCategory;
private MainActivity mActivity;
private SharedPreferences prefs;
Expand Down Expand Up @@ -125,17 +125,33 @@ public void onItemClick(AdapterView<?> arg0, View arg1, int position, long arg3)

mDrawerTagList = (ListView) getView().findViewById(R.id.drawer_tag_list);
if (categories.size() > 0) {

// Inflation of header view
LayoutInflater inflater = (LayoutInflater) mActivity.getSystemService(Activity.LAYOUT_INFLATER_SERVICE);
if (tagListHeader == null) {
tagListHeader = inflater.inflate(R.layout.drawer_category_list_header,
(ViewGroup) getView().findViewById(R.id.layout_root));
tagListHeader = inflater.inflate(R.layout.drawer_category_list_header, null);
}
// Adds the "tag" label as header
if (mDrawerTagList.getHeaderViewsCount() == 0) {
mDrawerTagList.addHeaderView(tagListHeader);
mDrawerTagList.setHeaderDividersEnabled(true);
}

// Inflation of footer view
if (tagListFooter == null) {
tagListFooter = inflater.inflate(R.layout.drawer_category_list_footer, null);
}
if (mDrawerTagList.getFooterViewsCount() == 0) {
mDrawerTagList.addFooterView(tagListFooter);
mDrawerTagList.setFooterDividersEnabled(true);
}
tagListFooter.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
Intent settingsIntent = new Intent(getActivity(), SettingsActivity.class);
startActivity(settingsIntent);
}
});

mDrawerTagList.setAdapter(new NavDrawerCategoryAdapter(mActivity, categories, mActivity.navigationTmp));

// Sets click events
Expand Down Expand Up @@ -249,18 +265,7 @@ public void onShowCaseAcknowledged(ShowcaseView showcaseView) {
});
}
}
};

// Settings textview
getActivity().findViewById(R.id.settings).setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
Intent settingsIntent = new Intent(getActivity(), SettingsActivity.class);
startActivity(settingsIntent);
}
});


};

mDrawerToggle.setDrawerIndicatorEnabled(true);
mDrawerLayout.setDrawerListener(mDrawerToggle);
Expand Down

0 comments on commit 8cc8ac5

Please sign in to comment.