724 lines
31 KiB
Java
724 lines
31 KiB
Java
package com.ubt.jimu.user.view;
|
|
|
|
import android.content.Context;
|
|
import android.content.DialogInterface;
|
|
import android.content.Intent;
|
|
import android.graphics.ColorFilter;
|
|
import android.graphics.drawable.Drawable;
|
|
import android.os.Bundle;
|
|
import android.os.Handler;
|
|
import android.text.Editable;
|
|
import android.text.TextUtils;
|
|
import android.text.TextWatcher;
|
|
import android.util.Log;
|
|
import android.view.View;
|
|
import android.view.animation.LinearInterpolator;
|
|
import android.view.animation.RotateAnimation;
|
|
import android.widget.EditText;
|
|
import android.widget.ImageView;
|
|
import android.widget.TextView;
|
|
import androidx.fragment.app.FragmentActivity;
|
|
import butterknife.ButterKnife;
|
|
import com.alibaba.android.arouter.facade.Postcard;
|
|
import com.alibaba.android.arouter.launcher.ARouter;
|
|
import com.bumptech.glide.Glide;
|
|
import com.bumptech.glide.Priority;
|
|
import com.bumptech.glide.RequestBuilder;
|
|
import com.bumptech.glide.load.DataSource;
|
|
import com.bumptech.glide.load.engine.GlideException;
|
|
import com.bumptech.glide.request.RequestListener;
|
|
import com.bumptech.glide.request.RequestOptions;
|
|
import com.bumptech.glide.request.target.Target;
|
|
import com.google.gson.Gson;
|
|
import com.google.gson.reflect.TypeToken;
|
|
import com.ubt.jimu.BaseActivity;
|
|
import com.ubt.jimu.R;
|
|
import com.ubt.jimu.base.db.user.UserDbHandler;
|
|
import com.ubt.jimu.base.dialog.JimuSimpleDialog;
|
|
import com.ubt.jimu.base.entities.NSLocale;
|
|
import com.ubt.jimu.base.entities.PublishType;
|
|
import com.ubt.jimu.base.entities.User;
|
|
import com.ubt.jimu.base.entities.UserDetailInfo;
|
|
import com.ubt.jimu.base.event.MessageEvent;
|
|
import com.ubt.jimu.base.http.ApiResultException;
|
|
import com.ubt.jimu.base.http.IApiObserver;
|
|
import com.ubt.jimu.upload.DataUploadProxy;
|
|
import com.ubt.jimu.upload.SimpleUploadCallback;
|
|
import com.ubt.jimu.upload.UploadRequest;
|
|
import com.ubt.jimu.upload.UploadResponse;
|
|
import com.ubt.jimu.user.repository.UserRepository;
|
|
import com.ubt.jimu.utils.LocaleUtils;
|
|
import com.ubt.jimu.utils.LogUtils;
|
|
import com.ubt.jimu.utils.RxSchedulers;
|
|
import com.ubt.jimu.widgets.JAlertDialog;
|
|
import com.ubt.jimu.widgets.NavigationBarView;
|
|
import com.ubt.jimu.widgets.RoundedImageView;
|
|
import com.ubt.jimu.widgets.choosePhotos.AlbumActivity;
|
|
import com.ubt.jimu.widgets.choosePhotos.media.HPMedia;
|
|
import com.ubtech.permission.JimuPermissionRequest;
|
|
import com.ubtech.permission.PermissionRequestListener;
|
|
import com.ubtech.utils.XLog;
|
|
import io.reactivex.Observable;
|
|
import io.reactivex.ObservableEmitter;
|
|
import io.reactivex.ObservableOnSubscribe;
|
|
import io.reactivex.Observer;
|
|
import io.reactivex.android.schedulers.AndroidSchedulers;
|
|
import io.reactivex.disposables.CompositeDisposable;
|
|
import io.reactivex.disposables.Disposable;
|
|
import io.reactivex.schedulers.Schedulers;
|
|
import java.io.InputStream;
|
|
import java.io.InputStreamReader;
|
|
import java.nio.CharBuffer;
|
|
import java.util.ArrayList;
|
|
import java.util.HashMap;
|
|
import java.util.List;
|
|
import java.util.Locale;
|
|
import org.greenrobot.eventbus.EventBus;
|
|
|
|
/* loaded from: classes2.dex */
|
|
public class UserDetailInfoActivity extends BaseActivity {
|
|
private String a;
|
|
private CompositeDisposable b;
|
|
private UserDetailInfo c;
|
|
TextView countryTextView;
|
|
private String e;
|
|
TextView emailTextView;
|
|
private JAlertDialog g;
|
|
ImageView im_shield;
|
|
ImageView iv_camera;
|
|
ImageView iv_female;
|
|
ImageView iv_male;
|
|
ImageView iv_upload;
|
|
NavigationBarView navBarView;
|
|
EditText nickNameEditText;
|
|
RoundedImageView portraitImageView;
|
|
TextView telephoneTextView;
|
|
TextView tv_female;
|
|
TextView tv_male;
|
|
private int d = 1;
|
|
private Handler f = new Handler();
|
|
private boolean h = false;
|
|
|
|
private void D0() {
|
|
JimuSimpleDialog.buildSimpleDialog(this, getString(R.string.ok), getString(R.string.cancel), "", getString(R.string.activity_tip_quit_update_address), 17, new DialogInterface.OnClickListener() { // from class: com.ubt.jimu.user.view.r
|
|
@Override // android.content.DialogInterface.OnClickListener
|
|
public final void onClick(DialogInterface dialogInterface, int i) {
|
|
dialogInterface.dismiss();
|
|
}
|
|
}, new DialogInterface.OnClickListener() { // from class: com.ubt.jimu.user.view.p
|
|
@Override // android.content.DialogInterface.OnClickListener
|
|
public final void onClick(DialogInterface dialogInterface, int i) {
|
|
UserDetailInfoActivity.this.a(dialogInterface, i);
|
|
}
|
|
}).show();
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: private */
|
|
public boolean E0() {
|
|
boolean a = a(this.nickNameEditText.getText().toString(), this.telephoneTextView.getText().toString(), this.countryTextView.getText().toString(), this.emailTextView.getText().toString());
|
|
if (a) {
|
|
D0();
|
|
} else {
|
|
finish();
|
|
}
|
|
return a;
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: private */
|
|
public void F0() {
|
|
this.iv_upload.clearAnimation();
|
|
this.iv_upload.setVisibility(8);
|
|
this.h = false;
|
|
}
|
|
|
|
private List<NSLocale> G0() {
|
|
List<NSLocale> list;
|
|
ArrayList arrayList = new ArrayList();
|
|
InputStream inputStream = null;
|
|
try {
|
|
try {
|
|
try {
|
|
inputStream = getResources().openRawResource(R.raw.diallingcode);
|
|
InputStreamReader inputStreamReader = new InputStreamReader(inputStream);
|
|
CharBuffer allocate = CharBuffer.allocate(51200);
|
|
if (inputStreamReader.read(allocate) != 0) {
|
|
allocate.flip();
|
|
}
|
|
list = (List) new Gson().fromJson(allocate.toString(), new TypeToken<ArrayList<NSLocale>>(this) { // from class: com.ubt.jimu.user.view.UserDetailInfoActivity.12
|
|
}.getType());
|
|
} catch (Exception e) {
|
|
e.printStackTrace();
|
|
if (inputStream != null) {
|
|
inputStream.close();
|
|
}
|
|
}
|
|
} catch (Exception e2) {
|
|
e2.printStackTrace();
|
|
}
|
|
if (list != null && list.size() != 0) {
|
|
Locale e3 = LocaleUtils.e();
|
|
if (e3.getLanguage().equals(Locale.CHINA.getLanguage())) {
|
|
for (NSLocale nSLocale : list) {
|
|
nSLocale.setName(nSLocale.getChineseName());
|
|
}
|
|
} else if (e3.getLanguage().equals(Locale.ENGLISH.getLanguage())) {
|
|
for (NSLocale nSLocale2 : list) {
|
|
nSLocale2.setName(nSLocale2.getName());
|
|
}
|
|
} else {
|
|
for (NSLocale nSLocale3 : list) {
|
|
nSLocale3.setName(new Locale("", nSLocale3.getCode()).getDisplayCountry());
|
|
}
|
|
}
|
|
arrayList.addAll(list);
|
|
if (inputStream != null) {
|
|
inputStream.close();
|
|
}
|
|
return arrayList;
|
|
}
|
|
return arrayList;
|
|
} finally {
|
|
if (0 != 0) {
|
|
try {
|
|
inputStream.close();
|
|
} catch (Exception e4) {
|
|
e4.printStackTrace();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
private void H0() {
|
|
this.b = new CompositeDisposable();
|
|
UserRepository.c().compose(RxSchedulers.a()).subscribe(new IApiObserver<UserDetailInfo>(this) { // from class: com.ubt.jimu.user.view.UserDetailInfoActivity.3
|
|
@Override // com.ubt.jimu.base.http.IApiObserver, io.reactivex.Observer
|
|
/* renamed from: a, reason: merged with bridge method [inline-methods] */
|
|
public void onNext(UserDetailInfo userDetailInfo) {
|
|
super.onNext(userDetailInfo);
|
|
UserDetailInfoActivity.this.b(userDetailInfo);
|
|
}
|
|
|
|
@Override // com.ubt.jimu.base.http.IApiObserver
|
|
public void onApiError(ApiResultException apiResultException) {
|
|
}
|
|
|
|
@Override // com.ubt.jimu.base.http.IApiObserver, io.reactivex.Observer
|
|
public void onSubscribe(Disposable disposable) {
|
|
super.onSubscribe(disposable);
|
|
UserDetailInfoActivity.this.b.b(disposable);
|
|
}
|
|
});
|
|
}
|
|
|
|
private void I0() {
|
|
JAlertDialog.Builder builder = new JAlertDialog.Builder(this);
|
|
builder.a(R.drawable.ic_loading);
|
|
builder.a(true);
|
|
this.g = builder.a();
|
|
this.g.show();
|
|
}
|
|
|
|
private void J0() {
|
|
this.h = true;
|
|
this.iv_upload.setVisibility(0);
|
|
RotateAnimation rotateAnimation = new RotateAnimation(0.0f, 720.0f, 1, 0.5f, 1, 0.5f);
|
|
rotateAnimation.setInterpolator(new LinearInterpolator());
|
|
rotateAnimation.setDuration(1200L);
|
|
rotateAnimation.setRepeatCount(-1);
|
|
rotateAnimation.setRepeatMode(1);
|
|
this.iv_upload.startAnimation(rotateAnimation);
|
|
}
|
|
|
|
private void initView() {
|
|
this.navBarView.setListener(new NavigationBarView.OnActionClickListener.Stub() { // from class: com.ubt.jimu.user.view.UserDetailInfoActivity.1
|
|
@Override // com.ubt.jimu.widgets.NavigationBarView.OnActionClickListener.Stub
|
|
public void onLeftClick(View view) {
|
|
UserDetailInfoActivity.this.E0();
|
|
}
|
|
|
|
@Override // com.ubt.jimu.widgets.NavigationBarView.OnActionClickListener.Stub
|
|
public void onRightClick(View view) {
|
|
UserDetailInfoActivity userDetailInfoActivity = UserDetailInfoActivity.this;
|
|
if (userDetailInfoActivity.a(userDetailInfoActivity.nickNameEditText.getText().toString(), UserDetailInfoActivity.this.telephoneTextView.getText().toString(), UserDetailInfoActivity.this.countryTextView.getText().toString(), UserDetailInfoActivity.this.emailTextView.getText().toString())) {
|
|
UserDetailInfoActivity.this.a(view);
|
|
}
|
|
}
|
|
});
|
|
this.navBarView.setRightIcon(R.drawable.ic_nav_finish);
|
|
this.navBarView.setMode(0);
|
|
this.nickNameEditText.addTextChangedListener(new TextWatcher() { // from class: com.ubt.jimu.user.view.UserDetailInfoActivity.2
|
|
@Override // android.text.TextWatcher
|
|
public void afterTextChanged(Editable editable) {
|
|
TextUtils.isEmpty(editable);
|
|
}
|
|
|
|
@Override // android.text.TextWatcher
|
|
public void beforeTextChanged(CharSequence charSequence, int i, int i2, int i3) {
|
|
}
|
|
|
|
@Override // android.text.TextWatcher
|
|
public void onTextChanged(CharSequence charSequence, int i, int i2, int i3) {
|
|
String charSequence2 = charSequence.toString();
|
|
UserDetailInfoActivity userDetailInfoActivity = UserDetailInfoActivity.this;
|
|
if (userDetailInfoActivity.a(charSequence2, userDetailInfoActivity.telephoneTextView.getText().toString(), UserDetailInfoActivity.this.countryTextView.getText().toString(), UserDetailInfoActivity.this.emailTextView.getText().toString())) {
|
|
UserDetailInfoActivity.this.navBarView.setMode(1);
|
|
} else {
|
|
UserDetailInfoActivity.this.navBarView.setMode(0);
|
|
}
|
|
}
|
|
});
|
|
}
|
|
|
|
public static void start(Context context) {
|
|
context.startActivity(new Intent(context, (Class<?>) UserDetailInfoActivity.class));
|
|
}
|
|
|
|
@Override // androidx.fragment.app.FragmentActivity, android.app.Activity
|
|
protected void onActivityResult(int i, int i2, Intent intent) {
|
|
List list;
|
|
super.onActivityResult(i, i2, intent);
|
|
if (i2 != -1) {
|
|
return;
|
|
}
|
|
if (i == 1) {
|
|
this.a = intent.getStringExtra("country_code");
|
|
this.countryTextView.setText(intent.getStringExtra("country_name"));
|
|
if (a(this.nickNameEditText.getText().toString(), this.telephoneTextView.getText().toString(), this.countryTextView.getText().toString(), this.emailTextView.getText().toString())) {
|
|
this.navBarView.setMode(1);
|
|
return;
|
|
} else {
|
|
this.navBarView.setMode(0);
|
|
return;
|
|
}
|
|
}
|
|
if (i == 2) {
|
|
String stringExtra = intent.getStringExtra("new_email");
|
|
this.emailTextView.setText(stringExtra);
|
|
if (a(this.nickNameEditText.getText().toString(), this.telephoneTextView.getText().toString(), this.countryTextView.getText().toString(), stringExtra)) {
|
|
this.navBarView.setMode(1);
|
|
return;
|
|
} else {
|
|
this.navBarView.setMode(0);
|
|
return;
|
|
}
|
|
}
|
|
if (i != 3) {
|
|
if (i == 4 || i != 5 || (list = (List) intent.getSerializableExtra("result_data")) == null || list.size() <= 0) {
|
|
return;
|
|
}
|
|
a((HPMedia) list.get(0));
|
|
return;
|
|
}
|
|
String stringExtra2 = intent.getStringExtra("new_telephone");
|
|
this.telephoneTextView.setText(stringExtra2);
|
|
if (a(this.nickNameEditText.getText().toString(), stringExtra2, this.countryTextView.getText().toString(), this.emailTextView.getText().toString())) {
|
|
this.navBarView.setMode(1);
|
|
} else {
|
|
this.navBarView.setMode(0);
|
|
}
|
|
}
|
|
|
|
@Override // androidx.fragment.app.FragmentActivity, android.app.Activity
|
|
public void onBackPressed() {
|
|
if (E0()) {
|
|
return;
|
|
}
|
|
super.onBackPressed();
|
|
}
|
|
|
|
public void onCountryAction(View view) {
|
|
String charSequence = this.countryTextView.getText().toString();
|
|
String substring = (TextUtils.isEmpty(charSequence) || !charSequence.contains("+")) ? null : charSequence.substring(charSequence.indexOf("+"));
|
|
Postcard a = ARouter.b().a("/account/countrycode");
|
|
a.a("selected_code", substring);
|
|
a.a(this, 1);
|
|
}
|
|
|
|
@Override // com.ubt.jimu.BaseActivity, com.ubt.jimu.ScreenRotationManageActivity, androidx.appcompat.app.AppCompatActivity, androidx.fragment.app.FragmentActivity, androidx.core.app.ComponentActivity, android.app.Activity
|
|
protected void onCreate(Bundle bundle) {
|
|
super.onCreate(bundle);
|
|
setContentView(R.layout.activity_user_detail_info);
|
|
ButterKnife.a(this);
|
|
initView();
|
|
H0();
|
|
}
|
|
|
|
@Override // com.ubt.jimu.BaseActivity, com.ubt.jimu.ScreenRotationManageActivity, androidx.appcompat.app.AppCompatActivity, androidx.fragment.app.FragmentActivity, android.app.Activity
|
|
protected void onDestroy() {
|
|
this.f.removeCallbacksAndMessages(null);
|
|
super.onDestroy();
|
|
CompositeDisposable compositeDisposable = this.b;
|
|
if (compositeDisposable != null) {
|
|
compositeDisposable.dispose();
|
|
this.b.a();
|
|
}
|
|
}
|
|
|
|
public void onEmailAction(View view) {
|
|
Intent intent = new Intent(this, (Class<?>) EmailUpdateActivity.class);
|
|
if (!TextUtils.isEmpty(this.emailTextView.getText().toString())) {
|
|
intent.putExtra("user_email", this.emailTextView.getText().toString());
|
|
}
|
|
startActivityForResult(intent, 2);
|
|
}
|
|
|
|
public void onFemaleRadioAction(View view) {
|
|
this.iv_female.setBackgroundResource(R.drawable.ic_girl);
|
|
this.iv_male.setBackgroundResource(R.drawable.ic_boy_checked);
|
|
this.tv_female.setTextColor(getResources().getColor(R.color.theme_input_txt));
|
|
this.tv_male.setTextColor(getResources().getColor(R.color.bg_FFAD42));
|
|
this.d = 1;
|
|
if (a(this.nickNameEditText.getText().toString(), this.telephoneTextView.getText().toString(), this.countryTextView.getText().toString(), this.emailTextView.getText().toString())) {
|
|
this.navBarView.setMode(1);
|
|
} else {
|
|
this.navBarView.setMode(0);
|
|
}
|
|
}
|
|
|
|
public void onMaleRadioAction(View view) {
|
|
this.tv_female.setTextColor(getResources().getColor(R.color.bg_FFAD42));
|
|
this.tv_male.setTextColor(getResources().getColor(R.color.theme_input_txt));
|
|
this.iv_female.setBackgroundResource(R.drawable.ic_girl_checked);
|
|
this.iv_male.setBackgroundResource(R.drawable.ic_boy);
|
|
this.d = 2;
|
|
if (a(this.nickNameEditText.getText().toString(), this.telephoneTextView.getText().toString(), this.countryTextView.getText().toString(), this.emailTextView.getText().toString())) {
|
|
this.navBarView.setMode(1);
|
|
} else {
|
|
this.navBarView.setMode(0);
|
|
}
|
|
}
|
|
|
|
public void onTelephoneAction(View view) {
|
|
Intent intent = new Intent(this, (Class<?>) TelephoneUpdateActivity.class);
|
|
if (!TextUtils.isEmpty(this.telephoneTextView.getText().toString())) {
|
|
intent.putExtra("user_phone", this.telephoneTextView.getText().toString());
|
|
}
|
|
UserDetailInfo userDetailInfo = this.c;
|
|
if (userDetailInfo != null && !TextUtils.isEmpty(userDetailInfo.getCountryCode())) {
|
|
intent.putExtra("user_code", this.c.getCountryCode());
|
|
}
|
|
startActivityForResult(intent, 3);
|
|
}
|
|
|
|
public void onUserPortraitAction(View view) {
|
|
JimuPermissionRequest.c(this, new PermissionRequestListener() { // from class: com.ubt.jimu.user.view.UserDetailInfoActivity.5
|
|
@Override // com.ubtech.permission.PermissionRequestListener
|
|
public void onDenied() {
|
|
}
|
|
|
|
@Override // com.ubtech.permission.PermissionRequestListener
|
|
public void onGranted() {
|
|
AlbumActivity.a(UserDetailInfoActivity.this, 5, 1, null, 1, "UNITERMING_IMAGE");
|
|
}
|
|
});
|
|
}
|
|
|
|
@Override // com.ubt.jimu.BaseActivity
|
|
public void relayout() {
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: private */
|
|
public void c(UserDetailInfo userDetailInfo) {
|
|
if (userDetailInfo == null) {
|
|
return;
|
|
}
|
|
User user = UserDbHandler.getUser();
|
|
user.setNickName(userDetailInfo.getNickName());
|
|
user.setUserImage(userDetailInfo.getUserImage());
|
|
user.setEmail(userDetailInfo.getUserEmail());
|
|
user.setCountry(userDetailInfo.getCountryName());
|
|
user.setCountryCode(userDetailInfo.getCountryCode());
|
|
user.setGender(String.valueOf(userDetailInfo.getUserGender()));
|
|
UserDbHandler.save(user);
|
|
this.f.postDelayed(new Runnable() { // from class: com.ubt.jimu.user.view.UserDetailInfoActivity.8
|
|
@Override // java.lang.Runnable
|
|
public void run() {
|
|
if (UserDetailInfoActivity.this.g != null) {
|
|
UserDetailInfoActivity.this.g.dismiss();
|
|
}
|
|
UserDetailInfoActivity userDetailInfoActivity = UserDetailInfoActivity.this;
|
|
userDetailInfoActivity.toastSuccess(userDetailInfoActivity.getString(R.string.update_success));
|
|
EventBus.b().b(new MessageEvent(6));
|
|
UserDetailInfoActivity.this.finish();
|
|
}
|
|
}, 1500L);
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: private */
|
|
public void b(UserDetailInfo userDetailInfo) {
|
|
if (userDetailInfo == null) {
|
|
return;
|
|
}
|
|
this.c = userDetailInfo;
|
|
this.d = userDetailInfo.getUserGender();
|
|
if (userDetailInfo.getUserGender() == 1) {
|
|
this.iv_female.setBackgroundResource(R.drawable.ic_girl);
|
|
this.iv_male.setBackgroundResource(R.drawable.ic_boy_checked);
|
|
} else {
|
|
this.iv_female.setBackgroundResource(R.drawable.ic_girl_checked);
|
|
this.iv_male.setBackgroundResource(R.drawable.ic_boy);
|
|
}
|
|
RequestOptions a = new RequestOptions().b().b(R.drawable.default_photo).a(R.drawable.default_photo).a(Priority.HIGH);
|
|
this.im_shield.setVisibility(8);
|
|
RequestBuilder<Drawable> a2 = Glide.a((FragmentActivity) this).a(userDetailInfo.getUserImage());
|
|
a2.a(a);
|
|
a2.a(new RequestListener<Drawable>() { // from class: com.ubt.jimu.user.view.UserDetailInfoActivity.4
|
|
@Override // com.bumptech.glide.request.RequestListener
|
|
public boolean a(GlideException glideException, Object obj, Target<Drawable> target, boolean z) {
|
|
UserDetailInfoActivity.this.iv_upload.setVisibility(8);
|
|
UserDetailInfoActivity.this.im_shield.setVisibility(0);
|
|
return false;
|
|
}
|
|
|
|
@Override // com.bumptech.glide.request.RequestListener
|
|
public boolean a(Drawable drawable, Object obj, Target<Drawable> target, DataSource dataSource, boolean z) {
|
|
LogUtils.c("加载成功");
|
|
UserDetailInfoActivity.this.im_shield.setVisibility(8);
|
|
UserDetailInfoActivity.this.iv_upload.setVisibility(8);
|
|
UserDetailInfoActivity.this.iv_camera.setVisibility(8);
|
|
return false;
|
|
}
|
|
});
|
|
a2.a((ImageView) this.portraitImageView);
|
|
a(userDetailInfo);
|
|
this.emailTextView.setText(userDetailInfo.getUserEmail());
|
|
this.telephoneTextView.setText(userDetailInfo.getUserPhone());
|
|
this.nickNameEditText.setText(userDetailInfo.getNickName());
|
|
EditText editText = this.nickNameEditText;
|
|
editText.setSelection(editText.getText().toString().length());
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: private */
|
|
public boolean a(String str, String str2, String str3, String str4) {
|
|
if (this.c == null) {
|
|
return false;
|
|
}
|
|
if (!TextUtils.isEmpty(this.e)) {
|
|
return true;
|
|
}
|
|
if (TextUtils.isEmpty(this.c.getNickName())) {
|
|
if (!TextUtils.isEmpty(str)) {
|
|
return true;
|
|
}
|
|
} else if (this.c.getNickName().length() <= 16) {
|
|
if (!this.c.getNickName().equals(str)) {
|
|
return true;
|
|
}
|
|
} else if (!this.c.getNickName().startsWith(str)) {
|
|
return true;
|
|
}
|
|
if (TextUtils.isEmpty(this.c.getUserPhone())) {
|
|
if (!TextUtils.isEmpty(str2)) {
|
|
return true;
|
|
}
|
|
} else if (!this.c.getUserPhone().equals(str2)) {
|
|
return true;
|
|
}
|
|
if (TextUtils.isEmpty(this.c.getCountryName())) {
|
|
if (!TextUtils.isEmpty(str3)) {
|
|
return true;
|
|
}
|
|
} else if (!this.c.getCountryName().equals(str3)) {
|
|
return true;
|
|
}
|
|
if (TextUtils.isEmpty(this.c.getUserEmail())) {
|
|
if (!TextUtils.isEmpty(str4)) {
|
|
return true;
|
|
}
|
|
} else if (!this.c.getUserEmail().equals(str4)) {
|
|
return true;
|
|
}
|
|
return this.d != this.c.getUserGender();
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: private */
|
|
public void a(View view) {
|
|
if (this.c == null) {
|
|
XLog.d(this.TAG, "cache info is null. may be should wait for network", new Object[0]);
|
|
return;
|
|
}
|
|
if (this.h) {
|
|
toastError(getString(R.string.status_uploading));
|
|
return;
|
|
}
|
|
String trim = this.nickNameEditText.getText().toString().trim();
|
|
if (TextUtils.isEmpty(trim)) {
|
|
toastError(getString(R.string.error_empty_nick_name));
|
|
return;
|
|
}
|
|
String trim2 = this.countryTextView.getText().toString().trim();
|
|
if (TextUtils.isEmpty(trim2)) {
|
|
toastError(getString(R.string.error_empty_country));
|
|
return;
|
|
}
|
|
I0();
|
|
HashMap hashMap = new HashMap();
|
|
if (!trim.equals(this.c.getNickName())) {
|
|
hashMap.put("nickName", trim);
|
|
}
|
|
if (this.d != this.c.getUserGender()) {
|
|
hashMap.put("userGender", String.valueOf(this.d));
|
|
}
|
|
if (!trim2.equals(this.c.getCountryName())) {
|
|
hashMap.put("countryName", trim2);
|
|
}
|
|
if (!TextUtils.isEmpty(this.e)) {
|
|
hashMap.put("userImage", this.e);
|
|
}
|
|
if (!TextUtils.isEmpty(this.a) && !this.a.equals(this.c.getCountryCode())) {
|
|
hashMap.put("countryCode", this.a);
|
|
}
|
|
UserRepository.b(hashMap).compose(RxSchedulers.a()).subscribe(new IApiObserver<UserDetailInfo>(this) { // from class: com.ubt.jimu.user.view.UserDetailInfoActivity.6
|
|
@Override // com.ubt.jimu.base.http.IApiObserver, io.reactivex.Observer
|
|
/* renamed from: a, reason: merged with bridge method [inline-methods] */
|
|
public void onNext(UserDetailInfo userDetailInfo) {
|
|
super.onNext(userDetailInfo);
|
|
UserDetailInfoActivity.this.c(userDetailInfo);
|
|
}
|
|
|
|
@Override // com.ubt.jimu.base.http.IApiObserver
|
|
public void onApiError(ApiResultException apiResultException) {
|
|
UserDetailInfoActivity.this.a(apiResultException);
|
|
}
|
|
|
|
@Override // com.ubt.jimu.base.http.IApiObserver, io.reactivex.Observer
|
|
public void onComplete() {
|
|
super.onComplete();
|
|
}
|
|
|
|
@Override // com.ubt.jimu.base.http.IApiObserver, io.reactivex.Observer
|
|
public void onSubscribe(Disposable disposable) {
|
|
super.onSubscribe(disposable);
|
|
UserDetailInfoActivity.this.b.b(disposable);
|
|
}
|
|
});
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: private */
|
|
public void a(ApiResultException apiResultException) {
|
|
JAlertDialog jAlertDialog = this.g;
|
|
if (jAlertDialog != null) {
|
|
jAlertDialog.a(apiResultException.getMessage());
|
|
}
|
|
this.f.postDelayed(new Runnable() { // from class: com.ubt.jimu.user.view.UserDetailInfoActivity.7
|
|
@Override // java.lang.Runnable
|
|
public void run() {
|
|
if (UserDetailInfoActivity.this.g != null) {
|
|
UserDetailInfoActivity.this.g.dismiss();
|
|
}
|
|
}
|
|
}, 1500L);
|
|
}
|
|
|
|
private void a(HPMedia hPMedia) {
|
|
Log.i("UserDetailInfoActivity:", hPMedia.toString());
|
|
this.portraitImageView.setColorFilter((ColorFilter) null);
|
|
RequestBuilder<Drawable> a = Glide.a((FragmentActivity) this).a(hPMedia.getPath());
|
|
a.a(new RequestListener<Drawable>() { // from class: com.ubt.jimu.user.view.UserDetailInfoActivity.9
|
|
@Override // com.bumptech.glide.request.RequestListener
|
|
public boolean a(GlideException glideException, Object obj, Target<Drawable> target, boolean z) {
|
|
UserDetailInfoActivity.this.iv_upload.setVisibility(8);
|
|
UserDetailInfoActivity.this.im_shield.setVisibility(0);
|
|
return false;
|
|
}
|
|
|
|
@Override // com.bumptech.glide.request.RequestListener
|
|
public boolean a(Drawable drawable, Object obj, Target<Drawable> target, DataSource dataSource, boolean z) {
|
|
UserDetailInfoActivity.this.im_shield.setVisibility(8);
|
|
UserDetailInfoActivity.this.iv_upload.setVisibility(8);
|
|
return false;
|
|
}
|
|
});
|
|
a.a((ImageView) this.portraitImageView);
|
|
this.iv_camera.setVisibility(8);
|
|
J0();
|
|
UploadRequest uploadRequest = new UploadRequest();
|
|
uploadRequest.a(hPMedia.getDisplayName());
|
|
uploadRequest.b(hPMedia.getPath());
|
|
uploadRequest.a(PublishType.IMAGE);
|
|
DataUploadProxy.c().a(uploadRequest, new SimpleUploadCallback() { // from class: com.ubt.jimu.user.view.UserDetailInfoActivity.10
|
|
@Override // com.ubt.jimu.upload.IUploadCallback
|
|
public void uploadFaulted(UploadRequest uploadRequest2, Exception exc) {
|
|
LogUtils.c("上传失败:" + Thread.currentThread().getName());
|
|
UserDetailInfoActivity userDetailInfoActivity = UserDetailInfoActivity.this;
|
|
userDetailInfoActivity.toastError(userDetailInfoActivity.getString(R.string.upload_portrait_fail));
|
|
UserDetailInfoActivity.this.F0();
|
|
}
|
|
|
|
@Override // com.ubt.jimu.upload.IUploadCallback
|
|
public void uploadSucceed(UploadResponse uploadResponse) {
|
|
LogUtils.c("上传成功:" + Thread.currentThread().getName());
|
|
UserDetailInfoActivity.this.e = uploadResponse.c();
|
|
UserDetailInfoActivity.this.navBarView.post(new Runnable() { // from class: com.ubt.jimu.user.view.UserDetailInfoActivity.10.1
|
|
@Override // java.lang.Runnable
|
|
public void run() {
|
|
LogUtils.c("111111111");
|
|
UserDetailInfoActivity.this.navBarView.setMode(1);
|
|
UserDetailInfoActivity.this.F0();
|
|
}
|
|
});
|
|
}
|
|
});
|
|
}
|
|
|
|
public /* synthetic */ void a(DialogInterface dialogInterface, int i) {
|
|
dialogInterface.dismiss();
|
|
finish();
|
|
}
|
|
|
|
private void a(final UserDetailInfo userDetailInfo) {
|
|
if (userDetailInfo == null) {
|
|
return;
|
|
}
|
|
if (!TextUtils.isEmpty(userDetailInfo.getCountryName())) {
|
|
this.countryTextView.setText(userDetailInfo.getCountryName());
|
|
} else {
|
|
if (TextUtils.isEmpty(userDetailInfo.getCountryCode())) {
|
|
return;
|
|
}
|
|
Observable.create(new ObservableOnSubscribe() { // from class: com.ubt.jimu.user.view.q
|
|
@Override // io.reactivex.ObservableOnSubscribe
|
|
public final void subscribe(ObservableEmitter observableEmitter) {
|
|
UserDetailInfoActivity.this.a(observableEmitter);
|
|
}
|
|
}).subscribeOn(Schedulers.b()).observeOn(AndroidSchedulers.a()).subscribe(new Observer<List<NSLocale>>() { // from class: com.ubt.jimu.user.view.UserDetailInfoActivity.11
|
|
@Override // io.reactivex.Observer
|
|
/* renamed from: a, reason: merged with bridge method [inline-methods] */
|
|
public void onNext(List<NSLocale> list) {
|
|
if (list == null || list.size() == 0) {
|
|
UserDetailInfoActivity.this.countryTextView.setText(userDetailInfo.getCountryName());
|
|
return;
|
|
}
|
|
for (NSLocale nSLocale : list) {
|
|
if (nSLocale.getCode().equals(userDetailInfo.getCountryCode())) {
|
|
String name = nSLocale.getName();
|
|
if (LocaleUtils.f()) {
|
|
name = nSLocale.getChineseName();
|
|
}
|
|
UserDetailInfoActivity.this.countryTextView.setText(name);
|
|
return;
|
|
}
|
|
}
|
|
}
|
|
|
|
@Override // io.reactivex.Observer
|
|
public void onComplete() {
|
|
}
|
|
|
|
@Override // io.reactivex.Observer
|
|
public void onError(Throwable th) {
|
|
}
|
|
|
|
@Override // io.reactivex.Observer
|
|
public void onSubscribe(Disposable disposable) {
|
|
}
|
|
});
|
|
}
|
|
}
|
|
|
|
public /* synthetic */ void a(ObservableEmitter observableEmitter) throws Exception {
|
|
observableEmitter.onNext(G0());
|
|
observableEmitter.onComplete();
|
|
}
|
|
}
|