导航菜单

页面标题

页面副标题

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

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

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


package com.beint.project.screens.sms.gallery;

import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.graphics.Bitmap;
import android.net.Uri;
import android.os.AsyncTask;
import android.os.Bundle;
import android.view.MenuItem;
import android.view.View;
import android.widget.TextView;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.Toolbar;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import com.beint.project.core.FileWorker.ImageVideoTransferModel;
import com.beint.project.core.FileWorker.VideoTransferModel;
import com.beint.project.core.managers.PremiumManager;
import com.beint.project.core.services.impl.SoundService;
import com.beint.project.core.services.impl.ZangiMessagingService;
import com.beint.project.core.utils.Log;
import com.beint.project.core.utils.ObjectType;
import com.beint.project.screens.BaseScreen;
import com.beint.project.screens.ConversationManager;
import com.beint.project.screens.sms.AppModeNotifierActivity;
import com.beint.project.screens.sms.ConversationView;
import com.beint.project.screens.sms.gallery.enums.AdditionalSettingsKeys;
import com.beint.project.screens.sms.gallery.enums.DestinationType;
import com.beint.project.screens.sms.gallery.enums.WorkType;
import com.beint.project.screens.sms.gallery.interfaces.GalleryScreenManager;
import com.beint.project.screens.sms.gallery.interfaces.SelectionChangeListener;
import com.beint.project.screens.sms.gallery.model.PhotoEntry;
import com.beint.project.screens.sms.gallery.model.VideoEntry;
import com.beint.project.screens.utils.ImageCache;
import com.beint.project.screens.utils.ImageLoader;
import com.beint.project.utils.ChatUtils;
import com.beint.project.utils.ProgressDialogUtils;
import com.beint.project.utils.ProjectUtils;
import java.lang.ref.WeakReference;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Locale;
import kotlin.jvm.internal.x;

public final class ZangiFileGalleryActivity extends AppModeNotifierActivity implements GalleryScreenManager {
    private static WeakReference<AppCompatActivity> sInstance;
    private boolean isFroGroup;
    private boolean mAddToStack;
    private View mBottomSelectionView;
    private TextView mCountTv;
    private String mDestinationNumber;
    private DestinationType mDestinationType;
    private TextView mDoneTv;
    public static final Companion Companion = new Companion(null);
    private static final String HAVE_SELECTED_LIST = "HAVE_SELECTED_LIST";
    private static final String DESTINATION_ENUM_KEY = "DESTINATION_ENUM_KEY";
    private static final String DESTINATION_NUMBER_KEY = "DESTINATION_NUMBER_KEY";
    private static final String IS_FOR_GROUP = "IS_FOR_GROUP";
    private static final String IS_FROM_IMAGE_BROWSER_PAGE = "IS_FROM_IMAGE_BROWSER_PAGE";
    private static final String TAKEN_MEDIA_PATH = "TAKEN_MEDIA_PATH";
    private final String TAG = "ZangiFileGalleryActivity";
    private final List<SelectionChangeListener> selectionChangeListeners = new ArrayList();

    public static final class Companion {
        private Companion() {
        }

        public Companion(kotlin.jvm.internal.g gVar) {
            this();
        }

        public final void finishInstance() {
            if (getSInstance() != null) {
                WeakReference<AppCompatActivity> sInstance = getSInstance();
                kotlin.jvm.internal.k.c(sInstance);
                if (sInstance.get() != null) {
                    WeakReference<AppCompatActivity> sInstance2 = getSInstance();
                    kotlin.jvm.internal.k.c(sInstance2);
                    AppCompatActivity appCompatActivity = sInstance2.get();
                    kotlin.jvm.internal.k.c(appCompatActivity);
                    appCompatActivity.finish();
                }
            }
        }

        public final String getDESTINATION_ENUM_KEY() {
            return ZangiFileGalleryActivity.DESTINATION_ENUM_KEY;
        }

        public final String getDESTINATION_NUMBER_KEY() {
            return ZangiFileGalleryActivity.DESTINATION_NUMBER_KEY;
        }

        public final String getHAVE_SELECTED_LIST() {
            return ZangiFileGalleryActivity.HAVE_SELECTED_LIST;
        }

        public final String getIS_FOR_GROUP() {
            return ZangiFileGalleryActivity.IS_FOR_GROUP;
        }

        public final String getIS_FROM_IMAGE_BROWSER_PAGE() {
            return ZangiFileGalleryActivity.IS_FROM_IMAGE_BROWSER_PAGE;
        }

        public final WeakReference<AppCompatActivity> getSInstance() {
            return ZangiFileGalleryActivity.sInstance;
        }

        public final String getTAKEN_MEDIA_PATH() {
            return ZangiFileGalleryActivity.TAKEN_MEDIA_PATH;
        }

        public final void setSInstance(WeakReference<AppCompatActivity> weakReference) {
            ZangiFileGalleryActivity.sInstance = weakReference;
        }
    }

    private static final class GetThumnail extends AsyncTask<Void, Void, Void> {
        private final String filePath;
        private final ImageCache imageCache;
        private final boolean isVideo;

        public GetThumnail(String str, boolean z) {
            kotlin.jvm.internal.k.f(str, "filePath");
            ImageCache imageCache = ImageLoader.getImageCache();
            kotlin.jvm.internal.k.e(imageCache, "getImageCache()");
            this.imageCache = imageCache;
            this.filePath = str;
            this.isVideo = z;
        }

        @Override
        public Void doInBackground(Void... voidArr) {
            kotlin.jvm.internal.k.f(voidArr, "params");
            if (this.imageCache.getBitmapFromMemCache(this.filePath) != null) {
                return null;
            }
            this.imageCache.addBitmapToCache(this.filePath, ChatUtils.createThumbnails(this.filePath, Boolean.valueOf(this.isVideo)));
            return null;
        }

        @Override
        public void onPostExecute(Void r1) {
            super.onPostExecute((GetThumnail) r1);
        }
    }

    public class WhenMappings {
        public static final int[] $EnumSwitchMapping$0;
        public static final int[] $EnumSwitchMapping$1;

        static {
            int[] iArr = new int[DestinationType.values().length];
            try {
                iArr[DestinationType.SELECT_IMAGE_AND_VIDEO.ordinal()] = 1;
            } catch (NoSuchFieldError unused) {
            }
            try {
                iArr[DestinationType.SELECT_IMAGE.ordinal()] = 2;
            } catch (NoSuchFieldError unused2) {
            }
            try {
                iArr[DestinationType.SELECT_VIDEO.ordinal()] = 3;
            } catch (NoSuchFieldError unused3) {
            }
            try {
                iArr[DestinationType.SELECT_DOCUMENT.ordinal()] = 4;
            } catch (NoSuchFieldError unused4) {
            }
            try {
                iArr[DestinationType.SELECT_MEDIA_FILE.ordinal()] = 5;
            } catch (NoSuchFieldError unused5) {
            }
            try {
                iArr[DestinationType.SELECT_IMAGE_FOR_PROFILE.ordinal()] = 6;
            } catch (NoSuchFieldError unused6) {
            }
            try {
                iArr[DestinationType.ADD_DESCRIPTION_TO_IMAGE.ordinal()] = 7;
            } catch (NoSuchFieldError unused7) {
            }
            try {
                iArr[DestinationType.ADD_DESCRIPTION_TO_VIDEO.ordinal()] = 8;
            } catch (NoSuchFieldError unused8) {
            }
            $EnumSwitchMapping$0 = iArr;
            int[] iArr2 = new int[WorkType.values().length];
            try {
                iArr2[WorkType.IMAGE_AND_VIDEO_TABS.ordinal()] = 1;
            } catch (NoSuchFieldError unused9) {
            }
            try {
                iArr2[WorkType.IMAGE_FOLDERS.ordinal()] = 2;
            } catch (NoSuchFieldError unused10) {
            }
            try {
                iArr2[WorkType.VIDEO_FOLDERS.ordinal()] = 3;
            } catch (NoSuchFieldError unused11) {
            }
            try {
                iArr2[WorkType.IMAGE_THUMBNAILS.ordinal()] = 4;
            } catch (NoSuchFieldError unused12) {
            }
            try {
                iArr2[WorkType.VIDEO_THUMBNAILS.ordinal()] = 5;
            } catch (NoSuchFieldError unused13) {
            }
            try {
                iArr2[WorkType.FILES_DOCUMENTS.ordinal()] = 6;
            } catch (NoSuchFieldError unused14) {
            }
            try {
                iArr2[WorkType.FILES_MEDIA.ordinal()] = 7;
            } catch (NoSuchFieldError unused15) {
            }
            try {
                iArr2[WorkType.SEND_FILE.ordinal()] = 8;
            } catch (NoSuchFieldError unused16) {
            }
            try {
                iArr2[WorkType.VIDEO_PREVIEW.ordinal()] = 9;
            } catch (NoSuchFieldError unused17) {
            }
            try {
                iArr2[WorkType.SET_RESULT_FOR_PROFILE.ordinal()] = 10;
            } catch (NoSuchFieldError unused18) {
            }
            $EnumSwitchMapping$1 = iArr2;
        }
    }

    private final boolean canAddFile() {
        return getAllSelectedItemsCount() < getMaxSelectionCount() || PremiumManager.INSTANCE.isPremium();
    }

    private final String getConversationId() {
        if (ZangiMessagingService.getInstance().getCurrChat() != null) {
            Log.i(this.TAG, "getConversationId currChat = " + ZangiMessagingService.getInstance().getCurrChat().getConversationId());
            return ZangiMessagingService.getInstance().getCurrChat().getConversationId();
        }
        ConversationManager conversationManager = ConversationManager.INSTANCE;
        if (conversationManager.getCurrentJid() != null) {
            Log.i(this.TAG, "getConversationId currentJid = " + conversationManager.getCurrentJid());
            return conversationManager.getCurrentJid();
        }
        Intent intent = getIntent();
        if (intent == null) {
            Log.i(this.TAG, "getConversationId null");
            return null;
        }
        String str = this.TAG;
        StringBuilder sb = new StringBuilder();
        sb.append("getConversationId intent = ");
        Bundle extras = intent.getExtras();
        sb.append(extras != null ? extras.getString(DESTINATION_NUMBER_KEY) : null);
        Log.i(str, sb.toString());
        Bundle extras2 = intent.getExtras();
        if (extras2 != null) {
            return extras2.getString(DESTINATION_NUMBER_KEY);
        }
        return null;
    }

    private final boolean isGroup(String str) {
        if (!(str != null && zb.f.y(str, "gid", false, 2, (Object) null))) {
            if (!(str != null && zb.f.y(str, "pid", false, 2, (Object) null))) {
                return false;
            }
        }
        return true;
    }

    public static final void onCreate$lambda$0(ZangiFileGalleryActivity zangiFileGalleryActivity, View view) {
        kotlin.jvm.internal.k.f(zangiFileGalleryActivity, "this$0");
        ProgressDialogUtils.showDialog(zangiFileGalleryActivity, "", zangiFileGalleryActivity.getString(2131887172), true);
        zangiFileGalleryActivity.show(WorkType.SEND_FILE, null);
        ProgressDialogUtils.dismissCurrentDialog();
    }

    public static final void onCreate$lambda$1(ZangiFileGalleryActivity zangiFileGalleryActivity, View view) {
        kotlin.jvm.internal.k.f(zangiFileGalleryActivity, "this$0");
        zangiFileGalleryActivity.finish();
    }

    public static final void onCreate$lambda$2(ZangiFileGalleryActivity zangiFileGalleryActivity, Object obj, boolean z) {
        kotlin.jvm.internal.k.f(zangiFileGalleryActivity, "this$0");
        zangiFileGalleryActivity.onSelectionChangeFunctional(zangiFileGalleryActivity.getSelectedImagesCount() + zangiFileGalleryActivity.getSelectedVideosCount());
    }

    private final void onSelectionChangeFunctional(int i) {
        String format;
        TextView textView = this.mDoneTv;
        if (textView != null) {
            textView.setEnabled(i > 0);
        }
        int maxSelectionCount = getMaxSelectionCount();
        if (PremiumManager.INSTANCE.isPremium()) {
            format = i + "";
        } else {
            x xVar = x.a;
            format = String.format(Locale.getDefault(), "%d/%d", Arrays.copyOf(new Object[]{Integer.valueOf(i), Integer.valueOf(maxSelectionCount)}, 2));
            kotlin.jvm.internal.k.e(format, "format(locale, format, *args)");
        }
        TextView textView2 = this.mCountTv;
        if (textView2 == null) {
            return;
        }
        textView2.setText(format);
    }

    private final void showFragment(WorkType workType, Fragment fragment) {
        FragmentManager supportFragmentManager = getSupportFragmentManager();
        kotlin.jvm.internal.k.e(supportFragmentManager, "supportFragmentManager");
        androidx.fragment.app.r n = supportFragmentManager.n();
        kotlin.jvm.internal.k.e(n, "fragmentManager.beginTransaction()");
        n.r(2131362562, fragment, workType.name());
        if (this.mAddToStack) {
            n.g(workType.name());
        }
        this.mAddToStack = true;
        n.j();
    }

    private final void startZangiImageEditActivity() {
        Bundle bundle = new Bundle();
        if (getCallingActivity() != null) {
            ComponentName callingActivity = getCallingActivity();
            kotlin.jvm.internal.k.c(callingActivity);
            if (kotlin.jvm.internal.k.b(callingActivity.getClassName(), ZangiImageEditActivity.class.getName())) {
                Intent intent = new Intent();
                intent.putExtras(bundle);
                setResult(-1, intent);
                finish();
            }
        }
        String conversationId = getConversationId();
        if (conversationId != null) {
            bundle.putString(DESTINATION_NUMBER_KEY, conversationId);
        }
        bundle.putBoolean(IS_FOR_GROUP, isGroup(conversationId));
        getScreenService().openZangiImageEditActivity(this, bundle);
        finish();
    }

    @Override
    public boolean addSelectedImage(PhotoEntry photoEntry) {
        if (photoEntry == null) {
            return false;
        }
        boolean canAddFile = canAddFile();
        String conversationId = getConversationId();
        if (conversationId == null) {
            return false;
        }
        if (canAddFile) {
            GallerySelectedManager.INSTANCE.addToList(photoEntry, conversationId);
            Iterator<SelectionChangeListener> it = this.selectionChangeListeners.iterator();
            while (it.hasNext()) {
                it.next().onSelectionChange(photoEntry, true);
            }
        } else {
            x xVar = x.a;
            Locale locale = Locale.getDefault();
            String string = getString(2131886604);
            kotlin.jvm.internal.k.e(string, "getString(R.string.gallery_selected_items_limit)");
            String format = String.format(locale, string, Arrays.copyOf(new Object[]{Integer.valueOf(getMaxSelectionCount())}, 1));
            kotlin.jvm.internal.k.e(format, "format(locale, format, *args)");
            BaseScreen.showCustomToast((Context) this, format);
        }
        return canAddFile;
    }

    @Override
    public boolean addSelectedVideo(VideoEntry videoEntry) {
        String conversationId;
        boolean canAddFile = canAddFile();
        if (videoEntry == null || (conversationId = getConversationId()) == null) {
            return false;
        }
        if (canAddFile) {
            GallerySelectedManager.INSTANCE.addToList(videoEntry, conversationId);
            Iterator<SelectionChangeListener> it = this.selectionChangeListeners.iterator();
            while (it.hasNext()) {
                it.next().onSelectionChange(videoEntry, true);
            }
        } else {
            x xVar = x.a;
            Locale locale = Locale.getDefault();
            String string = getString(2131886604);
            kotlin.jvm.internal.k.e(string, "getString(R.string.gallery_selected_items_limit)");
            String format = String.format(locale, string, Arrays.copyOf(new Object[]{Integer.valueOf(getMaxSelectionCount())}, 1));
            kotlin.jvm.internal.k.e(format, "format(locale, format, *args)");
            BaseScreen.showCustomToast((Context) this, format);
        }
        return canAddFile;
    }

    @Override
    public void back() {
        onBackPressed();
    }

    @Override
    public void clearAllSelectedItems() {
        GallerySelectedManager.INSTANCE.clearAll();
    }

    @Override
    public int getAllSelectedItemsCount() {
        return getSelectedImagesCount() + getSelectedVideosCount();
    }

    @Override
    public String getDestinationNumber() {
        return this.mDestinationNumber;
    }

    @Override
    public DestinationType getDestinationType() {
        return this.mDestinationType;
    }

    @Override
    public int getMaxSelectionCount() {
        return ProjectUtils.getMaxCountForSendMedia();
    }

    @Override
    public List<ImageVideoTransferModel> getSelectedImages() {
        return GallerySelectedManager.INSTANCE.getGallerySelectedPhotos();
    }

    @Override
    public int getSelectedImagesCount() {
        return GallerySelectedManager.INSTANCE.getGallerySelectedPhotos().size();
    }

    @Override
    public List<ImageVideoTransferModel> getSelectedVideos() {
        return GallerySelectedManager.INSTANCE.getGallerySelectedVideos();
    }

    @Override
    public int getSelectedVideosCount() {
        return GallerySelectedManager.INSTANCE.getGallerySelectedVideos().size();
    }

    public final String getTAG() {
        return this.TAG;
    }

    @Override
    public void goBackFirstScreen() {
        FragmentManager supportFragmentManager = getSupportFragmentManager();
        kotlin.jvm.internal.k.e(supportFragmentManager, "supportFragmentManager");
        FragmentManager.k n0 = supportFragmentManager.n0(0);
        kotlin.jvm.internal.k.e(n0, "fragmentManager.getBackStackEntryAt(0)");
        supportFragmentManager.b1(n0.getName(), 1);
    }

    @Override
    public boolean isContainsGalleryObject(ObjectType objectType) {
        return GallerySelectedManager.INSTANCE.isContains(objectType);
    }

    @Override
    public boolean isForGroup() {
        return this.isFroGroup;
    }

    public void onBackPressed() {
        SoundService soundService = SoundService.INSTANCE;
        soundService.initClosePanelSound(2131820547);
        soundService.startClosePanelSound();
        super.onBackPressed();
    }

    @Override
    protected void onCreate(Bundle bundle) {
        WorkType workType;
        super.onCreate(bundle);
        sInstance = new WeakReference<>(this);
        setContentView(2131558713);
        View findViewById = findViewById(2131363849);
        if (findViewById != null) {
            findViewById.setVisibility(8);
        }
        this.mBottomSelectionView = findViewById(2131362580);
        TextView textView = (TextView) findViewById(2131362119);
        View findViewById2 = findViewById(2131362402);
        kotlin.jvm.internal.k.d(findViewById2, "null cannot be cast to non-null type android.widget.TextView");
        this.mDoneTv = (TextView) findViewById2;
        View findViewById3 = findViewById(2131362297);
        kotlin.jvm.internal.k.d(findViewById3, "null cannot be cast to non-null type android.widget.TextView");
        this.mCountTv = (TextView) findViewById3;
        onSelectionChangeFunctional(0);
        Intent intent = getIntent();
        DestinationType destinationType = intent != null ? (DestinationType) intent.getSerializableExtra(DESTINATION_ENUM_KEY) : null;
        if (destinationType == null) {
            finish();
        }
        setDestinationType(destinationType);
        Toolbar findViewById4 = findViewById(2131363848);
        kotlin.jvm.internal.k.d(findViewById4, "null cannot be cast to non-null type androidx.appcompat.widget.Toolbar");
        setSupportActionBar(findViewById4);
        androidx.appcompat.app.a supportActionBar = getSupportActionBar();
        if (supportActionBar != null) {
            supportActionBar.v(false);
        }
        androidx.appcompat.app.a supportActionBar2 = getSupportActionBar();
        if (supportActionBar2 != null) {
            supportActionBar2.q(true);
        }
        androidx.appcompat.app.a supportActionBar3 = getSupportActionBar();
        if (supportActionBar3 != null) {
            supportActionBar3.r(true);
        }
        TextView textView2 = this.mDoneTv;
        if (textView2 != null) {
            textView2.setOnClickListener(new View.OnClickListener() {
                @Override
                public final void onClick(View view) {
                    ZangiFileGalleryActivity.onCreate$lambda$0(ZangiFileGalleryActivity.this, view);
                }
            });
        }
        if (textView != null) {
            textView.setOnClickListener(new View.OnClickListener() {
                @Override
                public final void onClick(View view) {
                    ZangiFileGalleryActivity.onCreate$lambda$1(ZangiFileGalleryActivity.this, view);
                }
            });
        }
        registerUpdateEvent(new SelectionChangeListener() {
            @Override
            public final void onSelectionChange(Object obj, boolean z) {
                ZangiFileGalleryActivity.onCreate$lambda$2(ZangiFileGalleryActivity.this, obj, z);
            }
        });
        onSelectionChangeFunctional(GallerySelectedManager.INSTANCE.getGallerySelectedArray().size());
        setBottomSelectionViewVisibility(true);
        DestinationType destinationType2 = getDestinationType();
        switch (destinationType2 == null ? -1 : WhenMappings.$EnumSwitchMapping$0[destinationType2.ordinal()]) {
            case 1:
                workType = WorkType.IMAGE_AND_VIDEO_TABS;
                break;
            case 2:
                workType = WorkType.IMAGE_FOLDERS;
                break;
            case 3:
                workType = WorkType.VIDEO_FOLDERS;
                break;
            case 4:
                workType = WorkType.FILES_DOCUMENTS;
                break;
            case 5:
                workType = WorkType.FILES_MEDIA;
                break;
            case 6:
                workType = WorkType.IMAGE_FOLDERS;
                break;
            case 7:
                Bundle extras = getIntent().getExtras();
                String string = extras != null ? extras.getString(TAKEN_MEDIA_PATH) : null;
                PhotoEntry photoEntry = new PhotoEntry();
                photoEntry.path = string;
                addSelectedImage(photoEntry);
                workType = WorkType.SEND_FILE;
                break;
            case 8:
                Bundle extras2 = getIntent().getExtras();
                String string2 = extras2 != null ? extras2.getString(TAKEN_MEDIA_PATH) : null;
                VideoEntry videoEntry = new VideoEntry(string2);
                Bundle extras3 = getIntent().getExtras();
                kotlin.jvm.internal.k.c(extras3);
                videoEntry.videoId = extras3.getInt("videoId", 0);
                videoEntry.path = string2;
                addSelectedVideo(videoEntry);
                workType = WorkType.VIDEO_PREVIEW;
                break;
            default:
                workType = null;
                break;
        }
        show(workType, null);
        ConversationManager conversationManager = ConversationManager.INSTANCE;
        if (conversationManager.getActivity() != null) {
            conversationManager.setGalleryActivity(new WeakReference<>(this));
        }
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
        sInstance = null;
    }

    public boolean onOptionsItemSelected(MenuItem menuItem) {
        kotlin.jvm.internal.k.f(menuItem, "item");
        if (menuItem.getItemId() == 16908332) {
            onBackPressed();
        } else {
            ConversationManager conversationManager = ConversationManager.INSTANCE;
            if (conversationManager.getConversationScreenRef() != null) {
                WeakReference<ConversationView> conversationScreenRef = conversationManager.getConversationScreenRef();
                kotlin.jvm.internal.k.c(conversationScreenRef);
                ConversationView conversationView = conversationScreenRef.get();
                kotlin.jvm.internal.k.c(conversationView);
                conversationView.setForceDeleteReplyView(true);
            }
        }
        return super/*android.app.Activity*/.onOptionsItemSelected(menuItem);
    }

    @Override
    public void registerUpdateEvent(SelectionChangeListener selectionChangeListener) {
        kotlin.jvm.internal.k.f(selectionChangeListener, "_listener");
        this.selectionChangeListeners.add(selectionChangeListener);
    }

    @Override
    public void removeSelectedImage(ObjectType objectType) {
        GallerySelectedManager.INSTANCE.removeFromList(objectType);
        Iterator<SelectionChangeListener> it = this.selectionChangeListeners.iterator();
        while (it.hasNext()) {
            it.next().onSelectionChange(objectType, false);
        }
    }

    @Override
    public void removeSelectedVideo(VideoEntry videoEntry) {
        GallerySelectedManager.INSTANCE.removeFromList(videoEntry);
        Iterator<SelectionChangeListener> it = this.selectionChangeListeners.iterator();
        while (it.hasNext()) {
            it.next().onSelectionChange(videoEntry, false);
        }
    }

    @Override
    public void setActionBarTitle(int i) {
        androidx.appcompat.app.a supportActionBar = getSupportActionBar();
        if (supportActionBar != null) {
            supportActionBar.w(i);
        }
    }

    @Override
    public void setBottomSelectionViewVisibility(boolean z) {
        DestinationType destinationType = getDestinationType();
        int i = destinationType == null ? -1 : WhenMappings.$EnumSwitchMapping$0[destinationType.ordinal()];
        if (i == 4 || i == 5 || i == 6) {
            z = false;
        }
        if (z) {
            View view = this.mBottomSelectionView;
            kotlin.jvm.internal.k.c(view);
            view.setVisibility(0);
        } else {
            View view2 = this.mBottomSelectionView;
            kotlin.jvm.internal.k.c(view2);
            view2.setVisibility(8);
        }
    }

    @Override
    public void setDestinationNumber(String str) {
        this.mDestinationNumber = str;
    }

    @Override
    public void setDestinationType(DestinationType destinationType) {
        this.mDestinationType = destinationType;
    }

    @Override
    public void setForGroup(boolean z) {
        this.isFroGroup = z;
    }

    @Override
    public void show(WorkType workType, HashMap<AdditionalSettingsKeys, Object> hashMap) {
        String str;
        if (workType == null) {
            finish();
        }
        FragmentManager supportFragmentManager = getSupportFragmentManager();
        kotlin.jvm.internal.k.e(supportFragmentManager, "supportFragmentManager");
        if (supportFragmentManager.j0(workType.name()) != null) {
            int o0 = supportFragmentManager.o0();
            int i = 0;
            while (true) {
                if (i >= o0) {
                    str = null;
                    break;
                }
                FragmentManager.k n0 = supportFragmentManager.n0(i);
                kotlin.jvm.internal.k.e(n0, "fragmentManager.getBackStackEntryAt(i)");
                if (kotlin.jvm.internal.k.b(workType.name(), n0.getName())) {
                    str = n0.getName();
                    break;
                }
                i++;
            }
            if (str == null && supportFragmentManager.o0() > 0 && supportFragmentManager.n0(0) != null) {
                str = supportFragmentManager.n0(0).getName();
            }
            supportFragmentManager.b1(str, 1);
            return;
        }
        switch (WhenMappings.$EnumSwitchMapping$1[workType.ordinal()]) {
            case 1:
                ImageAndVideoGalleryFragment imageAndVideoGalleryFragment = new ImageAndVideoGalleryFragment();
                imageAndVideoGalleryFragment.setScreenManager(this);
                showFragment(workType, imageAndVideoGalleryFragment);
                break;
            case 2:
                GalleryFoldersFragment galleryFoldersFragment = new GalleryFoldersFragment();
                galleryFoldersFragment.setScreenManager(this);
                showFragment(workType, galleryFoldersFragment);
                setActionBarTitle(2131886152);
                break;
            case 3:
                VideoFilesFoldersFragment videoFilesFoldersFragment = new VideoFilesFoldersFragment();
                videoFilesFoldersFragment.setScreenManager(this);
                showFragment(workType, videoFilesFoldersFragment);
                setActionBarTitle(2131886152);
                break;
            case 4:
                GalleryAlbumsThumbnailsFragment galleryAlbumsThumbnailsFragment = new GalleryAlbumsThumbnailsFragment();
                kotlin.jvm.internal.k.c(hashMap);
                galleryAlbumsThumbnailsFragment.setPhotos((ArrayList) hashMap.get(AdditionalSettingsKeys.PHOTOS));
                galleryAlbumsThumbnailsFragment.setScreenManager(this);
                showFragment(workType, galleryAlbumsThumbnailsFragment);
                break;
            case 5:
                VideoFilesThumbnailsFragment videoFilesThumbnailsFragment = new VideoFilesThumbnailsFragment();
                kotlin.jvm.internal.k.c(hashMap);
                videoFilesThumbnailsFragment.setVideos((ArrayList) hashMap.get(AdditionalSettingsKeys.VIDEOS));
                videoFilesThumbnailsFragment.setScreenManager(this);
                showFragment(workType, videoFilesThumbnailsFragment);
                break;
            case 6:
                DocumentListFragment documentListFragment = new DocumentListFragment();
                documentListFragment.setScreenManager(this);
                showFragment(workType, documentListFragment);
                break;
            case 7:
                AudioFileListFragment audioFileListFragment = new AudioFileListFragment();
                audioFileListFragment.setScreenManager(this);
                showFragment(workType, audioFileListFragment);
                break;
            case 8:
                startZangiImageEditActivity();
                break;
            case 9:
                VideoPreviewFragment videoPreviewFragment = new VideoPreviewFragment();
                if (hashMap != null) {
                    VideoEntry videoEntry = (VideoEntry) hashMap.get(AdditionalSettingsKeys.VIDEO_ITEM);
                    Bitmap bitmapFromMemCache = ImageLoader.getImageCache().getBitmapFromMemCache(String.valueOf(videoEntry));
                    if (bitmapFromMemCache != null) {
                        ImageCache imageCache = ImageLoader.getImageCache();
                        kotlin.jvm.internal.k.c(videoEntry);
                        imageCache.addBitmapToCache(videoEntry.path, bitmapFromMemCache);
                    } else {
                        kotlin.jvm.internal.k.c(videoEntry);
                        String str2 = videoEntry.path;
                        kotlin.jvm.internal.k.e(str2, "video!!.path");
                        new GetThumnail(str2, true).execute(new Void[0]);
                    }
                    String conversationId = getConversationId();
                    if (conversationId != null) {
                        GallerySelectedManager.INSTANCE.addToList(videoEntry, conversationId);
                        Bundle bundle = new Bundle();
                        bundle.putInt("model_position", 0);
                        bundle.putBoolean("get_from_gallery_selected_list", true);
                        videoPreviewFragment.setArguments(bundle);
                    }
                } else {
                    VideoTransferModel videoTransferModel = getSelectedVideos().get(0);
                    kotlin.jvm.internal.k.d(videoTransferModel, "null cannot be cast to non-null type com.beint.project.core.FileWorker.VideoTransferModel");
                    VideoEntry videoEntry2 = (VideoEntry) videoTransferModel.getGalleryObject();
                    Bundle bundle2 = new Bundle();
                    bundle2.putInt("model_position", 0);
                    bundle2.putBoolean("get_from_gallery_selected_lis", false);
                    videoPreviewFragment.setArguments(bundle2);
                    if (videoEntry2 != null) {
                        Bitmap bitmapFromMemCache2 = ImageLoader.getImageCache().getBitmapFromMemCache(videoEntry2.toString());
                        if (bitmapFromMemCache2 != null) {
                            ImageLoader.getImageCache().addBitmapToCache(videoEntry2.path, bitmapFromMemCache2);
                        } else {
                            String str3 = videoEntry2.path;
                            kotlin.jvm.internal.k.e(str3, "video.path");
                            new GetThumnail(str3, true).execute(new Void[0]);
                        }
                    }
                }
                showFragment(workType, videoPreviewFragment);
                break;
            case 10:
                kotlin.jvm.internal.k.c(hashMap);
                String str4 = (String) hashMap.get(AdditionalSettingsKeys.IMAGE_PATH);
                Intent intent = new Intent();
                intent.putExtra("com.beint.project.PHOTO_URI", str4);
                intent.setData(Uri.parse(str4));
                setResult(-1, intent);
                finish();
                break;
        }
    }

    @Override
    public void unregisterUpdateEvent(SelectionChangeListener selectionChangeListener) {
        kotlin.jvm.internal.k.f(selectionChangeListener, "_listener");
        this.selectionChangeListeners.remove(selectionChangeListener);
    }

    @Override
    public void setActionBarTitle(CharSequence charSequence) {
        androidx.appcompat.app.a supportActionBar = getSupportActionBar();
        if (supportActionBar == null) {
            return;
        }
        supportActionBar.x(charSequence);
    }
}