Add the background location disclaimer
This commit is contained in:
parent
a873c71918
commit
2762f12151
BIN
.idea/caches/build_file_checksums.ser
generated
BIN
.idea/caches/build_file_checksums.ser
generated
Binary file not shown.
@ -18,8 +18,8 @@ android {
|
||||
applicationId "com.tommasoberlose.anotherwidget"
|
||||
minSdkVersion 23
|
||||
targetSdkVersion 29
|
||||
versionCode 102
|
||||
versionName "2.0.12"
|
||||
versionCode 105
|
||||
versionName "2.0.13"
|
||||
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
}
|
||||
|
BIN
app/release/app-release.aab
Normal file
BIN
app/release/app-release.aab
Normal file
Binary file not shown.
@ -10,6 +10,7 @@ import android.media.session.MediaSessionManager
|
||||
import android.media.session.PlaybackState
|
||||
import android.util.Log
|
||||
import androidx.core.app.NotificationManagerCompat
|
||||
import com.chibatching.kotpref.Kotpref
|
||||
import com.chibatching.kotpref.blockingBulk
|
||||
import com.chibatching.kotpref.bulk
|
||||
import com.tommasoberlose.anotherwidget.global.Preferences
|
||||
@ -29,6 +30,7 @@ object MediaPlayerHelper {
|
||||
}
|
||||
|
||||
fun updatePlayingMediaInfo(context: Context) {
|
||||
Kotpref.init(context)
|
||||
if (NotificationManagerCompat.getEnabledListenerPackages(context).contains(context.packageName)) {
|
||||
val list = try {
|
||||
(context.getSystemService(Context.MEDIA_SESSION_SERVICE) as MediaSessionManager).getActiveSessions(
|
||||
@ -66,19 +68,20 @@ object MediaPlayerHelper {
|
||||
}
|
||||
|
||||
if (!isSomeonePlaying) {
|
||||
removeMediaInfo()
|
||||
removeMediaInfo(context)
|
||||
}
|
||||
|
||||
} else {
|
||||
removeMediaInfo()
|
||||
removeMediaInfo(context)
|
||||
}
|
||||
} else {
|
||||
removeMediaInfo()
|
||||
removeMediaInfo(context)
|
||||
}
|
||||
MainWidget.updateWidget(context)
|
||||
}
|
||||
|
||||
private fun removeMediaInfo() {
|
||||
private fun removeMediaInfo(context: Context) {
|
||||
Kotpref.init(context)
|
||||
Preferences.blockingBulk {
|
||||
remove(Preferences::mediaPlayerTitle)
|
||||
remove(Preferences::mediaPlayerArtist)
|
||||
|
@ -8,6 +8,7 @@ import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.os.Build
|
||||
import android.util.Log
|
||||
import com.chibatching.kotpref.Kotpref
|
||||
import com.google.android.gms.auth.api.signin.GoogleSignIn
|
||||
import com.google.android.gms.auth.api.signin.GoogleSignInAccount
|
||||
import com.google.android.gms.fitness.Fitness
|
||||
@ -35,15 +36,16 @@ class ActivityDetectionReceiver : BroadcastReceiver() {
|
||||
}
|
||||
} else {
|
||||
if (intent.action == Intent.ACTION_BOOT_COMPLETED || intent.action == Intent.ACTION_MY_PACKAGE_REPLACED && Preferences.showDailySteps && Build.VERSION.SDK_INT < Build.VERSION_CODES.Q || context.checkGrantedPermission(Manifest.permission.ACTIVITY_RECOGNITION)) {
|
||||
resetDailySteps()
|
||||
resetDailySteps(context)
|
||||
registerFence(context)
|
||||
} else {
|
||||
resetDailySteps()
|
||||
resetDailySteps(context)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun resetDailySteps() {
|
||||
private fun resetDailySteps(context: Context) {
|
||||
Kotpref.init(context)
|
||||
Preferences.googleFitSteps = -1
|
||||
}
|
||||
|
||||
@ -54,6 +56,7 @@ class ActivityDetectionReceiver : BroadcastReceiver() {
|
||||
.build()
|
||||
|
||||
fun registerFence(context: Context) {
|
||||
Kotpref.init(context)
|
||||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.Q || context.checkGrantedPermission(
|
||||
Manifest.permission.ACTIVITY_RECOGNITION)) {
|
||||
val transitions = mutableListOf<ActivityTransition>()
|
||||
@ -116,6 +119,7 @@ class ActivityDetectionReceiver : BroadcastReceiver() {
|
||||
}
|
||||
|
||||
fun requestDailySteps(context: Context) {
|
||||
Kotpref.init(context)
|
||||
|
||||
val account: GoogleSignInAccount? = GoogleSignIn.getLastSignedInAccount(context)
|
||||
if (account != null && GoogleSignIn.hasPermissions(account, FITNESS_OPTIONS)) {
|
||||
|
@ -28,6 +28,7 @@ import com.karumi.dexter.MultiplePermissionsReport
|
||||
import com.karumi.dexter.PermissionToken
|
||||
import com.karumi.dexter.listener.PermissionRequest
|
||||
import com.karumi.dexter.listener.multi.MultiplePermissionsListener
|
||||
import com.tommasoberlose.anotherwidget.components.MaterialBottomSheetDialog
|
||||
import com.tommasoberlose.anotherwidget.databinding.ActivityChooseApplicationBinding
|
||||
import com.tommasoberlose.anotherwidget.databinding.ActivityCustomLocationBinding
|
||||
import com.tommasoberlose.anotherwidget.global.Preferences
|
||||
@ -62,7 +63,11 @@ class CustomLocationActivity : AppCompatActivity() {
|
||||
injector
|
||||
.text(R.id.text, getString(R.string.custom_location_gps))
|
||||
.clicked(R.id.text) {
|
||||
requirePermission()
|
||||
MaterialBottomSheetDialog(this, message = getString(R.string.background_location_warning))
|
||||
.setPositiveButton(getString(android.R.string.ok)) {
|
||||
requirePermission()
|
||||
}
|
||||
.show()
|
||||
}
|
||||
}
|
||||
.register<Address>(R.layout.custom_location_item) { item, injector ->
|
||||
|
@ -26,6 +26,7 @@ import com.karumi.dexter.listener.multi.MultiplePermissionsListener
|
||||
import com.tommasoberlose.anotherwidget.R
|
||||
import com.tommasoberlose.anotherwidget.components.BottomSheetMenu
|
||||
import com.tommasoberlose.anotherwidget.components.IconPackSelector
|
||||
import com.tommasoberlose.anotherwidget.components.MaterialBottomSheetDialog
|
||||
import com.tommasoberlose.anotherwidget.databinding.FragmentWeatherSettingsBinding
|
||||
import com.tommasoberlose.anotherwidget.global.Constants
|
||||
import com.tommasoberlose.anotherwidget.global.Preferences
|
||||
@ -110,6 +111,7 @@ class WeatherTabFragment : Fragment() {
|
||||
|
||||
viewModel.customLocationAdd.observe(viewLifecycleOwner, Observer {
|
||||
maintainScrollPosition {
|
||||
background_location_warning.isVisible = it == ""
|
||||
label_custom_location?.text =
|
||||
if (it == "") getString(R.string.custom_location_gps) else it
|
||||
}
|
||||
@ -164,7 +166,11 @@ class WeatherTabFragment : Fragment() {
|
||||
} else if (Preferences.showWeather && Preferences.customLocationAdd == "") {
|
||||
location_permission_alert?.isVisible = true
|
||||
location_permission_alert?.setOnClickListener {
|
||||
requirePermission()
|
||||
MaterialBottomSheetDialog(requireContext(), message = getString(R.string.background_location_warning))
|
||||
.setPositiveButton(getString(android.R.string.ok)) {
|
||||
requirePermission()
|
||||
}
|
||||
.show()
|
||||
}
|
||||
} else {
|
||||
location_permission_alert?.isVisible = false
|
||||
|
@ -224,6 +224,26 @@
|
||||
android:text="@string/action_grant_permission"/>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/background_location_warning"
|
||||
android:paddingStart="64dp"
|
||||
android:paddingEnd="16dp"
|
||||
android:paddingBottom="8dp"
|
||||
android:orientation="horizontal">
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:duplicateParentState="true"
|
||||
android:textSize="14sp"
|
||||
android:text="@string/background_location_warning"
|
||||
android:textColor="@color/colorSecondaryText"
|
||||
android:letterSpacing="0"
|
||||
android:fontFamily="@font/product_sans"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Medium"
|
||||
app:textAllCaps="false" />
|
||||
</LinearLayout>
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
|
@ -93,7 +93,7 @@
|
||||
<string name="settings_weather_refresh_period_subtitle_4">12 ore</string>
|
||||
<string name="settings_weather_refresh_period_subtitle_5">24 ore</string>
|
||||
<string name="settings_custom_location_title">Location</string>
|
||||
<string name="custom_location_gps">Usa geolocalizzazione</string>
|
||||
<string name="custom_location_gps">Geolocalizzazione</string>
|
||||
<string name="show_weather_visible">Meteo visibile</string>
|
||||
<string name="show_weather_not_visible">Meteo nascosto</string>
|
||||
<string name="settings_weather_app_title">Tap sul meteo apre</string>
|
||||
@ -113,6 +113,7 @@
|
||||
<string name="api_key_info_all_set">La chiave API potrebbe aver bisogno di più di 20 minuti per diventare attiva, aggiorneremo il meteo non appena sarà possibile.</string>
|
||||
<string name="settings_weather_icon_pack_title">Icon pack</string>
|
||||
<string name="settings_weather_icon_pack_default">Icon pack %d</string>
|
||||
<string name="background_location_warning">Raccoglieremo i dati sulla posizione per attivare l\'aggiornamento del meteo anche quando l\'app è chiusa o non in uso.\nNon utilizzeremo i tuoi dati in nessun altro modo.</string>
|
||||
|
||||
<!-- Clock -->
|
||||
<string name="settings_clock_title">Orologio</string>
|
||||
|
@ -79,7 +79,7 @@
|
||||
<string name="settings_busy_events_title">Relevant events</string>
|
||||
<string name="settings_busy_events_subtitle">Show only the events\nthat keep you busy</string>
|
||||
<string name="attendee_status_accepted">Accepted events</string>
|
||||
<string name="attendee_status_invited">Events invites</string>
|
||||
<string name="attendee_status_invited">Events invitations</string>
|
||||
<string name="attendee_status_declined">Declined events</string>
|
||||
|
||||
<!-- Weather -->
|
||||
@ -97,7 +97,7 @@
|
||||
<string name="settings_weather_refresh_period_subtitle_4">12 hours</string>
|
||||
<string name="settings_weather_refresh_period_subtitle_5">24 hours</string>
|
||||
<string name="settings_custom_location_title">Location</string>
|
||||
<string name="custom_location_gps">Use geolocation</string>
|
||||
<string name="custom_location_gps">Geolocation</string>
|
||||
<string name="show_weather_visible">Weather info is visible</string>
|
||||
<string name="show_weather_not_visible">Weather info is hidden</string>
|
||||
<string name="settings_weather_app_title">Tap on weather opens</string>
|
||||
@ -117,6 +117,7 @@
|
||||
<string name="api_key_info_all_set">It may take up to ten minutes before your API key is activated. The weather will be updated as soon as it is available.</string>
|
||||
<string name="settings_weather_icon_pack_title">Icon pack</string>
|
||||
<string name="settings_weather_icon_pack_default">Icon pack %d</string>
|
||||
<string name="background_location_warning">We will collect location data to update the weather information even when the app is closed or not in use.\nWe will not use these data otherwise.</string>
|
||||
|
||||
<!-- Clock -->
|
||||
<string name="settings_clock_title">Clock</string>
|
||||
|
Loading…
x
Reference in New Issue
Block a user