public void unFocusOtherTab(View stillFocus) { Set<Entry<View, ElementState>> s = elements.entrySet(); for (Entry<View, ElementState> entry : s) { View tab = entry.getKey(); ElementState tabProp = entry.getValue(); if (tab != stillFocus) { ImageButton tabImg = (ImageButton) tab; tabImg.setBackgroundResource(tabProp.getNormalIcon()); tabProp.setFocused(false); } } }
public void onClick(View v) { if (elements.containsKey(v)) { ElementState es = elements.get(v); ImageButton tab = (ImageButton) v; if (!es.isFocused()) { // tab.setBackgroundResource(es.getFocusedIcon()); // es.setFocused(true); // unFocusOtherTab(v); Log.e("tab", tab.getId() + ""); // Right tab get user article if (tab.getId() == R.id.my_teams_tab1) { pabIndex = 1; if (act.getTeamList() == null | act.getTeamList().size() == 0) { act.displayNoGamesDialog(); } else { tab.setBackgroundResource(es.getFocusedIcon()); es.setFocused(true); unFocusOtherTab(v); act.setGameScore(); } } // Left Tab get score else if (tab.getId() == R.id.my_teams_tab2) { pabIndex = 2; tab.setBackgroundResource(es.getFocusedIcon()); es.setFocused(true); unFocusOtherTab(v); act.setArticles(); } } } }