Skip to content

Commit

Permalink
Moved 'category' out of the collapsible filters
Browse files Browse the repository at this point in the history
  • Loading branch information
tonymanou committed Aug 23, 2013
1 parent 6aa0e8d commit fe1a307
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 59 deletions.
104 changes: 49 additions & 55 deletions res/layout/mainlist.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
android:paddingTop="@dimen/activity_vertical_margin"
tools:context=".ActivityMain" >

<!-- Filters -->
<!-- Frame -->

<LinearLayout
android:layout_width="match_parent"
Expand All @@ -21,6 +21,37 @@

<!-- Restriction category -->

<LinearLayout
android:id="@+id/llCategory"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:text="@string/title_category"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textIsSelectable="false" />

<Spinner
android:id="@+id/spRestriction"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1" />

<ImageView
android:id="@+id/imgInfo"
android:layout_width="32dip"
android:layout_height="32dip"
android:layout_gravity="center_vertical"
android:contentDescription="@string/help_application"
android:src="?attr/icon_info" />
</LinearLayout>

<!-- Filters -->

<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content" >
Expand All @@ -33,36 +64,25 @@
android:contentDescription="@string/title_category"
android:src="?attr/icon_expander_maximized" />

<LinearLayout
android:id="@+id/llCategory"
android:layout_width="match_parent"
<EditText
android:id="@+id/etFilter"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="3dp"
android:layout_toRightOf="@id/imgToggleFilters"
android:orientation="horizontal" >

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:text="@string/title_category"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textIsSelectable="false" />

<Spinner
android:id="@+id/spRestriction"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_weight="1" />

<ImageView
android:id="@+id/imgInfo"
android:layout_width="32dip"
android:layout_height="32dip"
android:layout_gravity="center_vertical"
android:contentDescription="@string/help_application"
android:src="?attr/icon_info" />
</LinearLayout>
android:ems="10"
android:hint="@string/help_application"
android:inputType="textNoSuggestions"
android:textAppearance="?android:attr/textAppearanceSmall" />

<ImageView
android:id="@+id/imgClear"
android:layout_width="24dip"
android:layout_height="24dip"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:contentDescription="@string/help_application"
android:src="?attr/icon_clear_grayed" />

<TextView
android:id="@+id/tvFilterDetail"
Expand Down Expand Up @@ -99,32 +119,6 @@
android:contentDescription="@string/help_internet"
android:src="?attr/icon_internet_grayed" />

<RelativeLayout
android:layout_width="0dip"
android:layout_height="wrap_content"
android:layout_weight="1" >

<EditText
android:id="@+id/etFilter"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginLeft="6dip"
android:hint="@string/help_application"
android:inputType="textNoSuggestions"
android:textAppearance="?android:attr/textAppearanceSmall" />

<ImageView
android:id="@+id/imgClear"
android:layout_width="24dip"
android:layout_height="24dip"
android:layout_alignRight="@id/etFilter"
android:layout_centerVertical="true"
android:layout_gravity="center_vertical"
android:contentDescription="@string/help_application"
android:src="?attr/icon_clear_grayed" />
</RelativeLayout>

<CheckBox
android:id="@+id/cbFilter"
android:layout_width="32dp"
Expand Down
10 changes: 6 additions & 4 deletions src/biz/bokhorst/xprivacy/ActivityMain.java
Original file line number Diff line number Diff line change
Expand Up @@ -850,16 +850,18 @@ private void optionHelp() {

private void toggleFiltersVisibility() {
ImageView imgFilterToggle = (ImageView) findViewById(R.id.imgToggleFilters);
ImageView imgClear = (ImageView) findViewById(R.id.imgClear);
TextView tvFilters = (TextView) findViewById(R.id.tvFilterDetail);
LinearLayout llCategory = (LinearLayout) findViewById(R.id.llCategory);
EditText etFilter = (EditText) findViewById(R.id.etFilter);
LinearLayout llFilters = (LinearLayout) findViewById(R.id.llFilters);
CheckBox cbFPermission = (CheckBox) findViewById(R.id.cbFPermission);
CheckBox cbFSystem = (CheckBox) findViewById(R.id.cbFSystem);

if (mFiltersHidden) {
// Change visibility
tvFilters.setVisibility(TextView.GONE);
llCategory.setVisibility(LinearLayout.VISIBLE);
etFilter.setVisibility(EditText.VISIBLE);
imgClear.setVisibility(ImageView.VISIBLE);
llFilters.setVisibility(LinearLayout.VISIBLE);
cbFPermission.setVisibility(CheckBox.VISIBLE);
cbFSystem.setVisibility(CheckBox.VISIBLE);
Expand All @@ -873,7 +875,6 @@ private void toggleFiltersVisibility() {
numberOfFilters++;
if (mInternet)
numberOfFilters++;
EditText etFilter = (EditText) findViewById(R.id.etFilter);
if (etFilter.getText().length() > 0)
numberOfFilters++;
CheckBox cbFilter = (CheckBox) findViewById(R.id.cbFilter);
Expand All @@ -893,7 +894,8 @@ private void toggleFiltersVisibility() {

// Change visibility
tvFilters.setVisibility(TextView.VISIBLE);
llCategory.setVisibility(LinearLayout.GONE);
etFilter.setVisibility(EditText.GONE);
imgClear.setVisibility(ImageView.GONE);
llFilters.setVisibility(LinearLayout.GONE);
cbFPermission.setVisibility(CheckBox.GONE);
cbFSystem.setVisibility(CheckBox.GONE);
Expand Down

0 comments on commit fe1a307

Please sign in to comment.