Files
rr3-apk/decompiled-community/sources/com/facebook/FacebookButtonBase.java
Daniel Elliott c080f0d97f Add Discord community version (64-bit only)
- Added realracing3-community.apk (71.57 MB)
- Removed 32-bit support (armeabi-v7a)
- Only includes arm64-v8a libraries
- Decompiled source code included
- Added README-community.md with analysis
2026-02-18 15:48:36 -08:00

487 lines
19 KiB
Java

package com.facebook;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.app.Fragment;
import android.content.ComponentCallbacks2;
import android.content.Context;
import android.content.ContextWrapper;
import android.content.res.TypedArray;
import android.graphics.Canvas;
import android.graphics.Typeface;
import android.util.AttributeSet;
import android.view.View;
import android.widget.Button;
import androidx.activity.result.ActivityResultRegistryOwner;
import androidx.core.content.ContextCompat;
import com.facebook.appevents.InternalAppEventsLogger;
import com.facebook.internal.FragmentWrapper;
import com.facebook.internal.instrument.crashshield.CrashShieldHandler;
import kotlin.jvm.internal.Intrinsics;
@SuppressLint({"ResourceType"})
/* loaded from: classes2.dex */
public abstract class FacebookButtonBase extends Button {
private final String analyticsButtonCreatedEventName;
private final String analyticsButtonTappedEventName;
private final int defaultStyleResource;
private View.OnClickListener externalOnClickListener;
private View.OnClickListener internalOnClickListener;
private boolean overrideCompoundPadding;
private int overrideCompoundPaddingLeft;
private int overrideCompoundPaddingRight;
private FragmentWrapper parentFragment;
public abstract int getDefaultRequestCode();
/* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
public FacebookButtonBase(Context context, AttributeSet attributeSet, int i, int i2, String analyticsButtonCreatedEventName, String analyticsButtonTappedEventName) {
super(context, attributeSet, 0);
Intrinsics.checkNotNullParameter(context, "context");
Intrinsics.checkNotNullParameter(analyticsButtonCreatedEventName, "analyticsButtonCreatedEventName");
Intrinsics.checkNotNullParameter(analyticsButtonTappedEventName, "analyticsButtonTappedEventName");
i2 = i2 == 0 ? getDefaultStyleResource() : i2;
configureButton(context, attributeSet, i, i2 == 0 ? com.facebook.common.R.style.com_facebook_button : i2);
this.analyticsButtonCreatedEventName = analyticsButtonCreatedEventName;
this.analyticsButtonTappedEventName = analyticsButtonTappedEventName;
setClickable(true);
setFocusable(true);
}
public final String getAnalyticsButtonCreatedEventName() {
if (CrashShieldHandler.isObjectCrashing(this)) {
return null;
}
try {
return this.analyticsButtonCreatedEventName;
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, this);
return null;
}
}
public final String getAnalyticsButtonTappedEventName() {
if (CrashShieldHandler.isObjectCrashing(this)) {
return null;
}
try {
return this.analyticsButtonTappedEventName;
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, this);
return null;
}
}
public final Fragment getNativeFragment() {
if (CrashShieldHandler.isObjectCrashing(this)) {
return null;
}
try {
FragmentWrapper fragmentWrapper = this.parentFragment;
if (fragmentWrapper == null) {
return null;
}
return fragmentWrapper.getNativeFragment();
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, this);
return null;
}
}
public final void setFragment(Fragment fragment) {
if (CrashShieldHandler.isObjectCrashing(this)) {
return;
}
try {
Intrinsics.checkNotNullParameter(fragment, "fragment");
this.parentFragment = new FragmentWrapper(fragment);
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, this);
}
}
public final androidx.fragment.app.Fragment getFragment() {
if (CrashShieldHandler.isObjectCrashing(this)) {
return null;
}
try {
FragmentWrapper fragmentWrapper = this.parentFragment;
if (fragmentWrapper == null) {
return null;
}
return fragmentWrapper.getSupportFragment();
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, this);
return null;
}
}
public final void setFragment(androidx.fragment.app.Fragment fragment) {
if (CrashShieldHandler.isObjectCrashing(this)) {
return;
}
try {
Intrinsics.checkNotNullParameter(fragment, "fragment");
this.parentFragment = new FragmentWrapper(fragment);
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, this);
}
}
public final ActivityResultRegistryOwner getAndroidxActivityResultRegistryOwner() {
if (CrashShieldHandler.isObjectCrashing(this)) {
return null;
}
try {
ComponentCallbacks2 activity = getActivity();
if (activity instanceof ActivityResultRegistryOwner) {
return (ActivityResultRegistryOwner) activity;
}
return null;
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, this);
return null;
}
}
@Override // android.view.View
public void setOnClickListener(View.OnClickListener onClickListener) {
if (CrashShieldHandler.isObjectCrashing(this)) {
return;
}
try {
this.externalOnClickListener = onClickListener;
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, this);
}
}
public int getRequestCode() {
if (CrashShieldHandler.isObjectCrashing(this)) {
return 0;
}
try {
return getDefaultRequestCode();
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, this);
return 0;
}
}
@Override // android.widget.TextView, android.view.View
public void onAttachedToWindow() {
if (CrashShieldHandler.isObjectCrashing(this)) {
return;
}
try {
super.onAttachedToWindow();
if (isInEditMode()) {
return;
}
logButtonCreated(getContext());
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, this);
}
}
@Override // android.widget.TextView, android.view.View
public void onDraw(Canvas canvas) {
if (CrashShieldHandler.isObjectCrashing(this)) {
return;
}
try {
Intrinsics.checkNotNullParameter(canvas, "canvas");
if ((getGravity() & 1) != 0) {
int compoundPaddingLeft = getCompoundPaddingLeft();
int compoundPaddingRight = getCompoundPaddingRight();
int min = Math.min((((getWidth() - (getCompoundDrawablePadding() + compoundPaddingLeft)) - compoundPaddingRight) - measureTextWidth(getText().toString())) / 2, (compoundPaddingLeft - getPaddingLeft()) / 2);
this.overrideCompoundPaddingLeft = compoundPaddingLeft - min;
this.overrideCompoundPaddingRight = compoundPaddingRight + min;
this.overrideCompoundPadding = true;
}
super.onDraw(canvas);
this.overrideCompoundPadding = false;
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, this);
}
}
@Override // android.widget.TextView
public int getCompoundPaddingLeft() {
if (CrashShieldHandler.isObjectCrashing(this)) {
return 0;
}
try {
return this.overrideCompoundPadding ? this.overrideCompoundPaddingLeft : super.getCompoundPaddingLeft();
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, this);
return 0;
}
}
@Override // android.widget.TextView
public int getCompoundPaddingRight() {
if (CrashShieldHandler.isObjectCrashing(this)) {
return 0;
}
try {
return this.overrideCompoundPadding ? this.overrideCompoundPaddingRight : super.getCompoundPaddingRight();
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, this);
return 0;
}
}
public Activity getActivity() {
if (CrashShieldHandler.isObjectCrashing(this)) {
return null;
}
try {
Context context = getContext();
while (!(context instanceof Activity) && (context instanceof ContextWrapper)) {
context = ((ContextWrapper) context).getBaseContext();
}
if (context instanceof Activity) {
return (Activity) context;
}
throw new FacebookException("Unable to get Activity.");
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, this);
return null;
}
}
public int getDefaultStyleResource() {
if (CrashShieldHandler.isObjectCrashing(this)) {
return 0;
}
try {
return this.defaultStyleResource;
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, this);
return 0;
}
}
public int measureTextWidth(String str) {
if (CrashShieldHandler.isObjectCrashing(this)) {
return 0;
}
try {
return (int) Math.ceil(getPaint().measureText(str));
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, this);
return 0;
}
}
public void configureButton(Context context, AttributeSet attributeSet, int i, int i2) {
if (CrashShieldHandler.isObjectCrashing(this)) {
return;
}
try {
Intrinsics.checkNotNullParameter(context, "context");
parseBackgroundAttributes(context, attributeSet, i, i2);
parseCompoundDrawableAttributes(context, attributeSet, i, i2);
parseContentAttributes(context, attributeSet, i, i2);
parseTextAttributes(context, attributeSet, i, i2);
setupOnClickListener();
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, this);
}
}
public void callExternalOnClickListener(View view) {
if (CrashShieldHandler.isObjectCrashing(this)) {
return;
}
try {
View.OnClickListener onClickListener = this.externalOnClickListener;
if (onClickListener == null) {
return;
}
onClickListener.onClick(view);
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, this);
}
}
public void setInternalOnClickListener(View.OnClickListener onClickListener) {
if (CrashShieldHandler.isObjectCrashing(this)) {
return;
}
try {
this.internalOnClickListener = onClickListener;
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, this);
}
}
public void logButtonCreated(Context context) {
if (CrashShieldHandler.isObjectCrashing(this)) {
return;
}
try {
InternalAppEventsLogger.Companion.createInstance(context, null).logEventImplicitly(this.analyticsButtonCreatedEventName);
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, this);
}
}
public void logButtonTapped(Context context) {
if (CrashShieldHandler.isObjectCrashing(this)) {
return;
}
try {
InternalAppEventsLogger.Companion.createInstance(context, null).logEventImplicitly(this.analyticsButtonTappedEventName);
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, this);
}
}
private final void parseBackgroundAttributes(Context context, AttributeSet attributeSet, int i, int i2) {
if (CrashShieldHandler.isObjectCrashing(this)) {
return;
}
try {
if (isInEditMode()) {
return;
}
TypedArray obtainStyledAttributes = context.getTheme().obtainStyledAttributes(attributeSet, new int[]{android.R.attr.background}, i, i2);
Intrinsics.checkNotNullExpressionValue(obtainStyledAttributes, "context.theme.obtainStyledAttributes(attrs, attrsResources, defStyleAttr, defStyleRes)");
try {
if (obtainStyledAttributes.hasValue(0)) {
int resourceId = obtainStyledAttributes.getResourceId(0, 0);
if (resourceId != 0) {
setBackgroundResource(resourceId);
} else {
setBackgroundColor(obtainStyledAttributes.getColor(0, 0));
}
} else {
setBackgroundColor(ContextCompat.getColor(context, com.facebook.common.R.color.com_facebook_blue));
}
obtainStyledAttributes.recycle();
} catch (Throwable th) {
obtainStyledAttributes.recycle();
throw th;
}
} catch (Throwable th2) {
CrashShieldHandler.handleThrowable(th2, this);
}
}
@SuppressLint({"ResourceType"})
private final void parseCompoundDrawableAttributes(Context context, AttributeSet attributeSet, int i, int i2) {
if (CrashShieldHandler.isObjectCrashing(this)) {
return;
}
try {
TypedArray obtainStyledAttributes = context.getTheme().obtainStyledAttributes(attributeSet, new int[]{android.R.attr.drawableLeft, android.R.attr.drawableTop, android.R.attr.drawableRight, android.R.attr.drawableBottom, android.R.attr.drawablePadding}, i, i2);
Intrinsics.checkNotNullExpressionValue(obtainStyledAttributes, "context.theme.obtainStyledAttributes(attrs, attrsResources, defStyleAttr, defStyleRes)");
try {
setCompoundDrawablesWithIntrinsicBounds(obtainStyledAttributes.getResourceId(0, 0), obtainStyledAttributes.getResourceId(1, 0), obtainStyledAttributes.getResourceId(2, 0), obtainStyledAttributes.getResourceId(3, 0));
int dimensionPixelSize = obtainStyledAttributes.getDimensionPixelSize(4, 0);
obtainStyledAttributes.recycle();
setCompoundDrawablePadding(dimensionPixelSize);
} catch (Throwable th) {
obtainStyledAttributes.recycle();
throw th;
}
} catch (Throwable th2) {
CrashShieldHandler.handleThrowable(th2, this);
}
}
private final void parseContentAttributes(Context context, AttributeSet attributeSet, int i, int i2) {
if (CrashShieldHandler.isObjectCrashing(this)) {
return;
}
try {
TypedArray obtainStyledAttributes = context.getTheme().obtainStyledAttributes(attributeSet, new int[]{android.R.attr.paddingLeft, android.R.attr.paddingTop, android.R.attr.paddingRight, android.R.attr.paddingBottom}, i, i2);
Intrinsics.checkNotNullExpressionValue(obtainStyledAttributes, "context.theme.obtainStyledAttributes(attrs, attrsResources, defStyleAttr, defStyleRes)");
try {
setPadding(obtainStyledAttributes.getDimensionPixelSize(0, 0), obtainStyledAttributes.getDimensionPixelSize(1, 0), obtainStyledAttributes.getDimensionPixelSize(2, 0), obtainStyledAttributes.getDimensionPixelSize(3, 0));
} finally {
obtainStyledAttributes.recycle();
}
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, this);
}
}
private final void parseTextAttributes(Context context, AttributeSet attributeSet, int i, int i2) {
if (CrashShieldHandler.isObjectCrashing(this)) {
return;
}
try {
TypedArray obtainStyledAttributes = context.getTheme().obtainStyledAttributes(attributeSet, new int[]{android.R.attr.textColor}, i, i2);
Intrinsics.checkNotNullExpressionValue(obtainStyledAttributes, "context.theme.obtainStyledAttributes(attrs, colorResources, defStyleAttr, defStyleRes)");
try {
setTextColor(obtainStyledAttributes.getColorStateList(0));
obtainStyledAttributes.recycle();
obtainStyledAttributes = context.getTheme().obtainStyledAttributes(attributeSet, new int[]{android.R.attr.gravity}, i, i2);
Intrinsics.checkNotNullExpressionValue(obtainStyledAttributes, "context.theme.obtainStyledAttributes(attrs, gravityResources, defStyleAttr, defStyleRes)");
try {
int i3 = obtainStyledAttributes.getInt(0, 17);
obtainStyledAttributes.recycle();
setGravity(i3);
obtainStyledAttributes = context.getTheme().obtainStyledAttributes(attributeSet, new int[]{android.R.attr.textSize, android.R.attr.textStyle, android.R.attr.text}, i, i2);
Intrinsics.checkNotNullExpressionValue(obtainStyledAttributes, "context.theme.obtainStyledAttributes(attrs, attrsResources, defStyleAttr, defStyleRes)");
try {
setTextSize(0, obtainStyledAttributes.getDimensionPixelSize(0, 0));
setTypeface(Typeface.create(getTypeface(), 1));
String string = obtainStyledAttributes.getString(2);
obtainStyledAttributes.recycle();
setText(string);
} finally {
}
} finally {
}
} finally {
}
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, this);
}
}
private final void setupOnClickListener() {
if (CrashShieldHandler.isObjectCrashing(this)) {
return;
}
try {
super.setOnClickListener(new View.OnClickListener() { // from class: com.facebook.FacebookButtonBase$$ExternalSyntheticLambda0
@Override // android.view.View.OnClickListener
public final void onClick(View view) {
FacebookButtonBase.m420setupOnClickListener$lambda0(FacebookButtonBase.this, view);
}
});
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, this);
}
}
/* JADX INFO: Access modifiers changed from: private */
/* renamed from: setupOnClickListener$lambda-0, reason: not valid java name */
public static final void m420setupOnClickListener$lambda0(FacebookButtonBase this$0, View view) {
if (CrashShieldHandler.isObjectCrashing(FacebookButtonBase.class)) {
return;
}
try {
Intrinsics.checkNotNullParameter(this$0, "this$0");
this$0.logButtonTapped(this$0.getContext());
View.OnClickListener onClickListener = this$0.internalOnClickListener;
if (onClickListener != null) {
onClickListener.onClick(view);
return;
}
View.OnClickListener onClickListener2 = this$0.externalOnClickListener;
if (onClickListener2 == null) {
return;
}
onClickListener2.onClick(view);
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, FacebookButtonBase.class);
}
}
}