From fafd978342abb8332fcf3ed45cdc3b7d437576ba Mon Sep 17 00:00:00 2001 From: Amit Kumar Date: Mon, 17 May 2021 17:02:35 +0530 Subject: Use string resources for titles --- .../e/privacycentralapp/features/dashboard/DashboardFragment.kt | 4 ++-- .../privacycentralapp/features/dashboard/QuickProtectionFragment.kt | 2 +- .../features/internetprivacy/InternetPrivacyFragment.kt | 2 +- .../e/privacycentralapp/features/location/FakeLocationFragment.kt | 5 +---- .../privacycentralapp/features/permissions/PermissionAppsFragment.kt | 2 +- .../e/privacycentralapp/features/permissions/PermissionsFragment.kt | 2 +- app/src/main/res/values/strings.xml | 5 +++++ 7 files changed, 12 insertions(+), 10 deletions(-) (limited to 'app') 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 4164fea..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 @@ -113,10 +113,10 @@ class DashboardFragment : } } - override fun getTitle(): String = "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 442cfd2..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 @@ -27,7 +27,7 @@ class QuickProtectionFragment : NavToolbarFragment(R.layout.fragment_quick_prote private val viewModel: DashboardViewModel by activityViewModels() - override fun getTitle(): String = "Quick protection" + override fun getTitle(): String = getString(R.string.quick_protection) override fun onAttach(context: Context) { super.onAttach(context) 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 1844129..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 @@ -65,7 +65,7 @@ class InternetPrivacyFragment : bindClickListeners(view) } - override fun getTitle(): String = "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 2d174f0..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 @@ -178,9 +178,7 @@ class FakeLocationFragment : Mapbox.getInstance(requireContext(), getString(R.string.mapbox_key)) } - override fun getTitle(): String { - return getString(R.string.my_location_title) - } + override fun getTitle(): String = getString(R.string.my_location_title) private fun displayToast(message: String) { Toast.makeText(requireContext(), message, Toast.LENGTH_SHORT) @@ -315,7 +313,6 @@ class FakeLocationFragment : } override fun render(state: FakeLocationFeature.State) { - Log.d("FakeMyLocation", "State: $state") latEditText.text = Editable.Factory.getInstance().newEditable(state.location.latitude.toString()) longEditText.text = 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 374a430..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 @@ -64,7 +64,7 @@ class PermissionAppsFragment : .show() } - override fun getTitle(): String = "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 0b03343..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 @@ -51,7 +51,7 @@ class PermissionsFragment : super.onViewCreated(view, savedInstanceState) } - override fun getTitle(): String = "My Apps Permission" + override fun getTitle(): String = getString(R.string.apps_permissions) override fun render(state: PermissionsFeature.State) { view?.findViewById(R.id.recylcer_view_permissions)?.apply { 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 @@ %1$d apps are requesting %2$d permissions My Location "%1$d apps are using location permission\nCurrent location mode: " + Internet Activity Privacy My Internet Activity Privacy "Current internet activity mode: " Quick protection enables these settings when turned on @@ -38,4 +39,8 @@ This app needs location permissions in order to show its functionality. You didn\'t grant location permission Please enter valid latitude and longitude value + Quick Protection + Privacy Dashboard + Click to learn more + \"Apps Permission\" \ No newline at end of file -- cgit v1.2.1