正在查看: Biko v2.0.23 应用的 UserDetailsActivity.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: Biko v2.0.23 应用的 UserDetailsActivity.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package app.callpe.ui.user;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.activity.ComponentActivity;
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 app.callpe.App;
import app.callpe.common.utils.Constants;
import app.callpe.common.utils.sharedpref.PrefKeys;
import app.callpe.common.utils.sharedpref.SharedPref;
import app.callpe.data.model.User;
import app.callpe.databinding.ActivityUserDetailsBinding;
import app.callpe.ui.bottomsheet.UserDetailBottomSheet;
import app.callpe.ui.call.CallActivity;
import app.callpe.ui.chat.ChatActivity;
import app.callpe.ui.home.BaseActivity;
import com.bumptech.glide.Glide;
import com.google.android.gms.maps.CameraUpdate;
import com.google.android.gms.maps.CameraUpdateFactory;
import com.google.android.gms.maps.GoogleMap;
import com.google.android.gms.maps.OnMapReadyCallback;
import com.google.android.gms.maps.SupportMapFragment;
import com.google.android.gms.maps.model.LatLng;
import com.google.android.gms.maps.model.LatLngBounds;
import com.google.maps.android.SphericalUtil;
import dagger.hilt.android.AndroidEntryPoint;
import kotlin.Lazy;
import kotlin.Metadata;
import kotlin.coroutines.CoroutineContext;
import kotlin.jvm.functions.Function0;
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;
@Metadata(d1 = {"\u0000j\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u0006\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0005\n\u0002\u0010\u000b\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0005\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\n\n\u0002\u0018\u0002\n\u0002\b\u0002\b\u0007\u0018\u0000 22\b\u0012\u0004\u0012\u00020\u00020\u00012\u00020\u0003:\u00012B\u0005¢\u0006\u0002\u0010\u0004J\u0018\u0010\u0018\u001a\u00020\u00192\u0006\u0010\u001a\u001a\u00020\u001b2\u0006\u0010\u001c\u001a\u00020\bH\u0002J\u0010\u0010\u001d\u001a\u00020\u00022\u0006\u0010\u001e\u001a\u00020\u001fH\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\b\u0010(\u001a\u00020#H\u0016J\u0010\u0010)\u001a\u00020#2\u0006\u0010*\u001a\u00020\u0006H\u0016J\b\u0010+\u001a\u00020#H\u0014J\b\u0010,\u001a\u00020#H\u0014J\b\u0010-\u001a\u00020#H\u0002J\b\u0010.\u001a\u00020#H\u0002J\u0010\u0010/\u001a\u00020#2\u0006\u00100\u001a\u000201H\u0002R\u0010\u0010\u0005\u001a\u0004\u0018\u00010\u0006X\u0082\u000e¢\u0006\u0002\n\u0000R\u000e\u0010\u0007\u001a\u00020\bX\u0082\u000e¢\u0006\u0002\n\u0000R\u000e\u0010\t\u001a\u00020\bX\u0082\u000e¢\u0006\u0002\n\u0000R\u001c\u0010\n\u001a\u0004\u0018\u00010\u000bX\u0086\u000e¢\u0006\u000e\n\u0000\u001a\u0004\b\f\u0010\r\"\u0004\b\u000e\u0010\u000fR\u000e\u0010\u0010\u001a\u00020\u0011X\u0082\u000e¢\u0006\u0002\n\u0000R\u001b\u0010\u0012\u001a\u00020\u00138BX\u0082\u0084\u0002¢\u0006\f\n\u0004\b\u0016\u0010\u0017\u001a\u0004\b\u0014\u0010\u0015¨\u00063"}, d2 = {"Lapp/callpe/ui/user/UserDetailsActivity;", "Lapp/callpe/ui/home/BaseActivity;", "Lapp/callpe/databinding/ActivityUserDetailsBinding;", "Lcom/google/android/gms/maps/OnMapReadyCallback;", "()V", "googleMap", "Lcom/google/android/gms/maps/GoogleMap;", "lat", "", "lon", "mapView", "Lcom/google/android/gms/maps/SupportMapFragment;", "getMapView", "()Lcom/google/android/gms/maps/SupportMapFragment;", "setMapView", "(Lcom/google/android/gms/maps/SupportMapFragment;)V", "resumeScreen", "", "viewModel", "Lapp/callpe/ui/user/UserViewModel;", "getViewModel", "()Lapp/callpe/ui/user/UserViewModel;", "viewModel$delegate", "Lkotlin/Lazy;", "calculateBounds", "Lcom/google/android/gms/maps/model/LatLngBounds;", "center", "Lcom/google/android/gms/maps/model/LatLng;", "radiusKm", "inflateLayout", "layoutInflater", "Landroid/view/LayoutInflater;", "observeEvent", "Lkotlinx/coroutines/Job;", "onClicks", "", "onCreate", "savedInstanceState", "Landroid/os/Bundle;", "onDestroy", "onLowMemory", "onMapReady", "p0", "onPause", "onResume", "refresh", "setUpMap", "showUserdata", "userData", "Lapp/callpe/data/model/User;", "Companion", "app_bikoRelease"}, k = 1, mv = {1, 8, 0}, xi = 48)
@AndroidEntryPoint
public final class UserDetailsActivity extends BaseActivity<ActivityUserDetailsBinding> implements OnMapReadyCallback {
public static final Companion INSTANCE = new Companion(null);
private static boolean resume;
private GoogleMap googleMap;
private double lat;
private double lon;
private SupportMapFragment mapView;
private boolean resumeScreen;
private final Lazy viewModel;
public UserDetailsActivity() {
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 m2304invoke() {
return componentActivity.getViewModelStore();
}
}, new Function0<ViewModelProvider.Factory>() {
{
super(0);
}
public final ViewModelProvider.Factory m2303invoke() {
return componentActivity.getDefaultViewModelProviderFactory();
}
}, new Function0<CreationExtras>() {
{
super(0);
}
public final CreationExtras m2305invoke() {
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 SupportMapFragment getMapView() {
return this.mapView;
}
public final void setMapView(SupportMapFragment supportMapFragment) {
this.mapView = supportMapFragment;
}
@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/UserDetailsActivity$Companion;", "", "()V", "resume", "", "getResume", "()Z", "setResume", "(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 getResume() {
return UserDetailsActivity.resume;
}
public final void setResume(boolean z) {
UserDetailsActivity.resume = z;
}
}
@Override
public ActivityUserDetailsBinding inflateLayout(LayoutInflater layoutInflater) {
Intrinsics.checkNotNullParameter(layoutInflater, "layoutInflater");
ActivityUserDetailsBinding inflate = ActivityUserDetailsBinding.inflate(layoutInflater);
Intrinsics.checkNotNullExpressionValue(inflate, "inflate(layoutInflater)");
return inflate;
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView((View) getBinding().getRoot());
observeEvent();
refresh();
onClicks();
}
public final void refresh() {
getViewModel().getUserDetailsForStreamer(getIntent().getLongExtra("userId", 0L));
}
private final void onClicks() {
final long longExtra = getIntent().getLongExtra("userId", 0L);
getBinding().back.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
UserDetailsActivity.onClicks$lambda$0(UserDetailsActivity.this, view);
}
});
getBinding().more.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
UserDetailsActivity.onClicks$lambda$1(UserDetailsActivity.this, view);
}
});
getBinding().followBtn.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
UserDetailsActivity.onClicks$lambda$2(UserDetailsActivity.this, longExtra, view);
}
});
}
public static final void onClicks$lambda$0(UserDetailsActivity userDetailsActivity, View view) {
Intrinsics.checkNotNullParameter(userDetailsActivity, "this$0");
userDetailsActivity.finish();
}
public static final void onClicks$lambda$1(UserDetailsActivity userDetailsActivity, View view) {
Intrinsics.checkNotNullParameter(userDetailsActivity, "this$0");
UserDetailBottomSheet userDetailBottomSheet = new UserDetailBottomSheet(userDetailsActivity.getViewModel().getUserModel(), false, null, null, null, null, 62, null);
if (userDetailBottomSheet.isAdded() || userDetailBottomSheet.isVisible()) {
return;
}
userDetailBottomSheet.show(userDetailsActivity.getSupportFragmentManager(), userDetailBottomSheet.getTag());
}
public static final void onClicks$lambda$2(UserDetailsActivity userDetailsActivity, long j, View view) {
Intrinsics.checkNotNullParameter(userDetailsActivity, "this$0");
if (Intrinsics.areEqual(userDetailsActivity.getBinding().followBtn.getText(), "+ Follow")) {
userDetailsActivity.getBinding().followBtn.setText(userDetailsActivity.getString(2131952451));
userDetailsActivity.getViewModel().followUser(true, j);
} else {
userDetailsActivity.getBinding().followBtn.setText(userDetailsActivity.getString(2131952450));
userDetailsActivity.getViewModel().followUser(false, j);
}
}
private final void setUpMap() {
FrameLayout frameLayout = getBinding().mapContainer;
Intrinsics.checkNotNullExpressionValue(frameLayout, "binding.mapContainer");
frameLayout.setVisibility(0);
SupportMapFragment findFragmentById = getSupportFragmentManager().findFragmentById(2131363667);
this.mapView = findFragmentById;
if (findFragmentById != null) {
findFragmentById.getMapAsync(this);
}
}
private final Job observeEvent() {
return BuildersKt.launch$default(LifecycleOwnerKt.getLifecycleScope((LifecycleOwner) this), (CoroutineContext) null, (CoroutineStart) null, new UserDetailsActivity$observeEvent$1(this, null), 3, (Object) null);
}
public final void showUserdata(final User userData) {
String string;
String string2;
((ActivityUserDetailsBinding) getBinding()).messageBtn.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
UserDetailsActivity.showUserdata$lambda$6(User.this, this, view);
}
});
if (userData.getCurrentUserFollowingThisUser()) {
((ActivityUserDetailsBinding) getBinding()).followBtn.setText(getString(2131952451));
} else {
((ActivityUserDetailsBinding) getBinding()).followBtn.setText(getString(2131952450));
}
((ActivityUserDetailsBinding) getBinding()).userId.setText(String.valueOf(userData.getId()));
if (userData.getChatId() == null) {
((ActivityUserDetailsBinding) getBinding()).btnText.setText(getText(2131952552));
ImageView imageView = ((ActivityUserDetailsBinding) getBinding()).messagePic;
Intrinsics.checkNotNullExpressionValue(imageView, "binding.messagePic");
imageView.setVisibility(8);
} else {
((ActivityUserDetailsBinding) getBinding()).btnText.setText(getText(2131952252));
ImageView imageView2 = ((ActivityUserDetailsBinding) getBinding()).messagePic;
Intrinsics.checkNotNullExpressionValue(imageView2, "binding.messagePic");
imageView2.setVisibility(0);
}
if (userData.getVip()) {
TextView textView = ((ActivityUserDetailsBinding) getBinding()).tag;
Intrinsics.checkNotNullExpressionValue(textView, "binding.tag");
textView.setVisibility(0);
((ActivityUserDetailsBinding) getBinding()).tag.setText(getString(2131953075));
} else {
TextView textView2 = ((ActivityUserDetailsBinding) getBinding()).tag;
Intrinsics.checkNotNullExpressionValue(textView2, "binding.tag");
textView2.setVisibility(8);
}
if (userData.getLevelName() != null) {
View view = ((ActivityUserDetailsBinding) getBinding()).levelParent;
Intrinsics.checkNotNullExpressionValue(view, "binding.levelParent");
view.setVisibility(0);
StringBuilder sb = new StringBuilder();
sb.append("Lvl ");
String levelName = userData.getLevelName();
if (levelName == null) {
levelName = "";
}
sb.append(levelName);
((ActivityUserDetailsBinding) getBinding()).userLevel.setText(sb.toString());
} else {
View view2 = ((ActivityUserDetailsBinding) getBinding()).levelParent;
Intrinsics.checkNotNullExpressionValue(view2, "binding.levelParent");
view2.setVisibility(8);
}
if (BaseActivity.INSTANCE.isStreamer()) {
if (!Intrinsics.areEqual(userData.getUserType(), "USER")) {
Glide.with((FragmentActivity) this).load(userData.getAvatar()).into(((ActivityUserDetailsBinding) getBinding()).avatar);
}
} else {
Glide.with((FragmentActivity) this).load(userData.getAvatar()).into(((ActivityUserDetailsBinding) getBinding()).avatar);
}
((ActivityUserDetailsBinding) getBinding()).userName.setText(userData.getName());
if (Intrinsics.areEqual(userData.getGender(), "MALE")) {
((ActivityUserDetailsBinding) getBinding()).genderImage.setImageResource(2131231811);
} else {
((ActivityUserDetailsBinding) getBinding()).genderImage.setImageResource(2131231218);
}
((ActivityUserDetailsBinding) getBinding()).userAge.setText(String.valueOf(userData.getAge()));
if (userData.getOnline()) {
((ActivityUserDetailsBinding) getBinding()).userStatus.setText(getString(2131952384));
((ActivityUserDetailsBinding) getBinding()).userStatusIcon.setColorFilter(ContextCompat.getColor((Context) this, 2131100019));
} else if (userData.getBusy()) {
((ActivityUserDetailsBinding) getBinding()).userStatus.setText(getString(2131951753));
((ActivityUserDetailsBinding) getBinding()).userStatusIcon.setColorFilter(ContextCompat.getColor((Context) this, 2131100956));
} else {
((ActivityUserDetailsBinding) getBinding()).userStatus.setText(getString(2131952376));
((ActivityUserDetailsBinding) getBinding()).userStatusIcon.setColorFilter(ContextCompat.getColor((Context) this, 2131099709));
}
((ActivityUserDetailsBinding) getBinding()).videoCallBtn.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view3) {
UserDetailsActivity.showUserdata$lambda$7(UserDetailsActivity.this, userData, view3);
}
});
((ActivityUserDetailsBinding) getBinding()).earnings.setText(String.valueOf(userData.getStreamerEarningFromThisUser()));
TextView textView3 = ((ActivityUserDetailsBinding) getBinding()).myFollower;
if (userData.getThisUserFollowingCurrentUser()) {
string = getString(2131953093);
} else {
string = getString(2131952360);
}
textView3.setText(string);
TextView textView4 = ((ActivityUserDetailsBinding) getBinding()).myRefer;
if (userData.getCurrentUserReferredThisUser()) {
string2 = getString(2131953093);
} else {
string2 = getString(2131952360);
}
textView4.setText(string2);
Double lat = userData.getLat();
this.lat = lat != null ? lat.doubleValue() : 0.0d;
Double lon = userData.getLon();
double doubleValue = lon != null ? lon.doubleValue() : 0.0d;
this.lon = doubleValue;
if (this.lat == 0.0d) {
return;
}
if (!(doubleValue == 0.0d) && SharedPref.getBoolean((Context) this, PrefKeys.SHOW_USER_LOCATION)) {
setUpMap();
}
}
public static final void showUserdata$lambda$6(User user, UserDetailsActivity userDetailsActivity, View view) {
Intrinsics.checkNotNullParameter(user, "$userData");
Intrinsics.checkNotNullParameter(userDetailsActivity, "this$0");
Long chatId = user.getChatId();
if (chatId != null) {
long longValue = chatId.longValue();
App.Companion companion = App.Companion;
App.chatId = longValue;
App.Companion companion2 = App.Companion;
App.profile = user.getAvatar();
App.Companion companion3 = App.Companion;
String name = user.getName();
if (name == null) {
name = "";
}
App.chatTitle = name;
userDetailsActivity.startActivity(new Intent((Context) userDetailsActivity, (Class<?>) ChatActivity.class));
return;
}
userDetailsActivity.getViewModel().sendHiStreamerMessage(user);
}
public static final void showUserdata$lambda$7(UserDetailsActivity userDetailsActivity, User user, View view) {
Intrinsics.checkNotNullParameter(userDetailsActivity, "this$0");
Intrinsics.checkNotNullParameter(user, "$userData");
CallActivity.INSTANCE.userCall((FragmentActivity) userDetailsActivity, user.getId(), user.getAvatar(), user.getName(), Constants.ROLE.STREAMER);
}
public void onMapReady(GoogleMap p0) {
Intrinsics.checkNotNullParameter(p0, "p0");
this.googleMap = p0;
Timber.e("lat: " + this.lat + " , lon: " + this.lon, new Object[0]);
CameraUpdate newLatLngBounds = CameraUpdateFactory.newLatLngBounds(calculateBounds(new LatLng(this.lat, this.lon), 50.0d), 100);
Intrinsics.checkNotNullExpressionValue(newLatLngBounds, "newLatLngBounds(bounds, padding)");
GoogleMap googleMap = this.googleMap;
if (googleMap != null) {
googleMap.moveCamera(newLatLngBounds);
}
}
private final LatLngBounds calculateBounds(LatLng center, double radiusKm) {
double sqrt = radiusKm * 1000.0d * Math.sqrt(2.0d);
return new LatLngBounds(SphericalUtil.computeOffset(center, sqrt, 225.0d), SphericalUtil.computeOffset(center, sqrt, 45.0d));
}
protected void onResume() {
super.onResume();
SupportMapFragment supportMapFragment = this.mapView;
if (supportMapFragment != null) {
supportMapFragment.onResume();
}
if (resume) {
refresh();
resume = false;
}
if (this.resumeScreen) {
refresh();
resume = false;
this.resumeScreen = false;
}
}
protected void onPause() {
super.onPause();
SupportMapFragment supportMapFragment = this.mapView;
if (supportMapFragment != null) {
supportMapFragment.onPause();
}
}
protected void onDestroy() {
super.onDestroy();
SupportMapFragment supportMapFragment = this.mapView;
if (supportMapFragment != null) {
supportMapFragment.onDestroy();
}
}
public void onLowMemory() {
super.onLowMemory();
SupportMapFragment supportMapFragment = this.mapView;
if (supportMapFragment != null) {
supportMapFragment.onLowMemory();
}
}
}