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

Change Holo dialogs to Material #270

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
17 changes: 13 additions & 4 deletions app/src/main/java/com/github/mobile/ui/LightAlertDialog.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,11 @@
import android.app.AlertDialog;
import android.content.Context;

import static android.R.style.Theme_Holo_Light_Dialog;
import static android.R.style.Theme_Material_Light_Dialog_Alert;

/**
* Alert dialog using the Holo Light theme
* Alert dialog using the Material Light theme
*/
public class LightAlertDialog extends AlertDialog {

Expand All @@ -30,7 +33,10 @@ public class LightAlertDialog extends AlertDialog {
* @return dialog
*/
public static AlertDialog create(final Context context) {
return new LightAlertDialog(context, THEME_HOLO_LIGHT);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP)
return new LightAlertDialog(context, Theme_Material_Light_Dialog_Alert);
else
return new LightAlertDialog(context, Theme_Holo_Light_Dialog);
}

private LightAlertDialog(final Context context, final int theme) {
Expand All @@ -42,7 +48,7 @@ private LightAlertDialog(final Context context) {
}

/**
* Alert dialog builder using the Holo Light theme
* Alert dialog builder using the Material Light theme
*/
public static class Builder extends AlertDialog.Builder {

Expand All @@ -53,7 +59,10 @@ public static class Builder extends AlertDialog.Builder {
* @return dialog builder
*/
public static LightAlertDialog.Builder create(final Context context) {
return new LightAlertDialog.Builder(context, THEME_HOLO_LIGHT);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP)
return new LightAlertDialog.Builder(context, Theme_Material_Light_Dialog_Alert);
else
return new LightAlertDialog.Builder(context, Theme_Holo_Light_Dialog);
}

private Builder(Context context) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,15 @@
import android.app.AlertDialog;
import android.app.ProgressDialog;
import android.content.Context;
import android.os.Build;

import com.github.mobile.R;

import static android.R.style.Theme_Holo_Light_Dialog;
import static android.R.style.Theme_Material_Light_Dialog_Alert;

/**
* Progress dialog in Holo Light theme
* Progress dialog in Material Light theme
*/
public class LightProgressDialog extends ProgressDialog {

Expand Down Expand Up @@ -55,6 +58,6 @@ public static AlertDialog create(Context context, CharSequence message) {
}

private LightProgressDialog(Context context, CharSequence message) {
super(context, THEME_HOLO_LIGHT);
super(context, Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP ? Theme_Material_Light_Dialog_Alert : Theme_Holo_Light_Dialog);
}
}