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

Commit

Permalink
Showing icon if there is white/black list for a function
Browse files Browse the repository at this point in the history
Refs #1654
  • Loading branch information
M66B committed May 29, 2014
1 parent 867771d commit 8d28506
Show file tree
Hide file tree
Showing 8 changed files with 35 additions and 0 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ Changelog

**Next release**

* Showing icon if there is white/black list for a function ([issue](/../../issues/1654))

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

**Version 2.0.26 BETA**
Expand Down
Binary file added res/drawable/whitelist_holo_dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added res/drawable/whitelist_holo_light.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 10 additions & 0 deletions res/layout/help.xml
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,16 @@
android:textAppearance="?android:attr/textAppearanceMedium"
android:textIsSelectable="false" />

<TextView
android:layout_width="wrap_content"
android:layout_height="48dip"
android:drawableLeft="?attr/icon_whitelist"
android:drawablePadding="6dip"
android:gravity="center_vertical"
android:text="@string/menu_whitelists"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textIsSelectable="false" />

<!-- dangerous -->

<LinearLayout
Expand Down
10 changes: 10 additions & 0 deletions res/layout/restrictionchild.xml
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,16 @@
android:textAppearance="?android:attr/textAppearanceSmall"
tools:ignore="NestedWeights" />

<ImageView
android:id="@+id/imgCbMethodWhitelist"
android:layout_width="32dip"
android:layout_height="32dip"
android:layout_gravity="center_vertical"
android:contentDescription="@string/menu_whitelists"
android:paddingLeft="3dip"
android:src="?attr/icon_whitelist"
android:visibility="gone" />

<ImageView
android:id="@+id/imgCbMethodRestricted"
android:layout_width="32dip"
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 @@ -5,6 +5,7 @@
<item name="icon_help">@android:drawable/ic_menu_help</item>
<item name="icon_info">@drawable/info_holo_dark</item>
<item name="icon_info_book">@drawable/info_book_holo_dark</item>
<item name="icon_whitelist">@drawable/whitelist_holo_dark</item>
<item name="icon_internet">@drawable/internet_holo_dark</item>
<item name="icon_used">@drawable/used_holo_dark</item>
<item name="icon_used_grayed">@drawable/used_holo_dark_grayed</item>
Expand Down Expand Up @@ -32,6 +33,7 @@
<item name="icon_help">@android:drawable/ic_menu_help</item>
<item name="icon_info">@drawable/info_holo_light</item>
<item name="icon_info_book">@drawable/info_book_holo_light</item>
<item name="icon_whitelist">@drawable/whitelist_holo_light</item>
<item name="icon_internet">@drawable/internet_holo_light</item>
<item name="icon_used">@drawable/used_holo_light</item>
<item name="icon_used_grayed">@drawable/used_holo_light_grayed</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 @@ -5,6 +5,7 @@
<attr name="icon_help" format="reference" />
<attr name="icon_info" format="reference" />
<attr name="icon_info_book" format="reference" />
<attr name="icon_whitelist" format="reference" />
<attr name="icon_internet" format="reference" />
<attr name="icon_used" format="reference" />
<attr name="icon_used_grayed" format="reference" />
Expand Down
10 changes: 10 additions & 0 deletions src/biz/bokhorst/xprivacy/ActivityApp.java
Original file line number Diff line number Diff line change
Expand Up @@ -1286,6 +1286,7 @@ private class ChildViewHolder {
public ImageView imgInfo;
public TextView tvMethodName;
public ImageView imgCbMethodRestricted;
public ImageView imgCbMethodWhitelist;
public ProgressBar pbRunning;
public ImageView imgCbMethodAsk;
public LinearLayout llMethodName;
Expand All @@ -1299,6 +1300,7 @@ private ChildViewHolder(View theRow, int gPosition, int cPosition) {
imgInfo = (ImageView) row.findViewById(R.id.imgInfo);
tvMethodName = (TextView) row.findViewById(R.id.tvMethodName);
imgCbMethodRestricted = (ImageView) row.findViewById(R.id.imgCbMethodRestricted);
imgCbMethodWhitelist = (ImageView) row.findViewById(R.id.imgCbMethodWhitelist);
pbRunning = (ProgressBar) row.findViewById(R.id.pbRunning);
imgCbMethodAsk = (ImageView) row.findViewById(R.id.imgCbMethodAsk);
llMethodName = (LinearLayout) row.findViewById(R.id.llMethodName);
Expand All @@ -1316,6 +1318,7 @@ private class ChildHolderTask extends AsyncTask<Object, Object, Object> {
private boolean permission;
private RState rstate;
private boolean ondemand;
private boolean whitelist;

public ChildHolderTask(int gPosition, int cPosition, ChildViewHolder theHolder, String theRestrictionName) {
groupPosition = gPosition;
Expand All @@ -1339,6 +1342,10 @@ protected Object doInBackground(Object... params) {
if (ondemand)
ondemand = PrivacyManager.getSettingBool(-mAppInfo.getUid(), PrivacyManager.cSettingOnDemand,
false, false);
if (md.whitelist() == null)
whitelist = false;
else
whitelist = PrivacyManager.listWhitelisted(mAppInfo.getUid()).containsKey(md.whitelist());

return holder;
}
Expand Down Expand Up @@ -1368,6 +1375,8 @@ protected void onPostExecute(Object result) {
holder.imgCbMethodRestricted.setImageBitmap(getCheckBoxImage(rstate));
holder.imgCbMethodRestricted.setVisibility(View.VISIBLE);

holder.imgCbMethodWhitelist.setVisibility(whitelist ? View.VISIBLE : View.GONE);

if (ondemand) {
holder.imgCbMethodAsk.setImageBitmap(getAskBoxImage(rstate));
holder.imgCbMethodAsk.setVisibility(View.VISIBLE);
Expand Down Expand Up @@ -1534,6 +1543,7 @@ public void onClick(View view) {
// Display restriction
holder.llMethodName.setClickable(false);
holder.imgCbMethodRestricted.setVisibility(View.INVISIBLE);
holder.imgCbMethodWhitelist.setVisibility(View.GONE);

// Async update
new ChildHolderTask(groupPosition, childPosition, holder, restrictionName).executeOnExecutor(mExecutor,
Expand Down

0 comments on commit 8d28506

Please sign in to comment.