編輯:關於Android編程
android4.4\frameworks\base\packages\SystemUI\src\com\android\systemui\recent\RecentsActivity.java
此函數是打開最近應用點擊空閒地方跳轉
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));//這裡是跳轉到系統最高Launch 裡面
}
}
//記錄最近應用在這裡面
android4.4\frameworks\base\packages\SystemUI\src\com\android\systemui\recent\RecentTasksLoader.java
protected Void doInBackground(Void... params) {
// We load in two stages: first, we update progress with just the first screenful
// of items. Then, we update with the rest of the items
final int origPri = Process.getThreadPriority(Process.myTid());
Process.setThreadPriority(Process.THREAD_PRIORITY_BACKGROUND);
final PackageManager pm = mContext.getPackageManager();
final ActivityManager am = (ActivityManager)
mContext.getSystemService(Context.ACTIVITY_SERVICE);
final List recentTasks =
am.getRecentTasks(MAX_TASKS, ActivityManager.RECENT_IGNORE_UNAVAILABLE);
int numTasks = recentTasks.size();
ActivityInfo homeInfo = new Intent(Intent.ACTION_MAIN)
.addCategory(Intent.CATEGORY_HOME).resolveActivityInfo(pm, 0);
boolean firstScreenful = true;
ArrayList
// skip the first task - assume it's either the home screen or the current activity.
final int first = 0;
for (int i = first, index = 0; i < numTasks && (index < MAX_TASKS); ++i) {
if (isCancelled()) {
break;
}
final ActivityManager.RecentTaskInfo recentInfo = recentTasks.get(i);
Intent intent = new Intent(recentInfo.baseIntent);
if (recentInfo.origActivity != null) {
intent.setComponent(recentInfo.origActivity);
}
//關鍵代碼
// Don't load the current home activity.
if (isCurrentHomeActivity(intent.getComponent(), homeInfo)) {//這裡是屏蔽了系統最高launch 不記錄在最近應用的棧中
continue;
}
// Don't load ourselves
if (intent.getComponent().getPackageName().equals(mContext.getPackageName())) {
continue;
}
TaskDescription item = createTaskDescription(recentInfo.id,
recentInfo.persistentId, recentInfo.baseIntent,
recentInfo.origActivity, recentInfo.description);
if (item != null) {
while (true) {
try {
tasksWaitingForThumbnails.put(item);
break;
} catch (InterruptedException e) {
}
}
tasks.add(item);
if (firstScreenful && tasks.size() == mNumTasksInFirstScreenful) {
publishProgress(tasks);
tasks = new ArrayList
firstScreenful = false;
//break;
}
++index;
}
}
if (!isCancelled()) {
publishProgress(tasks);
if (firstScreenful) {
// always should publish two updates
publishProgress(new ArrayList
}
}
while (true) {
try {
tasksWaitingForThumbnails.put(new TaskDescription());
break;
} catch (InterruptedException e) {
}
}
Process.setThreadPriority(origPri);
return null;
}
};
mTaskLoader.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
loadThumbnailsAndIconsInBackground(tasksWaitingForThumbnails);
}
三種布局方式android對布局優化提供了三種布局:這三種布局都可以簡化我們的布局文件,優化繪制流程,下面我們簡單看一下這三種組件的使用方式。1、重用布局"ht
實現思路:該View是通過ListView實現的,通過實體兩個字段內容content和時間time來展示每個ListItem時間軸是使用上面一條線(20dp)
導航菜單的制作方式多種多樣,網上也有各種炫酷效果的具體實現方式,那麼今天我主要是想來說說Google在Android5.0之後推出的NavigationView的具體使用
安裝完暢玩,如何在電腦上用暢玩下載安卓游戲,並玩耍呢?今天以騰訊經典手游天天飛車為例,給你大家講下。1.點擊資源庫,進入如下畫面:2.在暢玩安卓模擬器右面的