Home | History | Annotate | Download | only in ui
      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 
     18 package com.android.mail.ui;
     19 
     20 import android.app.ActionBar;
     21 import android.app.Activity;
     22 import android.app.Application;
     23 import android.app.FragmentManager;
     24 import android.app.LoaderManager;
     25 import android.content.ComponentName;
     26 import android.content.ContentResolver;
     27 import android.content.Context;
     28 import android.content.Intent;
     29 import android.os.Bundle;
     30 import android.view.ActionMode;
     31 import android.view.MenuInflater;
     32 import android.view.MenuItem;
     33 import android.view.View;
     34 import android.view.Window;
     35 
     36 // Should not rely on any mail-specific packages.
     37 
     38 /**
     39  * {@link RestrictedActivity} gives access to a subset of {@link Activity} methods. These methods
     40  * match the signatures from {@link Activity}.
     41  */
     42 public interface RestrictedActivity {
     43     /*
     44      * All methods are from android.app.Activity, and the doc strings need to point to the
     45      * underlying methods.
     46      */
     47 
     48     /**
     49      * @see android.app.Activity#findViewById(int)
     50      */
     51     View findViewById(int id);
     52 
     53     /**
     54      * @see android.app.Activity#finish()
     55      */
     56     void finish();
     57 
     58     /**
     59      * @see android.app.Activity#getActionBar()
     60      */
     61     ActionBar getActionBar();
     62 
     63     /**
     64      * @see android.app.Activity#getApplication()
     65      */
     66     Application getApplication();
     67 
     68     /**
     69      * @see android.app.Activity#getComponentName()
     70      */
     71     ComponentName getComponentName();
     72 
     73     /**
     74      * @see android.app.Activity#getContentResolver()
     75      */
     76     ContentResolver getContentResolver();
     77 
     78     /**
     79      * @see android.app.Activity#getFragmentManager()
     80      */
     81     FragmentManager getFragmentManager();
     82 
     83     /**
     84      * @see android.app.Activity#getIntent()
     85      */
     86     Intent getIntent();
     87 
     88     /**
     89      * @see android.app.Activity#getLoaderManager()
     90      */
     91     LoaderManager getLoaderManager();
     92 
     93     /**
     94      * @see android.app.Activity#getMenuInflater()
     95      */
     96     MenuInflater getMenuInflater();
     97 
     98     /**
     99      * @see android.app.Activity#getWindow()
    100      */
    101     Window getWindow();
    102 
    103     /**
    104      * @see android.app.Activity#invalidateOptionsMenu()
    105      */
    106     void invalidateOptionsMenu();
    107 
    108     /**
    109      * @see android.app.Activity#isChangingConfigurations()
    110      */
    111     boolean isChangingConfigurations();
    112 
    113     /**
    114      * @see android.app.Activity#isFinishing()
    115      */
    116     boolean isFinishing();
    117 
    118     /**
    119      * @see android.app.Activity#onBackPressed()
    120      */
    121     void onBackPressed();
    122 
    123     /**
    124      * @see android.app.Activity#setContentView(int)
    125      */
    126     void setContentView(int layoutResId);
    127 
    128     /**
    129      * @see android.app.Activity#setDefaultKeyMode(int)
    130      */
    131     void setDefaultKeyMode(int mode);
    132 
    133     /**
    134      * @see android.app.Activity#setResult(int, Intent)
    135      */
    136     void setResult(int resultCode, Intent data);
    137 
    138     /**
    139      * @see android.app.Activity#setTitle(CharSequence)
    140      */
    141     void setTitle(CharSequence title);
    142 
    143     /**
    144      * @see android.app.Activity#showDialog(int)
    145      */
    146     void showDialog(int id);
    147 
    148     /**
    149      * @see android.app.Activity#startActionMode(android.view.ActionMode.Callback)
    150      */
    151     ActionMode startActionMode(ActionMode.Callback callback);
    152 
    153     /**
    154      * @see android.app.Activity#startActivityForResult(Intent, int)
    155      */
    156     void startActivityForResult(Intent intent, int requestCode);
    157 
    158     /**
    159      * @see android.app.Activity#startActivityForResult(Intent, int)
    160      */
    161     void startActivity(Intent intent);
    162 
    163     /**
    164      * @see android.app.Activity#startSearch(String, boolean, Bundle, boolean)
    165      */
    166     void startSearch(String initialQuery, boolean selectInitialQuery,
    167             Bundle appSearchData, boolean globalSearch);
    168 
    169     /**
    170      * @see android.app.Activity#getApplicationContext()
    171      */
    172     Context getApplicationContext();
    173 
    174     /**
    175      * Returns the context associated with the activity. This is different from the value returned
    176      * by {@link #getApplicationContext()}, which is the single context of the root activity. Some
    177      * components (dialogs) require the context of the activity. When implementing this, you can
    178      * return this, since each activity is also a context.
    179      * @return the context associated with this activity.
    180      */
    181     Context getActivityContext();
    182 
    183     /**
    184      * @see Activity#onOptionsItemSelected(MenuItem)
    185      */
    186     boolean onOptionsItemSelected(MenuItem item);
    187 
    188     /**
    189      * @see Activity#hasWindowFocus()
    190      */
    191     public boolean hasWindowFocus();
    192 
    193     void setPendingToastOperation(ToastBarOperation op);
    194 
    195     ToastBarOperation getPendingToastOperation();
    196 }
    197