From c141db84c385a04d4ae3a1c0476419266672cc9f Mon Sep 17 00:00:00 2001 From: M66B Date: Sat, 30 Aug 2014 08:26:37 +0200 Subject: [PATCH] Display introductory tutorial only on first run Fixes #1942 --- CHANGELOG.md | 1 + src/biz/bokhorst/xprivacy/ActivityMain.java | 36 +++++++++++++-------- 2 files changed, 23 insertions(+), 14 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 22b9d3039..bbb0c58f9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -49,6 +49,7 @@ Version 3.x will be available with a [pro license](http://www.xprivacy.eu/) only * Changed settings dialog to settings activity ([pull request](/../../issues/1938)) * Moved flush button to expert mode section ([issue](/../../issues/1934)) * Added category merge/reset ([issue](/../../issues/1909)) +* Display introductory tutorial only on first run after *About* ([issue](/../../issues/1942)) * Updated simplified Chinese translation [Open issues](https://github.com/M66B/XPrivacy/issues?state=open) diff --git a/src/biz/bokhorst/xprivacy/ActivityMain.java b/src/biz/bokhorst/xprivacy/ActivityMain.java index 561b1cce5..cf68bd01e 100644 --- a/src/biz/bokhorst/xprivacy/ActivityMain.java +++ b/src/biz/bokhorst/xprivacy/ActivityMain.java @@ -274,7 +274,6 @@ public void onClick(View view) { if (PrivacyManager.getSettingBool(userId, PrivacyManager.cSettingFirstRun, true)) { showChangelog = false; optionAbout(); - PrivacyManager.setSetting(userId, PrivacyManager.cSettingFirstRun, Boolean.FALSE.toString()); } // Tutorial @@ -1126,20 +1125,29 @@ private void optionAbout() { ((TextView) dlgAbout.findViewById(R.id.build_id)).setText(Build.ID); dlgAbout.setCancelable(true); - dlgAbout.show(); - dlgAbout.setOnDismissListener(new DialogInterface.OnDismissListener() { - @Override - public void onDismiss(DialogInterface dialog) { - Dialog dlgUsage = new Dialog(ActivityMain.this); - dlgUsage.requestWindowFeature(Window.FEATURE_LEFT_ICON); - dlgUsage.setTitle(R.string.app_name); - dlgUsage.setContentView(R.layout.usage); - dlgUsage.setFeatureDrawableResource(Window.FEATURE_LEFT_ICON, getThemed(R.attr.icon_launcher)); - dlgUsage.setCancelable(true); - dlgUsage.show(); - } - }); + final int userId = Util.getUserId(Process.myUid()); + if (PrivacyManager.getSettingBool(userId, PrivacyManager.cSettingFirstRun, true)) + dlgAbout.setOnDismissListener(new DialogInterface.OnDismissListener() { + @Override + public void onDismiss(DialogInterface dialog) { + Dialog dlgUsage = new Dialog(ActivityMain.this); + dlgUsage.requestWindowFeature(Window.FEATURE_LEFT_ICON); + dlgUsage.setTitle(R.string.app_name); + dlgUsage.setContentView(R.layout.usage); + dlgUsage.setFeatureDrawableResource(Window.FEATURE_LEFT_ICON, getThemed(R.attr.icon_launcher)); + dlgUsage.setCancelable(true); + dlgUsage.setOnDismissListener(new DialogInterface.OnDismissListener() { + @Override + public void onDismiss(DialogInterface dialog) { + PrivacyManager.setSetting(userId, PrivacyManager.cSettingFirstRun, Boolean.FALSE.toString()); + } + }); + dlgUsage.show(); + } + }); + + dlgAbout.show(); } // Tasks