1 /* 2 * Copyright (C) 2012 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package com.android.contacts.list; 18 19 import android.net.Uri; 20 import android.util.Log; 21 22 /** 23 * Version of PhoneNumberPickerFragment used specifically for legacy support. 24 */ 25 public class LegacyPhoneNumberPickerFragment extends PhoneNumberPickerFragment { 26 27 private static final String TAG = "LegacyPhoneNumberPicker"; 28 29 @Override getVisibleScrollbarEnabled()30 protected boolean getVisibleScrollbarEnabled() { 31 return false; 32 } 33 34 @Override getPhoneUri(int position)35 protected Uri getPhoneUri(int position) { 36 final LegacyPhoneNumberListAdapter adapter = (LegacyPhoneNumberListAdapter) getAdapter(); 37 return adapter.getPhoneUri(position); 38 } 39 40 @Override getLookupKey(int position)41 protected String getLookupKey(int position) { 42 // There is no lookup key for the legacy adapter. 43 return null; 44 } 45 46 @Override createListAdapter()47 protected ContactEntryListAdapter createListAdapter() { 48 LegacyPhoneNumberListAdapter adapter = new LegacyPhoneNumberListAdapter(getActivity()); 49 adapter.setDisplayPhotos(true); 50 return adapter; 51 } 52 53 @Override setPhotoPosition(ContactEntryListAdapter adapter)54 protected void setPhotoPosition(ContactEntryListAdapter adapter) { 55 // no-op 56 } 57 58 @Override startPhoneNumberShortcutIntent(Uri uri, boolean isVideoCall)59 protected void startPhoneNumberShortcutIntent(Uri uri, boolean isVideoCall) { 60 throw new UnsupportedOperationException(); 61 } 62 63 @Override setPhotoPosition(ContactListItemView.PhotoPosition photoPosition)64 public void setPhotoPosition(ContactListItemView.PhotoPosition photoPosition) { 65 Log.w(TAG, "setPhotoPosition() is ignored in legacy compatibility mode."); 66 } 67 } 68