AccountController.java revision 7c401b7896910c00e6234e8774aab0be45740d32
17c401b7896910c00e6234e8774aab0be45740d32Vikram Aggarwal/* 27c401b7896910c00e6234e8774aab0be45740d32Vikram Aggarwal * Copyright (C) 2012 Google Inc. 37c401b7896910c00e6234e8774aab0be45740d32Vikram Aggarwal * Licensed to The Android Open Source Project. 47c401b7896910c00e6234e8774aab0be45740d32Vikram Aggarwal * 57c401b7896910c00e6234e8774aab0be45740d32Vikram Aggarwal * Licensed under the Apache License, Version 2.0 (the "License"); 67c401b7896910c00e6234e8774aab0be45740d32Vikram Aggarwal * you may not use this file except in compliance with the License. 77c401b7896910c00e6234e8774aab0be45740d32Vikram Aggarwal * You may obtain a copy of the License at 87c401b7896910c00e6234e8774aab0be45740d32Vikram Aggarwal * 97c401b7896910c00e6234e8774aab0be45740d32Vikram Aggarwal * http://www.apache.org/licenses/LICENSE-2.0 107c401b7896910c00e6234e8774aab0be45740d32Vikram Aggarwal * 117c401b7896910c00e6234e8774aab0be45740d32Vikram Aggarwal * Unless required by applicable law or agreed to in writing, software 127c401b7896910c00e6234e8774aab0be45740d32Vikram Aggarwal * distributed under the License is distributed on an "AS IS" BASIS, 137c401b7896910c00e6234e8774aab0be45740d32Vikram Aggarwal * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 147c401b7896910c00e6234e8774aab0be45740d32Vikram Aggarwal * See the License for the specific language governing permissions and 157c401b7896910c00e6234e8774aab0be45740d32Vikram Aggarwal * limitations under the License. 167c401b7896910c00e6234e8774aab0be45740d32Vikram Aggarwal */ 177c401b7896910c00e6234e8774aab0be45740d32Vikram Aggarwal 187c401b7896910c00e6234e8774aab0be45740d32Vikram Aggarwalpackage com.android.mail.ui; 197c401b7896910c00e6234e8774aab0be45740d32Vikram Aggarwal 207c401b7896910c00e6234e8774aab0be45740d32Vikram Aggarwalimport android.database.DataSetObserver; 217c401b7896910c00e6234e8774aab0be45740d32Vikram Aggarwal 227c401b7896910c00e6234e8774aab0be45740d32Vikram Aggarwalimport com.android.mail.providers.Account; 237c401b7896910c00e6234e8774aab0be45740d32Vikram Aggarwalimport com.android.mail.providers.AccountObserver; 247c401b7896910c00e6234e8774aab0be45740d32Vikram Aggarwal 257c401b7896910c00e6234e8774aab0be45740d32Vikram Aggarwal/** 267c401b7896910c00e6234e8774aab0be45740d32Vikram Aggarwal * This class consolidates account-specific actions taken by a mail activity. 277c401b7896910c00e6234e8774aab0be45740d32Vikram Aggarwal */ 287c401b7896910c00e6234e8774aab0be45740d32Vikram Aggarwalpublic interface AccountController { 297c401b7896910c00e6234e8774aab0be45740d32Vikram Aggarwal /** 307c401b7896910c00e6234e8774aab0be45740d32Vikram Aggarwal * Registers to receive changes to the current account, and obtain the current account. 317c401b7896910c00e6234e8774aab0be45740d32Vikram Aggarwal */ 327c401b7896910c00e6234e8774aab0be45740d32Vikram Aggarwal void registerAccountObserver(DataSetObserver observer); 337c401b7896910c00e6234e8774aab0be45740d32Vikram Aggarwal 347c401b7896910c00e6234e8774aab0be45740d32Vikram Aggarwal /** 357c401b7896910c00e6234e8774aab0be45740d32Vikram Aggarwal * Removes a listener from receiving current account changes. 367c401b7896910c00e6234e8774aab0be45740d32Vikram Aggarwal */ 377c401b7896910c00e6234e8774aab0be45740d32Vikram Aggarwal void unregisterAccountObserver(DataSetObserver observer); 387c401b7896910c00e6234e8774aab0be45740d32Vikram Aggarwal 397c401b7896910c00e6234e8774aab0be45740d32Vikram Aggarwal /** 407c401b7896910c00e6234e8774aab0be45740d32Vikram Aggarwal * Returns the current account in use by the controller. Instead of calling this method, 417c401b7896910c00e6234e8774aab0be45740d32Vikram Aggarwal * consider registering for account changes using 427c401b7896910c00e6234e8774aab0be45740d32Vikram Aggarwal * {@link AccountObserver#initialize(AccountController)}, which not only provides the current 437c401b7896910c00e6234e8774aab0be45740d32Vikram Aggarwal * account, but also updates to the account, in case of settings changes. 447c401b7896910c00e6234e8774aab0be45740d32Vikram Aggarwal */ 457c401b7896910c00e6234e8774aab0be45740d32Vikram Aggarwal Account getAccount(); 467c401b7896910c00e6234e8774aab0be45740d32Vikram Aggarwal} 47