Skip to content
Original file line number Diff line number Diff line change
Expand Up @@ -207,15 +207,16 @@ private View hairline() {

/** ADFA-5023: strong confirm before a from-scratch reinstall (wipes everything), then the wizard. */
private void confirmReinstall() {
new com.google.android.material.dialog.MaterialAlertDialogBuilder(requireContext())
// K2GO-385: destructive from-scratch reinstall confirm -> the shared BrandDialog (clay destructive).
new org.appdevforall.k2go.ui.dialog.BrandDialog(requireContext())
.setTitle(R.string.k2go_reinstall_confirm_title)
.setMessage(R.string.k2go_reinstall_confirm_msg)
.setNegativeButton(android.R.string.cancel, null)
.setPositiveButton(R.string.k2go_reinstall_confirm_yes, (d, w) -> {
.setDestructive(R.string.k2go_reinstall_confirm_yes, () -> {
if (getActivity() instanceof SetupLibraryActivity) {
((SetupLibraryActivity) getActivity()).openReinstallWizard();
}
})
.setNegative(android.R.string.cancel, null)
.show();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -728,13 +728,14 @@ private void onDownloadToggle() {
* second copy of it here would be a second place formatting the same fact.
*/
private void confirmCancelDownload() {
new com.google.android.material.dialog.MaterialAlertDialogBuilder(this)
// K2GO-385: cancel-the-download confirm -> the shared BrandDialog (destructive: it stops + starts over).
new org.appdevforall.k2go.ui.dialog.BrandDialog(this)
.setTitle(R.string.k2go_dl_cancel_title)
.setMessage(R.string.k2go_dl_cancel_body)
.setNegativeButton(R.string.k2go_dl_cancel_keep, null)
.setPositiveButton(R.string.k2go_dl_cancel_confirm, (d, w) ->
.setDestructive(R.string.k2go_dl_cancel_confirm, () ->
sendToInstallService(
org.appdevforall.k2go.install.presentation.InstallService.ACTION_CANCEL))
.setNegative(R.string.k2go_dl_cancel_keep, null)
.show();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.app.AppCompatDelegate;
import androidx.core.content.ContextCompat;
import androidx.fragment.app.Fragment;
Expand Down Expand Up @@ -107,11 +106,17 @@ private void chooseTheme() {
AppCompatDelegate.MODE_NIGHT_NO,
AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM,
AppCompatDelegate.MODE_NIGHT_YES};
new AlertDialog.Builder(requireContext())
int cur = prefs().getInt("k2go_theme", AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM);
int checked = cur == AppCompatDelegate.MODE_NIGHT_NO ? 0 : (cur == AppCompatDelegate.MODE_NIGHT_YES ? 2 : 1);
// K2GO-385 (pill roles Q3): a single-choice list picker -- a themed M3 dialog with a leading
// filled radio on the current theme, not a bare setItems list. Tap applies and closes, as before.
new com.google.android.material.dialog.MaterialAlertDialogBuilder(
new android.view.ContextThemeWrapper(requireContext(), R.style.Theme_K2Go))
.setTitle(getString(R.string.k2go_settings_theme))
.setItems(labels, (d, w) -> {
.setSingleChoiceItems(labels, checked, (d, w) -> {
prefs().edit().putInt("k2go_theme", modes[w]).apply();
AppCompatDelegate.setDefaultNightMode(modes[w]);
d.dismiss();
})
.show();
}
Expand Down Expand Up @@ -143,15 +148,16 @@ private void buildFooter(Context ctx, LinearLayout footer) {
}

private void confirmTurnOff() {
new AlertDialog.Builder(requireContext())
.setTitle(getString(R.string.k2go_settings_turnoff_title))
.setMessage(getString(R.string.k2go_settings_turnoff_msg))
.setNegativeButton(getString(R.string.k2go_cancel), null)
.setPositiveButton(getString(R.string.k2go_settings_turnoff_confirm), (d, w) -> {
// K2GO-385: turn-off confirm -> the shared BrandDialog (destructive, matching the clay "Turn off" button).
new org.appdevforall.k2go.ui.dialog.BrandDialog(requireContext())
.setTitle(R.string.k2go_settings_turnoff_title)
.setMessage(R.string.k2go_settings_turnoff_msg)
.setDestructive(R.string.k2go_settings_turnoff_confirm, () -> {
if (getActivity() instanceof LibraryActivity) {
((LibraryActivity) getActivity()).turnOffK2Go();
}
})
.setNegative(R.string.k2go_cancel, null)
.show();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1389,13 +1389,14 @@ private void configureDetailBar() {
* flag and marks the module failed; the base system is untouched and the server restarts.
*/
private void confirmCancelModule() {
new com.google.android.material.dialog.MaterialAlertDialogBuilder(this)
// K2GO-385: cancel-running-install confirm -> the shared BrandDialog (destructive).
new org.appdevforall.k2go.ui.dialog.BrandDialog(this)
.setTitle(R.string.k2go_mod_cancel_title)
.setMessage(R.string.k2go_mod_cancel_body)
.setNegativeButton(R.string.k2go_mod_cancel_dismiss, null)
.setPositiveButton(R.string.k2go_mod_cancel_confirm, (d, w) ->
.setDestructive(R.string.k2go_mod_cancel_confirm, () ->
startService(new android.content.Intent(this, org.appdevforall.k2go.install.presentation.InstallService.class)
.setAction(org.appdevforall.k2go.install.presentation.InstallService.ACTION_CANCEL)))
.setNegative(R.string.k2go_mod_cancel_dismiss, null)
.show();
}

Expand Down
7 changes: 7 additions & 0 deletions controller/app/src/main/res/drawable/ic_language.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<!-- K2GO-385: Material "language" (globe), tinted by the caller (drawableTint teal on the selector). -->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp" android:height="24dp"
android:viewportWidth="24" android:viewportHeight="24">
<path android:fillColor="@android:color/white"
android:pathData="M11.99,2C6.47,2 2,6.48 2,12s4.47,10 9.99,10C17.52,22 22,17.52 22,12 22,6.48 17.52,2 11.99,2zM18.92,8h-2.95c-0.32,-1.25 -0.78,-2.45 -1.38,-3.56 1.84,0.63 3.37,1.9 4.33,3.56zM12,4.04c0.83,1.2 1.48,2.53 1.91,3.96h-3.82c0.43,-1.43 1.08,-2.76 1.91,-3.96zM4.26,14C4.1,13.36 4,12.69 4,12s0.1,-1.36 0.26,-2h3.38c-0.08,0.66 -0.14,1.32 -0.14,2 0,0.68 0.06,1.34 0.14,2H4.26zM5.08,16h2.95c0.32,1.25 0.78,2.45 1.38,3.56 -1.84,-0.63 -3.37,-1.9 -4.33,-3.56zM8.03,8H5.08c0.96,-1.65 2.49,-2.93 4.33,-3.56C8.81,5.55 8.35,6.75 8.03,8zM12,19.96c-0.83,-1.2 -1.48,-2.53 -1.91,-3.96h3.82c-0.43,1.43 -1.08,2.76 -1.91,3.96zM14.34,14H9.66c-0.09,-0.66 -0.16,-1.32 -0.16,-2 0,-0.68 0.07,-1.35 0.16,-2h4.68c0.09,0.65 0.16,1.32 0.16,2 0,0.68 -0.07,1.34 -0.16,2zM14.36,19.56c0.6,-1.11 1.06,-2.31 1.38,-3.56h2.95c-0.96,1.65 -2.49,2.93 -4.33,3.56zM16.36,14c0.08,-0.66 0.14,-1.32 0.14,-2 0,-0.68 -0.06,-1.34 -0.14,-2h3.38c0.16,0.64 0.26,1.31 0.26,2s-0.1,1.36 -0.26,2h-3.38z"/>
</vector>
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@
android:textColor="@color/k2go_ink"
android:textColorHint="@color/k2go_muted" />

<!-- K2GO-385 (pill roles Q3B): the language selector is a dropdown / menu button, not a filter
chip. A leading globe and a trailing caret frame the current value, and a tap opens the
single-choice picker; no check or selected-fill (that is the chip language). -->
<TextView
android:id="@+id/k2go_books_lang"
android:layout_width="wrap_content"
Expand All @@ -56,6 +59,11 @@
android:paddingTop="8dp"
android:paddingBottom="8dp"
android:background="@drawable/k2go_pill_bg"
android:drawableStart="@drawable/ic_language"
android:drawableEnd="@drawable/ic_expand_more"
android:drawableTint="@color/k2go_teal"
android:drawablePadding="6dp"
android:gravity="center_vertical"
android:textAppearance="?attr/textAppearanceBodySmall"
android:textColor="@color/k2go_ink" />

Expand Down
13 changes: 13 additions & 0 deletions controller/app/src/main/res/values/themes_k2go.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,19 @@
<item name="android:windowBackground">@color/k2go_paper</item>
<item name="colorSurface">@color/k2go_paper</item>
<item name="colorSurfaceContainer">@color/k2go_surface</item>
<!-- K2GO-385: define the full surface-container ladder so M3 dialogs and menus take a K2Go
surface, not the Material3 baseline lilac. A themed MaterialAlertDialog (e.g. the theme
picker) reads colorSurfaceContainerHigh for its card. The tokens carry their own -night
twins, so DayNight is handled. -->
<item name="colorSurfaceContainerLowest">@color/k2go_paper</item>
<item name="colorSurfaceContainerLow">@color/k2go_paper</item>
<item name="colorSurfaceContainerHigh">@color/k2go_surface</item>
<item name="colorSurfaceContainerHighest">@color/k2go_surface</item>
<!-- K2GO-385: interactive controls (the single-choice radio in the theme picker, checkboxes,
switches) take K2Go teal, not the Material3 / dynamic default (which read purple). The
android-namespace attr is the one the platform radio in setSingleChoiceItems uses. -->
<item name="colorControlActivated">@color/k2go_teal</item>
<item name="android:colorControlActivated">@color/k2go_teal</item>
<item name="colorOnBackground">@color/k2go_ink</item>
<item name="colorOnSurface">@color/k2go_ink</item>
<item name="colorOnSurfaceVariant">@color/k2go_muted</item>
Expand Down
Loading