Fields Summary |
---|
public static final String | TOGGLE_RECENTS_INTENT |
public static final String | PRELOAD_INTENT |
public static final String | CANCEL_PRELOAD_INTENT |
public static final String | CLOSE_RECENTS_INTENT |
public static final String | WINDOW_ANIMATION_START_INTENT |
public static final String | PRELOAD_PERMISSION |
public static final String | WAITING_FOR_WINDOW_ANIMATION_PARAM |
private static final String | WAS_SHOWING |
private RecentsPanelView | mRecentsPanel |
private android.content.IntentFilter | mIntentFilter |
private boolean | mShowing |
private boolean | mForeground |
private android.content.BroadcastReceiver | mIntentReceiver |
Methods Summary |
---|
public void | dismissAndGoBack()
if (mRecentsPanel != null) {
final ActivityManager am = (ActivityManager) getSystemService(Context.ACTIVITY_SERVICE);
final List<ActivityManager.RecentTaskInfo> recentTasks =
am.getRecentTasks(2,
ActivityManager.RECENT_WITH_EXCLUDED |
ActivityManager.RECENT_IGNORE_UNAVAILABLE |
ActivityManager.RECENT_INCLUDE_PROFILES);
if (recentTasks.size() > 1 &&
mRecentsPanel.simulateClick(recentTasks.get(1).persistentId)) {
// recents panel will take care of calling show(false) through simulateClick
return;
}
mRecentsPanel.show(false);
}
finish();
|
public void | dismissAndGoHome()
if (mRecentsPanel != null) {
Intent homeIntent = new Intent(Intent.ACTION_MAIN, null);
homeIntent.addCategory(Intent.CATEGORY_HOME);
homeIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK
| Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED);
startActivityAsUser(homeIntent, new UserHandle(UserHandle.USER_CURRENT));
mRecentsPanel.show(false);
}
|
public static boolean | forceOpaqueBackground(android.content.Context context)
return WallpaperManager.getInstance(context).getWallpaperInfo() != null;
|
private void | handleIntent(android.content.Intent intent, boolean checkWaitingForAnimationParam)
super.onNewIntent(intent);
if (TOGGLE_RECENTS_INTENT.equals(intent.getAction())) {
if (mRecentsPanel != null) {
if (mRecentsPanel.isShowing()) {
dismissAndGoBack();
} else {
final RecentTasksLoader recentTasksLoader = RecentTasksLoader.getInstance(this);
boolean waitingForWindowAnimation = checkWaitingForAnimationParam &&
intent.getBooleanExtra(WAITING_FOR_WINDOW_ANIMATION_PARAM, false);
mRecentsPanel.show(true, recentTasksLoader.getLoadedTasks(),
recentTasksLoader.isFirstScreenful(), waitingForWindowAnimation);
}
}
}
|
boolean | isActivityShowing()
return mShowing;
|
boolean | isForeground()
return mForeground;
|
public void | onBackPressed()
dismissAndGoBack();
|
protected void | onCreate(android.os.Bundle savedInstanceState)
getWindow().addPrivateFlags(
WindowManager.LayoutParams.PRIVATE_FLAG_INHERIT_TRANSLUCENT_DECOR);
setContentView(R.layout.status_bar_recent_panel);
mRecentsPanel = (RecentsPanelView) findViewById(R.id.recents_root);
mRecentsPanel.setOnTouchListener(new TouchOutsideListener(mRecentsPanel));
mRecentsPanel.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_STABLE
| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
| View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION);
final RecentTasksLoader recentTasksLoader = RecentTasksLoader.getInstance(this);
recentTasksLoader.setRecentsPanel(mRecentsPanel, mRecentsPanel);
mRecentsPanel.setMinSwipeAlpha(
getResources().getInteger(R.integer.config_recent_item_min_alpha) / 100f);
if (savedInstanceState == null ||
savedInstanceState.getBoolean(WAS_SHOWING)) {
handleIntent(getIntent(), (savedInstanceState == null));
}
mIntentFilter = new IntentFilter();
mIntentFilter.addAction(CLOSE_RECENTS_INTENT);
mIntentFilter.addAction(WINDOW_ANIMATION_START_INTENT);
registerReceiver(mIntentReceiver, mIntentFilter);
super.onCreate(savedInstanceState);
|
protected void | onDestroy()
RecentTasksLoader.getInstance(this).setRecentsPanel(null, mRecentsPanel);
unregisterReceiver(mIntentReceiver);
super.onDestroy();
|
protected void | onNewIntent(android.content.Intent intent)
handleIntent(intent, true);
|
public void | onPause()
overridePendingTransition(
R.anim.recents_return_to_launcher_enter,
R.anim.recents_return_to_launcher_exit);
mForeground = false;
super.onPause();
|
public void | onResume()
mForeground = true;
super.onResume();
|
protected void | onSaveInstanceState(android.os.Bundle outState)
outState.putBoolean(WAS_SHOWING, mRecentsPanel.isShowing());
|
public void | onStart()
// Hide wallpaper if it's not a static image
if (forceOpaqueBackground(this)) {
updateWallpaperVisibility(false);
} else {
updateWallpaperVisibility(true);
}
mShowing = true;
if (mRecentsPanel != null) {
// Call and refresh the recent tasks list in case we didn't preload tasks
// or in case we don't get an onNewIntent
mRecentsPanel.refreshRecentTasksList();
mRecentsPanel.refreshViews();
}
super.onStart();
|
public void | onStop()
mShowing = false;
if (mRecentsPanel != null) {
mRecentsPanel.onUiHidden();
}
super.onStop();
|
private void | updateWallpaperVisibility(boolean visible)
int wpflags = visible ? WindowManager.LayoutParams.FLAG_SHOW_WALLPAPER : 0;
int curflags = getWindow().getAttributes().flags
& WindowManager.LayoutParams.FLAG_SHOW_WALLPAPER;
if (wpflags != curflags) {
getWindow().setFlags(wpflags, WindowManager.LayoutParams.FLAG_SHOW_WALLPAPER);
}
|