Skip to content

Commit 80ca9e3

Browse files
committed
Fix: apply dark mode to profiles dialog with same width as light mode
1 parent bf09d3a commit 80ca9e3

1 file changed

Lines changed: 28 additions & 0 deletions

File tree

app/src/main/java/com/github/actions/ProjectsActivity.java

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -440,6 +440,14 @@ private void showProfiles() {
440440
builder.setNegativeButton("Close", null);
441441
AlertDialog dialog = builder.create();
442442

443+
SharedPreferences themePrefs = getSharedPreferences("GitCodeTheme", MODE_PRIVATE);
444+
boolean isDark = themePrefs.getBoolean("darkMode", true);
445+
446+
// Apply dark background BEFORE showing
447+
if (isDark && dialog.getWindow() != null) {
448+
dialog.getWindow().setBackgroundDrawable(new android.graphics.drawable.ColorDrawable(0xFF2D2D2D));
449+
}
450+
443451
// Set click listeners after dialog is created
444452
for (String profile : profiles.split(";")) {
445453
if (profile.isEmpty()) continue;
@@ -499,6 +507,26 @@ private void showProfiles() {
499507
});
500508

501509
dialog.show();
510+
511+
// Set dialog width to match parent with margins
512+
if (dialog.getWindow() != null) {
513+
android.view.WindowManager.LayoutParams params = dialog.getWindow().getAttributes();
514+
params.width = android.view.WindowManager.LayoutParams.MATCH_PARENT;
515+
dialog.getWindow().setAttributes(params);
516+
}
517+
518+
// Apply text colors AFTER showing
519+
if (isDark && dialog.getWindow() != null) {
520+
new android.os.Handler().post(() -> {
521+
try {
522+
android.view.ViewGroup root = (android.view.ViewGroup) dialog.getWindow().getDecorView();
523+
applyDarkTheme(root);
524+
525+
android.widget.Button negativeButton = dialog.getButton(AlertDialog.BUTTON_NEGATIVE);
526+
if (negativeButton != null) negativeButton.setTextColor(0xFFFFFFFF);
527+
} catch (Exception e) {}
528+
});
529+
}
502530
}
503531

504532
private void addProfile() {

0 commit comments

Comments
 (0)