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 */
16package com.android.dialer.app.filterednumber;
17
18import android.app.FragmentManager;
19import android.content.Context;
20import android.database.Cursor;
21import android.view.View;
22import com.android.contacts.common.ContactPhotoManager;
23import com.android.dialer.app.R;
24import com.android.dialer.blocking.FilteredNumbersUtil;
25import com.android.dialer.location.GeoUtil;
26import com.android.dialer.phonenumbercache.ContactInfoHelper;
27
28public class ViewNumbersToImportAdapter extends NumbersAdapter {
29
30  private ViewNumbersToImportAdapter(
31      Context context,
32      FragmentManager fragmentManager,
33      ContactInfoHelper contactInfoHelper,
34      ContactPhotoManager contactPhotoManager) {
35    super(context, fragmentManager, contactInfoHelper, contactPhotoManager);
36  }
37
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
48  public void bindView(View view, Context context, Cursor cursor) {
49    super.bindView(view, context, cursor);
50
51    final String number = cursor.getString(FilteredNumbersUtil.PhoneQuery.NUMBER_COLUMN_INDEX);
52
53    view.findViewById(R.id.delete_button).setVisibility(View.GONE);
54    updateView(view, number, null /* countryIso */);
55  }
56}
57