Kate Mobile v109.1版本的 MD5 值为:fcd76ded5f363ecbfac46035a4ed2a23
以下内容为反编译后的 ProfileInfoFragment.java 源代码,内容仅作参考
package com.perm.kate;
import android.app.Activity;
import android.content.DialogInterface;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.os.Handler;
import android.text.SpannableString;
import android.text.SpannableStringBuilder;
import android.text.TextPaint;
import android.text.TextUtils;
import android.text.style.ImageSpan;
import android.text.style.StyleSpan;
import android.text.style.URLSpan;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import androidx.appcompat.app.AlertDialog;
import com.perm.kate.AudioClickHelper;
import com.perm.kate.BlackListActivity;
import com.perm.kate.api.Audio;
import com.perm.kate.api.City;
import com.perm.kate.api.Country;
import com.perm.kate.api.Photo;
import com.perm.kate.api.User;
import com.perm.kate.db.DataHelper;
import com.perm.kate.history.History;
import com.perm.kate.photoupload.AvatarUploader;
import com.perm.kate.photoupload.PhotoChooser;
import com.perm.kate.photoupload.UploadCallback;
import com.perm.kate.session.Callback;
import com.perm.kate.session.Session;
import com.perm.kate.theme.ThemeColorsHelper;
import com.perm.utils.FriendsListsHelper;
import com.perm.utils.OnlineNotificationsHelper;
import com.perm.utils.RegistrationDate;
import com.perm.utils.SmileHelper;
import com.perm.utils.WallSubscriptions;
import java.util.ArrayList;
public class ProfileInfoFragment extends BaseFragment {
private LinearLayout add_friend_region;
private Integer blacklisted_by_me;
private Integer can_write_private_message;
private String city;
private String country;
private ImageView coverView;
private ImageView imv_profile_info_user_photo;
private Integer is_favorite;
private boolean is_me;
ProfileActivityCallback listener;
private LinearLayout ll_profile_edit_region;
private LinearLayout ll_profile_education_region;
private LinearLayout ll_profile_place_region;
public String relation_partner_first_name;
public Long relation_partner_id;
public String relation_partner_last_name;
private LinearLayout replies_region;
private Audio status_audio;
private TextView tv_profile_info_birthday;
private TextView tv_profile_info_country;
private TextView tv_profile_info_id;
private TextView tv_profile_info_rate;
private TextView tv_profile_info_relation;
private TextView tv_profile_info_sex;
private TextView tv_profile_info_university;
private TextView tv_profile_info_user_name;
private User u;
Long uid;
private String uid_str;
private boolean is_follower = false;
String deactivated = null;
final Callback callback_city = new Callback(getActivity()) {
@Override
public void ready(Object obj) {
ArrayList arrayList = (ArrayList) obj;
if (arrayList == null || arrayList.size() <= 0) {
return;
}
ProfileInfoFragment.this.city = ((City) arrayList.get(0)).name;
KApplication.db.createCity(ProfileInfoFragment.this.u.city.intValue(), ProfileInfoFragment.this.city);
ProfileInfoFragment.this.displayUserOnUiThread();
}
};
final Callback callback_country = new Callback(getActivity()) {
@Override
public void ready(Object obj) {
ArrayList arrayList = (ArrayList) obj;
if (arrayList == null || arrayList.size() <= 0) {
return;
}
ProfileInfoFragment.this.country = ((Country) arrayList.get(0)).name;
KApplication.db.createCountry(ProfileInfoFragment.this.u.country.intValue(), ProfileInfoFragment.this.country);
ProfileInfoFragment.this.displayUserOnUiThread();
}
};
private final View.OnClickListener photoClick = new View.OnClickListener() {
@Override
public void onClick(View view) {
ProfileInfoFragment.this.showAvatarDialog();
}
};
private final View.OnClickListener Edit_ClickListener = new View.OnClickListener() {
@Override
public void onClick(View view) {
ProfileInfoFragment.this.showOptionsDialog();
}
};
private final View.OnClickListener statusClickListener = new View.OnClickListener() {
@Override
public void onClick(View view) {
if (ProfileInfoFragment.this.is_me && ProfileInfoFragment.this.status_audio == null) {
ProfileInfoFragment.this.showStatusAcivity();
} else if (ProfileInfoFragment.this.status_audio != null) {
ArrayList arrayList = new ArrayList();
arrayList.add(ProfileInfoFragment.this.status_audio);
new AudioClickHelper((BaseActivity) ProfileInfoFragment.this.getActivity(), null).CreateContextMenu(ProfileInfoFragment.this.status_audio, false, arrayList, false, 10);
} else if (ProfileInfoFragment.this.u == null || ProfileInfoFragment.this.u.status == null || ProfileInfoFragment.this.u.status.equals("")) {
} else {
Helper.createCopyTextContextMenu(ProfileInfoFragment.this.u.status, ProfileInfoFragment.this.getActivity());
}
}
};
private final Callback avatars_photos_callback = new Callback(getActivity()) {
@Override
public void ready(Object obj) {
ArrayList arrayList = (ArrayList) obj;
long parseLong = Long.parseLong(KApplication.session.getMid());
KApplication.db.deleteAlbumPhotos(-6L, ProfileInfoFragment.this.uid.longValue());
KApplication.db.createOrUpdatePhotos(arrayList, parseLong);
KApplication.db.createAlbumPhotos(arrayList, -6L, ProfileInfoFragment.this.uid.longValue());
}
};
private final View.OnClickListener repliesClickListener = new View.OnClickListener() {
@Override
public void onClick(View view) {
ProfileInfoFragment.this.showMessageThread();
}
};
private final View.OnClickListener friendClickListener = new View.OnClickListener() {
@Override
public void onClick(View view) {
if (ProfileInfoFragment.this.isFriend()) {
ProfileInfoFragment.this.showDeleteDialog();
} else {
ProfileInfoFragment.this.showAddDialog();
}
}
};
private final Callback delete_friend_callback = new Callback(getActivity()) {
@Override
public void error(Throwable th) {
ProfileInfoFragment.this.showProgressBar(false);
super.error(th);
}
@Override
public void ready(Object obj) {
ProfileInfoFragment.this.showProgressBar(false);
Long l = (Long) obj;
if (l.longValue() == 1) {
KApplication.db.deleteFriend(Long.parseLong(KApplication.session.getMid()), ProfileInfoFragment.this.uid.longValue());
ProfileInfoFragment.this.displayToast(R.string.done);
ProfileInfoFragment.this.displayFriendStatusOnUiThread();
} else if (l.longValue() == 2) {
ProfileInfoFragment.this.displayToast(R.string.toast_you_canceled_friend_request);
ProfileInfoFragment.this.is_follower = false;
ProfileInfoFragment.this.displayFriendStatusOnUiThread2(0);
}
}
};
private final Callback add_friend_callback = new Callback(getActivity()) {
@Override
public void error(Throwable th) {
ProfileInfoFragment.this.showProgressBar(false);
super.error(th);
}
@Override
public void ready(Object obj) {
ProfileInfoFragment.this.showProgressBar(false);
if (((Long) obj).longValue() == 1) {
ProfileInfoFragment.this.displayToast(R.string.friend_request_sent);
}
}
};
private final PhotoChooser.Callback photoChooserCallback = new PhotoChooser.Callback() {
@Override
public void canceled() {
}
@Override
public void selected(ArrayList arrayList) {
ProfileInfoFragment.this.editPhotoBeforeUpload(arrayList);
}
@Override
public void selectedFromAlbum(ArrayList arrayList) {
}
};
protected final UploadCallback uploadCallback = new UploadCallback() {
@Override
public void success(ArrayList arrayList) {
ProfileInfoFragment.this.listener.onAvatarChanged();
}
};
private final View.OnClickListener relation_partner_ClickListener = new View.OnClickListener() {
@Override
public void onClick(View view) {
Long l = (Long) view.getTag();
if (l != null) {
Helper.ShowProfile(String.valueOf(l), ProfileInfoFragment.this.getActivity());
}
}
};
private final View.OnClickListener profileIdClickListener = new View.OnClickListener() {
@Override
public void onClick(View view) {
TextView textView = (TextView) view;
if (textView != null) {
Helper.createCopyTextContextMenu(textView.getText().toString(), ProfileInfoFragment.this.getActivity());
}
}
};
private final Callback is_friend_callback = new Callback(getActivity()) {
@Override
public void ready(Object obj) {
Integer num = (Integer) obj;
if (num != null) {
ProfileInfoFragment.this.is_follower = num.intValue() == 1;
if (num.intValue() == 3) {
long parseLong = Long.parseLong(KApplication.session.getMid());
if (!KApplication.db.isFriend(parseLong, ProfileInfoFragment.this.uid.longValue())) {
KApplication.db.createFriend(parseLong, ProfileInfoFragment.this.uid.longValue());
}
}
ProfileInfoFragment.this.displayFriendStatusOnUiThread2(num.intValue());
}
}
};
static class AudioClickHelper extends com.perm.kate.AudioClickHelper {
public AudioClickHelper(BaseActivity baseActivity, AudioClickHelper.AudioClickHelperCallback audioClickHelperCallback) {
super(baseActivity, audioClickHelperCallback);
}
}
public static class URLSpanNoUnderline extends URLSpan {
public URLSpanNoUnderline(String str) {
super(str);
}
@Override
public void updateDrawState(TextPaint textPaint) {
super.updateDrawState(textPaint);
textPaint.setUnderlineText(false);
}
}
public void addFriend(final String str) {
showProgressBar(true);
new Thread() {
@Override
public void run() {
Session session = KApplication.session;
ProfileInfoFragment profileInfoFragment = ProfileInfoFragment.this;
session.addFriend(profileInfoFragment.uid, str, profileInfoFragment.add_friend_callback, ProfileInfoFragment.this.getActivity());
}
}.start();
}
private void addToBlackList() {
BlackListActivity.AddToBlackList(this.uid_str, getActivity(), new BlackListActivity.BlackListCallback() {
@Override
public void onCompleted(boolean z) {
if (z) {
ProfileInfoFragment.this.blacklisted_by_me = 1;
}
}
});
}
private void checkDeactivated(String str) {
if (Helper.empty(str)) {
return;
}
if ("deleted".equals(str)) {
displayToast(R.string.toast_profile_deleted);
} else if ("banned".equals(str)) {
displayToast(R.string.toast_profile_banned);
}
}
public void deleteFriend() {
showProgressBar(true);
new Thread() {
@Override
public void run() {
Session session = KApplication.session;
ProfileInfoFragment profileInfoFragment = ProfileInfoFragment.this;
session.deleteFriend(profileInfoFragment.uid, profileInfoFragment.delete_friend_callback, ProfileInfoFragment.this.getActivity());
}
}.start();
}
private void displayCity(User user) {
String str = this.city;
if (str != null) {
if (this.country != null) {
TextView textView = this.tv_profile_info_country;
textView.setText(this.country + ", " + this.city);
} else {
this.tv_profile_info_country.setText(str);
}
setVisiblePlaceRegion(true);
}
}
private void displayCountry(User user) {
String str = this.country;
if (str != null) {
if (this.city != null) {
TextView textView = this.tv_profile_info_country;
textView.setText(this.country + ", " + this.city);
} else {
this.tv_profile_info_country.setText(str);
}
setVisiblePlaceRegion(true);
}
}
public void displayFriendStatus(View view) {
if (isFriend()) {
this.add_friend_region.setVisibility(8);
} else {
this.add_friend_region.setVisibility(0);
}
}
public void displayFriendStatus2(View view, int i) {
if (i == 0 || i == 2) {
this.add_friend_region.setVisibility(0);
} else {
this.add_friend_region.setVisibility(8);
}
if (view != null) {
LinearLayout linearLayout = (LinearLayout) view.findViewById(R.id.ll_profile_friend_status);
TextView textView = (TextView) view.findViewById(R.id.tv_profile_friends_status);
if (i != 1 && i != 2) {
linearLayout.setVisibility(8);
return;
}
linearLayout.setVisibility(0);
textView.setText(i == 1 ? R.string.label_you_are_following : R.string.label_following_you);
}
}
public void displayFriendStatusOnUiThread() {
if (getActivity() == null) {
return;
}
getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
ProfileInfoFragment profileInfoFragment = ProfileInfoFragment.this;
profileInfoFragment.displayFriendStatus(profileInfoFragment.getView());
}
});
}
public void displayFriendStatusOnUiThread2(final int i) {
if (getActivity() == null) {
return;
}
getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
ProfileInfoFragment profileInfoFragment = ProfileInfoFragment.this;
profileInfoFragment.displayFriendStatus2(profileInfoFragment.getView(), i);
}
});
}
public void displayUser(User user, View view) {
TextView textView;
String str;
if (view == null || (textView = this.tv_profile_info_id) == null) {
return;
}
textView.setText("id: " + this.uid_str);
if (user == null) {
return;
}
Integer num = user.sex;
boolean z = num == null || num.intValue() == 2;
if (user.online.booleanValue()) {
((TextView) view.findViewById(R.id.online)).setText(R.string.online);
view.findViewById(R.id.mobile_online).setVisibility((user.online_mobile.booleanValue() && user.online.booleanValue()) ? 0 : 8);
view.findViewById(R.id.bullet).setVisibility((user.online_mobile.booleanValue() || !user.online.booleanValue()) ? 8 : 0);
} else {
if (user.last_seen > 0) {
((TextView) view.findViewById(R.id.online)).setText(Helper.getLastSee(getActivity(), user.last_seen, z, user.online_mobile.booleanValue()));
} else {
((TextView) view.findViewById(R.id.online)).setText(R.string.offline);
}
view.findViewById(R.id.bullet).setVisibility(8);
view.findViewById(R.id.mobile_online).setVisibility(8);
}
String str2 = user.photo_200;
if (TextUtils.isEmpty(str2)) {
str2 = user.photo_big;
}
KApplication.getImageLoader().DisplayImage(str2, this.imv_profile_info_user_photo, true, 200, ProfileFragment.getBigAvaStubId(), true);
String str3 = user.nickname;
if (str3 == null || str3.equals("")) {
str = user.first_name + " " + user.last_name;
} else {
str = user.first_name + " " + user.nickname + " " + user.last_name;
}
Integer num2 = user.verified;
if (num2 == null || num2.intValue() != 1) {
this.tv_profile_info_user_name.setText(str);
} else {
SpannableStringBuilder spannableStringBuilder = new SpannableStringBuilder();
spannableStringBuilder.append((CharSequence) str).append((CharSequence) " ");
spannableStringBuilder.setSpan(new ImageSpan(getActivity(), ThemeColorsHelper.isLightTheme() ? R.drawable.ic_verified : R.drawable.ic_verified2, 1), spannableStringBuilder.length() - 1, spannableStringBuilder.length(), 33);
this.tv_profile_info_user_name.setText(spannableStringBuilder);
}
String sex = getSex(user.sex);
if (sex.equals("")) {
this.tv_profile_info_sex.setVisibility(8);
} else {
this.tv_profile_info_sex.setText(sex);
this.tv_profile_info_sex.setVisibility(0);
}
String relation = getRelation(user.relation, user.sex);
this.tv_profile_info_relation.setVisibility((relation == null || relation.equals("")) ? 8 : 0);
if (this.relation_partner_id != null) {
try {
String str4 = this.relation_partner_first_name + " " + this.relation_partner_last_name;
relation = relation + getRelationIn(user.relation, user.sex) + " " + str4;
SpannableString spannableString = new SpannableString(relation);
int length = relation.length();
int length2 = length - str4.length();
spannableString.setSpan(new StyleSpan(1), length2, length, 33);
spannableString.setSpan(new URLSpanNoUnderline("http://vk.com/id" + this.relation_partner_id), length2, length, 33);
this.tv_profile_info_relation.setText(spannableString);
this.tv_profile_info_relation.setTag(this.relation_partner_id);
this.tv_profile_info_relation.setOnClickListener(this.relation_partner_ClickListener);
} catch (Throwable th) {
this.tv_profile_info_relation.setText(relation);
th.printStackTrace();
Helper.reportError(th);
}
} else {
this.tv_profile_info_relation.setText(relation);
}
TextView textView2 = (TextView) view.findViewById(R.id.tv_profile_info_last_seen);
textView2.setVisibility(user.last_seen > 0 ? 0 : 8);
textView2.setText(Helper.getLastSee(getActivity(), user.last_seen, z, user.online_mobile.booleanValue()));
displayCity(user);
displayCountry(user);
Integer num3 = user.rate;
if (num3 == null || num3.intValue() <= 0) {
this.tv_profile_info_rate.setVisibility(8);
} else {
this.tv_profile_info_rate.setText(((Object) getText(R.string.label_rate)) + " " + user.rate);
this.tv_profile_info_rate.setVisibility(0);
}
String str5 = user.birthdate;
if (str5 != null && str5.length() > 0) {
this.tv_profile_info_birthday.setText(((Object) getText(R.string.label_birthday)) + " " + user.birthdate + Helper.getStringAge(user.birthdate, getActivity()));
setVisibleBirthdayRegion(true);
}
String str6 = user.university_name;
if (str6 != null && !str6.equals("")) {
String replace = user.university_name.replace("\r\n", "");
Integer num4 = user.graduation;
if (num4 != null && !num4.equals("")) {
replace = replace + " '" + user.graduation + ", " + user.faculty_name;
}
this.tv_profile_info_university.setText(replace);
setVisibleEducationRegion(true);
}
View findViewById = view.findViewById(R.id.ll_profile_status_region);
String str7 = user.status;
if (str7 == null || str7.equals("")) {
findViewById.setVisibility(8);
} else {
findViewById.setVisibility(0);
((TextView) view.findViewById(R.id.label_status)).setText(SmileHelper.getSmiledText(getActivity(), user.status));
view.findViewById(R.id.iv_status_audio_icon).setVisibility(this.status_audio != null ? 0 : 8);
}
if (this.coverView != null) {
String coverUrl = ProfileFragment.getCoverUrl(getActivity(), this.u);
if (TextUtils.isEmpty(coverUrl)) {
this.coverView.setVisibility(8);
} else {
this.coverView.setVisibility(0);
KApplication.getImageLoader().DisplayImage(coverUrl, this.coverView, true, 800, Helper.getSquareStubId(), false);
}
}
new Handler().postDelayed(new Runnable() {
@Override
public final void run() {
ProfileInfoFragment.this.lambda$displayUser$1();
}
}, 1000L);
}
public void displayUserOnUiThread() {
if (getActivity() == null) {
return;
}
getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
ProfileInfoFragment profileInfoFragment = ProfileInfoFragment.this;
profileInfoFragment.displayUser(profileInfoFragment.u, ProfileInfoFragment.this.getView());
}
});
}
private void downloadAvatarsAlbum() {
new Thread() {
@Override
public void run() {
KApplication.session.getPhotos(ProfileInfoFragment.this.uid, -6L, null, null, true, ProfileInfoFragment.this.avatars_photos_callback, ProfileInfoFragment.this.getActivity());
}
}.start();
}
public void editPhotoBeforeUpload(ArrayList arrayList) {
Intent intent = new Intent(getActivity(), PhotoUploadOptionsActivity.class);
intent.putExtra("uris", arrayList);
startActivityForResult(intent, 0);
}
private void faveAddUser() {
final Callback callback = new Callback(getActivity()) {
@Override
public void error(Throwable th) {
ProfileInfoFragment.this.showProgressBar(false);
}
@Override
public void ready(Object obj) {
if (ProfileInfoFragment.this.getActivity() == null) {
return;
}
ProfileInfoFragment.this.showProgressBar(false);
Integer num = (Integer) obj;
if (num == null || num.intValue() != 1) {
return;
}
ProfileInfoFragment.this.is_favorite = 1;
ProfileInfoFragment.this.displayToast(R.string.toast_bookmark_added);
}
};
showProgressBar(true);
new Thread() {
@Override
public void run() {
Session session = KApplication.session;
ProfileInfoFragment profileInfoFragment = ProfileInfoFragment.this;
session.faveAddPage(profileInfoFragment.uid, null, callback, profileInfoFragment.getActivity());
}
}.start();
}
private void faveRemoveUser() {
final Callback callback = new Callback(getActivity()) {
@Override
public void error(Throwable th) {
ProfileInfoFragment.this.showProgressBar(false);
}
@Override
public void ready(Object obj) {
if (ProfileInfoFragment.this.getActivity() == null) {
return;
}
ProfileInfoFragment.this.showProgressBar(false);
Integer num = (Integer) obj;
if (num == null || num.intValue() != 1) {
return;
}
ProfileInfoFragment.this.is_favorite = 0;
ProfileInfoFragment.this.displayToast(R.string.toast_bookmark_removed);
}
};
showProgressBar(true);
new Thread() {
@Override
public void run() {
Session session = KApplication.session;
ProfileInfoFragment profileInfoFragment = ProfileInfoFragment.this;
session.faveRemovePage(profileInfoFragment.uid, null, callback, profileInfoFragment.getActivity());
}
}.start();
}
private void fetchCityAndCountry() {
User user = this.u;
if (user == null) {
return;
}
Integer num = user.city;
if (num == null || num.intValue() == 0) {
this.city = null;
} else {
this.city = KApplication.db.fetchCity(this.u.city.intValue());
}
Integer num2 = this.u.country;
if (num2 != null) {
this.country = KApplication.db.fetchCountry(num2.intValue());
} else {
this.country = null;
}
}
private void getCityIfMissing() {
Integer num = this.u.city;
if (num == null || num.intValue() == 0 || this.city != null) {
return;
}
ArrayList arrayList = new ArrayList();
arrayList.add(Long.valueOf(this.u.city.intValue()));
KApplication.session.getCities(arrayList, this.callback_city, getActivity());
}
private void getCountryIfMissing() {
Integer num = this.u.country;
if (num == null || num.intValue() == 0 || this.country != null) {
return;
}
ArrayList arrayList = new ArrayList();
arrayList.add(Long.valueOf(this.u.country.intValue()));
KApplication.session.getCountries(arrayList, this.callback_country, getActivity());
}
private void getIsFriendInThread() {
new Thread() {
@Override
public void run() {
KApplication.session.isFriend(ProfileInfoFragment.this.uid.longValue(), null, ProfileInfoFragment.this.is_friend_callback, ProfileInfoFragment.this.getActivity());
}
}.start();
}
private String getRelation(Integer num, Integer num2) {
if (num == null) {
return "";
}
if (num.intValue() == 1) {
if (num2 == null || num2.intValue() == 0) {
return ((String) getText(R.string.label_relation)) + " " + ((String) getText(R.string.label_relation1));
} else if (num2.intValue() == 1) {
return ((String) getText(R.string.label_relation)) + " " + ((String) getText(R.string.label_relation1_1));
} else if (num2.intValue() == 2) {
return ((String) getText(R.string.label_relation)) + " " + ((String) getText(R.string.label_relation1_2));
}
}
if (num.intValue() == 2) {
if (num2 == null || num2.intValue() == 0) {
return ((String) getText(R.string.label_relation)) + " " + ((String) getText(R.string.label_relation2));
} else if (this.relation_partner_id != null) {
return ((String) getText(R.string.label_relation)) + " " + ((String) getText(R.string.label_relation2_3));
} else if (num2.intValue() == 1) {
return ((String) getText(R.string.label_relation)) + " " + ((String) getText(R.string.label_relation2_1));
} else if (num2.intValue() == 2) {
return ((String) getText(R.string.label_relation)) + " " + ((String) getText(R.string.label_relation2_2));
}
}
if (num.intValue() == 3) {
if (num2 == null || num2.intValue() == 0) {
return ((String) getText(R.string.label_relation)) + " " + ((String) getText(R.string.label_relation3));
} else if (num2.intValue() == 1) {
return ((String) getText(R.string.label_relation)) + " " + ((String) getText(R.string.label_relation3_1));
} else if (num2.intValue() == 2) {
return ((String) getText(R.string.label_relation)) + " " + ((String) getText(R.string.label_relation3_2));
}
}
if (num.intValue() == 4) {
if (num2 == null || num2.intValue() == 0) {
return ((String) getText(R.string.label_relation)) + " " + ((String) getText(R.string.label_relation4));
} else if (num2.intValue() == 1) {
return ((String) getText(R.string.label_relation)) + " " + ((String) getText(R.string.label_relation4_1));
} else if (num2.intValue() == 2) {
return ((String) getText(R.string.label_relation)) + " " + ((String) getText(R.string.label_relation4_2));
}
}
if (num.intValue() == 5) {
return ((String) getText(R.string.label_relation)) + " " + ((String) getText(R.string.label_relation5));
} else if (num.intValue() == 6) {
return ((String) getText(R.string.label_relation)) + " " + ((String) getText(R.string.label_relation6));
} else {
if (num.intValue() == 7) {
if (num2 == null || num2.intValue() == 0) {
return ((String) getText(R.string.label_relation)) + " " + ((String) getText(R.string.label_relation7));
} else if (num2.intValue() == 1) {
return ((String) getText(R.string.label_relation)) + " " + ((String) getText(R.string.label_relation7_1));
} else if (num2.intValue() == 2) {
return ((String) getText(R.string.label_relation)) + " " + ((String) getText(R.string.label_relation7_2));
}
}
if (num.intValue() == 8) {
return ((Object) getText(R.string.label_relation)) + " " + ((Object) getText(R.string.label_relation8));
}
return "";
}
}
private String getRelationIn(Integer num, Integer num2) {
if (num != null && num2 != null && num2.intValue() != 0) {
if (num.intValue() == 2) {
return " " + ((String) getText(R.string.label_relation_in2));
} else if (num.intValue() == 3) {
return " " + ((String) getText(R.string.label_relation_in3));
} else {
if (num.intValue() == 4) {
if (num2.intValue() == 1) {
return " " + ((String) getText(R.string.label_relation_in4_1));
} else if (num2.intValue() == 2) {
return " " + ((String) getText(R.string.label_relation_in4_2));
}
}
if (num.intValue() == 7) {
return " " + ((String) getText(R.string.label_relation_in7));
}
}
}
return "";
}
private String getSex(Integer num) {
if (num == null) {
return "";
}
if (num.intValue() == 1) {
return ((String) getText(R.string.label_sex)) + ": " + ((String) getText(R.string.label_sex_1));
} else if (num.intValue() == 2) {
return ((String) getText(R.string.label_sex)) + ": " + ((String) getText(R.string.label_sex_2));
} else {
return "";
}
}
private void initUiFields(View view) {
ImageView imageView = (ImageView) view.findViewById(R.id.imv_profile_info_user_photo);
this.imv_profile_info_user_photo = imageView;
imageView.setOnClickListener(this.photoClick);
this.tv_profile_info_user_name = (TextView) view.findViewById(R.id.tv_profile_info_user_name);
this.tv_profile_info_sex = (TextView) view.findViewById(R.id.tv_profile_info_sex);
this.tv_profile_info_relation = (TextView) view.findViewById(R.id.tv_profile_info_relation);
this.tv_profile_info_country = (TextView) view.findViewById(R.id.tv_profile_info_country);
this.tv_profile_info_rate = (TextView) view.findViewById(R.id.tv_profile_info_rate);
this.tv_profile_info_birthday = (TextView) view.findViewById(R.id.tv_profile_info_birthday);
this.tv_profile_info_id = (TextView) view.findViewById(R.id.tv_profile_info_id);
this.tv_profile_info_university = (TextView) view.findViewById(R.id.tv_profile_info_university);
this.ll_profile_place_region = (LinearLayout) view.findViewById(R.id.ll_profile_place_region);
this.ll_profile_education_region = (LinearLayout) view.findViewById(R.id.ll_profile_education_region);
this.add_friend_region = (LinearLayout) view.findViewById(R.id.add_friend_region);
this.replies_region = (LinearLayout) view.findViewById(R.id.replies_region);
LinearLayout linearLayout = (LinearLayout) view.findViewById(R.id.ll_profile_edit_region);
this.ll_profile_edit_region = linearLayout;
linearLayout.setOnClickListener(this.Edit_ClickListener);
this.tv_profile_info_id.setOnClickListener(this.profileIdClickListener);
setVisibleBirthdayRegion(false);
setVisiblePlaceRegion(false);
setVisibleEducationRegion(false);
setVisibleFriendsRegionsRegion(!this.is_me);
setVisibleEditRegion(this.is_me);
if (!this.is_me) {
displayFriendStatus(view);
this.add_friend_region.setOnClickListener(this.friendClickListener);
}
this.replies_region.setOnClickListener(this.repliesClickListener);
view.findViewById(R.id.ll_profile_status_region).setOnClickListener(this.statusClickListener);
this.coverView = (ImageView) view.findViewById(R.id.cover);
ProfileFragment.adjustCoverViewSize(getActivity(), this.coverView);
this.coverView.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view2) {
ProfileInfoFragment.this.lambda$initUiFields$0(view2);
}
});
}
public boolean isFriend() {
long parseLong = Long.parseLong(KApplication.session.getMid());
Long l = this.uid;
if (l == null) {
return false;
}
return KApplication.db.isFriend(parseLong, l.longValue());
}
public void lambda$displayUser$1() {
LinearLayout linearLayout = this.replies_region;
Integer num = this.can_write_private_message;
linearLayout.setVisibility((num == null || num.intValue() != 0) ? 0 : 8);
}
public void lambda$initUiFields$0(View view) {
ProfileFragment.coverClick(getActivity(), this.u);
}
private void removeFromBlackList() {
BlackListActivity.removeFromBlackList(this.uid_str, getActivity(), new BlackListActivity.BlackListCallback() {
@Override
public void onCompleted(boolean z) {
if (z) {
ProfileInfoFragment.this.blacklisted_by_me = 0;
}
}
});
}
private void setVisibleBirthdayRegion(boolean z) {
this.tv_profile_info_birthday.setVisibility(z ? 0 : 8);
}
private void setVisibleEditRegion(boolean z) {
this.ll_profile_edit_region.setVisibility(z ? 0 : 8);
}
private void setVisibleEducationRegion(boolean z) {
this.ll_profile_education_region.setVisibility(z ? 0 : 8);
}
private void setVisibleFriendsRegionsRegion(boolean z) {
this.replies_region.setVisibility(z ? 0 : 8);
this.add_friend_region.setVisibility(z ? 0 : 8);
}
private void setVisiblePlaceRegion(boolean z) {
this.ll_profile_place_region.setVisibility(z ? 0 : 8);
}
public void showAddDialog() {
View inflate = LayoutInflater.from(getActivity()).inflate(R.layout.add_friend, (ViewGroup) null);
final EditText editText = (EditText) inflate.findViewById(R.id.et_message);
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
builder.setTitle(R.string.label_add_friend).setView(inflate).setPositiveButton(R.string.yes, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
ProfileInfoFragment.this.addFriend(editText.getText().toString());
}
}).setNegativeButton(R.string.no, (DialogInterface.OnClickListener) null);
builder.create().show();
}
public void showAvatarsAlbum() {
Intent intent = new Intent();
intent.setClass(getActivity(), PhotosActivity.class);
intent.putExtra("com.perm.kate.aid", -6L);
intent.putExtra("com.perm.kate.uid", this.uid_str);
startActivity(intent);
}
public void showDeleteDialog() {
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
builder.setMessage(R.string.label_confirm_delete).setTitle(R.string.label_delete_friend).setPositiveButton(R.string.yes, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
ProfileInfoFragment.this.deleteFriend();
}
}).setNegativeButton(R.string.no, (DialogInterface.OnClickListener) null);
builder.create().show();
}
public void showProfileImage() {
User user = this.u;
if (user == null || user.photo_big == null) {
return;
}
Intent intent = new Intent();
intent.setClass(getActivity(), PhotoViewerActrivity.class);
long parseLong = Long.parseLong(KApplication.session.getMid());
DataHelper dataHelper = KApplication.db;
ArrayList photos = dataHelper.getPhotos(dataHelper.fetchPhotos(-6L, this.uid.longValue(), parseLong));
if (photos == null) {
photos = new ArrayList();
}
if (photos.size() == 0) {
Photo photo = new Photo();
photo.src_big = !TextUtils.isEmpty(this.u.photo_400_orig) && !this.u.photo_400_orig.contains("/camera") && NewsCursorAdapter.shouldDisplayBigPhotos() ? this.u.photo_400_orig : this.u.photo_big;
photos.add(photo);
}
intent.putExtra("com.perm.kate.photos", photos);
startActivity(intent);
}
public void showStatusAcivity() {
Intent intent = new Intent();
intent.setClass(getActivity(), StatusActivity.class);
startActivityForResult(intent, 1);
}
private void startSquareCrop(Uri uri, int i, int i2) {
Intent intent = new Intent(getActivity(), SinglePhotoViewer.class);
intent.putExtra("uri", uri);
intent.putExtra("resize_option", i);
intent.putExtra("rotate", i2);
intent.putExtra("crop", true);
startActivityForResult(intent, 4);
}
@Override
public void fillMenuItems(Menu menu) {
Integer num;
menu.add(0, 35, 3900, R.string.label_copy_video_link);
boolean isFriend = isFriend();
if (!this.is_me && isFriend) {
menu.add(0, 34, 1012, R.string.label_delete_friend);
}
if (!this.is_me) {
Integer num2 = this.blacklisted_by_me;
if (num2 == null || num2.intValue() != 1) {
menu.add(0, 36, 6000, R.string.label_to_black_list);
} else {
menu.add(0, 37, 6000, R.string.label_delete_from_blacklist);
}
}
menu.add(0, 1000, 5000, R.string.label_open_profile_web);
if (!this.is_me) {
if (OnlineNotificationsHelper.isEnabledUser(getActivity(), this.uid)) {
menu.add(0, 1007, 5005, R.string.label_online_notification_off);
} else {
menu.add(0, 1005, 5005, R.string.label_online_notification_on);
}
}
if (this.is_follower) {
menu.add(0, 1019, 7009, R.string.label_unfollow);
}
if (!this.is_me) {
menu.add(0, 1013, 7013, R.string.label_complain_report);
}
if (!this.is_me && isFriend) {
menu.add(0, 1021, 7021, R.string.label_friends_lists);
}
if (!this.is_me && (num = this.is_favorite) != null) {
if (num.intValue() == 1) {
menu.add(0, 1024, 7023, R.string.label_remove_from_bookmarks);
} else {
menu.add(0, 1023, 7023, R.string.label_add_to_bookmarks);
}
}
if (!this.is_me) {
if (WallSubscriptions.getInstance().subscribed(this.uid.longValue()) && UpdateService.regularRefreshEnabled()) {
menu.add(0, 1026, 7024, R.string.wall_notify_disable);
} else if (TextUtils.isEmpty(this.deactivated)) {
menu.add(0, 1025, 7024, R.string.wall_notify_enable);
}
}
if (!this.is_me) {
menu.add(0, 1027, 7025, R.string.send_gift);
}
menu.add(0, 1028, 7035, R.string.registration_date);
menu.add(0, 1029, 7045, R.string.mentions);
}
@Override
public void onActivityResult(int i, int i2, Intent intent) {
PhotoChooser.onActivityResult(getActivity(), i, i2, intent, this.photoChooserCallback);
if (i == 0 && i2 == -1) {
startSquareCrop((Uri) ((ArrayList) intent.getSerializableExtra("uris")).get(0), intent.getIntExtra("resize_option", 2), intent.getIntExtra("rotate", 0));
}
if (i == 1 && i2 == -1 && intent != null) {
String stringExtra = intent.getStringExtra("new_status");
if (Helper.isNotEmpty(stringExtra)) {
Helper.showPublishStatusDialog(getActivity(), this.uid.longValue(), stringExtra, false);
}
}
if (i == 2 && i2 == -1) {
this.listener.onAvatarChanged();
}
if (i == 4 && i2 == -1) {
Uri uri = (Uri) intent.getParcelableExtra("uri");
int intExtra = intent.getIntExtra("resize_option", 2);
int intExtra2 = intent.getIntExtra("rotate", 0);
new AvatarUploader(getActivity(), uri, intExtra, this.uploadCallback, intExtra2).setSquareCrop(intent.getStringExtra("x_y_w")).upload();
}
}
@Override
public void onAttach(Activity activity) {
super.onAttach(activity);
this.listener = (ProfileActivityCallback) activity;
}
@Override
public void onCreate(Bundle bundle) {
super.onCreate(bundle);
setHasOptionsMenu(true);
}
@Override
public View onCreateView(LayoutInflater layoutInflater, ViewGroup viewGroup, Bundle bundle) {
View view;
String string;
try {
view = layoutInflater.inflate(R.layout.profile_info, viewGroup, false);
} catch (Throwable th) {
th = th;
view = null;
}
try {
string = getArguments().getString("com.perm.kate.user_id");
this.uid_str = string;
} catch (Throwable th2) {
th = th2;
Helper.reportError(th);
th.printStackTrace();
if (th instanceof OutOfMemoryError) {
KApplication.getImageLoader().clearMemoryCache();
}
return view;
}
if (string == null) {
return view;
}
this.uid = Long.valueOf(Long.parseLong(string));
this.is_me = this.uid_str.equals(KApplication.session.getMid());
initUiFields(view);
this.u = KApplication.db.fetchUserFull(this.uid.longValue());
fetchCityAndCountry();
displayUser(this.u, view);
if (!this.is_me) {
getIsFriendInThread();
History.addUser(this.u);
}
return view;
}
@Override
public boolean onOptionsItemSelected(MenuItem menuItem) {
int itemId = menuItem.getItemId();
if (itemId == 1000) {
showProfileFromBrowser();
return true;
} else if (itemId == 1005) {
if (!isFriend()) {
displayToast(R.string.toast_working_only_for_friends);
}
OnlineNotificationsHelper.setEnabledUser(getActivity(), this.uid.longValue(), true);
return true;
} else if (itemId == 1007) {
OnlineNotificationsHelper.setEnabledUser(getActivity(), this.uid.longValue(), false);
return true;
} else if (itemId == 1013) {
new ReportHelper(getActivity()).showReportUserDialog(this.uid.longValue());
return true;
} else if (itemId == 1019) {
deleteFriend();
return true;
} else if (itemId == 1021) {
FriendsListsHelper.showFriendsListsDialogWithCheck((BaseActivity) getActivity(), this.uid);
return true;
} else {
switch (itemId) {
case 34:
showDeleteDialog();
return true;
case 35:
Helper.copyProfileLink(this.uid_str, getActivity());
return true;
case 36:
addToBlackList();
return true;
case 37:
removeFromBlackList();
return true;
default:
switch (itemId) {
case 1023:
faveAddUser();
return true;
case 1024:
faveRemoveUser();
return true;
case 1025:
WallSubscriptions.getInstance().subscribe(this.uid.longValue());
WallSubscriptions.ensureRegularRefreshEnabled();
displayToast(R.string.wall_notifications_enabled);
return true;
case 1026:
WallSubscriptions.getInstance().unsubscribe(this.uid.longValue());
WallSubscriptions.disableRegularRefreshIfRequired();
displayToast(R.string.wal_notifications_disabled);
return true;
case 1027:
ProfileFragment.sendGift(this.uid_str, getActivity());
return true;
case 1028:
RegistrationDate.getAndShow((BaseActivity) getActivity(), this.uid_str);
return true;
case 1029:
ProfileFragment.showMentions(getActivity(), this.uid_str, this.u.is_closed);
return true;
default:
return super.onOptionsItemSelected(menuItem);
}
}
}
}
@Override
public void onRefreshButton() {
}
protected void showAvatarDialog() {
final ArrayList arrayList = new ArrayList();
arrayList.add(new MenuItemDetails((int) R.string.this_photo, 1));
arrayList.add(new MenuItemDetails((int) R.string.all_avatars, 2));
AlertDialog create = new AlertDialog.Builder(getActivity()).setTitle(R.string.title_options).setItems(MenuItemDetails.toArray(arrayList), new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
int i2 = ((MenuItemDetails) arrayList.get(i)).code;
if (i2 == 1) {
ProfileInfoFragment.this.showProfileImage();
} else if (i2 != 2) {
} else {
ProfileInfoFragment.this.showAvatarsAlbum();
}
}
}).create();
create.setCanceledOnTouchOutside(true);
create.show();
downloadAvatarsAlbum();
}
public void showEditProfileAcivity(Activity activity) {
Intent intent = new Intent();
intent.setClass(activity, EditProfileActivity.class);
startActivityForResult(intent, 2);
}
protected void showMessageThread() {
Intent intent = new Intent();
intent.setClass(getActivity(), MessageThreadActivity.class);
intent.putExtra("com.perm.kate.message_uid", this.uid);
startActivity(intent);
}
protected void showOptionsDialog() {
final ArrayList arrayList = new ArrayList();
arrayList.add(new MenuItemDetails((int) R.string.label_edit_profile, 3));
arrayList.add(new MenuItemDetails((int) R.string.edit_avatar, 1));
arrayList.add(new MenuItemDetails((int) R.string.label_menu_status, 2));
AlertDialog create = new AlertDialog.Builder(getActivity()).setTitle(R.string.label_edit).setItems(MenuItemDetails.toArray(arrayList), new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
int i2 = ((MenuItemDetails) arrayList.get(i)).code;
if (i2 == 1) {
PhotoChooser.requestPhoto(ProfileInfoFragment.this.getActivity(), ProfileInfoFragment.this, false, false, false, null);
} else if (i2 == 2) {
ProfileInfoFragment.this.showStatusAcivity();
} else if (i2 != 3) {
} else {
ProfileInfoFragment profileInfoFragment = ProfileInfoFragment.this;
profileInfoFragment.showEditProfileAcivity(profileInfoFragment.getActivity());
}
}
}).create();
create.setCanceledOnTouchOutside(true);
create.show();
}
protected void showProfileFromBrowser() {
if (this.u == null) {
return;
}
Helper.openUrlInBrowser("http://vk.com/id" + this.u.uid, getActivity());
}
public void userRefreshed(User user) {
checkDeactivated(user.deactivated);
this.deactivated = user.deactivated;
Long l = user.relation_partner_id;
this.relation_partner_id = l;
if (l != null) {
this.relation_partner_first_name = user.relation_partner_first_name;
this.relation_partner_last_name = user.relation_partner_last_name;
}
this.status_audio = user.status_audio;
this.is_favorite = user.is_favorite;
this.can_write_private_message = user.can_write_private_message;
this.blacklisted_by_me = user.blacklisted_by_me;
User fetchUserFull = KApplication.db.fetchUserFull(this.uid.longValue());
this.u = fetchUserFull;
fetchUserFull.is_closed = user.is_closed;
fetchCityAndCountry();
displayUserOnUiThread();
getCityIfMissing();
getCountryIfMissing();
showProgressBar(false);
}
}