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

Commit

Permalink
Improved usage data layout
Browse files Browse the repository at this point in the history
Closes #1424
  • Loading branch information
M66B committed Feb 22, 2014
1 parent 3f11012 commit 94c0d04
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 9 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ Changelog

* Restrict all *view* actions, show parameters and whitelisting ([issue](/../../issues/1419))
* You might see a few more messages *Restricted by XPrivacy* because of this
* Improved usage data layout, option to copy parameters ([issue](/../../issues/1424))

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

Expand Down
25 changes: 21 additions & 4 deletions res/layout/usageentry.xml
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,30 @@
android:textAppearance="?android:attr/textAppearanceSmall"
android:textIsSelectable="false" />

<TextView
android:id="@+id/tvRestriction"
<LinearLayout
android:layout_width="0dip"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_weight="1"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textIsSelectable="false" />
android:orientation="vertical" >

<TextView
android:id="@+id/tvRestriction"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ellipsize="start"
android:singleLine="true"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textIsSelectable="false"
android:textStyle="bold" />

<TextView
android:id="@+id/tvParameter"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textIsSelectable="true"
android:visibility="gone" />
</LinearLayout>

</LinearLayout>
14 changes: 9 additions & 5 deletions src/biz/bokhorst/xprivacy/ActivityUsage.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import android.os.Bundle;
import android.support.v4.app.NavUtils;
import android.support.v4.app.TaskStackBuilder;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuInflater;
Expand Down Expand Up @@ -227,6 +228,7 @@ private class ViewHolder {
public ImageView imgRestricted;
public TextView tvApp;
public TextView tvRestriction;
public TextView tvParameter;

public ViewHolder(View theRow, int thePosition) {
row = theRow;
Expand All @@ -236,6 +238,7 @@ public ViewHolder(View theRow, int thePosition) {
imgRestricted = (ImageView) row.findViewById(R.id.imgRestricted);
tvApp = (TextView) row.findViewById(R.id.tvApp);
tvRestriction = (TextView) row.findViewById(R.id.tvRestriction);
tvParameter = (TextView) row.findViewById(R.id.tvParameter);
}
}

Expand Down Expand Up @@ -299,11 +302,12 @@ public View getView(int position, View convertView, ViewGroup parent) {
holder.imgIcon.setVisibility(View.INVISIBLE);
holder.imgRestricted.setVisibility(usageData.restricted ? View.VISIBLE : View.INVISIBLE);
holder.tvApp.setText(Integer.toString(usageData.uid));
if (usageData.extra == null || !mHasProLicense)
holder.tvRestriction.setText(String.format("%s/%s", usageData.restrictionName, usageData.methodName));
else
holder.tvRestriction.setText(String.format("%s/%s(%s)", usageData.restrictionName,
usageData.methodName, usageData.extra));
holder.tvRestriction.setText(String.format("%s/%s", usageData.restrictionName, usageData.methodName));
if (!TextUtils.isEmpty(usageData.extra) && mHasProLicense) {
holder.tvParameter.setText(usageData.extra);
holder.tvParameter.setVisibility(View.VISIBLE);
} else
holder.tvParameter.setVisibility(View.GONE);

// Async update
new HolderTask(position, holder, usageData).executeOnExecutor(mExecutor, (Object) null);
Expand Down

0 comments on commit 94c0d04

Please sign in to comment.