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