正在查看: Rilo v2.0.21 应用的 StreamerReviewActivity.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: Rilo v2.0.21 应用的 StreamerReviewActivity.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package app.callpe.ui.user;
import android.R;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.util.TypedValue;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.CompoundButton;
import android.widget.RatingBar;
import androidx.activity.ComponentActivity;
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 app.callpe.common.utils.Constants;
import app.callpe.common.utils.extensions.ActivityExtKt;
import app.callpe.common.utils.sharedpref.PrefKeys;
import app.callpe.common.utils.sharedpref.SharedPref;
import app.callpe.data.model.ReviewTag;
import app.callpe.data.model.StreamerModel;
import app.callpe.data.model.VideoDetailModel;
import app.callpe.databinding.ActivityStreamerRatingBinding;
import app.callpe.ui.call.CallViewModel;
import app.callpe.ui.home.BaseActivity;
import app.callpe.ui.home.HomeActivity;
import com.google.android.gms.tasks.OnCompleteListener;
import com.google.android.gms.tasks.Task;
import com.google.android.material.chip.Chip;
import com.google.android.play.core.review.ReviewException;
import com.google.android.play.core.review.ReviewInfo;
import com.google.android.play.core.review.ReviewManager;
import com.google.android.play.core.review.ReviewManagerFactory;
import com.google.gson.Gson;
import dagger.hilt.android.AndroidEntryPoint;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import kotlin.Lazy;
import kotlin.Metadata;
import kotlin.collections.CollectionsKt;
import kotlin.coroutines.CoroutineContext;
import kotlin.jvm.functions.Function0;
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;
@Metadata(d1 = {"\u0000r\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\u0010\b\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0005\n\u0002\u0010\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0004\n\u0002\u0018\u0002\n\u0002\b\u0005\n\u0002\u0010 \n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0000\b\u0007\u0018\u00002\b\u0012\u0004\u0012\u00020\u00020\u0001B\u0005¢\u0006\u0002\u0010\u0003J\b\u0010\u000f\u001a\u00020\u0010H\u0002J\b\u0010\u0011\u001a\u00020\u0012H\u0002J\u0012\u0010\u0013\u001a\u00020\u00102\b\u0010\u0014\u001a\u0004\u0018\u00010\u0015H\u0002J\u0010\u0010\u0016\u001a\u00020\u00022\u0006\u0010\u0017\u001a\u00020\u0018H\u0016J \u0010\u0019\u001a\u00020\u00102\u0016\u0010\u001a\u001a\u0012\u0012\u0004\u0012\u00020\u00070\u001bj\b\u0012\u0004\u0012\u00020\u0007`\u001cH\u0002J\b\u0010\u001d\u001a\u00020\u0010H\u0002J\b\u0010\u001e\u001a\u00020\u001fH\u0002J\b\u0010 \u001a\u00020\u0010H\u0016J\b\u0010!\u001a\u00020\u0010H\u0002J\u0012\u0010\"\u001a\u00020\u00102\b\u0010#\u001a\u0004\u0018\u00010$H\u0014J\b\u0010%\u001a\u00020\u0010H\u0014J\b\u0010&\u001a\u00020\u0010H\u0002J\b\u0010'\u001a\u00020\u0010H\u0002J\u0016\u0010(\u001a\u00020\u00102\f\u0010)\u001a\b\u0012\u0004\u0012\u00020\u00070*H\u0002J\u0016\u0010+\u001a\u00020\u00102\f\u0010)\u001a\b\u0012\u0004\u0012\u00020\u00070*H\u0002J\u0010\u0010,\u001a\u00020\u00102\u0006\u0010-\u001a\u00020.H\u0002R*\u0010\u0004\u001a\u001e\u0012\u0004\u0012\u00020\u0006\u0012\u0004\u0012\u00020\u00070\u0005j\u000e\u0012\u0004\u0012\u00020\u0006\u0012\u0004\u0012\u00020\u0007`\bX\u0082\u0004¢\u0006\u0002\n\u0000R\u001b\u0010\t\u001a\u00020\n8BX\u0082\u0084\u0002¢\u0006\f\n\u0004\b\r\u0010\u000e\u001a\u0004\b\u000b\u0010\f¨\u0006/"}, d2 = {"Lapp/callpe/ui/user/StreamerReviewActivity;", "Lapp/callpe/ui/home/BaseActivity;", "Lapp/callpe/databinding/ActivityStreamerRatingBinding;", "()V", "selectedTags", "Ljava/util/HashMap;", "", "Lapp/callpe/data/model/ReviewTag;", "Lkotlin/collections/HashMap;", "viewModel", "Lapp/callpe/ui/call/CallViewModel;", "getViewModel", "()Lapp/callpe/ui/call/CallViewModel;", "viewModel$delegate", "Lkotlin/Lazy;", "feedbackDialogShow", "", "getContext", "Landroid/content/Context;", "getVideoDetails", "intent", "Landroid/content/Intent;", "inflateLayout", "layoutInflater", "Landroid/view/LayoutInflater;", "initTags", "list", "Ljava/util/ArrayList;", "Lkotlin/collections/ArrayList;", "manageRatingPopup", "observeEvent", "Lkotlinx/coroutines/Job;", "onBackPressed", "onClicks", "onCreate", "savedInstanceState", "Landroid/os/Bundle;", "onDestroy", "refresh", "save", "setNegativeReviewTag", "reviews", "", "setPositiveReviewTag", "setUpUI", "videoDetails", "Lapp/callpe/data/model/VideoDetailModel;", "app_riloRelease"}, k = 1, mv = {1, 8, 0}, xi = 48)
@AndroidEntryPoint
public final class StreamerReviewActivity extends BaseActivity<ActivityStreamerRatingBinding> {
private final HashMap<Integer, ReviewTag> selectedTags = new HashMap<>();
private final Lazy viewModel;
public StreamerReviewActivity() {
final ComponentActivity componentActivity = (ComponentActivity) this;
final Function0 function0 = null;
this.viewModel = new ViewModelLazy(Reflection.getOrCreateKotlinClass(CallViewModel.class), new Function0<ViewModelStore>() {
{
super(0);
}
public final ViewModelStore m2282invoke() {
return componentActivity.getViewModelStore();
}
}, new Function0<ViewModelProvider.Factory>() {
{
super(0);
}
public final ViewModelProvider.Factory m2281invoke() {
return componentActivity.getDefaultViewModelProviderFactory();
}
}, new Function0<CreationExtras>() {
{
super(0);
}
public final CreationExtras m2283invoke() {
CreationExtras creationExtras;
Function0 function02 = function0;
return (function02 == null || (creationExtras = (CreationExtras) function02.invoke()) == null) ? componentActivity.getDefaultViewModelCreationExtras() : creationExtras;
}
});
}
@Override
public ActivityStreamerRatingBinding inflateLayout(LayoutInflater layoutInflater) {
Intrinsics.checkNotNullParameter(layoutInflater, "layoutInflater");
ActivityStreamerRatingBinding inflate = ActivityStreamerRatingBinding.inflate(layoutInflater);
Intrinsics.checkNotNullExpressionValue(inflate, "inflate(layoutInflater)");
return inflate;
}
public final CallViewModel getViewModel() {
return (CallViewModel) this.viewModel.getValue();
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setWindowFlag((Activity) this, 67108864, false);
getWindow().setStatusBarColor(ContextCompat.getColor((Context) this, 2131100053));
observeEvent();
getVideoDetails(getIntent());
onClicks();
refresh();
}
private final void getVideoDetails(Intent intent) {
String stringExtra;
VideoDetailModel videoDetailModel;
if (intent == null || intent.getExtras() == null || (stringExtra = intent.getStringExtra(Constants.FCM_DATA)) == null || (videoDetailModel = (VideoDetailModel) new Gson().fromJson(stringExtra, VideoDetailModel.class)) == null) {
return;
}
getViewModel().setVideoDetails(videoDetailModel);
setUpUI(videoDetailModel);
}
private final void setUpUI(VideoDetailModel videoDetails) {
String str;
StreamerModel streamerDetails = videoDetails.getStreamerDetails();
if (streamerDetails == null || (str = streamerDetails.getName()) == null) {
str = "";
}
String str2 = str;
getBinding().streamerName.setText(str2);
getBinding().streamerNameA.setText(str2);
}
private final void refresh() {
getViewModel().getReviewTagList();
}
private final void onClicks() {
getBinding().submitBtn.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
StreamerReviewActivity.onClicks$lambda$1(StreamerReviewActivity.this, view);
}
});
getBinding().ratingBar.setOnRatingBarChangeListener(new RatingBar.OnRatingBarChangeListener() {
@Override
public final void onRatingChanged(RatingBar ratingBar, float f, boolean z) {
StreamerReviewActivity.onClicks$lambda$2(StreamerReviewActivity.this, ratingBar, f, z);
}
});
}
public static final void onClicks$lambda$1(StreamerReviewActivity streamerReviewActivity, View view) {
Intrinsics.checkNotNullParameter(streamerReviewActivity, "this$0");
streamerReviewActivity.save();
}
public static final void onClicks$lambda$2(StreamerReviewActivity streamerReviewActivity, RatingBar ratingBar, float f, boolean z) {
Intrinsics.checkNotNullParameter(streamerReviewActivity, "this$0");
if (streamerReviewActivity.getBinding().ratingBar.getRating() >= 4.0f) {
streamerReviewActivity.manageRatingPopup();
}
}
private final void save() {
if (((ActivityStreamerRatingBinding) getBinding()).ratingBar.getRating() == 0.0f) {
ActivityExtKt.toast((Activity) this, "Rating required");
return;
}
if (this.selectedTags.isEmpty()) {
ActivityExtKt.toast((Activity) this, "At least 1 tag is required");
return;
}
Set<Map.Entry<Integer, ReviewTag>> entrySet = this.selectedTags.entrySet();
Intrinsics.checkNotNullExpressionValue(entrySet, "selectedTags.entries");
Set<Map.Entry<Integer, ReviewTag>> set = entrySet;
ArrayList arrayList = new ArrayList(CollectionsKt.collectionSizeOrDefault(set, 10));
Iterator<T> it = set.iterator();
while (it.hasNext()) {
arrayList.add((Integer) ((Map.Entry) it.next()).getKey());
}
getViewModel().submitReview(arrayList, (int) ((ActivityStreamerRatingBinding) getBinding()).ratingBar.getRating());
}
private final Job observeEvent() {
return BuildersKt.launch$default(LifecycleOwnerKt.getLifecycleScope((LifecycleOwner) this), (CoroutineContext) null, (CoroutineStart) null, new StreamerReviewActivity$observeEvent$1(this, null), 3, (Object) null);
}
public final void initTags(ArrayList<ReviewTag> list) {
ArrayList<ReviewTag> arrayList = list;
ArrayList arrayList2 = new ArrayList();
for (Object obj : arrayList) {
if (((ReviewTag) obj).getPositive()) {
arrayList2.add(obj);
}
}
ArrayList arrayList3 = arrayList2;
ArrayList arrayList4 = new ArrayList();
for (Object obj2 : arrayList) {
if (!((ReviewTag) obj2).getPositive()) {
arrayList4.add(obj2);
}
}
setPositiveReviewTag(arrayList3);
setNegativeReviewTag(arrayList4);
}
public void onBackPressed() {
if (isTaskRoot()) {
Intent intent = new Intent((Context) this, (Class<?>) HomeActivity.class);
intent.addFlags(268468224);
startActivity(intent);
overridePendingTransition(R.anim.fade_in, R.anim.fade_out);
finish();
return;
}
super.onBackPressed();
}
private final void setPositiveReviewTag(List<ReviewTag> reviews) {
getBinding().positiveReviewGroup.removeAllViews();
for (final ReviewTag reviewTag : reviews) {
View inflate = getLayoutInflater().inflate(2131558802, (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(reviewTag.getTag());
view.setId(reviewTag.getId());
int applyDimension = (int) TypedValue.applyDimension(1, 14.0f, getResources().getDisplayMetrics());
view.setPadding(applyDimension, 0, applyDimension, 0);
view.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public final void onCheckedChanged(CompoundButton compoundButton, boolean z) {
StreamerReviewActivity.setPositiveReviewTag$lambda$7(StreamerReviewActivity.this, reviewTag, compoundButton, z);
}
});
getBinding().positiveReviewGroup.addView(view);
}
}
public static final void setPositiveReviewTag$lambda$7(StreamerReviewActivity streamerReviewActivity, ReviewTag reviewTag, CompoundButton compoundButton, boolean z) {
Intrinsics.checkNotNullParameter(streamerReviewActivity, "this$0");
Intrinsics.checkNotNullParameter(reviewTag, "$review");
if (streamerReviewActivity.selectedTags.containsKey(Integer.valueOf(compoundButton.getId()))) {
streamerReviewActivity.selectedTags.remove(Integer.valueOf(compoundButton.getId()));
} else {
streamerReviewActivity.selectedTags.put(Integer.valueOf(compoundButton.getId()), reviewTag);
}
}
private final void setNegativeReviewTag(List<ReviewTag> reviews) {
getBinding().negativeReviewGroup.removeAllViews();
for (final ReviewTag reviewTag : reviews) {
View inflate = getLayoutInflater().inflate(2131558802, (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(reviewTag.getTag());
view.setId(reviewTag.getId());
int applyDimension = (int) TypedValue.applyDimension(1, 14.0f, getResources().getDisplayMetrics());
view.setPadding(applyDimension, 0, applyDimension, 0);
view.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public final void onCheckedChanged(CompoundButton compoundButton, boolean z) {
StreamerReviewActivity.setNegativeReviewTag$lambda$8(StreamerReviewActivity.this, reviewTag, compoundButton, z);
}
});
getBinding().negativeReviewGroup.addView(view);
}
}
public static final void setNegativeReviewTag$lambda$8(StreamerReviewActivity streamerReviewActivity, ReviewTag reviewTag, CompoundButton compoundButton, boolean z) {
Intrinsics.checkNotNullParameter(streamerReviewActivity, "this$0");
Intrinsics.checkNotNullParameter(reviewTag, "$review");
if (streamerReviewActivity.selectedTags.containsKey(Integer.valueOf(compoundButton.getId()))) {
streamerReviewActivity.selectedTags.remove(Integer.valueOf(compoundButton.getId()));
} else {
streamerReviewActivity.selectedTags.put(Integer.valueOf(compoundButton.getId()), reviewTag);
}
}
private final void manageRatingPopup() {
if (SharedPref.getBoolean((Context) this, PrefKeys.RATING_GIVEN)) {
return;
}
feedbackDialogShow();
}
private final void feedbackDialogShow() {
final ReviewManager create = ReviewManagerFactory.create(getApplicationContext());
Intrinsics.checkNotNullExpressionValue(create, "create(applicationContext)");
create.requestReviewFlow().addOnCompleteListener(new OnCompleteListener() {
public final void onComplete(Task task) {
StreamerReviewActivity.feedbackDialogShow$lambda$9(StreamerReviewActivity.this, create, task);
}
});
}
public static final void feedbackDialogShow$lambda$9(StreamerReviewActivity streamerReviewActivity, ReviewManager reviewManager, Task task) {
Intrinsics.checkNotNullParameter(streamerReviewActivity, "this$0");
Intrinsics.checkNotNullParameter(reviewManager, "$reviewManager");
Intrinsics.checkNotNullParameter(task, "it");
if (task.isSuccessful()) {
SharedPref.setBoolean((Context) streamerReviewActivity, PrefKeys.RATING_GIVEN, true);
reviewManager.launchReviewFlow((Activity) streamerReviewActivity, (ReviewInfo) task.getResult());
return;
}
try {
ReviewException exception = task.getException();
Intrinsics.checkNotNull(exception, "null cannot be cast to non-null type com.google.android.play.core.review.ReviewException");
Timber.tag("RATING").d(String.valueOf(exception.getErrorCode()), new Object[0]);
} catch (Exception e) {
Timber.e(e);
}
}
private final Context getContext() {
return (Context) this;
}
protected void onDestroy() {
super.onDestroy();
}
}