1、staticfinalStringLOG_TAG=RecentApplicationsDialog;4.booleanDBG_FORCE_EMPTY_LISTfalse;5.6.StatusBarManagersStatusBar;7.8.intNUM_BUTTONS8;9.MAX_RECENT_TASKS*2;allowsomediscards10.11.TextViewmIconsnewTextViewNUM_BUTTONS;12.ViewmNoAppsText;13.IntentFiltermBroadcastIntentFilterIntentFilter(Intent.ACTION_
2、CLOSE_SYSTEM_DIALOGS);14.15.RecentTag16.ActivityManager.RecentTaskInfoinfo;17.Intentintent;18.19.20.HandlermHandlerHandler();21.RunnablemCleanupRunnable()22.publicvoidrun()23.dumpextramemorywerehangingonto24.(TextViewicon:mIcons)25.icon.setCompoundDrawables(null,null,null);26.icon.setTag(null);27.28
3、.29.;30.31.RecentApplicationsDialog(Contextcontext)32.super(context,.android.internal.R.style.Theme_Dialog_RecentApplications);33.34.35.36./*37.Wecreatetherecentapplicationsdialogjustonce,anditstaysaround(hidden)38.untilactivatedbyuser.39.40.seePhoneWindowManager#showRecentAppsDialog41.*/42.Override
4、43.protectedonCreate(BundlesavedInstanceState)44.super.onCreate(savedInstanceState);45.46.ContextcontextgetContext();47.48.if(sStatusBar=null)49.sStatusBar(StatusBarManager)context.getSystemService(Context.STATUS_BAR_SERVICE);50.51.52.WindowwindowgetWindow();53.window.requestFeature(Window.FEATURE_N
5、O_TITLE);54.window.setType(WindowManager.LayoutParams.TYPE_SYSTEM_DIALOG);55.window.setFlags(WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM,56.WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM);57.window.setTitle(Recents);58.59.setContentView(.android.internal.R.layout.recent_apps_dialog);60.61.Win
6、dowManager.LayoutParamsparamswindow.getAttributes();62.params.widthWindowManager.LayoutParams.MATCH_PARENT;63.params.height64.window.setAttributes(params);65.window.setFlags(0,WindowManager.LayoutParams.FLAG_DIM_BEHIND);66.67./默认显示8个68.mIcons0(TextView)findViewById(.android.internal.R.id.button0);69
7、.mIcons1(TextView)findViewById(.android.internal.R.id.button1);70.mIcons2(TextView)findViewById(.android.internal.R.id.button2);71.mIcons3(TextView)findViewById(.android.internal.R.id.button3);72.mIcons4(TextView)findViewById(.android.internal.R.id.button4);73.mIcons5(TextView)findViewById(.android.
8、internal.R.id.button5);74.mIcons6(TextView)findViewById(.android.internal.R.id.button6);75.mIcons7(TextView)findViewById(.android.internal.R.id.button7);76.mNoAppsTextfindViewById(.android.internal.R.id.no_applications_message);77.78./关键在哪,你懂得.79.b:80.b.setOnClickListener(this);81.82.83.84.85.onKeyD
9、own(intkeyCode,KeyEventevent)86.(keyCodeKeyEvent.KEYCODE_TAB)87.IgnoreallmetakeysotherthanSHIFT.Theappswitchkeycouldbea88.fallbackactionchordedwithALT,METAorevenCTRLdependingmap.89.DPadnavigationishandledViewRootelsewhere.90.backwardevent.isShiftPressed();91.numIconsmIcons.length;92.numButtons0;93.while(numButtons&mIconsnumButtons.getVisibility()View.VISIBLE)94.+=1;95.96.!0)97.nextFocus?-1:98.(in
copyright@ 2008-2022 冰豆网网站版权所有
经营许可证编号:鄂ICP备2022015515号-1