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