143c697854c7e373fbc1dae8b7a5259a32de346b4Amith Yamasani/* 243c697854c7e373fbc1dae8b7a5259a32de346b4Amith Yamasani * Copyright (C) 2008 The Android Open Source Project 343c697854c7e373fbc1dae8b7a5259a32de346b4Amith Yamasani * 443c697854c7e373fbc1dae8b7a5259a32de346b4Amith Yamasani * Licensed under the Apache License, Version 2.0 (the "License"); 543c697854c7e373fbc1dae8b7a5259a32de346b4Amith Yamasani * you may not use this file except in compliance with the License. 643c697854c7e373fbc1dae8b7a5259a32de346b4Amith Yamasani * You may obtain a copy of the License at 743c697854c7e373fbc1dae8b7a5259a32de346b4Amith Yamasani * 843c697854c7e373fbc1dae8b7a5259a32de346b4Amith Yamasani * http://www.apache.org/licenses/LICENSE-2.0 943c697854c7e373fbc1dae8b7a5259a32de346b4Amith Yamasani * 1043c697854c7e373fbc1dae8b7a5259a32de346b4Amith Yamasani * Unless required by applicable law or agreed to in writing, software 1143c697854c7e373fbc1dae8b7a5259a32de346b4Amith Yamasani * distributed under the License is distributed on an "AS IS" BASIS, 1243c697854c7e373fbc1dae8b7a5259a32de346b4Amith Yamasani * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1343c697854c7e373fbc1dae8b7a5259a32de346b4Amith Yamasani * See the License for the specific language governing permissions and 1443c697854c7e373fbc1dae8b7a5259a32de346b4Amith Yamasani * limitations under the License. 1543c697854c7e373fbc1dae8b7a5259a32de346b4Amith Yamasani */ 1643c697854c7e373fbc1dae8b7a5259a32de346b4Amith Yamasani 1743c697854c7e373fbc1dae8b7a5259a32de346b4Amith Yamasanipackage com.android.settings.accounts; 1843c697854c7e373fbc1dae8b7a5259a32de346b4Amith Yamasani 1943c697854c7e373fbc1dae8b7a5259a32de346b4Amith Yamasaniimport com.android.settings.R; 2043c697854c7e373fbc1dae8b7a5259a32de346b4Amith Yamasani 2143c697854c7e373fbc1dae8b7a5259a32de346b4Amith Yamasaniimport android.content.Context; 2243c697854c7e373fbc1dae8b7a5259a32de346b4Amith Yamasaniimport android.graphics.drawable.Drawable; 2343c697854c7e373fbc1dae8b7a5259a32de346b4Amith Yamasaniimport android.preference.Preference; 2443c697854c7e373fbc1dae8b7a5259a32de346b4Amith Yamasaniimport android.view.View; 2543c697854c7e373fbc1dae8b7a5259a32de346b4Amith Yamasaniimport android.widget.ImageView; 2643c697854c7e373fbc1dae8b7a5259a32de346b4Amith Yamasani 2743c697854c7e373fbc1dae8b7a5259a32de346b4Amith Yamasani/** 2843c697854c7e373fbc1dae8b7a5259a32de346b4Amith Yamasani * ProviderPreference is used to display an image to the left of a provider name. 2943c697854c7e373fbc1dae8b7a5259a32de346b4Amith Yamasani * The preference ultimately calls AccountManager.addAccount() for the account type. 3043c697854c7e373fbc1dae8b7a5259a32de346b4Amith Yamasani */ 3143c697854c7e373fbc1dae8b7a5259a32de346b4Amith Yamasanipublic class ProviderPreference extends Preference { 3243c697854c7e373fbc1dae8b7a5259a32de346b4Amith Yamasani private String mAccountType; 3343c697854c7e373fbc1dae8b7a5259a32de346b4Amith Yamasani 3443c697854c7e373fbc1dae8b7a5259a32de346b4Amith Yamasani public ProviderPreference( 3543c697854c7e373fbc1dae8b7a5259a32de346b4Amith Yamasani Context context, String accountType, Drawable icon, CharSequence providerName) { 3643c697854c7e373fbc1dae8b7a5259a32de346b4Amith Yamasani super(context); 3743c697854c7e373fbc1dae8b7a5259a32de346b4Amith Yamasani mAccountType = accountType; 3843c697854c7e373fbc1dae8b7a5259a32de346b4Amith Yamasani setIcon(icon); 3943c697854c7e373fbc1dae8b7a5259a32de346b4Amith Yamasani setPersistent(false); 4043c697854c7e373fbc1dae8b7a5259a32de346b4Amith Yamasani setTitle(providerName); 4143c697854c7e373fbc1dae8b7a5259a32de346b4Amith Yamasani } 4243c697854c7e373fbc1dae8b7a5259a32de346b4Amith Yamasani 4343c697854c7e373fbc1dae8b7a5259a32de346b4Amith Yamasani public String getAccountType() { 4443c697854c7e373fbc1dae8b7a5259a32de346b4Amith Yamasani return mAccountType; 4543c697854c7e373fbc1dae8b7a5259a32de346b4Amith Yamasani } 4643c697854c7e373fbc1dae8b7a5259a32de346b4Amith Yamasani} 47