/** * Finds the program after the given Program * * @param prg Search Program after this * @return following Program */ private Program findNextProgram(Program prg) { Iterator<Program> it = Plugin.getPluginManager().getChannelDayProgram(prg.getDate(), prg.getChannel()); Program nprg = null; boolean last = false; while (it.hasNext()) { Program p = it.next(); if (prg.equals(p) && it.hasNext()) { while (it.hasNext()) { Program test = it.next(); if (!test.isExpired() && mCurrentFilter.accept(test)) { return test; } } last = true; } else if (prg.equals(p) && !it.hasNext()) { last = true; } } if (last) { it = Plugin.getPluginManager() .getChannelDayProgram(prg.getDate().addDays(1), prg.getChannel()); while (it.hasNext()) { Program p = it.next(); if (!p.isExpired() && mCurrentFilter.accept(p)) { return p; } } } return nprg; }