summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRomain Hunault <romain.hunault@e.email>2021-05-27 16:29:58 +0000
committerRomain Hunault <romain.hunault@e.email>2021-05-27 16:29:58 +0000
commit97b51f18dcc2f87a9cdd7f482033e30a6282d853 (patch)
treed951b14909c2dc4aab9908edea9da2122550c59d
parent7c02e9a048319c10d7396e7ec094c368f27273fd (diff)
parentfafd978342abb8332fcf3ed45cdc3b7d437576ba (diff)
Merge branch 'improvement/ui' into 'master'
Fix title and add back navigation support See merge request e/privacy-central/privacycentralapp!5
-rw-r--r--.sign/platform.jksbin0 -> 2899 bytes
-rw-r--r--app/build.gradle154
-rw-r--r--app/libs/e-ui-sdk-1.0.1-q.jarbin0 -> 115211 bytes
-rw-r--r--app/src/main/java/foundation/e/privacycentralapp/common/NavToolbarFragment.kt34
-rw-r--r--app/src/main/java/foundation/e/privacycentralapp/common/ToolbarFragment.kt43
-rw-r--r--app/src/main/java/foundation/e/privacycentralapp/features/dashboard/DashboardFragment.kt15
-rw-r--r--app/src/main/java/foundation/e/privacycentralapp/features/dashboard/QuickProtectionFragment.kt19
-rw-r--r--app/src/main/java/foundation/e/privacycentralapp/features/internetprivacy/InternetPrivacyFragment.kt13
-rw-r--r--app/src/main/java/foundation/e/privacycentralapp/features/location/FakeLocationFragment.kt24
-rw-r--r--app/src/main/java/foundation/e/privacycentralapp/features/location/FakeLocationMapView.kt8
-rw-r--r--app/src/main/java/foundation/e/privacycentralapp/features/permissions/PermissionAppsFragment.kt18
-rw-r--r--app/src/main/java/foundation/e/privacycentralapp/features/permissions/PermissionsFragment.kt13
-rw-r--r--app/src/main/res/layout/fragment_dashboard.xml15
-rw-r--r--app/src/main/res/layout/fragment_fake_location.xml31
-rw-r--r--app/src/main/res/layout/fragment_internet_activity_policy.xml15
-rw-r--r--app/src/main/res/layout/fragment_permission_apps.xml14
-rw-r--r--app/src/main/res/layout/fragment_permissions.xml14
-rw-r--r--app/src/main/res/layout/fragment_quick_protection.xml15
-rw-r--r--app/src/main/res/layout/topbar.xml37
-rw-r--r--app/src/main/res/values/strings.xml5
-rw-r--r--build.gradle21
-rw-r--r--privapp-permissions-foundation.e.privacycentralapp.xml8
22 files changed, 277 insertions, 239 deletions
diff --git a/.sign/platform.jks b/.sign/platform.jks
new file mode 100644
index 0000000..3c32281
--- /dev/null
+++ b/.sign/platform.jks
Binary files differ
diff --git a/app/build.gradle b/app/build.gradle
index 1c3b820..24ec426 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -1,79 +1,111 @@
plugins {
- id 'com.android.application'
- id 'kotlin-android'
+ id 'com.android.application'
+ id 'kotlin-android'
}
android {
- compileSdkVersion buildConfig.compileSdk
+ compileSdkVersion buildConfig.compileSdk
- defaultConfig {
- applicationId "foundation.e.privacycentralapp"
- minSdkVersion buildConfig.minSdk
- targetSdkVersion buildConfig.targetSdk
- versionCode buildConfig.version.code
- versionName buildConfig.version.fullName
+ defaultConfig {
+ applicationId "foundation.e.privacycentralapp"
+ minSdkVersion buildConfig.minSdk
+ targetSdkVersion buildConfig.targetSdk
+ versionCode buildConfig.version.code
+ versionName buildConfig.version.fullName
- testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
+ testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
- resValue("string", "mapbox_key", MAPBOX_KEY)
- }
+ resValue("string", "mapbox_key", MAPBOX_KEY)
+ }
- // We define here the OS flavor e, specific for the /e/ OS version, and google, for any
- // Andriod device. The e or google prefix is then used in resources, dependencies, ... as
- // expected by the android gradle plugin.
- flavorDimensions 'os'
- productFlavors {
- e {
- applicationIdSuffix '.e'
- dimension 'os'
- }
- google {
- applicationIdSuffix '.google'
- dimension 'os'
- }
- }
+ signingConfigs {
+ debug {
+ storeFile rootProject.file(".sign/debug.keystore")
+ storePassword "android"
+ keyAlias "androiddebugkey"
+ keyPassword "android"
+ }
- buildTypes {
- release {
- minifyEnabled false
- proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
- }
- }
+ // We use test platform keys to sign /e/OS specific debug flavour.
+ eDebug {
+ storeFile rootProject.file(".sign/platform.jks")
+ storePassword "android"
+ keyAlias "platform"
+ keyPassword "android"
+ }
+ }
- signingConfigs {
- debug {
- storeFile rootProject.file(".sign/debug.keystore")
- storePassword "android"
- keyAlias "androiddebugkey"
- keyPassword "android"
- }
- }
+ // We define here the OS flavor e, specific for the /e/ OS version, and google, for any
+ // android device. The e or google prefix is then used in resources, dependencies, ... as
+ // expected by the android gradle plugin.
+ flavorDimensions 'os'
+ productFlavors {
+ e {
+ applicationIdSuffix '.e'
+ dimension 'os'
+ }
+ google {
+ applicationIdSuffix '.google'
+ dimension 'os'
+ }
+ }
- compileOptions {
- sourceCompatibility JavaVersion.VERSION_1_8
- targetCompatibility JavaVersion.VERSION_1_8
- }
+ buildTypes {
+ debug {
+ signingConfig null // Set signing config to null as we use signingConfig per variant.
+ }
+ release {
+ minifyEnabled false
+ proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
+ }
+ }
+
+ /**
+ * Sets the output name of the variant outputs and also it setup signingConfig based on the product flavor.
+ */
+ applicationVariants.all { variant ->
+ if (variant.buildType.name == "debug") {
+ variant.outputs.all { output ->
+ outputFileName = "PrivacyCentral-${output.name}-${variant.versionName}.apk"
+ }
+ if (variant.getFlavorName() == "e") {
+ variant.mergedFlavor.signingConfig = signingConfigs.eDebug
+ } else {
+ variant.mergedFlavor.signingConfig = signingConfigs.debug
+ }
+ }
+ }
+
+ compileOptions {
+ sourceCompatibility JavaVersion.VERSION_1_8
+ targetCompatibility JavaVersion.VERSION_1_8
+ }
}
dependencies {
- implementation project(":privacymodulesapi")
+ compileOnly files('libs/e-ui-sdk-1.0.1-q.jar')
+ implementation project(":privacymodulesapi")
- // include the google specific version of the modules, just for the google flavor
- googleImplementation project(":privacymodulesgoogle")
- // include the e specific version of the modules, just for the e flavor
- eImplementation project(":privacymodulese")
- implementation project(":flow-mvi")
- implementation Libs.Kotlin.stdlib
- implementation Libs.AndroidX.coreKtx
- implementation Libs.AndroidX.Fragment.fragmentKtx
- implementation 'androidx.appcompat:appcompat:1.2.0'
- implementation Libs.AndroidX.Lifecycle.runtime
- implementation Libs.AndroidX.Lifecycle.viewmodel
+ // include the google specific version of the modules, just for the google flavor
+ googleImplementation project(":privacymodulesgoogle")
+ // include the e specific version of the modules, just for the e flavor
+ eImplementation project(":privacymodulese")
+ implementation project(":flow-mvi")
+ implementation Libs.Kotlin.stdlib
+ implementation Libs.AndroidX.coreKtx
+ implementation Libs.AndroidX.Fragment.fragmentKtx
+ implementation 'androidx.appcompat:appcompat:1.2.0'
+ implementation Libs.AndroidX.Lifecycle.runtime
+ implementation Libs.AndroidX.Lifecycle.viewmodel
- implementation Libs.MapBox.sdk
- implementation 'com.google.android.material:material:1.3.0'
+ implementation Libs.MapBox.sdk
+ implementation 'com.google.android.material:material:1.4.0-beta01'
+
+ testImplementation 'junit:junit:4.+'
+ androidTestImplementation 'androidx.test.ext:junit:1.1.2'
+ androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
+}
- testImplementation 'junit:junit:4.+'
- androidTestImplementation 'androidx.test.ext:junit:1.1.2'
- androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
+static def log(Object val) {
+ println("[GradleRepository]: " + val)
}
diff --git a/app/libs/e-ui-sdk-1.0.1-q.jar b/app/libs/e-ui-sdk-1.0.1-q.jar
new file mode 100644
index 0000000..16dfd86
--- /dev/null
+++ b/app/libs/e-ui-sdk-1.0.1-q.jar
Binary files differ
diff --git a/app/src/main/java/foundation/e/privacycentralapp/common/NavToolbarFragment.kt b/app/src/main/java/foundation/e/privacycentralapp/common/NavToolbarFragment.kt
new file mode 100644
index 0000000..52197cd
--- /dev/null
+++ b/app/src/main/java/foundation/e/privacycentralapp/common/NavToolbarFragment.kt
@@ -0,0 +1,34 @@
+/*
+ * 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 androidx.annotation.LayoutRes
+import com.google.android.material.appbar.MaterialToolbar
+
+abstract class NavToolbarFragment(@LayoutRes contentLayoutId: Int) : ToolbarFragment(contentLayoutId) {
+
+ override fun setupToolbar(toolbar: MaterialToolbar) {
+ super.setupToolbar(toolbar)
+ toolbar.apply {
+ setNavigationIcon(lineageos.platform.R.drawable.ic_back)
+ setNavigationOnClickListener {
+ requireActivity().onBackPressed()
+ }
+ }
+ }
+}
diff --git a/app/src/main/java/foundation/e/privacycentralapp/common/ToolbarFragment.kt b/app/src/main/java/foundation/e/privacycentralapp/common/ToolbarFragment.kt
new file mode 100644
index 0000000..f156e09
--- /dev/null
+++ b/app/src/main/java/foundation/e/privacycentralapp/common/ToolbarFragment.kt
@@ -0,0 +1,43 @@
+/*
+ * 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.os.Bundle
+import android.view.View
+import androidx.annotation.LayoutRes
+import androidx.fragment.app.Fragment
+import com.google.android.material.appbar.MaterialToolbar
+import foundation.e.privacycentralapp.R
+
+abstract class ToolbarFragment(@LayoutRes contentLayoutId: Int) : Fragment(contentLayoutId) {
+
+ /**
+ * @return title to be used in toolbar
+ */
+ abstract fun getTitle(): String
+
+ override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
+ super.onViewCreated(view, savedInstanceState)
+
+ setupToolbar(view.findViewById(R.id.toolbar))
+ }
+
+ open fun setupToolbar(toolbar: MaterialToolbar) {
+ toolbar.title = getTitle()
+ }
+}
diff --git a/app/src/main/java/foundation/e/privacycentralapp/features/dashboard/DashboardFragment.kt b/app/src/main/java/foundation/e/privacycentralapp/features/dashboard/DashboardFragment.kt
index f0a7397..c57e6cc 100644
--- a/app/src/main/java/foundation/e/privacycentralapp/features/dashboard/DashboardFragment.kt
+++ b/app/src/main/java/foundation/e/privacycentralapp/features/dashboard/DashboardFragment.kt
@@ -26,15 +26,14 @@ import android.view.View
import android.widget.ProgressBar
import android.widget.RelativeLayout
import android.widget.TextView
-import android.widget.Toolbar
import androidx.core.widget.NestedScrollView
-import androidx.fragment.app.Fragment
import androidx.fragment.app.activityViewModels
import androidx.fragment.app.add
import androidx.fragment.app.commit
import androidx.lifecycle.lifecycleScope
import foundation.e.flowmvi.MVIView
import foundation.e.privacycentralapp.R
+import foundation.e.privacycentralapp.common.ToolbarFragment
import foundation.e.privacycentralapp.dummy.mapToString
import foundation.e.privacycentralapp.features.internetprivacy.InternetPrivacyFragment
import foundation.e.privacycentralapp.features.location.FakeLocationFragment
@@ -43,7 +42,7 @@ import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.collect
class DashboardFragment :
- Fragment(R.layout.fragment_dashboard),
+ ToolbarFragment(R.layout.fragment_dashboard),
MVIView<DashboardFeature.State, DashboardFeature.Action> {
private val viewModel: DashboardViewModel by activityViewModels()
@@ -97,8 +96,6 @@ class DashboardFragment :
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
- val toolbar = view.findViewById<Toolbar>(R.id.toolbar)
- setupToolbar(toolbar)
addClickToMore(view.findViewById(R.id.personal_leakag_info))
view.let {
it.findViewById<TextView>(R.id.tap_to_enable_quick_protection).setOnClickListener {
@@ -116,14 +113,10 @@ class DashboardFragment :
}
}
- private fun setupToolbar(toolbar: Toolbar) {
- val activity = requireActivity()
- activity.setActionBar(toolbar)
- activity.title = "My Privacy Dashboard"
- }
+ override fun getTitle(): String = getString(R.string.privacy_dashboard)
private fun addClickToMore(textView: TextView) {
- val clickToMore = SpannableString("Click to learn more")
+ val clickToMore = SpannableString(getString(R.string.click_to_learn_more))
clickToMore.setSpan(
ForegroundColorSpan(Color.parseColor("#007fff")),
0,
diff --git a/app/src/main/java/foundation/e/privacycentralapp/features/dashboard/QuickProtectionFragment.kt b/app/src/main/java/foundation/e/privacycentralapp/features/dashboard/QuickProtectionFragment.kt
index c120b49..727afa9 100644
--- a/app/src/main/java/foundation/e/privacycentralapp/features/dashboard/QuickProtectionFragment.kt
+++ b/app/src/main/java/foundation/e/privacycentralapp/features/dashboard/QuickProtectionFragment.kt
@@ -18,23 +18,16 @@
package foundation.e.privacycentralapp.features.dashboard
import android.content.Context
-import android.os.Bundle
-import android.view.View
-import android.widget.Toolbar
import androidx.activity.addCallback
-import androidx.fragment.app.Fragment
import androidx.fragment.app.activityViewModels
import foundation.e.privacycentralapp.R
+import foundation.e.privacycentralapp.common.NavToolbarFragment
-class QuickProtectionFragment : Fragment(R.layout.fragment_quick_protection) {
+class QuickProtectionFragment : NavToolbarFragment(R.layout.fragment_quick_protection) {
private val viewModel: DashboardViewModel by activityViewModels()
- override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
- super.onViewCreated(view, savedInstanceState)
- val toolbar = view.findViewById<Toolbar>(R.id.toolbar)
- setupToolbar(toolbar)
- }
+ override fun getTitle(): String = getString(R.string.quick_protection)
override fun onAttach(context: Context) {
super.onAttach(context)
@@ -44,10 +37,4 @@ class QuickProtectionFragment : Fragment(R.layout.fragment_quick_protection) {
requireActivity().onBackPressed()
}
}
-
- private fun setupToolbar(toolbar: Toolbar) {
- val activity = requireActivity()
- activity.setActionBar(toolbar)
- activity.title = "Quick protection"
- }
}
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 a8c1671..5baae81 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
@@ -21,18 +21,17 @@ import android.os.Bundle
import android.view.View
import android.widget.RadioButton
import android.widget.Toast
-import android.widget.Toolbar
-import androidx.fragment.app.Fragment
import androidx.fragment.app.viewModels
import androidx.lifecycle.lifecycleScope
import foundation.e.flowmvi.MVIView
import foundation.e.privacycentralapp.R
+import foundation.e.privacycentralapp.common.NavToolbarFragment
import foundation.e.privacycentralapp.dummy.InternetPrivacyMode
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.collect
class InternetPrivacyFragment :
- Fragment(R.layout.fragment_internet_activity_policy),
+ NavToolbarFragment(R.layout.fragment_internet_activity_policy),
MVIView<InternetPrivacyFeature.State, InternetPrivacyFeature.Action> {
private val viewModel: InternetPrivacyViewModel by viewModels()
@@ -63,16 +62,10 @@ class InternetPrivacyFragment :
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
- val toolbar = view.findViewById<Toolbar>(R.id.toolbar)
- setupToolbar(toolbar)
bindClickListeners(view)
}
- private fun setupToolbar(toolbar: Toolbar) {
- val activity = requireActivity()
- activity.setActionBar(toolbar)
- activity.title = "My Internet Activity Privacy"
- }
+ override fun getTitle(): String = getString(R.string.internet_activity_privacy)
private fun bindClickListeners(fragmentView: View) {
fragmentView.let {
diff --git a/app/src/main/java/foundation/e/privacycentralapp/features/location/FakeLocationFragment.kt b/app/src/main/java/foundation/e/privacycentralapp/features/location/FakeLocationFragment.kt
index d569e2f..7281afc 100644
--- a/app/src/main/java/foundation/e/privacycentralapp/features/location/FakeLocationFragment.kt
+++ b/app/src/main/java/foundation/e/privacycentralapp/features/location/FakeLocationFragment.kt
@@ -31,10 +31,8 @@ import android.widget.FrameLayout
import android.widget.ImageView
import android.widget.RadioButton
import android.widget.Toast
-import android.widget.Toolbar
import androidx.annotation.NonNull
import androidx.core.widget.addTextChangedListener
-import androidx.fragment.app.Fragment
import androidx.fragment.app.viewModels
import androidx.lifecycle.lifecycleScope
import com.google.android.material.textfield.TextInputLayout
@@ -52,12 +50,12 @@ import com.mapbox.mapboxsdk.location.LocationUpdate
import com.mapbox.mapboxsdk.location.modes.CameraMode
import com.mapbox.mapboxsdk.location.modes.RenderMode
import com.mapbox.mapboxsdk.maps.MapboxMap
-import com.mapbox.mapboxsdk.maps.OnMapReadyCallback
import com.mapbox.mapboxsdk.maps.Style
import foundation.e.flowmvi.MVIView
import foundation.e.privacycentralapp.DependencyContainer
import foundation.e.privacycentralapp.PrivacyCentralApplication
import foundation.e.privacycentralapp.R
+import foundation.e.privacycentralapp.common.NavToolbarFragment
import foundation.e.privacycentralapp.dummy.LocationMode
import foundation.e.privacycentralapp.extensions.viewModelProviderFactoryOf
import kotlinx.coroutines.Job
@@ -68,7 +66,7 @@ import kotlinx.coroutines.flow.collect
import kotlinx.coroutines.launch
class FakeLocationFragment :
- Fragment(R.layout.fragment_fake_location),
+ NavToolbarFragment(R.layout.fragment_fake_location),
MVIView<FakeLocationFeature.State, FakeLocationFeature.Action>,
PermissionsListener {
@@ -180,6 +178,8 @@ class FakeLocationFragment :
Mapbox.getInstance(requireContext(), getString(R.string.mapbox_key))
}
+ override fun getTitle(): String = getString(R.string.my_location_title)
+
private fun displayToast(message: String) {
Toast.makeText(requireContext(), message, Toast.LENGTH_SHORT)
.show()
@@ -187,8 +187,7 @@ class FakeLocationFragment :
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
- val toolbar = view.findViewById<Toolbar>(R.id.toolbar)
- setupToolbar(toolbar)
+
setupViews(view)
mapView = view.findViewById<FakeLocationMapView>(R.id.mapView)
.setup(savedInstanceState) { mapboxMap ->
@@ -313,14 +312,7 @@ class FakeLocationFragment :
}
}
- private fun setupToolbar(toolbar: Toolbar) {
- val activity = requireActivity()
- activity.setActionBar(toolbar)
- activity.title = "Fake My Location"
- }
-
override fun render(state: FakeLocationFeature.State) {
- Log.d("FakeMyLocation", "State: $state")
latEditText.text =
Editable.Factory.getInstance().newEditable(state.location.latitude.toString())
longEditText.text =
@@ -418,9 +410,3 @@ class FakeLocationFragment :
}
}
}
-
-fun FakeLocationMapView.setup(savedInstanceState: Bundle?, callback: OnMapReadyCallback) =
- this.apply {
- onCreate(savedInstanceState)
- getMapAsync(callback)
- }
diff --git a/app/src/main/java/foundation/e/privacycentralapp/features/location/FakeLocationMapView.kt b/app/src/main/java/foundation/e/privacycentralapp/features/location/FakeLocationMapView.kt
index cd0030a..e71bfcc 100644
--- a/app/src/main/java/foundation/e/privacycentralapp/features/location/FakeLocationMapView.kt
+++ b/app/src/main/java/foundation/e/privacycentralapp/features/location/FakeLocationMapView.kt
@@ -19,9 +19,11 @@ package foundation.e.privacycentralapp.features.location
import android.annotation.SuppressLint
import android.content.Context
+import android.os.Bundle
import android.util.AttributeSet
import android.view.MotionEvent
import com.mapbox.mapboxsdk.maps.MapView
+import com.mapbox.mapboxsdk.maps.OnMapReadyCallback
class FakeLocationMapView @JvmOverloads constructor(
context: Context,
@@ -43,3 +45,9 @@ class FakeLocationMapView @JvmOverloads constructor(
return true
}
}
+
+fun FakeLocationMapView.setup(savedInstanceState: Bundle?, callback: OnMapReadyCallback) =
+ this.apply {
+ onCreate(savedInstanceState)
+ getMapAsync(callback)
+ }
diff --git a/app/src/main/java/foundation/e/privacycentralapp/features/permissions/PermissionAppsFragment.kt b/app/src/main/java/foundation/e/privacycentralapp/features/permissions/PermissionAppsFragment.kt
index 224d1be..72d8b0c 100644
--- a/app/src/main/java/foundation/e/privacycentralapp/features/permissions/PermissionAppsFragment.kt
+++ b/app/src/main/java/foundation/e/privacycentralapp/features/permissions/PermissionAppsFragment.kt
@@ -18,22 +18,20 @@
package foundation.e.privacycentralapp.features.permissions
import android.os.Bundle
-import android.view.View
import android.widget.TextView
import android.widget.Toast
-import android.widget.Toolbar
-import androidx.fragment.app.Fragment
import androidx.fragment.app.viewModels
import androidx.lifecycle.lifecycleScope
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import foundation.e.flowmvi.MVIView
import foundation.e.privacycentralapp.R
+import foundation.e.privacycentralapp.common.NavToolbarFragment
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.collect
class PermissionAppsFragment :
- Fragment(R.layout.fragment_permission_apps),
+ NavToolbarFragment(R.layout.fragment_permission_apps),
MVIView<PermissionsFeature.State, PermissionsFeature.Action> {
private val viewModel: PermissionsViewModel by viewModels()
@@ -66,17 +64,7 @@ class PermissionAppsFragment :
.show()
}
- override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
- super.onViewCreated(view, savedInstanceState)
- val toolbar = view.findViewById<Toolbar>(R.id.toolbar)
- setupToolbar(toolbar)
- }
-
- private fun setupToolbar(toolbar: Toolbar) {
- val activity = requireActivity()
- activity.setActionBar(toolbar)
- activity.title = "My Apps Permission"
- }
+ override fun getTitle(): String = getString(R.string.apps_permissions)
override fun render(state: PermissionsFeature.State) {
state.currentPermission?.let { permission ->
diff --git a/app/src/main/java/foundation/e/privacycentralapp/features/permissions/PermissionsFragment.kt b/app/src/main/java/foundation/e/privacycentralapp/features/permissions/PermissionsFragment.kt
index 864a355..be84e31 100644
--- a/app/src/main/java/foundation/e/privacycentralapp/features/permissions/PermissionsFragment.kt
+++ b/app/src/main/java/foundation/e/privacycentralapp/features/permissions/PermissionsFragment.kt
@@ -19,9 +19,7 @@ package foundation.e.privacycentralapp.features.permissions
import android.os.Bundle
import android.view.View
-import android.widget.Toolbar
import androidx.core.os.bundleOf
-import androidx.fragment.app.Fragment
import androidx.fragment.app.add
import androidx.fragment.app.commit
import androidx.fragment.app.viewModels
@@ -30,10 +28,11 @@ import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import foundation.e.flowmvi.MVIView
import foundation.e.privacycentralapp.R
+import foundation.e.privacycentralapp.common.NavToolbarFragment
import kotlinx.coroutines.flow.Flow
class PermissionsFragment :
- Fragment(R.layout.fragment_permissions),
+ NavToolbarFragment(R.layout.fragment_permissions),
MVIView<PermissionsFeature.State, PermissionsFeature.Action> {
private val viewModel: PermissionsViewModel by viewModels()
@@ -50,15 +49,9 @@ class PermissionsFragment :
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
- val toolbar = view.findViewById<Toolbar>(R.id.toolbar)
- setupToolbar(toolbar)
}
- private fun setupToolbar(toolbar: Toolbar) {
- val activity = requireActivity()
- activity.setActionBar(toolbar)
- activity.title = "My Apps Permission"
- }
+ override fun getTitle(): String = getString(R.string.apps_permissions)
override fun render(state: PermissionsFeature.State) {
view?.findViewById<RecyclerView>(R.id.recylcer_view_permissions)?.apply {
diff --git a/app/src/main/res/layout/fragment_dashboard.xml b/app/src/main/res/layout/fragment_dashboard.xml
index 663c270..dc79878 100644
--- a/app/src/main/res/layout/fragment_dashboard.xml
+++ b/app/src/main/res/layout/fragment_dashboard.xml
@@ -1,19 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
-<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
+<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
>
- <Toolbar
- android:id="@+id/toolbar"
- android:layout_width="match_parent"
- android:layout_height="?android:attr/actionBarSize"
- android:layout_gravity="top|center"
- android:background="@color/white"
- tools:layout_height="56dp"
- />
+ <include layout="@layout/topbar"/>
<ProgressBar
android:id="@+id/loadingSpinner"
@@ -27,8 +20,8 @@
android:id="@+id/scrollContainer"
android:layout_width="match_parent"
android:layout_height="match_parent"
- android:layout_marginTop="?android:attr/actionBarSize"
android:visibility="gone"
+ app:layout_behavior="@string/appbar_scrolling_view_behavior"
>
<LinearLayout
@@ -347,4 +340,4 @@
</LinearLayout>
</androidx.core.widget.NestedScrollView>
-</FrameLayout> \ No newline at end of file
+</androidx.coordinatorlayout.widget.CoordinatorLayout> \ No newline at end of file
diff --git a/app/src/main/res/layout/fragment_fake_location.xml b/app/src/main/res/layout/fragment_fake_location.xml
index 7d32bfa..40324a1 100644
--- a/app/src/main/res/layout/fragment_fake_location.xml
+++ b/app/src/main/res/layout/fragment_fake_location.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
-<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
+<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:mapbox="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
@@ -8,26 +8,19 @@
android:layout_width="match_parent"
>
- <Toolbar
- android:background="@color/white"
- android:id="@+id/toolbar"
- android:layout_gravity="top|center"
- android:layout_height="?android:attr/actionBarSize"
- android:layout_width="match_parent"
- tools:layout_height="56dp"
- />
+ <include layout="@layout/topbar"/>
<androidx.core.widget.NestedScrollView
android:layout_height="match_parent"
- android:layout_marginBottom="32dp"
- android:layout_marginTop="?android:attr/actionBarSize"
android:layout_width="match_parent"
+ app:layout_behavior="@string/appbar_scrolling_view_behavior"
>
<LinearLayout
android:layout_height="match_parent"
android:layout_width="match_parent"
android:orientation="vertical"
+ android:layout_marginBottom="32dp"
tools:context=".main.MainActivity"
>
@@ -57,20 +50,6 @@
android:textSize="14sp"
/>
- <TextView
- android:fontFamily="sans-serif-medium"
- android:id="@+id/my_location_header"
- android:layout_height="wrap_content"
- android:layout_width="wrap_content"
- android:paddingBottom="8dp"
- android:paddingTop="16dp"
- android:paddingLeft="32dp"
- android:paddingRight="32dp"
- android:text="@string/my_location_title"
- android:textColor="@color/black"
- android:textSize="14sp"
- />
-
<RadioGroup
android:id="@+id/location_choices"
android:layout_height="wrap_content"
@@ -152,4 +131,4 @@
</LinearLayout>
</androidx.core.widget.NestedScrollView>
-</FrameLayout> \ No newline at end of file
+</androidx.coordinatorlayout.widget.CoordinatorLayout> \ No newline at end of file
diff --git a/app/src/main/res/layout/fragment_internet_activity_policy.xml b/app/src/main/res/layout/fragment_internet_activity_policy.xml
index 6a53498..7a5d8b5 100644
--- a/app/src/main/res/layout/fragment_internet_activity_policy.xml
+++ b/app/src/main/res/layout/fragment_internet_activity_policy.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
-<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
+<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
@@ -7,20 +7,13 @@
android:background="@color/white"
>
- <Toolbar
- android:id="@+id/toolbar"
- android:layout_width="match_parent"
- android:layout_height="?android:attr/actionBarSize"
- android:layout_gravity="top|center"
- android:background="@color/white"
- tools:layout_height="56dp"
- />
+ <include layout="@layout/topbar"/>
<androidx.core.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
- android:layout_marginTop="?android:attr/actionBarSize"
android:layout_marginBottom="32dp"
+ app:layout_behavior="@string/appbar_scrolling_view_behavior"
>
<LinearLayout
@@ -102,4 +95,4 @@
</RadioGroup>
</LinearLayout>
</androidx.core.widget.NestedScrollView>
-</FrameLayout> \ No newline at end of file
+</androidx.coordinatorlayout.widget.CoordinatorLayout> \ No newline at end of file
diff --git a/app/src/main/res/layout/fragment_permission_apps.xml b/app/src/main/res/layout/fragment_permission_apps.xml
index 2888af0..65f4169 100644
--- a/app/src/main/res/layout/fragment_permission_apps.xml
+++ b/app/src/main/res/layout/fragment_permission_apps.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
-<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
+<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
@@ -7,20 +7,12 @@
android:background="@color/white"
>
- <Toolbar
- android:id="@+id/toolbar"
- android:layout_width="match_parent"
- android:layout_height="?android:attr/actionBarSize"
- android:layout_gravity="top|center"
- android:background="@color/white"
- tools:layout_height="56dp"
- />
+ <include layout="@layout/topbar"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
- android:layout_marginTop="?android:attr/actionBarSize"
tools:context=".main.MainActivity"
>
@@ -43,4 +35,4 @@
tools:listitem="@layout/item_permission_apps"
android:id="@+id/recylcer_view_permission_apps"/>
</LinearLayout>
-</FrameLayout> \ No newline at end of file
+</androidx.coordinatorlayout.widget.CoordinatorLayout> \ No newline at end of file
diff --git a/app/src/main/res/layout/fragment_permissions.xml b/app/src/main/res/layout/fragment_permissions.xml
index 9d1e972..a452570 100644
--- a/app/src/main/res/layout/fragment_permissions.xml
+++ b/app/src/main/res/layout/fragment_permissions.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
-<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
+<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
@@ -7,14 +7,7 @@
android:background="@color/white"
>
- <Toolbar
- android:id="@+id/toolbar"
- android:layout_width="match_parent"
- android:layout_height="?android:attr/actionBarSize"
- android:layout_gravity="top|center"
- android:background="@color/white"
- tools:layout_height="56dp"
- />
+ <include layout="@layout/topbar"/>
<LinearLayout
android:layout_width="match_parent"
@@ -22,7 +15,6 @@
android:orientation="vertical"
android:paddingLeft="32dp"
android:paddingRight="32dp"
- android:layout_marginTop="?android:attr/actionBarSize"
tools:context=".main.MainActivity"
>
@@ -54,4 +46,4 @@
tools:listitem="@layout/item_permission"
android:id="@+id/recylcer_view_permissions"/>
</LinearLayout>
-</FrameLayout> \ No newline at end of file
+</androidx.coordinatorlayout.widget.CoordinatorLayout> \ No newline at end of file
diff --git a/app/src/main/res/layout/fragment_quick_protection.xml b/app/src/main/res/layout/fragment_quick_protection.xml
index e8233ee..d57a101 100644
--- a/app/src/main/res/layout/fragment_quick_protection.xml
+++ b/app/src/main/res/layout/fragment_quick_protection.xml
@@ -1,26 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
-<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
+<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/white"
>
- <Toolbar
- android:id="@+id/toolbar"
- android:layout_width="match_parent"
- android:layout_height="?android:attr/actionBarSize"
- android:layout_gravity="top|center"
- android:background="@color/white"
- tools:layout_height="56dp"
- />
-
+ <include layout="@layout/topbar"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
- android:layout_marginTop="?android:attr/actionBarSize"
android:layout_marginBottom="56dp"
tools:context=".main.MainActivity"
>
@@ -65,4 +56,4 @@
android:textSize="14sp"
android:fontFamily="sans-serif-medium"
android:layout_gravity="bottom|right"/>
-</FrameLayout> \ No newline at end of file
+</androidx.coordinatorlayout.widget.CoordinatorLayout> \ No newline at end of file
diff --git a/app/src/main/res/layout/topbar.xml b/app/src/main/res/layout/topbar.xml
new file mode 100644
index 0000000..9142d79
--- /dev/null
+++ b/app/src/main/res/layout/topbar.xml
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<!--
+ ~ 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/>.
+ -->
+
+<com.google.android.material.appbar.AppBarLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:tools="http://schemas.android.com/tools"
+ android:layout_height="wrap_content"
+ android:layout_width="match_parent"
+ xmlns:app="http://schemas.android.com/apk/res-auto"
+ app:elevation="0dp"
+ >
+
+ <com.google.android.material.appbar.MaterialToolbar
+ android:background="@color/white"
+ android:id="@+id/toolbar"
+ app:titleCentered="true"
+ android:elevation="0dp"
+ android:layout_height="?android:attr/actionBarSize"
+ android:layout_width="match_parent"
+ tools:layout_height="56dp"
+ />
+</com.google.android.material.appbar.AppBarLayout>
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index 8fc7c92..fd24223 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -9,6 +9,7 @@
<string name="apps_permissions_subtitle">%1$d apps are requesting %2$d permissions</string>
<string name="my_location_title">My Location</string>
<string name="my_location_subtitle">"%1$d apps are using location permission\nCurrent location mode: "</string>
+ <string name="internet_activity_privacy">Internet Activity Privacy</string>
<string name="internet_activity_privacy_title">My Internet Activity Privacy</string>
<string name="internet_activity_privacy_subtitle">"Current internet activity mode: "</string>
<string name="quick_protection_info">Quick protection enables these settings when turned on</string>
@@ -38,4 +39,8 @@
<string name="user_location_permission_explanation">This app needs location permissions in order to show its functionality.</string>
<string name="user_location_permission_not_granted">You didn\'t grant location permission</string>
<string name="please_enter_valid_lat_long">Please enter valid latitude and longitude value</string>
+ <string name="quick_protection">Quick Protection</string>
+ <string name="privacy_dashboard">Privacy Dashboard</string>
+ <string name="click_to_learn_more">Click to learn more</string>
+ <string name="apps_permissions">\"Apps Permission\"</string>
</resources> \ No newline at end of file
diff --git a/build.gradle b/build.gradle
index e84cea8..0567d32 100644
--- a/build.gradle
+++ b/build.gradle
@@ -4,21 +4,21 @@ import foundation.e.privacycentral.buildsrc.ReleaseType
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext.buildConfig = [
- 'compileSdk': 30,
- 'minSdk' : 24,
- 'targetSdk' : 30,
- 'version': [
- 'major': 1,
- 'minor': 0,
- 'patch': 0,
- 'build': "alpha",
- ],
+ 'compileSdk': 30,
+ 'minSdk' : 24,
+ 'targetSdk' : 30,
+ 'version' : [
+ 'major': 1,
+ 'minor': 0,
+ 'patch': 0,
+ 'build': "alpha",
+ ],
]
ext.buildConfig.version['name'] = "${buildConfig.version.major}.${buildConfig.version.minor}.${buildConfig.version.patch}"
ext.buildConfig.version['fullName'] = "${buildConfig.version.name}-${buildConfig.version.build}"
def buildNumber
- if(buildConfig.version.build == 'alpha') {
+ if (buildConfig.version.build == 'alpha') {
buildNumber = -2
} else if (buildConfig.version.build == 'beta') {
buildNumber = -1
@@ -91,7 +91,6 @@ subprojects {
// define the steps to apply to those files
trimTrailingWhitespace()
- indentWithTabs() // or spaces. Takes an integer argument if you don't like 4
endWithNewline()
}
}
diff --git a/privapp-permissions-foundation.e.privacycentralapp.xml b/privapp-permissions-foundation.e.privacycentralapp.xml
index e3557a8..1b3e760 100644
--- a/privapp-permissions-foundation.e.privacycentralapp.xml
+++ b/privapp-permissions-foundation.e.privacycentralapp.xml
@@ -1,9 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<permissions>
<privapp-permissions package="foundation.e.privacycentralapp.e">
- <permission name="android.permission.UPDATE_APP_OPS_STATS"/>
- <permission name="android.permission.WATCH_APPOPS"/>
- <permission name="android.permission.GET_APP_OPS_STATS"/>
- <permission name="android.permission.WRITE_SECURE_SETTINGS"/>
+ <permission name="android.permission.UPDATE_APP_OPS_STATS" />
+ <permission name="android.permission.WATCH_APPOPS" />
+ <permission name="android.permission.GET_APP_OPS_STATS" />
+ <permission name="android.permission.WRITE_SECURE_SETTINGS" />
</privapp-permissions>
</permissions> \ No newline at end of file