Kate Mobile v109.1版本的 MD5 值为:fcd76ded5f363ecbfac46035a4ed2a23

以下内容为反编译后的 ProfileFragment.java 源代码,内容仅作参考


package com.perm.kate;

import android.app.Activity;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.Matrix;
import android.graphics.drawable.BitmapDrawable;
import android.net.Uri;
import android.os.Bundle;
import android.os.Handler;
import android.preference.PreferenceManager;
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.Display;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewTreeObserver;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import androidx.appcompat.app.AlertDialog;
import com.flurry.android.FlurryAgent;
import com.perm.kate.AudioClickHelper;
import com.perm.kate.BlackListActivity;
import com.perm.kate.ImageLoader;
import com.perm.kate.api.Api;
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.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.FakeCheck;
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.lang.ref.WeakReference;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.TreeMap;
public class ProfileFragment extends BaseFragment {
    static final HashMap refresh_time = new HashMap();
    private View activity_header;
    private View add_friend_region;
    private Integer blacklisted_by_me;
    private View buttons;
    private Integer can_write_private_message;
    private String city;
    private String country;
    private ImageView coverView;
    private ImageView imv_profile_info_user_photo;
    private Boolean is_closed;
    private Integer is_favorite;
    private boolean is_me;
    private LinearLayout ll_profile_education_region;
    private LinearLayout ll_profile_faves_region;
    private View ll_profile_friends_region;
    View ll_profile_gifts_region;
    private LinearLayout ll_profile_place_region;
    long me;
    View notes_layout;
    public String relation_partner_first_name;
    public Long relation_partner_id;
    public String relation_partner_last_name;
    private View replies_region;
    private View scrollView;
    private Audio status_audio;
    private TextView tv_albums_count;
    private TextView tv_audios_count;
    private TextView tv_followers_count;
    private TextView tv_friends_count;
    private TextView tv_gifts_count;
    private TextView tv_groups_count;
    private TextView tv_notes_count;
    private TextView tv_photo_count;
    private TextView tv_photos_count;
    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 TextView tv_videos_count;
    private TextView tv_wall_count;
    private User u;
    Long uid;
    private String uid_str;
    View user_photos;
    private boolean is_follower = false;
    private final boolean new_profile = !isOldProfile();
    String clicked_item = null;
    private boolean globalLayoutListenerAdded = false;
    String deactivated = null;
    private final Callback callback_profile = new Callback(getActivity()) {
        @Override
        public void error(Throwable th) {
            super.error(th);
            ProfileFragment.this.showProgressBar(false);
        }

        @Override
        public void ready(Object obj) {
            ArrayList arrayList = (ArrayList) obj;
            if (arrayList == null || arrayList.size() == 0) {
                return;
            }
            if (((User) arrayList.get(0)).photo_400_orig == null) {
                ((User) arrayList.get(0)).photo_400_orig = "";
            }
            if (((User) arrayList.get(0)).birthdate == null) {
                ((User) arrayList.get(0)).birthdate = "";
            }
            ProfileFragment.this.checkDeactivated(((User) arrayList.get(0)).deactivated);
            ProfileFragment.this.deactivated = ((User) arrayList.get(0)).deactivated;
            ProfileFragment.this.relation_partner_id = ((User) arrayList.get(0)).relation_partner_id;
            if (((User) arrayList.get(0)).relation_partner_id != null) {
                ProfileFragment.this.relation_partner_first_name = ((User) arrayList.get(0)).relation_partner_first_name;
                ProfileFragment.this.relation_partner_last_name = ((User) arrayList.get(0)).relation_partner_last_name;
            }
            ProfileFragment.this.status_audio = ((User) arrayList.get(0)).status_audio;
            ProfileFragment.this.is_favorite = ((User) arrayList.get(0)).is_favorite;
            ProfileFragment.this.can_write_private_message = ((User) arrayList.get(0)).can_write_private_message;
            ProfileFragment.this.blacklisted_by_me = ((User) arrayList.get(0)).blacklisted_by_me;
            KApplication.db.createOrUpdateUser((User) arrayList.get(0), true);
            ProfileFragment profileFragment = ProfileFragment.this;
            profileFragment.u = KApplication.db.fetchUserFull(profileFragment.uid.longValue());
            ProfileFragment.this.is_closed = ((User) arrayList.get(0)).is_closed;
            ProfileFragment.this.fetchCityAndCountry();
            ProfileFragment.this.displayUserOnUiThread();
            if (((User) arrayList.get(0)).blacklisted != null && ((User) arrayList.get(0)).blacklisted.intValue() == 1) {
                ProfileFragment.displayYouBlacklistedInUiThread(ProfileFragment.this.getActivity());
            }
            if (!ProfileFragment.this.is_me && ((User) arrayList.get(0)).is_closed != null && ((User) arrayList.get(0)).is_closed.booleanValue() && !ProfileFragment.isFriend(ProfileFragment.this.uid)) {
                ProfileFragment.this.displayToast(R.string.closed_profile);
            }
            ProfileFragment.this.getCityIfMissing();
            ProfileFragment.this.getCountryIfMissing();
            ProfileFragment.this.showProgressBar(false);
            ProfileFragment profileFragment2 = ProfileFragment.this;
            ProfileFragment.refresh_time.put(ProfileFragment.this.me + "_" + ProfileFragment.this.uid, new Object[]{Long.valueOf(System.currentTimeMillis()), profileFragment2.deactivated, profileFragment2.relation_partner_id, profileFragment2.relation_partner_first_name, profileFragment2.relation_partner_last_name, profileFragment2.status_audio, ProfileFragment.this.is_favorite, ProfileFragment.this.can_write_private_message, ProfileFragment.this.blacklisted_by_me, ProfileFragment.this.is_closed, ((User) arrayList.get(0)).blacklisted});
        }
    };
    private final Callback callback_wall_count = new Callback(getActivity()) {
        @Override
        public void ready(Object obj) {
            Integer[] numArr = (Integer[]) obj;
            KApplication.db.updateUserWallCount(ProfileFragment.this.uid.longValue(), numArr);
            ProfileFragment.this.displayWallCountInUiThread(numArr);
        }
    };
    final Callback callback_city = new Callback(getActivity()) {
        @Override
        public void ready(Object obj) {
            ArrayList arrayList = (ArrayList) obj;
            if (arrayList == null || arrayList.size() <= 0) {
                return;
            }
            ProfileFragment.this.city = ((City) arrayList.get(0)).name;
            KApplication.db.createCity(ProfileFragment.this.u.city.intValue(), ProfileFragment.this.city);
            ProfileFragment.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;
            }
            ProfileFragment.this.country = ((Country) arrayList.get(0)).name;
            KApplication.db.createCountry(ProfileFragment.this.u.country.intValue(), ProfileFragment.this.country);
            ProfileFragment.this.displayUserOnUiThread();
        }
    };
    private final View.OnClickListener Friends_ClickListener = new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            ProfileFragment.this.ShowFriendsAcivity();
            ProfileFragment.this.reportClick("friends");
        }
    };
    private final View.OnClickListener Photos_ClickListener = new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            ProfileFragment.ShowAlbumsAcivity(ProfileFragment.this.getActivity(), ProfileFragment.this.uid);
            ProfileFragment.this.reportClick("photos");
        }
    };
    private final View.OnClickListener Videos_ClickListener = new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            ProfileFragment.ShowVideosAcivity(ProfileFragment.this.getActivity(), ProfileFragment.this.uid);
            ProfileFragment.this.reportClick("video");
        }
    };
    private final View.OnClickListener Wall_ClickListener = new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            ProfileFragment.ShowWallAcivity(ProfileFragment.this.getActivity(), ProfileFragment.this.uid);
            ProfileFragment.this.reportClick("wall");
        }
    };
    private final View.OnClickListener Audio_ClickListener = new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            ProfileFragment.ShowAudioAcivity(ProfileFragment.this.getActivity(), ProfileFragment.this.uid);
            ProfileFragment.this.reportClick("audio");
        }
    };
    private final View.OnClickListener Groups_ClickListener = new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            ProfileFragment.this.ShowGroupsAcivity();
            ProfileFragment.this.reportClick("groups");
        }
    };
    private final View.OnClickListener userPhotosClickListener = new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            Helper.ShowAlbum(ProfileFragment.this.uid_str, -9000L, ProfileFragment.this.getActivity());
            ProfileFragment.this.reportClick("user_photos");
        }
    };
    private final View.OnClickListener allPhotosClickListener = new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            Helper.showAllPhotos(ProfileFragment.this.getActivity(), ProfileFragment.this.uid_str);
            ProfileFragment.this.reportClick("all_photos");
        }
    };
    private final View.OnClickListener photoClick = new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            ProfileFragment.this.downloadAvatarsAlbum();
            ProfileFragment.this.reportClick("ava");
        }
    };
    private final View.OnClickListener statusClickListener = new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            ProfileFragment.this.reportClick("status");
            if (ProfileFragment.this.is_me && ProfileFragment.this.status_audio == null) {
                ProfileFragment.this.showStatusAcivity();
            } else if (ProfileFragment.this.status_audio != null) {
                ArrayList arrayList = new ArrayList();
                arrayList.add(ProfileFragment.this.status_audio);
                new AudioClickHelper((BaseActivity) ProfileFragment.this.getActivity(), null).CreateContextMenu(ProfileFragment.this.status_audio, false, arrayList, false, 10);
            } else if (ProfileFragment.this.u == null || ProfileFragment.this.u.status == null || ProfileFragment.this.u.status.equals("")) {
            } else {
                if (ProfileFragment.this.new_profile) {
                    ProfileFragment.this.showStatusDialog();
                } else {
                    Helper.createCopyTextContextMenu(ProfileFragment.this.u.status, ProfileFragment.this.getActivity());
                }
            }
        }
    };
    private final View.OnClickListener Notes_ClickListener = new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            ProfileFragment.this.ShowNotesAcivity();
            ProfileFragment.this.reportClick("notes");
        }
    };
    private final View.OnClickListener giftsClickListener = new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            ProfileFragment.this.showGiftsAcivity();
            ProfileFragment.this.reportClick("gifts");
        }
    };
    private final View.OnClickListener docsClickListener = new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            Intent intent = new Intent(ProfileFragment.this.getActivity(), DocsActivity2.class);
            intent.putExtra("owner_id", ProfileFragment.this.uid);
            ProfileFragment.this.startActivity(intent);
            ProfileFragment.this.reportClick("docs");
        }
    };
    private final View.OnClickListener storiesClickListener = new View.OnClickListener() {
        @Override
        public final void onClick(View view) {
            ProfileFragment.this.lambda$new$2(view);
        }
    };
    private final Callback avatars_photos_callback = new Callback(getActivity()) {
        @Override
        public void error(Throwable th) {
            super.error(th);
            ProfileFragment.this.showProfileImage(null);
        }

        @Override
        public void ready(Object obj) {
            ProfileFragment.this.showProfileImage((ArrayList) obj);
        }
    };
    private final View.OnClickListener repliesClickListener = new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            ProfileFragment.this.showMessageThread();
            ProfileFragment.this.reportClick("messages");
        }
    };
    private final View.OnClickListener friendClickListener = new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            ProfileFragment.this.reportClick("add_friend");
            if (ProfileFragment.isFriend(ProfileFragment.this.uid)) {
                ProfileFragment.this.showDeleteDialog();
            } else {
                ProfileFragment.this.showAddDialog();
            }
        }
    };
    private final Callback delete_friend_callback = new Callback(getActivity()) {
        @Override
        public void error(Throwable th) {
            ProfileFragment.this.showProgressBar(false);
            super.error(th);
        }

        @Override
        public void ready(Object obj) {
            ProfileFragment.this.showProgressBar(false);
            Long l = (Long) obj;
            if (l.longValue() == 1) {
                KApplication.db.deleteFriend(Long.parseLong(KApplication.session.getMid()), ProfileFragment.this.uid.longValue());
                ProfileFragment.this.displayToast(R.string.done);
                ProfileFragment.this.displayFriendStatusOnUiThread();
            } else if (l.longValue() == 2) {
                ProfileFragment.this.displayToast(R.string.toast_you_canceled_friend_request);
                ProfileFragment.this.is_follower = false;
                ProfileFragment.this.displayFriendStatusOnUiThread2(0);
            }
        }
    };
    private final Callback add_friend_callback = new Callback(getActivity()) {
        @Override
        public void error(Throwable th) {
            ProfileFragment.this.showProgressBar(false);
            super.error(th);
        }

        @Override
        public void ready(Object obj) {
            ProfileFragment.this.showProgressBar(false);
            if (((Long) obj).longValue() == 1) {
                ProfileFragment.this.displayToast(R.string.friend_request_sent);
            }
        }
    };
    private final View.OnClickListener subscribersClickListener = new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            ProfileFragment.this.showSubscribers();
            ProfileFragment.this.reportClick("subscribers");
        }
    };
    private final View.OnClickListener followersClickListener = new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            ProfileFragment.this.showFollowers();
            ProfileFragment.this.reportClick("followers");
        }
    };
    private final View.OnClickListener faves_ClickListener = new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            ProfileFragment.this.showFaves();
            ProfileFragment.this.reportClick("faves");
        }
    };
    private final View.OnClickListener additional_info_ClickListener = new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            ProfileFragment.this.showAdditionalInfo();
            ProfileFragment.this.reportClick("additional_info");
        }
    };
    private final PhotoChooser.Callback photoChooserCallback = new PhotoChooser.Callback() {
        @Override
        public void canceled() {
        }

        @Override
        public void selected(ArrayList arrayList) {
            ProfileFragment.this.editPhotoBeforeUpload(arrayList);
        }

        @Override
        public void selectedFromAlbum(ArrayList arrayList) {
        }
    };
    protected final UploadCallback uploadCallback = new UploadCallback() {
        @Override
        public void success(ArrayList arrayList) {
            ProfileFragment.this.refreshInThread();
        }
    };
    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), ProfileFragment.this.getActivity());
            }
            ProfileFragment.this.reportClick("partner");
        }
    };
    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(), ProfileFragment.this.getActivity());
            }
            ProfileFragment.this.reportClick("id");
        }
    };
    private final Callback is_friend_callback = new Callback(getActivity()) {
        @Override
        public void ready(Object obj) {
            Integer num = (Integer) obj;
            if (num != null) {
                ProfileFragment.this.is_follower = num.intValue() == 1;
                if (num.intValue() == 3) {
                    long parseLong = Long.parseLong(KApplication.session.getMid());
                    if (!KApplication.db.isFriend(parseLong, ProfileFragment.this.uid.longValue())) {
                        KApplication.db.createFriend(parseLong, ProfileFragment.this.uid.longValue());
                    }
                }
                ProfileFragment.this.displayFriendStatusOnUiThread2(num.intValue());
            }
        }
    };

    static class AudioClickHelper extends com.perm.kate.AudioClickHelper {
        public AudioClickHelper(BaseActivity baseActivity, AudioClickHelper.AudioClickHelperCallback audioClickHelperCallback) {
            super(baseActivity, audioClickHelperCallback);
        }
    }

    public class MyObserver implements ViewTreeObserver.OnGlobalLayoutListener {
        MyObserver() {
        }

        @Override
        public void onGlobalLayout() {
            if (ProfileFragment.this.imv_profile_info_user_photo.getDrawable() == null || !(ProfileFragment.this.imv_profile_info_user_photo.getDrawable() instanceof BitmapDrawable)) {
                return;
            }
            ProfileFragment.setMatrix(ProfileFragment.this.imv_profile_info_user_photo, ((BitmapDrawable) ProfileFragment.this.imv_profile_info_user_photo.getDrawable()).getBitmap(), ProfileFragment.this.u);
        }
    }

    public static class PhotoTask extends ImageLoader.PhotoToLoad {
        WeakReference root;
        final String url;
        final User user;

        public PhotoTask(ImageView imageView, String str, User user) {
            super(str, 2);
            this.root = new WeakReference(imageView);
            this.url = str;
            this.mergeable = true;
            this.user = user;
        }

        @Override
        public void clear() {
            super.clear();
            this.root.clear();
        }

        @Override
        void display() {
            ImageView imageView = (ImageView) this.root.get();
            Bitmap bitmap = this.bmp;
            if (bitmap != null) {
                imageView.setImageBitmap(bitmap);
                ProfileFragment.setMatrix(imageView, this.bmp, this.user);
            }
        }

        @Override
        View getView() {
            return (View) this.root.get();
        }

        @Override
        void load() {
            ImageLoader imageLoader = KApplication.getImageLoader();
            if (this.root.get() == null) {
                return;
            }
            Bitmap bitmap = imageLoader.getBitmap(this.url, 800, 800, false, null, true, true);
            this.bmp = bitmap;
            imageLoader.putToMemoryCache(this.url, bitmap);
        }

        @Override
        void setView(View view) {
            this.root = new WeakReference((ImageView) view);
        }
    }

    private class ScrollChangedListener implements ViewTreeObserver.OnScrollChangedListener {
        private ScrollChangedListener() {
        }

        @Override
        public void onScrollChanged() {
            float scrollY = ProfileFragment.this.scrollView.getScrollY() / Helper.getDIP(230.0d);
            if (scrollY > 1.0f) {
                scrollY = 1.0f;
            }
            if (scrollY < 0.0f) {
                scrollY = 0.0f;
            }
            ProfileFragment.this.activity_header.getBackground().setAlpha((int) (scrollY * 255.0f));
        }
    }

    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 static void ShowAlbumsAcivity(Activity activity, Long l) {
        Intent intent = new Intent();
        intent.setClass(activity, AlbumsActivity2.class);
        intent.putExtra("com.perm.kate.owner_id", l);
        activity.startActivity(intent);
    }

    public static void ShowAudioAcivity(Activity activity, Long l) {
        Intent intent = new Intent();
        intent.setClass(activity, AudioActivity2.class);
        intent.putExtra("com.perm.kate.owner_id", l);
        activity.startActivity(intent);
    }

    public void ShowFriendsAcivity() {
        Intent intent = new Intent();
        intent.setClass(getActivity(), FriendsActivity2.class);
        intent.putExtra("com.perm.kate.user_id", this.uid_str);
        startActivity(intent);
    }

    public void ShowGroupsAcivity() {
        Intent intent = new Intent();
        intent.setClass(getActivity(), GroupsActivity2.class);
        intent.putExtra("com.perm.kate.user_id", this.uid);
        startActivity(intent);
    }

    public void ShowNotesAcivity() {
        Intent intent = new Intent();
        intent.setClass(getActivity(), NotesActivity2.class);
        intent.putExtra("com.perm.kate.user_id", this.uid);
        startActivity(intent);
    }

    public static void ShowVideosAcivity(Context context, Long l) {
        Intent intent = new Intent();
        intent.putExtra("com.perm.kate.user_id", l);
        intent.setClass(context, VideoActivity2.class);
        context.startActivity(intent);
    }

    public static void ShowWallAcivity(Activity activity, Long l) {
        Intent intent = new Intent();
        intent.setClass(activity, WallActivity2.class);
        intent.putExtra("com.perm.kate.user_id", Long.toString(l.longValue()));
        activity.startActivity(intent);
    }

    public void addFriend(final String str) {
        showProgressBar(true);
        new Thread() {
            @Override
            public void run() {
                Session session = KApplication.session;
                ProfileFragment profileFragment = ProfileFragment.this;
                session.addFriend(profileFragment.uid, str, profileFragment.add_friend_callback, ProfileFragment.this.getActivity());
            }
        }.start();
    }

    private void addToBlackList() {
        BlackListActivity.AddToBlackList(this.uid_str, getActivity(), new BlackListActivity.BlackListCallback() {
            @Override
            public void onCompleted(boolean z) {
                if (z) {
                    ProfileFragment.this.blacklisted_by_me = 1;
                }
            }
        });
    }

    public static void adjustCoverViewSize(Activity activity, View view) {
        Display defaultDisplay = activity.getWindowManager().getDefaultDisplay();
        view.getLayoutParams().height = (KApplication.isTablet ? Math.max(defaultDisplay.getWidth(), defaultDisplay.getHeight()) - Helper.getDIP(KApplication.LEFT_PANE_NEWS_MIN_WIDTH) : Math.min(defaultDisplay.getWidth(), defaultDisplay.getHeight())) / (KApplication.isTablet ? 6 : 3);
    }

    public 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);
        }
    }

    private void copyLink() {
        String str = "id" + this.uid_str;
        final String str2 = "https://vk.com/" + str;
        User user = this.u;
        String str3 = user != null ? user.domain : "";
        final String str4 = "https://vk.com/" + str3;
        final ArrayList arrayList = new ArrayList();
        if (!TextUtils.isEmpty(str3) && !str.equals(str3)) {
            arrayList.add(new MenuItemDetails(str4, 0));
        }
        arrayList.add(new MenuItemDetails(str2, 1));
        new AlertDialog.Builder(getActivity()).setItems(MenuItemDetails.toArray(arrayList), new DialogInterface.OnClickListener() {
            @Override
            public final void onClick(DialogInterface dialogInterface, int i) {
                ProfileFragment.this.lambda$copyLink$3(arrayList, str4, str2, dialogInterface, i);
            }
        }).create().show();
    }

    public static void coverClick(Activity activity, User user) {
        Intent intent = new Intent();
        intent.setClass(activity, PhotoViewerActrivity.class);
        ArrayList arrayList = new ArrayList();
        Photo photo = new Photo();
        photo.src_big = user.cover_960;
        photo.src = user.cover_400;
        arrayList.add(photo);
        intent.putExtra("com.perm.kate.photos", arrayList);
        activity.startActivity(intent);
    }

    public void deleteFriend() {
        showProgressBar(true);
        new Thread() {
            @Override
            public void run() {
                Session session = KApplication.session;
                ProfileFragment profileFragment = ProfileFragment.this;
                session.deleteFriend(profileFragment.uid, profileFragment.delete_friend_callback, ProfileFragment.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 displayCounters(User user) {
        String num = Integer.toString(user.friends_count);
        if (!this.is_me) {
            Integer num2 = user.mutual_friends_count;
            if (num2 != null && num2.intValue() != 0) {
                num = num + " (" + user.mutual_friends_count + " " + getString(R.string.mutual).toLowerCase().substring(0, 3) + ")";
            }
        } else if (user.online_friends_count != null) {
            num = num + " (" + user.online_friends_count + ")";
        }
        this.tv_friends_count.setText(num);
        this.tv_albums_count.setText(Integer.toString(user.albums_count));
        TextView textView = this.tv_photo_count;
        if (textView != null) {
            textView.setText(Integer.toString(user.photo_count));
        }
        if (user.user_photos_count == 0) {
            this.user_photos.setVisibility(8);
        } else {
            this.user_photos.setVisibility(0);
            this.tv_photos_count.setText(Integer.toString(user.user_photos_count));
        }
        this.tv_audios_count.setText(Integer.toString(user.audios_count));
        this.tv_videos_count.setText(Integer.toString(user.videos_count));
        this.tv_groups_count.setText(Integer.toString(user.groups_count));
        this.tv_followers_count.setText(Integer.toString(user.followers_count));
        if (user.gifts_count == 0) {
            this.ll_profile_gifts_region.setVisibility(8);
        } else {
            this.ll_profile_gifts_region.setVisibility(0);
            this.tv_gifts_count.setText(Integer.toString(user.gifts_count));
        }
        displayWallCount(user.posts_count);
    }

    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.uid)) {
            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) {
            TextView textView = (TextView) view.findViewById(R.id.tv_profile_friends_status);
            if (i != 1 && i != 2) {
                textView.setVisibility(8);
                return;
            }
            textView.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() {
                ProfileFragment profileFragment = ProfileFragment.this;
                profileFragment.displayFriendStatus(profileFragment.getView());
            }
        });
    }

    public void displayFriendStatusOnUiThread2(final int i) {
        if (getActivity() == null) {
            return;
        }
        getActivity().runOnUiThread(new Runnable() {
            @Override
            public void run() {
                ProfileFragment profileFragment = ProfileFragment.this;
                profileFragment.displayFriendStatus2(profileFragment.getView(), i);
            }
        });
    }

    public void displayNotesCount(int i) {
        View view = this.notes_layout;
        if (view == null || this.tv_notes_count == null) {
            return;
        }
        if (i == 0 && !this.is_me) {
            view.setVisibility(8);
            return;
        }
        view.setVisibility(0);
        this.tv_notes_count.setText(Integer.toString(i));
    }

    public void displayUser(User user, View view) {
        TextView textView;
        String str;
        boolean z;
        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;
        int i = 0;
        boolean z2 = 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, z2, 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.contains("/camera")) {
            str2 = user.photo_big;
        }
        boolean wideAva = wideAva();
        if (wideAva && !TextUtils.isEmpty(user.photo_400_orig) && NewsCursorAdapter.shouldDisplayBigPhotos() && !user.photo_400_orig.contains("/camera")) {
            str2 = user.photo_400_orig;
        }
        String str3 = str2;
        if (wideAva()) {
            if (KApplication.getImageLoader().isCachedInMemory(str3)) {
                KApplication.getImageLoader().imageViews.put(this.imv_profile_info_user_photo, str3);
                this.imv_profile_info_user_photo.setImageBitmap(KApplication.getImageLoader().getFromMemoryCache(str3));
            } else {
                KApplication.getImageLoader().displayImage(new PhotoTask(this.imv_profile_info_user_photo, str3, user));
            }
            if (!this.globalLayoutListenerAdded) {
                this.globalLayoutListenerAdded = true;
                this.imv_profile_info_user_photo.getViewTreeObserver().addOnGlobalLayoutListener(new MyObserver());
            }
        } else {
            KApplication.getImageLoader().DisplayImage(str3, this.imv_profile_info_user_photo, true, wideAva ? 400 : 200, getBigAvaStubId(), !wideAva);
        }
        String str4 = user.nickname;
        if (str4 == null || str4.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() || wideAva) ? R.drawable.ic_verified : R.drawable.ic_verified2, 1), spannableStringBuilder.length() - 1, spannableStringBuilder.length(), 33);
            this.tv_profile_info_user_name.setText(spannableStringBuilder);
            this.tv_profile_info_user_name.setContentDescription(str + ", страница подтверждена");
        }
        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 str5 = this.relation_partner_first_name + " " + this.relation_partner_last_name;
                relation = relation + getRelationIn(user.relation, user.sex) + " " + str5;
                SpannableString spannableString = new SpannableString(relation);
                int length = relation.length();
                int length2 = length - str5.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, z2, user.online_mobile.booleanValue()));
        displayCounters(user);
        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 str6 = user.birthdate;
        if (str6 == null || str6.length() <= 0) {
            setVisibleBirthdayRegion(false);
        } else {
            this.tv_profile_info_birthday.setText(((Object) getText(R.string.label_birthday)) + " " + user.birthdate + Helper.getStringAge(user.birthdate, getActivity()));
            setVisibleBirthdayRegion(true);
        }
        String str7 = user.university_name;
        if (str7 == null || str7.equals("")) {
            z = true;
        } else {
            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);
            z = true;
            setVisibleEducationRegion(true);
        }
        setVisibleFriendsRegion(z);
        View findViewById = view.findViewById(this.new_profile ? R.id.label_status : R.id.ll_profile_status_region);
        String str8 = user.status;
        if (str8 == null || str8.equals("")) {
            findViewById.setVisibility(8);
        } else {
            findViewById.setVisibility(0);
            String str9 = user.status;
            if (this.status_audio != null) {
                str9 = "📢 " + str9;
            }
            ((TextView) view.findViewById(R.id.label_status)).setText(SmileHelper.getSmiledText(getActivity(), str9));
        }
        if (this.coverView != null) {
            String coverUrl = getCoverUrl(getActivity(), this.u);
            if (!TextUtils.isEmpty(coverUrl)) {
                KApplication.getImageLoader().DisplayImage(coverUrl, this.coverView, true, 800, Helper.getSquareStubId(), false);
            }
            this.coverView.setVisibility((!getCoverEnabled() || TextUtils.isEmpty(coverUrl)) ? 8 : 8);
        }
        new Handler().postDelayed(new Runnable() {
            @Override
            public final void run() {
                ProfileFragment.this.lambda$displayUser$1();
            }
        }, 1000L);
    }

    public void displayUserOnUiThread() {
        if (getActivity() == null) {
            return;
        }
        getActivity().runOnUiThread(new Runnable() {
            @Override
            public void run() {
                ProfileFragment profileFragment = ProfileFragment.this;
                profileFragment.displayUser(profileFragment.u, ProfileFragment.this.getView());
            }
        });
    }

    public void displayWallCount(Integer num) {
        TextView textView = this.tv_wall_count;
        if (textView == null || num == null) {
            return;
        }
        textView.setText(Integer.toString(num.intValue()));
    }

    public void displayWallCountInUiThread(final Integer[] numArr) {
        if (getActivity() == null || getActivity().isFinishing()) {
            return;
        }
        getActivity().runOnUiThread(new Runnable() {
            @Override
            public void run() {
                ProfileFragment.this.displayWallCount(numArr[0]);
                ProfileFragment profileFragment = ProfileFragment.this;
                Integer num = numArr[1];
                profileFragment.displayNotesCount(num != null ? num.intValue() : 0);
            }
        });
    }

    public static void displayYouBlacklisted(Activity activity) {
        String string = activity.getString(R.string.toast_you_blacklisted);
        AlertDialog.Builder builder = new AlertDialog.Builder(activity);
        builder.setMessage(string).setPositiveButton("OK", (DialogInterface.OnClickListener) null);
        AlertDialog create = builder.create();
        create.setCanceledOnTouchOutside(true);
        create.show();
    }

    public static void displayYouBlacklistedInUiThread(final Activity activity) {
        if (activity == null || activity.isFinishing()) {
            return;
        }
        activity.runOnUiThread(new Runnable() {
            @Override
            public void run() {
                ProfileFragment.displayYouBlacklisted(activity);
            }
        });
    }

    public void downloadAvatarsAlbum() {
        showProgressBar(true);
        new Thread() {
            @Override
            public void run() {
                KApplication.session.getPhotos(ProfileFragment.this.uid, -6L, null, 100, true, ProfileFragment.this.avatars_photos_callback, ProfileFragment.this.getActivity());
                ProfileFragment.this.showProgressBar(false);
            }
        }.start();
    }

    public void editPhotoBeforeUpload(ArrayList arrayList) {
        Intent intent = new Intent(getActivity(), PhotoUploadOptionsActivity.class);
        intent.putExtra("uris", arrayList);
        startActivityForResult(intent, 0);
    }

    private void fakeCheckInThread() {
        showProgressBar(true);
        new Thread() {
            @Override
            public void run() {
                FakeCheck.check(ProfileFragment.this.getActivity(), ProfileFragment.this.uid);
                ProfileFragment.this.showProgressBar(false);
                boolean isFake = FakeCheck.isFake();
                ProfileFragment.this.displayToast(isFake ? R.string.fake_positive : R.string.fake_negative);
                ProfileFragment.reportFakeCheck(isFake);
            }
        }.start();
    }

    private void faveAddUser() {
        final Callback callback = new Callback(getActivity()) {
            @Override
            public void error(Throwable th) {
                ProfileFragment.this.showProgressBar(false);
            }

            @Override
            public void ready(Object obj) {
                if (ProfileFragment.this.getActivity() == null) {
                    return;
                }
                ProfileFragment.this.showProgressBar(false);
                Integer num = (Integer) obj;
                if (num == null || num.intValue() != 1) {
                    return;
                }
                ProfileFragment.this.is_favorite = 1;
                ProfileFragment.this.displayToast(R.string.toast_bookmark_added);
            }
        };
        showProgressBar(true);
        new Thread() {
            @Override
            public void run() {
                Session session = KApplication.session;
                ProfileFragment profileFragment = ProfileFragment.this;
                session.faveAddPage(profileFragment.uid, null, callback, profileFragment.getActivity());
            }
        }.start();
    }

    private void faveRemoveUser() {
        final Callback callback = new Callback(getActivity()) {
            @Override
            public void error(Throwable th) {
                ProfileFragment.this.showProgressBar(false);
            }

            @Override
            public void ready(Object obj) {
                if (ProfileFragment.this.getActivity() == null) {
                    return;
                }
                ProfileFragment.this.showProgressBar(false);
                Integer num = (Integer) obj;
                if (num == null || num.intValue() != 1) {
                    return;
                }
                ProfileFragment.this.is_favorite = 0;
                ProfileFragment.this.displayToast(R.string.toast_bookmark_removed);
            }
        };
        showProgressBar(true);
        new Thread() {
            @Override
            public void run() {
                Session session = KApplication.session;
                ProfileFragment profileFragment = ProfileFragment.this;
                session.faveRemovePage(profileFragment.uid, null, callback, profileFragment.getActivity());
            }
        }.start();
    }

    public 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;
        }
    }

    public static int getBigAvaStubId() {
        return (!ImageLoader.roundAvatarsEnabled() || wideAva()) ? AttachmentsHelper.getResIdForNoPhoto4() : R.drawable.no_photo_circle;
    }

    public 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());
    }

    public 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());
    }

    public static String getCoverUrl(Activity activity, User user) {
        Display defaultDisplay = activity.getWindowManager().getDefaultDisplay();
        return (KApplication.isTablet ? Math.max(defaultDisplay.getWidth(), defaultDisplay.getHeight()) : Math.min(defaultDisplay.getWidth(), defaultDisplay.getHeight())) / 3 > 400 ? user.cover_960 : user.cover_400;
    }

    private void getIsFriendInThread() {
        new Thread() {
            @Override
            public void run() {
                KApplication.session.isFriend(ProfileFragment.this.uid.longValue(), null, ProfileFragment.this.is_friend_callback, ProfileFragment.this.getActivity());
            }
        }.start();
    }

    static Matrix getMatrix(int i, int i2, int i3, int i4, User.Rect rect) {
        double d;
        double d2;
        if (rect != null) {
            d = rect.y1;
            d2 = rect.y2;
        } else {
            d = 0.0d;
            d2 = 100.0d;
        }
        Matrix matrix = new Matrix();
        float f = i / i3;
        float f2 = i2;
        float f3 = i4;
        float max = Math.max(f, f2 / f3);
        matrix.postScale(max, max);
        float f4 = f3 * max;
        float f5 = (((((float) (d2 + d)) / 2.0f) * f4) / 100.0f) - (f2 / 2.0f);
        if (f5 < 0.0f) {
            f5 = 0.0f;
        }
        if (f5 + f2 > f4) {
            f5 = f4 - f2;
        }
        double d3 = f4;
        Double.isNaN(d3);
        double d4 = (d3 * d) / 100.0d;
        if (f5 > d4) {
            f5 = (float) d4;
        }
        matrix.postTranslate(0.0f, -f5);
        return matrix;
    }

    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);
        if (ImageLoader.roundAvatarsEnabled() && !wideAva()) {
            LinearLayout.LayoutParams layoutParams = (LinearLayout.LayoutParams) this.imv_profile_info_user_photo.getLayoutParams();
            layoutParams.setMargins(Helper.getDIP(10.0d), Helper.getDIP(10.0d), Helper.getDIP(10.0d), Helper.getDIP(10.0d));
            layoutParams.height = Helper.getDIP(120.0d);
            layoutParams.width = Helper.getDIP(120.0d);
            this.imv_profile_info_user_photo.requestLayout();
        }
        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.ll_profile_friends_region = view.findViewById(R.id.ll_profile_friends_region);
        View findViewById = view.findViewById(R.id.ll_profile_photos_region);
        View findViewById2 = view.findViewById(R.id.ll_profile_videos_region);
        View findViewById3 = view.findViewById(R.id.ll_profile_wall_region);
        View findViewById4 = view.findViewById(R.id.ll_profile_audio_region);
        this.add_friend_region = view.findViewById(R.id.add_friend_region);
        this.replies_region = view.findViewById(R.id.replies_region);
        this.ll_profile_faves_region = (LinearLayout) view.findViewById(R.id.ll_profile_faves_region);
        this.tv_friends_count = (TextView) view.findViewById(R.id.tv_friends_count);
        this.tv_albums_count = (TextView) view.findViewById(R.id.tv_albums_count);
        this.tv_photo_count = (TextView) view.findViewById(R.id.tv_photo_count);
        this.tv_photos_count = (TextView) view.findViewById(R.id.tv_photos_count);
        this.tv_audios_count = (TextView) view.findViewById(R.id.tv_audios_count);
        this.tv_videos_count = (TextView) view.findViewById(R.id.tv_videos_count);
        this.tv_notes_count = (TextView) view.findViewById(R.id.tv_notes_count);
        this.tv_groups_count = (TextView) view.findViewById(R.id.tv_groups_count);
        this.tv_followers_count = (TextView) view.findViewById(R.id.tv_followers_count);
        this.tv_gifts_count = (TextView) view.findViewById(R.id.tv_gifts_count);
        this.tv_wall_count = (TextView) view.findViewById(R.id.tv_wall_count);
        ((LinearLayout) view.findViewById(R.id.ll_subscriptions_region)).setOnClickListener(this.subscribersClickListener);
        ((LinearLayout) view.findViewById(R.id.ll_followers_region)).setOnClickListener(this.followersClickListener);
        this.ll_profile_friends_region.setOnClickListener(this.Friends_ClickListener);
        findViewById.setOnClickListener(this.Photos_ClickListener);
        findViewById2.setOnClickListener(this.Videos_ClickListener);
        findViewById3.setOnClickListener(this.Wall_ClickListener);
        findViewById4.setOnClickListener(this.Audio_ClickListener);
        this.buttons = view.findViewById(R.id.buttons);
        this.ll_profile_faves_region.setOnClickListener(this.faves_ClickListener);
        ((LinearLayout) view.findViewById(R.id.ll_profile_additional_info)).setOnClickListener(this.additional_info_ClickListener);
        this.tv_profile_info_id.setOnClickListener(this.profileIdClickListener);
        view.findViewById(R.id.ll_profile_groups_region).setOnClickListener(this.Groups_ClickListener);
        LinearLayout linearLayout = (LinearLayout) view.findViewById(R.id.ll_profile_user_photos_region);
        this.user_photos = linearLayout;
        linearLayout.setOnClickListener(this.userPhotosClickListener);
        View findViewById5 = view.findViewById(R.id.ll_profile_notes_region);
        this.notes_layout = findViewById5;
        findViewById5.setOnClickListener(this.Notes_ClickListener);
        view.findViewById(R.id.ll_profile_all_photos_region).setOnClickListener(this.allPhotosClickListener);
        LinearLayout linearLayout2 = (LinearLayout) view.findViewById(R.id.ll_profile_gifts_region);
        this.ll_profile_gifts_region = linearLayout2;
        linearLayout2.setOnClickListener(this.giftsClickListener);
        View findViewById6 = view.findViewById(R.id.ll_profile_docs_region);
        if (this.is_me) {
            findViewById6.setOnClickListener(this.docsClickListener);
        } else {
            findViewById6.setVisibility(8);
            View findViewById7 = view.findViewById(R.id.docs_separator);
            if (findViewById7 != null) {
                findViewById7.setVisibility(8);
            }
        }
        View findViewById8 = view.findViewById(R.id.stories);
        if (findViewById8 != null) {
            findViewById8.setOnClickListener(this.storiesClickListener);
        }
        setVisibleBirthdayRegion(false);
        setVisiblePlaceRegion(false);
        setVisibleEducationRegion(false);
        setVisibleFriendsRegionsRegion(!this.is_me);
        setVisibleFavesRegion(this.is_me);
        if (!this.is_me) {
            displayFriendStatus(view);
            if (this.new_profile) {
                ((ViewGroup) this.add_friend_region).getChildAt(0).setOnClickListener(this.friendClickListener);
            } else {
                this.add_friend_region.setOnClickListener(this.friendClickListener);
            }
        }
        if (this.new_profile) {
            ((ViewGroup) this.replies_region).getChildAt(0).setOnClickListener(this.repliesClickListener);
        } else {
            this.replies_region.setOnClickListener(this.repliesClickListener);
        }
        if (this.new_profile) {
            view.findViewById(R.id.label_status).setOnClickListener(this.statusClickListener);
        } else {
            view.findViewById(R.id.ll_profile_status_region).setOnClickListener(this.statusClickListener);
        }
        ImageView imageView2 = (ImageView) view.findViewById(R.id.cover);
        this.coverView = imageView2;
        if (imageView2 != null) {
            adjustCoverViewSize(getActivity(), this.coverView);
            this.coverView.setOnClickListener(new View.OnClickListener() {
                @Override
                public final void onClick(View view2) {
                    ProfileFragment.this.lambda$initUiFields$0(view2);
                }
            });
        }
    }

    public static boolean isFriend(Long l) {
        long parseLong = Long.parseLong(KApplication.session.getMid());
        if (l == null) {
            return false;
        }
        return KApplication.db.isFriend(parseLong, l.longValue());
    }

    public static boolean isOldProfile() {
        return PreferenceManager.getDefaultSharedPreferences(KApplication.current).getBoolean("key_old_profile", false);
    }

    public static boolean isTransparentHeader() {
        return (!wideAva() || KApplication.isTabletUi || isOldProfile()) ? false : true;
    }

    public void lambda$copyLink$3(ArrayList arrayList, String str, String str2, DialogInterface dialogInterface, int i) {
        int i2 = ((MenuItemDetails) arrayList.get(i)).code;
        if (i2 == 0) {
            Helper.copyText(str, getActivity());
        } else if (i2 == 1) {
            Helper.copyText(str2, getActivity());
        }
    }

    public void lambda$displayUser$1() {
        boolean z = false;
        View childAt = ((ViewGroup) this.replies_region).getChildAt(0);
        Integer num = this.can_write_private_message;
        childAt.setEnabled((num == null || num.intValue() != 0) ? true : true);
    }

    public void lambda$initUiFields$0(View view) {
        coverClick(getActivity(), this.u);
    }

    public void lambda$new$2(View view) {
        Intent intent = new Intent(getActivity(), StoriesActivity.class);
        intent.putExtra("owner_id", this.uid);
        startActivity(intent);
        reportClick("stories");
    }

    private void removeFromBlackList() {
        BlackListActivity.removeFromBlackList(this.uid_str, getActivity(), new BlackListActivity.BlackListCallback() {
            @Override
            public void onCompleted(boolean z) {
                if (z) {
                    ProfileFragment.this.blacklisted_by_me = 0;
                }
            }
        });
    }

    public void reportClick(String str) {
        try {
            this.clicked_item = str;
            if (System.nanoTime() % 100000 < 99995) {
                return;
            }
            TreeMap treeMap = new TreeMap();
            treeMap.put("item", str);
            FlurryAgent.logEvent("CLICK_IN_PROFILE", treeMap);
        } catch (Throwable th) {
            th.printStackTrace();
            Helper.reportError(th);
        }
    }

    public static void reportFakeCheck(boolean z) {
        if (System.nanoTime() % 1000 >= 10) {
            return;
        }
        TreeMap treeMap = new TreeMap();
        treeMap.put("res", z ? "1" : "0");
        FlurryAgent.logEvent("FAKE_CHECK", treeMap);
    }

    public static void sendGift(String str, Activity activity) {
        Helper.openUrlInBrowser("https://m.vk.com/gifts" + str + "?act=send", activity, true);
    }

    public static void setMatrix(ImageView imageView, Bitmap bitmap, User user) {
        if (imageView.getWidth() == 0 || bitmap == null || user == null) {
            return;
        }
        Matrix matrix = getMatrix(imageView.getWidth(), imageView.getHeight(), bitmap.getWidth(), bitmap.getHeight(), user.crop_photo_rect);
        imageView.setScaleType(ImageView.ScaleType.MATRIX);
        imageView.setImageMatrix(matrix);
    }

    private void setVisibleBirthdayRegion(boolean z) {
        this.tv_profile_info_birthday.setVisibility(z ? 0 : 8);
    }

    private void setVisibleEducationRegion(boolean z) {
        this.ll_profile_education_region.setVisibility(z ? 0 : 8);
    }

    private void setVisibleFavesRegion(boolean z) {
        this.ll_profile_faves_region.setVisibility((z && PreferenceManager.getDefaultSharedPreferences(KApplication.current).getString("key_profile_tab", "0").equals("1")) ? 0 : 8);
    }

    private void setVisibleFriendsRegion(boolean z) {
        this.ll_profile_friends_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);
        if (this.new_profile) {
            this.buttons.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) {
                ProfileFragment.this.addFriend(editText.getText().toString());
            }
        }).setNegativeButton(R.string.no, (DialogInterface.OnClickListener) null);
        builder.create().show();
    }

    public void showAdditionalInfo() {
        Intent intent = new Intent();
        intent.setClass(getActivity(), ExtraProfileActivity2.class);
        intent.putExtra("com.perm.kate.user_id", 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) {
                ProfileFragment.this.deleteFriend();
            }
        }).setNegativeButton(R.string.no, (DialogInterface.OnClickListener) null);
        builder.create().show();
    }

    public void showFaves() {
        Intent intent = new Intent();
        intent.setClass(getActivity(), FavesActivity2.class);
        startActivity(intent);
    }

    public void showFollowers() {
        Intent intent = new Intent();
        intent.putExtra("com.perm.kate.user_id", this.uid);
        intent.putExtra("com.perm.kate.followers", true);
        intent.setClass(getActivity(), FollowersActivity2.class);
        startActivity(intent);
    }

    public void showGiftsAcivity() {
        Intent intent = new Intent();
        intent.setClass(getActivity(), GiftsActivity.class);
        intent.putExtra("com.perm.kate.user_id", this.uid);
        startActivity(intent);
    }

    public static void showMentions(Context context, String str, Boolean bool) {
        if (bool == null || !bool.booleanValue()) {
            Intent intent = new Intent(context, SearchActivity.class);
            intent.putExtra("mentions", true);
            intent.putExtra("com.perm.kate.hashtag", str);
            context.startActivity(intent);
            return;
        }
        ((BaseActivity) context).displayToast(R.string.mentions_warning);
        Helper.openUrlInBrowser("https://m.vk.com/search?c[q]=*id" + str + "&c[section]=statuses&c[type]=1", context);
    }

    public static void showNewMessage(String str, Activity activity) {
        Intent intent = new Intent();
        intent.setClass(activity, NewMessageActivity.class);
        intent.putExtra("com.perm.kate.user_id", str);
        activity.startActivity(intent);
    }

    public void showProfileImage(ArrayList arrayList) {
        if (getActivity() == null || getActivity().isFinishing()) {
            return;
        }
        Intent intent = new Intent();
        intent.setClass(getActivity(), PhotoViewerActrivity.class);
        if (arrayList == null) {
            arrayList = new ArrayList();
        }
        if (arrayList.size() == 0 && this.u != null) {
            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;
            arrayList.add(photo);
        }
        intent.putExtra("com.perm.kate.photos", arrayList);
        startActivity(intent);
    }

    public void showStatusAcivity() {
        Intent intent = new Intent();
        intent.setClass(getActivity(), StatusActivity.class);
        startActivityForResult(intent, 1);
    }

    public void showStatusDialog() {
        AlertDialog create = new AlertDialog.Builder(getActivity()).setMessage(this.u.status).setPositiveButton(R.string.close, (DialogInterface.OnClickListener) null).setNegativeButton(R.string.label_copy, new DialogInterface.OnClickListener() {
            @Override
            public void onClick(DialogInterface dialogInterface, int i) {
                Helper.copyText(ProfileFragment.this.u.status, ProfileFragment.this.getActivity());
            }
        }).create();
        create.setCanceledOnTouchOutside(true);
        create.show();
    }

    public void showSubscribers() {
        Intent intent = new Intent();
        intent.putExtra("com.perm.kate.user_id", this.uid);
        intent.putExtra("com.perm.kate.followers", false);
        intent.setClass(getActivity(), FollowersActivity2.class);
        startActivity(intent);
    }

    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);
    }

    private static boolean wideAva() {
        return PreferenceManager.getDefaultSharedPreferences(KApplication.current).getBoolean("key_wide_ava", true);
    }

    @Override
    public void fillMenuItems(Menu menu) {
        Integer num;
        menu.add(0, 17, 1010, R.string.label_menu_new_message);
        menu.add(0, 35, 3900, R.string.label_copy_video_link);
        menu.add(0, 34, 1012, R.string.label_delete_friend);
        boolean isFriend = isFriend(this.uid);
        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);
            }
        }
        if (this.is_me || !isFriend) {
            menu.findItem(34).setVisible(false);
        } else {
            menu.findItem(34).setVisible(true);
        }
        if (this.is_me) {
            menu.findItem(17).setVisible(false);
        }
        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) {
            menu.add(0, 1014, 7014, R.string.label_edit);
        }
        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);
        menu.add(0, 1030, 7045, R.string.fake_check);
        menu.add(0, 1031, 8000, R.string.cover).setCheckable(true).setChecked(getCoverEnabled());
    }

    boolean getCoverEnabled() {
        return PreferenceManager.getDefaultSharedPreferences(KApplication.current).getBoolean("prof_cover_en", true);
    }

    @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 == 3 && i2 == -1) {
            refreshInThread();
        }
        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.add_friend_callback.setActivity(activity);
    }

    @Override
    public void onCreate(Bundle bundle) {
        super.onCreate(bundle);
        if (KApplication.session == null) {
            return;
        }
        setHasOptionsMenu(true);
        String string = getArguments().getString("com.perm.kate.user_id");
        this.uid_str = string;
        try {
            this.uid = Long.valueOf(Long.parseLong(string));
        } catch (Throwable th) {
            Helper.reportError(th, "uid_str=" + this.uid_str);
            th.printStackTrace();
        }
        this.me = Long.parseLong(KApplication.session.getMid());
        this.is_me = KApplication.session.getMid().equals(this.uid_str);
        if (bundle == null) {
            HashMap hashMap = refresh_time;
            Object[] objArr = (Object[]) hashMap.get(this.me + "_" + this.uid);
            if (objArr == null || ((Long) objArr[0]).longValue() <= System.currentTimeMillis() - 1800000) {
                refreshInThread();
                return;
            }
            String str = (String) objArr[1];
            this.deactivated = str;
            checkDeactivated(str);
            this.relation_partner_id = (Long) objArr[2];
            this.relation_partner_first_name = (String) objArr[3];
            this.relation_partner_last_name = (String) objArr[4];
            this.status_audio = (Audio) objArr[5];
            this.is_favorite = (Integer) objArr[6];
            this.can_write_private_message = (Integer) objArr[7];
            this.blacklisted_by_me = (Integer) objArr[8];
            Boolean bool = (Boolean) objArr[9];
            this.is_closed = bool;
            if (!this.is_me && bool != null && bool.booleanValue() && !isFriend(this.uid)) {
                displayToast(R.string.closed_profile);
            }
            Integer num = (Integer) objArr[10];
            if (num == null || num.intValue() != 1) {
                return;
            }
            displayYouBlacklistedInUiThread(getActivity());
        }
    }

    @Override
    public View onCreateView(LayoutInflater layoutInflater, ViewGroup viewGroup, Bundle bundle) {
        View view = null;
        try {
            int i = wideAva() ? R.layout.profile_info_layout_wide_ava : R.layout.profile_info_layout;
            if (!this.new_profile) {
                i = R.layout.profile_info_layout_old;
            }
            View inflate = layoutInflater.inflate(i, viewGroup, false);
            try {
                if (this.uid_str == null) {
                    return inflate;
                }
                initUiFields(inflate);
                this.u = KApplication.db.fetchUserFull(this.uid.longValue());
                fetchCityAndCountry();
                displayUser(this.u, inflate);
                User user = this.u;
                if (user != null) {
                    displayNotesCount(user.notes_count);
                }
                if (!this.is_me) {
                    getIsFriendInThread();
                    History.addUser(this.u);
                }
                if (this.new_profile) {
                    BaseFragment.setButtonsBg(inflate, new int[]{R.id.add_friend_region, R.id.replies_region});
                }
                if (!isTransparentHeader() || (getActivity() instanceof MainActivity)) {
                    return inflate;
                }
                this.scrollView = inflate.findViewById(R.id.scrollView);
                this.activity_header = getActivity().findViewById(R.id.ll_header);
                this.scrollView.getViewTreeObserver().addOnScrollChangedListener(new ScrollChangedListener());
                return inflate;
            } catch (Throwable th) {
                th = th;
                view = inflate;
                Helper.reportError(th);
                th.printStackTrace();
                if (th instanceof OutOfMemoryError) {
                    KApplication.getImageLoader().clearMemoryCache();
                }
                return view;
            }
        } catch (Throwable th2) {
            th = th2;
        }
    }

    @Override
    public void onDestroy() {
        super.onDestroy();
        if (this.clicked_item == null) {
            reportClick("none");
        }
    }

    @Override
    public boolean onOptionsItemSelected(MenuItem menuItem) {
        int itemId = menuItem.getItemId();
        if (itemId == 17) {
            showNewMessage(this.uid_str, getActivity());
            return true;
        } else if (itemId == 1000) {
            showProfileFromBrowser();
            return true;
        } else if (itemId == 1005) {
            if (!isFriend(this.uid)) {
                displayToast(R.string.toast_working_only_for_friends);
            }
            OnlineNotificationsHelper.setEnabledUser(getActivity(), this.uid.longValue(), true);
            return true;
        } else {
            int i = 0;
            if (itemId == 1007) {
                OnlineNotificationsHelper.setEnabledUser(getActivity(), this.uid.longValue(), false);
                return true;
            } else if (itemId == 1019) {
                deleteFriend();
                return true;
            } else if (itemId == 1021) {
                FriendsListsHelper.showFriendsListsDialogWithCheck((BaseActivity) getActivity(), this.uid);
                return true;
            } else if (itemId == 1013) {
                new ReportHelper(getActivity()).showReportUserDialog(this.uid.longValue());
                return true;
            } else if (itemId == 1014) {
                showOptionsDialog();
                return true;
            } else {
                switch (itemId) {
                    case 34:
                        showDeleteDialog();
                        return true;
                    case 35:
                        copyLink();
                        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:
                                sendGift(this.uid_str, getActivity());
                                return true;
                            case 1028:
                                RegistrationDate.getAndShow((BaseActivity) getActivity(), this.uid_str);
                                return true;
                            case 1029:
                                showMentions(getActivity(), this.uid_str, this.is_closed);
                                return true;
                            case 1030:
                                fakeCheckInThread();
                                return true;
                            case 1031:
                                setCoverEnabled(!getCoverEnabled());
                                ImageView imageView = this.coverView;
                                if (imageView != null) {
                                    imageView.setVisibility((!getCoverEnabled() || TextUtils.isEmpty(getCoverUrl(getActivity(), this.u))) ? 8 : 8);
                                }
                                return true;
                            default:
                                return super.onOptionsItemSelected(menuItem);
                        }
                }
            }
        }
    }

    @Override
    public void onRefreshButton() {
        refreshInThread();
    }

    void refreshInThread() {
        if (this.uid == null) {
            return;
        }
        showProgressBar(true);
        new Thread() {
            @Override
            public void run() {
                try {
                    ArrayList arrayList = new ArrayList();
                    arrayList.add(ProfileFragment.this.uid);
                    Api.tag = "PrFr_" + ProfileFragment.this.is_me;
                    KApplication.session.getProfiles(arrayList, null, "first_name,last_name,nickname,screen_name,sex,bdate,city,country,timezone,photo_50,photo_100,photo_200_orig,photo_200,photo_400_orig,has_mobile,education,online,activity,relation,last_seen,counters,is_favorite,can_write_private_message,verified,blacklisted_by_me,blacklisted,crop_photo,cover", "nom", ProfileFragment.this.callback_profile, ProfileFragment.this.getActivity());
                    if (Helper.empty(ProfileFragment.this.deactivated)) {
                        Thread.sleep(1000L);
                        KApplication.session.getWallNotesCount(ProfileFragment.this.uid.longValue(), ProfileFragment.this.callback_wall_count, ProfileFragment.this.getActivity());
                    }
                } catch (Throwable th) {
                    Helper.reportError(th);
                    th.printStackTrace();
                }
            }
        }.start();
    }

    void setCoverEnabled(boolean z) {
        PreferenceManager.getDefaultSharedPreferences(KApplication.current).edit().putBoolean("prof_cover_en", z).apply();
    }

    public void showEditProfileAcivity(Activity activity) {
        Intent intent = new Intent();
        intent.setClass(activity, EditProfileActivity.class);
        startActivityForResult(intent, 3);
    }

    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(ProfileFragment.this.getActivity(), ProfileFragment.this, false, false, false, null);
                } else if (i2 == 2) {
                    ProfileFragment.this.showStatusAcivity();
                } else if (i2 != 3) {
                } else {
                    ProfileFragment profileFragment = ProfileFragment.this;
                    profileFragment.showEditProfileAcivity(profileFragment.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());
    }
}