Merge pull request #233 from quantum5/proximity-setting

Make it possible to disable proximity sensor during calls
This commit is contained in:
Tibor Kaputa
2021-09-24 21:51:06 +02:00
committed by GitHub
26 changed files with 59 additions and 1 deletions

View File

@ -342,7 +342,7 @@ class CallActivity : SimpleActivity() {
} }
private fun initProximitySensor() { private fun initProximitySensor() {
if (proximityWakeLock == null || proximityWakeLock?.isHeld == false) { if (!config.disableProximitySensor && (proximityWakeLock == null || proximityWakeLock?.isHeld == false)) {
val powerManager = getSystemService(Context.POWER_SERVICE) as PowerManager val powerManager = getSystemService(Context.POWER_SERVICE) as PowerManager
proximityWakeLock = powerManager.newWakeLock(PowerManager.PROXIMITY_SCREEN_OFF_WAKE_LOCK, "com.simplemobiletools.dialer.pro:wake_lock") proximityWakeLock = powerManager.newWakeLock(PowerManager.PROXIMITY_SCREEN_OFF_WAKE_LOCK, "com.simplemobiletools.dialer.pro:wake_lock")
proximityWakeLock!!.acquire(10 * MINUTE_SECONDS * 1000L) proximityWakeLock!!.acquire(10 * MINUTE_SECONDS * 1000L)

View File

@ -37,6 +37,7 @@ class SettingsActivity : SimpleActivity() {
setupGroupSubsequentCalls() setupGroupSubsequentCalls()
setupStartNameWithSurname() setupStartNameWithSurname()
setupShowCallConfirmation() setupShowCallConfirmation()
setupDisableProximitySensor()
updateTextColors(settings_holder) updateTextColors(settings_holder)
invalidateOptionsMenu() invalidateOptionsMenu()
} }
@ -169,4 +170,12 @@ class SettingsActivity : SimpleActivity() {
config.showCallConfirmation = settings_show_call_confirmation.isChecked config.showCallConfirmation = settings_show_call_confirmation.isChecked
} }
} }
private fun setupDisableProximitySensor() {
settings_disable_proximity_sensor.isChecked = config.disableProximitySensor
settings_disable_proximity_sensor_holder.setOnClickListener {
settings_disable_proximity_sensor.toggle()
config.disableProximitySensor = settings_disable_proximity_sensor.isChecked
}
}
} }

View File

@ -47,4 +47,8 @@ class Config(context: Context) : BaseConfig(context) {
var openDialPadAtLaunch: Boolean var openDialPadAtLaunch: Boolean
get() = prefs.getBoolean(OPEN_DIAL_PAD_AT_LAUNCH, false) get() = prefs.getBoolean(OPEN_DIAL_PAD_AT_LAUNCH, false)
set(openDialPad) = prefs.edit().putBoolean(OPEN_DIAL_PAD_AT_LAUNCH, openDialPad).apply() set(openDialPad) = prefs.edit().putBoolean(OPEN_DIAL_PAD_AT_LAUNCH, openDialPad).apply()
var disableProximitySensor: Boolean
get() = prefs.getBoolean(DISABLE_PROXIMITY_SENSOR, false)
set(disableProximitySensor) = prefs.edit().putBoolean(DISABLE_PROXIMITY_SENSOR, disableProximitySensor).apply()
} }

View File

@ -5,6 +5,7 @@ const val SPEED_DIAL = "speed_dial"
const val REMEMBER_SIM_PREFIX = "remember_sim_" const val REMEMBER_SIM_PREFIX = "remember_sim_"
const val GROUP_SUBSEQUENT_CALLS = "group_subsequent_calls" const val GROUP_SUBSEQUENT_CALLS = "group_subsequent_calls"
const val OPEN_DIAL_PAD_AT_LAUNCH = "open_dial_pad_at_launch" const val OPEN_DIAL_PAD_AT_LAUNCH = "open_dial_pad_at_launch"
const val DISABLE_PROXIMITY_SENSOR = "disable_proximity_sensor"
const val CONTACTS_TAB_MASK = 1 const val CONTACTS_TAB_MASK = 1
const val FAVORITES_TAB_MASK = 2 const val FAVORITES_TAB_MASK = 2

View File

@ -294,5 +294,28 @@
app:switchPadding="@dimen/medium_margin" /> app:switchPadding="@dimen/medium_margin" />
</RelativeLayout> </RelativeLayout>
<RelativeLayout
android:id="@+id/settings_disable_proximity_sensor_holder"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="@dimen/medium_margin"
android:background="?attr/selectableItemBackground"
android:paddingStart="@dimen/normal_margin"
android:paddingTop="@dimen/activity_margin"
android:paddingEnd="@dimen/normal_margin"
android:paddingBottom="@dimen/activity_margin">
<com.simplemobiletools.commons.views.MySwitchCompat
android:id="@+id/settings_disable_proximity_sensor"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@null"
android:clickable="false"
android:paddingStart="@dimen/medium_margin"
android:text="@string/disable_proximity_sensor"
app:switchPadding="@dimen/medium_margin" />
</RelativeLayout>
</LinearLayout> </LinearLayout>
</ScrollView> </ScrollView>

View File

@ -41,6 +41,7 @@
<!-- Settings --> <!-- Settings -->
<string name="group_subsequent_calls">Seskupte další hovory se stejným číslem v protokolu hovorů</string> <string name="group_subsequent_calls">Seskupte další hovory se stejným číslem v protokolu hovorů</string>
<string name="open_dialpad_by_default">Open the dialpad by default when the app opens</string> <string name="open_dialpad_by_default">Open the dialpad by default when the app opens</string>
<string name="disable_proximity_sensor">Disable proximity sensor during calls</string>
<!-- Strings displayed only on Google Playstore. Optional, but good to have --> <!-- Strings displayed only on Google Playstore. Optional, but good to have -->
<!-- App title has to have less than 50 characters. If you cannot squeeze it, just remove a part of it --> <!-- App title has to have less than 50 characters. If you cannot squeeze it, just remove a part of it -->

View File

@ -41,6 +41,7 @@
<!-- Settings --> <!-- Settings -->
<string name="group_subsequent_calls">In der Anrufliste aufeinanderfolgende Anrufe mit derselben Nummer gruppieren</string> <string name="group_subsequent_calls">In der Anrufliste aufeinanderfolgende Anrufe mit derselben Nummer gruppieren</string>
<string name="open_dialpad_by_default">Open the dialpad by default when the app opens</string> <string name="open_dialpad_by_default">Open the dialpad by default when the app opens</string>
<string name="disable_proximity_sensor">Disable proximity sensor during calls</string>
<!-- Strings displayed only on Google Playstore. Optional, but good to have --> <!-- Strings displayed only on Google Playstore. Optional, but good to have -->
<!-- App title has to have less than 50 characters. If you cannot squeeze it, just remove a part of it --> <!-- App title has to have less than 50 characters. If you cannot squeeze it, just remove a part of it -->

View File

@ -41,6 +41,7 @@
<!-- Settings --> <!-- Settings -->
<string name="group_subsequent_calls">Ομαδοποίηση των επόμενων κλήσεων του ίδιου αριθμού στο αρχείο καταγραφής κλήσεων</string> <string name="group_subsequent_calls">Ομαδοποίηση των επόμενων κλήσεων του ίδιου αριθμού στο αρχείο καταγραφής κλήσεων</string>
<string name="open_dialpad_by_default">Open the dialpad by default when the app opens</string> <string name="open_dialpad_by_default">Open the dialpad by default when the app opens</string>
<string name="disable_proximity_sensor">Disable proximity sensor during calls</string>
<!-- Strings displayed only on Google Playstore. Optional, but good to have --> <!-- Strings displayed only on Google Playstore. Optional, but good to have -->
<!-- App title has to have less than 50 characters. If you cannot squeeze it, just remove a part of it --> <!-- App title has to have less than 50 characters. If you cannot squeeze it, just remove a part of it -->

View File

@ -41,6 +41,7 @@
<!-- Settings --> <!-- Settings -->
<string name="group_subsequent_calls">Agrupar llamadas subsecuentes con el mísmo número en el registro de llamadas</string> <string name="group_subsequent_calls">Agrupar llamadas subsecuentes con el mísmo número en el registro de llamadas</string>
<string name="open_dialpad_by_default">Open the dialpad by default when the app opens</string> <string name="open_dialpad_by_default">Open the dialpad by default when the app opens</string>
<string name="disable_proximity_sensor">Disable proximity sensor during calls</string>
<!-- Strings displayed only on Google Playstore. Optional, but good to have --> <!-- Strings displayed only on Google Playstore. Optional, but good to have -->
<!-- App title has to have less than 50 characters. If you cannot squeeze it, just remove a part of it --> <!-- App title has to have less than 50 characters. If you cannot squeeze it, just remove a part of it -->

View File

@ -41,6 +41,7 @@
<!-- Settings --> <!-- Settings -->
<string name="group_subsequent_calls">Ryhmitä saman numeron peräkkäiset puhelut puheluhistoriassa</string> <string name="group_subsequent_calls">Ryhmitä saman numeron peräkkäiset puhelut puheluhistoriassa</string>
<string name="open_dialpad_by_default">Avaa numeronäppäimistö, kun sovellus avataan</string> <string name="open_dialpad_by_default">Avaa numeronäppäimistö, kun sovellus avataan</string>
<string name="disable_proximity_sensor">Disable proximity sensor during calls</string>
<!-- Strings displayed only on Google Playstore. Optional, but good to have --> <!-- Strings displayed only on Google Playstore. Optional, but good to have -->
<!-- App title has to have less than 50 characters. If you cannot squeeze it, just remove a part of it --> <!-- App title has to have less than 50 characters. If you cannot squeeze it, just remove a part of it -->

View File

@ -41,6 +41,7 @@
<!-- Settings --> <!-- Settings -->
<string name="group_subsequent_calls">Regrouper les appels suivants avec le même numéro dans le journal des appels</string> <string name="group_subsequent_calls">Regrouper les appels suivants avec le même numéro dans le journal des appels</string>
<string name="open_dialpad_by_default">Open the dialpad by default when the app opens</string> <string name="open_dialpad_by_default">Open the dialpad by default when the app opens</string>
<string name="disable_proximity_sensor">Disable proximity sensor during calls</string>
<!-- Strings displayed only on Google Playstore. Optional, but good to have --> <!-- Strings displayed only on Google Playstore. Optional, but good to have -->
<!-- App title has to have less than 50 characters. If you cannot squeeze it, just remove a part of it --> <!-- App title has to have less than 50 characters. If you cannot squeeze it, just remove a part of it -->

View File

@ -41,6 +41,7 @@
<!-- Settings --> <!-- Settings -->
<string name="group_subsequent_calls">Agrupar, no rexisto, as chamadas para o mesmo contacto</string> <string name="group_subsequent_calls">Agrupar, no rexisto, as chamadas para o mesmo contacto</string>
<string name="open_dialpad_by_default">Open the dialpad by default when the app opens</string> <string name="open_dialpad_by_default">Open the dialpad by default when the app opens</string>
<string name="disable_proximity_sensor">Disable proximity sensor during calls</string>
<!-- Strings displayed only on Google Playstore. Optional, but good to have --> <!-- Strings displayed only on Google Playstore. Optional, but good to have -->
<!-- App title has to have less than 50 characters. If you cannot squeeze it, just remove a part of it --> <!-- App title has to have less than 50 characters. If you cannot squeeze it, just remove a part of it -->

View File

@ -41,6 +41,7 @@
<!-- Settings --> <!-- Settings -->
<string name="group_subsequent_calls">Kelompokkan panggilan berikutnya dengan nomor yang sama di log panggilan</string> <string name="group_subsequent_calls">Kelompokkan panggilan berikutnya dengan nomor yang sama di log panggilan</string>
<string name="open_dialpad_by_default">Open the dialpad by default when the app opens</string> <string name="open_dialpad_by_default">Open the dialpad by default when the app opens</string>
<string name="disable_proximity_sensor">Disable proximity sensor during calls</string>
<!-- Strings displayed only on Google Playstore. Optional, but good to have --> <!-- Strings displayed only on Google Playstore. Optional, but good to have -->
<!-- App title has to have less than 50 characters. If you cannot squeeze it, just remove a part of it --> <!-- App title has to have less than 50 characters. If you cannot squeeze it, just remove a part of it -->

View File

@ -41,6 +41,7 @@
<!-- Settings --> <!-- Settings -->
<string name="group_subsequent_calls">Raggruppa chiamate successive con lo stesso numero nel registro delle chiamate</string> <string name="group_subsequent_calls">Raggruppa chiamate successive con lo stesso numero nel registro delle chiamate</string>
<string name="open_dialpad_by_default">Open the dialpad by default when the app opens</string> <string name="open_dialpad_by_default">Open the dialpad by default when the app opens</string>
<string name="disable_proximity_sensor">Disable proximity sensor during calls</string>
<!-- Strings displayed only on Google Playstore. Optional, but good to have --> <!-- Strings displayed only on Google Playstore. Optional, but good to have -->
<!-- App title has to have less than 50 characters. If you cannot squeeze it, just remove a part of it --> <!-- App title has to have less than 50 characters. If you cannot squeeze it, just remove a part of it -->

View File

@ -41,6 +41,7 @@
<!-- Settings --> <!-- Settings -->
<string name="group_subsequent_calls">後続の通話をコールログの同じ番号でグループ化する</string> <string name="group_subsequent_calls">後続の通話をコールログの同じ番号でグループ化する</string>
<string name="open_dialpad_by_default">Open the dialpad by default when the app opens</string> <string name="open_dialpad_by_default">Open the dialpad by default when the app opens</string>
<string name="disable_proximity_sensor">Disable proximity sensor during calls</string>
<!-- Strings displayed only on Google Playstore. Optional, but good to have --> <!-- Strings displayed only on Google Playstore. Optional, but good to have -->
<!-- App title has to have less than 50 characters. If you cannot squeeze it, just remove a part of it --> <!-- App title has to have less than 50 characters. If you cannot squeeze it, just remove a part of it -->

View File

@ -41,6 +41,7 @@
<!-- Settings --> <!-- Settings -->
<string name="group_subsequent_calls">കോൾ ലോഗിൽ അതേ നമ്പറുള്ള കോളുകൾ ഗ്രൂപ്പുചെയ്യുക</string> <string name="group_subsequent_calls">കോൾ ലോഗിൽ അതേ നമ്പറുള്ള കോളുകൾ ഗ്രൂപ്പുചെയ്യുക</string>
<string name="open_dialpad_by_default">Open the dialpad by default when the app opens</string> <string name="open_dialpad_by_default">Open the dialpad by default when the app opens</string>
<string name="disable_proximity_sensor">Disable proximity sensor during calls</string>
<!-- Strings displayed only on Google Playstore. Optional, but good to have --> <!-- Strings displayed only on Google Playstore. Optional, but good to have -->
<!-- App title has to have less than 50 characters. If you cannot squeeze it, just remove a part of it --> <!-- App title has to have less than 50 characters. If you cannot squeeze it, just remove a part of it -->

View File

@ -41,6 +41,7 @@
<!-- Settings --> <!-- Settings -->
<string name="group_subsequent_calls">Oproepgeschiedenis: opeenvolgende items van hetzelfde nummer groeperen</string> <string name="group_subsequent_calls">Oproepgeschiedenis: opeenvolgende items van hetzelfde nummer groeperen</string>
<string name="open_dialpad_by_default">Standaard het toetsenblok openen bij starten</string> <string name="open_dialpad_by_default">Standaard het toetsenblok openen bij starten</string>
<string name="disable_proximity_sensor">Disable proximity sensor during calls</string>v
<!-- Strings displayed only on Google Playstore. Optional, but good to have --> <!-- Strings displayed only on Google Playstore. Optional, but good to have -->
<!-- App title has to have less than 50 characters. If you cannot squeeze it, just remove a part of it --> <!-- App title has to have less than 50 characters. If you cannot squeeze it, just remove a part of it -->

View File

@ -41,6 +41,7 @@
<!-- Settings --> <!-- Settings -->
<string name="group_subsequent_calls">Grupuj kolejne połączenia z tym samym numerem w rejestrze połączeń</string> <string name="group_subsequent_calls">Grupuj kolejne połączenia z tym samym numerem w rejestrze połączeń</string>
<string name="open_dialpad_by_default">Otwieraj domyślnie panel wybierania przy uruchomieniu aplikacji</string> <string name="open_dialpad_by_default">Otwieraj domyślnie panel wybierania przy uruchomieniu aplikacji</string>
<string name="disable_proximity_sensor">Disable proximity sensor during calls</string>
<!-- Strings displayed only on Google Playstore. Optional, but good to have --> <!-- Strings displayed only on Google Playstore. Optional, but good to have -->
<!-- App title has to have less than 50 characters. If you cannot squeeze it, just remove a part of it --> <!-- App title has to have less than 50 characters. If you cannot squeeze it, just remove a part of it -->

View File

@ -41,6 +41,7 @@
<!-- Settings --> <!-- Settings -->
<string name="group_subsequent_calls">Agrupar, no registo, as chamadas para o mesmo contacto</string> <string name="group_subsequent_calls">Agrupar, no registo, as chamadas para o mesmo contacto</string>
<string name="open_dialpad_by_default">Open the dialpad by default when the app opens</string> <string name="open_dialpad_by_default">Open the dialpad by default when the app opens</string>
<string name="disable_proximity_sensor">Disable proximity sensor during calls</string>
<!-- Strings displayed only on Google Playstore. Optional, but good to have --> <!-- Strings displayed only on Google Playstore. Optional, but good to have -->
<!-- App title has to have less than 50 characters. If you cannot squeeze it, just remove a part of it --> <!-- App title has to have less than 50 characters. If you cannot squeeze it, just remove a part of it -->

View File

@ -41,6 +41,7 @@
<!-- Settings --> <!-- Settings -->
<string name="group_subsequent_calls">Группировать последующие вызовы с тем же номером в журнале вызовов</string> <string name="group_subsequent_calls">Группировать последующие вызовы с тем же номером в журнале вызовов</string>
<string name="open_dialpad_by_default">По умолчанию открывать номеронабиратель при запуске приложения</string> <string name="open_dialpad_by_default">По умолчанию открывать номеронабиратель при запуске приложения</string>
<string name="disable_proximity_sensor">Disable proximity sensor during calls</string>
<!-- Strings displayed only on Google Playstore. Optional, but good to have --> <!-- Strings displayed only on Google Playstore. Optional, but good to have -->
<!-- App title has to have less than 50 characters. If you cannot squeeze it, just remove a part of it --> <!-- App title has to have less than 50 characters. If you cannot squeeze it, just remove a part of it -->

View File

@ -41,6 +41,7 @@
<!-- Settings --> <!-- Settings -->
<string name="group_subsequent_calls">Zoskupiť susedné volania s rovnakým číslom v histórií volaní</string> <string name="group_subsequent_calls">Zoskupiť susedné volania s rovnakým číslom v histórií volaní</string>
<string name="open_dialpad_by_default">Otvoriť číselník po spustení apky</string> <string name="open_dialpad_by_default">Otvoriť číselník po spustení apky</string>
<string name="disable_proximity_sensor">Vypnúť počas hovorov senzor priblíženia</string>
<!-- Strings displayed only on Google Playstore. Optional, but good to have --> <!-- Strings displayed only on Google Playstore. Optional, but good to have -->
<!-- App title has to have less than 50 characters. If you cannot squeeze it, just remove a part of it --> <!-- App title has to have less than 50 characters. If you cannot squeeze it, just remove a part of it -->

View File

@ -41,6 +41,7 @@
<!-- Settings --> <!-- Settings -->
<string name="group_subsequent_calls">Gruppera samtal till och från samma nummer i samtalshistoriken</string> <string name="group_subsequent_calls">Gruppera samtal till och från samma nummer i samtalshistoriken</string>
<string name="open_dialpad_by_default">Open the dialpad by default when the app opens</string> <string name="open_dialpad_by_default">Open the dialpad by default when the app opens</string>
<string name="disable_proximity_sensor">Disable proximity sensor during calls</string>
<!-- Strings displayed only on Google Playstore. Optional, but good to have --> <!-- Strings displayed only on Google Playstore. Optional, but good to have -->
<!-- App title has to have less than 50 characters. If you cannot squeeze it, just remove a part of it --> <!-- App title has to have less than 50 characters. If you cannot squeeze it, just remove a part of it -->

View File

@ -41,6 +41,7 @@
<!-- Settings --> <!-- Settings -->
<string name="group_subsequent_calls">Arama kaydında aynı numaraya sahip sonraki aramaları gruplandır</string> <string name="group_subsequent_calls">Arama kaydında aynı numaraya sahip sonraki aramaları gruplandır</string>
<string name="open_dialpad_by_default">Open the dialpad by default when the app opens</string> <string name="open_dialpad_by_default">Open the dialpad by default when the app opens</string>
<string name="disable_proximity_sensor">Disable proximity sensor during calls</string>
<!-- Strings displayed only on Google Playstore. Optional, but good to have --> <!-- Strings displayed only on Google Playstore. Optional, but good to have -->
<!-- App title has to have less than 50 characters. If you cannot squeeze it, just remove a part of it --> <!-- App title has to have less than 50 characters. If you cannot squeeze it, just remove a part of it -->

View File

@ -41,6 +41,7 @@
<!-- Settings --> <!-- Settings -->
<string name="group_subsequent_calls">Group subsequent calls with the same number at the call log</string> <string name="group_subsequent_calls">Group subsequent calls with the same number at the call log</string>
<string name="open_dialpad_by_default">Open the dialpad by default when the app opens</string> <string name="open_dialpad_by_default">Open the dialpad by default when the app opens</string>
<string name="disable_proximity_sensor">Disable proximity sensor during calls</string>
<!-- Strings displayed only on Google Playstore. Optional, but good to have --> <!-- Strings displayed only on Google Playstore. Optional, but good to have -->
<!-- App title has to have less than 50 characters. If you cannot squeeze it, just remove a part of it --> <!-- App title has to have less than 50 characters. If you cannot squeeze it, just remove a part of it -->

View File

@ -41,6 +41,7 @@
<!-- Settings --> <!-- Settings -->
<string name="group_subsequent_calls">在通话记录中将同一号码的后续呼叫合并为一组</string> <string name="group_subsequent_calls">在通话记录中将同一号码的后续呼叫合并为一组</string>
<string name="open_dialpad_by_default">Open the dialpad by default when the app opens</string> <string name="open_dialpad_by_default">Open the dialpad by default when the app opens</string>
<string name="disable_proximity_sensor">Disable proximity sensor during calls</string>
<!-- Strings displayed only on Google Playstore. Optional, but good to have --> <!-- Strings displayed only on Google Playstore. Optional, but good to have -->
<!-- App title has to have less than 50 characters. If you cannot squeeze it, just remove a part of it --> <!-- App title has to have less than 50 characters. If you cannot squeeze it, just remove a part of it -->

View File

@ -41,6 +41,7 @@
<!-- Settings --> <!-- Settings -->
<string name="group_subsequent_calls">Group subsequent calls with the same number at the call log</string> <string name="group_subsequent_calls">Group subsequent calls with the same number at the call log</string>
<string name="open_dialpad_by_default">Open the dialpad by default when the app opens</string> <string name="open_dialpad_by_default">Open the dialpad by default when the app opens</string>
<string name="disable_proximity_sensor">Disable proximity sensor during calls</string>
<!-- Strings displayed only on Google Playstore. Optional, but good to have --> <!-- Strings displayed only on Google Playstore. Optional, but good to have -->
<!-- App title has to have less than 50 characters. If you cannot squeeze it, just remove a part of it --> <!-- App title has to have less than 50 characters. If you cannot squeeze it, just remove a part of it -->