String[] keys = new String[mAvailableActions.keySet().size()];
mAvailableActions.keySet().toArray(keys);
ArrayList<String> availableTimeActions = new ArrayList<String>();
for (String key : keys) {
Action action = mAvailableActions.get(key);
String test = action.getValue(Action.NAME).toString();
if (test.indexOf(':') != -1 && (test.length() == 4 || test.length() == 5)) {
availableTimeActions.add(key);
}
}
String scrollTo = MainFrame.mLocalizer
.msg("menuinfo.scrollTo", "Scroll to")
+ ": ";
for (final int timeMinutes : Settings.propTimeButtons.getIntArray()) {
int hour = timeMinutes / 60;
String time = String.valueOf(timeMinutes % 60);
if (time.length() == 1) {
time = hour + ":0" + time;
} else {
time = hour + ":" + time;
}
if (availableTimeActions.contains("#scrollTo" + time)) {
availableTimeActions.remove("#scrollTo" + time);
continue;
}
createAction(time, "#scrollTo" + time,
scrollTo + time, IconLoader.getInstance().getIconFromTheme("actions",
"scroll-to-specific-time", 16), IconLoader.getInstance().getIconFromTheme(
"actions", "scroll-to-specific-time", 22), ToolBar.BUTTON_ACTION,
new ActionListener() {
public void actionPerformed(ActionEvent e) {
MainFrame.getInstance().scrollToTime(timeMinutes);
}
});
}
Iterator<String> it = availableTimeActions.iterator();
while (it.hasNext()) {
final String timeActionId = it.next();
Action action = mAvailableActions.remove(timeActionId);
if (mVisibleActions.contains(action)) {
mVisibleActions.remove(action);
}
}