diff options
Diffstat (limited to 'app')
3 files changed, 15 insertions, 4 deletions
diff --git a/app/build.gradle b/app/build.gradle index 056246c..06a4a1d 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -101,7 +101,7 @@ dependencies { implementation 'foundation.e:privacymodule.trackerfilter:0.1.3' implementation 'foundation.e:privacymodule.api:0.4.3' implementation 'foundation.e:privacymodule.e-29:0.4.1' - implementation 'foundation.e:privacymodule.tor:0.2.0' + implementation 'foundation.e:privacymodule.tor:0.2.1' implementation 'com.github.PhilJay:MPAndroidChart:v3.1.0' diff --git a/app/src/main/java/foundation/e/privacycentralapp/common/ToggleAppsAdapter.kt b/app/src/main/java/foundation/e/privacycentralapp/common/ToggleAppsAdapter.kt index 82f8d43..9d62381 100644 --- a/app/src/main/java/foundation/e/privacycentralapp/common/ToggleAppsAdapter.kt +++ b/app/src/main/java/foundation/e/privacycentralapp/common/ToggleAppsAdapter.kt @@ -38,9 +38,10 @@ class ToggleAppsAdapter( val togglePermission: CheckBox = view.findViewById(R.id.toggle) - fun bind(item: Pair<ApplicationDescription, Boolean>) { + fun bind(item: Pair<ApplicationDescription, Boolean>, isEnabled: Boolean) { appName.text = item.first.label togglePermission.isChecked = item.second + togglePermission.isEnabled = isEnabled itemView.findViewById<ImageView>(R.id.icon).setImageDrawable(item.first.icon) } @@ -52,6 +53,13 @@ class ToggleAppsAdapter( notifyDataSetChanged() } + var isEnabled: Boolean = true + + fun setData(list: List<Pair<ApplicationDescription, Boolean>>, isEnabled: Boolean = true) { + this.isEnabled = isEnabled + dataSet = list + } + override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder { val view = LayoutInflater.from(parent.context) .inflate(itemsLayout, parent, false) @@ -64,7 +72,7 @@ class ToggleAppsAdapter( override fun onBindViewHolder(holder: ViewHolder, position: Int) { val permission = dataSet[position] - holder.bind(permission) + holder.bind(permission, isEnabled) } override fun getItemCount(): Int = dataSet.size diff --git a/app/src/main/java/foundation/e/privacycentralapp/features/internetprivacy/InternetPrivacyFragment.kt b/app/src/main/java/foundation/e/privacycentralapp/features/internetprivacy/InternetPrivacyFragment.kt index 3e0b549..f288320 100644 --- a/app/src/main/java/foundation/e/privacycentralapp/features/internetprivacy/InternetPrivacyFragment.kt +++ b/app/src/main/java/foundation/e/privacycentralapp/features/internetprivacy/InternetPrivacyFragment.kt @@ -155,7 +155,10 @@ class InternetPrivacyFragment : // TODO: this should not be mandatory. binding.apps.post { - (binding.apps.adapter as ToggleAppsAdapter?)?.dataSet = state.getApps() + (binding.apps.adapter as ToggleAppsAdapter?)?.setData( + list = state.getApps(), + isEnabled = state.mode == InternetPrivacyMode.HIDE_IP + ) } val viewIdsToHide = listOf( |