【Android源码 栏目提醒】:网学会员Android源码 为您提供[SampleSyncAdapter工程][android源码][authenticator-AuthenticatorActivity java] - 开发文档参考,解决您在[SampleSyncAdapter工程][android源码][authenticator-AuthenticatorActivity java] - 开发文档学习中工作中的难题,参考学习。
/ Copyright C 2010 The Android Open Source Project Licensed under the Apache License Version 2.0 the License you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing software distributed under the License is distributed on an AS IS BASIS WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND either express or implied. See the License for the specific language governing permissions and limitations under the License. / package com.example.android.samplesync.authenticator import android.accounts.Account import android.accounts.AccountAuthenticatorActivity import android.accounts.AccountManager import android.app.Dialog import android.app.ProgressDialog import android.content.ContentResolver import android.content.DialogInterface import android.content.Intent import android.os.Bundle import android.os.Handler import android.provider.ContactsContract import android.text.TextUtils import android.util.Log import android.view.View import android.view.Window import android.widget.EditText import android.widget.TextView import com.example.android.samplesync.Constants import com.example.android.samplesync.R import com.example.android.samplesync.client.NetworkUtilities / Activity which displays login screen to the user. / public class AuthenticatorActivity extends AccountAuthenticatorActivity / The Intent flag to confirm credentials. / public static final String PARAM_CONFIRM_CREDENTIALS confirmCredentials / The Intent extra to store password. / public static final String PARAM_PASSWORD password / The Intent extra to store username. / public static final String PARAM_USERNAME username / The Intent extra to store authtoken type. / public static final String PARAM_AUTHTOKEN_TYPE authtokenType / The tag used to log to adb console. / private static final String TAG AuthenticatorActivity private AccountManager mAccountManager private Thread mAuthThread private String mAuthtoken private String mAuthtokenType / If set we are just checking that the user knows their credentials this doesnt cause the users password to be changed on the device. / private Boolean mConfirmCredentials false / for posting authentication attempts back to UI thread / private final Handler mHandler new Handler private TextView mMessage private String mPassword private EditText mPasswordEdit / Was the original caller asking for an entirely new account / protected boolean mRequestNewAccount false private String mUsername private EditText mUsernameEdit / inheritDoc / Override public void onCreateBundle icicle Log.iTAG onCreate icicle super.onCreateicicle mAccountManager AccountManager.getthis Log.iTAG loading data from Intent final Intent intent getIntent mUsername intent.getStringExtraPARAM_USERNAME mAuthtokenType intent.getStringExtraPARAM_AUTHTOKEN_TYPE mRequestNewAccount mUsername null mConfirmCredentials intent.getBoolean