From 731d77ebff7932ad55fc223b066538804acdd7b7 Mon Sep 17 00:00:00 2001 From: M66B Date: Tue, 18 Feb 2014 15:21:53 +0100 Subject: [PATCH] Exclude apply category / apply once Closes #1381 --- CHANGELOG.md | 1 + src/biz/bokhorst/xprivacy/PrivacyService.java | 19 ++++++++++++++++++- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7fc9a75bf..8eb8178d8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,6 +20,7 @@ Changelog * Fixed null pointer in storage/open * Fixed restricting GSF ID in some cases ([issue](/../../issues/1374)) +* Make it clear that *Apply to entire category* and *Once for ... seconds* exclude each other ([issue](/../../issues/1381)) * Improved filter view layout ([issue](/../../issues/1335)) **Version 1.99.46 TEST** diff --git a/src/biz/bokhorst/xprivacy/PrivacyService.java b/src/biz/bokhorst/xprivacy/PrivacyService.java index 6ae0d97a6..ec9cc6470 100644 --- a/src/biz/bokhorst/xprivacy/PrivacyService.java +++ b/src/biz/bokhorst/xprivacy/PrivacyService.java @@ -44,6 +44,7 @@ import android.view.ViewGroup; import android.view.WindowManager; import android.widget.CheckBox; +import android.widget.CompoundButton; import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.ProgressBar; @@ -1363,13 +1364,29 @@ private AlertDialog.Builder getOnDemandDialogBuilder(final PRestriction restrict // Once check box final CheckBox cbOnce = new CheckBox(context); cbOnce.setText(String.format(resources.getString(R.string.title_once), - PrivacyManager.cRestrictionCacheTimeoutMs / 1000)); + (restriction.extra == null ? PrivacyManager.cRestrictionCacheTimeoutMs : 0) / 1000)); cbOnce.setChecked(mSelectOnce); LinearLayout.LayoutParams llOnceParams = new LinearLayout.LayoutParams( LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT); cbOnce.setLayoutParams(llOnceParams); llContainer.addView(cbOnce); + // Category and once exclude each other + cbCategory.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { + @Override + public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { + if (isChecked) + cbOnce.setChecked(false); + } + }); + cbOnce.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { + @Override + public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { + if (isChecked) + cbCategory.setChecked(false); + } + }); + // Message TextView tvPlease = new TextView(context); tvPlease.setText(resources.getString(R.string.title_pleasesubmit));