RestrictedActivity.java revision 4765c5c90802d0abcf2b05c4967e7dd7d2284f9a
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.app.ActionBar; 21import android.app.Activity; 22import android.app.Application; 23import android.app.FragmentManager; 24import android.app.LoaderManager; 25import android.content.ComponentName; 26import android.content.ContentResolver; 27import android.content.Context; 28import android.content.Intent; 29import android.os.Bundle; 30import android.view.ActionMode; 31import android.view.MenuInflater; 32import android.view.MenuItem; 33import android.view.View; 34import android.view.Window; 35 36import com.android.mail.providers.Settings; 37 38/** 39 * {@link RestrictedActivity} gives access to a subset of {@link Activity} methods. These methods 40 * match the signatures from {@link Activity}. 41 */ 42public 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#onSearchRequested() 125 */ 126 public boolean onSearchRequested(String query); 127 128 /** 129 * @see android.app.Activity#setContentView(int) 130 */ 131 void setContentView(int layoutResId); 132 133 /** 134 * @see android.app.Activity#setDefaultKeyMode(int) 135 */ 136 void setDefaultKeyMode(int mode); 137 138 /** 139 * @see android.app.Activity#setResult(int, Intent) 140 */ 141 void setResult(int resultCode, Intent data); 142 143 /** 144 * @see android.app.Activity#setTitle(CharSequence) 145 */ 146 void setTitle(CharSequence title); 147 148 /** 149 * @see android.app.Activity#showDialog(int) 150 */ 151 void showDialog(int id); 152 153 /** 154 * @see android.app.Activity#startActionMode(android.view.ActionMode.Callback) 155 */ 156 ActionMode startActionMode(ActionMode.Callback callback); 157 158 /** 159 * @see android.app.Activity#startActivityForResult(Intent, int) 160 */ 161 void startActivityForResult(Intent intent, int requestCode); 162 163 /** 164 * @see android.app.Activity#startActivityForResult(Intent, int) 165 */ 166 void startActivity(Intent intent); 167 168 /** 169 * @see android.app.Activity#startSearch(String, boolean, Bundle, boolean) 170 */ 171 void startSearch(String initialQuery, boolean selectInitialQuery, 172 Bundle appSearchData, boolean globalSearch); 173 174 /** 175 * @see android.app.Activity#getApplicationContext() 176 */ 177 Context getApplicationContext(); 178 179 /** 180 * Returns the context associated with the activity. This is different from the value returned 181 * by {@link #getApplicationContext()}, which is the single context of the root activity. Some 182 * components (dialogs) require the context of the activity. When implementing this, you can 183 * return this, since each activity is also a context. 184 * @return the context associated with this activity. 185 */ 186 Context getActivityContext(); 187 188 /** 189 * Return the settings currently being used by this activity. 190 * @return 191 */ 192 Settings getSettings(); 193 194 /** 195 * @see Activity#onOptionsItemSelected(MenuItem) 196 */ 197 boolean onOptionsItemSelected(MenuItem item); 198 199 void setPendingToastOperation(ToastBarOperation op); 200 201 ToastBarOperation getPendingToastOperation(); 202} 203