More lint fixes

This commit is contained in:
l3d00m
2015-08-23 21:12:30 +02:00
parent e9743b616a
commit 48b936d7b7
30 changed files with 173 additions and 167 deletions
@@ -72,11 +72,11 @@ public abstract class ElementTimeImpl implements ElementTime {
String[] beginTimeStringList = mSmilElement.getAttribute("begin").split(";");
// TODO: Check other constraints on parsed values, e.g., "single, non-negative offset values
ArrayList<Time> beginTimeList = new ArrayList<Time>();
ArrayList<Time> beginTimeList = new ArrayList<>();
// Initialize Time instances and add them to Vector
for (int i = 0; i < beginTimeStringList.length; i++) {
for (String aBeginTimeStringList : beginTimeStringList) {
try {
beginTimeList.add(new TimeImpl(beginTimeStringList[i], getBeginConstraints()));
beginTimeList.add(new TimeImpl(aBeginTimeStringList, getBeginConstraints()));
} catch (IllegalArgumentException e) {
// Ignore badly formatted times
}
@@ -121,15 +121,15 @@ public abstract class ElementTimeImpl implements ElementTime {
}
public TimeList getEnd() {
ArrayList<Time> endTimeList = new ArrayList<Time>();
ArrayList<Time> endTimeList = new ArrayList<>();
String[] endTimeStringList = mSmilElement.getAttribute("end").split(";");
int len = endTimeStringList.length;
if (!((len == 1) && (endTimeStringList[0].length() == 0))) { // Ensure the end field is set.
// Initialize Time instances and add them to Vector
for (int i = 0; i < len; i++) {
for (String anEndTimeStringList : endTimeStringList) {
try {
endTimeList.add(new TimeImpl(endTimeStringList[i],
endTimeList.add(new TimeImpl(anEndTimeStringList,
getEndConstraints()));
} catch (IllegalArgumentException e) {
// Ignore badly formatted times
@@ -245,7 +245,7 @@ public abstract class ElementTimeImpl implements ElementTime {
*/
return FILL_AUTO;
} else {
return ((ElementTimeImpl) parent).getFillDefault();
return parent.getFillDefault();
}
}
}
@@ -156,28 +156,29 @@ public class SmilDocumentImpl extends DocumentImpl implements SMILDocument, Docu
public Element createElement(String tagName) throws DOMException {
// Find the appropriate class for this element
tagName = tagName.toLowerCase();
if (tagName.equals("text") ||
tagName.equals("img") ||
tagName.equals("video")) {
return new SmilRegionMediaElementImpl(this, tagName);
} else if (tagName.equals("audio")) {
return new SmilMediaElementImpl(this, tagName);
} else if (tagName.equals("layout")) {
return new SmilLayoutElementImpl(this, tagName);
} else if (tagName.equals("root-layout")) {
return new SmilRootLayoutElementImpl(this, tagName);
} else if (tagName.equals("region")) {
return new SmilRegionElementImpl(this, tagName);
} else if (tagName.equals("ref")) {
return new SmilRefElementImpl(this, tagName);
} else if (tagName.equals("par")) {
return new SmilParElementImpl(this, tagName);
} else if (tagName.equals("vcard")) {
return new SmilRegionMediaElementImpl(this, tagName);
} else {
// This includes also the structural nodes SMIL,
// HEAD, BODY, for which no specific types are defined.
return new SmilElementImpl(this, tagName);
switch (tagName) {
case "text":
case "img":
case "video":
return new SmilRegionMediaElementImpl(this, tagName);
case "audio":
return new SmilMediaElementImpl(this, tagName);
case "layout":
return new SmilLayoutElementImpl(this, tagName);
case "root-layout":
return new SmilRootLayoutElementImpl(this, tagName);
case "region":
return new SmilRegionElementImpl(this, tagName);
case "ref":
return new SmilRefElementImpl(this, tagName);
case "par":
return new SmilParElementImpl(this, tagName);
case "vcard":
return new SmilRegionMediaElementImpl(this, tagName);
default:
// This includes also the structural nodes SMIL,
// HEAD, BODY, for which no specific types are defined.
return new SmilElementImpl(this, tagName);
}
}
@@ -44,7 +44,7 @@ public class SmilParElementImpl extends SmilElementImpl implements SMILParElemen
*/
TimeList beginTimeList = super.getBegin();
if (beginTimeList.getLength() > 1) {
ArrayList<Time> singleTimeContainer = new ArrayList<Time>();
ArrayList<Time> singleTimeContainer = new ArrayList<>();
singleTimeContainer.add(beginTimeList.item(0));
beginTimeList = new TimeListImpl(singleTimeContainer);
}
@@ -46,7 +46,7 @@ public class SmilPlayer implements Runnable {
private static final boolean LOCAL_LOGV = false;
private static final int TIMESLICE = 200;
private static enum SmilPlayerState {
private enum SmilPlayerState {
INITIALIZED,
PLAYING,
PLAYED,
@@ -54,7 +54,7 @@ public class SmilPlayer implements Runnable {
STOPPED,
}
private static enum SmilPlayerAction {
private enum SmilPlayerAction {
NO_ACTIVE_ACTION,
RELOAD,
STOP,
@@ -88,7 +88,7 @@ public class SmilPlayer implements Runnable {
private static ArrayList<TimelineEntry> getParTimeline(
ElementParallelTimeContainer par, double offset, double maxOffset) {
ArrayList<TimelineEntry> timeline = new ArrayList<TimelineEntry>();
ArrayList<TimelineEntry> timeline = new ArrayList<>();
// Set my begin at first
TimeList myBeginList = par.getBegin();
@@ -145,7 +145,7 @@ public class SmilPlayer implements Runnable {
private static ArrayList<TimelineEntry> getSeqTimeline(
ElementSequentialTimeContainer seq, double offset, double maxOffset) {
ArrayList<TimelineEntry> timeline = new ArrayList<TimelineEntry>();
ArrayList<TimelineEntry> timeline = new ArrayList<>();
double orgOffset = offset;
// Set my begin at first
@@ -211,7 +211,7 @@ public class SmilPlayer implements Runnable {
return getSeqTimeline((ElementSequentialTimeContainer) element, offset, maxOffset);
} else {
// Not ElementTimeContainer here
ArrayList<TimelineEntry> timeline = new ArrayList<TimelineEntry>();
ArrayList<TimelineEntry> timeline = new ArrayList<>();
TimeList beginList = element.getBegin();
for (int i = 0; i < beginList.getLength(); ++i) {
@@ -301,7 +301,7 @@ public class SmilPlayer implements Runnable {
mAllEntries = getTimeline(mRoot, 0, Long.MAX_VALUE);
mMediaTimeUpdatedEvent = ((DocumentEvent) mRoot).createEvent("Event");
mMediaTimeUpdatedEvent.initEvent(MEDIA_TIME_UPDATED_EVENT, false, false);
mActiveElements = new ArrayList<ElementTime>();
mActiveElements = new ArrayList<>();
}
public synchronized void play() {
@@ -529,7 +529,7 @@ public class SmilPlayer implements Runnable {
}
private void stopCurrentSlide() {
HashSet<TimelineEntry> skippedEntries = new HashSet<TimelineEntry>();
HashSet<TimelineEntry> skippedEntries = new HashSet<>();
int totalEntries = mAllEntries.size();
for (int i = mCurrentElement; i < totalEntries; i++) {
// Stop any started entries, and skip the not started entries until