use of net.iGap.helper.avatar.ParamWithAvatarType in project iGap-Android by KianIranian-STDG.
the class ItemBottomSheetForward method setAvatar.
private void setAvatar(final StructBottomSheetForward mInfo, CircleImageView imageView) {
long idForGetAvatar;
AvatarHandler.AvatarType avatarType;
if (mInfo.getType() == ProtoGlobal.Room.Type.CHAT) {
idForGetAvatar = mInfo.getPeer_id();
avatarType = AvatarHandler.AvatarType.USER;
} else {
idForGetAvatar = mInfo.getId();
avatarType = AvatarHandler.AvatarType.ROOM;
}
if (AccountManager.getInstance().getCurrentUser().getId() == mInfo.getPeer_id()) {
avatarHandler.removeImageViewFromHandler(imageView);
imageView.setImageResource(R.drawable.ic_cloud_space_blue);
} else {
avatarHandler.getAvatar(new ParamWithAvatarType(imageView, idForGetAvatar).avatarSize(R.dimen.dp52).avatarType(avatarType));
}
}
use of net.iGap.helper.avatar.ParamWithAvatarType in project iGap-Android by KianIranian-STDG.
the class MemberCell method loadInfo.
private void loadInfo(AvatarHandler avatarHandler, long userId, CharSequence name, String status) {
avatarHandler.getAvatar(new ParamWithAvatarType(avatarImage, userId).avatarType(AvatarHandler.AvatarType.USER).showMain(), true);
memberNameView.setText(name);
memberStatusView.setText(status);
}
use of net.iGap.helper.avatar.ParamWithAvatarType in project iGap-Android by KianIranian-STDG.
the class ChargeFragment method initForm.
private void initForm() {
// init number from dataBase
DbManager.getInstance().doRealmTask(realm -> {
RealmRegisteredInfo userInfo = realm.where(RealmRegisteredInfo.class).findFirst();
if (userInfo != null && editTextNumber.getText() != null) {
userNumber = userInfo.getPhoneNumber();
if (phoneNumber != null && !phoneNumber.isEmpty() && !phoneNumber.equals("0")) {
setPhoneNumberEditText(phoneNumber);
if (peerId != 0) {
avatarHandler.getAvatar(new ParamWithAvatarType(imageViewAvatar, peerId).avatarType(AvatarHandler.AvatarType.ROOM).showMain());
}
} else if (phoneNumber != null && phoneNumber.equals("0")) {
imageViewAvatar.setVisibility(View.GONE);
editTextNumber.setHint(getResources().getString(R.string.please_enter_phone_number));
iconRemove.setText(R.string.icon_edit);
} else {
imageViewAvatar.setVisibility(View.GONE);
setPhoneNumberEditText(userNumber);
}
}
});
// init RecyclerViewOperator
recyclerViewOperator.setLayoutManager(new GridLayoutManager(context, 3, RecyclerView.VERTICAL, false));
adapterOperator = new OperatorAdapter(getContext(), operators, operatorName -> {
if (currentConfigData != null) {
for (ConfigData configData : config.getData()) {
if (configData.getOperator().getKey().equals(operatorName)) {
currentConfigData = configData;
changeOperator(currentConfigData.getOperator());
break;
}
}
} else {
adapterOperator.setCheckedRadioButton(null);
HelperError.showSnackMessage(getResources().getString(R.string.please_enter_phone_number), false);
}
});
recyclerViewOperator.setAdapter(adapterOperator);
detectOperatorByNumber(editTextNumber.getText().toString());
editTextNumber.addTextChangedListener(editTextNumberWatcher());
iconRemove.setOnClickListener(removeNumberClicked());
historyButton.setOnClickListener(historyButtonClicked());
contactButton.setOnClickListener(contactButtonClicked());
buttonAmount.setOnClickListener(v -> {
choosePriceButtonClicked();
});
amountPlusButton.setOnClickListener(v -> {
if (currentAmount != null) {
isHistorySelected(false);
currentAmount = new Amount(currentAmount, true);
buttonAmount.setText(currentAmount.getTextAmount());
} else {
HelperError.showSnackMessage(getResources().getString(R.string.please_enter_desired_amount), false);
}
});
amountMinesButton.setOnClickListener(v -> {
if (currentAmount != null) {
if (currentAmount.getAmount() > 10000) {
isHistorySelected(false);
currentAmount = new Amount(currentAmount, false);
buttonAmount.setText(currentAmount.getTextAmount());
} else {
HelperError.showSnackMessage(getResources().getString(R.string.minimizeAmount), false);
}
} else {
HelperError.showSnackMessage(getResources().getString(R.string.please_enter_desired_amount), false);
}
});
buttonChargeType.setOnClickListener(v -> {
chooseChargeTypeClicked();
});
buttonEnter.setOnClickListener(v -> onSaveBtnClicked());
scrollView.setVisibility(View.VISIBLE);
progressBar.setVisibility(View.GONE);
}
use of net.iGap.helper.avatar.ParamWithAvatarType in project iGap-Android by KianIranian-STDG.
the class InternetFragment method initForm.
private void initForm() {
DbManager.getInstance().doRealmTask(realm -> {
RealmRegisteredInfo userInfo = realm.where(RealmRegisteredInfo.class).findFirst();
if (userInfo != null) {
userNumber = userInfo.getPhoneNumber();
if (phoneNumber != null && !phoneNumber.isEmpty() && !phoneNumber.equals("0")) {
setPhoneNumberEditText(phoneNumber);
if (peerId != 0) {
avatarHandler.getAvatar(new ParamWithAvatarType(avatar, peerId).avatarType(AvatarHandler.AvatarType.ROOM).showMain());
}
}
if (phoneNumber != null && phoneNumber.equals("0")) {
avatar.setVisibility(View.GONE);
editTextNumber.setHint(getActivity().getString(R.string.please_enter_phone_number));
removeButton.setText(R.string.icon_edit);
} else {
avatar.setVisibility(View.GONE);
setPhoneNumberEditText(userNumber);
}
if (editTextNumber.getText() != null && editTextNumber.getText().length() == 11) {
hideKeyboard();
}
editTextNumber.setSelection(editTextNumber.getText() == null ? 0 : editTextNumber.getText().length());
}
});
operatorAdapter = new OperatorAdapter(getContext(), operators, operatorName -> {
if (currentConfigData != null) {
changeOperator(currentConfigData.getOperator());
} else {
operatorAdapter.setCheckedRadioButton(null);
HelperError.showSnackMessage(getActivity().getString(R.string.please_enter_phone_number), false);
}
});
lstOperator.setAdapter(operatorAdapter);
detectOperatorByNumber(editTextNumber.getText().toString());
chargeApi = new RetrofitFactory().getChargeRetrofit();
editTextNumber.addTextChangedListener(editTextNumberWatcher());
removeButton.setOnClickListener(removeNumberClicked());
frameContact.setOnClickListener(v -> onContactNumberButtonClick());
frameHistory.setOnClickListener(v -> onHistoryNumberButtonClick());
radioGroup.setOnCheckedChangeListener((group, checkedId) -> InternetFragment.this.changeSimType());
goNextButton.setOnClickListener(v -> {
RadioButton radioButton = radioGroup.findViewById(radioGroup.getCheckedRadioButtonId());
if (radioButton != null) {
if (currentSimType == null) {
showError(getActivity().getString(R.string.invalid_sim_type));
return;
}
if (editTextNumber.getText() == null) {
editTextNumber.setError(getString(R.string.phone_number_is_not_valid));
return;
}
String rechargeableNumber = editTextNumber.getText().toString().trim();
if (!isNumeric(rechargeableNumber) || rechargeableNumber.length() < 11) {
editTextNumber.setError(getString(R.string.phone_number_is_not_valid));
return;
}
if (!isNumberFromIran(rechargeableNumber)) {
editTextNumber.setError(getString(R.string.phone_number_is_not_valid));
return;
}
int packageType = historyNumber != null ? Integer.parseInt(historyNumber.getPackageType()) : -1;
new HelperFragment(getActivity().getSupportFragmentManager(), PaymentInternetFragment.newInstance(userNumber, rechargeableNumber, currentOperator.getKey(), currentSimType, packageType)).setAnimated(false).setReplace(false).load();
} else {
showError(getActivity().getString(R.string.sim_type_not_choosed));
}
});
progressBar.setVisibility(View.GONE);
scrollView.setVisibility(View.VISIBLE);
}
use of net.iGap.helper.avatar.ParamWithAvatarType in project iGap-Android by KianIranian-STDG.
the class MyInfoWindow method onOpen.
public void onOpen(final Object arg) {
/**
* change latest clicked user marker color to GRAY and new clicker to GREEN
*/
if (latestClickedMarker != null) {
latestClickedMarker.setIcon(FragmentiGapMap.avatarMark(latestClickedUserId, FragmentiGapMap.MarkerColor.GRAY));
}
marker.setIcon(FragmentiGapMap.avatarMark(userId, FragmentiGapMap.MarkerColor.GREEN));
latestClickedMarker = marker;
latestClickedUserId = userId;
/**
* don't show dialog for mine user
*/
if (userId == AccountManager.getInstance().getCurrentUser().getId()) {
return;
}
String displayName = DbManager.getInstance().doRealmTask(realm2 -> {
RealmRegisteredInfo realmRegisteredInfo = RealmRegisteredInfo.getRegistrationInfo(realm2, userId);
if (realmRegisteredInfo == null) {
RealmRegisteredInfo.getRegistrationInfo(userId, new OnInfo() {
@Override
public void onInfo(Long registeredId) {
G.handler.post(new Runnable() {
@Override
public void run() {
onOpen(arg);
}
});
}
});
return null;
}
return realmRegisteredInfo.getDisplayName();
});
if (displayName == null) {
return;
}
/* RealmCallConfig callConfig = realm.where(RealmCallConfig.class).findFirst();
if (callConfig != null) {
isCallEnable = callConfig.isVoice_calling();
isVideoCallEnable = callConfig.isVideo_calling();
}*/
final MaterialDialog dialog = new MaterialDialog.Builder(mActivity).customView(R.layout.map_user_info, true).build();
View view = dialog.getCustomView();
if (view == null) {
return;
}
DialogAnimation.animationDown(dialog);
dialog.show();
final CircleImageView avatar = view.findViewById(R.id.img_info_avatar_map);
final TextView txtClose = view.findViewById(R.id.txt_close_map);
final TextView txtBack = view.findViewById(R.id.txt_info_back_map);
final TextView txtOpenComment = view.findViewById(R.id.txt_open_comment_map);
final TextView txtChat = view.findViewById(R.id.txt_chat_map);
final TextView txtCall = view.findViewById(R.id.txt_call_map);
txtCall.setVisibility(isCallEnable ? View.VISIBLE : View.GONE);
final TextView txtVideoCall = view.findViewById(R.id.txt_video_call_map);
txtVideoCall.setVisibility(isVideoCallEnable ? View.VISIBLE : View.GONE);
TextView txtName = view.findViewById(R.id.txt_name_info_map);
final TextView txtComment = view.findViewById(R.id.txt_info_comment);
txtName.setText(displayName);
txtName.setTypeface(ResourcesCompat.getFont(txtName.getContext(), R.font.main_font_bold), Typeface.BOLD);
if (!G.isAppRtl) {
txtComment.setGravity(Gravity.RIGHT);
txtOpenComment.setRotation(90);
} else {
txtComment.setGravity(Gravity.LEFT);
txtOpenComment.setRotation(270);
}
txtClose.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
dialog.dismiss();
}
});
txtBack.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
txtBack.setVisibility(View.GONE);
txtClose.setVisibility(View.VISIBLE);
txtChat.setVisibility(View.VISIBLE);
if (isCallEnable) {
txtCall.setVisibility(View.VISIBLE);
}
if (isVideoCallEnable) {
txtVideoCall.setVisibility(View.VISIBLE);
}
txtOpenComment.setVisibility(View.VISIBLE);
txtComment.setMaxLines(1);
txtComment.setEllipsize(TextUtils.TruncateAt.END);
}
});
txtChat.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
dialog.dismiss();
HelperPublicMethod.goToChatRoom(userId, new HelperPublicMethod.OnComplete() {
@Override
public void complete() {
// new HelperFragment(mActivity.getSupportFragmentManager(),fragmentiGapMap).remove();
}
}, null);
}
});
txtCall.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
CallSelectFragment.call(userId, false, ProtoSignalingOffer.SignalingOffer.Type.VOICE_CALLING);
}
});
txtVideoCall.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
CallSelectFragment.call(userId, false, ProtoSignalingOffer.SignalingOffer.Type.VIDEO_CALLING);
}
});
txtComment.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if (hasComment && comment != null) {
txtClose.setVisibility(View.GONE);
txtChat.setVisibility(View.GONE);
txtCall.setVisibility(View.GONE);
txtVideoCall.setVisibility(View.GONE);
txtOpenComment.setVisibility(View.GONE);
txtBack.setVisibility(View.VISIBLE);
txtComment.setMaxLines(Integer.MAX_VALUE);
txtComment.setEllipsize(null);
}
}
});
txtOpenComment.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
txtComment.performClick();
}
});
avatarHandler.getAvatar(new ParamWithAvatarType(avatar, userId).avatarType(AvatarHandler.AvatarType.USER).showMain());
if (hasComment) {
G.onGeoGetComment = new OnGeoGetComment() {
@Override
public void onGetComment(long userId, final String commentR) {
comment = commentR;
G.handler.post(new Runnable() {
@Override
public void run() {
txtComment.setText(commentR);
}
});
}
};
txtComment.setText(G.fragmentActivity.getResources().getString(R.string.comment_waiting));
new RequestGeoGetComment().getComment(userId);
} else {
txtComment.setText(G.fragmentActivity.getResources().getString(R.string.comment_no));
}
// for show old comment
//
// RealmGeoNearbyDistance realmGeoNearbyDistance = realm.where(RealmGeoNearbyDistance.class).equalTo("userId", userId).findFirst();
// if (realmGeoNearbyDistance != null && hasComment) {
// if (realmGeoNearbyDistance.getComment() != null && !realmGeoNearbyDistance.getComment().isEmpty()) {
// txtComment.setText(realmGeoNearbyDistance.getComment());
// }
// }
//
// if (hasComment) {
// txtComment.setText(G.fragmentActivity.getResources().getString(R.string.comment_waiting));
// new RequestGeoGetComment().getComment(userId);
// } else {
// txtComment.setText(G.fragmentActivity.getResources().getString(R.string.comment_no));
// }
}
Aggregations