本文整理匯總了Java中com.netease.nimlib.sdk.team.TeamService類的典型用法代碼示例。如果您正苦於以下問題:Java TeamService類的具體用法?Java TeamService怎麽用?Java TeamService使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
TeamService類屬於com.netease.nimlib.sdk.team包,在下文中一共展示了TeamService類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: queryTeamById
import com.netease.nimlib.sdk.team.TeamService; //導入依賴的package包/類
private void queryTeamById() {
NIMClient.getService(TeamService.class).searchTeam(searchEditText.getText().toString()).setCallback(new RequestCallback<Team>() {
@Override
public void onSuccess(Team team) {
updateTeamInfo(team);
}
@Override
public void onFailed(int code) {
if(code == 803) {
Toast.makeText(AdvancedTeamSearchActivity.this, R.string.team_number_not_exist, Toast.LENGTH_LONG).show();
} else {
Toast.makeText(AdvancedTeamSearchActivity.this,"search team failed: " + code, Toast.LENGTH_LONG).show();
}
}
@Override
public void onException(Throwable exception) {
Toast.makeText(AdvancedTeamSearchActivity.this, "search team exception:" + exception.getMessage(), Toast.LENGTH_LONG).show();
}
});
}
示例2: getContent
import com.netease.nimlib.sdk.team.TeamService; //導入依賴的package包/類
private String getContent(IMMessage message) {
if (message == null) {
return null;
}
NimUserInfo userInfo = NimUserInfoCache.getInstance().getUserInfo(DemoCache.getAccount());
if (userInfo == null) {
NimUserInfoCache.getInstance().getUserInfoFromRemote(DemoCache.getAccount(), null);
}
String nick = userInfo == null ? "" : userInfo.getName();
if (message.getSessionType() == SessionTypeEnum.Team) {
Team team = NIMClient.getService(TeamService.class).queryTeamBlock(message.getSessionId());
String teamName = team == null ? "" : team.getName();
return String.format("(群:%s) ", teamName) + createDefaultContent(nick, message);
} else {
return createDefaultContent(nick, message);
}
}
示例3: inviteMembers
import com.netease.nimlib.sdk.team.TeamService; //導入依賴的package包/類
/**
* 邀請群成員
*
* @param accounts 邀請帳號
*/
private void inviteMembers(ArrayList<String> accounts) {
NIMClient.getService(TeamService.class).addMembers(teamId, accounts).setCallback(new RequestCallback<Void>() {
@Override
public void onSuccess(Void param) {
Toast.makeText(AdvancedTeamInfoActivity.this, "添加群成員成功", Toast.LENGTH_SHORT).show();
}
@Override
public void onFailed(int code) {
if (code == ResponseCode.RES_TEAM_INVITE_SUCCESS) {
Toast.makeText(AdvancedTeamInfoActivity.this, R.string.team_invite_members_success, Toast.LENGTH_SHORT).show();
} else {
Toast.makeText(AdvancedTeamInfoActivity.this, "invite members failed, code=" + code, Toast.LENGTH_SHORT).show();
Log.e(TAG, "invite members failed, code=" + code);
}
}
@Override
public void onException(Throwable exception) {
}
});
}
示例4: quitTeam
import com.netease.nimlib.sdk.team.TeamService; //導入依賴的package包/類
/**
* 非群主退出群
*/
private void quitTeam() {
DialogMaker.showProgressDialog(this, getString(R.string.empty), true);
NIMClient.getService(TeamService.class).quitTeam(teamId).setCallback(new RequestCallback<Void>() {
@Override
public void onSuccess(Void param) {
DialogMaker.dismissProgressDialog();
Toast.makeText(AdvancedTeamInfoActivity.this, R.string.quit_team_success, Toast.LENGTH_SHORT).show();
setResult(Activity.RESULT_OK, new Intent().putExtra(RESULT_EXTRA_REASON, RESULT_EXTRA_REASON_QUIT));
finish();
}
@Override
public void onFailed(int code) {
DialogMaker.dismissProgressDialog();
Toast.makeText(AdvancedTeamInfoActivity.this, R.string.quit_team_failed, Toast.LENGTH_SHORT).show();
}
@Override
public void onException(Throwable exception) {
DialogMaker.dismissProgressDialog();
}
});
}
示例5: dismissTeam
import com.netease.nimlib.sdk.team.TeamService; //導入依賴的package包/類
/**
* 群主解散群(直接退出)
*/
private void dismissTeam() {
DialogMaker.showProgressDialog(this, getString(R.string.empty), true);
NIMClient.getService(TeamService.class).dismissTeam(teamId).setCallback(new RequestCallback<Void>() {
@Override
public void onSuccess(Void param) {
DialogMaker.dismissProgressDialog();
setResult(Activity.RESULT_OK, new Intent().putExtra(RESULT_EXTRA_REASON, RESULT_EXTRA_REASON_DISMISS));
Toast.makeText(AdvancedTeamInfoActivity.this, R.string.dismiss_team_success, Toast.LENGTH_SHORT).show();
finish();
}
@Override
public void onFailed(int code) {
DialogMaker.dismissProgressDialog();
Toast.makeText(AdvancedTeamInfoActivity.this, R.string.dismiss_team_failed, Toast.LENGTH_SHORT).show();
}
@Override
public void onException(Throwable exception) {
DialogMaker.dismissProgressDialog();
}
});
}
示例6: setBusinessCard
import com.netease.nimlib.sdk.team.TeamService; //導入依賴的package包/類
/**
* 設置我的名片
*
* @param nickname 群昵稱
*/
private void setBusinessCard(final String nickname) {
DialogMaker.showProgressDialog(this, getString(R.string.empty), true);
NIMClient.getService(TeamService.class).updateMemberNick(teamId, NimUIKit.getAccount(), nickname).setCallback(new RequestCallback<Void>() {
@Override
public void onSuccess(Void param) {
DialogMaker.dismissProgressDialog();
teamBusinessCard.setText(nickname);
Toast.makeText(AdvancedTeamInfoActivity.this, R.string.update_success, Toast.LENGTH_SHORT).show();
}
@Override
public void onFailed(int code) {
DialogMaker.dismissProgressDialog();
Toast.makeText(AdvancedTeamInfoActivity.this, String.format(getString(R.string.update_failed), code),
Toast.LENGTH_SHORT).show();
}
@Override
public void onException(Throwable exception) {
DialogMaker.dismissProgressDialog();
}
});
}
示例7: setAuthen
import com.netease.nimlib.sdk.team.TeamService; //導入依賴的package包/類
/**
* 設置驗證模式
*
* @param type 驗證類型
*/
private void setAuthen(final VerifyTypeEnum type) {
DialogMaker.showProgressDialog(this, getString(R.string.empty));
NIMClient.getService(TeamService.class).updateTeam(teamId, TeamFieldEnum.VerifyType, type).setCallback(new RequestCallback<Void>() {
@Override
public void onSuccess(Void param) {
DialogMaker.dismissProgressDialog();
setAuthenticationText(type);
Toast.makeText(AdvancedTeamInfoActivity.this, R.string.update_success, Toast.LENGTH_SHORT).show();
}
@Override
public void onFailed(int code) {
authenDialog.undoLastSelect(); // 撤銷選擇
DialogMaker.dismissProgressDialog();
Toast.makeText(AdvancedTeamInfoActivity.this, String.format(getString(R.string.update_failed), code), Toast.LENGTH_SHORT).show();
}
@Override
public void onException(Throwable exception) {
DialogMaker.dismissProgressDialog();
}
});
}
示例8: updateInviteMode
import com.netease.nimlib.sdk.team.TeamService; //導入依賴的package包/類
/**
* 更新邀請他人權限
* @param type 邀請他人類型
*/
private void updateInviteMode(final TeamInviteModeEnum type) {
DialogMaker.showProgressDialog(this, getString(R.string.empty));
NIMClient.getService(TeamService.class).updateTeam(teamId, TeamFieldEnum.InviteMode, type).setCallback(new RequestCallback<Void>() {
@Override
public void onSuccess(Void param) {
DialogMaker.dismissProgressDialog();
updateInviteText(type);
Toast.makeText(AdvancedTeamInfoActivity.this, R.string.update_success, Toast.LENGTH_SHORT).show();
}
@Override
public void onFailed(int code) {
inviteDialog.undoLastSelect(); // 撤銷選擇
DialogMaker.dismissProgressDialog();
Toast.makeText(AdvancedTeamInfoActivity.this, String.format(getString(R.string.update_failed), code), Toast.LENGTH_SHORT).show();
}
@Override
public void onException(Throwable exception) {
DialogMaker.dismissProgressDialog();
}
});
}
示例9: updateInfoUpdateMode
import com.netease.nimlib.sdk.team.TeamService; //導入依賴的package包/類
/**
* 更新群資料修改權限
* @param type 群資料修改類型
*/
private void updateInfoUpdateMode(final TeamUpdateModeEnum type) {
DialogMaker.showProgressDialog(this, getString(R.string.empty));
NIMClient.getService(TeamService.class).updateTeam(teamId, TeamFieldEnum.TeamUpdateMode, type).setCallback(new RequestCallback<Void>() {
@Override
public void onSuccess(Void param) {
DialogMaker.dismissProgressDialog();
updateInfoUpateText(type);
Toast.makeText(AdvancedTeamInfoActivity.this, R.string.update_success, Toast.LENGTH_SHORT).show();
}
@Override
public void onFailed(int code) {
teamInfoUpdateDialog.undoLastSelect(); // 撤銷選擇
DialogMaker.dismissProgressDialog();
Toast.makeText(AdvancedTeamInfoActivity.this, String.format(getString(R.string.update_failed), code), Toast.LENGTH_SHORT).show();
}
@Override
public void onException(Throwable exception) {
DialogMaker.dismissProgressDialog();
}
});
}
示例10: updateBeInvitedMode
import com.netease.nimlib.sdk.team.TeamService; //導入依賴的package包/類
/**
* 更新被邀請人權限
* @param type 被邀請人類型
*/
private void updateBeInvitedMode(final TeamBeInviteModeEnum type) {
DialogMaker.showProgressDialog(this, getString(R.string.empty));
NIMClient.getService(TeamService.class).updateTeam(teamId, TeamFieldEnum.BeInviteMode, type).setCallback(new RequestCallback<Void>() {
@Override
public void onSuccess(Void param) {
DialogMaker.dismissProgressDialog();
updateBeInvitedText(type);
Toast.makeText(AdvancedTeamInfoActivity.this, R.string.update_success, Toast.LENGTH_SHORT).show();
}
@Override
public void onFailed(int code) {
teamInviteeDialog.undoLastSelect(); // 撤銷選擇
DialogMaker.dismissProgressDialog();
Toast.makeText(AdvancedTeamInfoActivity.this, String.format(getString(R.string.update_failed), code), Toast.LENGTH_SHORT).show();
}
@Override
public void onException(Throwable exception) {
DialogMaker.dismissProgressDialog();
}
});
}
示例11: onRemoveMember
import com.netease.nimlib.sdk.team.TeamService; //導入依賴的package包/類
/**
* 移除群成員
*/
@Override
public void onRemoveMember(final String account) {
DialogMaker.showProgressDialog(this, getString(R.string.empty), true);
NIMClient.getService(TeamService.class).removeMember(teamId, account).setCallback(new RequestCallback<Void>
() {
@Override
public void onSuccess(Void param) {
DialogMaker.dismissProgressDialog();
removeMember(account);
Toast.makeText(NormalTeamInfoActivity.this, R.string.remove_member_success, Toast.LENGTH_SHORT).show();
}
@Override
public void onFailed(int code) {
DialogMaker.dismissProgressDialog();
Toast.makeText(NormalTeamInfoActivity.this, R.string.remove_member_failed, Toast.LENGTH_SHORT).show();
}
@Override
public void onException(Throwable exception) {
DialogMaker.dismissProgressDialog();
}
});
}
示例12: addMembersToTeam
import com.netease.nimlib.sdk.team.TeamService; //導入依賴的package包/類
/**
* 添加群成員
*/
private void addMembersToTeam(final ArrayList<String> selected) {
// add members
DialogMaker.showProgressDialog(this, getString(R.string.empty), true);
NIMClient.getService(TeamService.class).addMembers(teamId, selected).setCallback(new RequestCallback<Void>() {
@Override
public void onSuccess(Void param) {
DialogMaker.dismissProgressDialog();
addMember(selected, false);
Toast.makeText(NormalTeamInfoActivity.this, R.string.invite_member_success, Toast.LENGTH_SHORT).show();
}
@Override
public void onFailed(int code) {
DialogMaker.dismissProgressDialog();
Toast.makeText(NormalTeamInfoActivity.this, R.string.invite_member_failed, Toast.LENGTH_SHORT).show();
}
@Override
public void onException(Throwable exception) {
DialogMaker.dismissProgressDialog();
}
});
}
示例13: quitTeam
import com.netease.nimlib.sdk.team.TeamService; //導入依賴的package包/類
/**
* 非群主退出群
*/
private void quitTeam() {
DialogMaker.showProgressDialog(this, getString(R.string.empty), true);
NIMClient.getService(TeamService.class).quitTeam(teamId).setCallback(new RequestCallback<Void>() {
@Override
public void onSuccess(Void param) {
DialogMaker.dismissProgressDialog();
Toast.makeText(NormalTeamInfoActivity.this, R.string.quit_normal_team_success, Toast.LENGTH_SHORT).show();
setResult(Activity.RESULT_OK, new Intent().putExtra(TeamExtras.RESULT_EXTRA_REASON, TeamExtras.RESULT_EXTRA_REASON_QUIT));
NIMClient.getService(MsgService.class).deleteRecentContact2(teamId, SessionTypeEnum.Team);
finish();
}
@Override
public void onFailed(int code) {
DialogMaker.dismissProgressDialog();
Toast.makeText(NormalTeamInfoActivity.this, R.string.quit_normal_team_failed, Toast.LENGTH_SHORT).show();
}
@Override
public void onException(Throwable exception) {
DialogMaker.dismissProgressDialog();
}
});
}
示例14: setNickname
import com.netease.nimlib.sdk.team.TeamService; //導入依賴的package包/類
/**
* 更新群昵稱
*
* @param name
*/
private void setNickname(final String name) {
DialogMaker.showProgressDialog(this, getString(R.string.empty), true);
NIMClient.getService(TeamService.class).updateMemberNick(teamId, account, name).setCallback(new RequestCallback<Void>() {
@Override
public void onSuccess(Void param) {
DialogMaker.dismissProgressDialog();
nickName.setText(name != null ? name : getString(R.string.team_nickname_none));
Toast.makeText(AdvancedTeamMemberInfoActivity.this, R.string.update_success, Toast.LENGTH_SHORT).show();
}
@Override
public void onFailed(int code) {
DialogMaker.dismissProgressDialog();
Toast.makeText(AdvancedTeamMemberInfoActivity.this, String.format(getString(R.string.update_failed), code),
Toast.LENGTH_SHORT).show();
}
@Override
public void onException(Throwable exception) {
DialogMaker.dismissProgressDialog();
}
});
}
示例15: removeMember
import com.netease.nimlib.sdk.team.TeamService; //導入依賴的package包/類
/**
* 移除群成員
*/
private void removeMember() {
DialogMaker.showProgressDialog(this, getString(R.string.empty));
NIMClient.getService(TeamService.class).removeMember(teamId, account).setCallback(new RequestCallback<Void>() {
@Override
public void onSuccess(Void param) {
DialogMaker.dismissProgressDialog();
makeIntent(account, isSetAdmin, true);
finish();
Toast.makeText(AdvancedTeamMemberInfoActivity.this, R.string.update_success, Toast.LENGTH_LONG).show();
}
@Override
public void onFailed(int code) {
DialogMaker.dismissProgressDialog();
Toast.makeText(AdvancedTeamMemberInfoActivity.this, String.format(getString(R.string.update_failed), code), Toast.LENGTH_LONG).show();
}
@Override
public void onException(Throwable exception) {
DialogMaker.dismissProgressDialog();
}
});
}