Loading app/build.gradle +1 −1 Original line number Diff line number Diff line Loading @@ -101,7 +101,7 @@ dependencies { // include the e specific version of the modules, just for the e flavor eImplementation project(":privacymodulese") implementation 'foundation.e:privacymodule.api:0.2.1' implementation 'foundation.e:privacymodule.api:0.3.1' implementation 'foundation.e:privacymodule.tor:0.1.0' implementation 'com.github.PhilJay:MPAndroidChart:v3.1.0' Loading app/src/main/java/foundation/e/privacycentralapp/DependencyContainer.kt +6 −0 Original line number Diff line number Diff line Loading @@ -30,6 +30,7 @@ import foundation.e.privacycentralapp.features.dashboard.DashBoardViewModelFacto import foundation.e.privacycentralapp.features.internetprivacy.InternetPrivacyViewModelFactory import foundation.e.privacycentralapp.features.location.FakeLocationViewModelFactory import foundation.e.privacycentralapp.features.location.LocationApiDelegate import foundation.e.privacycentralapp.features.trackers.TrackersViewModelFactory import foundation.e.privacymodules.ipscrambler.IpScramblerModule import foundation.e.privacymodules.ipscramblermodule.IIpScramblerModule import foundation.e.privacymodules.location.FakeLocation Loading Loading @@ -83,6 +84,7 @@ class DependencyContainer constructor(val app: Application) { TrackersStatisticsUseCase(trackTrackersPrivacyModule) } // ViewModelFactories val dashBoardViewModelFactory by lazy { DashBoardViewModelFactory(getQuickPrivacyStateUseCase, ipScramblingStateUseCase, trackersStatisticsUseCase) } Loading @@ -96,4 +98,8 @@ class DependencyContainer constructor(val app: Application) { val internetPrivacyViewModelFactory by lazy { InternetPrivacyViewModelFactory(ipScramblerModule, getQuickPrivacyStateUseCase, ipScramblingStateUseCase, appListUseCase) } val trackersViewModelFactory by lazy { TrackersViewModelFactory(getQuickPrivacyStateUseCase, trackersStatisticsUseCase, appListUseCase) } } app/src/main/java/foundation/e/privacycentralapp/common/AppsAdapter.kt 0 → 100644 +67 −0 Original line number Diff line number Diff line /* * Copyright (C) 2021 E FOUNDATION * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <https://www.gnu.org/licenses/>. */ package foundation.e.privacycentralapp.common import android.view.LayoutInflater import android.view.View import android.view.ViewGroup import android.widget.ImageView import android.widget.TextView import androidx.recyclerview.widget.RecyclerView import foundation.e.privacycentralapp.R import foundation.e.privacymodules.permissions.data.ApplicationDescription class AppsAdapter( private val itemsLayout: Int, private val listener: (String) -> Unit ) : RecyclerView.Adapter<AppsAdapter.ViewHolder>() { class ViewHolder(view: View) : RecyclerView.ViewHolder(view) { val appName: TextView = view.findViewById(R.id.title) fun bind(item: ApplicationDescription) { appName.text = item.label itemView.findViewById<ImageView>(R.id.icon).setImageDrawable(item.icon) } } var dataSet: List<ApplicationDescription> = emptyList() set(value) { field = value notifyDataSetChanged() } override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder { val view = LayoutInflater.from(parent.context) .inflate(itemsLayout, parent, false) val holder = ViewHolder(view) holder.itemView.setOnClickListener { _ -> listener(dataSet[holder.adapterPosition].packageName) } return holder } override fun onBindViewHolder(holder: ViewHolder, position: Int) { val app = dataSet[position] holder.bind(app) } override fun getItemCount(): Int = dataSet.size } app/src/main/java/foundation/e/privacycentralapp/common/ToggleAppsAdapter.kt +0 −2 Original line number Diff line number Diff line Loading @@ -22,7 +22,6 @@ import android.view.View import android.view.ViewGroup import android.widget.CheckBox import android.widget.ImageView import android.widget.Switch import android.widget.TextView import androidx.recyclerview.widget.RecyclerView import foundation.e.privacycentralapp.R Loading Loading @@ -60,7 +59,6 @@ class ToggleAppsAdapter( holder.togglePermission.setOnCheckedChangeListener { _, isChecked -> listener(dataSet[holder.adapterPosition].first.packageName, isChecked) } view.findViewById<Switch>(R.id.toggle) return holder } Loading app/src/main/java/foundation/e/privacycentralapp/domain/usecases/TrackersStatisticsUseCase.kt +16 −0 Original line number Diff line number Diff line Loading @@ -26,4 +26,20 @@ class TrackersStatisticsUseCase( fun getPast24HoursTrackersCalls(): List<Int> { return trackTrackersPrivacyModule.getPast24HoursTrackersCalls() } fun getDayMonthYearStatistics(): Triple<List<Int>, List<Int>, List<Int>> { return Triple( trackTrackersPrivacyModule.getPast24HoursTrackersCalls(), trackTrackersPrivacyModule.getPastMonthTrackersCalls(), trackTrackersPrivacyModule.getPastYearTrackersCalls() ) } fun getDayMonthYearCounts(): Triple<Int, Int, Int> { return Triple( trackTrackersPrivacyModule.getPast24HoursTrackersCount(), trackTrackersPrivacyModule.getPastMonthTrackersCount(), trackTrackersPrivacyModule.getPastYearTrackersCount() ) } } Loading
app/build.gradle +1 −1 Original line number Diff line number Diff line Loading @@ -101,7 +101,7 @@ dependencies { // include the e specific version of the modules, just for the e flavor eImplementation project(":privacymodulese") implementation 'foundation.e:privacymodule.api:0.2.1' implementation 'foundation.e:privacymodule.api:0.3.1' implementation 'foundation.e:privacymodule.tor:0.1.0' implementation 'com.github.PhilJay:MPAndroidChart:v3.1.0' Loading
app/src/main/java/foundation/e/privacycentralapp/DependencyContainer.kt +6 −0 Original line number Diff line number Diff line Loading @@ -30,6 +30,7 @@ import foundation.e.privacycentralapp.features.dashboard.DashBoardViewModelFacto import foundation.e.privacycentralapp.features.internetprivacy.InternetPrivacyViewModelFactory import foundation.e.privacycentralapp.features.location.FakeLocationViewModelFactory import foundation.e.privacycentralapp.features.location.LocationApiDelegate import foundation.e.privacycentralapp.features.trackers.TrackersViewModelFactory import foundation.e.privacymodules.ipscrambler.IpScramblerModule import foundation.e.privacymodules.ipscramblermodule.IIpScramblerModule import foundation.e.privacymodules.location.FakeLocation Loading Loading @@ -83,6 +84,7 @@ class DependencyContainer constructor(val app: Application) { TrackersStatisticsUseCase(trackTrackersPrivacyModule) } // ViewModelFactories val dashBoardViewModelFactory by lazy { DashBoardViewModelFactory(getQuickPrivacyStateUseCase, ipScramblingStateUseCase, trackersStatisticsUseCase) } Loading @@ -96,4 +98,8 @@ class DependencyContainer constructor(val app: Application) { val internetPrivacyViewModelFactory by lazy { InternetPrivacyViewModelFactory(ipScramblerModule, getQuickPrivacyStateUseCase, ipScramblingStateUseCase, appListUseCase) } val trackersViewModelFactory by lazy { TrackersViewModelFactory(getQuickPrivacyStateUseCase, trackersStatisticsUseCase, appListUseCase) } }
app/src/main/java/foundation/e/privacycentralapp/common/AppsAdapter.kt 0 → 100644 +67 −0 Original line number Diff line number Diff line /* * Copyright (C) 2021 E FOUNDATION * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <https://www.gnu.org/licenses/>. */ package foundation.e.privacycentralapp.common import android.view.LayoutInflater import android.view.View import android.view.ViewGroup import android.widget.ImageView import android.widget.TextView import androidx.recyclerview.widget.RecyclerView import foundation.e.privacycentralapp.R import foundation.e.privacymodules.permissions.data.ApplicationDescription class AppsAdapter( private val itemsLayout: Int, private val listener: (String) -> Unit ) : RecyclerView.Adapter<AppsAdapter.ViewHolder>() { class ViewHolder(view: View) : RecyclerView.ViewHolder(view) { val appName: TextView = view.findViewById(R.id.title) fun bind(item: ApplicationDescription) { appName.text = item.label itemView.findViewById<ImageView>(R.id.icon).setImageDrawable(item.icon) } } var dataSet: List<ApplicationDescription> = emptyList() set(value) { field = value notifyDataSetChanged() } override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder { val view = LayoutInflater.from(parent.context) .inflate(itemsLayout, parent, false) val holder = ViewHolder(view) holder.itemView.setOnClickListener { _ -> listener(dataSet[holder.adapterPosition].packageName) } return holder } override fun onBindViewHolder(holder: ViewHolder, position: Int) { val app = dataSet[position] holder.bind(app) } override fun getItemCount(): Int = dataSet.size }
app/src/main/java/foundation/e/privacycentralapp/common/ToggleAppsAdapter.kt +0 −2 Original line number Diff line number Diff line Loading @@ -22,7 +22,6 @@ import android.view.View import android.view.ViewGroup import android.widget.CheckBox import android.widget.ImageView import android.widget.Switch import android.widget.TextView import androidx.recyclerview.widget.RecyclerView import foundation.e.privacycentralapp.R Loading Loading @@ -60,7 +59,6 @@ class ToggleAppsAdapter( holder.togglePermission.setOnCheckedChangeListener { _, isChecked -> listener(dataSet[holder.adapterPosition].first.packageName, isChecked) } view.findViewById<Switch>(R.id.toggle) return holder } Loading
app/src/main/java/foundation/e/privacycentralapp/domain/usecases/TrackersStatisticsUseCase.kt +16 −0 Original line number Diff line number Diff line Loading @@ -26,4 +26,20 @@ class TrackersStatisticsUseCase( fun getPast24HoursTrackersCalls(): List<Int> { return trackTrackersPrivacyModule.getPast24HoursTrackersCalls() } fun getDayMonthYearStatistics(): Triple<List<Int>, List<Int>, List<Int>> { return Triple( trackTrackersPrivacyModule.getPast24HoursTrackersCalls(), trackTrackersPrivacyModule.getPastMonthTrackersCalls(), trackTrackersPrivacyModule.getPastYearTrackersCalls() ) } fun getDayMonthYearCounts(): Triple<Int, Int, Int> { return Triple( trackTrackersPrivacyModule.getPast24HoursTrackersCount(), trackTrackersPrivacyModule.getPastMonthTrackersCount(), trackTrackersPrivacyModule.getPastYearTrackersCount() ) } }