Remove "view contacts only with phones" filter from phone
Because we have the phone app now
Change-Id: I3528001a6c57d34773106cf481db3c7c36fd5769
diff --git a/res/layout/contact_list_filter_phones_only.xml b/res/layout/contact_list_filter_phones_only.xml
deleted file mode 100644
index 35965da..0000000
--- a/res/layout/contact_list_filter_phones_only.xml
+++ /dev/null
@@ -1,66 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2009 The Android Open Source Project
-
- 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"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:minHeight="?android:attr/listPreferredItemHeight"
- android:gravity="center_vertical"
- android:paddingRight="?android:attr/scrollbarSize"
->
-
- <RelativeLayout
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_marginLeft="14dip"
- android:layout_marginRight="6dip"
- android:layout_marginTop="6dip"
- android:layout_marginBottom="6dip"
- android:layout_weight="1"
- >
-
- <TextView
- android:id="@android:id/text1"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:singleLine="true"
- android:ellipsize="marquee"
- android:textAppearance="?android:attr/textAppearanceMedium"
- />
-
- <TextView
- android:id="@android:id/text2"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_below="@android:id/text1"
- android:layout_alignLeft="@android:id/text1"
- android:maxLines="2"
- android:textAppearance="?android:attr/textAppearanceSmall"
- />
-
- </RelativeLayout>
-
- <CheckBox
- android:id="@android:id/checkbox"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_marginRight="4dip"
- android:focusable="false"
- android:clickable="false"
- android:gravity="center_vertical"
- android:orientation="vertical" />
-
-</LinearLayout>
diff --git a/res/values/strings.xml b/res/values/strings.xml
index a25b73d..e17648a 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -296,12 +296,6 @@
<!-- The text displayed when the contacts list is empty while displaying only contacts that have phone numbers -->
<string name="noContactsWithPhoneNumbers">No contacts with phone numbers.</string>
- <!-- The title of the filter to only show contacts with phone numbers -->
- <string name="showFilterPhones">Only contacts with phones</string>
-
- <!-- The description of the filter to only show contacts with phone numbers -->
- <string name="showFilterPhonesDescrip">Only display contacts that have phone numbers</string>
-
<!-- The header over the list of all contacts groups -->
<string name="headerContactGroups">Choose contacts to display</string>
diff --git a/src/com/android/contacts/list/CustomContactListFilterActivity.java b/src/com/android/contacts/list/CustomContactListFilterActivity.java
index dae7233..0f6aaad 100644
--- a/src/com/android/contacts/list/CustomContactListFilterActivity.java
+++ b/src/com/android/contacts/list/CustomContactListFilterActivity.java
@@ -23,10 +23,8 @@
import com.android.contacts.model.AccountTypeManager;
import com.android.contacts.model.EntityDelta.ValuesDelta;
import com.android.contacts.model.GoogleAccountType;
-import com.android.contacts.preference.ContactsPreferences;
import com.android.contacts.util.EmptyService;
import com.android.contacts.util.LocalizedNameResolver;
-import com.android.contacts.util.PhoneCapabilityTester;
import com.android.contacts.util.WeakAsyncTask;
import com.google.android.collect.Lists;
@@ -46,7 +44,6 @@
import android.content.Loader;
import android.content.OperationApplicationException;
import android.content.SharedPreferences;
-import android.content.SharedPreferences.Editor;
import android.database.Cursor;
import android.net.Uri;
import android.os.Bundle;
@@ -62,7 +59,6 @@
import android.view.MenuItem.OnMenuItemClickListener;
import android.view.View;
import android.view.ViewGroup;
-import android.widget.AdapterView;
import android.widget.BaseExpandableListAdapter;
import android.widget.CheckBox;
import android.widget.ExpandableListAdapter;
@@ -80,8 +76,7 @@
* select which ones they want to be visible.
*/
public class CustomContactListFilterActivity extends ContactsActivity
- implements AdapterView.OnItemClickListener, View.OnClickListener,
- ExpandableListView.OnChildClickListener,
+ implements View.OnClickListener, ExpandableListView.OnChildClickListener,
LoaderCallbacks<CustomContactListFilterActivity.AccountSet>
{
private static final String TAG = "CustomContactListFilterActivity";
@@ -93,11 +88,6 @@
private SharedPreferences mPrefs;
- private CheckBox mDisplayPhones;
-
- private View mHeaderPhones;
- private View mHeaderSeparator;
-
@Override
protected void onCreate(Bundle icicle) {
super.onCreate(icicle);
@@ -111,50 +101,14 @@
final LayoutInflater inflater = getLayoutInflater();
- createWithPhonesOnlyPreferenceView(inflater);
- createDisplayGroupHeader(inflater);
-
- if (mHeaderPhones != null) {
- mList.addHeaderView(mHeaderPhones, null, true);
- mList.addHeaderView(mHeaderSeparator, null, false);
- }
-
findViewById(R.id.btn_done).setOnClickListener(this);
findViewById(R.id.btn_discard).setOnClickListener(this);
- // Catch clicks on the header views
- mList.setOnItemClickListener(this);
mList.setOnCreateContextMenuListener(this);
mList.setAdapter(mAdapter);
}
- private void createWithPhonesOnlyPreferenceView(LayoutInflater inflater) {
- boolean optionSelected = mPrefs.getBoolean(ContactsPreferences.PREF_DISPLAY_ONLY_PHONES,
- ContactsPreferences.PREF_DISPLAY_ONLY_PHONES_DEFAULT);
-
- if (!optionSelected && !PhoneCapabilityTester.isPhone(this)) {
- return;
- }
-
- // Add the "Only contacts with phones" header modifier.
- mHeaderPhones = inflater.inflate(R.layout.contact_list_filter_phones_only, mList, false);
- mHeaderPhones.setId(R.id.header_phones);
- mDisplayPhones = (CheckBox) mHeaderPhones.findViewById(android.R.id.checkbox);
- mDisplayPhones.setChecked(optionSelected);
- final TextView text1 = (TextView) mHeaderPhones.findViewById(android.R.id.text1);
- text1.setText(R.string.showFilterPhones);
- final TextView text2 = (TextView) mHeaderPhones.findViewById(android.R.id.text2);
- text2.setText(R.string.showFilterPhonesDescrip);
- }
-
- private void createDisplayGroupHeader(LayoutInflater inflater) {
- // Add the separator before showing the detailed group list.
- mHeaderSeparator = inflater.inflate(R.layout.list_separator, mList, false);
- final TextView text1 = (TextView) mHeaderSeparator;
- text1.setText(R.string.headerContactGroups);
- }
-
public static class CustomFilterConfigurationLoader extends AsyncTaskLoader<AccountSet> {
private AccountSet mAccountSet;
@@ -696,18 +650,6 @@
}
}
- /**
- * Handle any clicks on header views added to our {@link #mAdapter}, which
- * are usually the global modifier checkboxes.
- */
- public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
- Log.d(TAG, "OnItemClick, position=" + position + ", id=" + id);
- if (view == mHeaderPhones) {
- mDisplayPhones.toggle();
- return;
- }
- }
-
/** {@inheritDoc} */
public void onClick(View view) {
switch (view.getId()) {
@@ -723,21 +665,6 @@
}
/**
- * Assign a specific value to {@link ContactsPreferences#PREF_DISPLAY_ONLY_PHONES}, refreshing
- * the visible list as needed.
- */
- protected void setDisplayOnlyPhones(boolean displayOnlyPhones) {
- mDisplayPhones.setChecked(displayOnlyPhones);
-
- Editor editor = mPrefs.edit();
- editor.putBoolean(ContactsPreferences.PREF_DISPLAY_ONLY_PHONES, displayOnlyPhones);
- editor.apply();
-
- mAdapter.setChildDescripWithPhones(displayOnlyPhones);
- mAdapter.notifyDataSetChanged();
- }
-
- /**
* Handle any clicks on {@link ExpandableListAdapter} children, which
* usually mean toggling its visible state.
*/
@@ -880,10 +807,6 @@
return;
}
- if (mDisplayPhones != null) {
- setDisplayOnlyPhones(mDisplayPhones.isChecked());
- }
-
setResult(RESULT_OK);
final ArrayList<ContentProviderOperation> diff = mAdapter.mAccounts.buildDiff();