导航菜单

页面标题

页面副标题

Rilo v2.0.21 - NonLiveOnboardActivity.java 源代码

正在查看: Rilo v2.0.21 应用的 NonLiveOnboardActivity.java JAVA 源代码文件

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


package app.callpe.ui.onboarding;

import android.app.Activity;
import android.content.Context;
import android.os.Bundle;
import android.view.LayoutInflater;
import androidx.activity.ComponentActivity;
import androidx.core.content.ContextCompat;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.lifecycle.Lifecycle;
import androidx.lifecycle.ViewModelLazy;
import androidx.lifecycle.ViewModelProvider;
import androidx.lifecycle.ViewModelStore;
import androidx.lifecycle.viewmodel.CreationExtras;
import androidx.recyclerview.widget.RecyclerView;
import androidx.viewpager2.adapter.FragmentStateAdapter;
import androidx.viewpager2.widget.ViewPager2;
import app.callpe.common.utils.sharedpref.PrefKeys;
import app.callpe.common.utils.sharedpref.SharedPref;
import app.callpe.data.model.OnboardModel;
import app.callpe.data.model.User;
import app.callpe.databinding.ActivityOnboardingBinding;
import app.callpe.ui.home.BaseActivity;
import app.callpe.ui.onboarding.NonLiveOnboardActivity;
import app.callpe.ui.onboarding.fragments.AddInterestFragment;
import app.callpe.ui.onboarding.fragments.AddLanguageFragment;
import app.callpe.ui.onboarding.fragments.BirthdayFragment;
import app.callpe.ui.onboarding.fragments.GenderSelectorFragment;
import app.callpe.ui.onboarding.fragments.NickNameAvatarFragment;
import app.callpe.ui.onboarding.fragments.NonLiveProfilePicFragment;
import app.callpe.ui.user.UserViewModel;
import com.facebook.internal.Utility;
import com.google.gson.Gson;
import dagger.hilt.android.AndroidEntryPoint;
import kotlin.Lazy;
import kotlin.Metadata;
import kotlin.jvm.functions.Function0;
import kotlin.jvm.internal.Intrinsics;
import kotlin.jvm.internal.Reflection;
import timber.log.Timber;

@Metadata(d1 = {"\u0000>\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\u0002\b\u0005\n\u0002\u0018\u0002\n\u0002\b\u0005\n\u0002\u0010\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\u0003\b\u0007\u0018\u00002\b\u0012\u0004\u0012\u00020\u00020\u0001:\u0001\u001cB\u0005¢\u0006\u0002\u0010\u0003J\b\u0010\u0012\u001a\u00020\u0013H\u0002J\u0010\u0010\u0014\u001a\u00020\u00022\u0006\u0010\u0015\u001a\u00020\u0016H\u0016J\b\u0010\u0017\u001a\u00020\u0013H\u0016J\u0012\u0010\u0018\u001a\u00020\u00132\b\u0010\u0019\u001a\u0004\u0018\u00010\u001aH\u0014J\b\u0010\u001b\u001a\u00020\u0013H\u0002R\u0012\u0010\u0004\u001a\u00060\u0005R\u00020\u0000X\u0082.¢\u0006\u0002\n\u0000R\u001b\u0010\u0006\u001a\u00020\u00078BX\u0082\u0084\u0002¢\u0006\f\n\u0004\b\n\u0010\u000b\u001a\u0004\b\b\u0010\tR\u001c\u0010\f\u001a\u0004\u0018\u00010\rX\u0086\u000e¢\u0006\u000e\n\u0000\u001a\u0004\b\u000e\u0010\u000f\"\u0004\b\u0010\u0010\u0011¨\u0006\u001d"}, d2 = {"Lapp/callpe/ui/onboarding/NonLiveOnboardActivity;", "Lapp/callpe/ui/home/BaseActivity;", "Lapp/callpe/databinding/ActivityOnboardingBinding;", "()V", "mViewPagerAdapter", "Lapp/callpe/ui/onboarding/NonLiveOnboardActivity$ViewPager2Adapter;", "viewModel", "Lapp/callpe/ui/user/UserViewModel;", "getViewModel", "()Lapp/callpe/ui/user/UserViewModel;", "viewModel$delegate", "Lkotlin/Lazy;", "viewPager", "Landroidx/viewpager2/widget/ViewPager2;", "getViewPager", "()Landroidx/viewpager2/widget/ViewPager2;", "setViewPager", "(Landroidx/viewpager2/widget/ViewPager2;)V", "getIntentValues", "", "inflateLayout", "layoutInflater", "Landroid/view/LayoutInflater;", "onBackPressed", "onCreate", "savedInstanceState", "Landroid/os/Bundle;", "setUpNavigation", "ViewPager2Adapter", "app_riloRelease"}, k = 1, mv = {1, 8, 0}, xi = 48)
@AndroidEntryPoint
public final class NonLiveOnboardActivity extends BaseActivity<ActivityOnboardingBinding> {
    private ViewPager2Adapter mViewPagerAdapter;

    private final Lazy viewModel;
    private ViewPager2 viewPager;

    public NonLiveOnboardActivity() {
        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 m2048invoke() {
                return componentActivity.getViewModelStore();
            }
        }, new Function0<ViewModelProvider.Factory>() {
            {
                super(0);
            }

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

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

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

    public final ViewPager2 getViewPager() {
        return this.viewPager;
    }

    public final void setViewPager(ViewPager2 viewPager2) {
        this.viewPager = viewPager2;
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setWindowFlag((Activity) this, 67108864, false);
        getWindow().getDecorView().setSystemUiVisibility(Utility.DEFAULT_STREAM_BUFFER_SIZE);
        getWindow().setStatusBarColor(ContextCompat.getColor((Context) this, 2131101146));
        getIntentValues();
        setUpNavigation();
    }

    private final void getIntentValues() {
        String stringExtra = getIntent().getStringExtra("user");
        String str = stringExtra;
        if (!(str == null || str.length() == 0)) {
            User user = (User) new Gson().fromJson(stringExtra, User.class);
            OnboardModel onboardModel = null;
            Context context = (Context) this;
            String string = SharedPref.getString(context, PrefKeys.ON_BOARD);
            if (!(string == null || string.length() == 0)) {
                String string2 = SharedPref.getString(context, PrefKeys.ON_BOARD);
                OnboardModel onboardModel2 = (OnboardModel) new Gson().fromJson(string2, OnboardModel.class);
                Timber.e("onboard " + string2, new Object[0]);
                onboardModel = onboardModel2;
            }
            if (user != null) {
                getViewModel().getOnBoardModel().fillValues(user, onboardModel);
                getViewModel().setAvatar(user.getAvatar());
                getViewModel().setUser(user);
                getViewModel().setRejected(user.getStreamerStatus() != null && Intrinsics.areEqual(user.getStreamerStatus(), "REJECTED"));
            }
        }
        if (getIntent().getBooleanExtra("streamerScreen", false)) {
            getViewModel().setBecomeStreamer(true);
        }
    }

    private final void setUpNavigation() {
        this.viewPager = getBinding().viewPager;
        FragmentManager supportFragmentManager = getSupportFragmentManager();
        Intrinsics.checkNotNullExpressionValue(supportFragmentManager, "supportFragmentManager");
        Lifecycle lifecycle = getLifecycle();
        Intrinsics.checkNotNullExpressionValue(lifecycle, "lifecycle");
        RecyclerView.Adapter viewPager2Adapter = new ViewPager2Adapter(this, supportFragmentManager, lifecycle);
        this.mViewPagerAdapter = viewPager2Adapter;
        ViewPager2 viewPager2 = this.viewPager;
        if (viewPager2 != null) {
            viewPager2.setAdapter(viewPager2Adapter);
        }
        ViewPager2 viewPager22 = this.viewPager;
        if (viewPager22 != null) {
            viewPager22.setUserInputEnabled(false);
        }
        ViewPager2 viewPager23 = this.viewPager;
        if (viewPager23 != null) {
            viewPager23.setOffscreenPageLimit(8);
        }
        ViewPager2 viewPager24 = this.viewPager;
        if (viewPager24 != null) {
            viewPager24.registerOnPageChangeCallback(new ViewPager2.OnPageChangeCallback() {
                public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
                }

                public void onPageSelected(int position) {
                    NonLiveOnboardActivity.ViewPager2Adapter viewPager2Adapter2;
                    ActivityOnboardingBinding binding;
                    viewPager2Adapter2 = NonLiveOnboardActivity.this.mViewPagerAdapter;
                    if (viewPager2Adapter2 == null) {
                        Intrinsics.throwUninitializedPropertyAccessException("mViewPagerAdapter");
                        viewPager2Adapter2 = null;
                    }
                    float itemCount = ((position + 1) / viewPager2Adapter2.getItemCount()) * 100;
                    binding = NonLiveOnboardActivity.this.getBinding();
                    binding.simpleProgressBar.setProgress((int) itemCount);
                }
            });
        }
    }

    @Metadata(d1 = {"\u0000&\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\b\n\u0002\b\u0004\b\u0086\u0004\u0018\u00002\u00020\u0001B\u0015\u0012\u0006\u0010\u0002\u001a\u00020\u0003\u0012\u0006\u0010\u0004\u001a\u00020\u0005¢\u0006\u0002\u0010\u0006J\u0010\u0010\u0007\u001a\u00020\b2\u0006\u0010\t\u001a\u00020\nH\u0016J\u000e\u0010\u000b\u001a\u00020\b2\u0006\u0010\f\u001a\u00020\nJ\b\u0010\r\u001a\u00020\nH\u0016R\u000e\u0010\u0002\u001a\u00020\u0003X\u0082\u0004¢\u0006\u0002\n\u0000¨\u0006\u000e"}, d2 = {"Lapp/callpe/ui/onboarding/NonLiveOnboardActivity$ViewPager2Adapter;", "Landroidx/viewpager2/adapter/FragmentStateAdapter;", "fm", "Landroidx/fragment/app/FragmentManager;", "lifecycle", "Landroidx/lifecycle/Lifecycle;", "(Lapp/callpe/ui/onboarding/NonLiveOnboardActivity;Landroidx/fragment/app/FragmentManager;Landroidx/lifecycle/Lifecycle;)V", "createFragment", "Landroidx/fragment/app/Fragment;", "position", "", "getItem", "currentItem", "getItemCount", "app_riloRelease"}, k = 1, mv = {1, 8, 0}, xi = 48)
    public final class ViewPager2Adapter extends FragmentStateAdapter {
        private final FragmentManager fm;
        final NonLiveOnboardActivity this$0;

        public int getItemCount() {
            return 5;
        }

        public ViewPager2Adapter(NonLiveOnboardActivity nonLiveOnboardActivity, FragmentManager fragmentManager, Lifecycle lifecycle) {
            super(fragmentManager, lifecycle);
            Intrinsics.checkNotNullParameter(fragmentManager, "fm");
            Intrinsics.checkNotNullParameter(lifecycle, "lifecycle");
            this.this$0 = nonLiveOnboardActivity;
            this.fm = fragmentManager;
        }

        public Fragment createFragment(int position) {
            if (position == 0) {
                return new BirthdayFragment();
            }
            if (position == 1) {
                return new NickNameAvatarFragment();
            }
            if (position == 2) {
                return new AddInterestFragment();
            }
            if (position == 3) {
                return new AddLanguageFragment();
            }
            if (position == 4) {
                return new NonLiveProfilePicFragment();
            }
            return new GenderSelectorFragment();
        }

        public final Fragment getItem(int currentItem) {
            Object obj = this.fm.getFragments().get(currentItem);
            Intrinsics.checkNotNull(obj, "null cannot be cast to non-null type androidx.fragment.app.Fragment");
            return (Fragment) obj;
        }
    }

    public void onBackPressed() {
        int currentItem = getBinding().viewPager.getCurrentItem();
        if (currentItem == 0) {
            super.onBackPressed();
        } else {
            getBinding().viewPager.setCurrentItem(currentItem - 1);
        }
    }

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