use of org.aisen.weibo.sina.sinasdk.bean.Token in project AisenWeiBo by wangdan.
the class BizFragment method destoryFollower.
/* 结束查看用户好友列表 */
// XXX /*开始移除粉丝*/
public void destoryFollower(final WeiBoUser user, final OnDestoryFollowerCallback callback) {
Token token = AppContext.getAccount().getAccessToken();
if (AppContext.getAccount().getAdvancedToken() != null)
token = AppContext.getAccount().getAdvancedToken();
final Token trueToken = token;
new AlertDialogWrapper.Builder(getRealActivity()).setTitle(R.string.title_destory_friend).setMessage(R.string.biz_destory_follower).setNegativeButton(R.string.cancel, null).setPositiveButton(R.string.confirm, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
new WorkTask<Void, Void, WeiBoUser>() {
@Override
public WeiBoUser workInBackground(Void... params) throws TaskException {
return SinaSDK.getInstance(trueToken).friendshipsFollowersDestory(user.getIdstr());
}
@Override
protected void onPrepare() {
super.onPrepare();
ViewUtils.createProgressDialog(getRealActivity(), getRealString(R.string.biz_destory_follower_loading), ThemeUtils.getThemeColor()).show();
}
;
@Override
protected void onFailure(TaskException exception) {
super.onFailure(exception);
showMessage(exception.getMessage());
}
;
@Override
protected void onSuccess(WeiBoUser result) {
super.onSuccess(result);
if (getRealActivity() != null)
callback.onDestoryFollower(result);
}
;
@Override
protected void onFinished() {
super.onFinished();
ViewUtils.dismissProgressDialog();
}
;
}.execute();
}
}).show();
}
use of org.aisen.weibo.sina.sinasdk.bean.Token in project AisenWeiBo by wangdan.
the class BizFragment method createFriendship.
/* 结束取消对某用户的关注 */
// XXX /*添加关注*/
public void createFriendship(final WeiBoUser user, final OnCreateFriendshipCallback callback) {
Token token = AppContext.getAccount().getAccessToken();
if (AppContext.getAccount().getAdvancedToken() != null)
token = AppContext.getAccount().getAdvancedToken();
final Token trueToken = token;
new WorkTask<Void, Void, WeiBoUser>() {
@Override
public WeiBoUser workInBackground(Void... params) throws TaskException {
return SinaSDK.getInstance(trueToken).friendshipsCreate(user.getIdstr());
}
@Override
protected void onPrepare() {
super.onPrepare();
ViewUtils.createProgressDialog(getRealActivity(), getRealString(R.string.biz_create_friendship), ThemeUtils.getThemeColor()).show();
}
;
@Override
protected void onFailure(TaskException exception) {
super.onFailure(exception);
if (getRealActivity() == null) {
return;
}
showMessage(exception.getMessage());
}
;
@Override
protected void onSuccess(WeiBoUser result) {
super.onSuccess(result);
if (getRealActivity() == null) {
return;
}
callback.onFriendshipCreated(result);
}
;
@Override
protected void onFinished() {
super.onFinished();
if (getRealActivity() == null) {
return;
}
ViewUtils.dismissProgressDialog();
}
;
}.execute();
}
use of org.aisen.weibo.sina.sinasdk.bean.Token in project AisenWeiBo by wangdan.
the class BizFragment method destoryFriendship.
/* 结束查看用户微博 */
// XXX /*取消对某用户的关注*/
public void destoryFriendship(final WeiBoUser user, final OnDestoryFriendshipCallback callback) {
Token token = AppContext.getAccount().getAccessToken();
if (AppContext.getAccount().getAdvancedToken() != null)
token = AppContext.getAccount().getAdvancedToken();
final Token trueToken = token;
new AlertDialogWrapper.Builder(getRealActivity()).setMessage(R.string.biz_destory_friend).setNegativeButton(R.string.no, null).setPositiveButton(R.string.yes, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
new WorkTask<Void, Void, WeiBoUser>() {
@Override
public WeiBoUser workInBackground(Void... params) throws TaskException {
return SinaSDK.getInstance(trueToken).friendshipsDestroy(user.getIdstr());
}
@Override
protected void onPrepare() {
super.onPrepare();
ViewUtils.createProgressDialog(getRealActivity(), getRealString(R.string.biz_destory_friendship), ThemeUtils.getThemeColor()).show();
}
;
@Override
protected void onFailure(TaskException exception) {
super.onFailure(exception);
showMessage(exception.getMessage());
}
;
@Override
protected void onSuccess(WeiBoUser result) {
super.onSuccess(result);
if (getRealActivity() == null) {
return;
}
callback.onFriendshipDestoryed(result);
}
;
@Override
protected void onFinished() {
super.onFinished();
if (getRealActivity() == null) {
return;
}
ViewUtils.dismissProgressDialog();
}
;
}.execute();
}
}).show();
}
Aggregations