diff --git a/app/src/main/java/fr/free/nrw/commons/auth/SignupActivity.java b/app/src/main/java/fr/free/nrw/commons/auth/SignupActivity.java index d6e4568fd9..be90bb4bb6 100644 --- a/app/src/main/java/fr/free/nrw/commons/auth/SignupActivity.java +++ b/app/src/main/java/fr/free/nrw/commons/auth/SignupActivity.java @@ -1,5 +1,7 @@ package fr.free.nrw.commons.auth; +import android.content.res.Configuration; +import android.os.Build; import android.os.Bundle; import android.webkit.WebSettings; import android.webkit.WebView; @@ -61,4 +63,20 @@ public void onBackPressed() { super.onBackPressed(); } } + + /** + * Known bug in androidx.appcompat library version 1.1.0 being tracked here + * https://issuetracker.google.com/issues/141132133 + * App tries to put light/dark theme to webview and crashes in the process + * This code tries to prevent applying the theme when sdk is between api 21 to 25 + * @param overrideConfiguration + */ + @Override + public void applyOverrideConfiguration(final Configuration overrideConfiguration) { + if (Build.VERSION.SDK_INT <= 25 && + (getResources().getConfiguration().uiMode == getApplicationContext().getResources().getConfiguration().uiMode)) { + return; + } + super.applyOverrideConfiguration(overrideConfiguration); + } }