diff --git a/core/res/layout/list_item_filter.xml b/core/res/layout/list_item_filter.xml index 66f6ae72..d80263a3 100644 --- a/core/res/layout/list_item_filter.xml +++ b/core/res/layout/list_item_filter.xml @@ -2,15 +2,16 @@ + android:paddingRight="@dimen/margin_default" + android:paddingTop="@dimen/margin_half" > \ No newline at end of file diff --git a/core/res/layout/list_item_navigation.xml b/core/res/layout/list_item_navigation.xml index 38868e27..1a66c39c 100644 --- a/core/res/layout/list_item_navigation.xml +++ b/core/res/layout/list_item_navigation.xml @@ -2,8 +2,7 @@ @@ -11,12 +10,17 @@ android:id="@+id/filter_text" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:textIsSelectable="false" /> + android:textColor="@android:color/primary_text_dark" + android:textIsSelectable="false" + android:textSize="17sp" /> - + android:layout_marginTop="-4dip" + android:textColor="@android:color/primary_text_dark" + android:textIsSelectable="false" + android:textSize="13sp" /> + \ No newline at end of file diff --git a/core/res/layout/list_item_separator.xml b/core/res/layout/list_item_separator.xml index 65389da3..c844caa6 100644 --- a/core/res/layout/list_item_separator.xml +++ b/core/res/layout/list_item_separator.xml @@ -1,16 +1,15 @@ - + android:paddingLeft="@dimen/margin_half" + android:paddingRight="@dimen/margin_half" > + android:textIsSelectable="false" /> - \ No newline at end of file + \ No newline at end of file diff --git a/core/res/menu/activity_torrents.xml b/core/res/menu/activity_torrents.xml index b5405114..4256c67d 100644 --- a/core/res/menu/activity_torrents.xml +++ b/core/res/menu/activity_torrents.xml @@ -3,7 +3,7 @@ @@ -14,7 +14,7 @@ ()); + filtersList.setAdapter(navigationListAdapter); filtersList.setOnItemSelectedListener(onFilterListItemSelected); } else { // Add status types directly to the action bar spinner navigationSpinnerAdapter.updateStatusTypes(StatusType.getAllStatusTypes(this)); + // Add an empty labels list (which will be updated later, but the adapter needs to be created now) + navigationSpinnerAdapter.updateLabels(new ArrayList()); } + // Now that all items (or at least their adapters) have been added + getSupportActionBar().setListNavigationCallbacks(navigationSpinnerAdapter, this); currentFilter = StatusType.getShowAllType(this); // Connect to the last used server diff --git a/core/src/org/transdroid/core/gui/lists/SimpleListItemView.java b/core/src/org/transdroid/core/gui/lists/SimpleListItemView.java index 4c8c0e42..884bdbb0 100644 --- a/core/src/org/transdroid/core/gui/lists/SimpleListItemView.java +++ b/core/src/org/transdroid/core/gui/lists/SimpleListItemView.java @@ -4,7 +4,7 @@ import org.androidannotations.annotations.EViewGroup; import org.androidannotations.annotations.ViewById; import android.content.Context; -import android.widget.LinearLayout; +import android.widget.FrameLayout; import android.widget.TextView; /** @@ -12,7 +12,7 @@ import android.widget.TextView; * @author Eric Kok */ @EViewGroup(resName="list_item_filter") -public class SimpleListItemView extends LinearLayout { +public class SimpleListItemView extends FrameLayout { @ViewById protected TextView itemText; diff --git a/core/src/org/transdroid/core/gui/navigation/FilterListAdapter.java b/core/src/org/transdroid/core/gui/navigation/FilterListAdapter.java index 98a365a9..4d74869f 100644 --- a/core/src/org/transdroid/core/gui/navigation/FilterListAdapter.java +++ b/core/src/org/transdroid/core/gui/navigation/FilterListAdapter.java @@ -10,9 +10,6 @@ import org.transdroid.core.gui.lists.SimpleListItemAdapter; import org.transdroid.core.gui.navigation.NavigationSelectionView.NavigationFilterManager; import android.content.Context; -import android.view.View; -import android.view.ViewGroup; -import android.widget.SpinnerAdapter; import com.commonsware.cwac.merge.MergeAdapter; @@ -22,14 +19,14 @@ import com.commonsware.cwac.merge.MergeAdapter; * @author Eric Kok */ @EBean -public class FilterListAdapter extends MergeAdapter implements SpinnerAdapter { +public class FilterListAdapter extends MergeAdapter { @RootContext protected Context context; private SimpleListItemAdapter serverItems = null; private SimpleListItemAdapter statusTypeItems = null; private SimpleListItemAdapter labelItems = null; - private NavigationFilterManager navigationFilterManager; + protected NavigationFilterManager navigationFilterManager; /** * Stores which screen, or manager, handles navigation selection and display @@ -88,17 +85,5 @@ public class FilterListAdapter extends MergeAdapter implements SpinnerAdapter { this.labelItems = null; } } - - @Override - public View getDropDownView(int position, View convertView, ViewGroup parent) { - NavigationSelectionView filterItemView; - if (convertView == null || !(convertView instanceof NavigationSelectionView)) { - filterItemView = NavigationSelectionView_.build(context).setNavigationFilterManager(navigationFilterManager); - } else { - filterItemView = (NavigationSelectionView) convertView; - } - filterItemView.bind(); - return filterItemView; - } } diff --git a/core/src/org/transdroid/core/gui/navigation/FilterListDropDownAdapter.java b/core/src/org/transdroid/core/gui/navigation/FilterListDropDownAdapter.java new file mode 100644 index 00000000..cf6d5f66 --- /dev/null +++ b/core/src/org/transdroid/core/gui/navigation/FilterListDropDownAdapter.java @@ -0,0 +1,35 @@ +package org.transdroid.core.gui.navigation; + +import org.androidannotations.annotations.EBean; + +import android.view.View; +import android.view.ViewGroup; + +/** + * List adapter that holds filter items, that is, servers, view types and labels and is displayed as content to a + * Spinner instead of a ListView. + * @author Eric Kok + */ +@EBean +public class FilterListDropDownAdapter extends FilterListAdapter { + + @Override + public View getView(int position, View convertView, ViewGroup parent) { + // This returns the item shown in the spinner + NavigationSelectionView filterItemView; + if (convertView == null || !(convertView instanceof NavigationSelectionView)) { + filterItemView = NavigationSelectionView_.build(context).setNavigationFilterManager(navigationFilterManager); + } else { + filterItemView = (NavigationSelectionView) convertView; + } + filterItemView.bind(); + return filterItemView; + } + + @Override + public View getDropDownView(int position, View convertView, ViewGroup parent) { + // This returns the item to show in the drop down list + return super.getView(position, convertView, parent); + } + +} diff --git a/core/src/org/transdroid/core/gui/navigation/FilterSeparatorView.java b/core/src/org/transdroid/core/gui/navigation/FilterSeparatorView.java index 3efde9a4..2a831fd2 100644 --- a/core/src/org/transdroid/core/gui/navigation/FilterSeparatorView.java +++ b/core/src/org/transdroid/core/gui/navigation/FilterSeparatorView.java @@ -4,16 +4,16 @@ import org.androidannotations.annotations.EViewGroup; import org.androidannotations.annotations.ViewById; import android.content.Context; -import android.widget.LinearLayout; +import android.widget.AbsListView; +import android.widget.FrameLayout; import android.widget.TextView; /** * A list item that shows a sub header or separator (in underlined Holo style). - * * @author Eric Kok */ @EViewGroup(resName="list_item_separator") -public class FilterSeparatorView extends LinearLayout { +public class FilterSeparatorView extends FrameLayout { protected String text; @@ -31,6 +31,8 @@ public class FilterSeparatorView extends LinearLayout { */ public FilterSeparatorView setText(String text) { separatorText.setText(text); + setLayoutParams(new AbsListView.LayoutParams(AbsListView.LayoutParams.WRAP_CONTENT, + AbsListView.LayoutParams.WRAP_CONTENT)); return this; } diff --git a/full/AndroidManifest.xml b/full/AndroidManifest.xml index 3622d5fc..df27dcf0 100644 --- a/full/AndroidManifest.xml +++ b/full/AndroidManifest.xml @@ -19,8 +19,11 @@ - - + + + + android:label="@string/app_name" + android:theme="@style/TransdroidTheme" + android:uiOptions="splitActionBarWhenNarrow" > @@ -45,13 +48,13 @@ + android:value="org.transdroid.core.gui.SearchActivity_" /> + android:theme="@style/TransdroidTheme" + android:uiOptions="splitActionBarWhenNarrow" > @@ -62,12 +65,12 @@ - +