use of me.zhanghai.android.douya.network.api.info.frodo.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);
mFragment = BroadcastFragment.newInstance(broadcastId, broadcast, showSendComment, title);
FragmentUtils.add(mFragment, this, android.R.id.content);
} else {
mFragment = FragmentUtils.findById(this, android.R.id.content);
}
}
use of me.zhanghai.android.douya.network.api.info.frodo.Broadcast in project Douya by DreaminginCodeZH.
the class BroadcastAdapter method onBindViewHolder.
@Override
public void onBindViewHolder(final ViewHolder holder, int position) {
Broadcast broadcast = getItem(position);
holder.rebroadcastedByText.setText(broadcast.isSimpleRebroadcast() ? broadcast.getRebroadcastedBy(holder.rebroadcastedByText.getContext()) : null);
Broadcast effectiveBroadcast = broadcast.getEffectiveBroadcast();
holder.cardView.setOnClickListener(view -> mListener.onOpenBroadcast(broadcast, getSharedView(holder)));
holder.broadcastLayout.bind(broadcast);
holder.broadcastLayout.setListener(new BroadcastLayout.Listener() {
@Override
public void onLikeClicked() {
mListener.onLikeBroadcast(effectiveBroadcast, !effectiveBroadcast.isLiked);
}
@Override
public void onRebroadcastClicked(boolean isLongClick) {
mListener.onRebroadcastBroadcast(broadcast, !broadcast.isSimpleRebroadcastByOneself(), isLongClick);
}
@Override
public void onCommentClicked() {
// Not setting button disabled because we are using enabled state for indeterminate
// state due to network, and we want the click to always open the broadcast for our
// user.
mListener.onCommentBroadcast(broadcast, getSharedView(holder));
}
});
ViewCompat.setTransitionName(getSharedView(holder), broadcast.makeTransitionName());
}
use of me.zhanghai.android.douya.network.api.info.frodo.Broadcast in project Douya by DreaminginCodeZH.
the class BroadcastResource method get.
/**
* @deprecated In most cases you may want to use {@link #getEffectiveBroadcast()}.
*/
@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.frodo.Broadcast in project Douya by DreaminginCodeZH.
the class DeleteBroadcastWriter method onResponse.
@Override
public void onResponse(Void response) {
ToastUtils.show(mBroadcast != null && mBroadcast.isSimpleRebroadcast() ? R.string.broadcast_unrebroadcast_successful : R.string.broadcast_delete_successful, getContext());
if (mBroadcast != null) {
Broadcast rebroadcastedBroadcast;
if (mBroadcast.parentBroadcast != null) {
rebroadcastedBroadcast = mBroadcast.parentBroadcast;
} else if (mBroadcast.getParentBroadcastId() != null) {
rebroadcastedBroadcast = null;
} else {
rebroadcastedBroadcast = mBroadcast.rebroadcastedBroadcast;
}
if (rebroadcastedBroadcast != null) {
--rebroadcastedBroadcast.rebroadcastCount;
EventBusUtils.postAsync(new BroadcastUpdatedEvent(rebroadcastedBroadcast, this));
}
}
EventBusUtils.postAsync(new BroadcastDeletedEvent(mBroadcastId, this));
stopSelf();
}
use of me.zhanghai.android.douya.network.api.info.frodo.Broadcast in project Douya by DreaminginCodeZH.
the class BroadcastFragment method copyText.
private void copyText() {
Broadcast broadcast = mBroadcastAdapter.getBroadcast();
Activity activity = getActivity();
if (broadcast == null) {
ToastUtils.show(R.string.broadcast_copy_text_not_loaded, activity);
return;
}
ClipboardUtils.copy(broadcast, activity);
}
Aggregations