capacitor-extended-dialog 0.0.1 → 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -115,10 +115,9 @@ public class ExtendedDialog {
|
|
|
115
115
|
TextViewCompat.setTextAppearance(titleView,
|
|
116
116
|
com.google.android.material.R.style.TextAppearance_Material3_HeadlineSmall);
|
|
117
117
|
// M3 dialog headline color: onSurface (#1D1B20)
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
}
|
|
118
|
+
// Use MaterialColors for proper theme attribute resolution across different R class configurations
|
|
119
|
+
int onSurfaceColor = MaterialColors.getColor(ctx, android.R.attr.textColorPrimary, 0xFF1D1B20);
|
|
120
|
+
titleView.setTextColor(onSurfaceColor);
|
|
122
121
|
}
|
|
123
122
|
|
|
124
123
|
// Apply M3 BodyMedium to message with onSurfaceVariant color
|
|
@@ -127,28 +126,26 @@ public class ExtendedDialog {
|
|
|
127
126
|
TextViewCompat.setTextAppearance(messageView,
|
|
128
127
|
com.google.android.material.R.style.TextAppearance_Material3_BodyMedium);
|
|
129
128
|
// M3 dialog supporting text color: onSurfaceVariant (#49454F)
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
}
|
|
129
|
+
// Use MaterialColors for proper theme attribute resolution
|
|
130
|
+
int onSurfaceVariantColor = MaterialColors.getColor(ctx, android.R.attr.textColorSecondary, 0xFF49454F);
|
|
131
|
+
messageView.setTextColor(onSurfaceVariantColor);
|
|
134
132
|
}
|
|
135
133
|
|
|
136
134
|
// Apply M3 colorPrimary to dialog buttons
|
|
137
135
|
// This ensures consistent button colors across all dialogs regardless of app theme
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
}
|
|
136
|
+
// Use MaterialColors.getColor with android.R.attr.colorPrimary for better compatibility
|
|
137
|
+
int primaryColor = MaterialColors.getColor(ctx, android.R.attr.colorPrimary, 0xFF6750A4);
|
|
138
|
+
Button positiveButton = dialog.getButton(DialogInterface.BUTTON_POSITIVE);
|
|
139
|
+
if (positiveButton != null) {
|
|
140
|
+
positiveButton.setTextColor(ColorStateList.valueOf(primaryColor));
|
|
141
|
+
}
|
|
142
|
+
Button negativeButton = dialog.getButton(DialogInterface.BUTTON_NEGATIVE);
|
|
143
|
+
if (negativeButton != null) {
|
|
144
|
+
negativeButton.setTextColor(ColorStateList.valueOf(primaryColor));
|
|
145
|
+
}
|
|
146
|
+
Button neutralButton = dialog.getButton(DialogInterface.BUTTON_NEUTRAL);
|
|
147
|
+
if (neutralButton != null) {
|
|
148
|
+
neutralButton.setTextColor(ColorStateList.valueOf(primaryColor));
|
|
152
149
|
}
|
|
153
150
|
}
|
|
154
151
|
|
|
@@ -29,6 +29,7 @@ import androidx.core.widget.TextViewCompat;
|
|
|
29
29
|
import androidx.fragment.app.DialogFragment;
|
|
30
30
|
import com.google.android.material.appbar.MaterialToolbar;
|
|
31
31
|
import com.google.android.material.button.MaterialButton;
|
|
32
|
+
import com.google.android.material.color.MaterialColors;
|
|
32
33
|
import com.google.android.material.textfield.TextInputEditText;
|
|
33
34
|
import com.google.android.material.textfield.TextInputLayout;
|
|
34
35
|
import java.util.ArrayList;
|
|
@@ -193,12 +194,9 @@ public class FullScreenDialogFragment extends DialogFragment {
|
|
|
193
194
|
root.setBackgroundColor(styleOptions.getBackgroundColor());
|
|
194
195
|
} else {
|
|
195
196
|
// Use Material 3 surface color or fallback to white
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
} else {
|
|
200
|
-
root.setBackgroundColor(getResources().getColor(android.R.color.white, null));
|
|
201
|
-
}
|
|
197
|
+
// Use android.R.attr.colorBackground which maps to surface in M3 themes
|
|
198
|
+
int surfaceColor = MaterialColors.getColor(ctx, android.R.attr.colorBackground, 0xFFFFFFFF);
|
|
199
|
+
root.setBackgroundColor(surfaceColor);
|
|
202
200
|
}
|
|
203
201
|
|
|
204
202
|
// Handle window insets for edge-to-edge display
|
|
@@ -220,10 +218,9 @@ public class FullScreenDialogFragment extends DialogFragment {
|
|
|
220
218
|
toolbar.setNavigationIcon(com.google.android.material.R.drawable.ic_m3_chip_close);
|
|
221
219
|
|
|
222
220
|
// Tint navigation icon for proper visibility in dark/light themes
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
}
|
|
221
|
+
// Use android.R.attr.textColorPrimary which maps to onSurface in M3 themes
|
|
222
|
+
int colorOnSurface = MaterialColors.getColor(ctx, android.R.attr.textColorPrimary, 0xFF1D1B20);
|
|
223
|
+
toolbar.setNavigationIconTint(colorOnSurface);
|
|
227
224
|
|
|
228
225
|
toolbar.setNavigationOnClickListener((v) -> {
|
|
229
226
|
handleCancel();
|
|
@@ -258,10 +255,9 @@ public class FullScreenDialogFragment extends DialogFragment {
|
|
|
258
255
|
messageView.setTextColor(styleOptions.getMessageColor());
|
|
259
256
|
} else {
|
|
260
257
|
// M3 dialog supporting text color: onSurfaceVariant (#49454F)
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
}
|
|
258
|
+
// Use android.R.attr.textColorSecondary which maps to onSurfaceVariant in M3 themes
|
|
259
|
+
int onSurfaceVariantColor = MaterialColors.getColor(ctx, android.R.attr.textColorSecondary, 0xFF49454F);
|
|
260
|
+
messageView.setTextColor(onSurfaceVariantColor);
|
|
265
261
|
}
|
|
266
262
|
LinearLayout.LayoutParams messageParams = new LinearLayout.LayoutParams(
|
|
267
263
|
ViewGroup.LayoutParams.MATCH_PARENT,
|
|
@@ -295,9 +291,8 @@ public class FullScreenDialogFragment extends DialogFragment {
|
|
|
295
291
|
buttonContainer.setGravity(android.view.Gravity.END);
|
|
296
292
|
|
|
297
293
|
// Get M3 primary color for text buttons
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
int primaryColorValue = primaryColor.data;
|
|
294
|
+
// Use android.R.attr.colorPrimary with M3 baseline fallback
|
|
295
|
+
int primaryColorValue = MaterialColors.getColor(ctx, android.R.attr.colorPrimary, 0xFF6750A4);
|
|
301
296
|
|
|
302
297
|
if (type != DialogType.ALERT) {
|
|
303
298
|
// Cancel button - M3 text button style (never disabled per M3 guidelines)
|
|
@@ -421,10 +416,9 @@ public class FullScreenDialogFragment extends DialogFragment {
|
|
|
421
416
|
TextViewCompat.setTextAppearance(radioButton,
|
|
422
417
|
com.google.android.material.R.style.TextAppearance_Material3_BodyLarge);
|
|
423
418
|
// M3 list item text color: onSurface (#1D1B20)
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
}
|
|
419
|
+
// Use android.R.attr.textColorPrimary which maps to onSurface in M3 themes
|
|
420
|
+
int onSurfaceColor = MaterialColors.getColor(ctx, android.R.attr.textColorPrimary, 0xFF1D1B20);
|
|
421
|
+
radioButton.setTextColor(onSurfaceColor);
|
|
428
422
|
radioButton.setId(View.generateViewId());
|
|
429
423
|
radioButton.setPadding((int) (8 * density), itemPadding, 0, itemPadding);
|
|
430
424
|
|
|
@@ -484,10 +478,9 @@ public class FullScreenDialogFragment extends DialogFragment {
|
|
|
484
478
|
TextViewCompat.setTextAppearance(checkBox,
|
|
485
479
|
com.google.android.material.R.style.TextAppearance_Material3_BodyLarge);
|
|
486
480
|
// M3 list item text color: onSurface (#1D1B20)
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
}
|
|
481
|
+
// Use android.R.attr.textColorPrimary which maps to onSurface in M3 themes
|
|
482
|
+
int onSurfaceColor = MaterialColors.getColor(ctx, android.R.attr.textColorPrimary, 0xFF1D1B20);
|
|
483
|
+
checkBox.setTextColor(onSurfaceColor);
|
|
491
484
|
checkBox.setPadding((int) (8 * density), itemPadding, 0, itemPadding);
|
|
492
485
|
checkBox.setChecked(selectedValues.contains(value));
|
|
493
486
|
|