List of usage examples for android.view Window equals
public boolean equals(Object obj)
From source file:net.bible.android.control.page.window.WindowControl.java
public boolean isActiveWindow(Window window) { return window.equals(windowRepository.getActiveWindow()); }
From source file:net.bible.android.control.page.window.WindowControl.java
/** * Add the Window sub-menu resource which is not included in the main.xml for the main menu * Set the synchronised checkbox in the app menu before displayed * Disable various menu items if links window selected *///from w w w. j av a2 s . co m public void updateOptionsMenu(Menu menu) { // when updating main menu rather than Window options menu MenuItem windowSubmenuItemPosition = menu.findItem(R.id.windowSubMenu); if (windowSubmenuItemPosition != null) { // check the Window sub-menu has been added Menu subMenuToPopulate = windowSubmenuItemPosition.getSubMenu(); if (subMenuToPopulate.findItem(R.id.windowNew) == null) { new MenuInflater(BibleApplication.getApplication()).inflate(R.menu.window_popup_menu, subMenuToPopulate); } } MenuItem synchronisedMenuItem = menu.findItem(R.id.windowSynchronise); MenuItem moveFirstMenuItem = menu.findItem(R.id.windowMoveFirst); MenuItem closeMenuItem = menu.findItem(R.id.windowClose); MenuItem minimiseMenuItem = menu.findItem(R.id.windowMinimise); MenuItem maximiseMenuItem = menu.findItem(R.id.windowMaximise); Window window = getActiveWindow(); if (synchronisedMenuItem != null && moveFirstMenuItem != null) { // set synchronised & maximised checkbox state synchronisedMenuItem.setChecked(window.isSynchronised()); maximiseMenuItem.setChecked(window.isMaximised()); // the dedicated links window cannot be treated as a normal window boolean isDedicatedLinksWindowActive = isActiveWindow(windowRepository.getDedicatedLinksWindow()); synchronisedMenuItem.setEnabled(!isDedicatedLinksWindowActive); moveFirstMenuItem.setEnabled(!isDedicatedLinksWindowActive); // cannot close last normal window closeMenuItem.setEnabled(isWindowRemovable(window)); minimiseMenuItem.setEnabled(isWindowMinimisable(window)); // if window is already first then cannot promote List<Window> visibleWindows = windowRepository.getVisibleWindows(); if (visibleWindows.size() > 0 && window.equals(visibleWindows.get(0))) { moveFirstMenuItem.setEnabled(false); } } }