Skip to content

Commit

Permalink
fixes crash in sign up activity in api 21 and 22 (#5311)
Browse files Browse the repository at this point in the history
* fixes crash in sign up activity

* javadoc comments added
  • Loading branch information
srishti-R authored Sep 26, 2023
1 parent 19733b3 commit a2ad039
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions app/src/main/java/fr/free/nrw/commons/auth/SignupActivity.java
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -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);
}
}

0 comments on commit a2ad039

Please sign in to comment.