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

Commit

Permalink
Improved function help layout
Browse files Browse the repository at this point in the history
Refs #1947
  • Loading branch information
M66B committed Aug 30, 2014
1 parent f32a5e8 commit 6d0120e
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 15 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ Version 3.x will be available with a [pro license](http://www.xprivacy.eu/) only
**Next release**

* Improved settings layout ([pull request](/../../issues/1946))
* Show function help in a dialog ([pull request](/../../issues/1947))
* Improved function help layout ([pull request](/../../issues/1947))

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

Expand Down
20 changes: 19 additions & 1 deletion res/layout/help.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
Expand All @@ -17,13 +18,30 @@
android:id="@+id/tvTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textStyle="bold" />

<TextView
android:id="@+id/tvInfo"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="12dip" />
android:layout_marginTop="6dip" />

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="12dip"
android:text="@string/title_permissions"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textStyle="bold" />

<TextView
android:id="@+id/tvPermissions"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="6dip"
android:text="-"
tools:ignore="HardcodedText" />
</LinearLayout>

</ScrollView>
24 changes: 11 additions & 13 deletions src/biz/bokhorst/xprivacy/ActivityApp.java
Original file line number Diff line number Diff line change
Expand Up @@ -1783,25 +1783,23 @@ public static void showHelp(ActivityBase context, View parent, Hook hook) {
dlgHelp.setFeatureDrawableResource(Window.FEATURE_LEFT_ICON, context.getThemed(R.attr.icon_launcher));
dlgHelp.setCancelable(true);

// Set text title
// Set title
TextView tvTitle = (TextView) dlgHelp.findViewById(R.id.tvTitle);
tvTitle.setText(hook.getName());

// Set text content
String text = hook.getAnnotation();
String[] permissions = hook.getPermissions();
if (permissions != null && permissions.length > 0) {
text += "<br /><br /><b>" + context.getString(R.string.title_permissions) + "</b><br /><br />";
if (permissions[0].equals(""))
text += "-";
else
text += TextUtils.join("<br />", permissions);
}

// Set info
TextView tvInfo = (TextView) dlgHelp.findViewById(R.id.tvInfo);
tvInfo.setText(Html.fromHtml(text));
tvInfo.setText(Html.fromHtml(hook.getAnnotation()));
tvInfo.setMovementMethod(LinkMovementMethod.getInstance());

// Set permissions
String[] permissions = hook.getPermissions();
if (permissions != null && permissions.length > 0)
if (!permissions[0].equals("")) {
TextView tvPermissions = (TextView) dlgHelp.findViewById(R.id.tvPermissions);
tvPermissions.setText(Html.fromHtml(TextUtils.join("<br />", permissions)));
}

dlgHelp.show();
}
}

0 comments on commit 6d0120e

Please sign in to comment.