Browse files

Updated UI for filter activity to match the rest of the app

* Tab indicator
 - Added 9-patch files and xml drawable for white tabs with black text
 - Added dimensions to the resources for tab height and padding
 - Used green gradient resource as a backdrop
 - Updated Filter.java to use all of this
* Changed background of the views to white
 - Created new list item with black text
* Changed button layout to match AddTask Activity
 - grey background
Closes #215
  • Loading branch information...
1 parent 54aa6c2 commit e8b15e3c31c122f92bebd545e499baff7974c5da @Krylez Krylez committed with Oct 13, 2011
View
BIN res/drawable-hdpi/tab_selected.9.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN res/drawable-hdpi/tab_selected_focused.9.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN res/drawable-hdpi/tab_selected_pressed.9.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN res/drawable-hdpi/tab_unselected.9.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN res/drawable-hdpi/tab_unselected_focused.9.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN res/drawable-hdpi/tab_unselected_pressed.9.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
27 res/drawable/tab_indicator.xml
@@ -0,0 +1,27 @@
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
+ <!-- selected tabs -->
+ <item android:drawable="@drawable/tab_selected_pressed"
+ android:state_selected="true"
+ android:state_pressed="true" />
+ <item android:drawable="@drawable/tab_selected_focused"
+ android:state_selected="true"
+ android:state_pressed="false"
+ android:state_focused="true" />
+ <item android:drawable="@drawable/tab_selected"
+ android:state_selected="true"
+ android:state_focused="false"
+ android:state_pressed="false" />
+
+ <!-- unselected tabs -->
+ <item android:drawable="@drawable/tab_unselected_pressed"
+ android:state_selected="false"
+ android:state_pressed="true" />
+ <item android:drawable="@drawable/tab_unselected_focused"
+ android:state_selected="false"
+ android:state_pressed="false"
+ android:state_focused="true" />
+ <item android:drawable="@drawable/tab_unselected"
+ android:state_selected="false"
+ android:state_focused="false"
+ android:state_pressed="false" />
+</selector>
View
44 res/layout/filter.xml
@@ -41,7 +41,10 @@ You should have received a copy of the GNU General Public License along with Tod
<LinearLayout android:id="@+id/buttons"
android:orientation="horizontal"
android:layout_alignParentBottom="true"
- android:layout_width="fill_parent" android:layout_height="wrap_content">
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:background="@drawable/actionbar_dark_background"
+ android:padding="3dip">
<Button android:id="@+id/ok"
android:text="@string/ok"
@@ -65,36 +68,51 @@ You should have received a copy of the GNU General Public License along with Tod
<LinearLayout android:id="@+id/priorities"
android:layout_above="@id/buttons"
- android:layout_width="fill_parent" android:layout_height="fill_parent">
+ android:layout_width="fill_parent"
+ android:layout_height="fill_parent"
+ android:background="@color/white">
- <ListView android:id="@+id/prioritieslv" android:layout_width="fill_parent"
- android:layout_height="fill_parent" />
+ <ListView android:id="@+id/prioritieslv"
+ android:layout_width="fill_parent"
+ android:layout_height="fill_parent"
+ android:cacheColorHint="#00000000" />
</LinearLayout>
<LinearLayout android:id="@+id/projects"
android:layout_above="@id/buttons"
- android:layout_width="fill_parent" android:layout_height="fill_parent">
+ android:layout_width="fill_parent"
+ android:layout_height="fill_parent"
+ android:background="@color/white">
- <ListView android:id="@+id/projectslv" android:layout_width="fill_parent"
+ <ListView android:id="@+id/projectslv"
+ android:layout_width="fill_parent"
android:layout_height="fill_parent" />
</LinearLayout>
<LinearLayout android:id="@+id/contexts"
android:layout_above="@id/buttons"
- android:layout_width="fill_parent" android:layout_height="fill_parent">
+ android:layout_width="fill_parent"
+ android:layout_height="fill_parent"
+ android:background="@color/white">
- <ListView android:id="@+id/contextslv" android:layout_width="fill_parent"
- android:layout_height="fill_parent" />
+ <ListView android:id="@+id/contextslv"
+ android:layout_width="fill_parent"
+ android:layout_height="fill_parent"
+ android:cacheColorHint="#00000000" />
</LinearLayout>
<LinearLayout android:id="@+id/search"
- android:layout_width="fill_parent" android:layout_height="wrap_content">
-
- <EditText android:id="@+id/searchet" android:layout_width="fill_parent"
- android:layout_height="fill_parent" />
+ android:layout_above="@id/buttons"
+ android:layout_width="fill_parent"
+ android:layout_height="fill_parent"
+ android:background="@color/white">
+
+ <EditText android:id="@+id/searchet"
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content" />
</LinearLayout>
View
37 res/layout/simple_list_item_multiple_choice.xml
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<!--
+
+Todo.txt Touch/res/layout/simple_list_item_multiple_choice.xml
+
+Copyright (c) 2009-2011 Hrayr Artunyan
+
+LICENSE:
+
+This file is part of Todo.txt Touch, an Android app for managing your todo.txt file (http://todotxt.com).
+
+Todo.txt Touch is free software: you can redistribute it and/or modify it under the terms of the GNU General Public
+License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any
+later version.
+
+Todo.txt Touch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
+warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+details.
+
+You should have received a copy of the GNU General Public License along with Todo.txt Touch. If not, see
+<http://www.gnu.org/licenses/>.
+
+@author Hrayr Artunyan <hrayr[dot]artunyan[at]gmail[dot]com>
+@license http://www.gnu.org/licenses/gpl.html
+@copyright 2009-2011 Hrayr Artunyan
+ -->
+<CheckedTextView xmlns:android="http://schemas.android.com/apk/res/android"
+ android:id="@android:id/text1"
+ android:layout_width="fill_parent"
+ android:layout_height="?android:attr/listPreferredItemHeight"
+ android:textAppearance="?android:attr/textAppearanceLarge"
+ android:textColor="@color/black"
+ android:gravity="center_vertical"
+ android:checkMark="?android:attr/listChoiceIndicatorMultiple"
+ android:paddingLeft="6dip"
+ android:paddingRight="6dip"/>
View
37 res/layout/tab_indicator.xml
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<!--
+
+Todo.txt Touch/res/layout/tab_indicator.xml
+
+Copyright (c) 2009-2011 Hrayr Artunyan
+
+LICENSE:
+
+This file is part of Todo.txt Touch, an Android app for managing your todo.txt file (http://todotxt.com).
+
+Todo.txt Touch is free software: you can redistribute it and/or modify it under the terms of the GNU General Public
+License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any
+later version.
+
+Todo.txt Touch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
+warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+details.
+
+You should have received a copy of the GNU General Public License along with Todo.txt Touch. If not, see
+<http://www.gnu.org/licenses/>.
+
+@author Hrayr Artunyan <hrayr[dot]artunyan[at]gmail[dot]com>
+@license http://www.gnu.org/licenses/gpl.html
+@copyright 2009-2011 Hrayr Artunyan
+ -->
+<TextView xmlns:android="http://schemas.android.com/apk/res/android"
+ android:id="@+id/tab_label"
+ android:layout_width="0dp"
+ android:layout_height="@dimen/tab_height"
+ android:layout_weight="1"
+ android:layout_marginLeft="@dimen/tab_side_padding"
+ android:layout_marginRight="@dimen/tab_side_padding"
+ android:gravity="center"
+ android:background="@drawable/tab_indicator"
+ android:textColor="@color/black" />
View
2 res/values/dimens.xml
@@ -36,4 +36,6 @@ You should have received a copy of the GNU General Public License along with Tod
<dimen name="text_size_small">14sp</dimen>
<dimen name="text_size_medium">18sp</dimen>
<dimen name="text_size_large">22sp</dimen>
+ <dimen name="tab_height">48dp</dimen>
+ <dimen name="tab_side_padding">2dp</dimen>
</resources>
View
42 src/com/todotxt/todotxttouch/Filter.java
@@ -32,45 +32,53 @@
import android.app.Activity;
import android.app.TabActivity;
import android.content.Intent;
+import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
+import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ListView;
import android.widget.TabHost;
+import android.widget.TextView;
public class Filter extends TabActivity {
private final static String TAG = Filter.class.getSimpleName();
private static ArrayList<String> appliedFilters = new ArrayList<String>();
+ private TabHost mTabHost;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
- TabHost tabHost = getTabHost();
+ mTabHost = getTabHost();
+
+ Drawable actionBarBg = getResources().getDrawable(R.drawable.title_background);
+ mTabHost.getTabWidget().setBackgroundDrawable(actionBarBg);
LayoutInflater.from(this).inflate(R.layout.filter,
- tabHost.getTabContentView(), true);
+ mTabHost.getTabContentView(), true);
- tabHost.addTab(tabHost
+ mTabHost.addTab(mTabHost
.newTabSpec(getString(R.string.filter_tab_priorities))
- .setIndicator(getString(R.string.filter_tab_priorities))
+ //.setIndicator(getString(R.string.filter_tab_priorities))
+ .setIndicator(buildIndicator(R.string.filter_tab_priorities))
.setContent(R.id.priorities));
- tabHost.addTab(tabHost
+ mTabHost.addTab(mTabHost
.newTabSpec(getString(R.string.filter_tab_projects))
- .setIndicator(getString(R.string.filter_tab_projects))
+ .setIndicator(buildIndicator(R.string.filter_tab_projects))
.setContent(R.id.projects));
- tabHost.addTab(tabHost
+ mTabHost.addTab(mTabHost
.newTabSpec(getString(R.string.filter_tab_contexts))
- .setIndicator(getString(R.string.filter_tab_contexts))
+ .setIndicator(buildIndicator(R.string.filter_tab_contexts))
.setContent(R.id.contexts));
- tabHost.addTab(tabHost
+ mTabHost.addTab(mTabHost
.newTabSpec(getString(R.string.filter_tab_search))
- .setIndicator(getString(R.string.filter_tab_search))
+ .setIndicator(buildIndicator(R.string.filter_tab_search))
.setContent(R.id.search));
Intent data = getIntent();
@@ -93,19 +101,19 @@ protected void onCreate(Bundle savedInstanceState) {
final ListView priorities = (ListView) findViewById(R.id.prioritieslv);
priorities.setChoiceMode(ListView.CHOICE_MODE_MULTIPLE);
priorities.setAdapter(new ArrayAdapter<String>(this,
- android.R.layout.simple_list_item_multiple_choice, priosArr));
+ R.layout.simple_list_item_multiple_choice, priosArr));
setSelected(priorities, priosArrSelected);
final ListView projects = (ListView) findViewById(R.id.projectslv);
projects.setChoiceMode(ListView.CHOICE_MODE_MULTIPLE);
projects.setAdapter(new ArrayAdapter<String>(this,
- android.R.layout.simple_list_item_multiple_choice, projectsArr));
+ R.layout.simple_list_item_multiple_choice, projectsArr));
setSelected(projects, projectsArrSelected);
final ListView contexts = (ListView) findViewById(R.id.contextslv);
contexts.setChoiceMode(ListView.CHOICE_MODE_MULTIPLE);
contexts.setAdapter(new ArrayAdapter<String>(this,
- android.R.layout.simple_list_item_multiple_choice, contextsArr));
+ R.layout.simple_list_item_multiple_choice, contextsArr));
setSelected(contexts, contextsArrSelected);
final EditText search = (EditText) findViewById(R.id.searchet);
@@ -157,7 +165,13 @@ public void onClick(View v) {
}
});
}
-
+ private View buildIndicator(int textRes) {
+ final TextView indicator = (TextView) this.getLayoutInflater()
+ .inflate(R.layout.tab_indicator,
+ mTabHost.getTabWidget(), false);
+ indicator.setText(textRes);
+ return indicator;
+ }
private static ArrayList<String> getItems(ListView adapter, String type) {
ArrayList<String> arr = new ArrayList<String>();
int size = adapter.getCount();

1 comment on commit e8b15e3

@ginatrapani

Hi @Krylez - this commit introduced a filter UI bug. If your project or context list is long and scrolls off the page, the list turns black when you scroll. I've filed it as issue #241. Any chance you could take a look?

Please sign in to comment.