Skip to content

Commit

Permalink
Remove non-addEventListener ways of adding an event listener
Browse files Browse the repository at this point in the history
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=218347641
  • Loading branch information
ojw28 committed Oct 24, 2018
1 parent d56b7ad commit 66a6921
Showing 1 changed file with 0 additions and 33 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,6 @@ public static final class Builder {

@Nullable private final Context context;

@Nullable private Handler eventHandler;
@Nullable private EventListener eventListener;
private SparseArray<Long> initialBitrateEstimates;
private int slidingWindowMaxWeight;
private Clock clock;
Expand All @@ -95,21 +93,6 @@ public Builder(Context context) {
clock = Clock.DEFAULT;
}

/**
* Sets an event listener for new bandwidth estimates.
*
* @param eventHandler A handler for events.
* @param eventListener A listener of events.
* @return This builder.
* @throws IllegalArgumentException If the event handler or listener are null.
*/
public Builder setEventListener(Handler eventHandler, EventListener eventListener) {
Assertions.checkArgument(eventHandler != null && eventListener != null);
this.eventHandler = eventHandler;
this.eventListener = eventListener;
return this;
}

/**
* Sets the maximum weight for the sliding window.
*
Expand Down Expand Up @@ -185,9 +168,6 @@ public DefaultBandwidthMeter build() {
DefaultBandwidthMeter bandwidthMeter =
new DefaultBandwidthMeter(
context, initialBitrateEstimates, slidingWindowMaxWeight, clock);
if (eventHandler != null && eventListener != null) {
bandwidthMeter.addEventListener(eventHandler, eventListener);
}
return bandwidthMeter;
}

Expand Down Expand Up @@ -238,19 +218,6 @@ public DefaultBandwidthMeter() {
Clock.DEFAULT);
}

/** @deprecated Use {@link Builder} instead. */
@Deprecated
public DefaultBandwidthMeter(Handler eventHandler, EventListener eventListener) {
this(
/* context= */ null,
/* initialBitrateEstimates= */ new SparseArray<>(),
DEFAULT_SLIDING_WINDOW_MAX_WEIGHT,
Clock.DEFAULT);
if (eventHandler != null && eventListener != null) {
addEventListener(eventHandler, eventListener);
}
}

private DefaultBandwidthMeter(
@Nullable Context context,
SparseArray<Long> initialBitrateEstimates,
Expand Down

0 comments on commit 66a6921

Please sign in to comment.