Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(android): override user interface style #14113

Merged
merged 17 commits into from
Nov 23, 2024
Merged
Changes from all commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@
import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatDelegate;
import androidx.appcompat.widget.Toolbar;
import androidx.core.app.ActivityCompat;

import android.text.Spannable;
import android.text.SpannableStringBuilder;
Expand Down Expand Up @@ -133,7 +132,6 @@ void onRequestPermissionsResult(
protected int msgId = -1;
//Storing the activity's dialogs and their persistence
private final CopyOnWriteArrayList<DialogWrapper> dialogs = new CopyOnWriteArrayList<>();

public TiWindowProxy lwWindow;
public boolean isResumed = false;

Expand Down Expand Up @@ -671,7 +669,6 @@ protected void attachBaseContext(Context newBase)
protected void onCreate(Bundle savedInstanceState)
{
Log.d(TAG, "Activity " + this + " onCreate", Log.DEBUG_MODE);

this.inForeground = true;
this.launchIntent = getIntent();
this.safeAreaMonitor = new TiActivitySafeAreaMonitor(this);
Expand Down Expand Up @@ -1239,11 +1236,21 @@ public void onConfigurationChanged(@NonNull Configuration newConfig)
final int NIGHT_MASK = Configuration.UI_MODE_NIGHT_MASK;
if ((newConfig.uiMode & NIGHT_MASK) != (this.lastUIModeFlags & NIGHT_MASK)) {
this.lastNightMode = AppCompatDelegate.getDefaultNightMode();
ActivityCompat.recreate(this);
this.updateActivity();
}
this.lastUIModeFlags = newConfig.uiMode;
}

private void updateActivity()
{
/**
* Set root activity to null to avoid duplication which causes the window
* to lose all it's content when the activity is recreated.
*/
getTiApp().setRootActivity(null);
this.recreate();
}

@Override
protected void onNightModeChanged(int mode)
{
Expand All @@ -1256,7 +1263,7 @@ public void applyNightMode()
int mode = AppCompatDelegate.getDefaultNightMode();
if (this.inForeground && (mode != this.lastNightMode)) {
this.lastNightMode = mode;
ActivityCompat.recreate(this);
this.updateActivity();
}
}

Expand Down
Loading