Session v1.18.2版本的 MD5 值为:92ce129e957021e1a845dcaca5ce957d
以下内容为反编译后的 PathActivity.java 源代码,内容仅作参考
package org.thoughtcrime.securesms.home;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.res.Resources;
import android.net.Uri;
import android.os.Bundle;
import android.os.Handler;
import android.provider.Downloads;
import android.util.AttributeSet;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;
import android.widget.Toast;
import androidx.appcompat.app.ActionBar;
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
import com.github.ybq.android.spinkit.SpinKitView;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;
import kotlin.Lazy;
import kotlin.LazyKt;
import kotlin.Metadata;
import kotlin.NoWhenBranchMatchedException;
import kotlin.collections.CollectionsKt;
import kotlin.jvm.functions.Function0;
import kotlin.jvm.internal.Intrinsics;
import network.loki.messenger.R;
import network.loki.messenger.databinding.ActivityPathBinding;
import org.apache.http.HttpHeaders;
import org.session.libsession.snode.OnionRequestAPI;
import org.session.libsession.utilities.ViewUtilsKt;
import org.session.libsignal.utilities.Snode;
import org.thoughtcrime.securesms.PassphraseRequiredActionBarActivity;
import org.thoughtcrime.securesms.home.PathActivity;
import org.thoughtcrime.securesms.util.GeneralUtilitiesKt;
import org.thoughtcrime.securesms.util.GlowViewUtilities;
import org.thoughtcrime.securesms.util.IP2Country;
import org.thoughtcrime.securesms.util.PathDotView;
import org.thoughtcrime.securesms.util.UiModeUtilities;
import org.thoughtcrime.securesms.util.ViewGroupUtilitiesKt;
import org.thoughtcrime.securesms.util.ViewUtilitiesKt;
@Metadata(d1 = {"\u0000T\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010!\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u000e\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\t\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u000b\n\u0000\n\u0002\u0010\u0002\n\u0002\b\u0005\n\u0002\u0018\u0002\n\u0002\b\u0007\b\u0007\u0018\u00002\u00020\u0001:\u0001#B\u0005¢\u0006\u0002\u0010\u0002J2\u0010\b\u001a\u00020\t2\u0006\u0010\n\u001a\u00020\u000b2\b\u0010\f\u001a\u0004\u0018\u00010\u000b2\u0006\u0010\r\u001a\u00020\u000e2\u0006\u0010\u000f\u001a\u00020\u00102\u0006\u0010\u0011\u001a\u00020\u0010H\u0002J0\u0010\b\u001a\u00020\t2\u0006\u0010\u0012\u001a\u00020\u00132\u0006\u0010\r\u001a\u00020\u000e2\u0006\u0010\u000f\u001a\u00020\u00102\u0006\u0010\u0011\u001a\u00020\u00102\u0006\u0010\u0014\u001a\u00020\u0015H\u0002J\b\u0010\u0016\u001a\u00020\u0017H\u0002J\b\u0010\u0018\u001a\u00020\u0017H\u0002J\b\u0010\u0019\u001a\u00020\u0017H\u0002J\b\u0010\u001a\u001a\u00020\u0017H\u0002J\u001a\u0010\u001b\u001a\u00020\u00172\b\u0010\u001c\u001a\u0004\u0018\u00010\u001d2\u0006\u0010\u001e\u001a\u00020\u0015H\u0014J\b\u0010\u001f\u001a\u00020\u0017H\u0014J\b\u0010 \u001a\u00020\u0017H\u0002J\u0010\u0010!\u001a\u00020\u00172\u0006\u0010\"\u001a\u00020\u0015H\u0002R\u000e\u0010\u0003\u001a\u00020\u0004X\u0082.¢\u0006\u0002\n\u0000R\u0014\u0010\u0005\u001a\b\u0012\u0004\u0012\u00020\u00070\u0006X\u0082\u0004¢\u0006\u0002\n\u0000¨\u0006$"}, d2 = {"Lorg/thoughtcrime/securesms/home/PathActivity;", "Lorg/thoughtcrime/securesms/PassphraseRequiredActionBarActivity;", "()V", "binding", "Lnetwork/loki/messenger/databinding/ActivityPathBinding;", "broadcastReceivers", "", "Landroid/content/BroadcastReceiver;", "getPathRow", "Landroid/widget/LinearLayout;", Downloads.Impl.COLUMN_TITLE, "", "subtitle", "location", "Lorg/thoughtcrime/securesms/home/PathActivity$LineView$Location;", "dotAnimationStartDelay", "", "dotAnimationRepeatInterval", "snode", "Lorg/session/libsignal/utilities/Snode;", "isGuardSnode", "", "handleBuildingPathsEvent", "", "handleOnionRequestPathCountriesLoaded", "handlePathsBuiltEvent", "learnMore", "onCreate", "savedInstanceState", "Landroid/os/Bundle;", "isReady", "onDestroy", "registerObservers", "update", "isAnimated", "LineView", "app_playRelease"}, k = 1, mv = {1, 8, 0}, xi = 48)
public final class PathActivity extends PassphraseRequiredActionBarActivity {
public static final int $stable = 8;
private ActivityPathBinding binding;
private final List<BroadcastReceiver> broadcastReceivers = new ArrayList();
@Override
public void onCreate(Bundle savedInstanceState, boolean isReady) {
super.onCreate(savedInstanceState, isReady);
ActivityPathBinding inflate = ActivityPathBinding.inflate(getLayoutInflater());
Intrinsics.checkNotNullExpressionValue(inflate, "inflate(layoutInflater)");
this.binding = inflate;
ActivityPathBinding activityPathBinding = null;
if (inflate == null) {
Intrinsics.throwUninitializedPropertyAccessException("binding");
inflate = null;
}
setContentView(inflate.getRoot());
ActionBar supportActionBar = getSupportActionBar();
Intrinsics.checkNotNull(supportActionBar);
supportActionBar.setTitle(getResources().getString(R.string.activity_path_title));
ActivityPathBinding activityPathBinding2 = this.binding;
if (activityPathBinding2 == null) {
Intrinsics.throwUninitializedPropertyAccessException("binding");
activityPathBinding2 = null;
}
LinearLayout linearLayout = activityPathBinding2.pathRowsContainer;
Intrinsics.checkNotNullExpressionValue(linearLayout, "binding.pathRowsContainer");
ViewGroupUtilitiesKt.disableClipping(linearLayout);
ActivityPathBinding activityPathBinding3 = this.binding;
if (activityPathBinding3 == null) {
Intrinsics.throwUninitializedPropertyAccessException("binding");
} else {
activityPathBinding = activityPathBinding3;
}
activityPathBinding.learnMoreButton.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
PathActivity.onCreate$lambda$0(PathActivity.this, view);
}
});
update(false);
registerObservers();
}
public static final void onCreate$lambda$0(PathActivity this$0, View view) {
Intrinsics.checkNotNullParameter(this$0, "this$0");
this$0.learnMore();
}
private final void registerObservers() {
BroadcastReceiver broadcastReceiver = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
Intrinsics.checkNotNullParameter(context, "context");
Intrinsics.checkNotNullParameter(intent, "intent");
PathActivity.this.handleBuildingPathsEvent();
}
};
this.broadcastReceivers.add(broadcastReceiver);
PathActivity pathActivity = this;
LocalBroadcastManager.getInstance(pathActivity).registerReceiver(broadcastReceiver, new IntentFilter("buildingPaths"));
BroadcastReceiver broadcastReceiver2 = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
Intrinsics.checkNotNullParameter(context, "context");
Intrinsics.checkNotNullParameter(intent, "intent");
PathActivity.this.handlePathsBuiltEvent();
}
};
this.broadcastReceivers.add(broadcastReceiver2);
LocalBroadcastManager.getInstance(pathActivity).registerReceiver(broadcastReceiver2, new IntentFilter("pathsBuilt"));
BroadcastReceiver broadcastReceiver3 = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
Intrinsics.checkNotNullParameter(context, "context");
Intrinsics.checkNotNullParameter(intent, "intent");
PathActivity.this.handleOnionRequestPathCountriesLoaded();
}
};
this.broadcastReceivers.add(broadcastReceiver3);
LocalBroadcastManager.getInstance(pathActivity).registerReceiver(broadcastReceiver3, new IntentFilter("onionRequestPathCountriesLoaded"));
}
@Override
public void onDestroy() {
Iterator<BroadcastReceiver> it = this.broadcastReceivers.iterator();
while (it.hasNext()) {
LocalBroadcastManager.getInstance(this).unregisterReceiver(it.next());
}
super.onDestroy();
}
public final void handleBuildingPathsEvent() {
update(false);
}
public final void handlePathsBuiltEvent() {
update(false);
}
public final void handleOnionRequestPathCountriesLoaded() {
update(false);
}
private final void update(boolean isAnimated) {
ActivityPathBinding activityPathBinding;
ActivityPathBinding activityPathBinding2;
ActivityPathBinding activityPathBinding3 = this.binding;
if (activityPathBinding3 == null) {
Intrinsics.throwUninitializedPropertyAccessException("binding");
activityPathBinding3 = null;
}
activityPathBinding3.pathRowsContainer.removeAllViews();
if (!(!OnionRequestAPI.INSTANCE.getPaths().isEmpty())) {
if (isAnimated) {
ActivityPathBinding activityPathBinding4 = this.binding;
if (activityPathBinding4 == null) {
Intrinsics.throwUninitializedPropertyAccessException("binding");
activityPathBinding4 = null;
}
SpinKitView spinKitView = activityPathBinding4.spinner;
Intrinsics.checkNotNullExpressionValue(spinKitView, "binding.spinner");
ViewUtilitiesKt.fadeIn$default(spinKitView, 0L, 1, null);
return;
}
ActivityPathBinding activityPathBinding5 = this.binding;
if (activityPathBinding5 == null) {
Intrinsics.throwUninitializedPropertyAccessException("binding");
activityPathBinding = null;
} else {
activityPathBinding = activityPathBinding5;
}
activityPathBinding.spinner.setAlpha(1.0f);
return;
}
List list = (List) CollectionsKt.firstOrNull((List) OnionRequestAPI.INSTANCE.getPaths());
if (list == null) {
finish();
return;
}
List list2 = list;
long j = 1000;
long size = (list2.size() * j) + j;
List list3 = list;
ArrayList arrayList = new ArrayList(CollectionsKt.collectionSizeOrDefault(list3, 10));
int i = 0;
for (Object obj : list3) {
int i2 = i + 1;
if (i < 0) {
CollectionsKt.throwIndexOverflow();
}
Snode snode = (Snode) obj;
ArrayList arrayList2 = arrayList;
arrayList2.add(getPathRow(snode, LineView.Location.Middle, 2000 + (i * j), size, OnionRequestAPI.INSTANCE.getGuardSnodes().contains(snode)));
j = j;
arrayList = arrayList2;
i = i2;
}
String string = getResources().getString(R.string.activity_path_device_row_title);
Intrinsics.checkNotNullExpressionValue(string, "resources.getString(R.st…ty_path_device_row_title)");
LinearLayout pathRow = getPathRow(string, (String) null, LineView.Location.Top, 1000L, size);
String string2 = getResources().getString(R.string.activity_path_destination_row_title);
Intrinsics.checkNotNullExpressionValue(string2, "resources.getString(R.st…th_destination_row_title)");
for (LinearLayout linearLayout : CollectionsKt.plus((Collection) CollectionsKt.plus((Collection) CollectionsKt.listOf(pathRow), (Iterable) arrayList), (Iterable) CollectionsKt.listOf(getPathRow(string2, (String) null, LineView.Location.Bottom, (list2.size() * j) + 2000, size)))) {
ActivityPathBinding activityPathBinding6 = this.binding;
if (activityPathBinding6 == null) {
Intrinsics.throwUninitializedPropertyAccessException("binding");
activityPathBinding6 = null;
}
activityPathBinding6.pathRowsContainer.addView(linearLayout);
}
if (isAnimated) {
ActivityPathBinding activityPathBinding7 = this.binding;
if (activityPathBinding7 == null) {
Intrinsics.throwUninitializedPropertyAccessException("binding");
activityPathBinding7 = null;
}
SpinKitView spinKitView2 = activityPathBinding7.spinner;
Intrinsics.checkNotNullExpressionValue(spinKitView2, "binding.spinner");
ViewUtilitiesKt.fadeOut$default(spinKitView2, 0L, 1, null);
return;
}
ActivityPathBinding activityPathBinding8 = this.binding;
if (activityPathBinding8 == null) {
Intrinsics.throwUninitializedPropertyAccessException("binding");
activityPathBinding2 = null;
} else {
activityPathBinding2 = activityPathBinding8;
}
activityPathBinding2.spinner.setAlpha(0.0f);
}
private final LinearLayout getPathRow(String title, String subtitle, LineView.Location location, long dotAnimationStartDelay, long dotAnimationRepeatInterval) {
PathActivity pathActivity = this;
LinearLayout linearLayout = new LinearLayout(pathActivity);
linearLayout.setOrientation(0);
linearLayout.setGravity(16);
ViewGroupUtilitiesKt.disableClipping(linearLayout);
linearLayout.setLayoutParams(new LinearLayout.LayoutParams(-2, -2));
LineView lineView = new LineView(pathActivity, location, dotAnimationStartDelay, dotAnimationRepeatInterval);
lineView.setLayoutParams(new LinearLayout.LayoutParams(getResources().getDimensionPixelSize(R.dimen.path_row_expanded_dot_size), getResources().getDimensionPixelSize(R.dimen.path_row_height)));
linearLayout.addView(lineView);
TextView textView = new TextView(pathActivity);
textView.setTextColor(ViewUtilsKt.getColorFromAttr$default(pathActivity, android.R.attr.textColorPrimary, null, false, 6, null));
textView.setTextSize(0, getResources().getDimension(R.dimen.medium_font_size));
textView.setText(title);
textView.setTextAlignment(5);
LinearLayout linearLayout2 = new LinearLayout(pathActivity);
linearLayout2.setOrientation(1);
linearLayout2.addView(textView);
LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(-2, -2);
layoutParams.setMarginStart(getResources().getDimensionPixelSize(R.dimen.large_spacing));
linearLayout2.setLayoutParams(layoutParams);
linearLayout.addView(linearLayout2);
if (subtitle != null) {
TextView textView2 = new TextView(pathActivity);
textView2.setTextColor(ViewUtilsKt.getColorFromAttr$default(pathActivity, android.R.attr.textColorPrimary, null, false, 6, null));
textView2.setTextSize(0, getResources().getDimension(R.dimen.small_font_size));
textView2.setText(subtitle);
textView2.setTextAlignment(5);
linearLayout2.addView(textView2);
}
return linearLayout;
}
private final LinearLayout getPathRow(Snode snode, LineView.Location location, long dotAnimationStartDelay, long dotAnimationRepeatInterval, boolean isGuardSnode) {
Resources resources;
int i;
String string;
if (isGuardSnode) {
resources = getResources();
i = R.string.activity_path_guard_node_row_title;
} else {
resources = getResources();
i = R.string.activity_path_service_node_row_title;
}
String string2 = resources.getString(i);
Intrinsics.checkNotNullExpressionValue(string2, "if (isGuardSnode) resour…h_service_node_row_title)");
if (IP2Country.INSTANCE.isInitialized()) {
string = IP2Country.INSTANCE.getShared().getCountryNamesCache().get(snode.getIp());
if (string == null) {
string = getResources().getString(R.string.activity_path_resolving_progress);
Intrinsics.checkNotNullExpressionValue(string, "resources.getString(R.st…_path_resolving_progress)");
}
} else {
string = getResources().getString(R.string.activity_path_resolving_progress);
Intrinsics.checkNotNullExpressionValue(string, "{\n resources.…lving_progress)\n }");
}
return getPathRow(string2, string, location, dotAnimationStartDelay, dotAnimationRepeatInterval);
}
private final void learnMore() {
try {
startActivity(new Intent("android.intent.action.VIEW", Uri.parse("https://getsession.org/faq/#onion-routing")));
} catch (Exception unused) {
Toast.makeText(this, R.string.invalid_url, 0).show();
}
}
@Metadata(d1 = {"\u0000>\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\t\n\u0002\b\u0004\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0010\b\n\u0002\b\u0004\n\u0002\u0018\u0002\n\u0002\b\u0005\n\u0002\u0010\u0002\n\u0002\b\u0005\b\u0002\u0018\u00002\u00020\u0001:\u0001\u001eB'\b\u0016\u0012\u0006\u0010\u0002\u001a\u00020\u0003\u0012\u0006\u0010\u0004\u001a\u00020\u0005\u0012\u0006\u0010\u0006\u001a\u00020\u0007\u0012\u0006\u0010\b\u001a\u00020\u0007¢\u0006\u0002\u0010\tB\u000f\b\u0016\u0012\u0006\u0010\u0002\u001a\u00020\u0003¢\u0006\u0002\u0010\nB\u0017\b\u0016\u0012\u0006\u0010\u0002\u001a\u00020\u0003\u0012\u0006\u0010\u000b\u001a\u00020\f¢\u0006\u0002\u0010\rB\u001f\b\u0016\u0012\u0006\u0010\u0002\u001a\u00020\u0003\u0012\u0006\u0010\u000b\u001a\u00020\f\u0012\u0006\u0010\u000e\u001a\u00020\u000f¢\u0006\u0002\u0010\u0010B'\b\u0016\u0012\u0006\u0010\u0002\u001a\u00020\u0003\u0012\u0006\u0010\u000b\u001a\u00020\f\u0012\u0006\u0010\u000e\u001a\u00020\u000f\u0012\u0006\u0010\u0011\u001a\u00020\u000f¢\u0006\u0002\u0010\u0012J\b\u0010\u0019\u001a\u00020\u001aH\u0002J\b\u0010\u001b\u001a\u00020\u001aH\u0002J\b\u0010\u001c\u001a\u00020\u001aH\u0002J\b\u0010\u001d\u001a\u00020\u001aH\u0002R\u000e\u0010\b\u001a\u00020\u0007X\u0082\u000e¢\u0006\u0002\n\u0000R\u000e\u0010\u0006\u001a\u00020\u0007X\u0082\u000e¢\u0006\u0002\n\u0000R\u001b\u0010\u0013\u001a\u00020\u00148BX\u0082\u0084\u0002¢\u0006\f\n\u0004\b\u0017\u0010\u0018\u001a\u0004\b\u0015\u0010\u0016R\u000e\u0010\u0004\u001a\u00020\u0005X\u0082.¢\u0006\u0002\n\u0000¨\u0006\u001f"}, d2 = {"Lorg/thoughtcrime/securesms/home/PathActivity$LineView;", "Landroid/widget/RelativeLayout;", "context", "Landroid/content/Context;", "location", "Lorg/thoughtcrime/securesms/home/PathActivity$LineView$Location;", "dotAnimationStartDelay", "", "dotAnimationRepeatInterval", "(Landroid/content/Context;Lorg/thoughtcrime/securesms/home/PathActivity$LineView$Location;JJ)V", "(Landroid/content/Context;)V", "attrs", "Landroid/util/AttributeSet;", "(Landroid/content/Context;Landroid/util/AttributeSet;)V", "defStyleAttr", "", "(Landroid/content/Context;Landroid/util/AttributeSet;I)V", "defStyleRes", "(Landroid/content/Context;Landroid/util/AttributeSet;II)V", "dotView", "Lorg/thoughtcrime/securesms/util/PathDotView;", "getDotView", "()Lorg/thoughtcrime/securesms/util/PathDotView;", "dotView$delegate", "Lkotlin/Lazy;", "collapse", "", "expand", "performAnimation", "setUpViewHierarchy", HttpHeaders.LOCATION, "app_playRelease"}, k = 1, mv = {1, 8, 0}, xi = 48)
public static final class LineView extends RelativeLayout {
private long dotAnimationRepeatInterval;
private long dotAnimationStartDelay;
private final Lazy dotView;
private Location location;
@Metadata(d1 = {"\u0000\f\n\u0002\u0018\u0002\n\u0002\u0010\u0010\n\u0002\b\u0005\b\u0086\u0001\u0018\u00002\b\u0012\u0004\u0012\u00020\u00000\u0001B\u0007\b\u0002¢\u0006\u0002\u0010\u0002j\u0002\b\u0003j\u0002\b\u0004j\u0002\b\u0005¨\u0006\u0006"}, d2 = {"Lorg/thoughtcrime/securesms/home/PathActivity$LineView$Location;", "", "(Ljava/lang/String;I)V", "Top", "Middle", "Bottom", "app_playRelease"}, k = 1, mv = {1, 8, 0}, xi = 48)
public enum Location {
Top,
Middle,
Bottom
}
@Metadata(k = 3, mv = {1, 8, 0}, xi = 48)
public class WhenMappings {
public static final int[] $EnumSwitchMapping$0;
static {
int[] iArr = new int[Location.values().length];
try {
iArr[Location.Top.ordinal()] = 1;
} catch (NoSuchFieldError unused) {
}
try {
iArr[Location.Bottom.ordinal()] = 2;
} catch (NoSuchFieldError unused2) {
}
try {
iArr[Location.Middle.ordinal()] = 3;
} catch (NoSuchFieldError unused3) {
}
$EnumSwitchMapping$0 = iArr;
}
}
private final PathDotView getDotView() {
return (PathDotView) this.dotView.getValue();
}
public LineView(Context context, Location location, long j, long j2) {
super(context);
Intrinsics.checkNotNullParameter(context, "context");
Intrinsics.checkNotNullParameter(location, "location");
this.dotView = LazyKt.lazy(new Function0<PathDotView>() {
{
super(0);
}
@Override
public final PathDotView invoke() {
Context context2 = PathActivity.LineView.this.getContext();
Intrinsics.checkNotNullExpressionValue(context2, "context");
PathDotView pathDotView = new PathDotView(context2);
pathDotView.setBackgroundResource(R.drawable.accent_dot);
Context context3 = PathActivity.LineView.this.getContext();
Intrinsics.checkNotNullExpressionValue(context3, "context");
pathDotView.setMainColor(ViewUtilitiesKt.getAccentColor(context3));
return pathDotView;
}
});
this.location = location;
this.dotAnimationStartDelay = j;
this.dotAnimationRepeatInterval = j2;
setUpViewHierarchy();
}
public LineView(Context context) {
super(context);
Intrinsics.checkNotNullParameter(context, "context");
this.dotView = LazyKt.lazy(new Function0<PathDotView>() {
{
super(0);
}
@Override
public final PathDotView invoke() {
Context context2 = PathActivity.LineView.this.getContext();
Intrinsics.checkNotNullExpressionValue(context2, "context");
PathDotView pathDotView = new PathDotView(context2);
pathDotView.setBackgroundResource(R.drawable.accent_dot);
Context context3 = PathActivity.LineView.this.getContext();
Intrinsics.checkNotNullExpressionValue(context3, "context");
pathDotView.setMainColor(ViewUtilitiesKt.getAccentColor(context3));
return pathDotView;
}
});
throw new Exception("Use LineView(context:location:dotAnimationStartDelay:dotAnimationRepeatInterval:) instead.");
}
public LineView(Context context, AttributeSet attrs) {
super(context, attrs);
Intrinsics.checkNotNullParameter(context, "context");
Intrinsics.checkNotNullParameter(attrs, "attrs");
this.dotView = LazyKt.lazy(new Function0<PathDotView>() {
{
super(0);
}
@Override
public final PathDotView invoke() {
Context context2 = PathActivity.LineView.this.getContext();
Intrinsics.checkNotNullExpressionValue(context2, "context");
PathDotView pathDotView = new PathDotView(context2);
pathDotView.setBackgroundResource(R.drawable.accent_dot);
Context context3 = PathActivity.LineView.this.getContext();
Intrinsics.checkNotNullExpressionValue(context3, "context");
pathDotView.setMainColor(ViewUtilitiesKt.getAccentColor(context3));
return pathDotView;
}
});
throw new Exception("Use LineView(context:location:dotAnimationStartDelay:dotAnimationRepeatInterval:) instead.");
}
public LineView(Context context, AttributeSet attrs, int i) {
super(context, attrs, i);
Intrinsics.checkNotNullParameter(context, "context");
Intrinsics.checkNotNullParameter(attrs, "attrs");
this.dotView = LazyKt.lazy(new Function0<PathDotView>() {
{
super(0);
}
@Override
public final PathDotView invoke() {
Context context2 = PathActivity.LineView.this.getContext();
Intrinsics.checkNotNullExpressionValue(context2, "context");
PathDotView pathDotView = new PathDotView(context2);
pathDotView.setBackgroundResource(R.drawable.accent_dot);
Context context3 = PathActivity.LineView.this.getContext();
Intrinsics.checkNotNullExpressionValue(context3, "context");
pathDotView.setMainColor(ViewUtilitiesKt.getAccentColor(context3));
return pathDotView;
}
});
throw new Exception("Use LineView(context:location:dotAnimationStartDelay:dotAnimationRepeatInterval:) instead.");
}
public LineView(Context context, AttributeSet attrs, int i, int i2) {
super(context, attrs, i, i2);
Intrinsics.checkNotNullParameter(context, "context");
Intrinsics.checkNotNullParameter(attrs, "attrs");
this.dotView = LazyKt.lazy(new Function0<PathDotView>() {
{
super(0);
}
@Override
public final PathDotView invoke() {
Context context2 = PathActivity.LineView.this.getContext();
Intrinsics.checkNotNullExpressionValue(context2, "context");
PathDotView pathDotView = new PathDotView(context2);
pathDotView.setBackgroundResource(R.drawable.accent_dot);
Context context3 = PathActivity.LineView.this.getContext();
Intrinsics.checkNotNullExpressionValue(context3, "context");
pathDotView.setMainColor(ViewUtilitiesKt.getAccentColor(context3));
return pathDotView;
}
});
throw new Exception("Use LineView(context:location:dotAnimationStartDelay:dotAnimationRepeatInterval:) instead.");
}
private final void setUpViewHierarchy() {
int dimensionPixelSize;
ViewGroupUtilitiesKt.disableClipping(this);
View view = new View(getContext());
Context context = getContext();
Intrinsics.checkNotNullExpressionValue(context, "context");
view.setBackgroundColor(ViewUtilsKt.getColorFromAttr$default(context, android.R.attr.textColorPrimary, null, false, 6, null));
Location location = this.location;
Location location2 = null;
if (location == null) {
Intrinsics.throwUninitializedPropertyAccessException("location");
location = null;
}
int i = WhenMappings.$EnumSwitchMapping$0[location.ordinal()];
if (i == 1 || i == 2) {
dimensionPixelSize = getResources().getDimensionPixelSize(R.dimen.path_row_height) / 2;
} else {
if (i != 3) {
throw new NoWhenBranchMatchedException();
}
dimensionPixelSize = getResources().getDimensionPixelSize(R.dimen.path_row_height);
}
RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(1, dimensionPixelSize);
Location location3 = this.location;
if (location3 == null) {
Intrinsics.throwUninitializedPropertyAccessException("location");
} else {
location2 = location3;
}
int i2 = WhenMappings.$EnumSwitchMapping$0[location2.ordinal()];
if (i2 == 1) {
layoutParams.addRule(12);
} else if (i2 == 2 || i2 == 3) {
layoutParams.addRule(10);
}
layoutParams.addRule(14);
view.setLayoutParams(layoutParams);
addView(view);
int dimensionPixelSize2 = getResources().getDimensionPixelSize(R.dimen.path_row_dot_size);
RelativeLayout.LayoutParams layoutParams2 = new RelativeLayout.LayoutParams(dimensionPixelSize2, dimensionPixelSize2);
layoutParams2.addRule(13);
getDotView().setLayoutParams(layoutParams2);
addView(getDotView());
new Handler().postDelayed(new Runnable() {
@Override
public final void run() {
PathActivity.LineView.setUpViewHierarchy$lambda$0(PathActivity.LineView.this);
}
}, this.dotAnimationStartDelay);
}
public static final void setUpViewHierarchy$lambda$0(LineView this$0) {
Intrinsics.checkNotNullParameter(this$0, "this$0");
this$0.performAnimation();
}
private final void performAnimation() {
expand();
new Handler().postDelayed(new Runnable() {
@Override
public final void run() {
PathActivity.LineView.performAnimation$lambda$2(PathActivity.LineView.this);
}
}, 1000L);
}
public static final void performAnimation$lambda$2(final LineView this$0) {
Intrinsics.checkNotNullParameter(this$0, "this$0");
this$0.collapse();
new Handler().postDelayed(new Runnable() {
@Override
public final void run() {
PathActivity.LineView.performAnimation$lambda$2$lambda$1(PathActivity.LineView.this);
}
}, this$0.dotAnimationRepeatInterval);
}
public static final void performAnimation$lambda$2$lambda$1(LineView this$0) {
Intrinsics.checkNotNullParameter(this$0, "this$0");
this$0.performAnimation();
}
private final void expand() {
ViewUtilitiesKt.animateSizeChange$default((View) getDotView(), R.dimen.path_row_dot_size, R.dimen.path_row_expanded_dot_size, 0L, 4, (Object) null);
Context context = getContext();
Intrinsics.checkNotNullExpressionValue(context, "context");
int i = UiModeUtilities.isDayUiMode(context) ? R.color.transparent_black_30 : R.color.black;
Resources resources = getContext().getResources();
Intrinsics.checkNotNullExpressionValue(resources, "context.resources");
int colorWithID = GeneralUtilitiesKt.getColorWithID(resources, i, getContext().getTheme());
Context context2 = getContext();
Intrinsics.checkNotNullExpressionValue(context2, "context");
GlowViewUtilities.animateShadowColorChange$default(GlowViewUtilities.INSTANCE, getDotView(), colorWithID, ViewUtilitiesKt.getAccentColor(context2), 0L, 8, null);
}
private final void collapse() {
ViewUtilitiesKt.animateSizeChange$default((View) getDotView(), R.dimen.path_row_expanded_dot_size, R.dimen.path_row_dot_size, 0L, 4, (Object) null);
Context context = getContext();
Intrinsics.checkNotNullExpressionValue(context, "context");
int i = UiModeUtilities.isDayUiMode(context) ? R.color.transparent_black_30 : R.color.black;
Context context2 = getContext();
Intrinsics.checkNotNullExpressionValue(context2, "context");
int accentColor = ViewUtilitiesKt.getAccentColor(context2);
Resources resources = getContext().getResources();
Intrinsics.checkNotNullExpressionValue(resources, "context.resources");
GlowViewUtilities.animateShadowColorChange$default(GlowViewUtilities.INSTANCE, getDotView(), accentColor, GeneralUtilitiesKt.getColorWithID(resources, i, getContext().getTheme()), 0L, 8, null);
}
}
}