Skip to content
This repository has been archived by the owner on Sep 6, 2019. It is now read-only.

Commit

Permalink
Set dangerous color on demand dialog
Browse files Browse the repository at this point in the history
  • Loading branch information
M66B committed Feb 3, 2014
1 parent c3cbf83 commit ae62214
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions src/biz/bokhorst/xprivacy/PrivacyService.java
Original file line number Diff line number Diff line change
Expand Up @@ -1001,7 +1001,7 @@ public void clear() throws RemoteException {

// Helper methods

private Boolean onDemandDialog(Hook hook, final PRestriction restriction) {
private Boolean onDemandDialog(final Hook hook, final PRestriction restriction) {
final PRestriction result = new PRestriction(restriction.uid, restriction.restrictionName, null, false);
try {
// Without handler nothing can be done
Expand Down Expand Up @@ -1060,8 +1060,8 @@ public void run() {
dialogLock.lock();
semaphore.release();

AlertDialog.Builder builder = getOnDemandDialogBuilder(restriction, result, context,
dialogLock);
AlertDialog.Builder builder = getOnDemandDialogBuilder(restriction, hook, result,
context, dialogLock);
AlertDialog alertDialog = builder.create();
alertDialog.getWindow().setType(WindowManager.LayoutParams.TYPE_SYSTEM_ALERT);
alertDialog.setCancelable(false);
Expand Down Expand Up @@ -1110,8 +1110,9 @@ final class AlertDialogHolder {
public AlertDialog dialog;
}

private AlertDialog.Builder getOnDemandDialogBuilder(final PRestriction restriction, final PRestriction result,
final Context context, final ReentrantLock dialogLock) throws NameNotFoundException {
private AlertDialog.Builder getOnDemandDialogBuilder(final PRestriction restriction, Hook hook,
final PRestriction result, Context context, final ReentrantLock dialogLock)
throws NameNotFoundException {
// Get resources
String self = PrivacyService.class.getPackage().getName();
Resources resources = context.getPackageManager().getResourcesForApplication(self);
Expand All @@ -1133,6 +1134,8 @@ private AlertDialog.Builder getOnDemandDialogBuilder(final PRestriction restrict
LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.MATCH_PARENT);
llContainer.setLayoutParams(llContainerParams);
llContainer.setPadding(hmargin, vmargin, hmargin, vmargin);
if (hook.isDangerous())
llContainer.setBackgroundColor(resources.getColor(R.color.color_dangerous_dark));

// Container for icon & message
LinearLayout llApplication = new LinearLayout(context);
Expand Down

0 comments on commit ae62214

Please sign in to comment.