use of me.zhanghai.android.douya.network.api.info.apiv2.Broadcast in project Douya by DreaminginCodeZH.
the class BroadcastListResource method onBroadcastDeleted.
@Subscribe(threadMode = ThreadMode.MAIN)
public void onBroadcastDeleted(BroadcastDeletedEvent event) {
if (event.isFromMyself(this) || isEmpty()) {
return;
}
List<Broadcast> broadcastList = get();
for (int i = 0, size = broadcastList.size(); i < size; ) {
Broadcast broadcast = broadcastList.get(i);
if (broadcast.id == event.broadcastId || (broadcast.rebroadcastedBroadcast != null && broadcast.rebroadcastedBroadcast.id == event.broadcastId)) {
broadcastList.remove(i);
getListener().onBroadcastRemoved(getRequestCode(), i);
--size;
} else {
++i;
}
}
}
use of me.zhanghai.android.douya.network.api.info.apiv2.Broadcast in project Douya by DreaminginCodeZH.
the class BroadcastListResource method onBroadcastUpdated.
@Subscribe(threadMode = ThreadMode.MAIN)
public void onBroadcastUpdated(BroadcastUpdatedEvent event) {
if (event.isFromMyself(this) || isEmpty()) {
return;
}
List<Broadcast> broadcastList = get();
for (int i = 0, size = broadcastList.size(); i < size; ++i) {
Broadcast broadcast = broadcastList.get(i);
boolean changed = false;
if (broadcast.id == event.broadcast.id) {
broadcastList.set(i, event.broadcast);
changed = true;
} else if (broadcast.rebroadcastedBroadcast != null && broadcast.rebroadcastedBroadcast.id == event.broadcast.id) {
broadcast.rebroadcastedBroadcast = event.broadcast;
changed = true;
}
if (changed) {
getListener().onBroadcastChanged(getRequestCode(), i, broadcastList.get(i));
}
}
}
use of me.zhanghai.android.douya.network.api.info.apiv2.Broadcast in project Douya by DreaminginCodeZH.
the class BroadcastResource method get.
@Override
public Broadcast get() {
Broadcast broadcast = super.get();
if (broadcast == null) {
// Can be called before onCreate() is called.
ensureArguments();
broadcast = mExtraBroadcast;
}
return broadcast;
}
use of me.zhanghai.android.douya.network.api.info.apiv2.Broadcast in project Douya by DreaminginCodeZH.
the class BroadcastActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
TransitionUtils.setupTransitionBeforeDecorate(this);
super.onCreate(savedInstanceState);
// Calls ensureSubDecor().
findViewById(android.R.id.content);
TransitionUtils.postponeTransition(this);
if (savedInstanceState == null) {
Intent intent = getIntent();
long broadcastId = intent.getLongExtra(EXTRA_BROADCAST_ID, -1);
Broadcast broadcast = intent.getParcelableExtra(EXTRA_BROADCAST);
boolean showSendComment = intent.getBooleanExtra(EXTRA_SHOW_SEND_COMMENT, false);
String title = intent.getStringExtra(EXTRA_TITLE);
FragmentUtils.add(BroadcastFragment.newInstance(broadcastId, broadcast, showSendComment, title), this, android.R.id.content);
}
}
Aggregations