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

Commit

Permalink
Showing category help in web view
Browse files Browse the repository at this point in the history
Fixes #1943
  • Loading branch information
M66B committed Aug 31, 2014
1 parent 4e94bd5 commit b6d960c
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 6 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ Version 3.x will be available with a [pro license](http://www.xprivacy.eu/) only

* Showing appropriate main and details help ([issue](/../../issues/1921))
* Showing application name above usage data ([issue](/../../issues/1949))
* Showing category help in web view ([issue](/../../issues/1943))

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

Expand Down
22 changes: 16 additions & 6 deletions src/biz/bokhorst/xprivacy/ActivityMain.java
Original file line number Diff line number Diff line change
Expand Up @@ -201,13 +201,27 @@ protected void onCreate(Bundle savedInstanceState) {
// Handle info
ImageView imgInfo = (ImageView) findViewById(R.id.imgInfo);
imgInfo.setOnClickListener(new View.OnClickListener() {
@SuppressLint("SetJavaScriptEnabled")
@Override
public void onClick(View view) {
int position = spRestriction.getSelectedItemPosition();
if (position != AdapterView.INVALID_POSITION) {
String query = (position == 0 ? "restrictions" : (String) PrivacyManager
.getRestrictions(ActivityMain.this).values().toArray()[position - 1]);
Util.viewUri(ActivityMain.this, Uri.parse("https://github.com/M66B/XPrivacy#" + query));

WebView webview = new WebView(ActivityMain.this);
webview.getSettings().setUserAgentString("Mozilla/5.0");
// needed for hashtag
webview.getSettings().setJavaScriptEnabled(true);
webview.loadUrl("https://github.com/M66B/XPrivacy#" + query);

AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(ActivityMain.this);
alertDialogBuilder.setTitle((String) spRestriction.getSelectedItem());
alertDialogBuilder.setIcon(getThemed(R.attr.icon_launcher));
alertDialogBuilder.setView(webview);
alertDialogBuilder.setCancelable(true);
AlertDialog alertDialog = alertDialogBuilder.create();
alertDialog.show();
}
}
});
Expand Down Expand Up @@ -1054,15 +1068,11 @@ public void onPageFinished(WebView view, String url) {
}
});
webview.loadUrl("https://github.com/M66B/XPrivacy/blob/master/CHANGELOG.md");

AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(this);
alertDialogBuilder.setTitle(R.string.menu_changelog);
alertDialogBuilder.setIcon(getThemed(R.attr.icon_launcher));
alertDialogBuilder.setView(webview);
alertDialogBuilder.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
}
});
AlertDialog alertDialog = alertDialogBuilder.create();
alertDialog.show();
}
Expand Down

0 comments on commit b6d960c

Please sign in to comment.