use of net.iGap.helper.upload.OnUploadListener in project iGap-Android by KianIranian-STDG.
the class EditGroupViewModel method uploadAvatar.
public void uploadAvatar(String path) {
long avatarId = SUID.id().get();
long lastUploadedAvatarId = avatarId + 1L;
Uploader.getInstance().upload(UploadObject.createForAvatar(lastUploadedAvatarId, path, null, ProtoGlobal.RoomMessageType.IMAGE, new OnUploadListener() {
@Override
public void onProgress(String id, int progress) {
showUploadProgressLiveData.postValue(View.VISIBLE);
}
@Override
public void onFinish(String id, String token) {
new RequestGroupAvatarAdd().groupAvatarAdd(roomId, token);
}
@Override
public void onError(String id) {
showUploadProgressLiveData.postValue(View.GONE);
}
}));
}
use of net.iGap.helper.upload.OnUploadListener in project iGap-Android by KianIranian-STDG.
the class FragmentRegistrationNicknameViewModel method uploadAvatar.
public void uploadAvatar(String path) {
existAvatar = false;
pathImageUser = path;
int lastUploadedAvatarId = idAvatar + 1;
prgVisibility.set(View.VISIBLE);
Uploader.getInstance().upload(UploadObject.createForAvatar(lastUploadedAvatarId, pathImageUser, null, ProtoGlobal.RoomMessageType.IMAGE, new OnUploadListener() {
@Override
public void onProgress(String id, int progress) {
progressValue.postValue(progress);
}
@Override
public void onFinish(String id, String token) {
Log.wtf(this.getClass().getName(), "onFinish: id: " + id);
existAvatar = true;
new RequestUserAvatarAdd().userAddAvatar(token);
}
@Override
public void onError(String id) {
Log.wtf(this.getClass().getName(), "onError: id: " + id);
existAvatar = true;
prgVisibility.set(View.GONE);
}
}));
}
use of net.iGap.helper.upload.OnUploadListener in project iGap-Android by KianIranian-STDG.
the class UserProfileViewModel method uploadAvatar.
public void uploadAvatar(String path) {
pathSaveImage = path;
long lastUploadedAvatarId = idAvatar + 1L;
showLoading.set(View.VISIBLE);
Uploader.getInstance().upload(UploadObject.createForAvatar(lastUploadedAvatarId, pathSaveImage, null, ProtoGlobal.RoomMessageType.IMAGE, new OnUploadListener() {
@Override
public void onProgress(String id, int progress) {
}
@Override
public void onFinish(String id, String token) {
new RequestUserAvatarAdd().userAddAvatar(token);
}
@Override
public void onError(String id) {
G.handler.post(() -> showLoading.set(View.GONE));
}
}));
}
Aggregations