刷新workspace中圖標的角標問題

ArrayList<CellLayout> cellLayouts = getWorkspaceAndHotseatCellLayouts();
			for (final CellLayout layoutParent : cellLayouts) {
				final ViewGroup layout = layoutParent.getShortcutsAndWidgets();
				int childCount = layout.getChildCount();
				for (int j = 0; j < childCount; j++) {
					final View view = layout.getChildAt(j);
					Object tag = view.getTag();

				if (tag instanceof ShortcutInfo) {
					final ShortcutInfo info = (ShortcutInfo) tag;
					final Intent intent = info.intent;

					if (intent.getComponent() != null
							&& intent.getComponent().getClassName()
									.equals(Launcher.TOCHAT_ACTIVITYNAME)) {
						((BubbleTextView) view).mAi.isShowChatCount(counter);
						view.invalidate();

					}
				}
				
				//add by csj 13-11-29 刷新文件夾中的聊天數量
				if (view instanceof FolderIcon) {
					FolderIcon folderIcon = (FolderIcon)view;
					Folder folder = folderIcon.getFolder();
					FolderInfo folderInfo = folder.mInfo;
					if (folderInfo.opened) {
						int folderCount = folderInfo.contents.size();
						for (int i = 0; i < folderCount; i++) {
							ShortcutInfo info = (ShortcutInfo) folderInfo.contents.get(i);
							final Intent intent = info.intent;

							if (intent.getComponent() != null
									&& intent.getComponent().getClassName().equals(Launcher.TOCHAT_ACTIVITYNAME)) {
								ArrayList<View> views = folder.getItemsInReadingOrder();
								
									View folderView = views.get(i);
									if (folderView instanceof BubbleTextView) {
										BubbleTextView bubbleTextView = (BubbleTextView)folderView;
										ShortcutInfo info2 = (ShortcutInfo)bubbleTextView.getTag();
										final Intent shourtintent = info2.intent;

										if (intent.getComponent() != null
												&& intent.getComponent().getClassName().equals(Launcher.TOCHAT_ACTIVITYNAME)) {
											bubbleTextView.mAi.isShowChatCount(counter);
											bubbleTextView.invalidate();
										}
									}
									
								
								
							}
						}
					}
					

					
				}
			}
		}


ArrayList<CellLayout> getWorkspaceAndHotseatCellLayouts() {
		ArrayList<CellLayout> layouts = new ArrayList<CellLayout>();
		int screenCount = getChildCount();
		for (int screen = 0; screen < screenCount; screen++) {
			layouts.add(((CellLayout) getChildAt(screen)));
		}
		if (mLauncher.getHotseat() != null) {
			layouts.add(mLauncher.getHotseat().getLayout());
		}
		return layouts;
	}



發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章