导航菜单

页面标题

页面副标题

Biko v2.0.23 - NonLiveStreamerDetailActivity.java 源代码

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

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


package app.callpe.ui.home;

import android.animation.Animator;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.graphics.Typeface;
import android.media.MediaPlayer;
import android.net.Uri;
import android.os.Bundle;
import android.util.TypedValue;
import android.view.LayoutInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;
import androidx.activity.ComponentActivity;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.AppCompatImageView;
import androidx.core.content.ContextCompat;
import androidx.fragment.app.FragmentActivity;
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.media3.common.MediaItem;
import androidx.media3.common.Player;
import androidx.media3.exoplayer.ExoPlayer;
import androidx.media3.exoplayer.source.MediaSource;
import androidx.media3.exoplayer.source.ProgressiveMediaSource;
import androidx.media3.ui.PlayerView;
import app.callpe.App;
import app.callpe.adapters.ProfileViewAdapter;
import app.callpe.common.utils.Constants;
import app.callpe.common.utils.custom.CustomLinearLayoutManager;
import app.callpe.common.utils.extensions.ActivityExtKt;
import app.callpe.common.utils.extensions.NumberExtKt;
import app.callpe.common.utils.extensions.ViewExtKt;
import app.callpe.common.utils.helper_functions.CacheDataSourceFactorySingleton;
import app.callpe.common.utils.sharedpref.PrefKeys;
import app.callpe.common.utils.sharedpref.SharedPref;
import app.callpe.data.model.Balance;
import app.callpe.data.model.LevelDetails;
import app.callpe.data.model.ReviewDetails;
import app.callpe.data.model.StarCount;
import app.callpe.data.model.StreamerModel;
import app.callpe.databinding.ActivityNonLiveStreamerDetailBinding;
import app.callpe.ui.bottomsheet.StreamerDetailBottomSheet;
import app.callpe.ui.call.CallActivity;
import app.callpe.ui.chat.ChatActivity;
import app.callpe.ui.dialog.RechargeDialog;
import app.callpe.ui.login.LoginActivity;
import app.callpe.ui.misc.ImageShowActivity;
import app.callpe.ui.user.UserViewModel;
import com.asynctaskcoffee.audiorecorder.R;
import com.bumptech.glide.Glide;
import com.google.android.material.chip.Chip;
import com.google.gson.Gson;
import dagger.hilt.android.AndroidEntryPoint;
import dagger.hilt.internal.GeneratedComponentManagerHolder;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
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 kotlinx.coroutines.BuildersKt;
import kotlinx.coroutines.CoroutineStart;
import kotlinx.coroutines.Job;
import timber.log.Timber;
import uk.bandev.xplosion.XplosionView;

@Metadata(d1 = {"\u0000\u008c\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\u000b\n\u0002\b\u0007\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010!\n\u0002\u0010\u000e\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\u0005\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\u0007\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0004\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0005\b\u0007\u0018\u0000 D2\b\u0012\u0004\u0012\u00020\u00020\u0001:\u0001DB\u0005¢\u0006\u0002\u0010\u0003J\b\u0010\u001d\u001a\u00020\u001eH\u0002J\b\u0010\u001f\u001a\u00020 H\u0002J\u0010\u0010!\u001a\u00020\u00022\u0006\u0010\"\u001a\u00020#H\u0016J\b\u0010$\u001a\u00020%H\u0002J\b\u0010&\u001a\u00020 H\u0002J\u0012\u0010'\u001a\u00020 2\b\u0010(\u001a\u0004\u0018\u00010)H\u0014J\b\u0010*\u001a\u00020 H\u0014J\u0010\u0010+\u001a\u00020\t2\u0006\u0010,\u001a\u00020-H\u0016J\b\u0010.\u001a\u00020 H\u0014J\b\u0010/\u001a\u00020 H\u0002J\b\u00100\u001a\u00020 H\u0002J\b\u00101\u001a\u00020 H\u0002J\b\u00102\u001a\u00020 H\u0002J\u0012\u00103\u001a\u00020 2\b\u00104\u001a\u0004\u0018\u000105H\u0002J \u00106\u001a\u00020 2\u0016\u00107\u001a\u0012\u0012\u0004\u0012\u00020\u001408j\b\u0012\u0004\u0012\u00020\u0014`9H\u0002J \u0010:\u001a\u00020 2\u0016\u0010;\u001a\u0012\u0012\u0004\u0012\u00020\u001408j\b\u0012\u0004\u0012\u00020\u0014`9H\u0002J\u0018\u0010<\u001a\u00020 2\u0006\u0010=\u001a\u00020>2\u0006\u0010?\u001a\u00020@H\u0002J\u0010\u0010A\u001a\u00020 2\u0006\u0010B\u001a\u00020\u0014H\u0007J\b\u0010C\u001a\u00020 H\u0002R\u0010\u0010\u0004\u001a\u0004\u0018\u00010\u0005X\u0082\u000e¢\u0006\u0002\n\u0000R\u000e\u0010\u0006\u001a\u00020\u0007X\u0082.¢\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\u001a\u0010\u000e\u001a\u00020\tX\u0086\u000e¢\u0006\u000e\n\u0000\u001a\u0004\b\u000e\u0010\u000b\"\u0004\b\u000f\u0010\rR\u0010\u0010\u0010\u001a\u0004\u0018\u00010\u0011X\u0082\u000e¢\u0006\u0002\n\u0000R\u0019\u0010\u0012\u001a\n\u0012\u0006\u0012\u0004\u0018\u00010\u00140\u0013¢\u0006\b\n\u0000\u001a\u0004\b\u0015\u0010\u0016R\u001b\u0010\u0017\u001a\u00020\u00188BX\u0082\u0084\u0002¢\u0006\f\n\u0004\b\u001b\u0010\u001c\u001a\u0004\b\u0019\u0010\u001a¨\u0006E"}, d2 = {"Lapp/callpe/ui/home/NonLiveStreamerDetailActivity;", "Lapp/callpe/ui/home/BaseActivity;", "Lapp/callpe/databinding/ActivityNonLiveStreamerDetailBinding;", "()V", "adapter", "Lapp/callpe/adapters/ProfileViewAdapter;", "exoPlayer", "Landroidx/media3/exoplayer/ExoPlayer;", "firstRechargeDone", "", "getFirstRechargeDone", "()Z", "setFirstRechargeDone", "(Z)V", "isVip", "setVip", "mediaSource", "Landroidx/media3/exoplayer/source/MediaSource;", "selectedPictures", "", "", "getSelectedPictures", "()Ljava/util/List;", "viewModel", "Lapp/callpe/ui/user/UserViewModel;", "getViewModel", "()Lapp/callpe/ui/user/UserViewModel;", "viewModel$delegate", "Lkotlin/Lazy;", "getContext", "Landroid/content/Context;", "getStreamer", "", "inflateLayout", "layoutInflater", "Landroid/view/LayoutInflater;", "observeEvent", "Lkotlinx/coroutines/Job;", "onClicks", "onCreate", "savedInstanceState", "Landroid/os/Bundle;", "onDestroy", "onOptionsItemSelected", "item", "Landroid/view/MenuItem;", "onResume", "playMessageSentSound", "refresh", "setAdapter", "setCallBtnBehaviour", "setRatings", "review", "Lapp/callpe/data/model/ReviewDetails;", "setStreamerInterestTag", "interests", "Ljava/util/ArrayList;", "Lkotlin/collections/ArrayList;", "setStreamerLanguage", "languages", "setUpValues", "streamer", "Lapp/callpe/data/model/StreamerModel;", "userBalance", "Lapp/callpe/data/model/Balance;", "setVideoPath", "url", "swipeRefresh", "Companion", "app_bikoRelease"}, k = 1, mv = {1, 8, 0}, xi = 48)
@AndroidEntryPoint
public final class NonLiveStreamerDetailActivity extends BaseActivity<ActivityNonLiveStreamerDetailBinding> {

    public static final Companion INSTANCE = new Companion(null);
    private static boolean refresh;
    private ProfileViewAdapter adapter;
    private ExoPlayer exoPlayer;
    private boolean firstRechargeDone;
    private boolean isVip;
    private MediaSource mediaSource;
    private final List<String> selectedPictures = new ArrayList();

    private final Lazy viewModel;

    public static final void setUpValues$lambda$8(View view) {
    }

    private final void swipeRefresh() {
    }

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

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

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

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

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

    public final List<String> getSelectedPictures() {
        return this.selectedPictures;
    }

    public final boolean getFirstRechargeDone() {
        return this.firstRechargeDone;
    }

    public final void setFirstRechargeDone(boolean z) {
        this.firstRechargeDone = z;
    }

    public final boolean getIsVip() {
        return this.isVip;
    }

    public final void setVip(boolean z) {
        this.isVip = z;
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setWindowFlag((Activity) this, 67108864, false);
        getWindow().setStatusBarColor(ContextCompat.getColor((Context) this, 2131100053));
        swipeRefresh();
        getStreamer();
        setAdapter();
        observeEvent();
        onClicks();
    }

    private final void getStreamer() {
        Context context = (Context) this;
        this.firstRechargeDone = SharedPref.getBoolean(context, PrefKeys.FIRST_RECHARGE_DONE);
        this.isVip = SharedPref.getBoolean(context, PrefKeys.IS_VIP);
        long longExtra = getIntent().getLongExtra("id", -1L);
        if (longExtra != -1) {
            getViewModel().getStreamerDetails(longExtra);
            getViewModel().setStreamerId(longExtra);
        } else {
            String stringExtra = getIntent().getStringExtra("streamer");
            if (stringExtra != null) {
                StreamerModel streamerModel = (StreamerModel) new Gson().fromJson(stringExtra, StreamerModel.class);
                getViewModel().setStreamerModel(streamerModel);
                getViewModel().setStreamerId(streamerModel.getId());
                getViewModel().getStreamerDetails(streamerModel.getId());
            }
        }
        if (LoginActivity.INSTANCE.isVitok()) {
            RelativeLayout relativeLayout = ((ActivityNonLiveStreamerDetailBinding) getBinding()).relativeLayout;
            Intrinsics.checkNotNullExpressionValue(relativeLayout, "binding.relativeLayout");
            relativeLayout.setVisibility(8);
            ImageView imageView = ((ActivityNonLiveStreamerDetailBinding) getBinding()).more;
            Intrinsics.checkNotNullExpressionValue(imageView, "binding.more");
            ViewExtKt.showOrInvisible(imageView, false);
            View view = ((ActivityNonLiveStreamerDetailBinding) getBinding()).heartBang;
            Intrinsics.checkNotNullExpressionValue(view, "binding.heartBang");
            view.setVisibility(8);
        }
    }

    public final void refresh() {
        if (getViewModel().getStreamerId() != -1) {
            getViewModel().getStreamerDetails(getViewModel().getStreamerId());
        }
    }

    private final void onClicks() {
        getBinding().back.setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                NonLiveStreamerDetailActivity.onClicks$lambda$1(NonLiveStreamerDetailActivity.this, view);
            }
        });
        getBinding().followBtn.setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                NonLiveStreamerDetailActivity.onClicks$lambda$2(NonLiveStreamerDetailActivity.this, view);
            }
        });
        getBinding().more.setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                NonLiveStreamerDetailActivity.onClicks$lambda$3(NonLiveStreamerDetailActivity.this, view);
            }
        });
    }

    public static final void onClicks$lambda$1(NonLiveStreamerDetailActivity nonLiveStreamerDetailActivity, View view) {
        Intrinsics.checkNotNullParameter(nonLiveStreamerDetailActivity, "this$0");
        nonLiveStreamerDetailActivity.finish();
    }

    public static final void onClicks$lambda$2(NonLiveStreamerDetailActivity nonLiveStreamerDetailActivity, View view) {
        Intrinsics.checkNotNullParameter(nonLiveStreamerDetailActivity, "this$0");
        XplosionView xplosionView = nonLiveStreamerDetailActivity.getBinding().heartBang;
        Intrinsics.checkNotNullExpressionValue(xplosionView, "binding.heartBang");
        XplosionView.likeAnimation$default(xplosionView, (Animator.AnimatorListener) null, 1, (Object) null);
        nonLiveStreamerDetailActivity.getBinding().followBtn.setSelected(!nonLiveStreamerDetailActivity.getBinding().followBtn.isSelected());
        nonLiveStreamerDetailActivity.getViewModel().followStreamer(nonLiveStreamerDetailActivity.getBinding().followBtn.isSelected(), nonLiveStreamerDetailActivity.getViewModel().getStreamerId());
    }

    public static final void onClicks$lambda$3(NonLiveStreamerDetailActivity nonLiveStreamerDetailActivity, View view) {
        Intrinsics.checkNotNullParameter(nonLiveStreamerDetailActivity, "this$0");
        StreamerDetailBottomSheet streamerDetailBottomSheet = new StreamerDetailBottomSheet(nonLiveStreamerDetailActivity.getViewModel().getStreamerModel(), null, null, null, 14, null);
        if (streamerDetailBottomSheet.isAdded() || streamerDetailBottomSheet.isVisible()) {
            return;
        }
        streamerDetailBottomSheet.show(nonLiveStreamerDetailActivity.getSupportFragmentManager(), "StreamerDetailBottomSheet");
    }

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

    private final void setAdapter() {
        Context context = (Context) this;
        ((ActivityNonLiveStreamerDetailBinding) getBinding()).rv.setLayoutManager(new CustomLinearLayoutManager(context, 0, false));
        this.adapter = new ProfileViewAdapter(context, new ArrayList(), new ProfileViewAdapter.onItemClickListener() {
            @Override
            public void onDeleteClick(String picturePath) {
                Intrinsics.checkNotNullParameter(picturePath, "picturePath");
            }

            @Override
            public void onItemClick(String picturePath, int position) {
                Intrinsics.checkNotNullParameter(picturePath, "picturePath");
                String joinToString$default = CollectionsKt.joinToString$default(NonLiveStreamerDetailActivity.this.getSelectedPictures(), ",", (CharSequence) null, (CharSequence) null, 0, (CharSequence) null, (Function1) null, 62, (Object) null);
                GeneratedComponentManagerHolder generatedComponentManagerHolder = this;
                Intrinsics.checkNotNull(generatedComponentManagerHolder, "null cannot be cast to non-null type androidx.appcompat.app.AppCompatActivity");
                Intent intent = new Intent((Context) ((AppCompatActivity) generatedComponentManagerHolder), (Class<?>) ImageShowActivity.class);
                NonLiveStreamerDetailActivity nonLiveStreamerDetailActivity = this;
                intent.putExtra("pics", joinToString$default);
                intent.putExtra("position", position);
                nonLiveStreamerDetailActivity.startActivity(intent);
            }
        });
        ((ActivityNonLiveStreamerDetailBinding) getBinding()).rv.setAdapter(this.adapter);
    }

    public final void setUpValues(final StreamerModel streamer, final Balance userBalance) {
        Integer age;
        String valueOf = String.valueOf(streamer.getName());
        String valueOf2 = String.valueOf(streamer.getAge());
        streamer.getGender();
        String aboutMe = streamer.getAboutMe();
        if (aboutMe == null) {
            aboutMe = "";
        }
        NumberExtKt.formatByNumberRupee$default(streamer.getDisplayRate(), false, 1, (Object) null);
        getString(2131951652);
        String city = streamer.getCity();
        String str = city != null ? city : "";
        ((ActivityNonLiveStreamerDetailBinding) getBinding()).location.setText(str);
        if (str.length() == 0) {
            ((ActivityNonLiveStreamerDetailBinding) getBinding()).locPic.setVisibility(8);
        }
        if (streamer.getBusy()) {
            ((ActivityNonLiveStreamerDetailBinding) getBinding()).onlineStatus.setText(getString(2131951753));
            Context context = (Context) this;
            ((ActivityNonLiveStreamerDetailBinding) getBinding()).streamerStatusIcon.setColorFilter(ContextCompat.getColor(context, 2131100962));
            ((ActivityNonLiveStreamerDetailBinding) getBinding()).onlineStatus.setTextColor(ContextCompat.getColor(context, 2131100962));
            setCallBtnBehaviour();
        } else if (streamer.getOnline()) {
            ((ActivityNonLiveStreamerDetailBinding) getBinding()).onlineStatus.setText(getString(2131952384));
            Context context2 = (Context) this;
            ((ActivityNonLiveStreamerDetailBinding) getBinding()).streamerStatusIcon.setColorFilter(ContextCompat.getColor(context2, 2131100034));
            ((ActivityNonLiveStreamerDetailBinding) getBinding()).onlineStatus.setTextColor(ContextCompat.getColor(context2, 2131100034));
        } else {
            if (!BaseActivity.INSTANCE.isAdmin()) {
                setCallBtnBehaviour();
            }
            ((ActivityNonLiveStreamerDetailBinding) getBinding()).onlineStatus.setText(getString(2131952376));
            Context context3 = (Context) this;
            ((ActivityNonLiveStreamerDetailBinding) getBinding()).streamerStatusIcon.setColorFilter(ContextCompat.getColor(context3, 2131101146));
            ((ActivityNonLiveStreamerDetailBinding) getBinding()).onlineStatus.setTextColor(ContextCompat.getColor(context3, 2131101146));
        }
        FragmentActivity fragmentActivity = (FragmentActivity) this;
        Glide.with(fragmentActivity).load(StreamerModel.getProfile$default(streamer, false, 1, null)).into(((ActivityNonLiveStreamerDetailBinding) getBinding()).profileImage);
        Glide.with(fragmentActivity).load(StreamerModel.getProfile$default(streamer, false, 1, null)).into(((ActivityNonLiveStreamerDetailBinding) getBinding()).profileImageSmall);
        ((ActivityNonLiveStreamerDetailBinding) getBinding()).followBtn.setSelected(streamer.getCurrentUserFollowingThisUser());
        if (streamer.getCurrentUserFollowingThisUser()) {
            ((ActivityNonLiveStreamerDetailBinding) getBinding()).followBtn.setSelected(true);
        } else {
            ((ActivityNonLiveStreamerDetailBinding) getBinding()).followBtn.setSelected(false);
        }
        if ((!streamer.getPictures().isEmpty()) && streamer.getPictures().size() > 1) {
            List<String> pictures = streamer.getPictures();
            pictures.remove(0);
            this.selectedPictures.addAll(pictures);
            ProfileViewAdapter profileViewAdapter = this.adapter;
            if (profileViewAdapter != null) {
                Intrinsics.checkNotNull(pictures, "null cannot be cast to non-null type java.util.ArrayList<kotlin.String>{ kotlin.collections.TypeAliasesKt.ArrayList<kotlin.String> }");
                profileViewAdapter.addItems((ArrayList) pictures);
            }
        }
        ((ActivityNonLiveStreamerDetailBinding) getBinding()).followCount.setText(String.valueOf(streamer.getFollowerCount()));
        ((ActivityNonLiveStreamerDetailBinding) getBinding()).videoCallCount.setText(streamer.getVideoCallCount() + " video calls");
        ((ActivityNonLiveStreamerDetailBinding) getBinding()).videoCallBtn.setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                NonLiveStreamerDetailActivity.setUpValues$lambda$5(StreamerModel.this, this, userBalance, view);
            }
        });
        if (streamer.getAge() == null || ((age = streamer.getAge()) != null && age.intValue() == 0)) {
            TextView textView = ((ActivityNonLiveStreamerDetailBinding) getBinding()).streamerAge;
            Intrinsics.checkNotNullExpressionValue(textView, "binding.streamerAge");
            textView.setVisibility(8);
        } else {
            ((ActivityNonLiveStreamerDetailBinding) getBinding()).streamerAge.setText(valueOf2);
            TextView textView2 = ((ActivityNonLiveStreamerDetailBinding) getBinding()).streamerAge;
            Intrinsics.checkNotNullExpressionValue(textView2, "binding.streamerAge");
            textView2.setVisibility(0);
        }
        ((ActivityNonLiveStreamerDetailBinding) getBinding()).streamerName.setText(valueOf);
        ((ActivityNonLiveStreamerDetailBinding) getBinding()).bioText.setText(aboutMe);
        LevelDetails levelDetails = streamer.getLevelDetails();
        if (levelDetails != null) {
            levelDetails.getName();
        }
        ReviewDetails reviewDetails = streamer.getReviewDetails();
        if (reviewDetails != null) {
            double rating = reviewDetails.getRating();
            if (rating == -1.0d) {
                ((ActivityNonLiveStreamerDetailBinding) getBinding()).ratingCountOverall.setText("0.0");
                ((ActivityNonLiveStreamerDetailBinding) getBinding()).ratingBar.setRating(0.0f);
            } else {
                ((ActivityNonLiveStreamerDetailBinding) getBinding()).ratingCountOverall.setText(NumberExtKt.formatByNumber2Decimal(rating));
                ((ActivityNonLiveStreamerDetailBinding) getBinding()).ratingBar.setRating((float) rating);
            }
        }
        ArrayList<String> languages = streamer.getLanguages();
        if (languages == null) {
            languages = new ArrayList<>();
        }
        setStreamerLanguage(languages);
        ArrayList<String> interests = streamer.getInterests();
        if (interests != null) {
            setStreamerInterestTag(interests);
        }
        ((ActivityNonLiveStreamerDetailBinding) getBinding()).introVideo.setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                NonLiveStreamerDetailActivity.setUpValues$lambda$8(view);
            }
        });
        ((ActivityNonLiveStreamerDetailBinding) getBinding()).profileImage.setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                NonLiveStreamerDetailActivity.setUpValues$lambda$10(NonLiveStreamerDetailActivity.this, streamer, view);
            }
        });
        if (streamer.getChatId() == null) {
            ((ActivityNonLiveStreamerDetailBinding) getBinding()).messageBtnTv.setText(getString(2131952552));
        } else {
            ((ActivityNonLiveStreamerDetailBinding) getBinding()).messageBtnTv.setText(getString(2131952252));
            LinearLayout linearLayout = ((ActivityNonLiveStreamerDetailBinding) getBinding()).messageTvParent;
            Intrinsics.checkNotNullExpressionValue(linearLayout, "binding.messageTvParent");
            linearLayout.setVisibility(0);
            FrameLayout frameLayout = ((ActivityNonLiveStreamerDetailBinding) getBinding()).hiAnimParent;
            Intrinsics.checkNotNullExpressionValue(frameLayout, "binding.hiAnimParent");
            frameLayout.setVisibility(8);
        }
        ((ActivityNonLiveStreamerDetailBinding) getBinding()).messageBtn.setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                NonLiveStreamerDetailActivity.setUpValues$lambda$14(StreamerModel.this, this, view);
            }
        });
        View view = ((ActivityNonLiveStreamerDetailBinding) getBinding()).videoCallBtn;
        Intrinsics.checkNotNullExpressionValue(view, "binding.videoCallBtn");
        view.setVisibility(0);
        View view2 = ((ActivityNonLiveStreamerDetailBinding) getBinding()).fakeVideoCallBtn;
        Intrinsics.checkNotNullExpressionValue(view2, "binding.fakeVideoCallBtn");
        view2.setVisibility(8);
        View view3 = ((ActivityNonLiveStreamerDetailBinding) getBinding()).userLevelCV;
        Intrinsics.checkNotNullExpressionValue(view3, "binding.userLevelCV");
        view3.setVisibility(streamer.getFake() ^ true ? 0 : 8);
    }

    public static final void setUpValues$lambda$5(StreamerModel streamerModel, NonLiveStreamerDetailActivity nonLiveStreamerDetailActivity, Balance balance, View view) {
        double displayRate;
        Intrinsics.checkNotNullParameter(streamerModel, "$streamer");
        Intrinsics.checkNotNullParameter(nonLiveStreamerDetailActivity, "this$0");
        Intrinsics.checkNotNullParameter(balance, "$userBalance");
        if (streamerModel.getBusy() || !streamerModel.getOnline()) {
            return;
        }
        if (nonLiveStreamerDetailActivity.isVip) {
            displayRate = streamerModel.getVipCallRate();
        } else {
            displayRate = streamerModel.getDisplayRate();
        }
        if (balance.getBalance() >= displayRate) {
            StreamerModel streamerModel2 = nonLiveStreamerDetailActivity.getViewModel().getStreamerModel();
            if (streamerModel2 != null) {
                CallActivity.INSTANCE.userCall((FragmentActivity) nonLiveStreamerDetailActivity, streamerModel2, (r17 & 4) != 0 ? Constants.ROLE.USER : null, (r17 & 8) != 0 ? false : nonLiveStreamerDetailActivity.isVip, (r17 & 16) != 0 ? null : null, (r17 & 32) != 0 ? Constants.VIDEO_CALL : null, (r17 & 64) != 0 ? null : null);
                return;
            }
            return;
        }
        try {
            RechargeDialog rechargeDialog = new RechargeDialog(null, balance, StreamerModel.getProfile$default(streamerModel, false, 1, null), null, Double.valueOf(displayRate), new Function0<Unit>() {
                public final void m1414invoke() {
                }

                public Object invoke() {
                    m1414invoke();
                    return Unit.INSTANCE;
                }
            }, new Function0<Unit>() {
                public final void m1415invoke() {
                }

                public Object invoke() {
                    m1415invoke();
                    return Unit.INSTANCE;
                }
            }, 8, null);
            rechargeDialog.setCancelable(true);
            if (!rechargeDialog.isAdded() && !rechargeDialog.isVisible()) {
                rechargeDialog.show(nonLiveStreamerDetailActivity.getSupportFragmentManager(), "RechargeDialog");
            }
        } catch (Exception unused) {
            String string = nonLiveStreamerDetailActivity.getString(2131951993);
            Intrinsics.checkNotNullExpressionValue(string, "getString(R.string.error_unknown)");
            ActivityExtKt.toast((Activity) nonLiveStreamerDetailActivity, string);
        }
    }

    public static final void setUpValues$lambda$10(NonLiveStreamerDetailActivity nonLiveStreamerDetailActivity, StreamerModel streamerModel, View view) {
        Intrinsics.checkNotNullParameter(nonLiveStreamerDetailActivity, "this$0");
        Intrinsics.checkNotNullParameter(streamerModel, "$streamer");
        Intent intent = new Intent((Context) nonLiveStreamerDetailActivity, (Class<?>) ImageShowActivity.class);
        intent.putExtra("pics", streamerModel.getProfilePic());
        nonLiveStreamerDetailActivity.startActivity(intent);
    }

    public static final void setUpValues$lambda$14(StreamerModel streamerModel, NonLiveStreamerDetailActivity nonLiveStreamerDetailActivity, View view) {
        Intrinsics.checkNotNullParameter(streamerModel, "$streamer");
        Intrinsics.checkNotNullParameter(nonLiveStreamerDetailActivity, "this$0");
        Long chatId = streamerModel.getChatId();
        if (chatId != null) {
            long longValue = chatId.longValue();
            App.Companion companion = App.Companion;
            App.chatId = longValue;
            App.Companion companion2 = App.Companion;
            App.profile = StreamerModel.getProfile$default(streamerModel, false, 1, null);
            App.Companion companion3 = App.Companion;
            String name = streamerModel.getName();
            if (name == null) {
                name = "";
            }
            App.chatTitle = name;
            Intent intent = new Intent((Context) nonLiveStreamerDetailActivity, (Class<?>) ChatActivity.class);
            intent.setFlags(603979776);
            nonLiveStreamerDetailActivity.startActivity(intent);
            return;
        }
        ((ActivityNonLiveStreamerDetailBinding) nonLiveStreamerDetailActivity.getBinding()).messageBtn.setEnabled(false);
        FrameLayout frameLayout = ((ActivityNonLiveStreamerDetailBinding) nonLiveStreamerDetailActivity.getBinding()).hiAnimParent;
        Intrinsics.checkNotNullExpressionValue(frameLayout, "binding.hiAnimParent");
        frameLayout.setVisibility(0);
        ((ActivityNonLiveStreamerDetailBinding) nonLiveStreamerDetailActivity.getBinding()).messageBtnTv.setText(nonLiveStreamerDetailActivity.getString(2131952252));
        nonLiveStreamerDetailActivity.getViewModel().sendHiMessage(streamerModel.getId());
    }

    private final void setRatings(ReviewDetails review) {
        if (review != null) {
            Iterator<StarCount> it = review.getRatingCounts().iterator();
            int i = 0;
            while (it.hasNext()) {
                Integer count = it.next().getCount();
                i += count != null ? count.intValue() : 0;
            }
            for (StarCount starCount : review.getRatingCounts()) {
                Integer star = starCount.getStar();
                if (star != null) {
                    int intValue = star.intValue();
                    Integer count2 = starCount.getCount();
                    if (count2 != null) {
                        int intValue2 = (count2.intValue() * 100) / i;
                        if (intValue == 1) {
                            getBinding().pb1.setProgress(intValue2);
                        } else if (intValue == 2) {
                            getBinding().pb2.setProgress(intValue2);
                        } else if (intValue == 3) {
                            getBinding().pb3.setProgress(intValue2);
                        } else if (intValue == 4) {
                            getBinding().pb4.setProgress(intValue2);
                        } else if (intValue == 5) {
                            getBinding().pb5.setProgress(intValue2);
                        }
                    }
                }
            }
        }
    }

    private final void setCallBtnBehaviour() {
        ((ActivityNonLiveStreamerDetailBinding) getBinding()).videoCallBtn.setClickable(false);
        ((ActivityNonLiveStreamerDetailBinding) getBinding()).videoCallBtn.setBackgroundTintList(ContextCompat.getColorStateList((Context) this, 2131099895));
        AppCompatImageView appCompatImageView = ((ActivityNonLiveStreamerDetailBinding) getBinding()).callButton;
        Intrinsics.checkNotNullExpressionValue(appCompatImageView, "binding.callButton");
        ViewExtKt.showOrInvisible((View) appCompatImageView, false);
        ((ActivityNonLiveStreamerDetailBinding) getBinding()).tv11.setTextColor(getColor(R.color.black_50));
    }

    public final void setVideoPath(String url) {
        Intrinsics.checkNotNullParameter(url, "url");
        Context context = getBinding().getRoot().getContext();
        if (this.exoPlayer != null) {
            return;
        }
        ExoPlayer build = new ExoPlayer.Builder(context).build();
        Intrinsics.checkNotNullExpressionValue(build, "Builder(context).build()");
        this.exoPlayer = build;
        ExoPlayer exoPlayer = null;
        if (build == null) {
            Intrinsics.throwUninitializedPropertyAccessException("exoPlayer");
            build = null;
        }
        build.addListener(new Player.Listener() {
            public void onPlaybackStateChanged(int playbackState) {
                super.onPlaybackStateChanged(playbackState);
            }
        });
        PlayerView playerView = getBinding().introVideo;
        ExoPlayer exoPlayer2 = this.exoPlayer;
        if (exoPlayer2 == null) {
            Intrinsics.throwUninitializedPropertyAccessException("exoPlayer");
            exoPlayer2 = null;
        }
        playerView.setPlayer((Player) exoPlayer2);
        ExoPlayer exoPlayer3 = this.exoPlayer;
        if (exoPlayer3 == null) {
            Intrinsics.throwUninitializedPropertyAccessException("exoPlayer");
            exoPlayer3 = null;
        }
        exoPlayer3.seekTo(0L);
        ExoPlayer exoPlayer4 = this.exoPlayer;
        if (exoPlayer4 == null) {
            Intrinsics.throwUninitializedPropertyAccessException("exoPlayer");
            exoPlayer4 = null;
        }
        exoPlayer4.setRepeatMode(1);
        ExoPlayer exoPlayer5 = this.exoPlayer;
        if (exoPlayer5 == null) {
            Intrinsics.throwUninitializedPropertyAccessException("exoPlayer");
            exoPlayer5 = null;
        }
        exoPlayer5.setVolume(0.0f);
        MediaSource createMediaSource = new ProgressiveMediaSource.Factory(CacheDataSourceFactorySingleton.INSTANCE.get()).createMediaSource(MediaItem.fromUri(Uri.parse(url)));
        this.mediaSource = createMediaSource;
        if (createMediaSource != null) {
            ExoPlayer exoPlayer6 = this.exoPlayer;
            if (exoPlayer6 == null) {
                Intrinsics.throwUninitializedPropertyAccessException("exoPlayer");
                exoPlayer6 = null;
            }
            exoPlayer6.setMediaSource(createMediaSource);
            ExoPlayer exoPlayer7 = this.exoPlayer;
            if (exoPlayer7 == null) {
                Intrinsics.throwUninitializedPropertyAccessException("exoPlayer");
                exoPlayer7 = null;
            }
            exoPlayer7.prepare();
            ExoPlayer exoPlayer8 = this.exoPlayer;
            if (exoPlayer8 == null) {
                Intrinsics.throwUninitializedPropertyAccessException("exoPlayer");
                exoPlayer8 = null;
            }
            exoPlayer8.setPlayWhenReady(true);
            ExoPlayer exoPlayer9 = this.exoPlayer;
            if (exoPlayer9 == null) {
                Intrinsics.throwUninitializedPropertyAccessException("exoPlayer");
            } else {
                exoPlayer = exoPlayer9;
            }
            exoPlayer.play();
        }
    }

    private final void setStreamerLanguage(ArrayList<String> languages) {
        if (languages.isEmpty()) {
            getBinding().spl.setVisibility(8);
            return;
        }
        getBinding().languageGroup.removeAllViews();
        Iterator<String> it = languages.iterator();
        while (it.hasNext()) {
            String next = it.next();
            View inflate = getLayoutInflater().inflate(2131558792, (ViewGroup) null, false);
            Intrinsics.checkNotNull(inflate, "null cannot be cast to non-null type com.google.android.material.chip.Chip");
            View view = (Chip) inflate;
            view.setText(next);
            view.setTypeface(Typeface.DEFAULT_BOLD);
            int applyDimension = (int) TypedValue.applyDimension(1, 14.0f, getResources().getDisplayMetrics());
            view.setPadding(applyDimension, 0, applyDimension, 0);
            view.setClickable(false);
            view.setChipBackgroundColor(getColorStateList(2131100106));
            getBinding().languageGroup.addView(view);
        }
    }

    private final void setStreamerInterestTag(ArrayList<String> interests) {
        if (interests.isEmpty()) {
            getBinding().intTag.setVisibility(8);
            return;
        }
        getBinding().interestGroup.removeAllViews();
        Iterator<String> it = interests.iterator();
        while (it.hasNext()) {
            String next = it.next();
            View inflate = getLayoutInflater().inflate(2131558792, (ViewGroup) null, false);
            Intrinsics.checkNotNull(inflate, "null cannot be cast to non-null type com.google.android.material.chip.Chip");
            View view = (Chip) inflate;
            view.setText(next);
            view.setTypeface(Typeface.DEFAULT_BOLD);
            int applyDimension = (int) TypedValue.applyDimension(1, 14.0f, getResources().getDisplayMetrics());
            view.setPadding(applyDimension, 0, applyDimension, 0);
            view.setClickable(false);
            view.setChipBackgroundColor(getColorStateList(2131100106));
            getBinding().interestGroup.addView(view);
        }
    }

    public final void playMessageSentSound() {
        try {
            MediaPlayer create = MediaPlayer.create((Context) this, 2131886129);
            create.start();
            create.setOnCompletionListener(new MediaPlayer.OnCompletionListener() {
                @Override
                public final void onCompletion(MediaPlayer mediaPlayer) {
                    mediaPlayer.release();
                }
            });
        } catch (Exception e) {
            Timber.e(e);
        }
    }

    private final Context getContext() {
        return (Context) this;
    }

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

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

    protected void onResume() {
        super.onResume();
        if (refresh) {
            UserViewModel.getUserDetails$default(getViewModel(), false, 1, null);
            refresh();
            refresh = false;
        }
    }

    protected void onDestroy() {
        super.onDestroy();
        ExoPlayer exoPlayer = this.exoPlayer;
        if (exoPlayer != null) {
            if (exoPlayer == null) {
                Intrinsics.throwUninitializedPropertyAccessException("exoPlayer");
                exoPlayer = null;
            }
            exoPlayer.stop();
            ExoPlayer exoPlayer2 = this.exoPlayer;
            if (exoPlayer2 == null) {
                Intrinsics.throwUninitializedPropertyAccessException("exoPlayer");
                exoPlayer2 = null;
            }
            exoPlayer2.release();
        }
        this.mediaSource = null;
    }

    @Metadata(d1 = {"\u0000,\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\b\u0002\n\u0002\u0010\u000b\n\u0002\b\u0005\n\u0002\u0010\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\t\n\u0000\b\u0086\u0003\u0018\u00002\u00020\u0001B\u0007\b\u0002¢\u0006\u0002\u0010\u0002J\u0016\u0010\t\u001a\u00020\n2\u0006\u0010\u000b\u001a\u00020\f2\u0006\u0010\r\u001a\u00020\u000eJ\u0016\u0010\t\u001a\u00020\n2\u0006\u0010\u000b\u001a\u00020\f2\u0006\u0010\u000f\u001a\u00020\u0010R\u001a\u0010\u0003\u001a\u00020\u0004X\u0086\u000e¢\u0006\u000e\n\u0000\u001a\u0004\b\u0005\u0010\u0006\"\u0004\b\u0007\u0010\b¨\u0006\u0011"}, d2 = {"Lapp/callpe/ui/home/NonLiveStreamerDetailActivity$Companion;", "", "()V", "refresh", "", "getRefresh", "()Z", "setRefresh", "(Z)V", "openScreen", "", "activity", "Landroidx/fragment/app/FragmentActivity;", "streamer", "Lapp/callpe/data/model/StreamerModel;", "id", "", "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 NonLiveStreamerDetailActivity.refresh;
        }

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

        public final void openScreen(FragmentActivity activity, StreamerModel streamer) {
            Intrinsics.checkNotNullParameter(activity, "activity");
            Intrinsics.checkNotNullParameter(streamer, "streamer");
            Intent intent = new Intent((Context) activity, (Class<?>) NonLiveStreamerDetailActivity.class);
            intent.putExtra("streamer", new Gson().toJson(streamer));
            activity.startActivity(intent);
        }

        public final void openScreen(FragmentActivity activity, long id) {
            Intrinsics.checkNotNullParameter(activity, "activity");
            Intent intent = new Intent((Context) activity, (Class<?>) NonLiveStreamerDetailActivity.class);
            intent.putExtra("id", id);
            activity.startActivity(intent);
        }
    }
}