1 /* 2 * Copyright (C) 2015 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 package com.android.dialer.filterednumber; 17 18 import android.app.FragmentManager; 19 import android.database.Cursor; 20 import android.content.Context; 21 import android.view.View; 22 23 import com.android.contacts.common.ContactPhotoManager; 24 import com.android.contacts.common.GeoUtil; 25 import com.android.dialer.R; 26 import com.android.dialer.calllog.ContactInfoHelper; 27 28 public class ViewNumbersToImportAdapter extends NumbersAdapter { 29 ViewNumbersToImportAdapter( Context context, FragmentManager fragmentManager, ContactInfoHelper contactInfoHelper, ContactPhotoManager contactPhotoManager)30 private ViewNumbersToImportAdapter( 31 Context context, 32 FragmentManager fragmentManager, 33 ContactInfoHelper contactInfoHelper, 34 ContactPhotoManager contactPhotoManager) { 35 super(context, fragmentManager, contactInfoHelper, contactPhotoManager); 36 } 37 newViewNumbersToImportAdapter( Context context, FragmentManager fragmentManager)38 public static ViewNumbersToImportAdapter newViewNumbersToImportAdapter( 39 Context context, FragmentManager fragmentManager) { 40 return new ViewNumbersToImportAdapter( 41 context, 42 fragmentManager, 43 new ContactInfoHelper(context, GeoUtil.getCurrentCountryIso(context)), 44 ContactPhotoManager.getInstance(context)); 45 } 46 47 @Override bindView(View view, Context context, Cursor cursor)48 public void bindView(View view, Context context, Cursor cursor) { 49 super.bindView(view, context, cursor); 50 51 final String number = cursor.getString( 52 FilteredNumbersUtil.PhoneQuery.NUMBER_COLUMN_INDEX); 53 54 view.findViewById(R.id.delete_button).setVisibility(View.GONE); 55 updateView(view, number, null /* countryIso */); 56 } 57 } 58