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

Commit

Permalink
Display user defined dangerous functions orangish
Browse files Browse the repository at this point in the history
Fixes #1626
  • Loading branch information
M66B committed Apr 13, 2014
1 parent b4e63cc commit 2f4ec04
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 2 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ Changelog

* Fixed applying template in relation to default restrictions ([issue](/../../issues/1566))
* Prefix export file name with date ([issue](/../../issues/1625))
* Display user defined dangerous functions orangish ([issue](/../../issues/1626))
* Long press on a function in the template to define dangerous functions

[Open issues](https://github.com/M66B/XPrivacy/issues?state=open)

Expand Down
2 changes: 2 additions & 0 deletions res/values-v14/styles.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
<item name="drawable_background">@android:color/black</item>
<item name="drawable_card">@drawable/card_dark</item>
<item name="color_dangerous">@color/color_dangerous_dark</item>
<item name="color_dangerous_user">@color/color_dangerous_user_dark</item>
<item name="color_state_attention">@color/color_state_attention_dark</item>
<item name="color_state_restricted">@color/color_state_restricted_dark</item>
<item name="color_state_shared">@color/color_state_shared_dark</item>
Expand All @@ -44,6 +45,7 @@
<item name="drawable_background">@color/color_home_background_light</item>
<item name="drawable_card">@drawable/card_light</item>
<item name="color_dangerous">@color/color_dangerous_light</item>
<item name="color_dangerous_user">@color/color_dangerous_user_light</item>
<item name="color_state_attention">@color/color_state_attention_light</item>
<item name="color_state_restricted">@color/color_state_restricted_light</item>
<item name="color_state_shared">@color/color_state_shared_light</item>
Expand Down
1 change: 1 addition & 0 deletions res/values/attrs.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
<attr name="drawable_background" format="reference" />
<attr name="drawable_card" format="reference" />
<attr name="color_dangerous" format="reference" />
<attr name="color_dangerous_user" format="reference" />
<attr name="color_state_attention" format="reference" />
<attr name="color_state_restricted" format="reference" />
<attr name="color_state_shared" format="reference" />
Expand Down
2 changes: 2 additions & 0 deletions res/values/colors.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@

<color name="color_dangerous_light">#3CF83A3A</color>
<color name="color_dangerous_dark">#50F83A3A</color>
<color name="color_dangerous_user_light">#3CF8743A</color>
<color name="color_dangerous_user_dark">#50F8743A</color>
<color name="color_filter_background_start">#30404040</color>
<color name="color_filter_background_end">#30D0D0D0</color>
<color name="color_home_background_light">#FFE5E5E5</color>
Expand Down
7 changes: 5 additions & 2 deletions src/biz/bokhorst/xprivacy/ActivityMain.java
Original file line number Diff line number Diff line change
Expand Up @@ -1224,7 +1224,8 @@ public View getChildView(int groupPosition, int childPosition, boolean isLastChi

// Set data
if (hook.isDangerous())
holder.row.setBackgroundColor(getResources().getColor(getThemed(R.attr.color_dangerous)));
holder.row.setBackgroundColor(getResources().getColor(
getThemed(hook.isDangerousDefined() ? R.attr.color_dangerous : R.attr.color_dangerous_user)));
else
holder.row.setBackgroundColor(Color.TRANSPARENT);
holder.tvRestriction.setText(hook.getName());
Expand All @@ -1243,7 +1244,9 @@ public boolean onLongClick(View view) {

// Change background color
if (hook.isDangerous())
holder.row.setBackgroundColor(getResources().getColor(getThemed(R.attr.color_dangerous)));
holder.row.setBackgroundColor(getResources().getColor(
getThemed(hook.isDangerousDefined() ? R.attr.color_dangerous
: R.attr.color_dangerous_user)));
else
holder.row.setBackgroundColor(Color.TRANSPARENT);

Expand Down
4 changes: 4 additions & 0 deletions src/biz/bokhorst/xprivacy/Hook.java
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,10 @@ public void toggleDangerous() {
PrivacyManager.setSetting(0, name, Boolean.toString(!isDangerous()));
}

public boolean isDangerousDefined() {
return mDangerous;
}

public void annotate(String text) {
mAnnotation = text;
}
Expand Down

0 comments on commit 2f4ec04

Please sign in to comment.