19af1b36e999036f4045b07285962cfdb7bfbcca7Andrew Lee/* 29af1b36e999036f4045b07285962cfdb7bfbcca7Andrew Lee * Copyright (C) 2015 The Android Open Source Project 39af1b36e999036f4045b07285962cfdb7bfbcca7Andrew Lee * 49af1b36e999036f4045b07285962cfdb7bfbcca7Andrew Lee * Licensed under the Apache License, Version 2.0 (the "License"); 59af1b36e999036f4045b07285962cfdb7bfbcca7Andrew Lee * you may not use this file except in compliance with the License. 69af1b36e999036f4045b07285962cfdb7bfbcca7Andrew Lee * You may obtain a copy of the License at 79af1b36e999036f4045b07285962cfdb7bfbcca7Andrew Lee * 89af1b36e999036f4045b07285962cfdb7bfbcca7Andrew Lee * http://www.apache.org/licenses/LICENSE-2.0 99af1b36e999036f4045b07285962cfdb7bfbcca7Andrew Lee * 109af1b36e999036f4045b07285962cfdb7bfbcca7Andrew Lee * Unless required by applicable law or agreed to in writing, software 119af1b36e999036f4045b07285962cfdb7bfbcca7Andrew Lee * distributed under the License is distributed on an "AS IS" BASIS, 129af1b36e999036f4045b07285962cfdb7bfbcca7Andrew Lee * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 139af1b36e999036f4045b07285962cfdb7bfbcca7Andrew Lee * See the License for the specific language governing permissions and 149af1b36e999036f4045b07285962cfdb7bfbcca7Andrew Lee * limitations under the License. 159af1b36e999036f4045b07285962cfdb7bfbcca7Andrew Lee */ 169af1b36e999036f4045b07285962cfdb7bfbcca7Andrew Leepackage com.android.dialer.filterednumber; 179af1b36e999036f4045b07285962cfdb7bfbcca7Andrew Lee 189af1b36e999036f4045b07285962cfdb7bfbcca7Andrew Leeimport android.app.FragmentManager; 199af1b36e999036f4045b07285962cfdb7bfbcca7Andrew Leeimport android.database.Cursor; 209af1b36e999036f4045b07285962cfdb7bfbcca7Andrew Leeimport android.content.Context; 219af1b36e999036f4045b07285962cfdb7bfbcca7Andrew Leeimport android.view.View; 229af1b36e999036f4045b07285962cfdb7bfbcca7Andrew Lee 239af1b36e999036f4045b07285962cfdb7bfbcca7Andrew Leeimport com.android.contacts.common.ContactPhotoManager; 249af1b36e999036f4045b07285962cfdb7bfbcca7Andrew Leeimport com.android.contacts.common.GeoUtil; 259af1b36e999036f4045b07285962cfdb7bfbcca7Andrew Leeimport com.android.dialer.R; 269af1b36e999036f4045b07285962cfdb7bfbcca7Andrew Leeimport com.android.dialer.calllog.ContactInfoHelper; 279af1b36e999036f4045b07285962cfdb7bfbcca7Andrew Lee 28690e1b5cc87003f939f57f80511e473458d17ac2Andrew Leepublic class ViewNumbersToImportAdapter extends NumbersAdapter { 299af1b36e999036f4045b07285962cfdb7bfbcca7Andrew Lee 309af1b36e999036f4045b07285962cfdb7bfbcca7Andrew Lee private ViewNumbersToImportAdapter( 319af1b36e999036f4045b07285962cfdb7bfbcca7Andrew Lee Context context, 329af1b36e999036f4045b07285962cfdb7bfbcca7Andrew Lee FragmentManager fragmentManager, 339af1b36e999036f4045b07285962cfdb7bfbcca7Andrew Lee ContactInfoHelper contactInfoHelper, 349af1b36e999036f4045b07285962cfdb7bfbcca7Andrew Lee ContactPhotoManager contactPhotoManager) { 359af1b36e999036f4045b07285962cfdb7bfbcca7Andrew Lee super(context, fragmentManager, contactInfoHelper, contactPhotoManager); 369af1b36e999036f4045b07285962cfdb7bfbcca7Andrew Lee } 379af1b36e999036f4045b07285962cfdb7bfbcca7Andrew Lee 389af1b36e999036f4045b07285962cfdb7bfbcca7Andrew Lee public static ViewNumbersToImportAdapter newViewNumbersToImportAdapter( 399af1b36e999036f4045b07285962cfdb7bfbcca7Andrew Lee Context context, FragmentManager fragmentManager) { 409af1b36e999036f4045b07285962cfdb7bfbcca7Andrew Lee return new ViewNumbersToImportAdapter( 419af1b36e999036f4045b07285962cfdb7bfbcca7Andrew Lee context, 429af1b36e999036f4045b07285962cfdb7bfbcca7Andrew Lee fragmentManager, 439af1b36e999036f4045b07285962cfdb7bfbcca7Andrew Lee new ContactInfoHelper(context, GeoUtil.getCurrentCountryIso(context)), 449af1b36e999036f4045b07285962cfdb7bfbcca7Andrew Lee ContactPhotoManager.getInstance(context)); 459af1b36e999036f4045b07285962cfdb7bfbcca7Andrew Lee } 469af1b36e999036f4045b07285962cfdb7bfbcca7Andrew Lee 479af1b36e999036f4045b07285962cfdb7bfbcca7Andrew Lee @Override 489af1b36e999036f4045b07285962cfdb7bfbcca7Andrew Lee public void bindView(View view, Context context, Cursor cursor) { 499af1b36e999036f4045b07285962cfdb7bfbcca7Andrew Lee super.bindView(view, context, cursor); 509af1b36e999036f4045b07285962cfdb7bfbcca7Andrew Lee 519af1b36e999036f4045b07285962cfdb7bfbcca7Andrew Lee final String number = cursor.getString( 529af1b36e999036f4045b07285962cfdb7bfbcca7Andrew Lee FilteredNumbersUtil.PhoneQuery.NUMBER_COLUMN_INDEX); 539af1b36e999036f4045b07285962cfdb7bfbcca7Andrew Lee 549af1b36e999036f4045b07285962cfdb7bfbcca7Andrew Lee view.findViewById(R.id.delete_button).setVisibility(View.GONE); 559af1b36e999036f4045b07285962cfdb7bfbcca7Andrew Lee updateView(view, number, null /* countryIso */); 569af1b36e999036f4045b07285962cfdb7bfbcca7Andrew Lee } 579af1b36e999036f4045b07285962cfdb7bfbcca7Andrew Lee} 58