Rabbit-R1/android (non root)/java/sources/androidx/navigation/NavDestinationBuilder.java
2024-05-21 17:08:36 -04:00

128 lines
8.5 KiB
Java

package androidx.navigation;
import androidx.navigation.NavDestination;
import io.sentry.protocol.OperatingSystem;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import kotlin.Deprecated;
import kotlin.Metadata;
import kotlin.ReplaceWith;
import kotlin.Unit;
import kotlin.jvm.functions.Function1;
import kotlin.jvm.internal.Intrinsics;
/* compiled from: NavDestinationBuilder.kt */
@NavDestinationDsl
@Metadata(d1 = {"\u0000r\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\b\n\u0002\b\u0002\n\u0002\u0010\u000e\n\u0002\b\u0003\n\u0002\u0010%\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010!\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0010\r\n\u0002\b\t\n\u0002\u0010\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\u0004\n\u0002\u0018\u0002\n\u0002\b\u0002\b\u0017\u0018\u0000*\n\b\u0000\u0010\u0001 \u0001*\u00020\u00022\u00020\u0003B!\b\u0017\u0012\u000e\u0010\u0004\u001a\n\u0012\u0006\b\u0001\u0012\u00028\u00000\u0005\u0012\b\b\u0001\u0010\u0006\u001a\u00020\u0007¢\u0006\u0002\u0010\bB!\b\u0016\u0012\u000e\u0010\u0004\u001a\n\u0012\u0006\b\u0001\u0012\u00028\u00000\u0005\u0012\b\u0010\t\u001a\u0004\u0018\u00010\\u0006\u0002\u0010\u000bB+\b\u0000\u0012\u000e\u0010\u0004\u001a\n\u0012\u0006\b\u0001\u0012\u00028\u00000\u0005\u0012\b\b\u0001\u0010\u0006\u001a\u00020\u0007\u0012\b\u0010\t\u001a\u0004\u0018\u00010\\u0006\u0002\u0010\fJ)\u0010!\u001a\u00020\"2\u0006\u0010#\u001a\u00020\u00072\u0017\u0010$\u001a\u0013\u0012\u0004\u0012\u00020&\u0012\u0004\u0012\u00020\"0%¢\u0006\u0002\b'H\u0007J'\u0010(\u001a\u00020\"2\u0006\u0010)\u001a\u00020\n2\u0017\u0010*\u001a\u0013\u0012\u0004\u0012\u00020+\u0012\u0004\u0012\u00020\"0%¢\u0006\u0002\b'J\r\u0010,\u001a\u00028\u0000H\u0016¢\u0006\u0002\u0010-J\u001f\u0010.\u001a\u00020\"2\u0017\u0010/\u001a\u0013\u0012\u0004\u0012\u000200\u0012\u0004\u0012\u00020\"0%¢\u0006\u0002\b'J\u000e\u0010.\u001a\u00020\"2\u0006\u00101\u001a\u00020\nR\u001a\u0010\r\u001a\u000e\u0012\u0004\u0012\u00020\u0007\u0012\u0004\u0012\u00020\u000f0\u000eX\u0082\u000e¢\u0006\u0002\n\u0000R\u001a\u0010\u0010\u001a\u000e\u0012\u0004\u0012\u00020\n\u0012\u0004\u0012\u00020\u00110\u000eX\u0082\u000e¢\u0006\u0002\n\u0000R\u0014\u0010\u0012\u001a\b\u0012\u0004\u0012\u00020\u00140\u0013X\u0082\u000e¢\u0006\u0002\n\u0000R\u0011\u0010\u0006\u001a\u00020\u0007¢\u0006\b\n\u0000\u001a\u0004\b\u0015\u0010\u0016R\u001c\u0010\u0017\u001a\u0004\u0018\u00010\u0018X\u0086\u000e¢\u0006\u000e\n\u0000\u001a\u0004\b\u0019\u0010\u001a\"\u0004\b\u001b\u0010\u001cR\u001c\u0010\u0004\u001a\n\u0012\u0006\b\u0001\u0012\u00028\u00000\u0005X\u0084\u0004¢\u0006\b\n\u0000\u001a\u0004\b\u001d\u0010\u001eR\u0013\u0010\t\u001a\u0004\u0018\u00010\\u0006\b\n\u0000\u001a\u0004\b\u001f\u0010 ¨\u00062"}, d2 = {"Landroidx/navigation/NavDestinationBuilder;", "D", "Landroidx/navigation/NavDestination;", "", "navigator", "Landroidx/navigation/Navigator;", "id", "", "(Landroidx/navigation/Navigator;I)V", "route", "", "(Landroidx/navigation/Navigator;Ljava/lang/String;)V", "(Landroidx/navigation/Navigator;ILjava/lang/String;)V", "actions", "", "Landroidx/navigation/NavAction;", "arguments", "Landroidx/navigation/NavArgument;", "deepLinks", "", "Landroidx/navigation/NavDeepLink;", "getId", "()I", "label", "", "getLabel", "()Ljava/lang/CharSequence;", "setLabel", "(Ljava/lang/CharSequence;)V", "getNavigator", "()Landroidx/navigation/Navigator;", "getRoute", "()Ljava/lang/String;", "action", "", "actionId", "actionBuilder", "Lkotlin/Function1;", "Landroidx/navigation/NavActionBuilder;", "Lkotlin/ExtensionFunctionType;", "argument", "name", "argumentBuilder", "Landroidx/navigation/NavArgumentBuilder;", OperatingSystem.JsonKeys.BUILD, "()Landroidx/navigation/NavDestination;", "deepLink", "navDeepLink", "Landroidx/navigation/NavDeepLinkDslBuilder;", "uriPattern", "navigation-common_release"}, k = 1, mv = {1, 8, 0}, xi = 48)
/* loaded from: classes2.dex */
public class NavDestinationBuilder<D extends NavDestination> {
private Map<Integer, NavAction> actions;
private Map<String, NavArgument> arguments;
private List<NavDeepLink> deepLinks;
private final int id;
private CharSequence label;
private final Navigator<? extends D> navigator;
private final String route;
public final int getId() {
return this.id;
}
public final CharSequence getLabel() {
return this.label;
}
protected final Navigator<? extends D> getNavigator() {
return this.navigator;
}
public final String getRoute() {
return this.route;
}
public final void setLabel(CharSequence charSequence) {
this.label = charSequence;
}
public NavDestinationBuilder(Navigator<? extends D> navigator, int i, String str) {
Intrinsics.checkNotNullParameter(navigator, "navigator");
this.navigator = navigator;
this.id = i;
this.route = str;
this.arguments = new LinkedHashMap();
this.deepLinks = new ArrayList();
this.actions = new LinkedHashMap();
}
/* JADX WARN: 'this' call moved to the top of the method (can break code semantics) */
@Deprecated(message = "Use routes to build your NavDestination instead", replaceWith = @ReplaceWith(expression = "NavDestinationBuilder(navigator, route = id.toString())", imports = {}))
public NavDestinationBuilder(Navigator<? extends D> navigator, int i) {
this(navigator, i, null);
Intrinsics.checkNotNullParameter(navigator, "navigator");
}
/* JADX WARN: 'this' call moved to the top of the method (can break code semantics) */
public NavDestinationBuilder(Navigator<? extends D> navigator, String str) {
this(navigator, -1, str);
Intrinsics.checkNotNullParameter(navigator, "navigator");
}
public final void argument(String name, Function1<? super NavArgumentBuilder, Unit> argumentBuilder) {
Intrinsics.checkNotNullParameter(name, "name");
Intrinsics.checkNotNullParameter(argumentBuilder, "argumentBuilder");
Map<String, NavArgument> map = this.arguments;
NavArgumentBuilder navArgumentBuilder = new NavArgumentBuilder();
argumentBuilder.invoke(navArgumentBuilder);
map.put(name, navArgumentBuilder.build());
}
public final void deepLink(String uriPattern) {
Intrinsics.checkNotNullParameter(uriPattern, "uriPattern");
this.deepLinks.add(new NavDeepLink(uriPattern));
}
public final void deepLink(Function1<? super NavDeepLinkDslBuilder, Unit> navDeepLink) {
Intrinsics.checkNotNullParameter(navDeepLink, "navDeepLink");
List<NavDeepLink> list = this.deepLinks;
NavDeepLinkDslBuilder navDeepLinkDslBuilder = new NavDeepLinkDslBuilder();
navDeepLink.invoke(navDeepLinkDslBuilder);
list.add(navDeepLinkDslBuilder.build$navigation_common_release());
}
@Deprecated(message = "Building NavDestinations using IDs with the Kotlin DSL has been deprecated in favor of using routes. When using routes there is no need for actions.")
public final void action(int actionId, Function1<? super NavActionBuilder, Unit> actionBuilder) {
Intrinsics.checkNotNullParameter(actionBuilder, "actionBuilder");
Map<Integer, NavAction> map = this.actions;
Integer valueOf = Integer.valueOf(actionId);
NavActionBuilder navActionBuilder = new NavActionBuilder();
actionBuilder.invoke(navActionBuilder);
map.put(valueOf, navActionBuilder.build$navigation_common_release());
}
public D build() {
D createDestination = this.navigator.createDestination();
createDestination.setLabel(this.label);
for (Map.Entry<String, NavArgument> entry : this.arguments.entrySet()) {
createDestination.addArgument(entry.getKey(), entry.getValue());
}
Iterator<T> it = this.deepLinks.iterator();
while (it.hasNext()) {
createDestination.addDeepLink((NavDeepLink) it.next());
}
for (Map.Entry<Integer, NavAction> entry2 : this.actions.entrySet()) {
createDestination.putAction(entry2.getKey().intValue(), entry2.getValue());
}
String str = this.route;
if (str != null) {
createDestination.setRoute(str);
}
int i = this.id;
if (i != -1) {
createDestination.setId(i);
}
return createDestination;
}
}