Skip to content
Snippets Groups Projects
Verified Commit 9e8529f6 authored by Sebastian's avatar Sebastian
Browse files

Move showOnboardingDialog() and styles to mailbox module

parent c0f762d9
No related branches found
No related tags found
1 merge request!62Add styled DoNotKillMeFragment
Pipeline #9795 passed
...@@ -14,7 +14,6 @@ import java.util.List; ...@@ -14,7 +14,6 @@ import java.util.List;
import java.util.Scanner; import java.util.Scanner;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
import androidx.appcompat.app.AlertDialog;
import static android.content.Context.POWER_SERVICE; import static android.content.Context.POWER_SERVICE;
import static android.content.pm.PackageManager.MATCH_DEFAULT_ONLY; import static android.content.pm.PackageManager.MATCH_DEFAULT_ONLY;
...@@ -49,14 +48,6 @@ public class PowerUtils { ...@@ -49,14 +48,6 @@ public class PowerUtils {
return i; return i;
} }
public static void showOnboardingDialog(Context ctx, String text) {
new AlertDialog.Builder(ctx, R.style.OnboardingDialogTheme)
.setMessage(text)
.setNeutralButton(R.string.got_it,
(dialog, which) -> dialog.cancel())
.show();
}
/** /**
* Determine whether a Huawei "Protected apps" feature is available on the * Determine whether a Huawei "Protected apps" feature is available on the
* device. * device.
......
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="OnboardingDialogTheme" parent="Theme.AppCompat.DayNight.Dialog.MinWidth" />
<style name="DoNotKillMeButton" parent="Widget.AppCompat.Button.Colored" />
<style name="HelpButton" parent="Widget.AppCompat.Button.Borderless">
<item name="android:tint">#418cd8</item>
</style>
</resources>
...@@ -23,7 +23,7 @@ import androidx.fragment.app.Fragment; ...@@ -23,7 +23,7 @@ import androidx.fragment.app.Fragment;
import static android.view.View.INVISIBLE; import static android.view.View.INVISIBLE;
import static android.view.View.VISIBLE; import static android.view.View.VISIBLE;
import static org.briarproject.android.dontkillmelib.PowerUtils.getDozeWhitelistingIntent; import static org.briarproject.android.dontkillmelib.PowerUtils.getDozeWhitelistingIntent;
import static org.briarproject.android.dontkillmelib.PowerUtils.showOnboardingDialog; import static org.briarproject.mailbox.android.dontkillme.DoNotKillMeUtils.showOnboardingDialog;
public abstract class AbstractDoNotKillMeFragment extends Fragment public abstract class AbstractDoNotKillMeFragment extends Fragment
implements OnCheckedChangedListener, implements OnCheckedChangedListener,
......
package org.briarproject.mailbox.android.dontkillme;
import android.content.Context;
import org.briarproject.mailbox.R;
import androidx.appcompat.app.AlertDialog;
public class DoNotKillMeUtils {
static void showOnboardingDialog(Context ctx, String text) {
new AlertDialog.Builder(ctx,
R.style.OnboardingDialogTheme)
.setMessage(text)
.setNeutralButton(
org.briarproject.android.dontkillmelib.R.string.got_it,
(dialog, which) -> dialog.cancel())
.show();
}
}
...@@ -22,7 +22,7 @@ import androidx.constraintlayout.widget.ConstraintLayout; ...@@ -22,7 +22,7 @@ import androidx.constraintlayout.widget.ConstraintLayout;
import androidx.core.content.ContextCompat; import androidx.core.content.ContextCompat;
import static android.content.Context.LAYOUT_INFLATER_SERVICE; import static android.content.Context.LAYOUT_INFLATER_SERVICE;
import static org.briarproject.android.dontkillmelib.PowerUtils.showOnboardingDialog; import static org.briarproject.mailbox.android.dontkillme.DoNotKillMeUtils.showOnboardingDialog;
@UiThread @UiThread
abstract class PowerView extends ConstraintLayout { abstract class PowerView extends ConstraintLayout {
......
...@@ -9,7 +9,7 @@ import androidx.annotation.UiThread; ...@@ -9,7 +9,7 @@ import androidx.annotation.UiThread;
import static org.briarproject.android.dontkillmelib.PowerUtils.isMiuiTenOrLater; import static org.briarproject.android.dontkillmelib.PowerUtils.isMiuiTenOrLater;
import static org.briarproject.android.dontkillmelib.PowerUtils.isXiaomiOrRedmiDevice; import static org.briarproject.android.dontkillmelib.PowerUtils.isXiaomiOrRedmiDevice;
import static org.briarproject.android.dontkillmelib.PowerUtils.showOnboardingDialog; import static org.briarproject.mailbox.android.dontkillme.DoNotKillMeUtils.showOnboardingDialog;
@UiThread @UiThread
public class XiaomiView extends PowerView { public class XiaomiView extends PowerView {
......
...@@ -5,6 +5,8 @@ ...@@ -5,6 +5,8 @@
<item name="android:textColor">?attr/colorSecondary</item> <item name="android:textColor">?attr/colorSecondary</item>
</style> </style>
<style name="OnboardingDialogTheme" parent="Theme.AppCompat.DayNight.Dialog.MinWidth" />
<style name="PowerIcon"> <style name="PowerIcon">
<item name="android:background">@drawable/ic_circle</item> <item name="android:background">@drawable/ic_circle</item>
<!-- Figma had #222E3C as backgroundTint, but the style guide's closest is this --> <!-- Figma had #222E3C as backgroundTint, but the style guide's closest is this -->
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment