AccountController.java revision 7c401b7896910c00e6234e8774aab0be45740d32
1/* 2 * Copyright (C) 2012 Google Inc. 3 * Licensed to The Android Open Source Project. 4 * 5 * Licensed under the Apache License, Version 2.0 (the "License"); 6 * you may not use this file except in compliance with the License. 7 * You may obtain a copy of the License at 8 * 9 * http://www.apache.org/licenses/LICENSE-2.0 10 * 11 * Unless required by applicable law or agreed to in writing, software 12 * distributed under the License is distributed on an "AS IS" BASIS, 13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 * See the License for the specific language governing permissions and 15 * limitations under the License. 16 */ 17 18package com.android.mail.ui; 19 20import android.database.DataSetObserver; 21 22import com.android.mail.providers.Account; 23import com.android.mail.providers.AccountObserver; 24 25/** 26 * This class consolidates account-specific actions taken by a mail activity. 27 */ 28public interface AccountController { 29 /** 30 * Registers to receive changes to the current account, and obtain the current account. 31 */ 32 void registerAccountObserver(DataSetObserver observer); 33 34 /** 35 * Removes a listener from receiving current account changes. 36 */ 37 void unregisterAccountObserver(DataSetObserver observer); 38 39 /** 40 * Returns the current account in use by the controller. Instead of calling this method, 41 * consider registering for account changes using 42 * {@link AccountObserver#initialize(AccountController)}, which not only provides the current 43 * account, but also updates to the account, in case of settings changes. 44 */ 45 Account getAccount(); 46} 47