导航菜单

页面标题

页面副标题

Biko v2.0.23 - CreateNewTicketActivity.java 源代码

正在查看: Biko v2.0.23 应用的 CreateNewTicketActivity.java JAVA 源代码文件

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


package app.callpe.ui.user;

import android.app.Activity;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
import android.text.Editable;
import android.text.TextWatcher;
import android.view.LayoutInflater;
import android.view.MenuItem;
import android.view.MotionEvent;
import android.view.View;
import androidx.activity.ComponentActivity;
import androidx.appcompat.app.ActionBar;
import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.widget.Toolbar;
import androidx.core.content.ContextCompat;
import androidx.lifecycle.LifecycleOwner;
import androidx.lifecycle.LifecycleOwnerKt;
import androidx.lifecycle.ViewModelLazy;
import androidx.lifecycle.ViewModelProvider;
import androidx.lifecycle.ViewModelStore;
import androidx.lifecycle.viewmodel.CreationExtras;
import androidx.recyclerview.widget.LinearLayoutManager;
import app.callpe.adapters.TicketMediaAdapter;
import app.callpe.adapters.TicketTopicsAdapter;
import app.callpe.common.utils.Constants;
import app.callpe.common.utils.custom.CustomGridLayoutManager;
import app.callpe.common.utils.custom.mediaslider.MediaSliderActivity;
import app.callpe.common.utils.extensions.ActivityExtKt;
import app.callpe.common.utils.helper_functions.DialogHelper;
import app.callpe.data.model.MediaFile;
import app.callpe.data.model.TicketsModel;
import app.callpe.databinding.ActivityCreateNewTicketBinding;
import app.callpe.ui.bottomsheet.TicketMediaSelectionSheet;
import app.callpe.ui.home.BaseActivity;
import app.callpe.ui.user.games.TicketsViewModel;
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
import dagger.hilt.android.AndroidEntryPoint;
import java.util.ArrayList;
import kotlin.Deprecated;
import kotlin.Lazy;
import kotlin.Metadata;
import kotlin.Unit;
import kotlin.collections.CollectionsKt;
import kotlin.coroutines.CoroutineContext;
import kotlin.jvm.functions.Function0;
import kotlin.jvm.functions.Function1;
import kotlin.jvm.internal.DefaultConstructorMarker;
import kotlin.jvm.internal.Intrinsics;
import kotlin.jvm.internal.Reflection;
import kotlin.text.StringsKt;
import kotlinx.coroutines.BuildersKt;
import kotlinx.coroutines.CoroutineStart;
import kotlinx.coroutines.Job;
import timber.log.Timber;

@Metadata(d1 = {"\u0000\u008a\u0001\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\b\n\u0002\b\u0005\n\u0002\u0010\u000b\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0005\n\u0002\u0010\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u000e\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\u0004\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\u000e\b\u0007\u0018\u0000 E2\b\u0012\u0004\u0012\u00020\u00020\u0001:\u0001EB\u0005¢\u0006\u0002\u0010\u0003J\u0010\u0010\u001c\u001a\u00020\u001d2\u0006\u0010\u001e\u001a\u00020\tH\u0002J0\u0010\u001f\u001a\u0012\u0012\u0004\u0012\u00020!0 j\b\u0012\u0004\u0012\u00020!`\"2\u0016\u0010#\u001a\u0012\u0012\u0004\u0012\u00020$0 j\b\u0012\u0004\u0012\u00020$`\"H\u0002J\u0016\u0010%\u001a\u00020\u001d2\f\u0010&\u001a\b\u0012\u0004\u0012\u00020\u001d0'H\u0002J\b\u0010(\u001a\u00020\u001dH\u0003J\u0010\u0010)\u001a\u00020\u00022\u0006\u0010*\u001a\u00020+H\u0016J\b\u0010,\u001a\u00020\u001dH\u0002J\b\u0010-\u001a\u00020\u001dH\u0002J\b\u0010.\u001a\u00020/H\u0002J\b\u00100\u001a\u00020\u001dH\u0017J\b\u00101\u001a\u00020\u001dH\u0003J\u0012\u00102\u001a\u00020\u001d2\b\u00103\u001a\u0004\u0018\u000104H\u0014J\b\u00105\u001a\u00020\u001dH\u0014J\u0010\u00106\u001a\u00020\u000f2\u0006\u00107\u001a\u000208H\u0016J\b\u00109\u001a\u00020\u001dH\u0014J\b\u0010:\u001a\u00020\u001dH\u0014J\u0010\u0010;\u001a\u00020\u001d2\u0006\u0010<\u001a\u00020\tH\u0007J\b\u0010=\u001a\u00020\u001dH\u0002J\b\u0010>\u001a\u00020\u001dH\u0002J\b\u0010?\u001a\u00020\u001dH\u0002J\b\u0010@\u001a\u00020\u001dH\u0002J0\u0010A\u001a\u00020\u001d2\u0006\u0010B\u001a\u00020$2\u0006\u0010C\u001a\u00020$2\u0016\u0010D\u001a\u0012\u0012\u0004\u0012\u00020$0 j\b\u0012\u0004\u0012\u00020$`\"H\u0002R\u0010\u0010\u0004\u001a\u0004\u0018\u00010\u0005X\u0082\u000e¢\u0006\u0002\n\u0000R\u0010\u0010\u0006\u001a\u0004\u0018\u00010\u0007X\u0082\u000e¢\u0006\u0002\n\u0000R\u001a\u0010\b\u001a\u00020\tX\u0086\u000e¢\u0006\u000e\n\u0000\u001a\u0004\b\n\u0010\u000b\"\u0004\b\f\u0010\rR\u000e\u0010\u000e\u001a\u00020\u000fX\u0082\u000e¢\u0006\u0002\n\u0000R\u0010\u0010\u0010\u001a\u0004\u0018\u00010\u0011X\u0082\u000e¢\u0006\u0002\n\u0000R\u0010\u0010\u0012\u001a\u0004\u0018\u00010\u0013X\u0082\u000e¢\u0006\u0002\n\u0000R\u000e\u0010\u0014\u001a\u00020\u0015X\u0082.¢\u0006\u0002\n\u0000R\u001b\u0010\u0016\u001a\u00020\u00178BX\u0082\u0084\u0002¢\u0006\f\n\u0004\b\u001a\u0010\u001b\u001a\u0004\b\u0018\u0010\u0019¨\u0006F"}, d2 = {"Lapp/callpe/ui/user/CreateNewTicketActivity;", "Lapp/callpe/ui/home/BaseActivity;", "Lapp/callpe/databinding/ActivityCreateNewTicketBinding;", "()V", "adapter", "Lapp/callpe/adapters/TicketTopicsAdapter;", "alertDialog", "Landroidx/appcompat/app/AlertDialog;", "descriptionTxtLength", "", "getDescriptionTxtLength", "()I", "setDescriptionTxtLength", "(I)V", "resume", "", "ticketMediaAdapter", "Lapp/callpe/adapters/TicketMediaAdapter;", "ticketMediaSheet", "Lapp/callpe/ui/bottomsheet/TicketMediaSelectionSheet;", "toolbar", "Landroidx/appcompat/widget/Toolbar;", "viewModel", "Lapp/callpe/ui/user/games/TicketsViewModel;", "getViewModel", "()Lapp/callpe/ui/user/games/TicketsViewModel;", "viewModel$delegate", "Lkotlin/Lazy;", "checkForAddButtonVisibility", "", "mediaSize", "createMediaFilesFromUrls", "Ljava/util/ArrayList;", "Lapp/callpe/data/model/MediaFile;", "Lkotlin/collections/ArrayList;", "urls", "", "finishThisActivity", "onBackPress", "Lkotlin/Function0;", "handleDescriptionTextScrolling", "inflateLayout", "layoutInflater", "Landroid/view/LayoutInflater;", "initViews", "observeEditText", "observeEvent", "Lkotlinx/coroutines/Job;", "onBackPressed", "onClicks", "onCreate", "savedInstanceState", "Landroid/os/Bundle;", "onDestroy", "onOptionsItemSelected", "item", "Landroid/view/MenuItem;", "onResume", "onStop", "openImageVideoSlider", "startPosition", "refresh", "setTicketMediaAdapter", "setUpToolbar", "setupRv", "submitTicket", "ticketTopic", "ticketDescription", "media", "Companion", "app_bikoRelease"}, k = 1, mv = {1, 8, 0}, xi = 48)
@AndroidEntryPoint
public final class CreateNewTicketActivity extends BaseActivity<ActivityCreateNewTicketBinding> {

    public static final Companion INSTANCE = new Companion(null);
    private static boolean refresh;
    private TicketTopicsAdapter adapter;
    private AlertDialog alertDialog;
    private int descriptionTxtLength;
    private boolean resume;
    private TicketMediaAdapter ticketMediaAdapter;
    private TicketMediaSelectionSheet ticketMediaSheet;
    private Toolbar toolbar;

    private final Lazy viewModel;

    public CreateNewTicketActivity() {
        final ComponentActivity componentActivity = (ComponentActivity) this;
        final Function0 function0 = null;
        this.viewModel = new ViewModelLazy(Reflection.getOrCreateKotlinClass(TicketsViewModel.class), new Function0<ViewModelStore>() {
            {
                super(0);
            }

            public final ViewModelStore m2175invoke() {
                return componentActivity.getViewModelStore();
            }
        }, new Function0<ViewModelProvider.Factory>() {
            {
                super(0);
            }

            public final ViewModelProvider.Factory m2174invoke() {
                return componentActivity.getDefaultViewModelProviderFactory();
            }
        }, new Function0<CreationExtras>() {
            {
                super(0);
            }

            public final CreationExtras m2176invoke() {
                CreationExtras creationExtras;
                Function0 function02 = function0;
                return (function02 == null || (creationExtras = (CreationExtras) function02.invoke()) == null) ? componentActivity.getDefaultViewModelCreationExtras() : creationExtras;
            }
        });
    }

    @Override
    public ActivityCreateNewTicketBinding inflateLayout(LayoutInflater layoutInflater) {
        Intrinsics.checkNotNullParameter(layoutInflater, "layoutInflater");
        ActivityCreateNewTicketBinding inflate = ActivityCreateNewTicketBinding.inflate(layoutInflater);
        Intrinsics.checkNotNullExpressionValue(inflate, "inflate(layoutInflater)");
        return inflate;
    }

    public final TicketsViewModel getViewModel() {
        return (TicketsViewModel) this.viewModel.getValue();
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        getWindow().setStatusBarColor(ContextCompat.getColor((Context) this, 2131100053));
        initViews();
        setUpToolbar();
        onClicks();
        observeEditText();
        observeEvent();
        setupRv();
        setTicketMediaAdapter();
    }

    private final void setupRv() {
        ((ActivityCreateNewTicketBinding) getBinding()).topicsRv.setLayoutManager(new CustomGridLayoutManager((Context) this, 2));
        this.adapter = new TicketTopicsAdapter(null, new TicketTopicsAdapter.ItemClickListener() {
            @Override
            public void onItemClick(String item, int position) {
                TicketsViewModel viewModel;
                TicketTopicsAdapter ticketTopicsAdapter;
                Intrinsics.checkNotNullParameter(item, "item");
                viewModel = CreateNewTicketActivity.this.getViewModel();
                viewModel.setSelectedTopic(item);
                ticketTopicsAdapter = CreateNewTicketActivity.this.adapter;
                if (ticketTopicsAdapter != null) {
                    ticketTopicsAdapter.setSelectedPosition(position);
                }
            }
        }, 1, null);
        ((ActivityCreateNewTicketBinding) getBinding()).topicsRv.setAdapter(this.adapter);
    }

    public final int getDescriptionTxtLength() {
        return this.descriptionTxtLength;
    }

    public final void setDescriptionTxtLength(int i) {
        this.descriptionTxtLength = i;
    }

    private final void observeEditText() {
        getBinding().ticketDes.addTextChangedListener(new TextWatcher() {
            @Override
            public void afterTextChanged(Editable s) {
            }

            @Override
            public void beforeTextChanged(CharSequence s, int start, int count, int after) {
            }

            @Override
            public void onTextChanged(CharSequence s, int start, int before, int count) {
                ActivityCreateNewTicketBinding binding;
                ActivityCreateNewTicketBinding binding2;
                binding = CreateNewTicketActivity.this.getBinding();
                Editable text = binding.ticketDes.getText();
                String valueOf = String.valueOf(text != null ? StringsKt.trim(text) : null);
                String str = valueOf.length() + " / 2000 (Min: 50)";
                CreateNewTicketActivity.this.setDescriptionTxtLength(valueOf.length());
                binding2 = CreateNewTicketActivity.this.getBinding();
                binding2.ticketDesCount.setText(str);
            }
        });
    }

    private final void handleDescriptionTextScrolling() {
        try {
            getBinding().ticketDes.setOnTouchListener(new View.OnTouchListener() {
                @Override
                public final boolean onTouch(View view, MotionEvent motionEvent) {
                    boolean handleDescriptionTextScrolling$lambda$0;
                    handleDescriptionTextScrolling$lambda$0 = CreateNewTicketActivity.handleDescriptionTextScrolling$lambda$0(view, motionEvent);
                    return handleDescriptionTextScrolling$lambda$0;
                }
            });
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    public static final boolean handleDescriptionTextScrolling$lambda$0(View view, MotionEvent motionEvent) {
        if (view.hasFocus()) {
            view.getParent().requestDisallowInterceptTouchEvent(true);
            if ((motionEvent.getAction() & 255) == 1) {
                view.getParent().requestDisallowInterceptTouchEvent(false);
            }
        }
        return false;
    }

    private final void setTicketMediaAdapter() {
        ((ActivityCreateNewTicketBinding) getBinding()).ticketMediaRv.setLayoutManager(new LinearLayoutManager((Context) this, 0, false));
        this.ticketMediaAdapter = new TicketMediaAdapter(null, new TicketMediaAdapter.ItemClickListener() {
            @Override
            public void onItemClick(String mediaItem, int position) {
                Intrinsics.checkNotNullParameter(mediaItem, "mediaItem");
                CreateNewTicketActivity.this.openImageVideoSlider(position);
            }

            @Override
            public void onDeleteClick(String mediaItem, final int position) {
                Intrinsics.checkNotNullParameter(mediaItem, "mediaItem");
                Context context = (Context) CreateNewTicketActivity.this;
                final CreateNewTicketActivity createNewTicketActivity = CreateNewTicketActivity.this;
                DialogHelper.showReasonDialog(context, "", "Are you sure you want to remove this media ?", true, new DialogHelper.Listener() {
                    @Override
                    public void onNegativeClick() {
                    }

                    @Override
                    public void onPositiveClick() {
                        TicketMediaAdapter ticketMediaAdapter;
                        TicketsViewModel viewModel;
                        TicketsViewModel viewModel2;
                        ticketMediaAdapter = CreateNewTicketActivity.this.ticketMediaAdapter;
                        if (ticketMediaAdapter != null) {
                            ticketMediaAdapter.removeItem(position);
                        }
                        viewModel = CreateNewTicketActivity.this.getViewModel();
                        viewModel.getSelectedTicketMediaItems().remove(position);
                        CreateNewTicketActivity createNewTicketActivity2 = CreateNewTicketActivity.this;
                        viewModel2 = createNewTicketActivity2.getViewModel();
                        createNewTicketActivity2.checkForAddButtonVisibility(viewModel2.getSelectedTicketMediaItems().size());
                    }
                });
            }
        }, false, 5, null);
        ((ActivityCreateNewTicketBinding) getBinding()).ticketMediaRv.setAdapter(this.ticketMediaAdapter);
    }

    public final void openImageVideoSlider(int startPosition) {
        try {
            ArrayList<MediaFile> createMediaFilesFromUrls = createMediaFilesFromUrls(getViewModel().getSelectedTicketMediaItems());
            Intent intent = new Intent((Context) this, (Class<?>) MediaSliderActivity.class);
            intent.putExtra("startPosition", startPosition);
            intent.putExtra("mediaUrlList", createMediaFilesFromUrls);
            startActivity(intent);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    private final ArrayList<MediaFile> createMediaFilesFromUrls(ArrayList<String> urls) {
        ArrayList<String> arrayList = urls;
        ArrayList<MediaFile> arrayList2 = new ArrayList<>(CollectionsKt.collectionSizeOrDefault(arrayList, 10));
        for (String str : arrayList) {
            arrayList2.add(new MediaFile(-1L, -1L, str, null, StringsKt.endsWith(str, ".mp4", true) ? Constants.VIDEO : Constants.IMAGE, ""));
        }
        return arrayList2;
    }

    public final void checkForAddButtonVisibility(int mediaSize) {
        Timber.d("Ticket media items size : " + getViewModel().getSelectedTicketMediaItems().size(), new Object[0]);
        View view = getBinding().addMedia;
        Intrinsics.checkNotNullExpressionValue(view, "binding.addMedia");
        view.setVisibility(mediaSize < 5 ? 0 : 8);
    }

    private final Job observeEvent() {
        return BuildersKt.launch$default(LifecycleOwnerKt.getLifecycleScope((LifecycleOwner) this), (CoroutineContext) null, (CoroutineStart) null, new CreateNewTicketActivity$observeEvent$1(this, null), 3, (Object) null);
    }

    private final void onClicks() {
        getBinding().addMedia.setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                CreateNewTicketActivity.onClicks$lambda$2(CreateNewTicketActivity.this, view);
            }
        });
        getBinding().submitTicket.setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                CreateNewTicketActivity.onClicks$lambda$3(CreateNewTicketActivity.this, view);
            }
        });
    }

    public static final void onClicks$lambda$2(final CreateNewTicketActivity createNewTicketActivity, View view) {
        Intrinsics.checkNotNullParameter(createNewTicketActivity, "this$0");
        try {
            TicketMediaSelectionSheet newInstance = TicketMediaSelectionSheet.INSTANCE.newInstance();
            createNewTicketActivity.ticketMediaSheet = newInstance;
            if (newInstance != null) {
                newInstance.setListener(new TicketMediaSelectionSheet.BottomSheetDialogListener() {
                    @Override
                    public void onBottomSheetDismissed(String url) {
                        TicketsViewModel viewModel;
                        TicketMediaAdapter ticketMediaAdapter;
                        TicketsViewModel viewModel2;
                        TicketsViewModel viewModel3;
                        Intrinsics.checkNotNullParameter(url, "url");
                        viewModel = CreateNewTicketActivity.this.getViewModel();
                        if (viewModel.getSelectedTicketMediaItems().size() <= 5) {
                            ticketMediaAdapter = CreateNewTicketActivity.this.ticketMediaAdapter;
                            if (ticketMediaAdapter != null) {
                                ticketMediaAdapter.addItem(url);
                            }
                            viewModel2 = CreateNewTicketActivity.this.getViewModel();
                            viewModel2.getSelectedTicketMediaItems().add(url);
                            CreateNewTicketActivity createNewTicketActivity2 = CreateNewTicketActivity.this;
                            viewModel3 = createNewTicketActivity2.getViewModel();
                            createNewTicketActivity2.checkForAddButtonVisibility(viewModel3.getSelectedTicketMediaItems().size());
                        }
                    }
                });
            }
            TicketMediaSelectionSheet ticketMediaSelectionSheet = createNewTicketActivity.ticketMediaSheet;
            if (ticketMediaSelectionSheet != null) {
                ticketMediaSelectionSheet.show(createNewTicketActivity.getSupportFragmentManager(), "BottomSheet");
            }
        } catch (Exception e) {
            Timber.e(e);
        }
    }

    public static final void onClicks$lambda$3(CreateNewTicketActivity createNewTicketActivity, View view) {
        Intrinsics.checkNotNullParameter(createNewTicketActivity, "this$0");
        if (createNewTicketActivity.getViewModel().getSelectedTopic().length() == 0) {
            ActivityExtKt.toast((Activity) createNewTicketActivity, "Please select a topic.");
            return;
        }
        if (createNewTicketActivity.descriptionTxtLength < 50) {
            ActivityExtKt.toast((Activity) createNewTicketActivity, "Description must be of 50 characters.");
        } else if (createNewTicketActivity.getViewModel().getSelectedTicketMediaItems().size() < 1) {
            ActivityExtKt.toast((Activity) createNewTicketActivity, "Atleast one attachment is required.");
        } else {
            createNewTicketActivity.submitTicket(createNewTicketActivity.getViewModel().getSelectedTopic(), String.valueOf(((ActivityCreateNewTicketBinding) createNewTicketActivity.getBinding()).ticketDes.getText()), createNewTicketActivity.getViewModel().getSelectedTicketMediaItems());
        }
    }

    private final void submitTicket(String ticketTopic, String ticketDescription, ArrayList<String> media) {
        String joinToString$default = CollectionsKt.joinToString$default(media, ",", (CharSequence) null, (CharSequence) null, 0, (CharSequence) null, (Function1) null, 62, (Object) null);
        Timber.d("Final Ticket Media: " + joinToString$default, new Object[0]);
        getViewModel().raiseTicket(new TicketsModel(ticketTopic, joinToString$default, ticketDescription));
    }

    private final void refresh() {
        getViewModel().getTopicList().clear();
        TicketTopicsAdapter ticketTopicsAdapter = this.adapter;
        if (ticketTopicsAdapter != null) {
            ticketTopicsAdapter.clear();
        }
        getViewModel().getTicketsTopicList();
    }

    private final void setUpToolbar() {
        try {
            Toolbar toolbar = this.toolbar;
            if (toolbar == null) {
                Intrinsics.throwUninitializedPropertyAccessException("toolbar");
                toolbar = null;
            }
            setSupportActionBar(toolbar);
            ActionBar supportActionBar = getSupportActionBar();
            if (supportActionBar != null) {
                supportActionBar.setDisplayHomeAsUpEnabled(true);
            }
        } catch (Exception e) {
            Timber.e(e, "setUpToolbar: Error ", new Object[0]);
        }
    }

    private final void initViews() {
        Toolbar toolbar = getBinding().toolbar;
        Intrinsics.checkNotNullExpressionValue(toolbar, "binding.toolbar");
        this.toolbar = toolbar;
        handleDescriptionTextScrolling();
    }

    protected void onResume() {
        super.onResume();
        if (!this.resume || refresh) {
            refresh();
            refresh = false;
        }
        this.resume = true;
    }

    protected void onStop() {
        super.onStop();
    }

    public boolean onOptionsItemSelected(MenuItem item) {
        Intrinsics.checkNotNullParameter(item, "item");
        if (item.getItemId() != 16908332) {
            return true;
        }
        finish();
        return true;
    }

    protected void onDestroy() {
        super.onDestroy();
        refresh = false;
        TicketMediaSelectionSheet ticketMediaSelectionSheet = this.ticketMediaSheet;
        if (ticketMediaSelectionSheet != null) {
            ticketMediaSelectionSheet.dismiss();
        }
        AlertDialog alertDialog = this.alertDialog;
        if (alertDialog != null) {
            alertDialog.dismiss();
        }
    }

    @Deprecated(message = "Deprecated in Java")
    public void onBackPressed() {
        Editable text = getBinding().ticketDes.getText();
        if (!(text == null || text.length() == 0) || (!getViewModel().getSelectedTicketMediaItems().isEmpty())) {
            finishThisActivity(new Function0<Unit>() {
                {
                    super(0);
                }

                public Object invoke() {
                    m2177invoke();
                    return Unit.INSTANCE;
                }

                public final void m2177invoke() {
                    super/*app.callpe.ui.user.Hilt_CreateNewTicketActivity*/.onBackPressed();
                    CreateNewTicketActivity.this.finish();
                }
            });
        } else {
            finish();
        }
    }

    private final void finishThisActivity(final Function0<Unit> onBackPress) {
        try {
            MaterialAlertDialogBuilder materialAlertDialogBuilder = new MaterialAlertDialogBuilder((Context) this);
            materialAlertDialogBuilder.setMessage("Are you sure you want to cancel reporting this problem?").setPositiveButton(getString(2131953093), new DialogInterface.OnClickListener() {
                @Override
                public final void onClick(DialogInterface dialogInterface, int i) {
                    CreateNewTicketActivity.finishThisActivity$lambda$4(onBackPress, dialogInterface, i);
                }
            }).setNegativeButton(getString(2131952360), new DialogInterface.OnClickListener() {
                @Override
                public final void onClick(DialogInterface dialogInterface, int i) {
                    CreateNewTicketActivity.finishThisActivity$lambda$5(dialogInterface, i);
                }
            }).create();
            this.alertDialog = materialAlertDialogBuilder.show();
        } catch (Exception e) {
            Timber.e(e);
            onBackPress.invoke();
        }
    }

    public static final void finishThisActivity$lambda$4(Function0 function0, DialogInterface dialogInterface, int i) {
        Intrinsics.checkNotNullParameter(function0, "$onBackPress");
        if (dialogInterface != null) {
            dialogInterface.dismiss();
        }
        function0.invoke();
    }

    public static final void finishThisActivity$lambda$5(DialogInterface dialogInterface, int i) {
        Intrinsics.checkNotNullParameter(dialogInterface, "dialogInterface");
        dialogInterface.dismiss();
    }

    @Metadata(d1 = {"\u0000\u0014\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\b\u0002\n\u0002\u0010\u000b\n\u0002\b\u0005\b\u0086\u0003\u0018\u00002\u00020\u0001B\u0007\b\u0002¢\u0006\u0002\u0010\u0002R\u001a\u0010\u0003\u001a\u00020\u0004X\u0086\u000e¢\u0006\u000e\n\u0000\u001a\u0004\b\u0005\u0010\u0006\"\u0004\b\u0007\u0010\b¨\u0006\t"}, d2 = {"Lapp/callpe/ui/user/CreateNewTicketActivity$Companion;", "", "()V", "refresh", "", "getRefresh", "()Z", "setRefresh", "(Z)V", "app_bikoRelease"}, k = 1, mv = {1, 8, 0}, xi = 48)
    public static final class Companion {
        public Companion(DefaultConstructorMarker defaultConstructorMarker) {
            this();
        }

        private Companion() {
        }

        public final boolean getRefresh() {
            return CreateNewTicketActivity.refresh;
        }

        public final void setRefresh(boolean z) {
            CreateNewTicketActivity.refresh = z;
        }
    }
}