导航菜单

页面标题

页面副标题

Hyouka private v5.8.9 - BaseScreen.java 源代码

正在查看: Hyouka private v5.8.9 应用的 BaseScreen.java JAVA 源代码文件

本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。


package com.beint.project.screens;

import android.annotation.SuppressLint;
import android.app.Activity;
import android.content.ActivityNotFoundException;
import android.content.ComponentName;
import android.content.ContentUris;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.content.res.AssetFileDescriptor;
import android.content.res.Configuration;
import android.content.res.Resources;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Rect;
import android.net.Uri;
import android.os.AsyncTask;
import android.os.Bundle;
import android.os.CountDownTimer;
import android.os.Handler;
import android.os.Looper;
import android.os.PowerManager;
import android.os.Process;
import android.provider.ContactsContract;
import android.provider.Settings;
import android.provider.Telephony;
import android.text.Spannable;
import android.text.TextUtils;
import android.util.DisplayMetrics;
import android.util.Pair;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.View;
import android.view.ViewGroup;
import android.view.animation.Animation;
import android.view.animation.ScaleAnimation;
import android.view.inputmethod.InputMethodManager;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.ProgressBar;
import android.widget.RelativeLayout;
import android.widget.TextView;
import android.widget.Toast;
import androidx.appcompat.app.c;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentActivity;
import com.beint.project.AbstractZangiActivity;
import com.beint.project.BuyCreditActivity;
import com.beint.project.Engine;
import com.beint.project.ExtensionsKt;
import com.beint.project.MainApplication;
import com.beint.project.adapter.AledtDialogAdapter;
import com.beint.project.adapter.FontScaleSizeAdapter;
import com.beint.project.adapter.MuteListAdapter;
import com.beint.project.call.CallHelper;
import com.beint.project.core.UserLastActivity.LastActivity;
import com.beint.project.core.managers.AvatarManager;
import com.beint.project.core.managers.AvatarSizeType;
import com.beint.project.core.managers.ConferenceManager;
import com.beint.project.core.managers.OrientationManager;
import com.beint.project.core.managers.SystemServiceManager;
import com.beint.project.core.model.contact.Contact;
import com.beint.project.core.model.contact.ContactNumber;
import com.beint.project.core.model.contact.Profile;
import com.beint.project.core.model.http.ServiceResult;
import com.beint.project.core.model.mute.Mute;
import com.beint.project.core.model.recent.ZangiRecentGroup;
import com.beint.project.core.model.sms.Conversation;
import com.beint.project.core.model.sms.GroupMember;
import com.beint.project.core.model.sms.GroupMemberCallState;
import com.beint.project.core.services.impl.BlockContactServiceImpl;
import com.beint.project.core.services.impl.ContactsManager;
import com.beint.project.core.services.impl.PathManager;
import com.beint.project.core.services.impl.SignalingService;
import com.beint.project.core.services.impl.StorageService;
import com.beint.project.core.services.impl.ZangiConfigurationService;
import com.beint.project.core.services.impl.ZangiHTTPServices;
import com.beint.project.core.services.impl.ZangiMessagingService;
import com.beint.project.core.services.impl.ZangiMuteService;
import com.beint.project.core.services.impl.ZangiProfileServiceImpl;
import com.beint.project.core.signal.AVSession;
import com.beint.project.core.utils.AvatarImageView;
import com.beint.project.core.utils.CacheManager;
import com.beint.project.core.utils.Constants;
import com.beint.project.core.utils.InitialsAvatarBitmap;
import com.beint.project.core.utils.Log;
import com.beint.project.core.utils.ZangiEngineUtils;
import com.beint.project.core.utils.ZangiFileUtils;
import com.beint.project.core.utils.ZangiPermissionUtils;
import com.beint.project.core.utils.videoconvert.VideoConverter;
import com.beint.project.enums.MultySelectType;
import com.beint.project.items.FontScaleListItem;
import com.beint.project.items.ILoadingView;
import com.beint.project.items.InfoAdditionalItem;
import com.beint.project.items.MultiLanguageListItem;
import com.beint.project.items.MuteListItem;
import com.beint.project.managers.ContactsManagerHelper;
import com.beint.project.managers.InviteController;
import com.beint.project.screens.ContactInfoActivity;
import com.beint.project.screens.contacts.MultiSelectListFragment;
import com.beint.project.screens.contacts.ScreenTabContacts;
import com.beint.project.screens.phone.ScreenVideoCall;
import com.beint.project.screens.register.LoginPagesListener;
import com.beint.project.screens.sms.MapLocationPicker;
import com.beint.project.screens.sms.TakePhotoActivity;
import com.beint.project.screens.sms.gallery.enums.DestinationType;
import com.beint.project.screens.utils.ImageLoader;
import com.beint.project.services.IMediaRecordAndPlayService;
import com.beint.project.services.IScreenService;
import com.beint.project.services.impl.MediaRecordAndPlay;
import com.beint.project.utils.AlertDialogUtils;
import com.beint.project.utils.DeviceTokenResolver;
import com.beint.project.utils.FastDataTimeUtils;
import com.beint.project.utils.ProjectUtils;
import com.fasterxml.jackson.core.util.MinimalPrettyPrinter;
import java.io.File;
import java.io.IOException;
import java.io.Serializable;
import java.text.DateFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Calendar;
import java.util.Date;
import java.util.GregorianCalendar;
import java.util.LinkedList;
import java.util.List;
import java.util.Locale;

public abstract class BaseScreen extends Fragment implements IBaseScreen {
    private static String TAG = "com.beint.project.screens.BaseScreen";
    protected static SCREEN_TYPE mType;
    public static long time;
    public static Toast toast;
    WhiteListRequestCallBack callBack;
    private boolean fromTimer;
    protected String mId;
    public static final Object timerMonitor = new Object();
    protected static Boolean waitingSms = Boolean.FALSE;
    public static int REQUEST_CODE_BROWS_FILE = 777;
    private static CountDownTimer myTimer = null;
    protected static long daySeconds = DeviceTokenResolver.REGISTRATION_EXPIRY_TIME_MS;
    final Handler progressBarHandler = new Handler(Looper.getMainLooper());
    private boolean isSavedInstanceState = false;
    private boolean isDestroyed = false;
    private int WHITE_LIST_REQUEST_CODE = 9417;

    static class AnonymousClass28 {
        static final int[] $SwitchMap$com$beint$project$core$model$mute$Mute$MuteType;

        static {
            int[] iArr = new int[Mute.MuteType.values().length];
            $SwitchMap$com$beint$project$core$model$mute$Mute$MuteType = iArr;
            try {
                iArr[Mute.MuteType.NOT_MUTED.ordinal()] = 1;
            } catch (NoSuchFieldError unused) {
            }
            try {
                $SwitchMap$com$beint$project$core$model$mute$Mute$MuteType[Mute.MuteType.MUTED_15_MIN.ordinal()] = 2;
            } catch (NoSuchFieldError unused2) {
            }
            try {
                $SwitchMap$com$beint$project$core$model$mute$Mute$MuteType[Mute.MuteType.MUTED_60_MIN.ordinal()] = 3;
            } catch (NoSuchFieldError unused3) {
            }
            try {
                $SwitchMap$com$beint$project$core$model$mute$Mute$MuteType[Mute.MuteType.MUTED_8_HRS.ordinal()] = 4;
            } catch (NoSuchFieldError unused4) {
            }
            try {
                $SwitchMap$com$beint$project$core$model$mute$Mute$MuteType[Mute.MuteType.MUTED_24_HRS.ordinal()] = 5;
            } catch (NoSuchFieldError unused5) {
            }
            try {
                $SwitchMap$com$beint$project$core$model$mute$Mute$MuteType[Mute.MuteType.MUTED_FOREVER.ordinal()] = 6;
            } catch (NoSuchFieldError unused6) {
            }
        }
    }

    public enum SCREEN_TYPE {
        ABOUT_T,
        AV_QUEUE_T,
        CHAT_T,
        CHAT_WITH_T,
        CHAT_QUEUE_T,
        CODECS_T,
        CODERETRIVE_T,
        CONTACTS_T,
        CONVERSATION_T,
        COUNTRY_T,
        DIALER_T,
        DIFFERENT_T,
        EDITCONTACT_T,
        FILETRANSFER_QUEUE_T,
        FILETRANSFER_VIEW_T,
        GET_CODE_T,
        HOME_T,
        GET_CODE_ERROR,
        HOME_T1,
        HAWK_T,
        IDENTITY_T,
        INTERCEPT_CALL_T,
        GENERAL_T,
        MESSAGING_T,
        MORE_T,
        ROAMING,
        EDITROAMING,
        ADD_ROAMING,
        NATT_T,
        NETWORK_T,
        PRESENCE_T,
        QOS_T,
        SETTINGS_T,
        SETTINGS1_T,
        SETUPSPLASH_T,
        SIGN_T,
        CHAT_SETTING_T,
        CHAT_SETTINGS_T,
        SECURITY_T,
        SPLASH_T,
        PROFILE_T,
        XMPP_CHAT_T,
        TAB_RECENT_T,
        TAB_CONTACTS,
        TAB_HISTORY_T,
        TAB_INFO_T,
        TAB_ONLINE,
        TAB_MESSAGES_T,
        TAB_SMS_T,
        ADD_CONTACT_NEW,
        AV_UTILS,
        CALL_TRYING,
        VIDEO_CALL,
        INCOMING_CALL,
        OUTGOING_CALL,
        IN_CALL,
        SIGN_IN,
        PROXITI_BASE,
        ZNAGI_MESSAGE_DIALOG,
        USER_PROMOTIONS,
        RATE_GET_FRAGMENT,
        GETTING_STARTED_FRAGMENT,
        BALANCE_FRAGMENT,
        AV_T,
        STICKER_GRID_VIEW,
        MY_FREE_MINUTES,
        FREE_MINUTES_LIST,
        SHARE_FACEBOOK,
        BASE_AV_CALL_SCREEN,
        VERIFY_FIRST_LOGIN,
        JOIN_ZANGI,
        FORGOT_PASS,
        GROUP_CHAT,
        RESET_PASS,
        USER_NUMBER,
        SCREEN_VERIFY_NUMBER,
        USER_NUMBER_FORGOT_PASS,
        SMILE_GRID,
        FILE_TANS_FRAGMENT,
        FREE_MINUTES_INFO_FRAGMENT,
        ENTER_PIN_FRAGMENT,
        STICKERS_LIST,
        STICKERS_PREVIEW,
        SCREEN_BUSY,
        SCREEN_UNAVAILABLE,
        THUMBNAIL_GALLERRY_FRAGMENT,
        VIDEO_THUMBNAIL_GALLERRY_FRAGMENT,
        IMAGE_SEND_FRAGMENT,
        MULTISELECT_LIST,
        R_SH_IN_RATE,
        R_SH_IN_SHARE,
        R_SH_IN_INVITE,
        STICKER_SHARE,
        RATES_FRAGMENT,
        SHARED_MEDIA_FRAGMENT,
        ABOUT_CREDIT,
        BALANCE_TRANSFER
    }

    protected BaseScreen() {
    }

    private void _locationClickListener() {
        String string = getString(2131886084);
        String string2 = Settings.Secure.getString(getActivity().getContentResolver(), "location_providers_allowed");
        if (string2 == null || string2.contains("gps")) {
            Intent intent = new Intent((Context) getActivity(), (Class<?>) MapLocationPicker.class);
            intent.addFlags(16777216);
            getActivity().startActivityForResult(intent, Constants.MAP_RESULT_CODE);
            return;
        }
        c.a alertDialog = AlertDialogUtils.getAlertDialog(getActivity());
        alertDialog.r(2131886085);
        alertDialog.i(string);
        alertDialog.p(getActivity().getString(2131887587).toUpperCase(), new DialogInterface.OnClickListener() {
            @Override
            public void onClick(DialogInterface dialogInterface, int i) {
                Intent intent2 = new Intent("android.settings.LOCATION_SOURCE_SETTINGS");
                intent2.addFlags(1073741824);
                BaseScreen.this.startActivity(intent2);
            }
        });
        alertDialog.k(getActivity().getString(2131886274).toUpperCase(), (DialogInterface.OnClickListener) null);
        androidx.appcompat.app.c a = alertDialog.a();
        a.show();
        a.getWindow().setLayout(AlertDialogUtils.getAlertSize(), -2);
        AlertDialogUtils.setCurrentDialog(a);
    }

    private void _openGallery() {
        c.a alertDialog = AlertDialogUtils.getAlertDialog(getActivity());
        alertDialog.r(2131887090);
        MainApplication.Companion companion = MainApplication.Companion;
        alertDialog.g(new CharSequence[]{companion.getMainContext().getString(2131887158), companion.getMainContext().getString(2131887651)}, new DialogInterface.OnClickListener() {
            @Override
            public void onClick(DialogInterface dialogInterface, int i) {
                if (i == 0) {
                    BaseScreen.getScreenService().openZangiFileGalleryActivity(BaseScreen.this.getActivity(), DestinationType.SELECT_IMAGE, null);
                } else {
                    if (i != 1) {
                        return;
                    }
                    if (VideoConverter.getInstance().isConverting()) {
                        BaseScreen.this.showInfoMessage(2131886750);
                    } else {
                        BaseScreen.getScreenService().openZangiFileGalleryActivity(BaseScreen.this.getActivity(), DestinationType.SELECT_VIDEO, null);
                    }
                }
            }
        });
        androidx.appcompat.app.c a = alertDialog.a();
        a.setCanceledOnTouchOutside(true);
        a.show();
        a.getWindow().setLayout(AlertDialogUtils.getAlertSize(), -2);
        AlertDialogUtils.setCurrentDialog(a);
    }

    private void _takePhotoclickListener() {
        if (getActivity() == null || getActivity().isFinishing() || !isAdded()) {
            return;
        }
        TakePhotoActivity.Companion.removeStates();
        Intent intent = new Intent((Context) getActivity(), (Class<?>) TakePhotoActivity.class);
        intent.putExtra("capture_from_camera", "photo");
        intent.addFlags(16777216);
        intent.addFlags(8388608);
        if (ZangiMessagingService.getInstance().getCurrChat() != null) {
            intent.putExtra("conversationId", ZangiMessagingService.getInstance().getCurrChat().getConversationId());
        }
        getActivity().startActivityForResult(intent, Constants.FILE_RESULT_CODE);
    }

    private void _takeVideo() {
        TakePhotoActivity.Companion.removeStates();
        Intent intent = new Intent((Context) getActivity(), (Class<?>) TakePhotoActivity.class);
        intent.putExtra("capture_from_camera", "video");
        intent.addFlags(16777216);
        intent.addFlags(8388608);
        intent.putExtra("android.intent.extra.videoQuality", 0);
        if (ZangiMessagingService.getInstance().getCurrChat() != null) {
            intent.putExtra("conversationId", ZangiMessagingService.getInstance().getCurrChat().getConversationId());
        }
        if (getActivity() != null) {
            getActivity().startActivityForResult(intent, Constants.FILE_RESULT_CODE);
        }
    }

    public static void disableMyAppForShare(Context context) {
        context.getApplicationContext().getPackageManager().setComponentEnabledSetting(new ComponentName(context.getPackageName(), ShareActivity.TAG), 2, 1);
    }

    public static void enableMyAppForShare(Context context) {
        context.getApplicationContext().getPackageManager().setComponentEnabledSetting(new ComponentName(context.getPackageName(), ShareActivity.TAG), 1, 1);
    }

    private Bitmap getAvatarLetterBitmapInCall(String str, String str2) {
        String str3 = str + AvatarManager.INSTANCE.getAvatarSize(AvatarSizeType.BIG);
        CacheManager cacheManager = CacheManager.INSTANCE;
        Bitmap bitmapFromMemCache = cacheManager.getBitmapFromMemCache(str3);
        if (bitmapFromMemCache != null) {
            return bitmapFromMemCache;
        }
        Bitmap letterBitmap = AvatarImageView.Companion.getLetterBitmap(getContext(), str2);
        if (letterBitmap == null) {
            return letterBitmap;
        }
        Bitmap croppedBitmap = ProjectUtils.getCroppedBitmap(letterBitmap);
        cacheManager.addBitmapToMemoryCache(str3, croppedBitmap);
        return croppedBitmap;
    }

    private String getMuteText(Mute.MuteType muteType, Long l, boolean z) {
        String format;
        Calendar calendar = Calendar.getInstance();
        calendar.setTimeInMillis(l.longValue());
        Context mainContext = getContext() == null ? MainApplication.Companion.getMainContext() : getContext();
        if (calendar.get(7) > Calendar.getInstance().get(7)) {
            format = mainContext.getResources().getString(2131886978) + MinimalPrettyPrinter.DEFAULT_ROOT_VALUE_SEPARATOR + DateFormat.getTimeInstance(3, Locale.getDefault()).format(calendar.getTime());
        } else {
            format = DateFormat.getTimeInstance(3, Locale.getDefault()).format(calendar.getTime());
        }
        switch (AnonymousClass28.$SwitchMap$com$beint$project$core$model$mute$Mute$MuteType[muteType.ordinal()]) {
            case 1:
                return mainContext.getResources().getString(2131887079);
            case 2:
            case 3:
            case 4:
            case 5:
                return String.format(getResources().getString(2131886976), format);
            case 6:
                return z ? mainContext.getResources().getString(2131887075) : mainContext.getResources().getString(2131887079);
            default:
                return "";
        }
    }

    private float getNearlyValue(float[] fArr, float f) {
        int i = 0;
        float abs = Math.abs(fArr[0] - f);
        for (int i7 = 1; i7 < fArr.length; i7++) {
            float abs2 = Math.abs(fArr[i7] - f);
            if (abs2 < abs) {
                i = i7;
                abs = abs2;
            }
        }
        return fArr[i];
    }

    public static IMediaRecordAndPlayService getRecordService() {
        return Engine.getInstance().getRecordService();
    }

    public static MediaRecordAndPlay.MediaState getRecordServiceState() {
        return Engine.getInstance().getRecordServiceState();
    }

    public static IScreenService getScreenService() {
        return Engine.getInstance().getScreenService();
    }

    public static SCREEN_TYPE getType() {
        return mType;
    }

    public static boolean hasBack() {
        return false;
    }

    public static void inviteByMail(Context context, String str) {
        disableMyAppForShare(context);
        Intent intent = new Intent("android.intent.action.SEND");
        intent.putExtra("android.intent.extra.EMAIL", new String[0]);
        intent.putExtra("android.intent.extra.SUBJECT", context.getString(2131887353));
        intent.putExtra("android.intent.extra.TEXT", context.getString(2131886735));
        intent.setType("text/plain");
        context.startActivity(Intent.createChooser(intent, str));
    }

    public static void inviteFriends(final Context context) {
        c.a alertDialog = AlertDialogUtils.getAlertDialog(context);
        alertDialog.r(2131887354);
        alertDialog.d(true);
        alertDialog.g(new CharSequence[]{context.getString(2131886743), context.getString(2131886744)}, new DialogInterface.OnClickListener() {
            @Override
            public void onClick(DialogInterface dialogInterface, int i) {
                if (i == 0) {
                    Intent intent = new Intent();
                    intent.putExtra(Constants.LOAD_ONLY_NOT_ZANGI_CONTACTS, (Serializable) MultySelectType.INVITE_FRIENDS);
                    BaseScreen.getScreenService().showFragment(MultiSelectListFragment.class, intent, (Activity) null, Boolean.FALSE);
                } else {
                    if (i != 1) {
                        return;
                    }
                    Context context2 = context;
                    BaseScreen.inviteByMail(context2, context2.getString(2131887358));
                }
            }
        });
        androidx.appcompat.app.c a = alertDialog.a();
        a.setCanceledOnTouchOutside(true);
        a.show();
        a.getWindow().setLayout(AlertDialogUtils.getAlertSize(), -2);
    }

    public static void inviteFriendsByRegistration(final Activity activity, final LoginPagesListener loginPagesListener, final String str) {
        c.a alertDialog = AlertDialogUtils.getAlertDialog(activity);
        alertDialog.r(2131887354);
        alertDialog.d(true);
        alertDialog.g(new CharSequence[]{activity.getString(2131886743), activity.getString(2131886744)}, new DialogInterface.OnClickListener() {
            @Override
            public void onClick(DialogInterface dialogInterface, int i) {
                if (i == 0) {
                    if (ZangiConfigurationService.INSTANCE.getBoolean("SHOW_PRIVACY_POLICY_DIALOG", false)) {
                        BaseScreen.onAcceptClick(activity, loginPagesListener, str);
                        return;
                    } else {
                        BaseScreen.showContactPermissionDialog(activity, loginPagesListener, str);
                        return;
                    }
                }
                if (i != 1) {
                    return;
                }
                String format = String.format(activity.getString(2131886738), str);
                BaseScreen.disableMyAppForShare(activity);
                Intent intent = new Intent("android.intent.action.SEND");
                intent.putExtra("android.intent.extra.EMAIL", new String[0]);
                intent.putExtra("android.intent.extra.SUBJECT", activity.getString(2131887353));
                intent.putExtra("android.intent.extra.TEXT", format);
                intent.setType("text/plain");
                Activity activity2 = activity;
                activity2.startActivity(Intent.createChooser(intent, activity2.getString(2131887358)));
            }
        });
        androidx.appcompat.app.c a = alertDialog.a();
        a.setCanceledOnTouchOutside(true);
        a.show();
        a.getWindow().setLayout(AlertDialogUtils.getAlertSize(), -2);
    }

    public void lambda$galleryOnClickListener$1(ArrayList arrayList, boolean z) {
        if (z) {
            _openGallery();
        }
    }

    public void lambda$locationClickListener$0(ArrayList arrayList, boolean z) {
        if (z) {
            _locationClickListener();
        }
    }

    public static void lambda$onAcceptClick$6(LoginPagesListener loginPagesListener, String str, ArrayList arrayList, boolean z) {
        if (!z || loginPagesListener == null) {
            return;
        }
        loginPagesListener.goToInviteContactsScreen(str);
    }

    public static void lambda$showContactPermissionDialog$5(DialogInterface dialogInterface, int i) {
        ZangiConfigurationService.INSTANCE.putBoolean("Contacts_Asked_Permission", true);
    }

    public static void lambda$showForceKeypad$8(Activity activity, View view) {
        InputMethodManager inputMethodManager = (InputMethodManager) activity.getSystemService("input_method");
        view.requestFocus();
        inputMethodManager.toggleSoftInput(2, 0);
    }

    public void lambda$showKeyPad$7(View view) {
        if (getActivity() == null) {
            return;
        }
        view.requestFocus();
        if (view instanceof EditText) {
            EditText editText = (EditText) view;
            editText.setSelection(editText.getText().length());
        }
        ((InputMethodManager) getActivity().getSystemService("input_method")).showSoftInput(view, 1);
    }

    public void lambda$takePhotoclickListener$3(ArrayList arrayList, boolean z) {
        if (z) {
            _takePhotoclickListener();
        }
    }

    public void lambda$takeVideoClickListener$2(ArrayList arrayList, boolean z) {
        if (z) {
            _takeVideo();
        }
    }

    public static void onAcceptClick(Activity activity, final LoginPagesListener loginPagesListener, final String str) {
        ZangiConfigurationService.INSTANCE.putBoolean("SHOW_PRIVACY_POLICY_DIALOG", true, true);
        if (!ZangiPermissionUtils.hasPermissionForRegistration(activity, 1006, new ZangiPermissionUtils.OnPermissionResult() {
            public final void onResult(ArrayList arrayList, boolean z) {
                BaseScreen.lambda$onAcceptClick$6(LoginPagesListener.this, str, arrayList, z);
            }
        }) || loginPagesListener == null) {
            return;
        }
        loginPagesListener.goToInviteContactsScreen(str);
    }

    private void setVideoBg(ImageView imageView, Bitmap bitmap) {
        if (bitmap != null) {
            imageView.setImageBitmap(ZangiMessagingService.getInstance().blureImage(bitmap, 15));
        }
    }

    public static void showContactPermissionDialog(final Activity activity, final LoginPagesListener loginPagesListener, final String str) {
        if (activity == null || activity.isFinishing()) {
            return;
        }
        AlertDialogUtils.showAlertWithMessage((Context) activity, 2131886181, (Spannable) SpannableBuilderManager.INSTANCE.getPrivacyPolicySpannableBuilder(activity, activity.getResources().getString(2131887129)), 2131886369, 2131886439, new DialogInterface.OnClickListener() {
            @Override
            public final void onClick(DialogInterface dialogInterface, int i) {
                BaseScreen.onAcceptClick(activity, loginPagesListener, str);
            }
        }, new DialogInterface.OnClickListener() {
            @Override
            public final void onClick(DialogInterface dialogInterface, int i) {
                BaseScreen.lambda$showContactPermissionDialog$5(dialogInterface, i);
            }
        }, true);
    }

    public static void showCustomToast(Context context, String str) {
        if (context == null) {
            return;
        }
        try {
            View inflate = LayoutInflater.from(context).inflate(2131558783, (ViewGroup) null);
            ((TextView) inflate.findViewById(2131363843)).setText(str);
            Toast toast2 = toast;
            if (toast2 != null) {
                toast2.cancel();
            }
            Toast toast3 = new Toast(context);
            toast = toast3;
            toast3.setView(inflate);
            toast.setDuration(1);
            if (inflate.getWindowToken() == null) {
                toast.show();
            }
        } catch (Exception e) {
            Log.i(TAG, "showCustomToast error = " + e.getMessage());
        }
    }

    public static void showForwardingCustomToast(Context context, int i) {
        if (context == null) {
            return;
        }
        try {
            View inflate = LayoutInflater.from(context).inflate(2131558783, (ViewGroup) null);
            TextView textView = (TextView) inflate.findViewById(2131363843);
            textView.setText(i);
            textView.setCompoundDrawablesWithIntrinsicBounds(2131231295, 0, 0, 0);
            textView.setCompoundDrawablePadding(ProjectUtils.dpToPx(8));
            textView.setIncludeFontPadding(false);
            Toast toast2 = toast;
            if (toast2 != null) {
                toast2.cancel();
            }
            Toast toast3 = new Toast(context);
            toast = toast3;
            toast3.setView(inflate);
            toast.setDuration(1);
            if (inflate.getWindowToken() == null) {
                toast.show();
            }
        } catch (Exception e) {
            Log.i(TAG, "showCustomToast error = " + e.getMessage());
        }
    }

    public void showMultiSelectListFragment() {
        Intent intent = new Intent();
        intent.putExtra(Constants.LOAD_ONLY_NOT_ZANGI_CONTACTS, (Serializable) MultySelectType.CONVERSTAION_CONTACTS);
        getScreenService().showFragment(MultiSelectListFragment.class, intent, (Activity) null, Boolean.FALSE);
    }

    public void back() {
        if (this.isSavedInstanceState || getActivity() == null) {
            return;
        }
        getActivity().onBackPressed();
    }

    public void blockContactAlertDialog(final List<String> list, final TextView textView) {
        if (getActivity() == null) {
            return;
        }
        c.a alertDialog = AlertDialogUtils.getAlertDialog(getActivity());
        alertDialog.r(2131886219);
        alertDialog.h(2131886224);
        alertDialog.d(true);
        alertDialog.p(getActivity().getString(2131886219).toUpperCase(), new DialogInterface.OnClickListener() {
            @Override
            public void onClick(DialogInterface dialogInterface, int i) {
                BlockContactServiceImpl.getInstance().blockContactNumber(list, ZangiEngineUtils.getZipCode());
                textView.setText(BaseScreen.this.getActivity().getString(2131887602));
            }
        });
        alertDialog.k(getActivity().getString(2131886274).toUpperCase(), new DialogInterface.OnClickListener() {
            @Override
            public void onClick(DialogInterface dialogInterface, int i) {
            }
        });
        androidx.appcompat.app.c a = alertDialog.a();
        a.show();
        a.getWindow().setLayout(AlertDialogUtils.getAlertSize(), -2);
        AlertDialogUtils.setCurrentDialog(a);
    }

    public void buyCredite() {
        if (Constants.IS_GOOG_PLAY_PURCHASE_ENABLED) {
            getActivity().startActivity(new Intent(getContext(), (Class<?>) BuyCreditActivity.class));
        } else {
            getActivity().startActivity(new Intent(getContext(), (Class<?>) BuyCreditActivity.class));
        }
    }

    protected boolean callPhoto(Contact contact, ImageView imageView, ImageView imageView2, View view, TextView textView, String str, int i, boolean z, String str2) {
        boolean z6;
        Bitmap bitmap;
        boolean z7;
        Bitmap bitmap2;
        int i7;
        String str3 = "";
        if (contact == null || contact.getIdentifire().equals("")) {
            Profile userProfile = ZangiProfileServiceImpl.getInstance().getUserProfile(str);
            if (userProfile != null) {
                String firstName = userProfile.getFirstName();
                String lastName = userProfile.getLastName();
                if (firstName == null || firstName.isEmpty()) {
                    firstName = "";
                }
                if (lastName != null && !lastName.isEmpty()) {
                    firstName = firstName + MinimalPrettyPrinter.DEFAULT_ROOT_VALUE_SEPARATOR + lastName;
                }
                if (firstName.replaceAll(MinimalPrettyPrinter.DEFAULT_ROOT_VALUE_SEPARATOR, "").isEmpty()) {
                    if (TextUtils.isEmpty(str2) || !Constants.IS_DISPLAY_EMAIL_TURN_ON) {
                        String localeFormatNumber = ProjectUtils.localeFormatNumber(str);
                        if (!localeFormatNumber.startsWith("+") && !ContactsManager.INSTANCE.isDummyNumber(localeFormatNumber)) {
                            localeFormatNumber = "+" + localeFormatNumber;
                        }
                        ExtensionsKt.setTextWithDividerIfNeeded(textView, localeFormatNumber);
                    } else {
                        textView.setText(str2);
                    }
                    z6 = true;
                } else {
                    ExtensionsKt.setTextWithDividerIfNeeded(textView, firstName);
                    z6 = false;
                }
                if (userProfile.getImg() == null || userProfile.getImg().isEmpty()) {
                    ZangiProfileServiceImpl.getInstance().deleteFileIfExist(userProfile.getKey(), true);
                    bitmap2 = null;
                } else {
                    bitmap2 = BitmapFactory.decodeFile(ZangiProfileServiceImpl.getInstance().getProfileAvatarDir(userProfile.getKey()), new BitmapFactory.Options());
                }
                str3 = firstName;
                bitmap = bitmap2;
            } else {
                String str4 = str2;
                String localeFormatNumber2 = ProjectUtils.localeFormatNumber(str);
                if (TextUtils.isEmpty(str2) || !Constants.IS_DISPLAY_EMAIL_TURN_ON) {
                    if (localeFormatNumber2 == null) {
                        str4 = "";
                    } else if (localeFormatNumber2.startsWith("+") || ZangiEngineUtils.isShortNumber(localeFormatNumber2) || ContactsManager.INSTANCE.isDummyNumber(localeFormatNumber2)) {
                        str4 = localeFormatNumber2;
                    } else {
                        str4 = "+" + localeFormatNumber2;
                    }
                }
                ExtensionsKt.setTextWithDividerIfNeeded(textView, str4);
                z6 = true;
                bitmap = null;
            }
            z7 = false;
        } else {
            Profile userProfile2 = ZangiProfileServiceImpl.getInstance().getUserProfile(str);
            bitmap = userProfile2 != null ? (userProfile2.getImg() == null || userProfile2.getImg().isEmpty()) ? ContactsManagerHelper.INSTANCE.openPhoto(contact.getIdentifire(), imageView.getLayoutParams().height) : BitmapFactory.decodeFile(ZangiProfileServiceImpl.getInstance().getProfileAvatarDir(userProfile2.getKey()), new BitmapFactory.Options()) : ContactsManagerHelper.INSTANCE.openPhoto(contact.getIdentifire(), imageView.getLayoutParams().height);
            if (bitmap == null && contact.getPpUriSuffix() != null) {
                bitmap = BitmapFactory.decodeFile(ZangiProfileServiceImpl.getInstance().getProfileAvatarDir(contact.getPpUriSuffix()), new BitmapFactory.Options());
            }
            if (bitmap == null) {
                String str5 = contact.getIdentifire() + AvatarManager.INSTANCE.getAvatarSize(AvatarSizeType.SMALL);
                CacheManager cacheManager = CacheManager.INSTANCE;
                Bitmap bitmapFromMemCache = cacheManager.getBitmapFromMemCache(str5);
                if (z && bitmapFromMemCache == null) {
                    Bitmap letterBitmap = AvatarImageView.Companion.getLetterBitmap(getContext(), contact.getFirstName() + MinimalPrettyPrinter.DEFAULT_ROOT_VALUE_SEPARATOR + contact.getLastName());
                    if (letterBitmap != null) {
                        letterBitmap = ProjectUtils.getCroppedBitmap(letterBitmap);
                        cacheManager.addBitmapToMemoryCache(str5, letterBitmap);
                    }
                    bitmap = letterBitmap;
                } else {
                    bitmap = bitmapFromMemCache;
                }
                z7 = true;
            } else {
                z7 = false;
            }
            ExtensionsKt.setTextWithDividerIfNeeded(textView, contact.getName());
            z6 = false;
        }
        if (bitmap != null) {
            if (imageView2 != null) {
                setVideoBg(imageView2, z7 ? null : bitmap.copy(bitmap.getConfig(), true));
                i7 = 0;
                if (view != null) {
                    view.setVisibility(0);
                }
            } else {
                i7 = 0;
                if (view != null) {
                    view.setVisibility(8);
                }
            }
            Bitmap CircleBitmap = ZangiFileUtils.CircleBitmap(bitmap, i7);
            ImageLoader.getImageCache().addBitmapToCache(str, CircleBitmap);
            imageView.setVisibility(i7);
            imageView.setImageBitmap(CircleBitmap);
        } else if (i != 0) {
            imageView.setImageResource(i);
            imageView.setVisibility(0);
            if (view != null) {
                view.setVisibility(8);
            }
        } else {
            Bitmap avatarLetterBitmapInCall = getAvatarLetterBitmapInCall(str, str3);
            if (avatarLetterBitmapInCall != null) {
                imageView.setImageBitmap(avatarLetterBitmapInCall);
            } else {
                imageView.setVisibility(8);
            }
            if (view != null) {
                view.setVisibility(0);
            }
        }
        return z6;
    }

    protected void cameraOnClickListener() {
        c.a alertDialog = AlertDialogUtils.getAlertDialog(getActivity());
        alertDialog.s("Camera");
        MainApplication.Companion companion = MainApplication.Companion;
        alertDialog.g(new CharSequence[]{companion.getMainContext().getString(2131887527), companion.getMainContext().getString(2131887528)}, new DialogInterface.OnClickListener() {
            @Override
            public void onClick(DialogInterface dialogInterface, int i) {
                if (i == 0) {
                    if (CallingFragmentActivity.chatScreenButtonsState) {
                        return;
                    }
                    BaseScreen.this.takePhotoclickListener();
                } else if (i == 1 && !CallingFragmentActivity.chatScreenButtonsState) {
                    if (VideoConverter.getInstance().isConverting()) {
                        BaseScreen.this.showInfoMessage(2131886750);
                    } else {
                        BaseScreen.this.takeVideoClickListener();
                    }
                }
            }
        });
        androidx.appcompat.app.c a = alertDialog.a();
        a.setCanceledOnTouchOutside(true);
        a.show();
        a.getWindow().setLayout(AlertDialogUtils.getAlertSize(), -2);
        AlertDialogUtils.setCurrentDialog(a);
    }

    public boolean canHandlePipMode() {
        return false;
    }

    public void checkAllCasesBeforePipMode() {
    }

    public void closeCall() {
        Log.i(TAG, "PING-PONG OnRtmpEvent closeCall()");
        Log.i(TAG, "!!!!!Finish time = " + System.currentTimeMillis());
        closeCallingActivity();
        AVSession.Companion.closeAndReleaseSession((AVSession) null);
    }

    protected void closeCallingActivity() {
        Log.i(TAG, "PING-PONG OnRtmpEvent closeCall() closeCallingActivity()");
        CallHelper.callVideo(false);
        ZangiConfigurationService.INSTANCE.putBoolean("CALL_OUT_ACTION", false);
        if (getActivity() != null) {
            CallingFragmentActivity.chatScreenButtonsState = false;
            ScreenVideoCall.Companion.setFromVideo(false);
            getActivity().finish();
            Log.i(TAG, "!!!!!Activity finish");
        }
    }

    protected boolean closeCallingActivityBusyCase() {
        AVSession.Companion companion = AVSession.Companion;
        synchronized (companion.getSignallingMonitor()) {
            if (companion.getSize() > 0) {
                return false;
            }
            closeCallingActivity();
            return true;
        }
    }

    public void closeDropdown(final View view) {
        if (view.getVisibility() == 0) {
            ScaleAnimation scaleAnimation = new ScaleAnimation(1.0f, 1.0f, 1.0f, 0.0f);
            scaleAnimation.setDuration(300L);
            scaleAnimation.setAnimationListener(new Animation.AnimationListener() {
                @Override
                public void onAnimationEnd(Animation animation) {
                    view.setVisibility(8);
                }

                @Override
                public void onAnimationRepeat(Animation animation) {
                }

                @Override
                public void onAnimationStart(Animation animation) {
                }
            });
            view.startAnimation(scaleAnimation);
        }
    }

    protected void contactClickListener() {
        if (ZangiPermissionUtils.hasPermission(getActivity(), 1006, true, new ZangiPermissionUtils.OnPermissionResult() {
            public void onResult(ArrayList<Pair<String, Boolean>> arrayList, boolean z) {
                if (z) {
                    BaseScreen.this.showMultiSelectListFragment();
                }
            }
        })) {
            showMultiSelectListFragment();
        }
    }

    protected boolean containsNumber(List<ContactNumber> list, LastActivity lastActivity) {
        if (list == null || list.isEmpty()) {
            return false;
        }
        for (ContactNumber contactNumber : list) {
            if (contactNumber != null && contactNumber.getFullNumber().equals(lastActivity.getId())) {
                contactNumber.setUserLastActivity(lastActivity);
                return true;
            }
        }
        return false;
    }

    @Override
    public boolean createOptionsMenu(Menu menu) {
        return false;
    }

    protected void enableDisableView(View view, boolean z) {
        view.setEnabled(z);
        if (view instanceof ViewGroup) {
            ViewGroup viewGroup = (ViewGroup) view;
            for (int i = 0; i < viewGroup.getChildCount(); i++) {
                enableDisableView(viewGroup.getChildAt(i), z);
            }
        }
    }

    public void formatMuteTillText(Mute.MuteType muteType, Long l, InfoAdditionalItem infoAdditionalItem, boolean z) {
        if (infoAdditionalItem == null) {
            return;
        }
        infoAdditionalItem.setDescription(getMuteText(muteType, l, z));
    }

    protected void galleryOnClickListener() {
        if (ZangiPermissionUtils.hasPermission(getActivity(), 1007, true, new ZangiPermissionUtils.OnPermissionResult() {
            public final void onResult(ArrayList arrayList, boolean z) {
                BaseScreen.this.lambda$galleryOnClickListener$1(arrayList, z);
            }
        })) {
            _openGallery();
        }
    }

    public Bundle getActivityArgs() {
        return Engine.getInstance().getScreenService().getArguments();
    }

    protected Bitmap getContactBitmapImage(Uri uri, int i, int i7) {
        try {
            AssetFileDescriptor openAssetFileDescriptor = MainApplication.Companion.getMainContext().getContentResolver().openAssetFileDescriptor(uri, "r");
            if (openAssetFileDescriptor != null) {
                return ImageLoader.decodeSampledBitmapFromDescriptor(openAssetFileDescriptor.getFileDescriptor(), i7, i);
            }
        } catch (Exception unused) {
        }
        return null;
    }

    public String getCurrentLanguage() {
        String string = ZangiConfigurationService.INSTANCE.getString(Constants.LANGUAGE_CODE, "default");
        ArrayList arrayList = new ArrayList(Arrays.asList(getResources().getStringArray(2130903044)));
        if (!string.equals("default")) {
            return string;
        }
        String language = Locale.getDefault().getLanguage();
        return arrayList.contains(language) ? language : "en";
    }

    public n0.a getDefaultViewModelCreationExtras() {
        return androidx.lifecycle.h.a(this);
    }

    protected Engine getEngine() {
        return Engine.getInstance();
    }

    protected List<MultiLanguageListItem> getMultiLanguageList() {
        ArrayList arrayList = new ArrayList();
        String[] stringArray = getResources().getStringArray(2130903043);
        String[] stringArray2 = getResources().getStringArray(2130903044);
        String[] stringArray3 = getResources().getStringArray(2130903045);
        String string = ZangiConfigurationService.INSTANCE.getString(Constants.LANGUAGE_CODE, "default");
        for (int i = 0; i < stringArray.length; i++) {
            MultiLanguageListItem multiLanguageListItem = new MultiLanguageListItem();
            multiLanguageListItem.setLanguageName(stringArray[i]);
            multiLanguageListItem.setLanguageCod(stringArray2[i]);
            multiLanguageListItem.setLanguageDefaultName(stringArray3[i]);
            if (string.equals(stringArray2[i])) {
                multiLanguageListItem.setActiveLanguage(true);
            } else {
                multiLanguageListItem.setActiveLanguage(false);
            }
            arrayList.add(multiLanguageListItem);
        }
        return arrayList;
    }

    protected fb.o<Bitmap, String, Boolean> getPhoto(Contact contact, String str, int i, int i7) {
        String str2;
        Bitmap bitmap;
        boolean z = true;
        String str3 = "";
        boolean z6 = false;
        if (contact == null || contact.getIdentifire().equals("")) {
            Profile userProfile = ZangiProfileServiceImpl.getInstance().getUserProfile(str);
            Bitmap bitmap2 = null;
            if (userProfile != null) {
                String firstName = userProfile.getFirstName();
                String lastName = userProfile.getLastName();
                if (firstName == null || firstName.isEmpty()) {
                    firstName = "";
                }
                if (lastName != null && !lastName.isEmpty()) {
                    firstName = firstName + MinimalPrettyPrinter.DEFAULT_ROOT_VALUE_SEPARATOR + lastName;
                }
                if (firstName.replaceAll(MinimalPrettyPrinter.DEFAULT_ROOT_VALUE_SEPARATOR, "").isEmpty()) {
                    str3 = "+" + ProjectUtils.localeFormatNumber(str);
                }
                if (userProfile.getImg() == null || userProfile.getImg().isEmpty()) {
                    ZangiProfileServiceImpl.getInstance().deleteFileIfExist(userProfile.getKey(), true);
                } else {
                    bitmap2 = BitmapFactory.decodeFile(ZangiProfileServiceImpl.getInstance().getProfileAvatarDir(userProfile.getKey()), new BitmapFactory.Options());
                }
                bitmap = bitmap2;
                str2 = str3;
                str3 = firstName;
            } else {
                String localeFormatNumber = ProjectUtils.localeFormatNumber(str);
                if (localeFormatNumber == null) {
                    localeFormatNumber = "";
                } else if (!localeFormatNumber.startsWith("+") && !ZangiEngineUtils.isShortNumber(localeFormatNumber) && !ContactsManager.INSTANCE.isDummyNumber(localeFormatNumber)) {
                    localeFormatNumber = "+" + localeFormatNumber;
                }
                str2 = localeFormatNumber;
                bitmap = null;
            }
        } else {
            bitmap = ContactsManagerHelper.INSTANCE.openPhoto(contact.getIdentifire(), i);
            if (bitmap != null || contact.getPpUriSuffix() == null) {
                z = false;
            } else {
                bitmap = BitmapFactory.decodeFile(ZangiProfileServiceImpl.getInstance().getProfileAvatarDir(contact.getPpUriSuffix()), new BitmapFactory.Options());
            }
            str2 = contact.getName();
            if (bitmap == null) {
                bitmap = ZangiFileUtils.CircleBitmap(loadContactBitmap(contact.getFirstName(), contact.getLastName(), contact.getIdentifire()), i7);
            } else {
                z6 = z;
            }
        }
        if (!str3.isEmpty()) {
            str2 = str3;
        }
        return new fb.o<>(bitmap, str2, Boolean.valueOf(z6));
    }

    protected String getStatusForSwitchOffUser(Long l) {
        GregorianCalendar gregorianCalendar = new GregorianCalendar();
        gregorianCalendar.setTime(new Date(System.currentTimeMillis() - (l.longValue() * 100)));
        long time2 = (((new GregorianCalendar().getTime().getTime() - gregorianCalendar.getTime().getTime()) / 100) / 60) / 60;
        long j = time2 / 24;
        long j7 = j / 365;
        Context context = getContext();
        if (context == null) {
            context = MainApplication.Companion.getMainContext();
        }
        return time2 < 12 ? context.getResources().getString(2131886772) : time2 <= 24 ? context.getResources().getString(2131886773) : j <= 7 ? context.getResources().getString(2131886775) : j <= 30 ? context.getResources().getString(2131886774) : j7 <= 1 ? context.getResources().getString(2131886776) : j7 > 1 ? context.getResources().getString(2131886771) : "";
    }

    @Override
    public String getStringId() {
        return this.mId;
    }

    public String getUsername() {
        return ZangiConfigurationService.INSTANCE.getString("IDENTITY_USERNAME.com.beint.zangi.core.c.b", "");
    }

    protected boolean hangUpCall() {
        Log.i(TAG, "!!!!!hangup call");
        AVSession currentAvSession = AVSession.Companion.getCurrentAvSession();
        if (currentAvSession == null) {
            closeCallingActivity();
            return true;
        }
        long currentTimeMillis = System.currentTimeMillis();
        Log.i(TAG, "hangUpCall Session Id = " + currentAvSession.getId() + "getActivityArgs()=" + getActivityArgs().toString());
        String str = TAG;
        StringBuilder sb = new StringBuilder();
        sb.append("!!!!!HangUp time");
        sb.append(System.currentTimeMillis() - currentTimeMillis);
        Log.i(str, sb.toString());
        if (currentAvSession.isInFakeCallState()) {
            currentAvSession.hangUpFakeCall();
        } else if (currentAvSession.isConferenceCall()) {
            String currentRegisteredUserId = ZangiEngineUtils.getCurrentRegisteredUserId();
            ConferenceManager conferenceManager = ConferenceManager.INSTANCE;
            if (conferenceManager.getCallMembersMap().get(currentRegisteredUserId) == null || ((GroupMember) conferenceManager.getCallMembersMap().get(currentRegisteredUserId)).getCallState() == GroupMemberCallState.inCall) {
                currentAvSession.hangUpCall();
            } else {
                currentAvSession.declineConferenceCall();
            }
        } else {
            currentAvSession.hangUpCall();
        }
        return closeCallingActivityBusyCase();
    }

    public void hangUpCallWhenSignOut() {
        Log.i(TAG, "!!!!!hangup call when sign ou");
        AVSession currentAvSession = AVSession.Companion.getCurrentAvSession();
        if (currentAvSession != null) {
            long currentTimeMillis = System.currentTimeMillis();
            Log.i(TAG, "hangUpCall Session Id = " + currentAvSession.getId() + "getActivityArgs()=" + getActivityArgs().toString());
            String str = TAG;
            StringBuilder sb = new StringBuilder();
            sb.append("!!!!!HangUp time");
            sb.append(System.currentTimeMillis() - currentTimeMillis);
            Log.i(str, sb.toString());
            if (currentAvSession.isInFakeCallState()) {
                currentAvSession.hangUpFakeCall();
            } else {
                currentAvSession.hangUpCall();
            }
        }
    }

    public void hangUpCallWithBlockContact(List<String> list) {
        if (list == null || list.isEmpty()) {
            return;
        }
        for (int i = 0; i < list.size(); i++) {
            AVSession.Companion companion = AVSession.Companion;
            if (companion.getActiveSession() != null && companion.getActiveSession().getContactNumber().contains(list.get(i)) && CallingFragmentActivity.getInstance() != null) {
                getScreenService().showCallScreen();
                hangUpCall();
            }
        }
    }

    @Override
    public boolean hasMenu() {
        return false;
    }

    protected boolean haveUserDisplayImage(Contact contact, String str) {
        if (contact == null || contact.getIdentifire().equals("")) {
            Profile userProfile = ZangiProfileServiceImpl.getInstance().getUserProfile(str);
            if (userProfile != null && userProfile.getImg() != null && !userProfile.getImg().isEmpty()) {
                return true;
            }
        } else {
            if (ContactsContract.Contacts.openContactPhotoInputStream(getActivity().getContentResolver(), ContentUris.withAppendedId(ContactsContract.Contacts.CONTENT_URI, Long.valueOf(contact.getIdentifire()).longValue()), true) != null) {
                return true;
            }
            if (contact.getPpUriSuffix() != null && ZangiProfileServiceImpl.getInstance().isFileExist(contact.getPpUriSuffix(), true)) {
                return true;
            }
        }
        return false;
    }

    protected void hideCallBackProgress(RelativeLayout relativeLayout, View view) {
        relativeLayout.setVisibility(8);
        HomeActivity.tabLayout.setEnabled(true);
        enableDisableView(view, true);
    }

    public void hideKeyPad() {
        View currentFocus;
        if (getActivity() == null || (currentFocus = getActivity().getCurrentFocus()) == null) {
            return;
        }
        ((InputMethodManager) getActivity().getSystemService("input_method")).hideSoftInputFromWindow(currentFocus.getWindowToken(), 0);
    }

    public boolean hideKeyPadBoll(View view) {
        InputMethodManager inputMethodManager = (InputMethodManager) getActivity().getSystemService("input_method");
        if (view == null) {
            return true;
        }
        inputMethodManager.hideSoftInputFromWindow(view.getWindowToken(), 0);
        return true;
    }

    protected void inviteByEmail(String str, Context context) {
        inviteByEmail(context, str, MainApplication.Companion.getMainContext().getText(2131886735));
    }

    public void inviteByEmailDeepLink(String str, Context context, String str2) {
        inviteByEmail(context, str, String.format(MainApplication.Companion.getMainContext().getString(2131886737), str2));
    }

    protected void inviteBySMS(String str) {
        inviteBySMS(str, MainApplication.Companion.getMainContext().getText(2131886735));
    }

    public void inviteBySMSDeepLink(String str, String str2) {
        inviteBySMS(str, String.format(MainApplication.Companion.getMainContext().getString(2131886737), str2));
    }

    protected void inviteBySMSForGift(String str, CharSequence charSequence, Context context) {
        String defaultSmsPackage = Telephony.Sms.getDefaultSmsPackage(getActivity());
        Intent intent = new Intent("android.intent.action.SENDTO", Uri.parse("smsto:" + Uri.encode(str)));
        if (defaultSmsPackage != null) {
            intent.setPackage(defaultSmsPackage);
        }
        intent.putExtra("sms_body", charSequence);
        intent.putExtra("exit_on_sent", true);
        try {
            startActivity(intent);
        } catch (Exception e) {
            Log.i(TAG, e.getMessage(), e);
        }
    }

    public void isDeleteContact(String str) {
    }

    public boolean isDestroyed() {
        return this.isDestroyed;
    }

    protected boolean isFromTimer() {
        return this.fromTimer;
    }

    public boolean isInPipMode() {
        return false;
    }

    public boolean isOnline() {
        return SystemServiceManager.INSTANCE.isNetworkConnected();
    }

    public boolean isSavedInstanceState() {
        return this.isSavedInstanceState;
    }

    public boolean isTablet(Context context) {
        return ((context.getResources().getConfiguration().screenLayout & 15) == 4) || ((context.getResources().getConfiguration().screenLayout & 15) == 3);
    }

    public Bitmap loadContactBitmap(String str, String str2, String str3) {
        FragmentActivity activity = getActivity() != null ? getActivity() : MainApplication.Companion.getMainContext();
        if (activity == null) {
            return null;
        }
        return ProjectUtils.getCroppedBitmap(new InitialsAvatarBitmap(activity, true).getLetterTile(str, str2, str3));
    }

    protected void locationClickListener() {
        if (ZangiPermissionUtils.hasPermission(getActivity(), 1005, true, new ZangiPermissionUtils.OnPermissionResult() {
            public final void onResult(ArrayList arrayList, boolean z) {
                BaseScreen.this.lambda$locationClickListener$0(arrayList, z);
            }
        })) {
            _locationClickListener();
        }
    }

    public boolean makeCallBack(String str, final RelativeLayout relativeLayout, final View view) {
        String currentRegisteredUserId = ZangiEngineUtils.getCurrentRegisteredUserId();
        final String e164WithoutPlus = ZangiEngineUtils.getE164WithoutPlus(str, ZangiEngineUtils.getZipCode(), false);
        if (e164WithoutPlus == null) {
            showInfoMessage(2131886728);
            return false;
        }
        if (e164WithoutPlus.equals(currentRegisteredUserId)) {
            showInfoMessage(2131887306);
            return false;
        }
        ZangiConfigurationService.INSTANCE.putString("IDENTITI_CALL_NUMBER.com.beint.zangi.core.c.b", str, true);
        if (SignalingService.INSTANCE.isRegistered()) {
            new AsyncTask<Void, Boolean, ServiceResult<String>>() {
                ServiceResult<String> result;
                ServiceResult<Boolean> serviceResult;

                @Override
                public ServiceResult<String> doInBackground(Void... voidArr) {
                    Thread.currentThread().setName("makeCallBack");
                    try {
                        this.result = ZangiHTTPServices.getInstance().callBack(e164WithoutPlus, false);
                        this.serviceResult = ZangiHTTPServices.getInstance().isZangiNumber(e164WithoutPlus, false);
                    } catch (IOException e) {
                        Log.e(BaseScreen.TAG, e.getMessage(), e);
                    }
                    return this.result;
                }

                @Override
                public void onPostExecute(ServiceResult<String> serviceResult) {
                    ServiceResult<Boolean> serviceResult2;
                    super.onPostExecute((AnonymousClass17) serviceResult);
                    if (serviceResult == null) {
                        BaseScreen.this.showInfoMessage(2131887599);
                        return;
                    }
                    if (serviceResult.isOk() || (serviceResult2 = this.serviceResult) == null) {
                        return;
                    }
                    if (((Boolean) serviceResult2.getBody()).booleanValue()) {
                        if (Constants.IS_BALANCE_ENABLE) {
                            BaseScreen.this.noBalanceAlert(2131887048, 2131886242);
                        }
                        RelativeLayout relativeLayout2 = relativeLayout;
                        if (relativeLayout2 != null) {
                            BaseScreen.this.hideCallBackProgress(relativeLayout2, view);
                            return;
                        }
                        return;
                    }
                    if (Constants.IS_BALANCE_ENABLE) {
                        BaseScreen.this.notZangiNumberAlert(e164WithoutPlus, 2131887049, 2131886242);
                    }
                    RelativeLayout relativeLayout3 = relativeLayout;
                    if (relativeLayout3 != null) {
                        BaseScreen.this.hideCallBackProgress(relativeLayout3, view);
                    }
                }
            }.executeOnExecutor(MainApplication.Companion.getRequestServiceExecutor(), new Void[0]);
            return true;
        }
        Log.e(TAG, "Not registered yet");
        showInfoMessage(2131887053);
        return false;
    }

    public void noBalanceAlert(int i, int i7) {
        if (getActivity() == null) {
            return;
        }
        final androidx.appcompat.app.c a = AlertDialogUtils.getAlertDialog(getActivity()).a();
        a.setTitle(i7);
        a.setCancelable(false);
        a.setMessage(getString(i));
        a.setButton(-2, getString(2131886274).toUpperCase(), new DialogInterface.OnClickListener() {
            @Override
            public void onClick(DialogInterface dialogInterface, int i8) {
                a.cancel();
            }
        });
        a.setButton(-1, getString(2131886778).toUpperCase(), new DialogInterface.OnClickListener() {
            @Override
            public void onClick(DialogInterface dialogInterface, int i8) {
                BaseScreen.this.buyCredite();
            }
        });
        a.show();
        a.getWindow().setLayout(AlertDialogUtils.getAlertSize(), -2);
        AlertDialogUtils.setCurrentDialog(a);
    }

    protected void notZangiNumberAlert(final String str, int i, int i7) {
        if (getActivity() == null) {
            return;
        }
        final androidx.appcompat.app.c a = AlertDialogUtils.getAlertDialog(getActivity()).a();
        a.setTitle(i7);
        a.setCancelable(false);
        a.setMessage(getString(i));
        a.setButton(-2, getString(2131886740).toUpperCase(), new DialogInterface.OnClickListener() {
            @Override
            public void onClick(DialogInterface dialogInterface, int i8) {
                InviteController.INSTANCE.showInviteShareMessage(str, (String) null, true, this, (ILoadingView) null, (qb.l) null, (qb.l) null);
            }
        });
        a.setButton(-3, getString(2131886778).toUpperCase(), new DialogInterface.OnClickListener() {
            @Override
            public void onClick(DialogInterface dialogInterface, int i8) {
                BaseScreen.this.buyCredite();
            }
        });
        a.setButton(-1, getString(2131886274).toUpperCase(), new DialogInterface.OnClickListener() {
            @Override
            public void onClick(DialogInterface dialogInterface, int i8) {
                a.cancel();
            }
        });
        a.show();
        a.getWindow().setLayout(AlertDialogUtils.getAlertSize(), -2);
        AlertDialogUtils.setCurrentDialog(a);
    }

    public void onActivityResult(int i, int i7, Intent intent) {
        WhiteListRequestCallBack whiteListRequestCallBack;
        if (i == this.WHITE_LIST_REQUEST_CODE && (whiteListRequestCallBack = this.callBack) != null) {
            whiteListRequestCallBack.requestDone();
            this.callBack = null;
        }
        super.onActivityResult(i, i7, intent);
    }

    public void onCreate(Bundle bundle) {
        super.onCreate(bundle);
    }

    public void onDestroy() {
        this.isDestroyed = true;
        super.onDestroy();
    }

    public void onPause() {
        super.onPause();
    }

    public void onResume() {
        super.onResume();
        this.isSavedInstanceState = false;
    }

    public void onSaveInstanceState(Bundle bundle) {
        super.onSaveInstanceState(bundle);
        this.isSavedInstanceState = true;
    }

    public void onViewStateRestored(Bundle bundle) {
        super.onViewStateRestored(bundle);
        this.isSavedInstanceState = false;
    }

    public void openDropdown(View view) {
        if (view.getVisibility() != 0) {
            ScaleAnimation scaleAnimation = new ScaleAnimation(1.0f, 1.0f, 0.0f, 1.0f);
            scaleAnimation.setDuration(300L);
            view.startAnimation(scaleAnimation);
            view.setVisibility(0);
        }
    }

    protected void restartImm(View view) {
        if (getActivity() == null || view == null) {
            return;
        }
        ((InputMethodManager) getActivity().getSystemService("input_method")).restartInput(view);
    }

    protected void setFontSizeByWidth(TextView textView, float f) {
        textView.setTextSize(0, f);
        float dimensionPixelSize = getResources().getDimensionPixelSize(2131166075);
        float dimensionPixelSize2 = (getResources().getDimensionPixelSize(2131166074) - dimensionPixelSize) / 2.0f;
        int measuredWidth = textView.getMeasuredWidth();
        String charSequence = textView.getText().toString();
        Paint paint = new Paint();
        Rect rect = new Rect();
        paint.setTextAlign(Paint.Align.LEFT);
        paint.setTextSize(textView.getTextSize());
        paint.getTextBounds(charSequence, 0, charSequence.length(), rect);
        if (Math.abs(rect.left + rect.right) > measuredWidth && f > dimensionPixelSize) {
            setFontSizeByWidth(textView, f - dimensionPixelSize2);
        } else {
            textView.setTextSize(0, f);
            textView.setVisibility(0);
        }
    }

    protected void setFromTimer(boolean z) {
        this.fromTimer = z;
        if (z) {
            Object obj = timerMonitor;
            synchronized (obj) {
                Log.i(TAG, "synchronized notify");
                obj.notify();
            }
        }
    }

    public void setIsDestroyed(boolean z) {
        this.isDestroyed = z;
    }

    protected void setLayoutParmasToStatus(View view, TextView textView, int i) {
        ViewGroup.LayoutParams layoutParams = view.getLayoutParams();
        textView.measure(0, 0);
        int measuredWidth = textView.getMeasuredWidth();
        int dpToPx = ProjectUtils.dpToPx(i);
        if (measuredWidth < dpToPx) {
            measuredWidth = dpToPx;
        }
        layoutParams.width = measuredWidth;
        view.setLayoutParams(layoutParams);
    }

    public void setLocale(String str) {
        if (str.equals("default")) {
            str = Resources.getSystem().getConfiguration().locale.getLanguage();
            ZangiConfigurationService.INSTANCE.putString(Constants.LANGUAGE_CODE, "default");
        } else {
            ZangiConfigurationService.INSTANCE.putString(Constants.LANGUAGE_CODE, str);
        }
        Locale locale = str.equals("br") ? new Locale("pt", "BR") : str.equals("pt") ? new Locale(str, "PT") : new Locale(str);
        MainApplication.Companion companion = MainApplication.Companion;
        Configuration configuration = companion.getMainContext().getResources().getConfiguration();
        DisplayMetrics displayMetrics = companion.getMainContext().getResources().getDisplayMetrics();
        configuration.setLocale(locale);
        companion.getMainContext().createConfigurationContext(configuration);
        companion.getMainContext().getResources().updateConfiguration(configuration, displayMetrics);
        OrientationManager.INSTANCE.setRtl(str.equals("ar") || str.equals("fa"));
        if (HomeActivity.getInstance() != null) {
            HomeActivity.getInstance().finish();
        }
        AbstractZangiActivity abstractZangiActivity = BaseFragmentActivity.sInstance;
        if (abstractZangiActivity != null) {
            abstractZangiActivity.finish();
        }
        FastDataTimeUtils.INSTANCE.resetFastDate(locale);
        startActivity(new Intent(getContext(), (Class<?>) HomeActivity.class));
    }

    public void setScale(float f) {
        Resources resources = getResources();
        DisplayMetrics displayMetrics = resources.getDisplayMetrics();
        Configuration configuration = resources.getConfiguration();
        configuration.fontScale = f;
        ZangiConfigurationService.INSTANCE.putFloat("FONT_SCALE_SIZE", f, true);
        resources.updateConfiguration(configuration, displayMetrics);
        if (HomeActivity.getInstance() != null) {
            HomeActivity.getInstance().finish();
        }
        AbstractZangiActivity abstractZangiActivity = BaseFragmentActivity.sInstance;
        if (abstractZangiActivity != null) {
            abstractZangiActivity.finish();
        }
        Process.killProcess(Process.myPid());
    }

    public void setScreenId(String str) {
        this.mId = str;
    }

    public void setScreenType(SCREEN_TYPE screen_type) {
        mType = screen_type;
    }

    protected void setTextSelected(TextView textView) {
        if (textView != null) {
            textView.setTextColor(Color.parseColor("#333333"));
        }
    }

    protected void setTextUnselected(TextView textView) {
        if (textView != null) {
            textView.setTextColor(Color.parseColor("#EEEEEE"));
        }
    }

    protected boolean setUserFullPhoto(Contact contact, ImageView imageView, String str, boolean z) {
        if (z) {
            StringBuilder sb = new StringBuilder();
            PathManager pathManager = PathManager.INSTANCE;
            sb.append(pathManager.getGROUP_CHAT_DIR());
            sb.append(str);
            sb.append("/image.png");
            String sb2 = sb.toString();
            if (!new File(sb2).exists()) {
                sb2 = pathManager.getGROUP_CHAT_DIR() + str + "/avatar.png";
            }
            try {
                r1 = ZangiFileUtils.scaleImage(sb2, ZangiFileUtils.FILE_MAX_DIM.intValue());
            } catch (IOException e) {
                Log.e(TAG, "setUserFullPhoto() e = " + e.toString());
            }
        } else {
            Profile userProfile = ZangiProfileServiceImpl.getInstance().getUserProfile(str);
            if (contact != null && !contact.getIdentifire().equals("")) {
                r1 = getContext() != null ? ContactsManagerHelper.INSTANCE.openPhoto(contact.getIdentifire(), imageView.getLayoutParams().height) : null;
                if (r1 == null && contact.getPpUriSuffix() != null && (r1 = BitmapFactory.decodeFile(ZangiProfileServiceImpl.getInstance().getProfileAvatarImageDir(contact.getPpUriSuffix()), new BitmapFactory.Options())) == null) {
                    r1 = BitmapFactory.decodeFile(ZangiProfileServiceImpl.getInstance().getProfileAvatarDir(contact.getPpUriSuffix()), new BitmapFactory.Options());
                    ZangiProfileServiceImpl.getInstance().getUserProfileFullSizeImage(str);
                }
            } else if (userProfile != null) {
                if (userProfile.getImg() == null || userProfile.getImg().isEmpty()) {
                    ZangiProfileServiceImpl.getInstance().deleteFileIfExist(userProfile.getKey(), true);
                } else {
                    r1 = BitmapFactory.decodeFile(ZangiProfileServiceImpl.getInstance().getProfileAvatarImageDir(userProfile.getKey()), new BitmapFactory.Options());
                    if (r1 == null) {
                        r1 = BitmapFactory.decodeFile(ZangiProfileServiceImpl.getInstance().getProfileAvatarDir(userProfile.getKey()), new BitmapFactory.Options());
                        ZangiProfileServiceImpl.getInstance().getUserProfileFullSizeImage(str);
                    }
                }
                r1 = ZangiFileUtils.rotateBitmap(r1, ZangiFileUtils.getExifOrientation(ZangiProfileServiceImpl.getInstance().getProfileAvatarImageDir(userProfile.getKey())));
            }
        }
        if (r1 != null) {
            imageView.setImageBitmap(r1);
        }
        return true;
    }

    public void showAlertWithMessage(int i) {
        AlertDialogUtils.showAlertWithMessage((Context) getActivity(), i, false);
    }

    public void showCallBackProgress(final RelativeLayout relativeLayout, final View view, final ProgressBar progressBar) {
        relativeLayout.setVisibility(0);
        HomeActivity.tabLayout.setEnabled(false);
        enableDisableView(view, false);
        final int[] iArr = {0};
        new Thread(new Runnable() {
            @Override
            public void run() {
                int i;
                while (true) {
                    int[] iArr2 = iArr;
                    i = iArr2[0];
                    if (i >= 100) {
                        break;
                    }
                    iArr2[0] = i + 1;
                    try {
                        Thread.sleep(100L);
                    } catch (InterruptedException e) {
                        Log.e(BaseScreen.TAG, e.getMessage(), e);
                    }
                    BaseScreen.this.progressBarHandler.post(new Runnable() {
                        @Override
                        public void run() {
                            AnonymousClass18 anonymousClass18 = AnonymousClass18.this;
                            progressBar.setProgress(iArr[0]);
                        }
                    });
                }
                if (i >= 100) {
                    try {
                        Thread.sleep(200L);
                    } catch (InterruptedException e7) {
                        Log.e(BaseScreen.TAG, e7.getMessage(), e7);
                    }
                    BaseScreen.this.progressBarHandler.post(new Runnable() {
                        @Override
                        public void run() {
                            AnonymousClass18 anonymousClass18 = AnonymousClass18.this;
                            BaseScreen.this.hideCallBackProgress(relativeLayout, view);
                            iArr[0] = 0;
                        }
                    });
                }
            }
        }, "showCallBackThread").start();
    }

    protected void showCountryListFragment(Class<?> cls, Class<?> cls2, Intent intent, int i) {
        Intent intent2 = new Intent((Context) getActivity(), cls2);
        if (intent.getExtras() != null) {
            intent2.putExtras(intent.getExtras());
            intent2.addFlags(intent.getFlags());
            intent2.putExtra(Constants.ZANGI_ACTION, intent.getExtras().getInt(Constants.ZANGI_ACTION));
        }
        intent2.putExtra("com.beint.project.FragmentName", cls);
        intent2.addFlags(536870912);
        intent.addFlags(65536);
        startActivityForResult(intent2, i);
    }

    public void showCustomAlert(int i) {
        showCustomToast((Context) getActivity(), i);
    }

    public void showCustomAlertText(String str) {
        FragmentActivity activity = getActivity();
        if (activity == null) {
            return;
        }
        View inflate = LayoutInflater.from(activity).inflate(2131558783, (ViewGroup) null);
        ((TextView) inflate.findViewById(2131363843)).setText(str);
        Toast toast2 = new Toast(activity);
        toast2.setView(inflate);
        toast2.setDuration(1);
        toast2.show();
    }

    public void showFontAlertDialog() {
        if (AVSession.Companion.hasActiveSession()) {
            Toast.makeText(MainApplication.Companion.getMainContext(), getString(2131887578), 0).show();
            return;
        }
        float f = MainApplication.Companion.getMainContext().getApplicationContext().getResources().getConfiguration().fontScale;
        final ArrayList arrayList = new ArrayList();
        String[] stringArray = getResources().getStringArray(2130903041);
        int length = stringArray.length;
        float[] fArr = new float[length];
        for (int i = 0; i < stringArray.length; i++) {
            fArr[i] = Float.parseFloat(stringArray[i]);
        }
        float nearlyValue = getNearlyValue(fArr, ZangiConfigurationService.INSTANCE.getFloat("FONT_SCALE_SIZE", f));
        for (int i7 = 0; i7 < length; i7++) {
            float f7 = fArr[i7];
            FontScaleListItem fontScaleListItem = new FontScaleListItem();
            fontScaleListItem.setFontScale(f7);
            if (nearlyValue == fontScaleListItem.getFontScale()) {
                fontScaleListItem.setisCurrentFont(true);
            } else {
                fontScaleListItem.setisCurrentFont(false);
            }
            arrayList.add(fontScaleListItem);
        }
        FontScaleSizeAdapter fontScaleSizeAdapter = new FontScaleSizeAdapter(arrayList, getActivity());
        c.a alertDialog = AlertDialogUtils.getAlertDialog(getActivity());
        alertDialog.r(2131886581);
        alertDialog.d(true);
        alertDialog.c(fontScaleSizeAdapter, new DialogInterface.OnClickListener() {
            @Override
            public void onClick(DialogInterface dialogInterface, int i8) {
                BaseScreen.this.setScale(((FontScaleListItem) arrayList.get(i8)).getFontScale());
            }
        });
        androidx.appcompat.app.c a = alertDialog.a();
        a.setCanceledOnTouchOutside(true);
        a.show();
        a.getWindow().setLayout(AlertDialogUtils.getAlertSize(), -2);
    }

    protected void showForceKeypad(final Activity activity, final View view) {
        if (activity == null || view == null) {
            return;
        }
        view.postDelayed(new Runnable() {
            @Override
            public final void run() {
                BaseScreen.lambda$showForceKeypad$8(activity, view);
            }
        }, 20L);
    }

    protected void showGroupCreationScreen(String str, String str2, String str3) {
        String e164WithoutPlus = ZangiEngineUtils.getE164WithoutPlus(str, ZangiEngineUtils.getZipCode(), false);
        if (e164WithoutPlus == null) {
            showInfoMessage(2131886728);
            return;
        }
        if (e164WithoutPlus.equals(ZangiEngineUtils.getCurrentRegisteredUserId())) {
            showInfoMessage(2131887360);
            return;
        }
        Bundle bundle = new Bundle();
        if (str3 != null && !str3.equals("")) {
            bundle.putString("com.beint.project.selectedcontactextid", str3);
        }
        if (str != null) {
            bundle.putString("KEY_SELECTED_NUMBER", str);
        }
        if (!TextUtils.isEmpty(str2)) {
            bundle.putString("KEY_SELECTED_EMAIL", str2);
        }
        bundle.putSerializable("FOR_WHICH_SCREEN", ScreenTabContacts.ForWhichScreen.GROUP_CHAT);
        getScreenService().showFragment(ScreenTabContacts.class, bundle);
    }

    protected void showInfoMessage(String str) {
        if (str == null) {
            return;
        }
        showCustomAlertText(str);
    }

    protected void showKeyPad(final View view) {
        if (getActivity() == null || view == null) {
            return;
        }
        InputMethodManager inputMethodManager = (InputMethodManager) getActivity().getSystemService("input_method");
        view.postDelayed(new Runnable() {
            @Override
            public final void run() {
                BaseScreen.this.lambda$showKeyPad$7(view);
            }
        }, 40L);
        inputMethodManager.showSoftInput(view, 0);
    }

    protected void showMuteDialogList(final Conversation conversation, ZangiRecentGroup zangiRecentGroup) {
        boolean z;
        int i;
        if (conversation == null && zangiRecentGroup != null && !TextUtils.isEmpty(zangiRecentGroup.getDisplayNumber())) {
            conversation = StorageService.INSTANCE.getConversationItemByChat(ZangiEngineUtils.getNumberFromJidWithoutPlus(zangiRecentGroup.getDisplayNumber()));
        }
        if (conversation == null) {
            return;
        }
        final ArrayList arrayList = new ArrayList();
        String[] stringArray = getResources().getStringArray(2130903048);
        Mute.MuteType mutedType = ZangiMuteService.getInstance().getMutedType(conversation);
        if (mutedType == null || mutedType.equals(Mute.MuteType.NOT_MUTED)) {
            z = false;
            i = 1;
        } else {
            z = true;
            i = 0;
        }
        if (z) {
            showUnmuteAlert(conversation);
            return;
        }
        while (i < stringArray.length) {
            MuteListItem muteListItem = new MuteListItem();
            muteListItem.setMuteName(stringArray[i]);
            muteListItem.setMuteType(Mute.MuteType.fromOrdinal(i));
            if (z) {
                if (mutedType.equals(Mute.MuteType.fromOrdinal(i))) {
                    muteListItem.setActiveMute(true);
                } else {
                    muteListItem.setActiveMute(false);
                }
            }
            arrayList.add(muteListItem);
            i++;
        }
        MuteListAdapter muteListAdapter = new MuteListAdapter(arrayList, getActivity());
        c.a alertDialog = AlertDialogUtils.getAlertDialog(getActivity());
        alertDialog.r(2131886975);
        alertDialog.d(true);
        alertDialog.c(muteListAdapter, new DialogInterface.OnClickListener() {
            @Override
            public void onClick(DialogInterface dialogInterface, int i7) {
                Mute.MuteType muteType = ((MuteListItem) arrayList.get(i7)).getMuteType();
                switch (AnonymousClass28.$SwitchMap$com$beint$project$core$model$mute$Mute$MuteType[muteType.ordinal()]) {
                    case 1:
                        ZangiMuteService.getInstance().unMuteConversation(conversation);
                        break;
                    case 2:
                    case 3:
                    case 4:
                    case 5:
                    case 6:
                        ZangiMuteService.getInstance().muteConversation(conversation, muteType);
                        break;
                }
            }
        });
        androidx.appcompat.app.c a = alertDialog.a();
        a.setCanceledOnTouchOutside(true);
        a.show();
        a.getWindow().setLayout(AlertDialogUtils.getAlertSize(), -2);
    }

    protected void showUnmuteAlert(final Conversation conversation) {
        final androidx.appcompat.app.c a = AlertDialogUtils.getAlertDialog(getActivity()).a();
        a.setTitle(2131886975);
        a.setCancelable(true);
        a.setMessage(getResources().getString(2131886979));
        a.setButton(-2, getString(2131886274).toUpperCase(), new DialogInterface.OnClickListener() {
            @Override
            public void onClick(DialogInterface dialogInterface, int i) {
                a.cancel();
            }
        });
        a.setButton(-1, getString(2131886343).toUpperCase(), new DialogInterface.OnClickListener() {
            @Override
            public void onClick(DialogInterface dialogInterface, int i) {
                ZangiMuteService.getInstance().unMuteConversation(conversation);
            }
        });
        a.show();
        a.getWindow().setLayout(AlertDialogUtils.getAlertSize(), -2);
        AlertDialogUtils.setCurrentDialog(a);
    }

    @SuppressLint({"BatteryLife"})
    public void showWhiteListPopUpIfNeeded(WhiteListRequestCallBack whiteListRequestCallBack) {
        boolean isIgnoringBatteryOptimizations;
        this.callBack = whiteListRequestCallBack;
        ZangiConfigurationService zangiConfigurationService = ZangiConfigurationService.INSTANCE;
        if (zangiConfigurationService.getBoolean("whiteListRequested", false)) {
            whiteListRequestCallBack.requestDone();
            return;
        }
        zangiConfigurationService.putBoolean("whiteListRequested", true, true);
        Intent intent = new Intent("android.settings.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS", Uri.parse("package:com.beint.project"));
        MainApplication.Companion companion = MainApplication.Companion;
        PackageManager packageManager = companion.getMainContext().getPackageManager();
        isIgnoringBatteryOptimizations = ((PowerManager) androidx.appcompat.widget.v.a(companion.getMainContext(), PowerManager.class)).isIgnoringBatteryOptimizations("com.beint.project");
        if (isIgnoringBatteryOptimizations || intent.resolveActivity(packageManager) == null) {
            whiteListRequestCallBack.requestDone();
        } else {
            startActivityForResult(intent, this.WHITE_LIST_REQUEST_CODE);
        }
    }

    protected void startConversation(Conversation conversation) {
        ConversationManager.INSTANCE.openConversation(conversation, null, null, null, false, false);
    }

    protected void takePhotoclickListener() {
        if (ZangiPermissionUtils.hasPermission(getActivity(), 1011, true, new ZangiPermissionUtils.OnPermissionResult() {
            public final void onResult(ArrayList arrayList, boolean z) {
                BaseScreen.this.lambda$takePhotoclickListener$3(arrayList, z);
            }
        })) {
            _takePhotoclickListener();
        }
    }

    protected void takeVideoClickListener() {
        if (ZangiPermissionUtils.hasPermission(getActivity(), 1011, true, new ZangiPermissionUtils.OnPermissionResult() {
            public final void onResult(ArrayList arrayList, boolean z) {
                BaseScreen.this.lambda$takeVideoClickListener$2(arrayList, z);
            }
        })) {
            _takeVideo();
        }
    }

    public void unblockContactAlertDialog(final List<String> list, final TextView textView) {
        if (getActivity() == null) {
            return;
        }
        c.a alertDialog = AlertDialogUtils.getAlertDialog(getActivity());
        alertDialog.r(2131887601);
        alertDialog.h(2131887603);
        alertDialog.d(false);
        alertDialog.p(getActivity().getString(2131887601).toUpperCase(), new DialogInterface.OnClickListener() {
            @Override
            public void onClick(DialogInterface dialogInterface, int i) {
                BlockContactServiceImpl.getInstance().unBlockContactNumber(list, ZangiEngineUtils.getZipCode());
                textView.setText(BaseScreen.this.getActivity().getString(2131886220));
            }
        });
        alertDialog.k(getActivity().getString(2131886274).toUpperCase(), new DialogInterface.OnClickListener() {
            @Override
            public void onClick(DialogInterface dialogInterface, int i) {
            }
        });
        androidx.appcompat.app.c a = alertDialog.a();
        a.show();
        a.getWindow().setLayout(AlertDialogUtils.getAlertSize(), -2);
        AlertDialogUtils.setCurrentDialog(a);
    }

    protected void inviteByEmail(Context context, String str, CharSequence charSequence) {
        String str2 = "mailto:" + str + "?subject=" + Uri.encode(String.valueOf(context.getString(2131887353))) + "&body=" + Uri.encode(String.valueOf(charSequence));
        Intent intent = new Intent("android.intent.action.SENDTO");
        intent.putExtra("finishActivityOnSaveCompleted", true);
        intent.setData(Uri.parse(str2));
        try {
            startActivity(intent);
        } catch (ActivityNotFoundException unused) {
        }
    }

    public void inviteBySMS(String str, CharSequence charSequence) {
        String str2;
        if (str == null) {
            return;
        }
        try {
            str2 = Telephony.Sms.getDefaultSmsPackage(getActivity());
        } catch (Exception e) {
            Log.e(TAG, e.getLocalizedMessage());
            str2 = null;
        }
        Intent intent = new Intent("android.intent.action.SENDTO", Uri.parse("smsto:" + Uri.encode(str)));
        if (str2 != null) {
            intent.setPackage(str2);
        }
        intent.putExtra("sms_body", charSequence);
        try {
            startActivity(intent);
        } catch (Exception e7) {
            Log.i(TAG, e7.getMessage(), e7);
        }
    }

    protected void showAlertWithMessage(int i, int i7) {
        if (getActivity() == null) {
            return;
        }
        c.a alertDialog = AlertDialogUtils.getAlertDialog(getActivity());
        alertDialog.r(i);
        alertDialog.h(i7);
        alertDialog.d(false);
        alertDialog.p(getActivity().getString(2131887077).toUpperCase(), new DialogInterface.OnClickListener() {
            @Override
            public void onClick(DialogInterface dialogInterface, int i8) {
            }
        });
        androidx.appcompat.app.c a = alertDialog.a();
        a.show();
        a.getWindow().setLayout(AlertDialogUtils.getAlertSize(), -2);
        AlertDialogUtils.setCurrentDialog(a);
    }

    public void showInfoMessage(int i) {
        showCustomAlert(i);
    }

    protected void startConversation(Conversation conversation, long j) {
        ConversationManager.INSTANCE.openConversation(conversation, null, null, Long.valueOf(j), false, false);
    }

    public void formatMuteTillText(Mute.MuteType muteType, Long l, TextView textView, boolean z) {
        if (textView == null) {
            return;
        }
        textView.setText(getMuteText(muteType, l, z));
    }

    protected void startConversation(Contact contact) {
        final LinkedList contactNumbers = contact.getContactNumbers();
        if (contactNumbers != null) {
            if (contactNumbers.size() > 1) {
                AledtDialogAdapter aledtDialogAdapter = new AledtDialogAdapter(getActivity(), contact, AledtDialogAdapter.LOAD_TYPE.ALL);
                c.a alertDialog = AlertDialogUtils.getAlertDialog(getActivity());
                alertDialog.r(2131887359);
                alertDialog.c(aledtDialogAdapter, new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialogInterface, int i) {
                        BaseScreen.this.startConversation(((ContactNumber) contactNumbers.get(i)).getNumber(), false);
                        dialogInterface.dismiss();
                    }
                });
                androidx.appcompat.app.c a = alertDialog.a();
                a.show();
                a.getWindow().setLayout(AlertDialogUtils.getAlertSize(), -2);
                return;
            }
            if (contactNumbers.size() == 1) {
                startConversation(((ContactNumber) contactNumbers.get(0)).getNumber(), false);
            }
        }
    }

    public void hideKeyPad(View view) {
        if (getActivity() == null || view == null) {
            return;
        }
        ((InputMethodManager) getActivity().getSystemService("input_method")).hideSoftInputFromWindow(view.getWindowToken(), 0);
    }

    public static void inviteByMail(Context context, String str, String str2) {
        disableMyAppForShare(context);
        Intent intent = new Intent("android.intent.action.SEND");
        intent.putExtra("android.intent.extra.EMAIL", new String[0]);
        intent.putExtra("android.intent.extra.SUBJECT", context.getString(2131887353));
        intent.putExtra("android.intent.extra.TEXT", str2);
        intent.setType("text/plain");
        context.startActivity(Intent.createChooser(intent, str));
    }

    protected void inviteByEmail(Context context, String str, CharSequence charSequence, String str2) {
        String str3 = "mailto:" + str + "?subject=" + Uri.encode(str2) + "&body=" + Uri.encode(String.valueOf(charSequence));
        Intent intent = new Intent("android.intent.action.SENDTO");
        intent.putExtra("finishActivityOnSaveCompleted", true);
        intent.setData(Uri.parse(str3));
        try {
            startActivity(intent);
        } catch (ActivityNotFoundException unused) {
        }
    }

    protected void showUnmuteAlert(final List<Conversation> list) {
        final androidx.appcompat.app.c a = AlertDialogUtils.getAlertDialog(getActivity()).a();
        a.setTitle(2131886975);
        a.setCancelable(true);
        a.setMessage(getResources().getString(2131886979));
        a.setButton(-2, getString(2131886274).toUpperCase(), new DialogInterface.OnClickListener() {
            @Override
            public void onClick(DialogInterface dialogInterface, int i) {
                a.cancel();
            }
        });
        a.setButton(-1, getString(2131886343).toUpperCase(), new DialogInterface.OnClickListener() {
            @Override
            public void onClick(DialogInterface dialogInterface, int i) {
                for (int i7 = 0; i7 < list.size(); i7++) {
                    ZangiMuteService.getInstance().unMuteConversation((Conversation) list.get(i7));
                }
            }
        });
        a.show();
        a.getWindow().setLayout(AlertDialogUtils.getAlertSize(), -2);
        AlertDialogUtils.setCurrentDialog(a);
    }

    public static void showCustomToast(Context context, int i) {
        if (context == null) {
            return;
        }
        try {
            View inflate = LayoutInflater.from(context).inflate(2131558783, (ViewGroup) null);
            ((TextView) inflate.findViewById(2131363843)).setText(i);
            Toast toast2 = toast;
            if (toast2 != null) {
                toast2.cancel();
            }
            Toast toast3 = new Toast(context);
            toast = toast3;
            toast3.setView(inflate);
            toast.setDuration(1);
            if (inflate.getWindowToken() == null) {
                toast.show();
            }
        } catch (Exception e) {
            Log.i(TAG, "showCustomToast error = " + e.getMessage());
        }
    }

    protected void startConversation(String str) {
        String e164WithoutPlus = ZangiEngineUtils.getE164WithoutPlus(str, ZangiEngineUtils.getZipCode(), false);
        Log.i(TAG, "!!!!!Start conversation with " + e164WithoutPlus);
        if (e164WithoutPlus == null) {
            showInfoMessage(2131886728);
            return;
        }
        Conversation conversationItemByChat = StorageService.INSTANCE.getConversationItemByChat(e164WithoutPlus);
        if (conversationItemByChat == null) {
            conversationItemByChat = new Conversation();
            conversationItemByChat.setLastUpdateDate(System.currentTimeMillis());
            conversationItemByChat.createSingleChat(e164WithoutPlus);
        }
        Conversation conversation = conversationItemByChat;
        ConversationManager conversationManager = ConversationManager.INSTANCE;
        conversationManager.finishActivity();
        HomeActivity homeActivity = HomeActivity.getInstance();
        if (homeActivity == null) {
            conversationManager.openConversation(conversation, null, null, null, false, false);
        } else {
            conversationManager.openConversation(conversation, homeActivity, 2131362423, null, false, false);
        }
    }

    protected void showMuteDialogList(final List<Conversation> list) {
        boolean z;
        int i;
        final ArrayList arrayList = new ArrayList();
        final ArrayList arrayList2 = new ArrayList();
        MuteListAdapter muteListAdapter = null;
        for (int i7 = 0; i7 < list.size(); i7++) {
            if (list.get(i7) == null) {
                return;
            }
            arrayList = new ArrayList();
            String[] stringArray = getResources().getStringArray(2130903048);
            Mute.MuteType mutedType = ZangiMuteService.getInstance().getMutedType(list.get(i7));
            arrayList2.add(mutedType);
            if (mutedType == null || mutedType.equals(Mute.MuteType.NOT_MUTED)) {
                z = false;
                i = 1;
            } else {
                z = true;
                i = 0;
            }
            if (z) {
                showUnmuteAlert(list);
                return;
            }
            while (i < stringArray.length) {
                MuteListItem muteListItem = new MuteListItem();
                muteListItem.setMuteName(stringArray[i]);
                muteListItem.setMuteType(Mute.MuteType.fromOrdinal(i));
                if (z) {
                    if (mutedType.equals(Mute.MuteType.fromOrdinal(i))) {
                        muteListItem.setActiveMute(true);
                    } else {
                        muteListItem.setActiveMute(false);
                    }
                }
                arrayList.add(muteListItem);
                i++;
            }
            muteListAdapter = new MuteListAdapter(arrayList, getActivity());
        }
        c.a alertDialog = AlertDialogUtils.getAlertDialog(getActivity());
        alertDialog.r(2131886975);
        alertDialog.d(true);
        alertDialog.c(muteListAdapter, new DialogInterface.OnClickListener() {
            @Override
            public void onClick(DialogInterface dialogInterface, int i8) {
                if (arrayList2.size() != 0) {
                    for (int i9 = 0; i9 < arrayList2.size(); i9++) {
                        Mute.MuteType muteType = ((MuteListItem) arrayList.get(i8)).getMuteType();
                        switch (AnonymousClass28.$SwitchMap$com$beint$project$core$model$mute$Mute$MuteType[muteType.ordinal()]) {
                            case 1:
                                ZangiMuteService.getInstance().unMuteConversation((Conversation) list.get(i9));
                                break;
                            case 2:
                            case 3:
                            case 4:
                            case 5:
                            case 6:
                                ZangiMuteService.getInstance().muteConversation((Conversation) list.get(i9), muteType);
                                break;
                        }
                    }
                }
            }
        });
        androidx.appcompat.app.c a = alertDialog.a();
        a.setCanceledOnTouchOutside(true);
        a.show();
        a.getWindow().setLayout(AlertDialogUtils.getAlertSize(), -2);
    }

    protected void startConversation(String str, boolean z) {
        startConversation(str, z, false);
    }

    protected void startConversation(String str, boolean z, boolean z6) {
        String e164WithoutPlus = ZangiEngineUtils.getE164WithoutPlus(str, ZangiEngineUtils.getZipCode(), false);
        Log.i(TAG, "!!!!!Start conversation with " + e164WithoutPlus);
        if (e164WithoutPlus == null) {
            showInfoMessage(2131886728);
            return;
        }
        StorageService storageService = StorageService.INSTANCE;
        Conversation conversationItemByChat = storageService.getConversationItemByChat(e164WithoutPlus);
        if (conversationItemByChat == null) {
            conversationItemByChat = new Conversation();
            conversationItemByChat.setLastUpdateDate(System.currentTimeMillis());
            conversationItemByChat.createSingleChat(e164WithoutPlus);
        }
        Conversation conversation = conversationItemByChat;
        if (!storageService.isConversationCreated(conversation.getConversationJid())) {
            storageService.createEmptyConversationForDraftText(conversation);
        }
        FragmentActivity homeActivity = HomeActivity.getInstance();
        if (z6) {
            ContactInfoActivity.Companion companion = ContactInfoActivity.Companion;
            if (companion.getSInstance() != null && companion.getSInstance().get() != null) {
                companion.getSInstance().get().setConversation(conversation);
            }
        }
        if (homeActivity == null) {
            ConversationManager.INSTANCE.openConversation(conversation, null, null, null, z, false);
        } else {
            ConversationManager.INSTANCE.openConversation(conversation, homeActivity, 2131362423, null, z, true);
        }
        ConversationManager.INSTANCE.finishActivity(true);
    }
}