645 lines
25 KiB
Java
645 lines
25 KiB
Java
package androidx.fragment.app;
|
|
|
|
import android.app.Activity;
|
|
import android.content.Context;
|
|
import android.content.Intent;
|
|
import android.content.IntentSender;
|
|
import android.content.res.Configuration;
|
|
import android.os.Build;
|
|
import android.os.Bundle;
|
|
import android.os.Handler;
|
|
import android.os.Message;
|
|
import android.os.Parcelable;
|
|
import android.util.AttributeSet;
|
|
import android.util.Log;
|
|
import android.view.LayoutInflater;
|
|
import android.view.Menu;
|
|
import android.view.MenuItem;
|
|
import android.view.View;
|
|
import android.view.Window;
|
|
import androidx.collection.SparseArrayCompat;
|
|
import androidx.core.app.ActivityCompat;
|
|
import androidx.core.app.ComponentActivity;
|
|
import androidx.core.app.SharedElementCallback;
|
|
import androidx.lifecycle.Lifecycle;
|
|
import androidx.lifecycle.ViewModelStore;
|
|
import androidx.lifecycle.ViewModelStoreOwner;
|
|
import androidx.loader.app.LoaderManager;
|
|
import java.io.FileDescriptor;
|
|
import java.io.PrintWriter;
|
|
|
|
/* loaded from: classes.dex */
|
|
public class FragmentActivity extends ComponentActivity implements ViewModelStoreOwner, ActivityCompat.OnRequestPermissionsResultCallback, ActivityCompat.RequestPermissionsRequestCodeValidator {
|
|
static final String ALLOCATED_REQUEST_INDICIES_TAG = "android:support:request_indicies";
|
|
static final String FRAGMENTS_TAG = "android:support:fragments";
|
|
static final int MAX_NUM_PENDING_FRAGMENT_ACTIVITY_RESULTS = 65534;
|
|
static final int MSG_RESUME_PENDING = 2;
|
|
static final String NEXT_CANDIDATE_REQUEST_INDEX_TAG = "android:support:next_request_index";
|
|
static final String REQUEST_FRAGMENT_WHO_TAG = "android:support:request_fragment_who";
|
|
private static final String TAG = "FragmentActivity";
|
|
boolean mCreated;
|
|
int mNextCandidateRequestIndex;
|
|
SparseArrayCompat<String> mPendingFragmentActivityResults;
|
|
boolean mRequestedPermissionsFromFragment;
|
|
boolean mResumed;
|
|
boolean mStartedActivityFromFragment;
|
|
boolean mStartedIntentSenderFromFragment;
|
|
private ViewModelStore mViewModelStore;
|
|
final Handler mHandler = new Handler() { // from class: androidx.fragment.app.FragmentActivity.1
|
|
@Override // android.os.Handler
|
|
public void handleMessage(Message message) {
|
|
if (message.what != 2) {
|
|
super.handleMessage(message);
|
|
} else {
|
|
FragmentActivity.this.onResumeFragments();
|
|
FragmentActivity.this.mFragments.i();
|
|
}
|
|
}
|
|
};
|
|
final FragmentController mFragments = FragmentController.a(new HostCallbacks());
|
|
boolean mStopped = true;
|
|
|
|
class HostCallbacks extends FragmentHostCallback<FragmentActivity> {
|
|
public HostCallbacks() {
|
|
super(FragmentActivity.this);
|
|
}
|
|
|
|
@Override // androidx.fragment.app.FragmentHostCallback
|
|
public void a(String str, FileDescriptor fileDescriptor, PrintWriter printWriter, String[] strArr) {
|
|
FragmentActivity.this.dump(str, fileDescriptor, printWriter, strArr);
|
|
}
|
|
|
|
@Override // androidx.fragment.app.FragmentHostCallback
|
|
public boolean b(Fragment fragment) {
|
|
return !FragmentActivity.this.isFinishing();
|
|
}
|
|
|
|
@Override // androidx.fragment.app.FragmentHostCallback
|
|
public LayoutInflater g() {
|
|
return FragmentActivity.this.getLayoutInflater().cloneInContext(FragmentActivity.this);
|
|
}
|
|
|
|
@Override // androidx.fragment.app.FragmentHostCallback
|
|
public int h() {
|
|
Window window = FragmentActivity.this.getWindow();
|
|
if (window == null) {
|
|
return 0;
|
|
}
|
|
return window.getAttributes().windowAnimations;
|
|
}
|
|
|
|
@Override // androidx.fragment.app.FragmentHostCallback
|
|
public boolean i() {
|
|
return FragmentActivity.this.getWindow() != null;
|
|
}
|
|
|
|
@Override // androidx.fragment.app.FragmentHostCallback
|
|
public void j() {
|
|
FragmentActivity.this.supportInvalidateOptionsMenu();
|
|
}
|
|
|
|
@Override // androidx.fragment.app.FragmentHostCallback
|
|
public void a(Fragment fragment, Intent intent, int i, Bundle bundle) {
|
|
FragmentActivity.this.startActivityFromFragment(fragment, intent, i, bundle);
|
|
}
|
|
|
|
/* JADX WARN: Can't rename method to resolve collision */
|
|
@Override // androidx.fragment.app.FragmentHostCallback
|
|
public FragmentActivity f() {
|
|
return FragmentActivity.this;
|
|
}
|
|
|
|
@Override // androidx.fragment.app.FragmentHostCallback
|
|
public void a(Fragment fragment, IntentSender intentSender, int i, Intent intent, int i2, int i3, int i4, Bundle bundle) throws IntentSender.SendIntentException {
|
|
FragmentActivity.this.startIntentSenderFromFragment(fragment, intentSender, i, intent, i2, i3, i4, bundle);
|
|
}
|
|
|
|
@Override // androidx.fragment.app.FragmentHostCallback
|
|
public void a(Fragment fragment, String[] strArr, int i) {
|
|
FragmentActivity.this.requestPermissionsFromFragment(fragment, strArr, i);
|
|
}
|
|
|
|
@Override // androidx.fragment.app.FragmentHostCallback
|
|
public boolean a(String str) {
|
|
return ActivityCompat.a((Activity) FragmentActivity.this, str);
|
|
}
|
|
|
|
@Override // androidx.fragment.app.FragmentHostCallback
|
|
public void a(Fragment fragment) {
|
|
FragmentActivity.this.onAttachFragment(fragment);
|
|
}
|
|
|
|
@Override // androidx.fragment.app.FragmentContainer
|
|
public View a(int i) {
|
|
return FragmentActivity.this.findViewById(i);
|
|
}
|
|
|
|
@Override // androidx.fragment.app.FragmentContainer
|
|
public boolean a() {
|
|
Window window = FragmentActivity.this.getWindow();
|
|
return (window == null || window.peekDecorView() == null) ? false : true;
|
|
}
|
|
}
|
|
|
|
static final class NonConfigurationInstances {
|
|
Object a;
|
|
ViewModelStore b;
|
|
FragmentManagerNonConfig c;
|
|
|
|
NonConfigurationInstances() {
|
|
}
|
|
}
|
|
|
|
private int allocateRequestIndex(Fragment fragment) {
|
|
if (this.mPendingFragmentActivityResults.b() >= MAX_NUM_PENDING_FRAGMENT_ACTIVITY_RESULTS) {
|
|
throw new IllegalStateException("Too many pending Fragment activity results.");
|
|
}
|
|
while (this.mPendingFragmentActivityResults.c(this.mNextCandidateRequestIndex) >= 0) {
|
|
this.mNextCandidateRequestIndex = (this.mNextCandidateRequestIndex + 1) % MAX_NUM_PENDING_FRAGMENT_ACTIVITY_RESULTS;
|
|
}
|
|
int i = this.mNextCandidateRequestIndex;
|
|
this.mPendingFragmentActivityResults.c(i, fragment.mWho);
|
|
this.mNextCandidateRequestIndex = (this.mNextCandidateRequestIndex + 1) % MAX_NUM_PENDING_FRAGMENT_ACTIVITY_RESULTS;
|
|
return i;
|
|
}
|
|
|
|
static void checkForValidRequestCode(int i) {
|
|
if ((i & (-65536)) != 0) {
|
|
throw new IllegalArgumentException("Can only use lower 16 bits for requestCode");
|
|
}
|
|
}
|
|
|
|
private void markFragmentsCreated() {
|
|
while (markState(getSupportFragmentManager(), Lifecycle.State.CREATED)) {
|
|
}
|
|
}
|
|
|
|
private static boolean markState(FragmentManager fragmentManager, Lifecycle.State state) {
|
|
boolean z = false;
|
|
for (Fragment fragment : fragmentManager.b()) {
|
|
if (fragment != null) {
|
|
if (fragment.getLifecycle().a().isAtLeast(Lifecycle.State.STARTED)) {
|
|
fragment.mLifecycleRegistry.a(state);
|
|
z = true;
|
|
}
|
|
FragmentManager peekChildFragmentManager = fragment.peekChildFragmentManager();
|
|
if (peekChildFragmentManager != null) {
|
|
z |= markState(peekChildFragmentManager, state);
|
|
}
|
|
}
|
|
}
|
|
return z;
|
|
}
|
|
|
|
final View dispatchFragmentsOnCreateView(View view, String str, Context context, AttributeSet attributeSet) {
|
|
return this.mFragments.a(view, str, context, attributeSet);
|
|
}
|
|
|
|
@Override // android.app.Activity
|
|
public void dump(String str, FileDescriptor fileDescriptor, PrintWriter printWriter, String[] strArr) {
|
|
super.dump(str, fileDescriptor, printWriter, strArr);
|
|
printWriter.print(str);
|
|
printWriter.print("Local FragmentActivity ");
|
|
printWriter.print(Integer.toHexString(System.identityHashCode(this)));
|
|
printWriter.println(" State:");
|
|
String str2 = str + " ";
|
|
printWriter.print(str2);
|
|
printWriter.print("mCreated=");
|
|
printWriter.print(this.mCreated);
|
|
printWriter.print(" mResumed=");
|
|
printWriter.print(this.mResumed);
|
|
printWriter.print(" mStopped=");
|
|
printWriter.print(this.mStopped);
|
|
if (getApplication() != null) {
|
|
LoaderManager.a(this).a(str2, fileDescriptor, printWriter, strArr);
|
|
}
|
|
this.mFragments.j().a(str, fileDescriptor, printWriter, strArr);
|
|
}
|
|
|
|
public Object getLastCustomNonConfigurationInstance() {
|
|
NonConfigurationInstances nonConfigurationInstances = (NonConfigurationInstances) getLastNonConfigurationInstance();
|
|
if (nonConfigurationInstances != null) {
|
|
return nonConfigurationInstances.a;
|
|
}
|
|
return null;
|
|
}
|
|
|
|
@Override // androidx.core.app.ComponentActivity, androidx.lifecycle.LifecycleOwner
|
|
public Lifecycle getLifecycle() {
|
|
return super.getLifecycle();
|
|
}
|
|
|
|
public FragmentManager getSupportFragmentManager() {
|
|
return this.mFragments.j();
|
|
}
|
|
|
|
@Deprecated
|
|
public LoaderManager getSupportLoaderManager() {
|
|
return LoaderManager.a(this);
|
|
}
|
|
|
|
@Override // androidx.lifecycle.ViewModelStoreOwner
|
|
public ViewModelStore getViewModelStore() {
|
|
if (getApplication() == null) {
|
|
throw new IllegalStateException("Your activity is not yet attached to the Application instance. You can't request ViewModel before onCreate call.");
|
|
}
|
|
if (this.mViewModelStore == null) {
|
|
NonConfigurationInstances nonConfigurationInstances = (NonConfigurationInstances) getLastNonConfigurationInstance();
|
|
if (nonConfigurationInstances != null) {
|
|
this.mViewModelStore = nonConfigurationInstances.b;
|
|
}
|
|
if (this.mViewModelStore == null) {
|
|
this.mViewModelStore = new ViewModelStore();
|
|
}
|
|
}
|
|
return this.mViewModelStore;
|
|
}
|
|
|
|
@Override // android.app.Activity
|
|
protected void onActivityResult(int i, int i2, Intent intent) {
|
|
this.mFragments.k();
|
|
int i3 = i >> 16;
|
|
if (i3 == 0) {
|
|
ActivityCompat.PermissionCompatDelegate a = ActivityCompat.a();
|
|
if (a == null || !a.a(this, i, i2, intent)) {
|
|
super.onActivityResult(i, i2, intent);
|
|
return;
|
|
}
|
|
return;
|
|
}
|
|
int i4 = i3 - 1;
|
|
String b = this.mPendingFragmentActivityResults.b(i4);
|
|
this.mPendingFragmentActivityResults.e(i4);
|
|
if (b == null) {
|
|
Log.w(TAG, "Activity result delivered for unknown Fragment.");
|
|
return;
|
|
}
|
|
Fragment a2 = this.mFragments.a(b);
|
|
if (a2 != null) {
|
|
a2.onActivityResult(i & 65535, i2, intent);
|
|
return;
|
|
}
|
|
Log.w(TAG, "Activity result no fragment exists for who: " + b);
|
|
}
|
|
|
|
public void onAttachFragment(Fragment fragment) {
|
|
}
|
|
|
|
@Override // android.app.Activity
|
|
public void onBackPressed() {
|
|
FragmentManager j = this.mFragments.j();
|
|
boolean c = j.c();
|
|
if (!c || Build.VERSION.SDK_INT > 25) {
|
|
if (c || !j.e()) {
|
|
super.onBackPressed();
|
|
}
|
|
}
|
|
}
|
|
|
|
@Override // android.app.Activity, android.content.ComponentCallbacks
|
|
public void onConfigurationChanged(Configuration configuration) {
|
|
super.onConfigurationChanged(configuration);
|
|
this.mFragments.k();
|
|
this.mFragments.a(configuration);
|
|
}
|
|
|
|
@Override // androidx.core.app.ComponentActivity, android.app.Activity
|
|
protected void onCreate(Bundle bundle) {
|
|
ViewModelStore viewModelStore;
|
|
this.mFragments.a((Fragment) null);
|
|
super.onCreate(bundle);
|
|
NonConfigurationInstances nonConfigurationInstances = (NonConfigurationInstances) getLastNonConfigurationInstance();
|
|
if (nonConfigurationInstances != null && (viewModelStore = nonConfigurationInstances.b) != null && this.mViewModelStore == null) {
|
|
this.mViewModelStore = viewModelStore;
|
|
}
|
|
if (bundle != null) {
|
|
this.mFragments.a(bundle.getParcelable(FRAGMENTS_TAG), nonConfigurationInstances != null ? nonConfigurationInstances.c : null);
|
|
if (bundle.containsKey(NEXT_CANDIDATE_REQUEST_INDEX_TAG)) {
|
|
this.mNextCandidateRequestIndex = bundle.getInt(NEXT_CANDIDATE_REQUEST_INDEX_TAG);
|
|
int[] intArray = bundle.getIntArray(ALLOCATED_REQUEST_INDICIES_TAG);
|
|
String[] stringArray = bundle.getStringArray(REQUEST_FRAGMENT_WHO_TAG);
|
|
if (intArray == null || stringArray == null || intArray.length != stringArray.length) {
|
|
Log.w(TAG, "Invalid requestCode mapping in savedInstanceState.");
|
|
} else {
|
|
this.mPendingFragmentActivityResults = new SparseArrayCompat<>(intArray.length);
|
|
for (int i = 0; i < intArray.length; i++) {
|
|
this.mPendingFragmentActivityResults.c(intArray[i], stringArray[i]);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
if (this.mPendingFragmentActivityResults == null) {
|
|
this.mPendingFragmentActivityResults = new SparseArrayCompat<>();
|
|
this.mNextCandidateRequestIndex = 0;
|
|
}
|
|
this.mFragments.b();
|
|
}
|
|
|
|
@Override // android.app.Activity, android.view.Window.Callback
|
|
public boolean onCreatePanelMenu(int i, Menu menu) {
|
|
return i == 0 ? super.onCreatePanelMenu(i, menu) | this.mFragments.a(menu, getMenuInflater()) : super.onCreatePanelMenu(i, menu);
|
|
}
|
|
|
|
@Override // android.app.Activity, android.view.LayoutInflater.Factory2
|
|
public View onCreateView(View view, String str, Context context, AttributeSet attributeSet) {
|
|
View dispatchFragmentsOnCreateView = dispatchFragmentsOnCreateView(view, str, context, attributeSet);
|
|
return dispatchFragmentsOnCreateView == null ? super.onCreateView(view, str, context, attributeSet) : dispatchFragmentsOnCreateView;
|
|
}
|
|
|
|
@Override // android.app.Activity
|
|
protected void onDestroy() {
|
|
super.onDestroy();
|
|
if (this.mViewModelStore != null && !isChangingConfigurations()) {
|
|
this.mViewModelStore.a();
|
|
}
|
|
this.mFragments.c();
|
|
}
|
|
|
|
@Override // android.app.Activity, android.content.ComponentCallbacks
|
|
public void onLowMemory() {
|
|
super.onLowMemory();
|
|
this.mFragments.d();
|
|
}
|
|
|
|
@Override // android.app.Activity, android.view.Window.Callback
|
|
public boolean onMenuItemSelected(int i, MenuItem menuItem) {
|
|
if (super.onMenuItemSelected(i, menuItem)) {
|
|
return true;
|
|
}
|
|
if (i == 0) {
|
|
return this.mFragments.b(menuItem);
|
|
}
|
|
if (i != 6) {
|
|
return false;
|
|
}
|
|
return this.mFragments.a(menuItem);
|
|
}
|
|
|
|
@Override // android.app.Activity
|
|
public void onMultiWindowModeChanged(boolean z) {
|
|
this.mFragments.a(z);
|
|
}
|
|
|
|
@Override // android.app.Activity
|
|
protected void onNewIntent(Intent intent) {
|
|
super.onNewIntent(intent);
|
|
this.mFragments.k();
|
|
}
|
|
|
|
@Override // android.app.Activity, android.view.Window.Callback
|
|
public void onPanelClosed(int i, Menu menu) {
|
|
if (i == 0) {
|
|
this.mFragments.a(menu);
|
|
}
|
|
super.onPanelClosed(i, menu);
|
|
}
|
|
|
|
@Override // android.app.Activity
|
|
protected void onPause() {
|
|
super.onPause();
|
|
this.mResumed = false;
|
|
if (this.mHandler.hasMessages(2)) {
|
|
this.mHandler.removeMessages(2);
|
|
onResumeFragments();
|
|
}
|
|
this.mFragments.e();
|
|
}
|
|
|
|
@Override // android.app.Activity
|
|
public void onPictureInPictureModeChanged(boolean z) {
|
|
this.mFragments.b(z);
|
|
}
|
|
|
|
@Override // android.app.Activity
|
|
protected void onPostResume() {
|
|
super.onPostResume();
|
|
this.mHandler.removeMessages(2);
|
|
onResumeFragments();
|
|
this.mFragments.i();
|
|
}
|
|
|
|
protected boolean onPrepareOptionsPanel(View view, Menu menu) {
|
|
return super.onPreparePanel(0, view, menu);
|
|
}
|
|
|
|
@Override // android.app.Activity, android.view.Window.Callback
|
|
public boolean onPreparePanel(int i, View view, Menu menu) {
|
|
return (i != 0 || menu == null) ? super.onPreparePanel(i, view, menu) : onPrepareOptionsPanel(view, menu) | this.mFragments.b(menu);
|
|
}
|
|
|
|
@Override // android.app.Activity, androidx.core.app.ActivityCompat.OnRequestPermissionsResultCallback
|
|
public void onRequestPermissionsResult(int i, String[] strArr, int[] iArr) {
|
|
this.mFragments.k();
|
|
int i2 = (i >> 16) & 65535;
|
|
if (i2 != 0) {
|
|
int i3 = i2 - 1;
|
|
String b = this.mPendingFragmentActivityResults.b(i3);
|
|
this.mPendingFragmentActivityResults.e(i3);
|
|
if (b == null) {
|
|
Log.w(TAG, "Activity result delivered for unknown Fragment.");
|
|
return;
|
|
}
|
|
Fragment a = this.mFragments.a(b);
|
|
if (a != null) {
|
|
a.onRequestPermissionsResult(i & 65535, strArr, iArr);
|
|
return;
|
|
}
|
|
Log.w(TAG, "Activity result no fragment exists for who: " + b);
|
|
}
|
|
}
|
|
|
|
@Override // android.app.Activity
|
|
protected void onResume() {
|
|
super.onResume();
|
|
this.mHandler.sendEmptyMessage(2);
|
|
this.mResumed = true;
|
|
this.mFragments.i();
|
|
}
|
|
|
|
protected void onResumeFragments() {
|
|
this.mFragments.f();
|
|
}
|
|
|
|
public Object onRetainCustomNonConfigurationInstance() {
|
|
return null;
|
|
}
|
|
|
|
@Override // android.app.Activity
|
|
public final Object onRetainNonConfigurationInstance() {
|
|
Object onRetainCustomNonConfigurationInstance = onRetainCustomNonConfigurationInstance();
|
|
FragmentManagerNonConfig l = this.mFragments.l();
|
|
if (l == null && this.mViewModelStore == null && onRetainCustomNonConfigurationInstance == null) {
|
|
return null;
|
|
}
|
|
NonConfigurationInstances nonConfigurationInstances = new NonConfigurationInstances();
|
|
nonConfigurationInstances.a = onRetainCustomNonConfigurationInstance;
|
|
nonConfigurationInstances.b = this.mViewModelStore;
|
|
nonConfigurationInstances.c = l;
|
|
return nonConfigurationInstances;
|
|
}
|
|
|
|
@Override // androidx.core.app.ComponentActivity, android.app.Activity
|
|
protected void onSaveInstanceState(Bundle bundle) {
|
|
super.onSaveInstanceState(bundle);
|
|
markFragmentsCreated();
|
|
Parcelable m = this.mFragments.m();
|
|
if (m != null) {
|
|
bundle.putParcelable(FRAGMENTS_TAG, m);
|
|
}
|
|
if (this.mPendingFragmentActivityResults.b() > 0) {
|
|
bundle.putInt(NEXT_CANDIDATE_REQUEST_INDEX_TAG, this.mNextCandidateRequestIndex);
|
|
int[] iArr = new int[this.mPendingFragmentActivityResults.b()];
|
|
String[] strArr = new String[this.mPendingFragmentActivityResults.b()];
|
|
for (int i = 0; i < this.mPendingFragmentActivityResults.b(); i++) {
|
|
iArr[i] = this.mPendingFragmentActivityResults.d(i);
|
|
strArr[i] = this.mPendingFragmentActivityResults.f(i);
|
|
}
|
|
bundle.putIntArray(ALLOCATED_REQUEST_INDICIES_TAG, iArr);
|
|
bundle.putStringArray(REQUEST_FRAGMENT_WHO_TAG, strArr);
|
|
}
|
|
}
|
|
|
|
@Override // android.app.Activity
|
|
protected void onStart() {
|
|
super.onStart();
|
|
this.mStopped = false;
|
|
if (!this.mCreated) {
|
|
this.mCreated = true;
|
|
this.mFragments.a();
|
|
}
|
|
this.mFragments.k();
|
|
this.mFragments.i();
|
|
this.mFragments.g();
|
|
}
|
|
|
|
@Override // android.app.Activity
|
|
public void onStateNotSaved() {
|
|
this.mFragments.k();
|
|
}
|
|
|
|
@Override // android.app.Activity
|
|
protected void onStop() {
|
|
super.onStop();
|
|
this.mStopped = true;
|
|
markFragmentsCreated();
|
|
this.mFragments.h();
|
|
}
|
|
|
|
void requestPermissionsFromFragment(Fragment fragment, String[] strArr, int i) {
|
|
if (i == -1) {
|
|
ActivityCompat.a(this, strArr, i);
|
|
return;
|
|
}
|
|
checkForValidRequestCode(i);
|
|
try {
|
|
this.mRequestedPermissionsFromFragment = true;
|
|
ActivityCompat.a(this, strArr, ((allocateRequestIndex(fragment) + 1) << 16) + (i & 65535));
|
|
} finally {
|
|
this.mRequestedPermissionsFromFragment = false;
|
|
}
|
|
}
|
|
|
|
public void setEnterSharedElementCallback(SharedElementCallback sharedElementCallback) {
|
|
ActivityCompat.a(this, sharedElementCallback);
|
|
}
|
|
|
|
public void setExitSharedElementCallback(SharedElementCallback sharedElementCallback) {
|
|
ActivityCompat.b(this, sharedElementCallback);
|
|
}
|
|
|
|
@Override // android.app.Activity
|
|
public void startActivityForResult(Intent intent, int i) {
|
|
if (!this.mStartedActivityFromFragment && i != -1) {
|
|
checkForValidRequestCode(i);
|
|
}
|
|
super.startActivityForResult(intent, i);
|
|
}
|
|
|
|
public void startActivityFromFragment(Fragment fragment, Intent intent, int i) {
|
|
startActivityFromFragment(fragment, intent, i, (Bundle) null);
|
|
}
|
|
|
|
@Override // android.app.Activity
|
|
public void startIntentSenderForResult(IntentSender intentSender, int i, Intent intent, int i2, int i3, int i4) throws IntentSender.SendIntentException {
|
|
if (!this.mStartedIntentSenderFromFragment && i != -1) {
|
|
checkForValidRequestCode(i);
|
|
}
|
|
super.startIntentSenderForResult(intentSender, i, intent, i2, i3, i4);
|
|
}
|
|
|
|
public void startIntentSenderFromFragment(Fragment fragment, IntentSender intentSender, int i, Intent intent, int i2, int i3, int i4, Bundle bundle) throws IntentSender.SendIntentException {
|
|
this.mStartedIntentSenderFromFragment = true;
|
|
try {
|
|
if (i == -1) {
|
|
ActivityCompat.a(this, intentSender, i, intent, i2, i3, i4, bundle);
|
|
} else {
|
|
checkForValidRequestCode(i);
|
|
ActivityCompat.a(this, intentSender, ((allocateRequestIndex(fragment) + 1) << 16) + (i & 65535), intent, i2, i3, i4, bundle);
|
|
}
|
|
} finally {
|
|
this.mStartedIntentSenderFromFragment = false;
|
|
}
|
|
}
|
|
|
|
public void supportFinishAfterTransition() {
|
|
ActivityCompat.b((Activity) this);
|
|
}
|
|
|
|
@Deprecated
|
|
public void supportInvalidateOptionsMenu() {
|
|
invalidateOptionsMenu();
|
|
}
|
|
|
|
public void supportPostponeEnterTransition() {
|
|
ActivityCompat.c((Activity) this);
|
|
}
|
|
|
|
public void supportStartPostponedEnterTransition() {
|
|
ActivityCompat.d(this);
|
|
}
|
|
|
|
@Override // androidx.core.app.ActivityCompat.RequestPermissionsRequestCodeValidator
|
|
public final void validateRequestPermissionsRequestCode(int i) {
|
|
if (this.mRequestedPermissionsFromFragment || i == -1) {
|
|
return;
|
|
}
|
|
checkForValidRequestCode(i);
|
|
}
|
|
|
|
public void startActivityFromFragment(Fragment fragment, Intent intent, int i, Bundle bundle) {
|
|
this.mStartedActivityFromFragment = true;
|
|
try {
|
|
if (i == -1) {
|
|
ActivityCompat.a(this, intent, -1, bundle);
|
|
} else {
|
|
checkForValidRequestCode(i);
|
|
ActivityCompat.a(this, intent, ((allocateRequestIndex(fragment) + 1) << 16) + (i & 65535), bundle);
|
|
}
|
|
} finally {
|
|
this.mStartedActivityFromFragment = false;
|
|
}
|
|
}
|
|
|
|
@Override // android.app.Activity, android.view.LayoutInflater.Factory
|
|
public View onCreateView(String str, Context context, AttributeSet attributeSet) {
|
|
View dispatchFragmentsOnCreateView = dispatchFragmentsOnCreateView(null, str, context, attributeSet);
|
|
return dispatchFragmentsOnCreateView == null ? super.onCreateView(str, context, attributeSet) : dispatchFragmentsOnCreateView;
|
|
}
|
|
|
|
@Override // android.app.Activity
|
|
public void startActivityForResult(Intent intent, int i, Bundle bundle) {
|
|
if (!this.mStartedActivityFromFragment && i != -1) {
|
|
checkForValidRequestCode(i);
|
|
}
|
|
super.startActivityForResult(intent, i, bundle);
|
|
}
|
|
|
|
@Override // android.app.Activity
|
|
public void startIntentSenderForResult(IntentSender intentSender, int i, Intent intent, int i2, int i3, int i4, Bundle bundle) throws IntentSender.SendIntentException {
|
|
if (!this.mStartedIntentSenderFromFragment && i != -1) {
|
|
checkForValidRequestCode(i);
|
|
}
|
|
super.startIntentSenderForResult(intentSender, i, intent, i2, i3, i4, bundle);
|
|
}
|
|
}
|