use of com.zhan_dui.auth.SocialPlatform in project AnimeTaste by daimajia.
the class PlayActivity method comment.
public void comment() {
MobclickAgent.onEvent(mContext, "comment");
if (mUser.isLogin() == false) {
new AlertDialog.Builder(this).setTitle(R.string.choose_login).setItems(new String[] { getString(R.string.weibo), getString(R.string.qq) }, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
switch(which) {
case 0:
new SocialPlatform(mContext).auth(SinaWeibo.NAME, mAuthHandler);
break;
case 1:
new SocialPlatform(mContext).auth(QZone.NAME, mAuthHandler);
break;
default:
break;
}
}
}).setNegativeButton(R.string.cancel_login, null).show();
} else {
final EditText editText = new EditText(mContext);
editText.setHeight(mContext.getResources().getDimensionPixelSize(R.dimen.comment_edit_height));
editText.setFilters(new InputFilter[] { new InputFilter.LengthFilter(250) });
editText.setGravity(Gravity.LEFT | Gravity.TOP);
AlertDialog.Builder commentDialog = new AlertDialog.Builder(mContext).setTitle(R.string.publish_comment).setView(editText).setNegativeButton(R.string.cancel_publish, null).setPositiveButton(R.string.publish, null);
final AlertDialog dialog = commentDialog.create();
dialog.show();
dialog.getButton(AlertDialog.BUTTON_POSITIVE).setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
final String content = editText.getText().toString();
if (content.length() == 0) {
Toast.makeText(mContext, R.string.comment_nothing, Toast.LENGTH_SHORT).show();
} else if (content.length() < 5) {
Toast.makeText(mContext, R.string.comment_too_short, Toast.LENGTH_SHORT).show();
} else {
new CommentThread(content).start();
dialog.dismiss();
}
}
});
}
}
Aggregations